3 lines
1.0 MiB
3 lines
1.0 MiB
/*! For license information please see main.fe5e2acc.js.LICENSE.txt */
|
|
(()=>{var __webpack_modules__={5943:e=>{"use strict";e.exports=function(e,t){var r=new Array(arguments.length-1),n=0,i=2,s=!0;for(;i<arguments.length;)r[n++]=arguments[i++];return new Promise((function(i,o){r[n]=function(e){if(s)if(s=!1,e)o(e);else{for(var t=new Array(arguments.length-1),r=0;r<t.length;)t[r++]=arguments[r];i.apply(null,t)}};try{e.apply(t||null,r)}catch(a){s&&(s=!1,o(a))}}))}},7195:(e,t)=>{"use strict";var r=t;r.length=function(e){var t=e.length;if(!t)return 0;for(var r=0;--t%4>1&&"="===e.charAt(t);)++r;return Math.ceil(3*e.length)/4-r};for(var n=new Array(64),i=new Array(123),s=0;s<64;)i[n[s]=s<26?s+65:s<52?s+71:s<62?s-4:s-59|43]=s++;r.encode=function(e,t,r){for(var i,s=null,o=[],a=0,c=0;t<r;){var l=e[t++];switch(c){case 0:o[a++]=n[l>>2],i=(3&l)<<4,c=1;break;case 1:o[a++]=n[i|l>>4],i=(15&l)<<2,c=2;break;case 2:o[a++]=n[i|l>>6],o[a++]=n[63&l],c=0}a>8191&&((s||(s=[])).push(String.fromCharCode.apply(String,o)),a=0)}return c&&(o[a++]=n[i],o[a++]=61,1===c&&(o[a++]=61)),s?(a&&s.push(String.fromCharCode.apply(String,o.slice(0,a))),s.join("")):String.fromCharCode.apply(String,o.slice(0,a))};var o="invalid encoding";r.decode=function(e,t,r){for(var n,s=r,a=0,c=0;c<e.length;){var l=e.charCodeAt(c++);if(61===l&&a>1)break;if(void 0===(l=i[l]))throw Error(o);switch(a){case 0:n=l,a=1;break;case 1:t[r++]=n<<2|(48&l)>>4,n=l,a=2;break;case 2:t[r++]=(15&n)<<4|(60&l)>>2,n=l,a=3;break;case 3:t[r++]=(3&n)<<6|l,a=0}}if(1===a)throw Error(o);return r-s},r.test=function(e){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(e)}},1035:e=>{"use strict";function t(e,r){"string"===typeof e&&(r=e,e=void 0);var n=[];function i(e){if("string"!==typeof e){var r=s();if(t.verbose&&console.log("codegen: "+r),r="return "+r,e){for(var o=Object.keys(e),a=new Array(o.length+1),c=new Array(o.length),l=0;l<o.length;)a[l]=o[l],c[l]=e[o[l++]];return a[l]=r,Function.apply(null,a).apply(null,c)}return Function(r)()}for(var u=new Array(arguments.length-1),h=0;h<u.length;)u[h]=arguments[++h];if(h=0,e=e.replace(/%([%dfijs])/g,(function(e,t){var r=u[h++];switch(t){case"d":case"f":return String(Number(r));case"i":return String(Math.floor(r));case"j":return JSON.stringify(r);case"s":return String(r)}return"%"})),h!==u.length)throw Error("parameter count mismatch");return n.push(e),i}function s(t){return"function "+(t||r||"")+"("+(e&&e.join(",")||"")+"){\n "+n.join("\n ")+"\n}"}return i.toString=s,i}e.exports=t,t.verbose=!1},3745:e=>{"use strict";function t(){this._listeners={}}e.exports=t,t.prototype.on=function(e,t,r){return(this._listeners[e]||(this._listeners[e]=[])).push({fn:t,ctx:r||this}),this},t.prototype.off=function(e,t){if(void 0===e)this._listeners={};else if(void 0===t)this._listeners[e]=[];else for(var r=this._listeners[e],n=0;n<r.length;)r[n].fn===t?r.splice(n,1):++n;return this},t.prototype.emit=function(e){var t=this._listeners[e];if(t){for(var r=[],n=1;n<arguments.length;)r.push(arguments[n++]);for(n=0;n<t.length;)t[n].fn.apply(t[n++].ctx,r)}return this}},1289:(e,t,r)=>{"use strict";e.exports=s;var n=r(5943),i=r(4638)("fs");function s(e,t,r){return"function"===typeof t?(r=t,t={}):t||(t={}),r?!t.xhr&&i&&i.readFile?i.readFile(e,(function(n,i){return n&&"undefined"!==typeof XMLHttpRequest?s.xhr(e,t,r):n?r(n):r(null,t.binary?i:i.toString("utf8"))})):s.xhr(e,t,r):n(s,this,e,t)}s.xhr=function(e,t,r){var n=new XMLHttpRequest;n.onreadystatechange=function(){if(4===n.readyState){if(0!==n.status&&200!==n.status)return r(Error("status "+n.status));if(t.binary){var e=n.response;if(!e){e=[];for(var i=0;i<n.responseText.length;++i)e.push(255&n.responseText.charCodeAt(i))}return r(null,"undefined"!==typeof Uint8Array?new Uint8Array(e):e)}return r(null,n.responseText)}},t.binary&&("overrideMimeType"in n&&n.overrideMimeType("text/plain; charset=x-user-defined"),n.responseType="arraybuffer"),n.open("GET",e),n.send()}},1448:e=>{"use strict";function t(e){return"undefined"!==typeof Float32Array?function(){var t=new Float32Array([-0]),r=new Uint8Array(t.buffer),n=128===r[3];function i(e,n,i){t[0]=e,n[i]=r[0],n[i+1]=r[1],n[i+2]=r[2],n[i+3]=r[3]}function s(e,n,i){t[0]=e,n[i]=r[3],n[i+1]=r[2],n[i+2]=r[1],n[i+3]=r[0]}function o(e,n){return r[0]=e[n],r[1]=e[n+1],r[2]=e[n+2],r[3]=e[n+3],t[0]}function a(e,n){return r[3]=e[n],r[2]=e[n+1],r[1]=e[n+2],r[0]=e[n+3],t[0]}e.writeFloatLE=n?i:s,e.writeFloatBE=n?s:i,e.readFloatLE=n?o:a,e.readFloatBE=n?a:o}():function(){function t(e,t,r,n){var i=t<0?1:0;if(i&&(t=-t),0===t)e(1/t>0?0:2147483648,r,n);else if(isNaN(t))e(2143289344,r,n);else if(t>34028234663852886e22)e((i<<31|2139095040)>>>0,r,n);else if(t<11754943508222875e-54)e((i<<31|Math.round(t/1401298464324817e-60))>>>0,r,n);else{var s=Math.floor(Math.log(t)/Math.LN2);e((i<<31|s+127<<23|8388607&Math.round(t*Math.pow(2,-s)*8388608))>>>0,r,n)}}function o(e,t,r){var n=e(t,r),i=2*(n>>31)+1,s=n>>>23&255,o=8388607&n;return 255===s?o?NaN:i*(1/0):0===s?1401298464324817e-60*i*o:i*Math.pow(2,s-150)*(o+8388608)}e.writeFloatLE=t.bind(null,r),e.writeFloatBE=t.bind(null,n),e.readFloatLE=o.bind(null,i),e.readFloatBE=o.bind(null,s)}(),"undefined"!==typeof Float64Array?function(){var t=new Float64Array([-0]),r=new Uint8Array(t.buffer),n=128===r[7];function i(e,n,i){t[0]=e,n[i]=r[0],n[i+1]=r[1],n[i+2]=r[2],n[i+3]=r[3],n[i+4]=r[4],n[i+5]=r[5],n[i+6]=r[6],n[i+7]=r[7]}function s(e,n,i){t[0]=e,n[i]=r[7],n[i+1]=r[6],n[i+2]=r[5],n[i+3]=r[4],n[i+4]=r[3],n[i+5]=r[2],n[i+6]=r[1],n[i+7]=r[0]}function o(e,n){return r[0]=e[n],r[1]=e[n+1],r[2]=e[n+2],r[3]=e[n+3],r[4]=e[n+4],r[5]=e[n+5],r[6]=e[n+6],r[7]=e[n+7],t[0]}function a(e,n){return r[7]=e[n],r[6]=e[n+1],r[5]=e[n+2],r[4]=e[n+3],r[3]=e[n+4],r[2]=e[n+5],r[1]=e[n+6],r[0]=e[n+7],t[0]}e.writeDoubleLE=n?i:s,e.writeDoubleBE=n?s:i,e.readDoubleLE=n?o:a,e.readDoubleBE=n?a:o}():function(){function t(e,t,r,n,i,s){var o=n<0?1:0;if(o&&(n=-n),0===n)e(0,i,s+t),e(1/n>0?0:2147483648,i,s+r);else if(isNaN(n))e(0,i,s+t),e(2146959360,i,s+r);else if(n>17976931348623157e292)e(0,i,s+t),e((o<<31|2146435072)>>>0,i,s+r);else{var a;if(n<22250738585072014e-324)e((a=n/5e-324)>>>0,i,s+t),e((o<<31|a/4294967296)>>>0,i,s+r);else{var c=Math.floor(Math.log(n)/Math.LN2);1024===c&&(c=1023),e(4503599627370496*(a=n*Math.pow(2,-c))>>>0,i,s+t),e((o<<31|c+1023<<20|1048576*a&1048575)>>>0,i,s+r)}}}function o(e,t,r,n,i){var s=e(n,i+t),o=e(n,i+r),a=2*(o>>31)+1,c=o>>>20&2047,l=4294967296*(1048575&o)+s;return 2047===c?l?NaN:a*(1/0):0===c?5e-324*a*l:a*Math.pow(2,c-1075)*(l+4503599627370496)}e.writeDoubleLE=t.bind(null,r,0,4),e.writeDoubleBE=t.bind(null,n,4,0),e.readDoubleLE=o.bind(null,i,0,4),e.readDoubleBE=o.bind(null,s,4,0)}(),e}function r(e,t,r){t[r]=255&e,t[r+1]=e>>>8&255,t[r+2]=e>>>16&255,t[r+3]=e>>>24}function n(e,t,r){t[r]=e>>>24,t[r+1]=e>>>16&255,t[r+2]=e>>>8&255,t[r+3]=255&e}function i(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0}function s(e,t){return(e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3])>>>0}e.exports=t(t)},4638:module=>{"use strict";function inquire(moduleName){try{var mod=eval("quire".replace(/^/,"re"))(moduleName);if(mod&&(mod.length||Object.keys(mod).length))return mod}catch(e){}return null}module.exports=inquire},4022:(e,t)=>{"use strict";var r=t,n=r.isAbsolute=function(e){return/^(?:\/|\w+:)/.test(e)},i=r.normalize=function(e){var t=(e=e.replace(/\\/g,"/").replace(/\/{2,}/g,"/")).split("/"),r=n(e),i="";r&&(i=t.shift()+"/");for(var s=0;s<t.length;)".."===t[s]?s>0&&".."!==t[s-1]?t.splice(--s,2):r?t.splice(s,1):++s:"."===t[s]?t.splice(s,1):++s;return i+t.join("/")};r.resolve=function(e,t,r){return r||(t=i(t)),n(t)?t:(r||(e=i(e)),(e=e.replace(/(?:\/|^)[^/]+$/,"")).length?i(e+"/"+t):t)}},8071:e=>{"use strict";e.exports=function(e,t,r){var n=r||8192,i=n>>>1,s=null,o=n;return function(r){if(r<1||r>i)return e(r);o+r>n&&(s=e(n),o=0);var a=t.call(s,o,o+=r);return 7&o&&(o=1+(7|o)),a}}},8557:(e,t)=>{"use strict";var r=t;r.length=function(e){for(var t=0,r=0,n=0;n<e.length;++n)(r=e.charCodeAt(n))<128?t+=1:r<2048?t+=2:55296===(64512&r)&&56320===(64512&e.charCodeAt(n+1))?(++n,t+=4):t+=3;return t},r.read=function(e,t,r){if(r-t<1)return"";for(var n,i=null,s=[],o=0;t<r;)(n=e[t++])<128?s[o++]=n:n>191&&n<224?s[o++]=(31&n)<<6|63&e[t++]:n>239&&n<365?(n=((7&n)<<18|(63&e[t++])<<12|(63&e[t++])<<6|63&e[t++])-65536,s[o++]=55296+(n>>10),s[o++]=56320+(1023&n)):s[o++]=(15&n)<<12|(63&e[t++])<<6|63&e[t++],o>8191&&((i||(i=[])).push(String.fromCharCode.apply(String,s)),o=0);return i?(o&&i.push(String.fromCharCode.apply(String,s.slice(0,o))),i.join("")):String.fromCharCode.apply(String,s.slice(0,o))},r.write=function(e,t,r){for(var n,i,s=r,o=0;o<e.length;++o)(n=e.charCodeAt(o))<128?t[r++]=n:n<2048?(t[r++]=n>>6|192,t[r++]=63&n|128):55296===(64512&n)&&56320===(64512&(i=e.charCodeAt(o+1)))?(n=65536+((1023&n)<<10)+(1023&i),++o,t[r++]=n>>18|240,t[r++]=n>>12&63|128,t[r++]=n>>6&63|128,t[r++]=63&n|128):(t[r++]=n>>12|224,t[r++]=n>>6&63|128,t[r++]=63&n|128);return r-s}},6733:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(411);function i(e,t,r){return void 0===t&&(t=new Uint8Array(2)),void 0===r&&(r=0),t[r+0]=e>>>8,t[r+1]=e>>>0,t}function s(e,t,r){return void 0===t&&(t=new Uint8Array(2)),void 0===r&&(r=0),t[r+0]=e>>>0,t[r+1]=e>>>8,t}function o(e,t){return void 0===t&&(t=0),e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3]}function a(e,t){return void 0===t&&(t=0),(e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3])>>>0}function c(e,t){return void 0===t&&(t=0),e[t+3]<<24|e[t+2]<<16|e[t+1]<<8|e[t]}function l(e,t){return void 0===t&&(t=0),(e[t+3]<<24|e[t+2]<<16|e[t+1]<<8|e[t])>>>0}function u(e,t,r){return void 0===t&&(t=new Uint8Array(4)),void 0===r&&(r=0),t[r+0]=e>>>24,t[r+1]=e>>>16,t[r+2]=e>>>8,t[r+3]=e>>>0,t}function h(e,t,r){return void 0===t&&(t=new Uint8Array(4)),void 0===r&&(r=0),t[r+0]=e>>>0,t[r+1]=e>>>8,t[r+2]=e>>>16,t[r+3]=e>>>24,t}function d(e,t,r){return void 0===t&&(t=new Uint8Array(8)),void 0===r&&(r=0),u(e/4294967296>>>0,t,r),u(e>>>0,t,r+4),t}function f(e,t,r){return void 0===t&&(t=new Uint8Array(8)),void 0===r&&(r=0),h(e>>>0,t,r),h(e/4294967296>>>0,t,r+4),t}t.readInt16BE=function(e,t){return void 0===t&&(t=0),(e[t+0]<<8|e[t+1])<<16>>16},t.readUint16BE=function(e,t){return void 0===t&&(t=0),(e[t+0]<<8|e[t+1])>>>0},t.readInt16LE=function(e,t){return void 0===t&&(t=0),(e[t+1]<<8|e[t])<<16>>16},t.readUint16LE=function(e,t){return void 0===t&&(t=0),(e[t+1]<<8|e[t])>>>0},t.writeUint16BE=i,t.writeInt16BE=i,t.writeUint16LE=s,t.writeInt16LE=s,t.readInt32BE=o,t.readUint32BE=a,t.readInt32LE=c,t.readUint32LE=l,t.writeUint32BE=u,t.writeInt32BE=u,t.writeUint32LE=h,t.writeInt32LE=h,t.readInt64BE=function(e,t){void 0===t&&(t=0);var r=o(e,t),n=o(e,t+4);return 4294967296*r+n-4294967296*(n>>31)},t.readUint64BE=function(e,t){return void 0===t&&(t=0),4294967296*a(e,t)+a(e,t+4)},t.readInt64LE=function(e,t){void 0===t&&(t=0);var r=c(e,t);return 4294967296*c(e,t+4)+r-4294967296*(r>>31)},t.readUint64LE=function(e,t){void 0===t&&(t=0);var r=l(e,t);return 4294967296*l(e,t+4)+r},t.writeUint64BE=d,t.writeInt64BE=d,t.writeUint64LE=f,t.writeInt64LE=f,t.readUintBE=function(e,t,r){if(void 0===r&&(r=0),e%8!==0)throw new Error("readUintBE supports only bitLengths divisible by 8");if(e/8>t.length-r)throw new Error("readUintBE: array is too short for the given bitLength");for(var n=0,i=1,s=e/8+r-1;s>=r;s--)n+=t[s]*i,i*=256;return n},t.readUintLE=function(e,t,r){if(void 0===r&&(r=0),e%8!==0)throw new Error("readUintLE supports only bitLengths divisible by 8");if(e/8>t.length-r)throw new Error("readUintLE: array is too short for the given bitLength");for(var n=0,i=1,s=r;s<r+e/8;s++)n+=t[s]*i,i*=256;return n},t.writeUintBE=function(e,t,r,i){if(void 0===r&&(r=new Uint8Array(e/8)),void 0===i&&(i=0),e%8!==0)throw new Error("writeUintBE supports only bitLengths divisible by 8");if(!n.isSafeInteger(t))throw new Error("writeUintBE value must be an integer");for(var s=1,o=e/8+i-1;o>=i;o--)r[o]=t/s&255,s*=256;return r},t.writeUintLE=function(e,t,r,i){if(void 0===r&&(r=new Uint8Array(e/8)),void 0===i&&(i=0),e%8!==0)throw new Error("writeUintLE supports only bitLengths divisible by 8");if(!n.isSafeInteger(t))throw new Error("writeUintLE value must be an integer");for(var s=1,o=i;o<i+e/8;o++)r[o]=t/s&255,s*=256;return r},t.readFloat32BE=function(e,t){return void 0===t&&(t=0),new DataView(e.buffer,e.byteOffset,e.byteLength).getFloat32(t)},t.readFloat32LE=function(e,t){return void 0===t&&(t=0),new DataView(e.buffer,e.byteOffset,e.byteLength).getFloat32(t,!0)},t.readFloat64BE=function(e,t){return void 0===t&&(t=0),new DataView(e.buffer,e.byteOffset,e.byteLength).getFloat64(t)},t.readFloat64LE=function(e,t){return void 0===t&&(t=0),new DataView(e.buffer,e.byteOffset,e.byteLength).getFloat64(t,!0)},t.writeFloat32BE=function(e,t,r){return void 0===t&&(t=new Uint8Array(4)),void 0===r&&(r=0),new DataView(t.buffer,t.byteOffset,t.byteLength).setFloat32(r,e),t},t.writeFloat32LE=function(e,t,r){return void 0===t&&(t=new Uint8Array(4)),void 0===r&&(r=0),new DataView(t.buffer,t.byteOffset,t.byteLength).setFloat32(r,e,!0),t},t.writeFloat64BE=function(e,t,r){return void 0===t&&(t=new Uint8Array(8)),void 0===r&&(r=0),new DataView(t.buffer,t.byteOffset,t.byteLength).setFloat64(r,e),t},t.writeFloat64LE=function(e,t,r){return void 0===t&&(t=new Uint8Array(8)),void 0===r&&(r=0),new DataView(t.buffer,t.byteOffset,t.byteLength).setFloat64(r,e,!0),t}},1277:(e,t,r)=>{"use strict";var n=r(7003),i=r(5719),s=r(6246),o=r(6733),a=r(2996);t.Cv=32,t.WH=12,t.pg=16;var c=new Uint8Array(16),l=function(){function e(e){if(this.nonceLength=t.WH,this.tagLength=t.pg,e.length!==t.Cv)throw new Error("ChaCha20Poly1305 needs 32-byte key");this._key=new Uint8Array(e)}return e.prototype.seal=function(e,t,r,i){if(e.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");var o=new Uint8Array(16);o.set(e,o.length-e.length);var a=new Uint8Array(32);n.stream(this._key,o,a,4);var c,l=t.length+this.tagLength;if(i){if(i.length!==l)throw new Error("ChaCha20Poly1305: incorrect destination length");c=i}else c=new Uint8Array(l);return n.streamXOR(this._key,o,t,c,4),this._authenticate(c.subarray(c.length-this.tagLength,c.length),a,c.subarray(0,c.length-this.tagLength),r),s.wipe(o),c},e.prototype.open=function(e,t,r,i){if(e.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");if(t.length<this.tagLength)return null;var o=new Uint8Array(16);o.set(e,o.length-e.length);var c=new Uint8Array(32);n.stream(this._key,o,c,4);var l=new Uint8Array(this.tagLength);if(this._authenticate(l,c,t.subarray(0,t.length-this.tagLength),r),!a.equal(l,t.subarray(t.length-this.tagLength,t.length)))return null;var u,h=t.length-this.tagLength;if(i){if(i.length!==h)throw new Error("ChaCha20Poly1305: incorrect destination length");u=i}else u=new Uint8Array(h);return n.streamXOR(this._key,o,t.subarray(0,t.length-this.tagLength),u,4),s.wipe(o),u},e.prototype.clean=function(){return s.wipe(this._key),this},e.prototype._authenticate=function(e,t,r,n){var a=new i.Poly1305(t);n&&(a.update(n),n.length%16>0&&a.update(c.subarray(n.length%16))),a.update(r),r.length%16>0&&a.update(c.subarray(r.length%16));var l=new Uint8Array(8);n&&o.writeUint64LE(n.length,l),a.update(l),o.writeUint64LE(r.length,l),a.update(l);for(var u=a.digest(),h=0;h<u.length;h++)e[h]=u[h];a.clean(),s.wipe(u),s.wipe(l)},e}();t.OK=l},7003:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(6733),i=r(6246);function s(e,t,r){for(var i=1634760805,s=857760878,o=2036477234,a=1797285236,c=r[3]<<24|r[2]<<16|r[1]<<8|r[0],l=r[7]<<24|r[6]<<16|r[5]<<8|r[4],u=r[11]<<24|r[10]<<16|r[9]<<8|r[8],h=r[15]<<24|r[14]<<16|r[13]<<8|r[12],d=r[19]<<24|r[18]<<16|r[17]<<8|r[16],f=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],g=t[3]<<24|t[2]<<16|t[1]<<8|t[0],m=t[7]<<24|t[6]<<16|t[5]<<8|t[4],v=t[11]<<24|t[10]<<16|t[9]<<8|t[8],b=t[15]<<24|t[14]<<16|t[13]<<8|t[12],w=i,E=s,_=o,S=a,I=c,C=l,A=u,T=h,k=d,R=f,P=p,D=y,N=g,x=m,L=v,O=b,B=0;B<20;B+=2)I=(I^=k=k+(N=(N^=w=w+I|0)>>>16|N<<16)|0)>>>20|I<<12,C=(C^=R=R+(x=(x^=E=E+C|0)>>>16|x<<16)|0)>>>20|C<<12,A=(A^=P=P+(L=(L^=_=_+A|0)>>>16|L<<16)|0)>>>20|A<<12,T=(T^=D=D+(O=(O^=S=S+T|0)>>>16|O<<16)|0)>>>20|T<<12,A=(A^=P=P+(L=(L^=_=_+A|0)>>>24|L<<8)|0)>>>25|A<<7,T=(T^=D=D+(O=(O^=S=S+T|0)>>>24|O<<8)|0)>>>25|T<<7,C=(C^=R=R+(x=(x^=E=E+C|0)>>>24|x<<8)|0)>>>25|C<<7,I=(I^=k=k+(N=(N^=w=w+I|0)>>>24|N<<8)|0)>>>25|I<<7,C=(C^=P=P+(O=(O^=w=w+C|0)>>>16|O<<16)|0)>>>20|C<<12,A=(A^=D=D+(N=(N^=E=E+A|0)>>>16|N<<16)|0)>>>20|A<<12,T=(T^=k=k+(x=(x^=_=_+T|0)>>>16|x<<16)|0)>>>20|T<<12,I=(I^=R=R+(L=(L^=S=S+I|0)>>>16|L<<16)|0)>>>20|I<<12,T=(T^=k=k+(x=(x^=_=_+T|0)>>>24|x<<8)|0)>>>25|T<<7,I=(I^=R=R+(L=(L^=S=S+I|0)>>>24|L<<8)|0)>>>25|I<<7,A=(A^=D=D+(N=(N^=E=E+A|0)>>>24|N<<8)|0)>>>25|A<<7,C=(C^=P=P+(O=(O^=w=w+C|0)>>>24|O<<8)|0)>>>25|C<<7;n.writeUint32LE(w+i|0,e,0),n.writeUint32LE(E+s|0,e,4),n.writeUint32LE(_+o|0,e,8),n.writeUint32LE(S+a|0,e,12),n.writeUint32LE(I+c|0,e,16),n.writeUint32LE(C+l|0,e,20),n.writeUint32LE(A+u|0,e,24),n.writeUint32LE(T+h|0,e,28),n.writeUint32LE(k+d|0,e,32),n.writeUint32LE(R+f|0,e,36),n.writeUint32LE(P+p|0,e,40),n.writeUint32LE(D+y|0,e,44),n.writeUint32LE(N+g|0,e,48),n.writeUint32LE(x+m|0,e,52),n.writeUint32LE(L+v|0,e,56),n.writeUint32LE(O+b|0,e,60)}function o(e,t,r,n,o){if(void 0===o&&(o=0),32!==e.length)throw new Error("ChaCha: key size must be 32 bytes");if(n.length<r.length)throw new Error("ChaCha: destination is shorter than source");var c,l;if(0===o){if(8!==t.length&&12!==t.length)throw new Error("ChaCha nonce must be 8 or 12 bytes");l=(c=new Uint8Array(16)).length-t.length,c.set(t,l)}else{if(16!==t.length)throw new Error("ChaCha nonce with counter must be 16 bytes");c=t,l=o}for(var u=new Uint8Array(64),h=0;h<r.length;h+=64){s(u,c,e);for(var d=h;d<h+64&&d<r.length;d++)n[d]=r[d]^u[d-h];a(c,0,l)}return i.wipe(u),0===o&&i.wipe(c),n}function a(e,t,r){for(var n=1;r--;)n=n+(255&e[t])|0,e[t]=255&n,n>>>=8,t++;if(n>0)throw new Error("ChaCha: counter overflow")}t.streamXOR=o,t.stream=function(e,t,r,n){return void 0===n&&(n=0),i.wipe(r),o(e,t,r,r,n)}},2996:(e,t)=>{"use strict";function r(e,t){if(e.length!==t.length)return 0;for(var r=0,n=0;n<e.length;n++)r|=e[n]^t[n];return 1&r-1>>>8}Object.defineProperty(t,"__esModule",{value:!0}),t.select=function(e,t,r){return~(e-1)&t|e-1&r},t.lessOrEqual=function(e,t){return(0|e)-(0|t)-1>>>31&1},t.compare=r,t.equal=function(e,t){return 0!==e.length&&0!==t.length&&0!==r(e,t)}},2114:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isSerializableHash=function(e){return"undefined"!==typeof e.saveState&&"undefined"!==typeof e.restoreState&&"undefined"!==typeof e.cleanSavedState}},7397:(e,t,r)=>{"use strict";var n=r(5366),i=r(6246),s=function(){function e(e,t,r,i){void 0===r&&(r=new Uint8Array(0)),this._counter=new Uint8Array(1),this._hash=e,this._info=i;var s=n.hmac(this._hash,r,t);this._hmac=new n.HMAC(e,s),this._buffer=new Uint8Array(this._hmac.digestLength),this._bufpos=this._buffer.length}return e.prototype._fillBuffer=function(){this._counter[0]++;var e=this._counter[0];if(0===e)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},e.prototype.expand=function(e){for(var t=new Uint8Array(e),r=0;r<t.length;r++)this._bufpos===this._buffer.length&&this._fillBuffer(),t[r]=this._buffer[this._bufpos++];return t},e.prototype.clean=function(){this._hmac.clean(),i.wipe(this._buffer),i.wipe(this._counter),this._bufpos=0},e}();t.t=s},5366:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(2114),i=r(2996),s=r(6246),o=function(){function e(e,t){this._finished=!1,this._inner=new e,this._outer=new e,this.blockSize=this._outer.blockSize,this.digestLength=this._outer.digestLength;var r=new Uint8Array(this.blockSize);t.length>this.blockSize?this._inner.update(t).finish(r).clean():r.set(t);for(var i=0;i<r.length;i++)r[i]^=54;this._inner.update(r);for(i=0;i<r.length;i++)r[i]^=106;this._outer.update(r),n.isSerializableHash(this._inner)&&n.isSerializableHash(this._outer)&&(this._innerKeyedState=this._inner.saveState(),this._outerKeyedState=this._outer.saveState()),s.wipe(r)}return e.prototype.reset=function(){if(!n.isSerializableHash(this._inner)||!n.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},e.prototype.clean=function(){n.isSerializableHash(this._inner)&&this._inner.cleanSavedState(this._innerKeyedState),n.isSerializableHash(this._outer)&&this._outer.cleanSavedState(this._outerKeyedState),this._inner.clean(),this._outer.clean()},e.prototype.update=function(e){return this._inner.update(e),this},e.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)},e.prototype.digest=function(){var e=new Uint8Array(this.digestLength);return this.finish(e),e},e.prototype.saveState=function(){if(!n.isSerializableHash(this._inner))throw new Error("hmac: can't saveState() because hash doesn't implement it");return this._inner.saveState()},e.prototype.restoreState=function(e){if(!n.isSerializableHash(this._inner)||!n.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},e.prototype.cleanSavedState=function(e){if(!n.isSerializableHash(this._inner))throw new Error("hmac: can't cleanSavedState() because hash doesn't implement it");this._inner.cleanSavedState(e)},e}();t.HMAC=o,t.hmac=function(e,t,r){var n=new o(e,t);n.update(r);var i=n.digest();return n.clean(),i},t.equal=i.equal},411:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.mul=Math.imul||function(e,t){var r=65535&e,n=65535&t;return r*n+((e>>>16&65535)*n+r*(t>>>16&65535)<<16>>>0)|0},t.add=function(e,t){return e+t|0},t.sub=function(e,t){return e-t|0},t.rotl=function(e,t){return e<<t|e>>>32-t},t.rotr=function(e,t){return e<<32-t|e>>>t},t.isInteger=Number.isInteger||function(e){return"number"===typeof e&&isFinite(e)&&Math.floor(e)===e},t.MAX_SAFE_INTEGER=9007199254740991,t.isSafeInteger=function(e){return t.isInteger(e)&&e>=-t.MAX_SAFE_INTEGER&&e<=t.MAX_SAFE_INTEGER}},5719:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(2996),i=r(6246);t.DIGEST_LENGTH=16;var s=function(){function e(e){this.digestLength=t.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]=8191&r;var n=e[2]|e[3]<<8;this._r[1]=8191&(r>>>13|n<<3);var i=e[4]|e[5]<<8;this._r[2]=7939&(n>>>10|i<<6);var s=e[6]|e[7]<<8;this._r[3]=8191&(i>>>7|s<<9);var o=e[8]|e[9]<<8;this._r[4]=255&(s>>>4|o<<12),this._r[5]=o>>>1&8190;var a=e[10]|e[11]<<8;this._r[6]=8191&(o>>>14|a<<2);var c=e[12]|e[13]<<8;this._r[7]=8065&(a>>>11|c<<5);var l=e[14]|e[15]<<8;this._r[8]=8191&(c>>>8|l<<8),this._r[9]=l>>>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 e.prototype._blocks=function(e,t,r){for(var n=this._fin?0:2048,i=this._h[0],s=this._h[1],o=this._h[2],a=this._h[3],c=this._h[4],l=this._h[5],u=this._h[6],h=this._h[7],d=this._h[8],f=this._h[9],p=this._r[0],y=this._r[1],g=this._r[2],m=this._r[3],v=this._r[4],b=this._r[5],w=this._r[6],E=this._r[7],_=this._r[8],S=this._r[9];r>=16;){var I=e[t+0]|e[t+1]<<8;i+=8191&I;var C=e[t+2]|e[t+3]<<8;s+=8191&(I>>>13|C<<3);var A=e[t+4]|e[t+5]<<8;o+=8191&(C>>>10|A<<6);var T=e[t+6]|e[t+7]<<8;a+=8191&(A>>>7|T<<9);var k=e[t+8]|e[t+9]<<8;c+=8191&(T>>>4|k<<12),l+=k>>>1&8191;var R=e[t+10]|e[t+11]<<8;u+=8191&(k>>>14|R<<2);var P=e[t+12]|e[t+13]<<8;h+=8191&(R>>>11|P<<5);var D=e[t+14]|e[t+15]<<8,N=0,x=N;x+=i*p,x+=s*(5*S),x+=o*(5*_),x+=a*(5*E),N=(x+=c*(5*w))>>>13,x&=8191,x+=l*(5*b),x+=u*(5*v),x+=h*(5*m),x+=(d+=8191&(P>>>8|D<<8))*(5*g);var L=N+=(x+=(f+=D>>>5|n)*(5*y))>>>13;L+=i*y,L+=s*p,L+=o*(5*S),L+=a*(5*_),N=(L+=c*(5*E))>>>13,L&=8191,L+=l*(5*w),L+=u*(5*b),L+=h*(5*v),L+=d*(5*m),N+=(L+=f*(5*g))>>>13,L&=8191;var O=N;O+=i*g,O+=s*y,O+=o*p,O+=a*(5*S),N=(O+=c*(5*_))>>>13,O&=8191,O+=l*(5*E),O+=u*(5*w),O+=h*(5*b),O+=d*(5*v);var B=N+=(O+=f*(5*m))>>>13;B+=i*m,B+=s*g,B+=o*y,B+=a*p,N=(B+=c*(5*S))>>>13,B&=8191,B+=l*(5*_),B+=u*(5*E),B+=h*(5*w),B+=d*(5*b);var M=N+=(B+=f*(5*v))>>>13;M+=i*v,M+=s*m,M+=o*g,M+=a*y,N=(M+=c*p)>>>13,M&=8191,M+=l*(5*S),M+=u*(5*_),M+=h*(5*E),M+=d*(5*w);var U=N+=(M+=f*(5*b))>>>13;U+=i*b,U+=s*v,U+=o*m,U+=a*g,N=(U+=c*y)>>>13,U&=8191,U+=l*p,U+=u*(5*S),U+=h*(5*_),U+=d*(5*E);var F=N+=(U+=f*(5*w))>>>13;F+=i*w,F+=s*b,F+=o*v,F+=a*m,N=(F+=c*g)>>>13,F&=8191,F+=l*y,F+=u*p,F+=h*(5*S),F+=d*(5*_);var V=N+=(F+=f*(5*E))>>>13;V+=i*E,V+=s*w,V+=o*b,V+=a*v,N=(V+=c*m)>>>13,V&=8191,V+=l*g,V+=u*y,V+=h*p,V+=d*(5*S);var j=N+=(V+=f*(5*_))>>>13;j+=i*_,j+=s*E,j+=o*w,j+=a*b,N=(j+=c*v)>>>13,j&=8191,j+=l*m,j+=u*g,j+=h*y,j+=d*p;var K=N+=(j+=f*(5*S))>>>13;K+=i*S,K+=s*_,K+=o*E,K+=a*w,N=(K+=c*b)>>>13,K&=8191,K+=l*v,K+=u*m,K+=h*g,K+=d*y,i=x=8191&(N=(N=((N+=(K+=f*p)>>>13)<<2)+N|0)+(x&=8191)|0),s=L+=N>>>=13,o=O&=8191,a=B&=8191,c=M&=8191,l=U&=8191,u=F&=8191,h=V&=8191,d=j&=8191,f=K&=8191,t+=16,r-=16}this._h[0]=i,this._h[1]=s,this._h[2]=o,this._h[3]=a,this._h[4]=c,this._h[5]=l,this._h[6]=u,this._h[7]=h,this._h[8]=d,this._h[9]=f},e.prototype.finish=function(e,t){void 0===t&&(t=0);var r,n,i,s,o=new Uint16Array(10);if(this._leftover){for(s=this._leftover,this._buffer[s++]=1;s<16;s++)this._buffer[s]=0;this._fin=1,this._blocks(this._buffer,0,16)}for(r=this._h[1]>>>13,this._h[1]&=8191,s=2;s<10;s++)this._h[s]+=r,r=this._h[s]>>>13,this._h[s]&=8191;for(this._h[0]+=5*r,r=this._h[0]>>>13,this._h[0]&=8191,this._h[1]+=r,r=this._h[1]>>>13,this._h[1]&=8191,this._h[2]+=r,o[0]=this._h[0]+5,r=o[0]>>>13,o[0]&=8191,s=1;s<10;s++)o[s]=this._h[s]+r,r=o[s]>>>13,o[s]&=8191;for(o[9]-=8192,n=(1^r)-1,s=0;s<10;s++)o[s]&=n;for(n=~n,s=0;s<10;s++)this._h[s]=this._h[s]&n|o[s];for(this._h[0]=65535&(this._h[0]|this._h[1]<<13),this._h[1]=65535&(this._h[1]>>>3|this._h[2]<<10),this._h[2]=65535&(this._h[2]>>>6|this._h[3]<<7),this._h[3]=65535&(this._h[3]>>>9|this._h[4]<<4),this._h[4]=65535&(this._h[4]>>>12|this._h[5]<<1|this._h[6]<<14),this._h[5]=65535&(this._h[6]>>>2|this._h[7]<<11),this._h[6]=65535&(this._h[7]>>>5|this._h[8]<<8),this._h[7]=65535&(this._h[8]>>>8|this._h[9]<<5),i=this._h[0]+this._pad[0],this._h[0]=65535&i,s=1;s<8;s++)i=(this._h[s]+this._pad[s]|0)+(i>>>16)|0,this._h[s]=65535&i;return e[t+0]=this._h[0]>>>0,e[t+1]=this._h[0]>>>8,e[t+2]=this._h[1]>>>0,e[t+3]=this._h[1]>>>8,e[t+4]=this._h[2]>>>0,e[t+5]=this._h[2]>>>8,e[t+6]=this._h[3]>>>0,e[t+7]=this._h[3]>>>8,e[t+8]=this._h[4]>>>0,e[t+9]=this._h[4]>>>8,e[t+10]=this._h[5]>>>0,e[t+11]=this._h[5]>>>8,e[t+12]=this._h[6]>>>0,e[t+13]=this._h[6]>>>8,e[t+14]=this._h[7]>>>0,e[t+15]=this._h[7]>>>8,this._finished=!0,this},e.prototype.update=function(e){var t,r=0,n=e.length;if(this._leftover){(t=16-this._leftover)>n&&(t=n);for(var i=0;i<t;i++)this._buffer[this._leftover+i]=e[r+i];if(n-=t,r+=t,this._leftover+=t,this._leftover<16)return this;this._blocks(this._buffer,0,16),this._leftover=0}if(n>=16&&(t=n-n%16,this._blocks(e,r,t),r+=t,n-=t),n){for(i=0;i<n;i++)this._buffer[this._leftover+i]=e[r+i];this._leftover+=n}return this},e.prototype.digest=function(){if(this._finished)throw new Error("Poly1305 was finished");var e=new Uint8Array(16);return this.finish(e),e},e.prototype.clean=function(){return i.wipe(this._buffer),i.wipe(this._r),i.wipe(this._h),i.wipe(this._pad),this._leftover=0,this._fin=0,this._finished=!0,this},e}();t.Poly1305=s,t.oneTimeAuth=function(e,t){var r=new s(e);r.update(t);var n=r.digest();return r.clean(),n},t.equal=function(e,r){return e.length===t.DIGEST_LENGTH&&r.length===t.DIGEST_LENGTH&&n.equal(e,r)}},2066:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(2912),i=r(6733),s=r(6246);function o(e,r){return void 0===r&&(r=t.defaultRandomSource),r.randomBytes(e)}t.defaultRandomSource=new n.SystemRandomSource,t.randomBytes=o,t.randomUint32=function(e){void 0===e&&(e=t.defaultRandomSource);var r=o(4,e),n=i.readUint32LE(r);return s.wipe(r),n};var a="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";function c(e,r,n){if(void 0===r&&(r=a),void 0===n&&(n=t.defaultRandomSource),r.length<2)throw new Error("randomString charset is too short");if(r.length>256)throw new Error("randomString charset is too long");for(var i="",c=r.length,l=256-256%c;e>0;){for(var u=o(Math.ceil(256*e/l),n),h=0;h<u.length&&e>0;h++){var d=u[h];d<l&&(i+=r.charAt(d%c),e--)}s.wipe(u)}return i}t.randomString=c,t.randomStringForEntropy=function(e,r,n){return void 0===r&&(r=a),void 0===n&&(n=t.defaultRandomSource),c(Math.ceil(e/(Math.log(r.length)/Math.LN2)),r,n)}},37:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(){this.isAvailable=!1,this.isInstantiated=!1;var e="undefined"!==typeof self?self.crypto||self.msCrypto:null;e&&e.getRandomValues&&(this._crypto=e,this.isAvailable=!0,this.isInstantiated=!0)}return e.prototype.randomBytes=function(e){if(!this.isAvailable||!this._crypto)throw new Error("Browser random byte generator is not available.");for(var t=new Uint8Array(e),r=0;r<t.length;r+=65536)this._crypto.getRandomValues(t.subarray(r,r+Math.min(t.length-r,65536)));return t},e}();t.BrowserRandomSource=r},3629:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(6246),i=function(){function e(){this.isAvailable=!1,this.isInstantiated=!1;var e=r(1665);e&&e.randomBytes&&(this._crypto=e,this.isAvailable=!0,this.isInstantiated=!0)}return e.prototype.randomBytes=function(e){if(!this.isAvailable||!this._crypto)throw new Error("Node.js random byte generator is not available.");var t=this._crypto.randomBytes(e);if(t.length!==e)throw new Error("NodeRandomSource: got fewer bytes than requested");for(var r=new Uint8Array(e),i=0;i<r.length;i++)r[i]=t[i];return n.wipe(t),r},e}();t.NodeRandomSource=i},2912:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(37),i=r(3629),s=function(){function e(){return this.isAvailable=!1,this.name="",this._source=new n.BrowserRandomSource,this._source.isAvailable?(this.isAvailable=!0,void(this.name="Browser")):(this._source=new i.NodeRandomSource,this._source.isAvailable?(this.isAvailable=!0,void(this.name="Node")):void 0)}return e.prototype.randomBytes=function(e){if(!this.isAvailable)throw new Error("System random byte generator is not available.");return this._source.randomBytes(e)},e}();t.SystemRandomSource=s},4791:(e,t,r)=>{"use strict";var n=r(6733),i=r(6246);t.k=32,t.cn=64;var s=function(){function e(){this.digestLength=t.k,this.blockSize=t.cn,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 e.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},e.prototype.reset=function(){return this._initState(),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this},e.prototype.clean=function(){i.wipe(this._buffer),i.wipe(this._temp),this.reset()},e.prototype.update=function(e,t){if(void 0===t&&(t=e.length),this._finished)throw new Error("SHA256: can't update because hash was finished.");var r=0;if(this._bytesHashed+=t,this._bufferLength>0){for(;this._bufferLength<this.blockSize&&t>0;)this._buffer[this._bufferLength++]=e[r++],t--;this._bufferLength===this.blockSize&&(a(this._temp,this._state,this._buffer,0,this.blockSize),this._bufferLength=0)}for(t>=this.blockSize&&(r=a(this._temp,this._state,e,r,t),t%=this.blockSize);t>0;)this._buffer[this._bufferLength++]=e[r++],t--;return this},e.prototype.finish=function(e){if(!this._finished){var t=this._bytesHashed,r=this._bufferLength,i=t/536870912|0,s=t<<3,o=t%64<56?64:128;this._buffer[r]=128;for(var c=r+1;c<o-8;c++)this._buffer[c]=0;n.writeUint32BE(i,this._buffer,o-8),n.writeUint32BE(s,this._buffer,o-4),a(this._temp,this._state,this._buffer,0,o),this._finished=!0}for(c=0;c<this.digestLength/4;c++)n.writeUint32BE(this._state[c],e,4*c);return this},e.prototype.digest=function(){var e=new Uint8Array(this.digestLength);return this.finish(e),e},e.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}},e.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},e.prototype.cleanSavedState=function(e){i.wipe(e.state),e.buffer&&i.wipe(e.buffer),e.bufferLength=0,e.bytesHashed=0},e}();t.mE=s;var o=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 a(e,t,r,i,s){for(;s>=64;){for(var a=t[0],c=t[1],l=t[2],u=t[3],h=t[4],d=t[5],f=t[6],p=t[7],y=0;y<16;y++){var g=i+4*y;e[y]=n.readUint32BE(r,g)}for(y=16;y<64;y++){var m=e[y-2],v=(m>>>17|m<<15)^(m>>>19|m<<13)^m>>>10,b=((m=e[y-15])>>>7|m<<25)^(m>>>18|m<<14)^m>>>3;e[y]=(v+e[y-7]|0)+(b+e[y-16]|0)}for(y=0;y<64;y++){v=(((h>>>6|h<<26)^(h>>>11|h<<21)^(h>>>25|h<<7))+(h&d^~h&f)|0)+(p+(o[y]+e[y]|0)|0)|0,b=((a>>>2|a<<30)^(a>>>13|a<<19)^(a>>>22|a<<10))+(a&c^a&l^c&l)|0;p=f,f=d,d=h,h=u+v|0,u=l,l=c,c=a,a=v+b|0}t[0]+=a,t[1]+=c,t[2]+=l,t[3]+=u,t[4]+=h,t[5]+=d,t[6]+=f,t[7]+=p,i+=64,s-=64}return i}t.vp=function(e){var t=new s;t.update(e);var r=t.digest();return t.clean(),r}},6246:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.wipe=function(e){for(var t=0;t<e.length;t++)e[t]=0;return e}},1063:(e,t,r)=>{"use strict";var n=r(2066),i=r(6246);function s(e){var t=new Float64Array(16);if(e)for(var r=0;r<e.length;r++)t[r]=e[r];return t}t.kz=32,t.KS=32;var o=new Uint8Array(32);o[0]=9;var a=s([56129,1]);function c(e){for(var t=1,r=0;r<16;r++){var n=e[r]+t+65535;t=Math.floor(n/65536),e[r]=n-65536*t}e[0]+=t-1+37*(t-1)}function l(e,t,r){for(var n=~(r-1),i=0;i<16;i++){var s=n&(e[i]^t[i]);e[i]^=s,t[i]^=s}}function u(e,t,r){for(var n=0;n<16;n++)e[n]=t[n]+r[n]}function h(e,t,r){for(var n=0;n<16;n++)e[n]=t[n]-r[n]}function d(e,t,r){var n,i,s=0,o=0,a=0,c=0,l=0,u=0,h=0,d=0,f=0,p=0,y=0,g=0,m=0,v=0,b=0,w=0,E=0,_=0,S=0,I=0,C=0,A=0,T=0,k=0,R=0,P=0,D=0,N=0,x=0,L=0,O=0,B=r[0],M=r[1],U=r[2],F=r[3],V=r[4],j=r[5],K=r[6],q=r[7],z=r[8],H=r[9],W=r[10],G=r[11],Q=r[12],Y=r[13],$=r[14],X=r[15];s+=(n=t[0])*B,o+=n*M,a+=n*U,c+=n*F,l+=n*V,u+=n*j,h+=n*K,d+=n*q,f+=n*z,p+=n*H,y+=n*W,g+=n*G,m+=n*Q,v+=n*Y,b+=n*$,w+=n*X,o+=(n=t[1])*B,a+=n*M,c+=n*U,l+=n*F,u+=n*V,h+=n*j,d+=n*K,f+=n*q,p+=n*z,y+=n*H,g+=n*W,m+=n*G,v+=n*Q,b+=n*Y,w+=n*$,E+=n*X,a+=(n=t[2])*B,c+=n*M,l+=n*U,u+=n*F,h+=n*V,d+=n*j,f+=n*K,p+=n*q,y+=n*z,g+=n*H,m+=n*W,v+=n*G,b+=n*Q,w+=n*Y,E+=n*$,_+=n*X,c+=(n=t[3])*B,l+=n*M,u+=n*U,h+=n*F,d+=n*V,f+=n*j,p+=n*K,y+=n*q,g+=n*z,m+=n*H,v+=n*W,b+=n*G,w+=n*Q,E+=n*Y,_+=n*$,S+=n*X,l+=(n=t[4])*B,u+=n*M,h+=n*U,d+=n*F,f+=n*V,p+=n*j,y+=n*K,g+=n*q,m+=n*z,v+=n*H,b+=n*W,w+=n*G,E+=n*Q,_+=n*Y,S+=n*$,I+=n*X,u+=(n=t[5])*B,h+=n*M,d+=n*U,f+=n*F,p+=n*V,y+=n*j,g+=n*K,m+=n*q,v+=n*z,b+=n*H,w+=n*W,E+=n*G,_+=n*Q,S+=n*Y,I+=n*$,C+=n*X,h+=(n=t[6])*B,d+=n*M,f+=n*U,p+=n*F,y+=n*V,g+=n*j,m+=n*K,v+=n*q,b+=n*z,w+=n*H,E+=n*W,_+=n*G,S+=n*Q,I+=n*Y,C+=n*$,A+=n*X,d+=(n=t[7])*B,f+=n*M,p+=n*U,y+=n*F,g+=n*V,m+=n*j,v+=n*K,b+=n*q,w+=n*z,E+=n*H,_+=n*W,S+=n*G,I+=n*Q,C+=n*Y,A+=n*$,T+=n*X,f+=(n=t[8])*B,p+=n*M,y+=n*U,g+=n*F,m+=n*V,v+=n*j,b+=n*K,w+=n*q,E+=n*z,_+=n*H,S+=n*W,I+=n*G,C+=n*Q,A+=n*Y,T+=n*$,k+=n*X,p+=(n=t[9])*B,y+=n*M,g+=n*U,m+=n*F,v+=n*V,b+=n*j,w+=n*K,E+=n*q,_+=n*z,S+=n*H,I+=n*W,C+=n*G,A+=n*Q,T+=n*Y,k+=n*$,R+=n*X,y+=(n=t[10])*B,g+=n*M,m+=n*U,v+=n*F,b+=n*V,w+=n*j,E+=n*K,_+=n*q,S+=n*z,I+=n*H,C+=n*W,A+=n*G,T+=n*Q,k+=n*Y,R+=n*$,P+=n*X,g+=(n=t[11])*B,m+=n*M,v+=n*U,b+=n*F,w+=n*V,E+=n*j,_+=n*K,S+=n*q,I+=n*z,C+=n*H,A+=n*W,T+=n*G,k+=n*Q,R+=n*Y,P+=n*$,D+=n*X,m+=(n=t[12])*B,v+=n*M,b+=n*U,w+=n*F,E+=n*V,_+=n*j,S+=n*K,I+=n*q,C+=n*z,A+=n*H,T+=n*W,k+=n*G,R+=n*Q,P+=n*Y,D+=n*$,N+=n*X,v+=(n=t[13])*B,b+=n*M,w+=n*U,E+=n*F,_+=n*V,S+=n*j,I+=n*K,C+=n*q,A+=n*z,T+=n*H,k+=n*W,R+=n*G,P+=n*Q,D+=n*Y,N+=n*$,x+=n*X,b+=(n=t[14])*B,w+=n*M,E+=n*U,_+=n*F,S+=n*V,I+=n*j,C+=n*K,A+=n*q,T+=n*z,k+=n*H,R+=n*W,P+=n*G,D+=n*Q,N+=n*Y,x+=n*$,L+=n*X,w+=(n=t[15])*B,o+=38*(_+=n*U),a+=38*(S+=n*F),c+=38*(I+=n*V),l+=38*(C+=n*j),u+=38*(A+=n*K),h+=38*(T+=n*q),d+=38*(k+=n*z),f+=38*(R+=n*H),p+=38*(P+=n*W),y+=38*(D+=n*G),g+=38*(N+=n*Q),m+=38*(x+=n*Y),v+=38*(L+=n*$),b+=38*(O+=n*X),s=(n=(s+=38*(E+=n*M))+(i=1)+65535)-65536*(i=Math.floor(n/65536)),o=(n=o+i+65535)-65536*(i=Math.floor(n/65536)),a=(n=a+i+65535)-65536*(i=Math.floor(n/65536)),c=(n=c+i+65535)-65536*(i=Math.floor(n/65536)),l=(n=l+i+65535)-65536*(i=Math.floor(n/65536)),u=(n=u+i+65535)-65536*(i=Math.floor(n/65536)),h=(n=h+i+65535)-65536*(i=Math.floor(n/65536)),d=(n=d+i+65535)-65536*(i=Math.floor(n/65536)),f=(n=f+i+65535)-65536*(i=Math.floor(n/65536)),p=(n=p+i+65535)-65536*(i=Math.floor(n/65536)),y=(n=y+i+65535)-65536*(i=Math.floor(n/65536)),g=(n=g+i+65535)-65536*(i=Math.floor(n/65536)),m=(n=m+i+65535)-65536*(i=Math.floor(n/65536)),v=(n=v+i+65535)-65536*(i=Math.floor(n/65536)),b=(n=b+i+65535)-65536*(i=Math.floor(n/65536)),w=(n=w+i+65535)-65536*(i=Math.floor(n/65536)),s=(n=(s+=i-1+37*(i-1))+(i=1)+65535)-65536*(i=Math.floor(n/65536)),o=(n=o+i+65535)-65536*(i=Math.floor(n/65536)),a=(n=a+i+65535)-65536*(i=Math.floor(n/65536)),c=(n=c+i+65535)-65536*(i=Math.floor(n/65536)),l=(n=l+i+65535)-65536*(i=Math.floor(n/65536)),u=(n=u+i+65535)-65536*(i=Math.floor(n/65536)),h=(n=h+i+65535)-65536*(i=Math.floor(n/65536)),d=(n=d+i+65535)-65536*(i=Math.floor(n/65536)),f=(n=f+i+65535)-65536*(i=Math.floor(n/65536)),p=(n=p+i+65535)-65536*(i=Math.floor(n/65536)),y=(n=y+i+65535)-65536*(i=Math.floor(n/65536)),g=(n=g+i+65535)-65536*(i=Math.floor(n/65536)),m=(n=m+i+65535)-65536*(i=Math.floor(n/65536)),v=(n=v+i+65535)-65536*(i=Math.floor(n/65536)),b=(n=b+i+65535)-65536*(i=Math.floor(n/65536)),w=(n=w+i+65535)-65536*(i=Math.floor(n/65536)),s+=i-1+37*(i-1),e[0]=s,e[1]=o,e[2]=a,e[3]=c,e[4]=l,e[5]=u,e[6]=h,e[7]=d,e[8]=f,e[9]=p,e[10]=y,e[11]=g,e[12]=m,e[13]=v,e[14]=b,e[15]=w}function f(e,t){d(e,t,t)}function p(e,t){for(var r=new Uint8Array(32),n=new Float64Array(80),i=s(),o=s(),p=s(),y=s(),g=s(),m=s(),v=0;v<31;v++)r[v]=e[v];r[31]=127&e[31]|64,r[0]&=248,function(e,t){for(var r=0;r<16;r++)e[r]=t[2*r]+(t[2*r+1]<<8);e[15]&=32767}(n,t);for(v=0;v<16;v++)o[v]=n[v];i[0]=y[0]=1;for(v=254;v>=0;--v){var b=r[v>>>3]>>>(7&v)&1;l(i,o,b),l(p,y,b),u(g,i,p),h(i,i,p),u(p,o,y),h(o,o,y),f(y,g),f(m,i),d(i,p,i),d(p,o,g),u(g,i,p),h(i,i,p),f(o,i),h(p,y,m),d(i,p,a),u(i,i,y),d(p,p,i),d(i,y,m),d(y,o,n),f(o,g),l(i,o,b),l(p,y,b)}for(v=0;v<16;v++)n[v+16]=i[v],n[v+32]=p[v],n[v+48]=o[v],n[v+64]=y[v];var w=n.subarray(32),E=n.subarray(16);!function(e,t){for(var r=s(),n=0;n<16;n++)r[n]=t[n];for(n=253;n>=0;n--)f(r,r),2!==n&&4!==n&&d(r,r,t);for(n=0;n<16;n++)e[n]=r[n]}(w,w),d(E,E,w);var _=new Uint8Array(32);return function(e,t){for(var r=s(),n=s(),i=0;i<16;i++)n[i]=t[i];c(n),c(n),c(n);for(var o=0;o<2;o++){for(r[0]=n[0]-65517,i=1;i<15;i++)r[i]=n[i]-65535-(r[i-1]>>16&1),r[i-1]&=65535;r[15]=n[15]-32767-(r[14]>>16&1);var a=r[15]>>16&1;r[14]&=65535,l(n,r,1-a)}for(i=0;i<16;i++)e[2*i]=255&n[i],e[2*i+1]=n[i]>>8}(_,E),_}function y(e){return p(e,o)}function g(e){if(e.length!==t.KS)throw new Error("x25519: seed must be "+t.KS+" bytes");var r=new Uint8Array(e);return{publicKey:y(r),secretKey:r}}t._w=g,t.Au=function(e){var t=n.randomBytes(32,e),r=g(t);return i.wipe(t),r},t.gi=function(e,r,n){if(void 0===n&&(n=!1),e.length!==t.kz)throw new Error("X25519: incorrect secret key length");if(r.length!==t.kz)throw new Error("X25519: incorrect public key length");var i=p(e,r);if(n){for(var s=0,o=0;o<i.length;o++)s|=i[o];if(0===s)throw new Error("X25519: invalid shared key")}return i}},5832:e=>{function t(e){const t=new globalThis.AbortController;function r(){t.abort();for(const t of e)t&&t.removeEventListener&&t.removeEventListener("abort",r)}for(const n of e)if(n&&n.addEventListener){if(n.aborted){r();break}n.addEventListener("abort",r)}return t.signal}e.exports=t,e.exports.anySignal=t},7420:(e,t,r)=>{t.formatArgs=function(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;const r="color: "+this.color;t.splice(1,0,r,"color: inherit");let n=0,i=0;t[0].replace(/%[a-zA-Z%]/g,(e=>{"%%"!==e&&(n++,"%c"===e&&(i=n))})),t.splice(i,0,r)},t.save=function(e){try{e?t.storage.setItem("debug",e):t.storage.removeItem("debug")}catch(r){}},t.load=function(){let e;try{e=t.storage.getItem("debug")}catch(r){}!e&&"undefined"!==typeof process&&"env"in process&&(e={NODE_ENV:"production",PUBLIC_URL:"/relay-reactjs-chat",WDS_SOCKET_HOST:void 0,WDS_SOCKET_PATH:void 0,WDS_SOCKET_PORT:void 0,FAST_REFRESH:!0}.DEBUG);return e},t.useColors=function(){if("undefined"!==typeof window&&window.process&&("renderer"===window.process.type||window.process.__nwjs))return!0;if("undefined"!==typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;return"undefined"!==typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!==typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!==typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!==typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},t.storage=function(){try{return localStorage}catch(e){}}(),t.destroy=(()=>{let e=!1;return()=>{e||(e=!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`."))}})(),t.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"],t.log=console.debug||console.log||(()=>{}),e.exports=r(6981)(t);const{formatters:n}=e.exports;n.j=function(e){try{return JSON.stringify(e)}catch(t){return"[UnexpectedJSONParseError]: "+t.message}}},6981:(e,t,r)=>{e.exports=function(e){function t(e){let r,i,s,o=null;function a(){for(var e=arguments.length,n=new Array(e),i=0;i<e;i++)n[i]=arguments[i];if(!a.enabled)return;const s=a,o=Number(new Date),c=o-(r||o);s.diff=c,s.prev=r,s.curr=o,r=o,n[0]=t.coerce(n[0]),"string"!==typeof n[0]&&n.unshift("%O");let l=0;n[0]=n[0].replace(/%([a-zA-Z%])/g,((e,r)=>{if("%%"===e)return"%";l++;const i=t.formatters[r];if("function"===typeof i){const t=n[l];e=i.call(s,t),n.splice(l,1),l--}return e})),t.formatArgs.call(s,n);const u=s.log||t.log;u.apply(s,n)}return a.namespace=e,a.useColors=t.useColors(),a.color=t.selectColor(e),a.extend=n,a.destroy=t.destroy,Object.defineProperty(a,"enabled",{enumerable:!0,configurable:!1,get:()=>null!==o?o:(i!==t.namespaces&&(i=t.namespaces,s=t.enabled(e)),s),set:e=>{o=e}}),"function"===typeof t.init&&t.init(a),a}function n(e,r){const n=t(this.namespace+("undefined"===typeof r?":":r)+e);return n.log=this.log,n}function i(e){return e.toString().substring(2,e.toString().length-2).replace(/\.\*\?$/,"*")}return t.debug=t,t.default=t,t.coerce=function(e){if(e instanceof Error)return e.stack||e.message;return e},t.disable=function(){const e=[...t.names.map(i),...t.skips.map(i).map((e=>"-"+e))].join(",");return t.enable(""),e},t.enable=function(e){let r;t.save(e),t.namespaces=e,t.names=[],t.skips=[];const n=("string"===typeof e?e:"").split(/[\s,]+/),i=n.length;for(r=0;r<i;r++)n[r]&&("-"===(e=n[r].replace(/\*/g,".*?"))[0]?t.skips.push(new RegExp("^"+e.slice(1)+"$")):t.names.push(new RegExp("^"+e+"$")))},t.enabled=function(e){if("*"===e[e.length-1])return!0;let r,n;for(r=0,n=t.skips.length;r<n;r++)if(t.skips[r].test(e))return!1;for(r=0,n=t.names.length;r<n;r++)if(t.names[r].test(e))return!0;return!1},t.humanize=r(1694),t.destroy=function(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")},Object.keys(e).forEach((r=>{t[r]=e[r]})),t.names=[],t.skips=[],t.formatters={},t.selectColor=function(e){let r=0;for(let t=0;t<e.length;t++)r=(r<<5)-r+e.charCodeAt(t),r|=0;return t.colors[Math.abs(r)%t.colors.length]},t.enable(t.load()),t}},8865:e=>{"use strict";function t(e,t){t=t||{};this._head=0,this._tail=0,this._capacity=t.capacity,this._capacityMask=3,this._list=new Array(4),Array.isArray(e)&&this._fromArray(e)}t.prototype.peekAt=function(e){var t=e;if(t===(0|t)){var r=this.size();if(!(t>=r||t<-r))return t<0&&(t+=r),t=this._head+t&this._capacityMask,this._list[t]}},t.prototype.get=function(e){return this.peekAt(e)},t.prototype.peek=function(){if(this._head!==this._tail)return this._list[this._head]},t.prototype.peekFront=function(){return this.peek()},t.prototype.peekBack=function(){return this.peekAt(-1)},Object.defineProperty(t.prototype,"length",{get:function(){return this.size()}}),t.prototype.size=function(){return this._head===this._tail?0:this._head<this._tail?this._tail-this._head:this._capacityMask+1-(this._head-this._tail)},t.prototype.unshift=function(e){if(void 0===e)return this.size();var t=this._list.length;return this._head=this._head-1+t&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)},t.prototype.shift=function(){var e=this._head;if(e!==this._tail){var t=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(),t}},t.prototype.push=function(e){if(void 0===e)return this.size();var t=this._tail;return this._list[t]=e,this._tail=t+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)},t.prototype.pop=function(){var e=this._tail;if(e!==this._head){var t=this._list.length;this._tail=e-1+t&this._capacityMask;var r=this._list[this._tail];return this._list[this._tail]=void 0,this._head<2&&e>1e4&&e<=t>>>2&&this._shrinkArray(),r}},t.prototype.removeOne=function(e){var t=e;if(t===(0|t)&&this._head!==this._tail){var r=this.size(),n=this._list.length;if(!(t>=r||t<-r)){t<0&&(t+=r),t=this._head+t&this._capacityMask;var i,s=this._list[t];if(e<r/2){for(i=e;i>0;i--)this._list[t]=this._list[t=t-1+n&this._capacityMask];this._list[t]=void 0,this._head=this._head+1+n&this._capacityMask}else{for(i=r-1-e;i>0;i--)this._list[t]=this._list[t=t+1+n&this._capacityMask];this._list[t]=void 0,this._tail=this._tail-1+n&this._capacityMask}return s}}},t.prototype.remove=function(e,t){var r,n=e,i=t;if(n===(0|n)&&this._head!==this._tail){var s=this.size(),o=this._list.length;if(!(n>=s||n<-s||t<1)){if(n<0&&(n+=s),1===t||!t)return(r=new Array(1))[0]=this.removeOne(n),r;if(0===n&&n+t>=s)return r=this.toArray(),this.clear(),r;var a;for(n+t>s&&(t=s-n),r=new Array(t),a=0;a<t;a++)r[a]=this._list[this._head+n+a&this._capacityMask];if(n=this._head+n&this._capacityMask,e+t===s){for(this._tail=this._tail-t+o&this._capacityMask,a=t;a>0;a--)this._list[n=n+1+o&this._capacityMask]=void 0;return r}if(0===e){for(this._head=this._head+t+o&this._capacityMask,a=t-1;a>0;a--)this._list[n=n+1+o&this._capacityMask]=void 0;return r}if(n<s/2){for(this._head=this._head+e+t+o&this._capacityMask,a=e;a>0;a--)this.unshift(this._list[n=n-1+o&this._capacityMask]);for(n=this._head-1+o&this._capacityMask;i>0;)this._list[n=n-1+o&this._capacityMask]=void 0,i--;e<0&&(this._tail=n)}else{for(this._tail=n,n=n+t+o&this._capacityMask,a=s-(t+e);a>0;a--)this.push(this._list[n++]);for(n=this._tail;i>0;)this._list[n=n+1+o&this._capacityMask]=void 0,i--}return this._head<2&&this._tail>1e4&&this._tail<=o>>>2&&this._shrinkArray(),r}}},t.prototype.splice=function(e,t){var r=e;if(r===(0|r)){var n=this.size();if(r<0&&(r+=n),!(r>n)){if(arguments.length>2){var i,s,o,a=arguments.length,c=this._list.length,l=2;if(!n||r<n/2){for(s=new Array(r),i=0;i<r;i++)s[i]=this._list[this._head+i&this._capacityMask];for(0===t?(o=[],r>0&&(this._head=this._head+r+c&this._capacityMask)):(o=this.remove(r,t),this._head=this._head+r+c&this._capacityMask);a>l;)this.unshift(arguments[--a]);for(i=r;i>0;i--)this.unshift(s[i-1])}else{var u=(s=new Array(n-(r+t))).length;for(i=0;i<u;i++)s[i]=this._list[this._head+r+t+i&this._capacityMask];for(0===t?(o=[],r!=n&&(this._tail=this._head+r+c&this._capacityMask)):(o=this.remove(r,t),this._tail=this._tail-u+c&this._capacityMask);l<a;)this.push(arguments[l++]);for(i=0;i<u;i++)this.push(s[i])}return o}return this.remove(r,t)}}},t.prototype.clear=function(){this._head=0,this._tail=0},t.prototype.isEmpty=function(){return this._head===this._tail},t.prototype.toArray=function(){return this._copyArray(!1)},t.prototype._fromArray=function(e){for(var t=0;t<e.length;t++)this.push(e[t])},t.prototype._copyArray=function(e){var t,r=[],n=this._list,i=n.length;if(e||this._head>this._tail){for(t=this._head;t<i;t++)r.push(n[t]);for(t=0;t<this._tail;t++)r.push(n[t])}else for(t=this._head;t<this._tail;t++)r.push(n[t]);return r},t.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},t.prototype._shrinkArray=function(){this._list.length>>>=1,this._capacityMask>>>=1},e.exports=t},1362:e=>{"use strict";function t(e,t){for(const r in t)Object.defineProperty(e,r,{value:t[r],enumerable:!0,configurable:!0});return e}e.exports=function(e,r,n){if(!e||"string"===typeof e)throw new TypeError("Please pass an Error to err-code");n||(n={}),"object"===typeof r&&(n=r,r=""),r&&(n.code=r);try{return t(e,n)}catch(i){n.message=e.message,n.stack=e.stack;const r=function(){};r.prototype=Object.create(Object.getPrototypeOf(e));return t(new r,n)}}},593:(e,t,r)=>{"use strict";const n=r(9834);t.zN=n.EventIterator,n.EventIterator},9834:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});class r{constructor(){this.pullQueue=[],this.pushQueue=[],this.eventHandlers={},this.isPaused=!1,this.isStopped=!1}push(e){if(this.isStopped)return;const t={value:e,done:!1};if(this.pullQueue.length){const e=this.pullQueue.shift();e&&e.resolve(t)}else this.pushQueue.push(Promise.resolve(t)),void 0!==this.highWaterMark&&this.pushQueue.length>=this.highWaterMark&&!this.isPaused&&(this.isPaused=!0,this.eventHandlers.highWater?this.eventHandlers.highWater():console&&console.warn("EventIterator queue reached ".concat(this.pushQueue.length," items")))}stop(){if(!this.isStopped){this.isStopped=!0,this.remove();for(const 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(const t of this.pullQueue)t.reject(e);this.pullQueue.length=0}else{const t=Promise.reject(e);t.catch((()=>{})),this.pushQueue.push(t)}}remove(){Promise.resolve().then((()=>{this.removeCallback&&this.removeCallback()}))}[Symbol.asyncIterator](){return{next:e=>{const t=this.pushQueue.shift();return t?(void 0!==this.lowWaterMark&&this.pushQueue.length<=this.lowWaterMark&&this.isPaused&&(this.isPaused=!1,this.eventHandlers.lowWater&&this.eventHandlers.lowWater()),t):this.isStopped?Promise.resolve({value:void 0,done:!0}):new Promise(((e,t)=>{this.pullQueue.push({resolve:e,reject:t})}))},return:()=>(this.isStopped=!0,this.pushQueue.length=0,this.remove(),Promise.resolve({value:void 0,done:!0}))}}}class n{constructor(e){let{highWaterMark:t=100,lowWaterMark:n=1}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const i=new r;i.highWaterMark=t,i.lowWaterMark=n,i.removeCallback=e({push:e=>i.push(e),stop:()=>i.stop(),fail:e=>i.fail(e),on:(e,t)=>{i.eventHandlers[e]=t}})||(()=>{}),this[Symbol.asyncIterator]=()=>i[Symbol.asyncIterator](),Object.freeze(this)}}t.EventIterator=n,t.default=n},2359:e=>{"use strict";var t=Object.prototype.hasOwnProperty,r="~";function n(){}function i(e,t,r){this.fn=e,this.context=t,this.once=r||!1}function s(e,t,n,s,o){if("function"!==typeof n)throw new TypeError("The listener must be a function");var a=new i(n,s||e,o),c=r?r+t:t;return e._events[c]?e._events[c].fn?e._events[c]=[e._events[c],a]:e._events[c].push(a):(e._events[c]=a,e._eventsCount++),e}function o(e,t){0===--e._eventsCount?e._events=new n:delete e._events[t]}function a(){this._events=new n,this._eventsCount=0}Object.create&&(n.prototype=Object.create(null),(new n).__proto__||(r=!1)),a.prototype.eventNames=function(){var e,n,i=[];if(0===this._eventsCount)return i;for(n in e=this._events)t.call(e,n)&&i.push(r?n.slice(1):n);return Object.getOwnPropertySymbols?i.concat(Object.getOwnPropertySymbols(e)):i},a.prototype.listeners=function(e){var t=r?r+e:e,n=this._events[t];if(!n)return[];if(n.fn)return[n.fn];for(var i=0,s=n.length,o=new Array(s);i<s;i++)o[i]=n[i].fn;return o},a.prototype.listenerCount=function(e){var t=r?r+e:e,n=this._events[t];return n?n.fn?1:n.length:0},a.prototype.emit=function(e,t,n,i,s,o){var a=r?r+e:e;if(!this._events[a])return!1;var c,l,u=this._events[a],h=arguments.length;if(u.fn){switch(u.once&&this.removeListener(e,u.fn,void 0,!0),h){case 1:return u.fn.call(u.context),!0;case 2:return u.fn.call(u.context,t),!0;case 3:return u.fn.call(u.context,t,n),!0;case 4:return u.fn.call(u.context,t,n,i),!0;case 5:return u.fn.call(u.context,t,n,i,s),!0;case 6:return u.fn.call(u.context,t,n,i,s,o),!0}for(l=1,c=new Array(h-1);l<h;l++)c[l-1]=arguments[l];u.fn.apply(u.context,c)}else{var d,f=u.length;for(l=0;l<f;l++)switch(u[l].once&&this.removeListener(e,u[l].fn,void 0,!0),h){case 1:u[l].fn.call(u[l].context);break;case 2:u[l].fn.call(u[l].context,t);break;case 3:u[l].fn.call(u[l].context,t,n);break;case 4:u[l].fn.call(u[l].context,t,n,i);break;default:if(!c)for(d=1,c=new Array(h-1);d<h;d++)c[d-1]=arguments[d];u[l].fn.apply(u[l].context,c)}}return!0},a.prototype.on=function(e,t,r){return s(this,e,t,r,!1)},a.prototype.once=function(e,t,r){return s(this,e,t,r,!0)},a.prototype.removeListener=function(e,t,n,i){var s=r?r+e:e;if(!this._events[s])return this;if(!t)return o(this,s),this;var a=this._events[s];if(a.fn)a.fn!==t||i&&!a.once||n&&a.context!==n||o(this,s);else{for(var c=0,l=[],u=a.length;c<u;c++)(a[c].fn!==t||i&&!a[c].once||n&&a[c].context!==n)&&l.push(a[c]);l.length?this._events[s]=1===l.length?l[0]:l:o(this,s)}return this},a.prototype.removeAllListeners=function(e){var t;return e?(t=r?r+e:e,this._events[t]&&o(this,t)):(this._events=new n,this._eventsCount=0),this},a.prototype.off=a.prototype.removeListener,a.prototype.addListener=a.prototype.on,a.prefixed=r,a.EventEmitter=a,e.exports=a},3478:e=>{"use strict";var t,r="object"===typeof Reflect?Reflect:null,n=r&&"function"===typeof r.apply?r.apply:function(e,t,r){return Function.prototype.apply.call(e,t,r)};t=r&&"function"===typeof r.ownKeys?r.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var i=Number.isNaN||function(e){return e!==e};function s(){s.init.call(this)}e.exports=s,e.exports.once=function(e,t){return new Promise((function(r,n){function i(r){e.removeListener(t,s),n(r)}function s(){"function"===typeof e.removeListener&&e.removeListener("error",i),r([].slice.call(arguments))}y(e,t,s,{once:!0}),"error"!==t&&function(e,t,r){"function"===typeof e.on&&y(e,"error",t,r)}(e,i,{once:!0})}))},s.EventEmitter=s,s.prototype._events=void 0,s.prototype._eventsCount=0,s.prototype._maxListeners=void 0;var o=10;function a(e){if("function"!==typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function c(e){return void 0===e._maxListeners?s.defaultMaxListeners:e._maxListeners}function l(e,t,r,n){var i,s,o,l;if(a(r),void 0===(s=e._events)?(s=e._events=Object.create(null),e._eventsCount=0):(void 0!==s.newListener&&(e.emit("newListener",t,r.listener?r.listener:r),s=e._events),o=s[t]),void 0===o)o=s[t]=r,++e._eventsCount;else if("function"===typeof o?o=s[t]=n?[r,o]:[o,r]:n?o.unshift(r):o.push(r),(i=c(e))>0&&o.length>i&&!o.warned){o.warned=!0;var u=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");u.name="MaxListenersExceededWarning",u.emitter=e,u.type=t,u.count=o.length,l=u,console&&console.warn&&console.warn(l)}return e}function u(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function h(e,t,r){var n={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},i=u.bind(n);return i.listener=r,n.wrapFn=i,i}function d(e,t,r){var n=e._events;if(void 0===n)return[];var i=n[t];return void 0===i?[]:"function"===typeof i?r?[i.listener||i]:[i]:r?function(e){for(var t=new Array(e.length),r=0;r<t.length;++r)t[r]=e[r].listener||e[r];return t}(i):p(i,i.length)}function f(e){var t=this._events;if(void 0!==t){var r=t[e];if("function"===typeof r)return 1;if(void 0!==r)return r.length}return 0}function p(e,t){for(var r=new Array(t),n=0;n<t;++n)r[n]=e[n];return r}function y(e,t,r,n){if("function"===typeof e.on)n.once?e.once(t,r):e.on(t,r);else{if("function"!==typeof e.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e);e.addEventListener(t,(function i(s){n.once&&e.removeEventListener(t,i),r(s)}))}}Object.defineProperty(s,"defaultMaxListeners",{enumerable:!0,get:function(){return o},set:function(e){if("number"!==typeof e||e<0||i(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");o=e}}),s.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},s.prototype.setMaxListeners=function(e){if("number"!==typeof e||e<0||i(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},s.prototype.getMaxListeners=function(){return c(this)},s.prototype.emit=function(e){for(var t=[],r=1;r<arguments.length;r++)t.push(arguments[r]);var i="error"===e,s=this._events;if(void 0!==s)i=i&&void 0===s.error;else if(!i)return!1;if(i){var o;if(t.length>0&&(o=t[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(void 0===c)return!1;if("function"===typeof c)n(c,this,t);else{var l=c.length,u=p(c,l);for(r=0;r<l;++r)n(u[r],this,t)}return!0},s.prototype.addListener=function(e,t){return l(this,e,t,!1)},s.prototype.on=s.prototype.addListener,s.prototype.prependListener=function(e,t){return l(this,e,t,!0)},s.prototype.once=function(e,t){return a(t),this.on(e,h(this,e,t)),this},s.prototype.prependOnceListener=function(e,t){return a(t),this.prependListener(e,h(this,e,t)),this},s.prototype.removeListener=function(e,t){var r,n,i,s,o;if(a(t),void 0===(n=this._events))return this;if(void 0===(r=n[e]))return this;if(r===t||r.listener===t)0===--this._eventsCount?this._events=Object.create(null):(delete n[e],n.removeListener&&this.emit("removeListener",e,r.listener||t));else if("function"!==typeof r){for(i=-1,s=r.length-1;s>=0;s--)if(r[s]===t||r[s].listener===t){o=r[s].listener,i=s;break}if(i<0)return this;0===i?r.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(r,i),1===r.length&&(n[e]=r[0]),void 0!==n.removeListener&&this.emit("removeListener",e,o||t)}return this},s.prototype.off=s.prototype.removeListener,s.prototype.removeAllListeners=function(e){var t,r,n;if(void 0===(r=this._events))return this;if(void 0===r.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==r[e]&&(0===--this._eventsCount?this._events=Object.create(null):delete r[e]),this;if(0===arguments.length){var i,s=Object.keys(r);for(n=0;n<s.length;++n)"removeListener"!==(i=s[n])&&this.removeAllListeners(i);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"===typeof(t=r[e]))this.removeListener(e,t);else if(void 0!==t)for(n=t.length-1;n>=0;n--)this.removeListener(e,t[n]);return this},s.prototype.listeners=function(e){return d(this,e,!0)},s.prototype.rawListeners=function(e){return d(this,e,!1)},s.listenerCount=function(e,t){return"function"===typeof e.listenerCount?e.listenerCount(t):f.call(e,t)},s.prototype.listenerCount=f,s.prototype.eventNames=function(){return this._eventsCount>0?t(this._events):[]}},8002:e=>{e.exports=class{constructor(e){if(!(e>0)||0!==(e-1&e))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 void 0===this.buffer[this.top]&&(this.buffer[this.top]=e,this.top=this.top+1&this.mask,!0)}shift(){const e=this.buffer[this.btm];if(void 0!==e)return this.buffer[this.btm]=void 0,this.btm=this.btm+1&this.mask,e}peek(){return this.buffer[this.btm]}isEmpty(){return void 0===this.buffer[this.btm]}}},8443:(e,t,r)=>{const n=r(8002);e.exports=class{constructor(e){this.hwm=e||16,this.head=new n(this.hwm),this.tail=this.head}push(e){if(!this.head.push(e)){const t=this.head;this.head=t.next=new n(2*this.head.buffer.length),this.head.push(e)}}shift(){const e=this.tail.shift();if(void 0===e&&this.tail.next){const e=this.tail.next;return this.tail.next=null,this.tail=e,this.tail.shift()}return e}peek(){return this.tail.peek()}isEmpty(){return this.head.isEmpty()}}},3341:e=>{e.exports=function(e){if(!e)throw Error("hashlru must have a max value, of type number, greater than 0");var t=0,r=Object.create(null),n=Object.create(null);function i(i,s){r[i]=s,++t>=e&&(t=0,n=r,r=Object.create(null))}return{has:function(e){return void 0!==r[e]||void 0!==n[e]},remove:function(e){void 0!==r[e]&&(r[e]=void 0),void 0!==n[e]&&(n[e]=void 0)},get:function(e){var t=r[e];return void 0!==t?t:void 0!==(t=n[e])?(i(e,t),t):void 0},set:function(e,t){void 0!==r[e]?r[e]=t:i(e,t)},clear:function(){r=Object.create(null),n=Object.create(null)}}}},8380:e=>{"use strict";const t="[a-fA-F\\d:]",r=e=>e&&e.includeBoundaries?"(?:(?<=\\s|^)(?=".concat(t,")|(?<=").concat(t,")(?=\\s|$))"):"",n="(?: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}",i="[a-fA-F\\d]{1,4}",s="\n(?:\n(?:".concat(i,":){7}(?:").concat(i,"|:)| // 1:2:3:4:5:6:7:: 1:2:3:4:5:6:7:8\n(?:").concat(i,":){6}(?:").concat(n,"|:").concat(i,"|:)| // 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\n(?:").concat(i,":){5}(?::").concat(n,"|(?::").concat(i,"){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\n(?:").concat(i,":){4}(?:(?::").concat(i,"){0,1}:").concat(n,"|(?::").concat(i,"){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\n(?:").concat(i,":){3}(?:(?::").concat(i,"){0,2}:").concat(n,"|(?::").concat(i,"){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\n(?:").concat(i,":){2}(?:(?::").concat(i,"){0,3}:").concat(n,"|(?::").concat(i,"){1,5}|:)| // 1:2:: 1:2::4:5:6:7:8 1:2::8 1:2::4:5:6:7:1.2.3.4\n(?:").concat(i,":){1}(?:(?::").concat(i,"){0,4}:").concat(n,"|(?::").concat(i,"){1,6}|:)| // 1:: 1::3:4:5:6:7:8 1::8 1::3:4:5:6:7:1.2.3.4\n(?::(?:(?::").concat(i,"){0,5}:").concat(n,"|(?::").concat(i,"){1,7}|:)) // ::2:3:4:5:6:7:8 ::2:3:4:5:6:7:8 ::8 ::1.2.3.4\n)(?:%[0-9a-zA-Z]{1,})? // %eth0 %1\n").replace(/\s*\/\/.*$/gm,"").replace(/\n/g,"").trim(),o=new RegExp("(?:^".concat(n,"$)|(?:^").concat(s,"$)")),a=new RegExp("^".concat(n,"$")),c=new RegExp("^".concat(s,"$")),l=e=>e&&e.exact?o:new RegExp("(?:".concat(r(e)).concat(n).concat(r(e),")|(?:").concat(r(e)).concat(s).concat(r(e),")"),"g");l.v4=e=>e&&e.exact?a:new RegExp("".concat(r(e)).concat(n).concat(r(e)),"g"),l.v6=e=>e&&e.exact?c:new RegExp("".concat(r(e)).concat(s).concat(r(e)),"g"),e.exports=l},4974:function(e){!function(t){"use strict";const r="(0?\\d+|0x[a-f0-9]+)",n={fourOctet:new RegExp("^".concat(r,"\\.").concat(r,"\\.").concat(r,"\\.").concat(r,"$"),"i"),threeOctet:new RegExp("^".concat(r,"\\.").concat(r,"\\.").concat(r,"$"),"i"),twoOctet:new RegExp("^".concat(r,"\\.").concat(r,"$"),"i"),longValue:new RegExp("^".concat(r,"$"),"i")},i=new RegExp("^0[0-7]+$","i"),s=new RegExp("^0x[a-f0-9]+$","i"),o="%[0-9a-z]{1,}",a="(?:[0-9a-f]+::?)+",c={zoneIndex:new RegExp(o,"i"),native:new RegExp("^(::)?(".concat(a,")?([0-9a-f]+)?(::)?(").concat(o,")?$"),"i"),deprecatedTransitional:new RegExp("^(?:::)(".concat(r,"\\.").concat(r,"\\.").concat(r,"\\.").concat(r,"(").concat(o,")?)$"),"i"),transitional:new RegExp("^((?:".concat(a,")|(?:::)(?:").concat(a,")?)").concat(r,"\\.").concat(r,"\\.").concat(r,"\\.").concat(r,"(").concat(o,")?$"),"i")};function l(e,t){if(e.indexOf("::")!==e.lastIndexOf("::"))return null;let r,n,i=0,s=-1,o=(e.match(c.zoneIndex)||[])[0];for(o&&(o=o.substring(1),e=e.replace(/%.+$/,""));(s=e.indexOf(":",s+1))>=0;)i++;if("::"===e.substr(0,2)&&i--,"::"===e.substr(-2,2)&&i--,i>t)return null;for(n=t-i,r=":";n--;)r+="0:";return":"===(e=e.replace("::",r))[0]&&(e=e.slice(1)),":"===e[e.length-1]&&(e=e.slice(0,-1)),{parts:t=function(){const t=e.split(":"),r=[];for(let e=0;e<t.length;e++)r.push(parseInt(t[e],16));return r}(),zoneId:o}}function u(e,t,r,n){if(e.length!==t.length)throw new Error("ipaddr: cannot match CIDR for objects with different lengths");let i,s=0;for(;n>0;){if(i=r-n,i<0&&(i=0),e[s]>>i!==t[s]>>i)return!1;n-=r,s+=1}return!0}function h(e){if(s.test(e))return parseInt(e,16);if("0"===e[0]&&!isNaN(parseInt(e[1],10))){if(i.test(e))return parseInt(e,8);throw new Error("ipaddr: cannot parse ".concat(e," as octal"))}return parseInt(e,10)}function d(e,t){for(;e.length<t;)e="0".concat(e);return e}const f={};f.IPv4=function(){function e(e){if(4!==e.length)throw new Error("ipaddr: ipv4 octet count should be 4");let t,r;for(t=0;t<e.length;t++)if(r=e[t],!(0<=r&&r<=255))throw new Error("ipaddr: ipv4 octet should fit in 8 bits");this.octets=e}return e.prototype.SpecialRanges={unspecified:[[new e([0,0,0,0]),8]],broadcast:[[new e([255,255,255,255]),32]],multicast:[[new e([224,0,0,0]),4]],linkLocal:[[new e([169,254,0,0]),16]],loopback:[[new e([127,0,0,0]),8]],carrierGradeNat:[[new e([100,64,0,0]),10]],private:[[new e([10,0,0,0]),8],[new e([172,16,0,0]),12],[new e([192,168,0,0]),16]],reserved:[[new e([192,0,0,0]),24],[new e([192,0,2,0]),24],[new e([192,88,99,0]),24],[new e([198,51,100,0]),24],[new e([203,0,113,0]),24],[new e([240,0,0,0]),4]]},e.prototype.kind=function(){return"ipv4"},e.prototype.match=function(e,t){let r;if(void 0===t&&(r=e,e=r[0],t=r[1]),"ipv4"!==e.kind())throw new Error("ipaddr: cannot match ipv4 address with non-ipv4 one");return u(this.octets,e.octets,8,t)},e.prototype.prefixLengthFromSubnetMask=function(){let e=0,t=!1;const r={0:8,128:7,192:6,224:5,240:4,248:3,252:2,254:1,255:0};let n,i,s;for(n=3;n>=0;n-=1){if(i=this.octets[n],!(i in r))return null;if(s=r[i],t&&0!==s)return null;8!==s&&(t=!0),e+=s}return 32-e},e.prototype.range=function(){return f.subnetMatch(this,this.SpecialRanges)},e.prototype.toByteArray=function(){return this.octets.slice(0)},e.prototype.toIPv4MappedAddress=function(){return f.IPv6.parse("::ffff:".concat(this.toString()))},e.prototype.toNormalizedString=function(){return this.toString()},e.prototype.toString=function(){return this.octets.join(".")},e}(),f.IPv4.broadcastAddressFromCIDR=function(e){try{const t=this.parseCIDR(e),r=t[0].toByteArray(),n=this.subnetMaskFromPrefixLength(t[1]).toByteArray(),i=[];let s=0;for(;s<4;)i.push(parseInt(r[s],10)|255^parseInt(n[s],10)),s++;return new this(i)}catch(t){throw new Error("ipaddr: the address does not have IPv4 CIDR format")}},f.IPv4.isIPv4=function(e){return null!==this.parser(e)},f.IPv4.isValid=function(e){try{return new this(this.parser(e)),!0}catch(t){return!1}},f.IPv4.isValidFourPartDecimal=function(e){return!(!f.IPv4.isValid(e)||!e.match(/^(0|[1-9]\d*)(\.(0|[1-9]\d*)){3}$/))},f.IPv4.networkAddressFromCIDR=function(e){let t,r,n,i,s;try{for(t=this.parseCIDR(e),n=t[0].toByteArray(),s=this.subnetMaskFromPrefixLength(t[1]).toByteArray(),i=[],r=0;r<4;)i.push(parseInt(n[r],10)&parseInt(s[r],10)),r++;return new this(i)}catch(o){throw new Error("ipaddr: the address does not have IPv4 CIDR format")}},f.IPv4.parse=function(e){const t=this.parser(e);if(null===t)throw new Error("ipaddr: string is not formatted like an IPv4 Address");return new this(t)},f.IPv4.parseCIDR=function(e){let t;if(t=e.match(/^(.+)\/(\d+)$/)){const e=parseInt(t[2]);if(e>=0&&e<=32){const r=[this.parse(t[1]),e];return Object.defineProperty(r,"toString",{value:function(){return this.join("/")}}),r}}throw new Error("ipaddr: string is not formatted like an IPv4 CIDR range")},f.IPv4.parser=function(e){let t,r,i;if(t=e.match(n.fourOctet))return function(){const e=t.slice(1,6),n=[];for(let t=0;t<e.length;t++)r=e[t],n.push(h(r));return n}();if(t=e.match(n.longValue)){if(i=h(t[1]),i>4294967295||i<0)throw new Error("ipaddr: address outside defined range");return function(){const e=[];let t;for(t=0;t<=24;t+=8)e.push(i>>t&255);return e}().reverse()}return(t=e.match(n.twoOctet))?function(){const e=t.slice(1,4),r=[];if(i=h(e[1]),i>16777215||i<0)throw new Error("ipaddr: address outside defined range");return r.push(h(e[0])),r.push(i>>16&255),r.push(i>>8&255),r.push(255&i),r}():(t=e.match(n.threeOctet))?function(){const e=t.slice(1,5),r=[];if(i=h(e[2]),i>65535||i<0)throw new Error("ipaddr: address outside defined range");return r.push(h(e[0])),r.push(h(e[1])),r.push(i>>8&255),r.push(255&i),r}():null},f.IPv4.subnetMaskFromPrefixLength=function(e){if((e=parseInt(e))<0||e>32)throw new Error("ipaddr: invalid IPv4 prefix length");const t=[0,0,0,0];let r=0;const n=Math.floor(e/8);for(;r<n;)t[r]=255,r++;return n<4&&(t[n]=Math.pow(2,e%8)-1<<8-e%8),new this(t)},f.IPv6=function(){function e(e,t){let r,n;if(16===e.length)for(this.parts=[],r=0;r<=14;r+=2)this.parts.push(e[r]<<8|e[r+1]);else{if(8!==e.length)throw new Error("ipaddr: ipv6 part count should be 8 or 16");this.parts=e}for(r=0;r<this.parts.length;r++)if(n=this.parts[r],!(0<=n&&n<=65535))throw new Error("ipaddr: ipv6 part should fit in 16 bits");t&&(this.zoneId=t)}return e.prototype.SpecialRanges={unspecified:[new e([0,0,0,0,0,0,0,0]),128],linkLocal:[new e([65152,0,0,0,0,0,0,0]),10],multicast:[new e([65280,0,0,0,0,0,0,0]),8],loopback:[new e([0,0,0,0,0,0,0,1]),128],uniqueLocal:[new e([64512,0,0,0,0,0,0,0]),7],ipv4Mapped:[new e([0,0,0,0,0,65535,0,0]),96],rfc6145:[new e([0,0,0,0,65535,0,0,0]),96],rfc6052:[new e([100,65435,0,0,0,0,0,0]),96],"6to4":[new e([8194,0,0,0,0,0,0,0]),16],teredo:[new e([8193,0,0,0,0,0,0,0]),32],reserved:[[new e([8193,3512,0,0,0,0,0,0]),32]]},e.prototype.isIPv4MappedAddress=function(){return"ipv4Mapped"===this.range()},e.prototype.kind=function(){return"ipv6"},e.prototype.match=function(e,t){let r;if(void 0===t&&(r=e,e=r[0],t=r[1]),"ipv6"!==e.kind())throw new Error("ipaddr: cannot match ipv6 address with non-ipv6 one");return u(this.parts,e.parts,16,t)},e.prototype.prefixLengthFromSubnetMask=function(){let e=0,t=!1;const r={0:16,32768:15,49152:14,57344:13,61440:12,63488:11,64512:10,65024:9,65280:8,65408:7,65472:6,65504:5,65520:4,65528:3,65532:2,65534:1,65535:0};let n,i;for(let s=7;s>=0;s-=1){if(n=this.parts[s],!(n in r))return null;if(i=r[n],t&&0!==i)return null;16!==i&&(t=!0),e+=i}return 128-e},e.prototype.range=function(){return f.subnetMatch(this,this.SpecialRanges)},e.prototype.toByteArray=function(){let e;const t=[],r=this.parts;for(let n=0;n<r.length;n++)e=r[n],t.push(e>>8),t.push(255&e);return t},e.prototype.toFixedLengthString=function(){const e=function(){const e=[];for(let t=0;t<this.parts.length;t++)e.push(d(this.parts[t].toString(16),4));return e}.call(this).join(":");let t="";return this.zoneId&&(t="%".concat(this.zoneId)),e+t},e.prototype.toIPv4Address=function(){if(!this.isIPv4MappedAddress())throw new Error("ipaddr: trying to convert a generic ipv6 address to ipv4");const e=this.parts.slice(-2),t=e[0],r=e[1];return new f.IPv4([t>>8,255&t,r>>8,255&r])},e.prototype.toNormalizedString=function(){const e=function(){const e=[];for(let t=0;t<this.parts.length;t++)e.push(this.parts[t].toString(16));return e}.call(this).join(":");let t="";return this.zoneId&&(t="%".concat(this.zoneId)),e+t},e.prototype.toRFC5952String=function(){const e=/((^|:)(0(:|$)){2,})/g,t=this.toNormalizedString();let r,n=0,i=-1;for(;r=e.exec(t);)r[0].length>i&&(n=r.index,i=r[0].length);return i<0?t:"".concat(t.substring(0,n),"::").concat(t.substring(n+i))},e.prototype.toString=function(){return this.toNormalizedString().replace(/((^|:)(0(:|$))+)/,"::")},e}(),f.IPv6.broadcastAddressFromCIDR=function(e){try{const t=this.parseCIDR(e),r=t[0].toByteArray(),n=this.subnetMaskFromPrefixLength(t[1]).toByteArray(),i=[];let s=0;for(;s<16;)i.push(parseInt(r[s],10)|255^parseInt(n[s],10)),s++;return new this(i)}catch(t){throw new Error("ipaddr: the address does not have IPv6 CIDR format (".concat(t,")"))}},f.IPv6.isIPv6=function(e){return null!==this.parser(e)},f.IPv6.isValid=function(e){if("string"===typeof e&&-1===e.indexOf(":"))return!1;try{const t=this.parser(e);return new this(t.parts,t.zoneId),!0}catch(t){return!1}},f.IPv6.networkAddressFromCIDR=function(e){let t,r,n,i,s;try{for(t=this.parseCIDR(e),n=t[0].toByteArray(),s=this.subnetMaskFromPrefixLength(t[1]).toByteArray(),i=[],r=0;r<16;)i.push(parseInt(n[r],10)&parseInt(s[r],10)),r++;return new this(i)}catch(o){throw new Error("ipaddr: the address does not have IPv6 CIDR format (".concat(o,")"))}},f.IPv6.parse=function(e){const t=this.parser(e);if(null===t.parts)throw new Error("ipaddr: string is not formatted like an IPv6 Address");return new this(t.parts,t.zoneId)},f.IPv6.parseCIDR=function(e){let t,r,n;if((r=e.match(/^(.+)\/(\d+)$/))&&(t=parseInt(r[2]),t>=0&&t<=128))return n=[this.parse(r[1]),t],Object.defineProperty(n,"toString",{value:function(){return this.join("/")}}),n;throw new Error("ipaddr: string is not formatted like an IPv6 CIDR range")},f.IPv6.parser=function(e){let t,r,n,i,s,o;if(n=e.match(c.deprecatedTransitional))return this.parser("::ffff:".concat(n[1]));if(c.native.test(e))return l(e,8);if((n=e.match(c.transitional))&&(o=n[6]||"",t=l(n[1].slice(0,-1)+o,6),t.parts)){for(s=[parseInt(n[2]),parseInt(n[3]),parseInt(n[4]),parseInt(n[5])],r=0;r<s.length;r++)if(i=s[r],!(0<=i&&i<=255))return null;return t.parts.push(s[0]<<8|s[1]),t.parts.push(s[2]<<8|s[3]),{parts:t.parts,zoneId:t.zoneId}}return null},f.IPv6.subnetMaskFromPrefixLength=function(e){if((e=parseInt(e))<0||e>128)throw new Error("ipaddr: invalid IPv6 prefix length");const t=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];let r=0;const n=Math.floor(e/8);for(;r<n;)t[r]=255,r++;return n<16&&(t[n]=Math.pow(2,e%8)-1<<8-e%8),new this(t)},f.fromByteArray=function(e){const t=e.length;if(4===t)return new f.IPv4(e);if(16===t)return new f.IPv6(e);throw new Error("ipaddr: the binary input is neither an IPv6 nor IPv4 address")},f.isValid=function(e){return f.IPv6.isValid(e)||f.IPv4.isValid(e)},f.parse=function(e){if(f.IPv6.isValid(e))return f.IPv6.parse(e);if(f.IPv4.isValid(e))return f.IPv4.parse(e);throw new Error("ipaddr: the address has neither IPv6 nor IPv4 format")},f.parseCIDR=function(e){try{return f.IPv6.parseCIDR(e)}catch(t){try{return f.IPv4.parseCIDR(e)}catch(r){throw new Error("ipaddr: the address has neither IPv6 nor IPv4 CIDR format")}}},f.process=function(e){const t=this.parse(e);return"ipv6"===t.kind()&&t.isIPv4MappedAddress()?t.toIPv4Address():t},f.subnetMatch=function(e,t,r){let n,i,s,o;for(i in void 0!==r&&null!==r||(r="unicast"),t)if(Object.prototype.hasOwnProperty.call(t,i))for(s=t[i],!s[0]||s[0]instanceof Array||(s=[s]),n=0;n<s.length;n++)if(o=s[n],e.kind()===o[0].kind()&&e.match.apply(e,o))return i;return r},e.exports?e.exports=f:t.ipaddr=f}(this)},7710:e=>{e.exports=function(){return"undefined"!==typeof window&&"object"===typeof window.process&&"renderer"===window.process.type||(!("undefined"===typeof process||"object"!==typeof process.versions||!process.versions.electron)||"object"===typeof navigator&&"string"===typeof navigator.userAgent&&navigator.userAgent.indexOf("Electron")>=0)}},8224:(e,t,r)=>{"use strict";const n=r(8380),i=e=>n({exact:!0}).test(e);i.v4=e=>n.v4({exact:!0}).test(e),i.v6=e=>n.v6({exact:!0}).test(e),i.version=e=>i(e)?i.v4(e)?4:6:void 0,e.exports=i},3118:e=>{"use strict";e.exports=e=>{if("[object Object]"!==Object.prototype.toString.call(e))return!1;const t=Object.getPrototypeOf(e);return null===t||t===Object.prototype}},9088:(e,t,r)=>{"use strict";const{URLWithLegacySupport:n,format:i,URLSearchParams:s,defaultBase:o}=r(9557),a=r(9102);e.exports={URL:n,URLSearchParams:s,format:i,relative:a,defaultBase:o}},9102:(e,t,r)=>{"use strict";const{URLWithLegacySupport:n,format:i}=r(9557);e.exports=function(e){let t,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=arguments.length>3?arguments[3]:void 0,a=r.protocol?r.protocol.replace(":",""):"http";a=(s[a]||o||a)+":";try{t=new n(e)}catch(l){t={}}const c=Object.assign({},r,{protocol:a||t.protocol,host:r.host||t.host});return new n(e,i(c)).toString()}},9557:e=>{"use strict";const t="undefined"!==typeof navigator&&"ReactNative"===navigator.product;const r=self.URL,n=t?"http://localhost":self.location?self.location.protocol+"//"+self.location.host:"";e.exports={URLWithLegacySupport:class{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:n;this.super=new r(e,t),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 r.createObjectURL(e)}static revokeObjectURL(e){r.revokeObjectURL(e)}toJSON(){return this.super.toJSON()}toString(){return this.super.toString()}format(){return this.toString()}},URLSearchParams:self.URLSearchParams,defaultBase:n,format:function(e){if("string"===typeof e){return new r(e).toString()}if(!(e instanceof r)){const t=e.username&&e.password?"".concat(e.username,":").concat(e.password,"@"):"",r=e.auth?e.auth+"@":"",n=e.port?":"+e.port:"",i=e.protocol?e.protocol+"//":"",s=e.host||"",o=e.hostname||"",a=e.search||(e.query?"?"+e.query:""),c=e.hash||"",l=e.pathname||"",u=e.path||l+a;return"".concat(i).concat(t||r).concat(s||o+n).concat(u).concat(c)}}}},533:e=>{"use strict";e.exports=async e=>{const t=[];for await(const r of e)t.push(r);return t}},8712:e=>{"use strict";e.exports=async e=>{for await(const t of e);}},7453:e=>{"use strict";e.exports=async function*(e,t){for await(const r of e)await t(r)&&(yield r)}},4092:e=>{"use strict";e.exports=async e=>{for await(const t of e)return t}},587:e=>{"use strict";e.exports=async function*(e,t){for await(const r of e)await t(r),yield r}},7723:e=>{"use strict";e.exports=async function*(e,t){for await(const r of e)yield t(r)}},5520:(e,t,r)=>{"use strict";const n=r(4259);e.exports=async function*(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];const i=n();setTimeout((async()=>{try{await Promise.all(t.map((async e=>{for await(const t of e)i.push(t)}))),i.end()}catch(e){i.end(e)}}),0),yield*i}},4259:(e,t,r)=>{const n=r(8443);e.exports=e=>{let t;"function"===typeof(e=e||{})?(t=e,e={}):t=e.onEnd;let r,i,s,o=new n;const a=e=>i?i(e):(o.push(e),r),c=e=>s?r:a({done:!1,value:e}),l=e=>s?r:(s=!0,e?(e=>(o=new n,i?i({error:e}):(o.push({error:e}),r)))(e):a({done:!0}));if(r={[Symbol.asyncIterator](){return this},next:()=>{if(!o.isEmpty()){if(e.writev){let e;const t=[];for(;!o.isEmpty();){if(e=o.shift(),e.error)throw e.error;t.push(e.value)}return{done:e.done,value:t}}const t=o.shift();if(t.error)throw t.error;return t}return s?{done:!0}:new Promise(((t,n)=>{i=s=>(i=null,s.error?n(s.error):e.writev&&!s.done?t({done:s.done,value:[s.value]}):t(s),r)}))},return:()=>(o=new n,l(),{done:!0}),throw:e=>(l(e),{done:!0}),push:c,end:l},!t)return r;const u=r;return r={[Symbol.asyncIterator](){return this},next:()=>u.next(),throw:e=>(u.throw(e),t&&(t(e),t=null),{done:!0}),return:()=>(u.return(),t&&(t(),t=null),{done:!0}),push:c,end:e=>(u.end(e),t&&(t(e),t=null),r)},r}},7693:e=>{"use strict";e.exports=async function*(e,t){let r=0;if(!(t<1))for await(const n of e)if(yield n,r++,r===t)return}},9217:function(e,t,r){"use strict";const n=r(3118),{hasOwnProperty:i}=Object.prototype,{propertyIsEnumerable:s}=Object,o=(e,t,r)=>Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0}),a=this,c={concatArrays:!1,ignoreUndefined:!1},l=e=>{const t=[];for(const r in e)i.call(e,r)&&t.push(r);if(Object.getOwnPropertySymbols){const r=Object.getOwnPropertySymbols(e);for(const n of r)s.call(e,n)&&t.push(n)}return t};function u(e){return Array.isArray(e)?function(e){const t=e.slice(0,0);return l(e).forEach((r=>{o(t,r,u(e[r]))})),t}(e):n(e)?function(e){const t=null===Object.getPrototypeOf(e)?Object.create(null):{};return l(e).forEach((r=>{o(t,r,u(e[r]))})),t}(e):e}const h=(e,t,r,n)=>(r.forEach((r=>{"undefined"===typeof t[r]&&n.ignoreUndefined||(r in e&&e[r]!==Object.getPrototypeOf(e)?o(e,r,d(e[r],t[r],n)):o(e,r,u(t[r])))})),e);function d(e,t,r){return r.concatArrays&&Array.isArray(e)&&Array.isArray(t)?((e,t,r)=>{let n=e.slice(0,0),s=0;return[e,t].forEach((t=>{const a=[];for(let r=0;r<t.length;r++)i.call(t,r)&&(a.push(String(r)),o(n,s++,t===e?t[r]:u(t[r])));n=h(n,t,l(t).filter((e=>!a.includes(e))),r)})),n})(e,t,r):n(t)&&n(e)?h(e,t,l(t),r):u(t)}e.exports=function(){const e=d(u(c),this!==a&&this||{},c);let t={_:{}};for(var r=arguments.length,i=new Array(r),s=0;s<r;s++)i[s]=arguments[s];for(const o of i)if(void 0!==o){if(!n(o))throw new TypeError("`"+o+"` is not an Option Object");t=d(t,{_:o},e)}return t._}},1694:e=>{var t=1e3,r=60*t,n=60*r,i=24*n,s=7*i,o=365.25*i;function a(e,t,r,n){var i=t>=1.5*r;return Math.round(e/r)+" "+n+(i?"s":"")}e.exports=function(e,c){c=c||{};var l=typeof e;if("string"===l&&e.length>0)return function(e){if((e=String(e)).length>100)return;var a=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(!a)return;var c=parseFloat(a[1]);switch((a[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return c*o;case"weeks":case"week":case"w":return c*s;case"days":case"day":case"d":return c*i;case"hours":case"hour":case"hrs":case"hr":case"h":return c*n;case"minutes":case"minute":case"mins":case"min":case"m":return c*r;case"seconds":case"second":case"secs":case"sec":case"s":return c*t;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return c;default:return}}(e);if("number"===l&&isFinite(e))return c.long?function(e){var s=Math.abs(e);if(s>=i)return a(e,s,i,"day");if(s>=n)return a(e,s,n,"hour");if(s>=r)return a(e,s,r,"minute");if(s>=t)return a(e,s,t,"second");return e+" ms"}(e):function(e){var s=Math.abs(e);if(s>=i)return Math.round(e/i)+"d";if(s>=n)return Math.round(e/n)+"h";if(s>=r)return Math.round(e/r)+"m";if(s>=t)return Math.round(e/t)+"s";return e+"ms"}(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))}},7123:e=>{var t=1e3,r=60*t,n=60*r,i=24*n,s=7*i,o=365.25*i;function a(e,t,r,n){var i=t>=1.5*r;return Math.round(e/r)+" "+n+(i?"s":"")}e.exports=function(e,c){c=c||{};var l=typeof e;if("string"===l&&e.length>0)return function(e){if((e=String(e)).length>100)return;var a=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(!a)return;var c=parseFloat(a[1]);switch((a[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return c*o;case"weeks":case"week":case"w":return c*s;case"days":case"day":case"d":return c*i;case"hours":case"hour":case"hrs":case"hr":case"h":return c*n;case"minutes":case"minute":case"mins":case"min":case"m":return c*r;case"seconds":case"second":case"secs":case"sec":case"s":return c*t;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return c;default:return}}(e);if("number"===l&&isFinite(e))return c.long?function(e){var s=Math.abs(e);if(s>=i)return a(e,s,i,"day");if(s>=n)return a(e,s,n,"hour");if(s>=r)return a(e,s,r,"minute");if(s>=t)return a(e,s,t,"second");return e+" ms"}(e):function(e){var s=Math.abs(e);if(s>=i)return Math.round(e/i)+"d";if(s>=n)return Math.round(e/n)+"h";if(s>=r)return Math.round(e/r)+"m";if(s>=t)return Math.round(e/t)+"s";return e+"ms"}(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))}},3212:e=>{"use strict";function t(e){if(Array.isArray(e)){for(var t=0,r=Array(e.length);t<e.length;t++)r[t]=e[t];return r}return Array.from(e)}e.exports=function(e){var r=void 0,n=void 0;function i(e){if(!(e instanceof Object))throw new Error('Target "'+e+'" is not an object');n=e}function s(e){Object.keys(e).forEach((function(t){var r=e[t];if("function"!==typeof r)throw new Error('Trap "'+t+": "+r+'" is not a function');if(!Reflect[t])throw new Error('Trap "'+t+": "+r+'" is not a valid trap')})),r=e}i((function(){})),e&&i(e),s(Reflect);var o=new Proxy({},{get:function(e,i){return function(){for(var e=arguments.length,s=Array(e),o=0;o<e;o++)s[o]=arguments[o];return r[i].apply(null,[n].concat(t(s.slice(1))))}}});return{setTarget:i,setHandler:s,getTarget:function(){return n},getHandler:function(){return r},proxy:new Proxy(n,o)}}},4982:function(e,t){(function(){var e,r,n,i,s,o,a,c;c=function(e){return[(e&255<<24)>>>24,(e&255<<16)>>>16,(65280&e)>>>8,255&e].join(".")},a=function(e){var t,n,i,s,o,a;for(t=[],i=s=0;s<=3&&0!==e.length;i=++s){if(i>0){if("."!==e[0])throw new Error("Invalid IP");e=e.substring(1)}o=(a=r(e))[0],n=a[1],e=e.substring(n),t.push(o)}if(0!==e.length)throw new Error("Invalid IP");switch(t.length){case 1:if(t[0]>4294967295)throw new Error("Invalid IP");return t[0]>>>0;case 2:if(t[0]>255||t[1]>16777215)throw new Error("Invalid IP");return(t[0]<<24|t[1])>>>0;case 3:if(t[0]>255||t[1]>255||t[2]>65535)throw new Error("Invalid IP");return(t[0]<<24|t[1]<<16|t[2])>>>0;case 4:if(t[0]>255||t[1]>255||t[2]>255||t[3]>255)throw new Error("Invalid IP");return(t[0]<<24|t[1]<<16|t[2]<<8|t[3])>>>0;default:throw new Error("Invalid IP")}},i=(n=function(e){return e.charCodeAt(0)})("0"),o=n("a"),s=n("A"),r=function(e){var t,r,a,c,l;for(c=0,t=10,r="9",a=0,e.length>1&&"0"===e[a]&&("x"===e[a+1]||"X"===e[a+1]?(a+=2,t=16):"0"<=e[a+1]&&e[a+1]<="9"&&(a++,t=8,r="7")),l=a;a<e.length;){if("0"<=e[a]&&e[a]<=r)c=c*t+(n(e[a])-i)>>>0;else{if(16!==t)break;if("a"<=e[a]&&e[a]<="f")c=c*t+(10+n(e[a])-o)>>>0;else{if(!("A"<=e[a]&&e[a]<="F"))break;c=c*t+(10+n(e[a])-s)>>>0}}if(c>4294967295)throw new Error("too large");a++}if(a===l)throw new Error("empty octet");return[c,a]},e=function(){function e(e,t){var r,n,i;if("string"!==typeof e)throw new Error("Missing `net' parameter");if(t||(i=e.split("/",2),e=i[0],t=i[1]),t||(t=32),"string"===typeof t&&t.indexOf(".")>-1){try{this.maskLong=a(t)}catch(s){throw s,new Error("Invalid mask: "+t)}for(r=n=32;n>=0;r=--n)if(this.maskLong===4294967295<<32-r>>>0){this.bitmask=r;break}}else{if(!t&&0!==t)throw new Error("Invalid mask: empty");this.bitmask=parseInt(t,10),this.maskLong=0,this.bitmask>0&&(this.maskLong=4294967295<<32-this.bitmask>>>0)}try{this.netLong=(a(e)&this.maskLong)>>>0}catch(s){throw s,new Error("Invalid net address: "+e)}if(!(this.bitmask<=32))throw new Error("Invalid mask for ip4: "+t);this.size=Math.pow(2,32-this.bitmask),this.base=c(this.netLong),this.mask=c(this.maskLong),this.hostmask=c(~this.maskLong),this.first=this.bitmask<=30?c(this.netLong+1):this.base,this.last=this.bitmask<=30?c(this.netLong+this.size-2):c(this.netLong+this.size-1),this.broadcast=this.bitmask<=30?c(this.netLong+this.size-1):void 0}return e.prototype.contains=function(t){return"string"===typeof t&&(t.indexOf("/")>0||4!==t.split(".").length)&&(t=new e(t)),t instanceof e?this.contains(t.base)&&this.contains(t.broadcast||t.last):(a(t)&this.maskLong)>>>0===(this.netLong&this.maskLong)>>>0},e.prototype.next=function(t){return null==t&&(t=1),new e(c(this.netLong+this.size*t),this.mask)},e.prototype.forEach=function(e){var t,r,n;for(n=a(this.first),r=a(this.last),t=0;n<=r;)e(c(n),n,t),t++,n++},e.prototype.toString=function(){return this.base+"/"+this.bitmask},e}(),t.ip2long=a,t.long2ip=c,t.Netmask=e}).call(this)},5645:(e,t,r)=>{var n=r(6547);function i(e,t){n.cipher.registerAlgorithm(e,(function(){return new n.aes.Algorithm(e,t)}))}r(6313),r(9434),r(5061),e.exports=n.aes=n.aes||{},n.aes.startEncrypting=function(e,t,r,n){var i=p({key:e,output:r,decrypt:!1,mode:n});return i.start(t),i},n.aes.createEncryptionCipher=function(e,t){return p({key:e,output:null,decrypt:!1,mode:t})},n.aes.startDecrypting=function(e,t,r,n){var i=p({key:e,output:r,decrypt:!0,mode:n});return i.start(t),i},n.aes.createDecryptionCipher=function(e,t){return p({key:e,output:null,decrypt:!0,mode:t})},n.aes.Algorithm=function(e,t){u||h();var r=this;r.name=e,r.mode=new t({blockSize:16,cipher:{encrypt:function(e,t){return f(r._w,e,t,!1)},decrypt:function(e,t){return f(r._w,e,t,!0)}}}),r._init=!1},n.aes.Algorithm.prototype.initialize=function(e){if(!this._init){var t,r=e.key;if("string"!==typeof r||16!==r.length&&24!==r.length&&32!==r.length){if(n.util.isArray(r)&&(16===r.length||24===r.length||32===r.length)){t=r,r=n.util.createBuffer();for(var i=0;i<t.length;++i)r.putByte(t[i])}}else r=n.util.createBuffer(r);if(!n.util.isArray(r)){t=r,r=[];var s=t.length();if(16===s||24===s||32===s){s>>>=2;for(i=0;i<s;++i)r.push(t.getInt32())}}if(!n.util.isArray(r)||4!==r.length&&6!==r.length&&8!==r.length)throw new Error("Invalid key parameter.");var o=this.mode.name,a=-1!==["CFB","OFB","CTR","GCM"].indexOf(o);this._w=d(r,e.decrypt&&!a),this._init=!0}},n.aes._expandKey=function(e,t){return u||h(),d(e,t)},n.aes._updateBlock=f,i("AES-ECB",n.cipher.modes.ecb),i("AES-CBC",n.cipher.modes.cbc),i("AES-CFB",n.cipher.modes.cfb),i("AES-OFB",n.cipher.modes.ofb),i("AES-CTR",n.cipher.modes.ctr),i("AES-GCM",n.cipher.modes.gcm);var s,o,a,c,l,u=!1;function h(){u=!0,a=[0,1,2,4,8,16,32,64,128,27,54];for(var e=new Array(256),t=0;t<128;++t)e[t]=t<<1,e[t+128]=t+128<<1^283;s=new Array(256),o=new Array(256),c=new Array(4),l=new Array(4);for(t=0;t<4;++t)c[t]=new Array(256),l[t]=new Array(256);var r,n,i,h,d,f,p,y=0,g=0;for(t=0;t<256;++t){h=(h=g^g<<1^g<<2^g<<3^g<<4)>>8^255&h^99,s[y]=h,o[h]=y,f=(d=e[h])<<24^h<<16^h<<8^h^d,p=((r=e[y])^(n=e[r])^(i=e[n]))<<24^(y^i)<<16^(y^n^i)<<8^y^r^i;for(var m=0;m<4;++m)c[m][y]=f,l[m][h]=p,f=f<<24|f>>>8,p=p<<24|p>>>8;0===y?y=g=1:(y=r^e[e[e[r^i]]],g^=e[e[g]])}}function d(e,t){for(var r,n=e.slice(0),i=1,o=n.length,c=4*(o+6+1),u=o;u<c;++u)r=n[u-1],u%o===0?(r=s[r>>>16&255]<<24^s[r>>>8&255]<<16^s[255&r]<<8^s[r>>>24]^a[i]<<24,i++):o>6&&u%o===4&&(r=s[r>>>24]<<24^s[r>>>16&255]<<16^s[r>>>8&255]<<8^s[255&r]),n[u]=n[u-o]^r;if(t){for(var h,d=l[0],f=l[1],p=l[2],y=l[3],g=n.slice(0),m=(u=0,(c=n.length)-4);u<c;u+=4,m-=4)if(0===u||u===c-4)g[u]=n[m],g[u+1]=n[m+3],g[u+2]=n[m+2],g[u+3]=n[m+1];else for(var v=0;v<4;++v)h=n[m+v],g[u+(3&-v)]=d[s[h>>>24]]^f[s[h>>>16&255]]^p[s[h>>>8&255]]^y[s[255&h]];n=g}return n}function f(e,t,r,n){var i,a,u,h,d,f,p,y,g,m,v,b,w=e.length/4-1;n?(i=l[0],a=l[1],u=l[2],h=l[3],d=o):(i=c[0],a=c[1],u=c[2],h=c[3],d=s),f=t[0]^e[0],p=t[n?3:1]^e[1],y=t[2]^e[2],g=t[n?1:3]^e[3];for(var E=3,_=1;_<w;++_)m=i[f>>>24]^a[p>>>16&255]^u[y>>>8&255]^h[255&g]^e[++E],v=i[p>>>24]^a[y>>>16&255]^u[g>>>8&255]^h[255&f]^e[++E],b=i[y>>>24]^a[g>>>16&255]^u[f>>>8&255]^h[255&p]^e[++E],g=i[g>>>24]^a[f>>>16&255]^u[p>>>8&255]^h[255&y]^e[++E],f=m,p=v,y=b;r[0]=d[f>>>24]<<24^d[p>>>16&255]<<16^d[y>>>8&255]<<8^d[255&g]^e[++E],r[n?3:1]=d[p>>>24]<<24^d[y>>>16&255]<<16^d[g>>>8&255]<<8^d[255&f]^e[++E],r[2]=d[y>>>24]<<24^d[g>>>16&255]<<16^d[f>>>8&255]<<8^d[255&p]^e[++E],r[n?1:3]=d[g>>>24]<<24^d[f>>>16&255]<<16^d[p>>>8&255]<<8^d[255&y]^e[++E]}function p(e){var t,r="AES-"+((e=e||{}).mode||"CBC").toUpperCase(),i=(t=e.decrypt?n.cipher.createDecipher(r,e.key):n.cipher.createCipher(r,e.key)).start;return t.start=function(e,r){var s=null;r instanceof n.util.ByteBuffer&&(s=r,r={}),(r=r||{}).output=s,r.iv=e,i.call(t,r)},t}},8791:(e,t,r)=>{var n=r(6547);r(5061),r(8217);var i=e.exports=n.asn1=n.asn1||{};function s(e,t,r){if(r>t){var n=new Error("Too few bytes to parse DER.");throw n.available=e.length(),n.remaining=t,n.requested=r,n}}i.Class={UNIVERSAL:0,APPLICATION:64,CONTEXT_SPECIFIC:128,PRIVATE:192},i.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},i.create=function(e,t,r,s,o){if(n.util.isArray(s)){for(var a=[],c=0;c<s.length;++c)void 0!==s[c]&&a.push(s[c]);s=a}var l={tagClass:e,type:t,constructed:r,composed:r||n.util.isArray(s),value:s};return o&&"bitStringContents"in o&&(l.bitStringContents=o.bitStringContents,l.original=i.copy(l)),l},i.copy=function(e,t){var r;if(n.util.isArray(e)){r=[];for(var s=0;s<e.length;++s)r.push(i.copy(e[s],t));return r}return"string"===typeof e?e:(r={tagClass:e.tagClass,type:e.type,constructed:e.constructed,composed:e.composed,value:i.copy(e.value,t)},t&&!t.excludeBitStringContents&&(r.bitStringContents=e.bitStringContents),r)},i.equals=function(e,t,r){if(n.util.isArray(e)){if(!n.util.isArray(t))return!1;if(e.length!==t.length)return!1;for(var s=0;s<e.length;++s)if(!i.equals(e[s],t[s]))return!1;return!0}if(typeof e!==typeof t)return!1;if("string"===typeof e)return e===t;var o=e.tagClass===t.tagClass&&e.type===t.type&&e.constructed===t.constructed&&e.composed===t.composed&&i.equals(e.value,t.value);return r&&r.includeBitStringContents&&(o=o&&e.bitStringContents===t.bitStringContents),o},i.getBerValueLength=function(e){var t=e.getByte();if(128!==t)return 128&t?e.getInt((127&t)<<3):t};function o(e,t,r,n){var a;s(e,t,2);var c=e.getByte();t--;var l=192&c,u=31&c;a=e.length();var h,d,f=function(e,t){var r=e.getByte();if(t--,128!==r){var n;if(128&r){var i=127&r;s(e,t,i),n=e.getInt(i<<3)}else n=r;if(n<0)throw new Error("Negative length: "+n);return n}}(e,t);if(t-=a-e.length(),void 0!==f&&f>t){if(n.strict){var p=new Error("Too few bytes to read ASN.1 value.");throw p.available=e.length(),p.remaining=t,p.requested=f,p}f=t}var y=32===(32&c);if(y)if(h=[],void 0===f)for(;;){if(s(e,t,2),e.bytes(2)===String.fromCharCode(0,0)){e.getBytes(2),t-=2;break}a=e.length(),h.push(o(e,t,r+1,n)),t-=a-e.length()}else for(;f>0;)a=e.length(),h.push(o(e,f,r+1,n)),t-=a-e.length(),f-=a-e.length();if(void 0===h&&l===i.Class.UNIVERSAL&&u===i.Type.BITSTRING&&(d=e.bytes(f)),void 0===h&&n.decodeBitStrings&&l===i.Class.UNIVERSAL&&u===i.Type.BITSTRING&&f>1){var g=e.read,m=t,v=0;if(u===i.Type.BITSTRING&&(s(e,t,1),v=e.getByte(),t--),0===v)try{a=e.length();var b=o(e,t,r+1,{strict:!0,decodeBitStrings:!0}),w=a-e.length();t-=w,u==i.Type.BITSTRING&&w++;var E=b.tagClass;w!==f||E!==i.Class.UNIVERSAL&&E!==i.Class.CONTEXT_SPECIFIC||(h=[b])}catch(S){}void 0===h&&(e.read=g,t=m)}if(void 0===h){if(void 0===f){if(n.strict)throw new Error("Non-constructed ASN.1 object of indefinite length.");f=t}if(u===i.Type.BMPSTRING)for(h="";f>0;f-=2)s(e,t,2),h+=String.fromCharCode(e.getInt16()),t-=2;else h=e.getBytes(f),t-=f}var _=void 0===d?null:{bitStringContents:d};return i.create(l,u,y,h,_)}i.fromDer=function(e,t){void 0===t&&(t={strict:!0,parseAllBytes:!0,decodeBitStrings:!0}),"boolean"===typeof t&&(t={strict:t,parseAllBytes:!0,decodeBitStrings:!0}),"strict"in t||(t.strict=!0),"parseAllBytes"in t||(t.parseAllBytes=!0),"decodeBitStrings"in t||(t.decodeBitStrings=!0),"string"===typeof e&&(e=n.util.createBuffer(e));var r=e.length(),i=o(e,e.length(),0,t);if(t.parseAllBytes&&0!==e.length()){var s=new Error("Unparsed DER bytes remain after ASN.1 parsing.");throw s.byteCount=r,s.remaining=e.length(),s}return i},i.toDer=function(e){var t=n.util.createBuffer(),r=e.tagClass|e.type,s=n.util.createBuffer(),o=!1;if("bitStringContents"in e&&(o=!0,e.original&&(o=i.equals(e,e.original))),o)s.putBytes(e.bitStringContents);else if(e.composed){e.constructed?r|=32:s.putByte(0);for(var a=0;a<e.value.length;++a)void 0!==e.value[a]&&s.putBuffer(i.toDer(e.value[a]))}else if(e.type===i.Type.BMPSTRING)for(a=0;a<e.value.length;++a)s.putInt16(e.value.charCodeAt(a));else e.type===i.Type.INTEGER&&e.value.length>1&&(0===e.value.charCodeAt(0)&&0===(128&e.value.charCodeAt(1))||255===e.value.charCodeAt(0)&&128===(128&e.value.charCodeAt(1)))?s.putBytes(e.value.substr(1)):s.putBytes(e.value);if(t.putByte(r),s.length()<=127)t.putByte(127&s.length());else{var c=s.length(),l="";do{l+=String.fromCharCode(255&c),c>>>=8}while(c>0);t.putByte(128|l.length);for(a=l.length-1;a>=0;--a)t.putByte(l.charCodeAt(a))}return t.putBuffer(s),t},i.oidToDer=function(e){var t,r,i,s,o=e.split("."),a=n.util.createBuffer();a.putByte(40*parseInt(o[0],10)+parseInt(o[1],10));for(var c=2;c<o.length;++c){t=!0,r=[],i=parseInt(o[c],10);do{s=127&i,i>>>=7,t||(s|=128),r.push(s),t=!1}while(i>0);for(var l=r.length-1;l>=0;--l)a.putByte(r[l])}return a},i.derToOid=function(e){var t;"string"===typeof e&&(e=n.util.createBuffer(e));var r=e.getByte();t=Math.floor(r/40)+"."+r%40;for(var i=0;e.length()>0;)i<<=7,128&(r=e.getByte())?i+=127&r:(t+="."+(i+r),i=0);return t},i.utcTimeToDate=function(e){var t=new Date,r=parseInt(e.substr(0,2),10);r=r>=50?1900+r:2e3+r;var n=parseInt(e.substr(2,2),10)-1,i=parseInt(e.substr(4,2),10),s=parseInt(e.substr(6,2),10),o=parseInt(e.substr(8,2),10),a=0;if(e.length>11){var c=e.charAt(10),l=10;"+"!==c&&"-"!==c&&(a=parseInt(e.substr(10,2),10),l+=2)}if(t.setUTCFullYear(r,n,i),t.setUTCHours(s,o,a,0),l&&("+"===(c=e.charAt(l))||"-"===c)){var u=60*parseInt(e.substr(l+1,2),10)+parseInt(e.substr(l+4,2),10);u*=6e4,"+"===c?t.setTime(+t-u):t.setTime(+t+u)}return t},i.generalizedTimeToDate=function(e){var t=new Date,r=parseInt(e.substr(0,4),10),n=parseInt(e.substr(4,2),10)-1,i=parseInt(e.substr(6,2),10),s=parseInt(e.substr(8,2),10),o=parseInt(e.substr(10,2),10),a=parseInt(e.substr(12,2),10),c=0,l=0,u=!1;"Z"===e.charAt(e.length-1)&&(u=!0);var h=e.length-5,d=e.charAt(h);"+"!==d&&"-"!==d||(l=60*parseInt(e.substr(h+1,2),10)+parseInt(e.substr(h+4,2),10),l*=6e4,"+"===d&&(l*=-1),u=!0);return"."===e.charAt(14)&&(c=1e3*parseFloat(e.substr(14),10)),u?(t.setUTCFullYear(r,n,i),t.setUTCHours(s,o,a,c),t.setTime(+t+l)):(t.setFullYear(r,n,i),t.setHours(s,o,a,c)),t},i.dateToUtcTime=function(e){if("string"===typeof e)return e;var t="",r=[];r.push((""+e.getUTCFullYear()).substr(2)),r.push(""+(e.getUTCMonth()+1)),r.push(""+e.getUTCDate()),r.push(""+e.getUTCHours()),r.push(""+e.getUTCMinutes()),r.push(""+e.getUTCSeconds());for(var n=0;n<r.length;++n)r[n].length<2&&(t+="0"),t+=r[n];return t+="Z"},i.dateToGeneralizedTime=function(e){if("string"===typeof e)return e;var t="",r=[];r.push(""+e.getUTCFullYear()),r.push(""+(e.getUTCMonth()+1)),r.push(""+e.getUTCDate()),r.push(""+e.getUTCHours()),r.push(""+e.getUTCMinutes()),r.push(""+e.getUTCSeconds());for(var n=0;n<r.length;++n)r[n].length<2&&(t+="0"),t+=r[n];return t+="Z"},i.integerToDer=function(e){var t=n.util.createBuffer();if(e>=-128&&e<128)return t.putSignedInt(e,8);if(e>=-32768&&e<32768)return t.putSignedInt(e,16);if(e>=-8388608&&e<8388608)return t.putSignedInt(e,24);if(e>=-2147483648&&e<2147483648)return t.putSignedInt(e,32);var r=new Error("Integer too large; max is 32-bits.");throw r.integer=e,r},i.derToInteger=function(e){"string"===typeof e&&(e=n.util.createBuffer(e));var t=8*e.length();if(t>32)throw new Error("Integer too large; max is 32-bits.");return e.getSignedInt(t)},i.validate=function(e,t,r,s){var o=!1;if(e.tagClass!==t.tagClass&&"undefined"!==typeof t.tagClass||e.type!==t.type&&"undefined"!==typeof t.type)s&&(e.tagClass!==t.tagClass&&s.push("["+t.name+'] Expected tag class "'+t.tagClass+'", got "'+e.tagClass+'"'),e.type!==t.type&&s.push("["+t.name+'] Expected type "'+t.type+'", got "'+e.type+'"'));else if(e.constructed===t.constructed||"undefined"===typeof t.constructed){if(o=!0,t.value&&n.util.isArray(t.value))for(var a=0,c=0;o&&c<t.value.length;++c)o=t.value[c].optional||!1,e.value[a]&&((o=i.validate(e.value[a],t.value[c],r,s))?++a:t.value[c].optional&&(o=!0)),!o&&s&&s.push("["+t.name+'] Tag class "'+t.tagClass+'", type "'+t.type+'" expected value length "'+t.value.length+'", got "'+e.value.length+'"');if(o&&r)if(t.capture&&(r[t.capture]=e.value),t.captureAsn1&&(r[t.captureAsn1]=e),t.captureBitStringContents&&"bitStringContents"in e&&(r[t.captureBitStringContents]=e.bitStringContents),t.captureBitStringValue&&"bitStringContents"in e)if(e.bitStringContents.length<2)r[t.captureBitStringValue]="";else{if(0!==e.bitStringContents.charCodeAt(0))throw new Error("captureBitStringValue only supported for zero unused bits");r[t.captureBitStringValue]=e.bitStringContents.slice(1)}}else s&&s.push("["+t.name+'] Expected constructed "'+t.constructed+'", got "'+e.constructed+'"');return o};var a=/[^\\u0000-\\u00ff]/;i.prettyPrint=function(e,t,r){var s="";r=r||2,(t=t||0)>0&&(s+="\n");for(var o="",c=0;c<t*r;++c)o+=" ";switch(s+=o+"Tag: ",e.tagClass){case i.Class.UNIVERSAL:s+="Universal:";break;case i.Class.APPLICATION:s+="Application:";break;case i.Class.CONTEXT_SPECIFIC:s+="Context-Specific:";break;case i.Class.PRIVATE:s+="Private:"}if(e.tagClass===i.Class.UNIVERSAL)switch(s+=e.type,e.type){case i.Type.NONE:s+=" (None)";break;case i.Type.BOOLEAN:s+=" (Boolean)";break;case i.Type.INTEGER:s+=" (Integer)";break;case i.Type.BITSTRING:s+=" (Bit string)";break;case i.Type.OCTETSTRING:s+=" (Octet string)";break;case i.Type.NULL:s+=" (Null)";break;case i.Type.OID:s+=" (Object Identifier)";break;case i.Type.ODESC:s+=" (Object Descriptor)";break;case i.Type.EXTERNAL:s+=" (External or Instance of)";break;case i.Type.REAL:s+=" (Real)";break;case i.Type.ENUMERATED:s+=" (Enumerated)";break;case i.Type.EMBEDDED:s+=" (Embedded PDV)";break;case i.Type.UTF8:s+=" (UTF8)";break;case i.Type.ROID:s+=" (Relative Object Identifier)";break;case i.Type.SEQUENCE:s+=" (Sequence)";break;case i.Type.SET:s+=" (Set)";break;case i.Type.PRINTABLESTRING:s+=" (Printable String)";break;case i.Type.IA5String:s+=" (IA5String (ASCII))";break;case i.Type.UTCTIME:s+=" (UTC time)";break;case i.Type.GENERALIZEDTIME:s+=" (Generalized time)";break;case i.Type.BMPSTRING:s+=" (BMP String)"}else s+=e.type;if(s+="\n",s+=o+"Constructed: "+e.constructed+"\n",e.composed){var l=0,u="";for(c=0;c<e.value.length;++c)void 0!==e.value[c]&&(l+=1,u+=i.prettyPrint(e.value[c],t+1,r),c+1<e.value.length&&(u+=","));s+=o+"Sub values: "+l+u}else{if(s+=o+"Value: ",e.type===i.Type.OID){var h=i.derToOid(e.value);s+=h,n.pki&&n.pki.oids&&h in n.pki.oids&&(s+=" ("+n.pki.oids[h]+") ")}if(e.type===i.Type.INTEGER)try{s+=i.derToInteger(e.value)}catch(f){s+="0x"+n.util.bytesToHex(e.value)}else if(e.type===i.Type.BITSTRING){if(e.value.length>1?s+="0x"+n.util.bytesToHex(e.value.slice(1)):s+="(none)",e.value.length>0){var d=e.value.charCodeAt(0);1==d?s+=" (1 unused bit shown)":d>1&&(s+=" ("+d+" unused bits shown)")}}else if(e.type===i.Type.OCTETSTRING)a.test(e.value)||(s+="("+e.value+") "),s+="0x"+n.util.bytesToHex(e.value);else if(e.type===i.Type.UTF8)try{s+=n.util.decodeUtf8(e.value)}catch(p){if("URI malformed"!==p.message)throw p;s+="0x"+n.util.bytesToHex(e.value)+" (malformed UTF8)"}else e.type===i.Type.PRINTABLESTRING||e.type===i.Type.IA5String?s+=e.value:a.test(e.value)?s+="0x"+n.util.bytesToHex(e.value):0===e.value.length?s+="[null]":s+=e.value}return s}},4626:e=>{var t={};e.exports=t;var r={};t.encode=function(e,t,r){if("string"!==typeof t)throw new TypeError('"alphabet" must be a string.');if(void 0!==r&&"number"!==typeof r)throw new TypeError('"maxline" must be a number.');var n="";if(e instanceof Uint8Array){var i=0,s=t.length,o=t.charAt(0),a=[0];for(i=0;i<e.length;++i){for(var c=0,l=e[i];c<a.length;++c)l+=a[c]<<8,a[c]=l%s,l=l/s|0;for(;l>0;)a.push(l%s),l=l/s|0}for(i=0;0===e[i]&&i<e.length-1;++i)n+=o;for(i=a.length-1;i>=0;--i)n+=t[a[i]]}else n=function(e,t){var r=0,n=t.length,i=t.charAt(0),s=[0];for(r=0;r<e.length();++r){for(var o=0,a=e.at(r);o<s.length;++o)a+=s[o]<<8,s[o]=a%n,a=a/n|0;for(;a>0;)s.push(a%n),a=a/n|0}var c="";for(r=0;0===e.at(r)&&r<e.length()-1;++r)c+=i;for(r=s.length-1;r>=0;--r)c+=t[s[r]];return c}(e,t);if(r){var u=new RegExp(".{1,"+r+"}","g");n=n.match(u).join("\r\n")}return n},t.decode=function(e,t){if("string"!==typeof e)throw new TypeError('"input" must be a string.');if("string"!==typeof t)throw new TypeError('"alphabet" must be a string.');var n=r[t];if(!n){n=r[t]=[];for(var i=0;i<t.length;++i)n[t.charCodeAt(i)]=i}e=e.replace(/\s/g,"");var s=t.length,o=t.charAt(0),a=[0];for(i=0;i<e.length;i++){var c=n[e.charCodeAt(i)];if(void 0===c)return;for(var l=0,u=c;l<a.length;++l)u+=a[l]*s,a[l]=255&u,u>>=8;for(;u>0;)a.push(255&u),u>>=8}for(var h=0;e[h]===o&&h<e.length-1;++h)a.push(0);return"undefined"!==typeof Buffer?Buffer.from(a.reverse()):new Uint8Array(a.reverse())}},6313:(e,t,r)=>{var n=r(6547);r(5061),e.exports=n.cipher=n.cipher||{},n.cipher.algorithms=n.cipher.algorithms||{},n.cipher.createCipher=function(e,t){var r=e;if("string"===typeof r&&(r=n.cipher.getAlgorithm(r))&&(r=r()),!r)throw new Error("Unsupported algorithm: "+e);return new n.cipher.BlockCipher({algorithm:r,key:t,decrypt:!1})},n.cipher.createDecipher=function(e,t){var r=e;if("string"===typeof r&&(r=n.cipher.getAlgorithm(r))&&(r=r()),!r)throw new Error("Unsupported algorithm: "+e);return new n.cipher.BlockCipher({algorithm:r,key:t,decrypt:!0})},n.cipher.registerAlgorithm=function(e,t){e=e.toUpperCase(),n.cipher.algorithms[e]=t},n.cipher.getAlgorithm=function(e){return(e=e.toUpperCase())in n.cipher.algorithms?n.cipher.algorithms[e]:null};var i=n.cipher.BlockCipher=function(e){this.algorithm=e.algorithm,this.mode=this.algorithm.mode,this.blockSize=this.mode.blockSize,this._finish=!1,this._input=null,this.output=null,this._op=e.decrypt?this.mode.decrypt:this.mode.encrypt,this._decrypt=e.decrypt,this.algorithm.initialize(e)};i.prototype.start=function(e){e=e||{};var t={};for(var r in e)t[r]=e[r];t.decrypt=this._decrypt,this._finish=!1,this._input=n.util.createBuffer(),this.output=e.output||n.util.createBuffer(),this.mode.start(t)},i.prototype.update=function(e){for(e&&this._input.putBuffer(e);!this._op.call(this.mode,this._input,this.output,this._finish)&&!this._finish;);this._input.compact()},i.prototype.finish=function(e){!e||"ECB"!==this.mode.name&&"CBC"!==this.mode.name||(this.mode.pad=function(t){return e(this.blockSize,t,!1)},this.mode.unpad=function(t){return e(this.blockSize,t,!0)});var t={};return t.decrypt=this._decrypt,t.overflow=this._input.length()%this.blockSize,!(!this._decrypt&&this.mode.pad&&!this.mode.pad(this._input,t))&&(this._finish=!0,this.update(),!(this._decrypt&&this.mode.unpad&&!this.mode.unpad(this.output,t))&&!(this.mode.afterFinish&&!this.mode.afterFinish(this.output,t)))}},9434:(e,t,r)=>{var n=r(6547);r(5061),n.cipher=n.cipher||{};var i=e.exports=n.cipher.modes=n.cipher.modes||{};function s(e,t){if("string"===typeof e&&(e=n.util.createBuffer(e)),n.util.isArray(e)&&e.length>4){var r=e;e=n.util.createBuffer();for(var i=0;i<r.length;++i)e.putByte(r[i])}if(e.length()<t)throw new Error("Invalid IV length; got "+e.length()+" bytes and expected "+t+" bytes.");if(!n.util.isArray(e)){var s=[],o=t/4;for(i=0;i<o;++i)s.push(e.getInt32());e=s}return e}function o(e){e[e.length-1]=e[e.length-1]+1&4294967295}function a(e){return[e/4294967296|0,4294967295&e]}i.ecb=function(e){e=e||{},this.name="ECB",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints)},i.ecb.prototype.start=function(e){},i.ecb.prototype.encrypt=function(e,t,r){if(e.length()<this.blockSize&&!(r&&e.length()>0))return!0;for(var n=0;n<this._ints;++n)this._inBlock[n]=e.getInt32();this.cipher.encrypt(this._inBlock,this._outBlock);for(n=0;n<this._ints;++n)t.putInt32(this._outBlock[n])},i.ecb.prototype.decrypt=function(e,t,r){if(e.length()<this.blockSize&&!(r&&e.length()>0))return!0;for(var n=0;n<this._ints;++n)this._inBlock[n]=e.getInt32();this.cipher.decrypt(this._inBlock,this._outBlock);for(n=0;n<this._ints;++n)t.putInt32(this._outBlock[n])},i.ecb.prototype.pad=function(e,t){var r=e.length()===this.blockSize?this.blockSize:this.blockSize-e.length();return e.fillWithByte(r,r),!0},i.ecb.prototype.unpad=function(e,t){if(t.overflow>0)return!1;var r=e.length(),n=e.at(r-1);return!(n>this.blockSize<<2)&&(e.truncate(n),!0)},i.cbc=function(e){e=e||{},this.name="CBC",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints)},i.cbc.prototype.start=function(e){if(null===e.iv){if(!this._prev)throw new Error("Invalid IV parameter.");this._iv=this._prev.slice(0)}else{if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=s(e.iv,this.blockSize),this._prev=this._iv.slice(0)}},i.cbc.prototype.encrypt=function(e,t,r){if(e.length()<this.blockSize&&!(r&&e.length()>0))return!0;for(var n=0;n<this._ints;++n)this._inBlock[n]=this._prev[n]^e.getInt32();this.cipher.encrypt(this._inBlock,this._outBlock);for(n=0;n<this._ints;++n)t.putInt32(this._outBlock[n]);this._prev=this._outBlock},i.cbc.prototype.decrypt=function(e,t,r){if(e.length()<this.blockSize&&!(r&&e.length()>0))return!0;for(var n=0;n<this._ints;++n)this._inBlock[n]=e.getInt32();this.cipher.decrypt(this._inBlock,this._outBlock);for(n=0;n<this._ints;++n)t.putInt32(this._prev[n]^this._outBlock[n]);this._prev=this._inBlock.slice(0)},i.cbc.prototype.pad=function(e,t){var r=e.length()===this.blockSize?this.blockSize:this.blockSize-e.length();return e.fillWithByte(r,r),!0},i.cbc.prototype.unpad=function(e,t){if(t.overflow>0)return!1;var r=e.length(),n=e.at(r-1);return!(n>this.blockSize<<2)&&(e.truncate(n),!0)},i.cfb=function(e){e=e||{},this.name="CFB",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialBlock=new Array(this._ints),this._partialOutput=n.util.createBuffer(),this._partialBytes=0},i.cfb.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=s(e.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0},i.cfb.prototype.encrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var i=0;i<this._ints;++i)this._inBlock[i]=e.getInt32()^this._outBlock[i],t.putInt32(this._inBlock[i]);else{var s=(this.blockSize-n)%this.blockSize;s>0&&(s=this.blockSize-s),this._partialOutput.clear();for(i=0;i<this._ints;++i)this._partialBlock[i]=e.getInt32()^this._outBlock[i],this._partialOutput.putInt32(this._partialBlock[i]);if(s>0)e.read-=this.blockSize;else for(i=0;i<this._ints;++i)this._inBlock[i]=this._partialBlock[i];if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),s>0&&!r)return t.putBytes(this._partialOutput.getBytes(s-this._partialBytes)),this._partialBytes=s,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}},i.cfb.prototype.decrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var i=0;i<this._ints;++i)this._inBlock[i]=e.getInt32(),t.putInt32(this._inBlock[i]^this._outBlock[i]);else{var s=(this.blockSize-n)%this.blockSize;s>0&&(s=this.blockSize-s),this._partialOutput.clear();for(i=0;i<this._ints;++i)this._partialBlock[i]=e.getInt32(),this._partialOutput.putInt32(this._partialBlock[i]^this._outBlock[i]);if(s>0)e.read-=this.blockSize;else for(i=0;i<this._ints;++i)this._inBlock[i]=this._partialBlock[i];if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),s>0&&!r)return t.putBytes(this._partialOutput.getBytes(s-this._partialBytes)),this._partialBytes=s,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}},i.ofb=function(e){e=e||{},this.name="OFB",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=n.util.createBuffer(),this._partialBytes=0},i.ofb.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=s(e.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0},i.ofb.prototype.encrypt=function(e,t,r){var n=e.length();if(0===e.length())return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var i=0;i<this._ints;++i)t.putInt32(e.getInt32()^this._outBlock[i]),this._inBlock[i]=this._outBlock[i];else{var s=(this.blockSize-n)%this.blockSize;s>0&&(s=this.blockSize-s),this._partialOutput.clear();for(i=0;i<this._ints;++i)this._partialOutput.putInt32(e.getInt32()^this._outBlock[i]);if(s>0)e.read-=this.blockSize;else for(i=0;i<this._ints;++i)this._inBlock[i]=this._outBlock[i];if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),s>0&&!r)return t.putBytes(this._partialOutput.getBytes(s-this._partialBytes)),this._partialBytes=s,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}},i.ofb.prototype.decrypt=i.ofb.prototype.encrypt,i.ctr=function(e){e=e||{},this.name="CTR",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=n.util.createBuffer(),this._partialBytes=0},i.ctr.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=s(e.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0},i.ctr.prototype.encrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var i=0;i<this._ints;++i)t.putInt32(e.getInt32()^this._outBlock[i]);else{var s=(this.blockSize-n)%this.blockSize;s>0&&(s=this.blockSize-s),this._partialOutput.clear();for(i=0;i<this._ints;++i)this._partialOutput.putInt32(e.getInt32()^this._outBlock[i]);if(s>0&&(e.read-=this.blockSize),this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),s>0&&!r)return t.putBytes(this._partialOutput.getBytes(s-this._partialBytes)),this._partialBytes=s,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}o(this._inBlock)},i.ctr.prototype.decrypt=i.ctr.prototype.encrypt,i.gcm=function(e){e=e||{},this.name="GCM",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints),this._partialOutput=n.util.createBuffer(),this._partialBytes=0,this._R=3774873600},i.gcm.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");var t,r=n.util.createBuffer(e.iv);if(this._cipherLength=0,t="additionalData"in e?n.util.createBuffer(e.additionalData):n.util.createBuffer(),this._tagLength="tagLength"in e?e.tagLength:128,this._tag=null,e.decrypt&&(this._tag=n.util.createBuffer(e.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=r.length();if(12===i)this._j0=[r.getInt32(),r.getInt32(),r.getInt32(),1];else{for(this._j0=[0,0,0,0];r.length()>0;)this._j0=this.ghash(this._hashSubkey,this._j0,[r.getInt32(),r.getInt32(),r.getInt32(),r.getInt32()]);this._j0=this.ghash(this._hashSubkey,this._j0,[0,0].concat(a(8*i)))}this._inBlock=this._j0.slice(0),o(this._inBlock),this._partialBytes=0,t=n.util.createBuffer(t),this._aDataLength=a(8*t.length());var s=t.length()%this.blockSize;for(s&&t.fillWithByte(0,this.blockSize-s),this._s=[0,0,0,0];t.length()>0;)this._s=this.ghash(this._hashSubkey,this._s,[t.getInt32(),t.getInt32(),t.getInt32(),t.getInt32()])},i.gcm.prototype.encrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize){for(var i=0;i<this._ints;++i)t.putInt32(this._outBlock[i]^=e.getInt32());this._cipherLength+=this.blockSize}else{var s=(this.blockSize-n)%this.blockSize;s>0&&(s=this.blockSize-s),this._partialOutput.clear();for(i=0;i<this._ints;++i)this._partialOutput.putInt32(e.getInt32()^this._outBlock[i]);if(s<=0||r){if(r){var a=n%this.blockSize;this._cipherLength+=a,this._partialOutput.truncate(this.blockSize-a)}else this._cipherLength+=this.blockSize;for(i=0;i<this._ints;++i)this._outBlock[i]=this._partialOutput.getInt32();this._partialOutput.read-=this.blockSize}if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),s>0&&!r)return e.read-=this.blockSize,t.putBytes(this._partialOutput.getBytes(s-this._partialBytes)),this._partialBytes=s,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}this._s=this.ghash(this._hashSubkey,this._s,this._outBlock),o(this._inBlock)},i.gcm.prototype.decrypt=function(e,t,r){var n=e.length();if(n<this.blockSize&&!(r&&n>0))return!0;this.cipher.encrypt(this._inBlock,this._outBlock),o(this._inBlock),this._hashBlock[0]=e.getInt32(),this._hashBlock[1]=e.getInt32(),this._hashBlock[2]=e.getInt32(),this._hashBlock[3]=e.getInt32(),this._s=this.ghash(this._hashSubkey,this._s,this._hashBlock);for(var i=0;i<this._ints;++i)t.putInt32(this._outBlock[i]^this._hashBlock[i]);n<this.blockSize?this._cipherLength+=n%this.blockSize:this._cipherLength+=this.blockSize},i.gcm.prototype.afterFinish=function(e,t){var r=!0;t.decrypt&&t.overflow&&e.truncate(this.blockSize-t.overflow),this.tag=n.util.createBuffer();var i=this._aDataLength.concat(a(8*this._cipherLength));this._s=this.ghash(this._hashSubkey,this._s,i);var s=[];this.cipher.encrypt(this._j0,s);for(var o=0;o<this._ints;++o)this.tag.putInt32(this._s[o]^s[o]);return this.tag.truncate(this.tag.length()%(this._tagLength/8)),t.decrypt&&this.tag.bytes()!==this._tag&&(r=!1),r},i.gcm.prototype.multiply=function(e,t){for(var r=[0,0,0,0],n=t.slice(0),i=0;i<128;++i){e[i/32|0]&1<<31-i%32&&(r[0]^=n[0],r[1]^=n[1],r[2]^=n[2],r[3]^=n[3]),this.pow(n,n)}return r},i.gcm.prototype.pow=function(e,t){for(var r=1&e[3],n=3;n>0;--n)t[n]=e[n]>>>1|(1&e[n-1])<<31;t[0]=e[0]>>>1,r&&(t[0]^=this._R)},i.gcm.prototype.tableMultiply=function(e){for(var t=[0,0,0,0],r=0;r<32;++r){var n=e[r/8|0]>>>4*(7-r%8)&15,i=this._m[r][n];t[0]^=i[0],t[1]^=i[1],t[2]^=i[2],t[3]^=i[3]}return t},i.gcm.prototype.ghash=function(e,t,r){return t[0]^=r[0],t[1]^=r[1],t[2]^=r[2],t[3]^=r[3],this.tableMultiply(t)},i.gcm.prototype.generateHashTable=function(e,t){for(var r=8/t,n=4*r,i=16*r,s=new Array(i),o=0;o<i;++o){var a=[0,0,0,0],c=(n-1-o%n)*t;a[o/n|0]=1<<t-1<<c,s[o]=this.generateSubHashTable(this.multiply(a,e),t)}return s},i.gcm.prototype.generateSubHashTable=function(e,t){var r=1<<t,n=r>>>1,i=new Array(r);i[n]=e.slice(0);for(var s=n>>>1;s>0;)this.pow(i[2*s],i[s]=[]),s>>=1;for(s=2;s<n;){for(var o=1;o<s;++o){var a=i[s],c=i[o];i[s+o]=[a[0]^c[0],a[1]^c[1],a[2]^c[2],a[3]^c[3]]}s*=2}for(i[0]=[0,0,0,0],s=n+1;s<r;++s){var l=i[s^n];i[s]=[e[0]^l[0],e[1]^l[1],e[2]^l[2],e[3]^l[3]]}return i}},3280:(e,t,r)=>{var n=r(6547);function i(e,t){n.cipher.registerAlgorithm(e,(function(){return new n.des.Algorithm(e,t)}))}r(6313),r(9434),r(5061),e.exports=n.des=n.des||{},n.des.startEncrypting=function(e,t,r,n){var i=p({key:e,output:r,decrypt:!1,mode:n||(null===t?"ECB":"CBC")});return i.start(t),i},n.des.createEncryptionCipher=function(e,t){return p({key:e,output:null,decrypt:!1,mode:t})},n.des.startDecrypting=function(e,t,r,n){var i=p({key:e,output:r,decrypt:!0,mode:n||(null===t?"ECB":"CBC")});return i.start(t),i},n.des.createDecryptionCipher=function(e,t){return p({key:e,output:null,decrypt:!0,mode:t})},n.des.Algorithm=function(e,t){var r=this;r.name=e,r.mode=new t({blockSize:8,cipher:{encrypt:function(e,t){return f(r._keys,e,t,!1)},decrypt:function(e,t){return f(r._keys,e,t,!0)}}}),r._init=!1},n.des.Algorithm.prototype.initialize=function(e){if(!this._init){var t=n.util.createBuffer(e.key);if(0===this.name.indexOf("3DES")&&24!==t.length())throw new Error("Invalid Triple-DES key size: "+8*t.length());this._keys=function(e){for(var t,r=[0,4,536870912,536870916,65536,65540,536936448,536936452,512,516,536871424,536871428,66048,66052,536936960,536936964],n=[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],s=[0,2097152,134217728,136314880,8192,2105344,134225920,136323072,131072,2228224,134348800,136445952,139264,2236416,134356992,136454144],o=[0,262144,16,262160,0,262144,16,262160,4096,266240,4112,266256,4096,266240,4112,266256],a=[0,1024,32,1056,0,1024,32,1056,33554432,33555456,33554464,33555488,33554432,33555456,33554464,33555488],c=[0,268435456,524288,268959744,2,268435458,524290,268959746,0,268435456,524288,268959744,2,268435458,524290,268959746],l=[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],h=[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],f=[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],g=e.length()>8?3:1,m=[],v=[0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0],b=0,w=0;w<g;w++){var E=e.getInt32(),_=e.getInt32();E^=(t=252645135&(E>>>4^_))<<4,E^=t=65535&((_^=t)>>>-16^E),E^=(t=858993459&(E>>>2^(_^=t<<-16)))<<2,E^=t=65535&((_^=t)>>>-16^E),E^=(t=1431655765&(E>>>1^(_^=t<<-16)))<<1,E^=t=16711935&((_^=t)>>>8^E),t=(E^=(t=1431655765&(E>>>1^(_^=t<<8)))<<1)<<8|(_^=t)>>>20&240,E=_<<24|_<<8&16711680|_>>>8&65280|_>>>24&240,_=t;for(var S=0;S<v.length;++S){v[S]?(E=E<<2|E>>>26,_=_<<2|_>>>26):(E=E<<1|E>>>27,_=_<<1|_>>>27),_&=-15;var I=r[(E&=-15)>>>28]|n[E>>>24&15]|i[E>>>20&15]|s[E>>>16&15]|o[E>>>12&15]|a[E>>>8&15]|c[E>>>4&15],C=l[_>>>28]|u[_>>>24&15]|h[_>>>20&15]|d[_>>>16&15]|f[_>>>12&15]|p[_>>>8&15]|y[_>>>4&15];t=65535&(C>>>16^I),m[b++]=I^t,m[b++]=C^t<<16}}return m}(t),this._init=!0}},i("DES-ECB",n.cipher.modes.ecb),i("DES-CBC",n.cipher.modes.cbc),i("DES-CFB",n.cipher.modes.cfb),i("DES-OFB",n.cipher.modes.ofb),i("DES-CTR",n.cipher.modes.ctr),i("3DES-ECB",n.cipher.modes.ecb),i("3DES-CBC",n.cipher.modes.cbc),i("3DES-CFB",n.cipher.modes.cfb),i("3DES-OFB",n.cipher.modes.ofb),i("3DES-CTR",n.cipher.modes.ctr);var s=[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],o=[-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],a=[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],c=[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],l=[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],u=[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],h=[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],d=[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 f(e,t,r,n){var i,f,p=32===e.length?3:9;i=3===p?n?[30,-2,-2]:[0,32,2]:n?[94,62,-2,32,64,2,30,-2,-2]:[0,32,2,62,30,-2,64,96,2];var y=t[0],g=t[1];y^=(f=252645135&(y>>>4^g))<<4,y^=(f=65535&(y>>>16^(g^=f)))<<16,y^=f=858993459&((g^=f)>>>2^y),y^=f=16711935&((g^=f<<2)>>>8^y),y=(y^=(f=1431655765&(y>>>1^(g^=f<<8)))<<1)<<1|y>>>31,g=(g^=f)<<1|g>>>31;for(var m=0;m<p;m+=3){for(var v=i[m+1],b=i[m+2],w=i[m];w!=v;w+=b){var E=g^e[w],_=(g>>>4|g<<28)^e[w+1];f=y,y=g,g=f^(o[E>>>24&63]|c[E>>>16&63]|u[E>>>8&63]|d[63&E]|s[_>>>24&63]|a[_>>>16&63]|l[_>>>8&63]|h[63&_])}f=y,y=g,g=f}g=g>>>1|g<<31,g^=f=1431655765&((y=y>>>1|y<<31)>>>1^g),g^=(f=16711935&(g>>>8^(y^=f<<1)))<<8,g^=(f=858993459&(g>>>2^(y^=f)))<<2,g^=f=65535&((y^=f)>>>16^g),g^=f=252645135&((y^=f<<16)>>>4^g),y^=f<<4,r[0]=y,r[1]=g}function p(e){var t,r="DES-"+((e=e||{}).mode||"CBC").toUpperCase(),i=(t=e.decrypt?n.cipher.createDecipher(r,e.key):n.cipher.createCipher(r,e.key)).start;return t.start=function(e,r){var s=null;r instanceof n.util.ByteBuffer&&(s=r,r={}),(r=r||{}).output=s,r.iv=e,i.call(t,r)},t}},6547:e=>{e.exports={options:{usePureJavaScript:!1}}},1722:(e,t,r)=>{var n=r(6547);r(9893),r(5061),(e.exports=n.hmac=n.hmac||{}).create=function(){var e=null,t=null,r=null,i=null,s={start:function(s,o){if(null!==s)if("string"===typeof s){if(!((s=s.toLowerCase())in n.md.algorithms))throw new Error('Unknown hash algorithm "'+s+'"');t=n.md.algorithms[s].create()}else t=s;if(null===o)o=e;else{if("string"===typeof o)o=n.util.createBuffer(o);else if(n.util.isArray(o)){var a=o;o=n.util.createBuffer();for(var c=0;c<a.length;++c)o.putByte(a[c])}var l=o.length();l>t.blockLength&&(t.start(),t.update(o.bytes()),o=t.digest()),r=n.util.createBuffer(),i=n.util.createBuffer(),l=o.length();for(c=0;c<l;++c){a=o.at(c);r.putByte(54^a),i.putByte(92^a)}if(l<t.blockLength)for(a=t.blockLength-l,c=0;c<a;++c)r.putByte(54),i.putByte(92);e=o,r=r.bytes(),i=i.bytes()}t.start(),t.update(r)},update:function(e){t.update(e)},getMac:function(){var e=t.digest().bytes();return t.start(),t.update(i),t.update(e),t.digest()}};return s.digest=s.getMac,s}},9259:(e,t,r)=>{var n,i=r(6547);e.exports=i.jsbn=i.jsbn||{};function s(e,t,r){this.data=[],null!=e&&("number"==typeof e?this.fromNumber(e,t,r):null==t&&"string"!=typeof e?this.fromString(e,256):this.fromString(e,t))}function o(){return new s(null)}function a(e,t,r,n,i,s){for(var o=16383&t,a=t>>14;--s>=0;){var c=16383&this.data[e],l=this.data[e++]>>14,u=a*c+l*o;i=((c=o*c+((16383&u)<<14)+r.data[n]+i)>>28)+(u>>14)+a*l,r.data[n++]=268435455&c}return i}i.jsbn.BigInteger=s,"undefined"===typeof navigator?(s.prototype.am=a,n=28):"Microsoft Internet Explorer"==navigator.appName?(s.prototype.am=function(e,t,r,n,i,s){for(var o=32767&t,a=t>>15;--s>=0;){var c=32767&this.data[e],l=this.data[e++]>>15,u=a*c+l*o;i=((c=o*c+((32767&u)<<15)+r.data[n]+(1073741823&i))>>>30)+(u>>>15)+a*l+(i>>>30),r.data[n++]=1073741823&c}return i},n=30):"Netscape"!=navigator.appName?(s.prototype.am=function(e,t,r,n,i,s){for(;--s>=0;){var o=t*this.data[e++]+r.data[n]+i;i=Math.floor(o/67108864),r.data[n++]=67108863&o}return i},n=26):(s.prototype.am=a,n=28),s.prototype.DB=n,s.prototype.DM=(1<<n)-1,s.prototype.DV=1<<n;s.prototype.FV=Math.pow(2,52),s.prototype.F1=52-n,s.prototype.F2=2*n-52;var c,l,u=new Array;for(c="0".charCodeAt(0),l=0;l<=9;++l)u[c++]=l;for(c="a".charCodeAt(0),l=10;l<36;++l)u[c++]=l;for(c="A".charCodeAt(0),l=10;l<36;++l)u[c++]=l;function h(e){return"0123456789abcdefghijklmnopqrstuvwxyz".charAt(e)}function d(e,t){var r=u[e.charCodeAt(t)];return null==r?-1:r}function f(e){var t=o();return t.fromInt(e),t}function p(e){var t,r=1;return 0!=(t=e>>>16)&&(e=t,r+=16),0!=(t=e>>8)&&(e=t,r+=8),0!=(t=e>>4)&&(e=t,r+=4),0!=(t=e>>2)&&(e=t,r+=2),0!=(t=e>>1)&&(e=t,r+=1),r}function y(e){this.m=e}function g(e){this.m=e,this.mp=e.invDigit(),this.mpl=32767&this.mp,this.mph=this.mp>>15,this.um=(1<<e.DB-15)-1,this.mt2=2*e.t}function m(e,t){return e&t}function v(e,t){return e|t}function b(e,t){return e^t}function w(e,t){return e&~t}function E(e){if(0==e)return-1;var t=0;return 0==(65535&e)&&(e>>=16,t+=16),0==(255&e)&&(e>>=8,t+=8),0==(15&e)&&(e>>=4,t+=4),0==(3&e)&&(e>>=2,t+=2),0==(1&e)&&++t,t}function _(e){for(var t=0;0!=e;)e&=e-1,++t;return t}function S(){}function I(e){return e}function C(e){this.r2=o(),this.q3=o(),s.ONE.dlShiftTo(2*e.t,this.r2),this.mu=this.r2.divide(e),this.m=e}y.prototype.convert=function(e){return e.s<0||e.compareTo(this.m)>=0?e.mod(this.m):e},y.prototype.revert=function(e){return e},y.prototype.reduce=function(e){e.divRemTo(this.m,null,e)},y.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r),this.reduce(r)},y.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)},g.prototype.convert=function(e){var t=o();return e.abs().dlShiftTo(this.m.t,t),t.divRemTo(this.m,null,t),e.s<0&&t.compareTo(s.ZERO)>0&&this.m.subTo(t,t),t},g.prototype.revert=function(e){var t=o();return e.copyTo(t),this.reduce(t),t},g.prototype.reduce=function(e){for(;e.t<=this.mt2;)e.data[e.t++]=0;for(var t=0;t<this.m.t;++t){var r=32767&e.data[t],n=r*this.mpl+((r*this.mph+(e.data[t]>>15)*this.mpl&this.um)<<15)&e.DM;for(r=t+this.m.t,e.data[r]+=this.m.am(0,n,e,t,0,this.m.t);e.data[r]>=e.DV;)e.data[r]-=e.DV,e.data[++r]++}e.clamp(),e.drShiftTo(this.m.t,e),e.compareTo(this.m)>=0&&e.subTo(this.m,e)},g.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r),this.reduce(r)},g.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)},s.prototype.copyTo=function(e){for(var t=this.t-1;t>=0;--t)e.data[t]=this.data[t];e.t=this.t,e.s=this.s},s.prototype.fromInt=function(e){this.t=1,this.s=e<0?-1:0,e>0?this.data[0]=e:e<-1?this.data[0]=e+this.DV:this.t=0},s.prototype.fromString=function(e,t){var r;if(16==t)r=4;else if(8==t)r=3;else if(256==t)r=8;else if(2==t)r=1;else if(32==t)r=5;else{if(4!=t)return void this.fromRadix(e,t);r=2}this.t=0,this.s=0;for(var n=e.length,i=!1,o=0;--n>=0;){var a=8==r?255&e[n]:d(e,n);a<0?"-"==e.charAt(n)&&(i=!0):(i=!1,0==o?this.data[this.t++]=a:o+r>this.DB?(this.data[this.t-1]|=(a&(1<<this.DB-o)-1)<<o,this.data[this.t++]=a>>this.DB-o):this.data[this.t-1]|=a<<o,(o+=r)>=this.DB&&(o-=this.DB))}8==r&&0!=(128&e[0])&&(this.s=-1,o>0&&(this.data[this.t-1]|=(1<<this.DB-o)-1<<o)),this.clamp(),i&&s.ZERO.subTo(this,this)},s.prototype.clamp=function(){for(var e=this.s&this.DM;this.t>0&&this.data[this.t-1]==e;)--this.t},s.prototype.dlShiftTo=function(e,t){var r;for(r=this.t-1;r>=0;--r)t.data[r+e]=this.data[r];for(r=e-1;r>=0;--r)t.data[r]=0;t.t=this.t+e,t.s=this.s},s.prototype.drShiftTo=function(e,t){for(var r=e;r<this.t;++r)t.data[r-e]=this.data[r];t.t=Math.max(this.t-e,0),t.s=this.s},s.prototype.lShiftTo=function(e,t){var r,n=e%this.DB,i=this.DB-n,s=(1<<i)-1,o=Math.floor(e/this.DB),a=this.s<<n&this.DM;for(r=this.t-1;r>=0;--r)t.data[r+o+1]=this.data[r]>>i|a,a=(this.data[r]&s)<<n;for(r=o-1;r>=0;--r)t.data[r]=0;t.data[o]=a,t.t=this.t+o+1,t.s=this.s,t.clamp()},s.prototype.rShiftTo=function(e,t){t.s=this.s;var r=Math.floor(e/this.DB);if(r>=this.t)t.t=0;else{var n=e%this.DB,i=this.DB-n,s=(1<<n)-1;t.data[0]=this.data[r]>>n;for(var o=r+1;o<this.t;++o)t.data[o-r-1]|=(this.data[o]&s)<<i,t.data[o-r]=this.data[o]>>n;n>0&&(t.data[this.t-r-1]|=(this.s&s)<<i),t.t=this.t-r,t.clamp()}},s.prototype.subTo=function(e,t){for(var r=0,n=0,i=Math.min(e.t,this.t);r<i;)n+=this.data[r]-e.data[r],t.data[r++]=n&this.DM,n>>=this.DB;if(e.t<this.t){for(n-=e.s;r<this.t;)n+=this.data[r],t.data[r++]=n&this.DM,n>>=this.DB;n+=this.s}else{for(n+=this.s;r<e.t;)n-=e.data[r],t.data[r++]=n&this.DM,n>>=this.DB;n-=e.s}t.s=n<0?-1:0,n<-1?t.data[r++]=this.DV+n:n>0&&(t.data[r++]=n),t.t=r,t.clamp()},s.prototype.multiplyTo=function(e,t){var r=this.abs(),n=e.abs(),i=r.t;for(t.t=i+n.t;--i>=0;)t.data[i]=0;for(i=0;i<n.t;++i)t.data[i+r.t]=r.am(0,n.data[i],t,i,0,r.t);t.s=0,t.clamp(),this.s!=e.s&&s.ZERO.subTo(t,t)},s.prototype.squareTo=function(e){for(var t=this.abs(),r=e.t=2*t.t;--r>=0;)e.data[r]=0;for(r=0;r<t.t-1;++r){var n=t.am(r,t.data[r],e,2*r,0,1);(e.data[r+t.t]+=t.am(r+1,2*t.data[r],e,2*r+1,n,t.t-r-1))>=t.DV&&(e.data[r+t.t]-=t.DV,e.data[r+t.t+1]=1)}e.t>0&&(e.data[e.t-1]+=t.am(r,t.data[r],e,2*r,0,1)),e.s=0,e.clamp()},s.prototype.divRemTo=function(e,t,r){var n=e.abs();if(!(n.t<=0)){var i=this.abs();if(i.t<n.t)return null!=t&&t.fromInt(0),void(null!=r&&this.copyTo(r));null==r&&(r=o());var a=o(),c=this.s,l=e.s,u=this.DB-p(n.data[n.t-1]);u>0?(n.lShiftTo(u,a),i.lShiftTo(u,r)):(n.copyTo(a),i.copyTo(r));var h=a.t,d=a.data[h-1];if(0!=d){var f=d*(1<<this.F1)+(h>1?a.data[h-2]>>this.F2:0),y=this.FV/f,g=(1<<this.F1)/f,m=1<<this.F2,v=r.t,b=v-h,w=null==t?o():t;for(a.dlShiftTo(b,w),r.compareTo(w)>=0&&(r.data[r.t++]=1,r.subTo(w,r)),s.ONE.dlShiftTo(h,w),w.subTo(a,a);a.t<h;)a.data[a.t++]=0;for(;--b>=0;){var E=r.data[--v]==d?this.DM:Math.floor(r.data[v]*y+(r.data[v-1]+m)*g);if((r.data[v]+=a.am(0,E,r,b,0,h))<E)for(a.dlShiftTo(b,w),r.subTo(w,r);r.data[v]<--E;)r.subTo(w,r)}null!=t&&(r.drShiftTo(h,t),c!=l&&s.ZERO.subTo(t,t)),r.t=h,r.clamp(),u>0&&r.rShiftTo(u,r),c<0&&s.ZERO.subTo(r,r)}}},s.prototype.invDigit=function(){if(this.t<1)return 0;var e=this.data[0];if(0==(1&e))return 0;var t=3&e;return(t=(t=(t=(t=t*(2-(15&e)*t)&15)*(2-(255&e)*t)&255)*(2-((65535&e)*t&65535))&65535)*(2-e*t%this.DV)%this.DV)>0?this.DV-t:-t},s.prototype.isEven=function(){return 0==(this.t>0?1&this.data[0]:this.s)},s.prototype.exp=function(e,t){if(e>4294967295||e<1)return s.ONE;var r=o(),n=o(),i=t.convert(this),a=p(e)-1;for(i.copyTo(r);--a>=0;)if(t.sqrTo(r,n),(e&1<<a)>0)t.mulTo(n,i,r);else{var c=r;r=n,n=c}return t.revert(r)},s.prototype.toString=function(e){if(this.s<0)return"-"+this.negate().toString(e);var t;if(16==e)t=4;else if(8==e)t=3;else if(2==e)t=1;else if(32==e)t=5;else{if(4!=e)return this.toRadix(e);t=2}var r,n=(1<<t)-1,i=!1,s="",o=this.t,a=this.DB-o*this.DB%t;if(o-- >0)for(a<this.DB&&(r=this.data[o]>>a)>0&&(i=!0,s=h(r));o>=0;)a<t?(r=(this.data[o]&(1<<a)-1)<<t-a,r|=this.data[--o]>>(a+=this.DB-t)):(r=this.data[o]>>(a-=t)&n,a<=0&&(a+=this.DB,--o)),r>0&&(i=!0),i&&(s+=h(r));return i?s:"0"},s.prototype.negate=function(){var e=o();return s.ZERO.subTo(this,e),e},s.prototype.abs=function(){return this.s<0?this.negate():this},s.prototype.compareTo=function(e){var t=this.s-e.s;if(0!=t)return t;var r=this.t;if(0!=(t=r-e.t))return this.s<0?-t:t;for(;--r>=0;)if(0!=(t=this.data[r]-e.data[r]))return t;return 0},s.prototype.bitLength=function(){return this.t<=0?0:this.DB*(this.t-1)+p(this.data[this.t-1]^this.s&this.DM)},s.prototype.mod=function(e){var t=o();return this.abs().divRemTo(e,null,t),this.s<0&&t.compareTo(s.ZERO)>0&&e.subTo(t,t),t},s.prototype.modPowInt=function(e,t){var r;return r=e<256||t.isEven()?new y(t):new g(t),this.exp(e,r)},s.ZERO=f(0),s.ONE=f(1),S.prototype.convert=I,S.prototype.revert=I,S.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r)},S.prototype.sqrTo=function(e,t){e.squareTo(t)},C.prototype.convert=function(e){if(e.s<0||e.t>2*this.m.t)return e.mod(this.m);if(e.compareTo(this.m)<0)return e;var t=o();return e.copyTo(t),this.reduce(t),t},C.prototype.revert=function(e){return e},C.prototype.reduce=function(e){for(e.drShiftTo(this.m.t-1,this.r2),e.t>this.m.t+1&&(e.t=this.m.t+1,e.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);e.compareTo(this.r2)<0;)e.dAddOffset(1,this.m.t+1);for(e.subTo(this.r2,e);e.compareTo(this.m)>=0;)e.subTo(this.m,e)},C.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r),this.reduce(r)},C.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)};var A=[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],T=(1<<26)/A[A.length-1];s.prototype.chunkSize=function(e){return Math.floor(Math.LN2*this.DB/Math.log(e))},s.prototype.toRadix=function(e){if(null==e&&(e=10),0==this.signum()||e<2||e>36)return"0";var t=this.chunkSize(e),r=Math.pow(e,t),n=f(r),i=o(),s=o(),a="";for(this.divRemTo(n,i,s);i.signum()>0;)a=(r+s.intValue()).toString(e).substr(1)+a,i.divRemTo(n,i,s);return s.intValue().toString(e)+a},s.prototype.fromRadix=function(e,t){this.fromInt(0),null==t&&(t=10);for(var r=this.chunkSize(t),n=Math.pow(t,r),i=!1,o=0,a=0,c=0;c<e.length;++c){var l=d(e,c);l<0?"-"==e.charAt(c)&&0==this.signum()&&(i=!0):(a=t*a+l,++o>=r&&(this.dMultiply(n),this.dAddOffset(a,0),o=0,a=0))}o>0&&(this.dMultiply(Math.pow(t,o)),this.dAddOffset(a,0)),i&&s.ZERO.subTo(this,this)},s.prototype.fromNumber=function(e,t,r){if("number"==typeof t)if(e<2)this.fromInt(1);else for(this.fromNumber(e,r),this.testBit(e-1)||this.bitwiseTo(s.ONE.shiftLeft(e-1),v,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(t);)this.dAddOffset(2,0),this.bitLength()>e&&this.subTo(s.ONE.shiftLeft(e-1),this);else{var n=new Array,i=7&e;n.length=1+(e>>3),t.nextBytes(n),i>0?n[0]&=(1<<i)-1:n[0]=0,this.fromString(n,256)}},s.prototype.bitwiseTo=function(e,t,r){var n,i,s=Math.min(e.t,this.t);for(n=0;n<s;++n)r.data[n]=t(this.data[n],e.data[n]);if(e.t<this.t){for(i=e.s&this.DM,n=s;n<this.t;++n)r.data[n]=t(this.data[n],i);r.t=this.t}else{for(i=this.s&this.DM,n=s;n<e.t;++n)r.data[n]=t(i,e.data[n]);r.t=e.t}r.s=t(this.s,e.s),r.clamp()},s.prototype.changeBit=function(e,t){var r=s.ONE.shiftLeft(e);return this.bitwiseTo(r,t,r),r},s.prototype.addTo=function(e,t){for(var r=0,n=0,i=Math.min(e.t,this.t);r<i;)n+=this.data[r]+e.data[r],t.data[r++]=n&this.DM,n>>=this.DB;if(e.t<this.t){for(n+=e.s;r<this.t;)n+=this.data[r],t.data[r++]=n&this.DM,n>>=this.DB;n+=this.s}else{for(n+=this.s;r<e.t;)n+=e.data[r],t.data[r++]=n&this.DM,n>>=this.DB;n+=e.s}t.s=n<0?-1:0,n>0?t.data[r++]=n:n<-1&&(t.data[r++]=this.DV+n),t.t=r,t.clamp()},s.prototype.dMultiply=function(e){this.data[this.t]=this.am(0,e-1,this,0,0,this.t),++this.t,this.clamp()},s.prototype.dAddOffset=function(e,t){if(0!=e){for(;this.t<=t;)this.data[this.t++]=0;for(this.data[t]+=e;this.data[t]>=this.DV;)this.data[t]-=this.DV,++t>=this.t&&(this.data[this.t++]=0),++this.data[t]}},s.prototype.multiplyLowerTo=function(e,t,r){var n,i=Math.min(this.t+e.t,t);for(r.s=0,r.t=i;i>0;)r.data[--i]=0;for(n=r.t-this.t;i<n;++i)r.data[i+this.t]=this.am(0,e.data[i],r,i,0,this.t);for(n=Math.min(e.t,t);i<n;++i)this.am(0,e.data[i],r,i,0,t-i);r.clamp()},s.prototype.multiplyUpperTo=function(e,t,r){--t;var n=r.t=this.t+e.t-t;for(r.s=0;--n>=0;)r.data[n]=0;for(n=Math.max(t-this.t,0);n<e.t;++n)r.data[this.t+n-t]=this.am(t-n,e.data[n],r,0,0,this.t+n-t);r.clamp(),r.drShiftTo(1,r)},s.prototype.modInt=function(e){if(e<=0)return 0;var t=this.DV%e,r=this.s<0?e-1:0;if(this.t>0)if(0==t)r=this.data[0]%e;else for(var n=this.t-1;n>=0;--n)r=(t*r+this.data[n])%e;return r},s.prototype.millerRabin=function(e){var t=this.subtract(s.ONE),r=t.getLowestSetBit();if(r<=0)return!1;for(var n,i=t.shiftRight(r),o={nextBytes:function(e){for(var t=0;t<e.length;++t)e[t]=Math.floor(256*Math.random())}},a=0;a<e;++a){do{n=new s(this.bitLength(),o)}while(n.compareTo(s.ONE)<=0||n.compareTo(t)>=0);var c=n.modPow(i,this);if(0!=c.compareTo(s.ONE)&&0!=c.compareTo(t)){for(var l=1;l++<r&&0!=c.compareTo(t);)if(0==(c=c.modPowInt(2,this)).compareTo(s.ONE))return!1;if(0!=c.compareTo(t))return!1}}return!0},s.prototype.clone=function(){var e=o();return this.copyTo(e),e},s.prototype.intValue=function(){if(this.s<0){if(1==this.t)return this.data[0]-this.DV;if(0==this.t)return-1}else{if(1==this.t)return this.data[0];if(0==this.t)return 0}return(this.data[1]&(1<<32-this.DB)-1)<<this.DB|this.data[0]},s.prototype.byteValue=function(){return 0==this.t?this.s:this.data[0]<<24>>24},s.prototype.shortValue=function(){return 0==this.t?this.s:this.data[0]<<16>>16},s.prototype.signum=function(){return this.s<0?-1:this.t<=0||1==this.t&&this.data[0]<=0?0:1},s.prototype.toByteArray=function(){var e=this.t,t=new Array;t[0]=this.s;var r,n=this.DB-e*this.DB%8,i=0;if(e-- >0)for(n<this.DB&&(r=this.data[e]>>n)!=(this.s&this.DM)>>n&&(t[i++]=r|this.s<<this.DB-n);e>=0;)n<8?(r=(this.data[e]&(1<<n)-1)<<8-n,r|=this.data[--e]>>(n+=this.DB-8)):(r=this.data[e]>>(n-=8)&255,n<=0&&(n+=this.DB,--e)),0!=(128&r)&&(r|=-256),0==i&&(128&this.s)!=(128&r)&&++i,(i>0||r!=this.s)&&(t[i++]=r);return t},s.prototype.equals=function(e){return 0==this.compareTo(e)},s.prototype.min=function(e){return this.compareTo(e)<0?this:e},s.prototype.max=function(e){return this.compareTo(e)>0?this:e},s.prototype.and=function(e){var t=o();return this.bitwiseTo(e,m,t),t},s.prototype.or=function(e){var t=o();return this.bitwiseTo(e,v,t),t},s.prototype.xor=function(e){var t=o();return this.bitwiseTo(e,b,t),t},s.prototype.andNot=function(e){var t=o();return this.bitwiseTo(e,w,t),t},s.prototype.not=function(){for(var e=o(),t=0;t<this.t;++t)e.data[t]=this.DM&~this.data[t];return e.t=this.t,e.s=~this.s,e},s.prototype.shiftLeft=function(e){var t=o();return e<0?this.rShiftTo(-e,t):this.lShiftTo(e,t),t},s.prototype.shiftRight=function(e){var t=o();return e<0?this.lShiftTo(-e,t):this.rShiftTo(e,t),t},s.prototype.getLowestSetBit=function(){for(var e=0;e<this.t;++e)if(0!=this.data[e])return e*this.DB+E(this.data[e]);return this.s<0?this.t*this.DB:-1},s.prototype.bitCount=function(){for(var e=0,t=this.s&this.DM,r=0;r<this.t;++r)e+=_(this.data[r]^t);return e},s.prototype.testBit=function(e){var t=Math.floor(e/this.DB);return t>=this.t?0!=this.s:0!=(this.data[t]&1<<e%this.DB)},s.prototype.setBit=function(e){return this.changeBit(e,v)},s.prototype.clearBit=function(e){return this.changeBit(e,w)},s.prototype.flipBit=function(e){return this.changeBit(e,b)},s.prototype.add=function(e){var t=o();return this.addTo(e,t),t},s.prototype.subtract=function(e){var t=o();return this.subTo(e,t),t},s.prototype.multiply=function(e){var t=o();return this.multiplyTo(e,t),t},s.prototype.divide=function(e){var t=o();return this.divRemTo(e,t,null),t},s.prototype.remainder=function(e){var t=o();return this.divRemTo(e,null,t),t},s.prototype.divideAndRemainder=function(e){var t=o(),r=o();return this.divRemTo(e,t,r),new Array(t,r)},s.prototype.modPow=function(e,t){var r,n,i=e.bitLength(),s=f(1);if(i<=0)return s;r=i<18?1:i<48?3:i<144?4:i<768?5:6,n=i<8?new y(t):t.isEven()?new C(t):new g(t);var a=new Array,c=3,l=r-1,u=(1<<r)-1;if(a[1]=n.convert(this),r>1){var h=o();for(n.sqrTo(a[1],h);c<=u;)a[c]=o(),n.mulTo(h,a[c-2],a[c]),c+=2}var d,m,v=e.t-1,b=!0,w=o();for(i=p(e.data[v])-1;v>=0;){for(i>=l?d=e.data[v]>>i-l&u:(d=(e.data[v]&(1<<i+1)-1)<<l-i,v>0&&(d|=e.data[v-1]>>this.DB+i-l)),c=r;0==(1&d);)d>>=1,--c;if((i-=c)<0&&(i+=this.DB,--v),b)a[d].copyTo(s),b=!1;else{for(;c>1;)n.sqrTo(s,w),n.sqrTo(w,s),c-=2;c>0?n.sqrTo(s,w):(m=s,s=w,w=m),n.mulTo(w,a[d],s)}for(;v>=0&&0==(e.data[v]&1<<i);)n.sqrTo(s,w),m=s,s=w,w=m,--i<0&&(i=this.DB-1,--v)}return n.revert(s)},s.prototype.modInverse=function(e){var t=e.isEven();if(this.isEven()&&t||0==e.signum())return s.ZERO;for(var r=e.clone(),n=this.clone(),i=f(1),o=f(0),a=f(0),c=f(1);0!=r.signum();){for(;r.isEven();)r.rShiftTo(1,r),t?(i.isEven()&&o.isEven()||(i.addTo(this,i),o.subTo(e,o)),i.rShiftTo(1,i)):o.isEven()||o.subTo(e,o),o.rShiftTo(1,o);for(;n.isEven();)n.rShiftTo(1,n),t?(a.isEven()&&c.isEven()||(a.addTo(this,a),c.subTo(e,c)),a.rShiftTo(1,a)):c.isEven()||c.subTo(e,c),c.rShiftTo(1,c);r.compareTo(n)>=0?(r.subTo(n,r),t&&i.subTo(a,i),o.subTo(c,o)):(n.subTo(r,n),t&&a.subTo(i,a),c.subTo(o,c))}return 0!=n.compareTo(s.ONE)?s.ZERO:c.compareTo(e)>=0?c.subtract(e):c.signum()<0?(c.addTo(e,c),c.signum()<0?c.add(e):c):c},s.prototype.pow=function(e){return this.exp(e,new S)},s.prototype.gcd=function(e){var t=this.s<0?this.negate():this.clone(),r=e.s<0?e.negate():e.clone();if(t.compareTo(r)<0){var n=t;t=r,r=n}var i=t.getLowestSetBit(),s=r.getLowestSetBit();if(s<0)return t;for(i<s&&(s=i),s>0&&(t.rShiftTo(s,t),r.rShiftTo(s,r));t.signum()>0;)(i=t.getLowestSetBit())>0&&t.rShiftTo(i,t),(i=r.getLowestSetBit())>0&&r.rShiftTo(i,r),t.compareTo(r)>=0?(t.subTo(r,t),t.rShiftTo(1,t)):(r.subTo(t,r),r.rShiftTo(1,r));return s>0&&r.lShiftTo(s,r),r},s.prototype.isProbablePrime=function(e){var t,r=this.abs();if(1==r.t&&r.data[0]<=A[A.length-1]){for(t=0;t<A.length;++t)if(r.data[0]==A[t])return!0;return!1}if(r.isEven())return!1;for(t=1;t<A.length;){for(var n=A[t],i=t+1;i<A.length&&n<T;)n*=A[i++];for(n=r.modInt(n);t<i;)if(n%A[t++]==0)return!1}return r.millerRabin(e)}},9893:(e,t,r)=>{var n=r(6547);e.exports=n.md=n.md||{},n.md.algorithms=n.md.algorithms||{}},6935:(e,t,r)=>{var n=r(6547);r(2107),e.exports=n.mgf=n.mgf||{},n.mgf.mgf1=n.mgf1},2107:(e,t,r)=>{var n=r(6547);r(5061),n.mgf=n.mgf||{},(e.exports=n.mgf.mgf1=n.mgf1=n.mgf1||{}).create=function(e){return{generate:function(t,r){for(var i=new n.util.ByteBuffer,s=Math.ceil(r/e.digestLength),o=0;o<s;o++){var a=new n.util.ByteBuffer;a.putInt32(o),e.start(),e.update(t+a.getBytes()),i.putBuffer(e.digest())}return i.truncate(i.length()-r),i.getBytes()}}}},8217:(e,t,r)=>{var n=r(6547);n.pki=n.pki||{};var i=e.exports=n.pki.oids=n.oids=n.oids||{};function s(e,t){i[e]=t,i[t]=e}function o(e,t){i[e]=t}s("1.2.840.113549.1.1.1","rsaEncryption"),s("1.2.840.113549.1.1.4","md5WithRSAEncryption"),s("1.2.840.113549.1.1.5","sha1WithRSAEncryption"),s("1.2.840.113549.1.1.7","RSAES-OAEP"),s("1.2.840.113549.1.1.8","mgf1"),s("1.2.840.113549.1.1.9","pSpecified"),s("1.2.840.113549.1.1.10","RSASSA-PSS"),s("1.2.840.113549.1.1.11","sha256WithRSAEncryption"),s("1.2.840.113549.1.1.12","sha384WithRSAEncryption"),s("1.2.840.113549.1.1.13","sha512WithRSAEncryption"),s("1.3.101.112","EdDSA25519"),s("1.2.840.10040.4.3","dsa-with-sha1"),s("1.3.14.3.2.7","desCBC"),s("1.3.14.3.2.26","sha1"),s("1.3.14.3.2.29","sha1WithRSASignature"),s("2.16.840.1.101.3.4.2.1","sha256"),s("2.16.840.1.101.3.4.2.2","sha384"),s("2.16.840.1.101.3.4.2.3","sha512"),s("2.16.840.1.101.3.4.2.4","sha224"),s("2.16.840.1.101.3.4.2.5","sha512-224"),s("2.16.840.1.101.3.4.2.6","sha512-256"),s("1.2.840.113549.2.2","md2"),s("1.2.840.113549.2.5","md5"),s("1.2.840.113549.1.7.1","data"),s("1.2.840.113549.1.7.2","signedData"),s("1.2.840.113549.1.7.3","envelopedData"),s("1.2.840.113549.1.7.4","signedAndEnvelopedData"),s("1.2.840.113549.1.7.5","digestedData"),s("1.2.840.113549.1.7.6","encryptedData"),s("1.2.840.113549.1.9.1","emailAddress"),s("1.2.840.113549.1.9.2","unstructuredName"),s("1.2.840.113549.1.9.3","contentType"),s("1.2.840.113549.1.9.4","messageDigest"),s("1.2.840.113549.1.9.5","signingTime"),s("1.2.840.113549.1.9.6","counterSignature"),s("1.2.840.113549.1.9.7","challengePassword"),s("1.2.840.113549.1.9.8","unstructuredAddress"),s("1.2.840.113549.1.9.14","extensionRequest"),s("1.2.840.113549.1.9.20","friendlyName"),s("1.2.840.113549.1.9.21","localKeyId"),s("1.2.840.113549.1.9.22.1","x509Certificate"),s("1.2.840.113549.1.12.10.1.1","keyBag"),s("1.2.840.113549.1.12.10.1.2","pkcs8ShroudedKeyBag"),s("1.2.840.113549.1.12.10.1.3","certBag"),s("1.2.840.113549.1.12.10.1.4","crlBag"),s("1.2.840.113549.1.12.10.1.5","secretBag"),s("1.2.840.113549.1.12.10.1.6","safeContentsBag"),s("1.2.840.113549.1.5.13","pkcs5PBES2"),s("1.2.840.113549.1.5.12","pkcs5PBKDF2"),s("1.2.840.113549.1.12.1.1","pbeWithSHAAnd128BitRC4"),s("1.2.840.113549.1.12.1.2","pbeWithSHAAnd40BitRC4"),s("1.2.840.113549.1.12.1.3","pbeWithSHAAnd3-KeyTripleDES-CBC"),s("1.2.840.113549.1.12.1.4","pbeWithSHAAnd2-KeyTripleDES-CBC"),s("1.2.840.113549.1.12.1.5","pbeWithSHAAnd128BitRC2-CBC"),s("1.2.840.113549.1.12.1.6","pbewithSHAAnd40BitRC2-CBC"),s("1.2.840.113549.2.7","hmacWithSHA1"),s("1.2.840.113549.2.8","hmacWithSHA224"),s("1.2.840.113549.2.9","hmacWithSHA256"),s("1.2.840.113549.2.10","hmacWithSHA384"),s("1.2.840.113549.2.11","hmacWithSHA512"),s("1.2.840.113549.3.7","des-EDE3-CBC"),s("2.16.840.1.101.3.4.1.2","aes128-CBC"),s("2.16.840.1.101.3.4.1.22","aes192-CBC"),s("2.16.840.1.101.3.4.1.42","aes256-CBC"),s("2.5.4.3","commonName"),s("2.5.4.4","surname"),s("2.5.4.5","serialNumber"),s("2.5.4.6","countryName"),s("2.5.4.7","localityName"),s("2.5.4.8","stateOrProvinceName"),s("2.5.4.9","streetAddress"),s("2.5.4.10","organizationName"),s("2.5.4.11","organizationalUnitName"),s("2.5.4.12","title"),s("2.5.4.13","description"),s("2.5.4.15","businessCategory"),s("2.5.4.17","postalCode"),s("2.5.4.42","givenName"),s("1.3.6.1.4.1.311.60.2.1.2","jurisdictionOfIncorporationStateOrProvinceName"),s("1.3.6.1.4.1.311.60.2.1.3","jurisdictionOfIncorporationCountryName"),s("2.16.840.1.113730.1.1","nsCertType"),s("2.16.840.1.113730.1.13","nsComment"),o("2.5.29.1","authorityKeyIdentifier"),o("2.5.29.2","keyAttributes"),o("2.5.29.3","certificatePolicies"),o("2.5.29.4","keyUsageRestriction"),o("2.5.29.5","policyMapping"),o("2.5.29.6","subtreesConstraint"),o("2.5.29.7","subjectAltName"),o("2.5.29.8","issuerAltName"),o("2.5.29.9","subjectDirectoryAttributes"),o("2.5.29.10","basicConstraints"),o("2.5.29.11","nameConstraints"),o("2.5.29.12","policyConstraints"),o("2.5.29.13","basicConstraints"),s("2.5.29.14","subjectKeyIdentifier"),s("2.5.29.15","keyUsage"),o("2.5.29.16","privateKeyUsagePeriod"),s("2.5.29.17","subjectAltName"),s("2.5.29.18","issuerAltName"),s("2.5.29.19","basicConstraints"),o("2.5.29.20","cRLNumber"),o("2.5.29.21","cRLReason"),o("2.5.29.22","expirationDate"),o("2.5.29.23","instructionCode"),o("2.5.29.24","invalidityDate"),o("2.5.29.25","cRLDistributionPoints"),o("2.5.29.26","issuingDistributionPoint"),o("2.5.29.27","deltaCRLIndicator"),o("2.5.29.28","issuingDistributionPoint"),o("2.5.29.29","certificateIssuer"),o("2.5.29.30","nameConstraints"),s("2.5.29.31","cRLDistributionPoints"),s("2.5.29.32","certificatePolicies"),o("2.5.29.33","policyMappings"),o("2.5.29.34","policyConstraints"),s("2.5.29.35","authorityKeyIdentifier"),o("2.5.29.36","policyConstraints"),s("2.5.29.37","extKeyUsage"),o("2.5.29.46","freshestCRL"),o("2.5.29.54","inhibitAnyPolicy"),s("1.3.6.1.4.1.11129.2.4.2","timestampList"),s("1.3.6.1.5.5.7.1.1","authorityInfoAccess"),s("1.3.6.1.5.5.7.3.1","serverAuth"),s("1.3.6.1.5.5.7.3.2","clientAuth"),s("1.3.6.1.5.5.7.3.3","codeSigning"),s("1.3.6.1.5.5.7.3.4","emailProtection"),s("1.3.6.1.5.5.7.3.8","timeStamping")},5040:(e,t,r)=>{var n=r(6547);if(r(5645),r(8791),r(3280),r(9893),r(8217),r(7068),r(1244),r(4677),r(9707),r(8690),r(5061),"undefined"===typeof i)var i=n.jsbn.BigInteger;var s=n.asn1,o=n.pki=n.pki||{};e.exports=o.pbe=n.pbe=n.pbe||{};var a=o.oids,c={name:"EncryptedPrivateKeyInfo",tagClass:s.Class.UNIVERSAL,type:s.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedPrivateKeyInfo.encryptionAlgorithm",tagClass:s.Class.UNIVERSAL,type:s.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:s.Class.UNIVERSAL,type:s.Type.OID,constructed:!1,capture:"encryptionOid"},{name:"AlgorithmIdentifier.parameters",tagClass:s.Class.UNIVERSAL,type:s.Type.SEQUENCE,constructed:!0,captureAsn1:"encryptionParams"}]},{name:"EncryptedPrivateKeyInfo.encryptedData",tagClass:s.Class.UNIVERSAL,type:s.Type.OCTETSTRING,constructed:!1,capture:"encryptedData"}]},l={name:"PBES2Algorithms",tagClass:s.Class.UNIVERSAL,type:s.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.keyDerivationFunc",tagClass:s.Class.UNIVERSAL,type:s.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.keyDerivationFunc.oid",tagClass:s.Class.UNIVERSAL,type:s.Type.OID,constructed:!1,capture:"kdfOid"},{name:"PBES2Algorithms.params",tagClass:s.Class.UNIVERSAL,type:s.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.params.salt",tagClass:s.Class.UNIVERSAL,type:s.Type.OCTETSTRING,constructed:!1,capture:"kdfSalt"},{name:"PBES2Algorithms.params.iterationCount",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"kdfIterationCount"},{name:"PBES2Algorithms.params.keyLength",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,optional:!0,capture:"keyLength"},{name:"PBES2Algorithms.params.prf",tagClass:s.Class.UNIVERSAL,type:s.Type.SEQUENCE,constructed:!0,optional:!0,value:[{name:"PBES2Algorithms.params.prf.algorithm",tagClass:s.Class.UNIVERSAL,type:s.Type.OID,constructed:!1,capture:"prfOid"}]}]}]},{name:"PBES2Algorithms.encryptionScheme",tagClass:s.Class.UNIVERSAL,type:s.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.encryptionScheme.oid",tagClass:s.Class.UNIVERSAL,type:s.Type.OID,constructed:!1,capture:"encOid"},{name:"PBES2Algorithms.encryptionScheme.iv",tagClass:s.Class.UNIVERSAL,type:s.Type.OCTETSTRING,constructed:!1,capture:"encIv"}]}]},u={name:"pkcs-12PbeParams",tagClass:s.Class.UNIVERSAL,type:s.Type.SEQUENCE,constructed:!0,value:[{name:"pkcs-12PbeParams.salt",tagClass:s.Class.UNIVERSAL,type:s.Type.OCTETSTRING,constructed:!1,capture:"salt"},{name:"pkcs-12PbeParams.iterations",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"iterations"}]};function h(e,t){return e.start().update(t).digest().getBytes()}function d(e){var t;if(e){if(!(t=o.oids[s.derToOid(e)])){var r=new Error("Unsupported PRF OID.");throw r.oid=e,r.supported=["hmacWithSHA1","hmacWithSHA224","hmacWithSHA256","hmacWithSHA384","hmacWithSHA512"],r}}else t="hmacWithSHA1";return f(t)}function f(e){var t=n.md;switch(e){case"hmacWithSHA224":t=n.md.sha512;case"hmacWithSHA1":case"hmacWithSHA256":case"hmacWithSHA384":case"hmacWithSHA512":e=e.substr(8).toLowerCase();break;default:var r=new Error("Unsupported PRF algorithm.");throw r.algorithm=e,r.supported=["hmacWithSHA1","hmacWithSHA224","hmacWithSHA256","hmacWithSHA384","hmacWithSHA512"],r}if(!t||!(e in t))throw new Error("Unknown hash algorithm: "+e);return t[e].create()}o.encryptPrivateKeyInfo=function(e,t,r){(r=r||{}).saltSize=r.saltSize||8,r.count=r.count||2048,r.algorithm=r.algorithm||"aes128",r.prfAlgorithm=r.prfAlgorithm||"sha1";var i,c,l,u=n.random.getBytesSync(r.saltSize),h=r.count,d=s.integerToDer(h);if(0===r.algorithm.indexOf("aes")||"des"===r.algorithm){var p,y,g;switch(r.algorithm){case"aes128":i=16,p=16,y=a["aes128-CBC"],g=n.aes.createEncryptionCipher;break;case"aes192":i=24,p=16,y=a["aes192-CBC"],g=n.aes.createEncryptionCipher;break;case"aes256":i=32,p=16,y=a["aes256-CBC"],g=n.aes.createEncryptionCipher;break;case"des":i=8,p=8,y=a.desCBC,g=n.des.createEncryptionCipher;break;default:throw(_=new Error("Cannot encrypt private key. Unknown encryption algorithm.")).algorithm=r.algorithm,_}var m="hmacWith"+r.prfAlgorithm.toUpperCase(),v=f(m),b=n.pkcs5.pbkdf2(t,u,h,i,v),w=n.random.getBytesSync(p);(S=g(b)).start(w),S.update(s.toDer(e)),S.finish(),l=S.output.getBytes();var E=function(e,t,r,i){var a=s.create(s.Class.UNIVERSAL,s.Type.SEQUENCE,!0,[s.create(s.Class.UNIVERSAL,s.Type.OCTETSTRING,!1,e),s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,t.getBytes())]);"hmacWithSHA1"!==i&&a.value.push(s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,n.util.hexToBytes(r.toString(16))),s.create(s.Class.UNIVERSAL,s.Type.SEQUENCE,!0,[s.create(s.Class.UNIVERSAL,s.Type.OID,!1,s.oidToDer(o.oids[i]).getBytes()),s.create(s.Class.UNIVERSAL,s.Type.NULL,!1,"")]));return a}(u,d,i,m);c=s.create(s.Class.UNIVERSAL,s.Type.SEQUENCE,!0,[s.create(s.Class.UNIVERSAL,s.Type.OID,!1,s.oidToDer(a.pkcs5PBES2).getBytes()),s.create(s.Class.UNIVERSAL,s.Type.SEQUENCE,!0,[s.create(s.Class.UNIVERSAL,s.Type.SEQUENCE,!0,[s.create(s.Class.UNIVERSAL,s.Type.OID,!1,s.oidToDer(a.pkcs5PBKDF2).getBytes()),E]),s.create(s.Class.UNIVERSAL,s.Type.SEQUENCE,!0,[s.create(s.Class.UNIVERSAL,s.Type.OID,!1,s.oidToDer(y).getBytes()),s.create(s.Class.UNIVERSAL,s.Type.OCTETSTRING,!1,w)])])])}else{var _;if("3des"!==r.algorithm)throw(_=new Error("Cannot encrypt private key. Unknown encryption algorithm.")).algorithm=r.algorithm,_;i=24;var S,I=new n.util.ByteBuffer(u);b=o.pbe.generatePkcs12Key(t,I,1,h,i),w=o.pbe.generatePkcs12Key(t,I,2,h,i);(S=n.des.createEncryptionCipher(b)).start(w),S.update(s.toDer(e)),S.finish(),l=S.output.getBytes(),c=s.create(s.Class.UNIVERSAL,s.Type.SEQUENCE,!0,[s.create(s.Class.UNIVERSAL,s.Type.OID,!1,s.oidToDer(a["pbeWithSHAAnd3-KeyTripleDES-CBC"]).getBytes()),s.create(s.Class.UNIVERSAL,s.Type.SEQUENCE,!0,[s.create(s.Class.UNIVERSAL,s.Type.OCTETSTRING,!1,u),s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,d.getBytes())])])}return s.create(s.Class.UNIVERSAL,s.Type.SEQUENCE,!0,[c,s.create(s.Class.UNIVERSAL,s.Type.OCTETSTRING,!1,l)])},o.decryptPrivateKeyInfo=function(e,t){var r=null,i={},a=[];if(!s.validate(e,c,i,a)){var l=new Error("Cannot read encrypted private key. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw l.errors=a,l}var u=s.derToOid(i.encryptionOid),h=o.pbe.getCipher(u,i.encryptionParams,t),d=n.util.createBuffer(i.encryptedData);return h.update(d),h.finish()&&(r=s.fromDer(h.output)),r},o.encryptedPrivateKeyToPem=function(e,t){var r={type:"ENCRYPTED PRIVATE KEY",body:s.toDer(e).getBytes()};return n.pem.encode(r,{maxline:t})},o.encryptedPrivateKeyFromPem=function(e){var t=n.pem.decode(e)[0];if("ENCRYPTED PRIVATE KEY"!==t.type){var r=new Error('Could not convert encrypted private key from PEM; PEM header type is "ENCRYPTED PRIVATE KEY".');throw r.headerType=t.type,r}if(t.procType&&"ENCRYPTED"===t.procType.type)throw new Error("Could not convert encrypted private key from PEM; PEM is encrypted.");return s.fromDer(t.body)},o.encryptRsaPrivateKey=function(e,t,r){if(!(r=r||{}).legacy){var i=o.wrapRsaPrivateKey(o.privateKeyToAsn1(e));return i=o.encryptPrivateKeyInfo(i,t,r),o.encryptedPrivateKeyToPem(i)}var a,c,l,u;switch(r.algorithm){case"aes128":a="AES-128-CBC",l=16,c=n.random.getBytesSync(16),u=n.aes.createEncryptionCipher;break;case"aes192":a="AES-192-CBC",l=24,c=n.random.getBytesSync(16),u=n.aes.createEncryptionCipher;break;case"aes256":a="AES-256-CBC",l=32,c=n.random.getBytesSync(16),u=n.aes.createEncryptionCipher;break;case"3des":a="DES-EDE3-CBC",l=24,c=n.random.getBytesSync(8),u=n.des.createEncryptionCipher;break;case"des":a="DES-CBC",l=8,c=n.random.getBytesSync(8),u=n.des.createEncryptionCipher;break;default:var h=new Error('Could not encrypt RSA private key; unsupported encryption algorithm "'+r.algorithm+'".');throw h.algorithm=r.algorithm,h}var d=u(n.pbe.opensslDeriveBytes(t,c.substr(0,8),l));d.start(c),d.update(s.toDer(o.privateKeyToAsn1(e))),d.finish();var f={type:"RSA PRIVATE KEY",procType:{version:"4",type:"ENCRYPTED"},dekInfo:{algorithm:a,parameters:n.util.bytesToHex(c).toUpperCase()},body:d.output.getBytes()};return n.pem.encode(f)},o.decryptRsaPrivateKey=function(e,t){var r=null,i=n.pem.decode(e)[0];if("ENCRYPTED PRIVATE KEY"!==i.type&&"PRIVATE KEY"!==i.type&&"RSA PRIVATE KEY"!==i.type)throw(l=new Error('Could not convert private key from PEM; PEM header type is not "ENCRYPTED PRIVATE KEY", "PRIVATE KEY", or "RSA PRIVATE KEY".')).headerType=l,l;if(i.procType&&"ENCRYPTED"===i.procType.type){var a,c;switch(i.dekInfo.algorithm){case"DES-CBC":a=8,c=n.des.createDecryptionCipher;break;case"DES-EDE3-CBC":a=24,c=n.des.createDecryptionCipher;break;case"AES-128-CBC":a=16,c=n.aes.createDecryptionCipher;break;case"AES-192-CBC":a=24,c=n.aes.createDecryptionCipher;break;case"AES-256-CBC":a=32,c=n.aes.createDecryptionCipher;break;case"RC2-40-CBC":a=5,c=function(e){return n.rc2.createDecryptionCipher(e,40)};break;case"RC2-64-CBC":a=8,c=function(e){return n.rc2.createDecryptionCipher(e,64)};break;case"RC2-128-CBC":a=16,c=function(e){return n.rc2.createDecryptionCipher(e,128)};break;default:var l;throw(l=new Error('Could not decrypt private key; unsupported encryption algorithm "'+i.dekInfo.algorithm+'".')).algorithm=i.dekInfo.algorithm,l}var u=n.util.hexToBytes(i.dekInfo.parameters),h=c(n.pbe.opensslDeriveBytes(t,u.substr(0,8),a));if(h.start(u),h.update(n.util.createBuffer(i.body)),!h.finish())return r;r=h.output.getBytes()}else r=i.body;return null!==(r="ENCRYPTED PRIVATE KEY"===i.type?o.decryptPrivateKeyInfo(s.fromDer(r),t):s.fromDer(r))&&(r=o.privateKeyFromAsn1(r)),r},o.pbe.generatePkcs12Key=function(e,t,r,i,s,o){var a,c;if("undefined"===typeof o||null===o){if(!("sha1"in n.md))throw new Error('"sha1" hash algorithm unavailable.');o=n.md.sha1.create()}var l=o.digestLength,u=o.blockLength,h=new n.util.ByteBuffer,d=new n.util.ByteBuffer;if(null!==e&&void 0!==e){for(c=0;c<e.length;c++)d.putInt16(e.charCodeAt(c));d.putInt16(0)}var f=d.length(),p=t.length(),y=new n.util.ByteBuffer;y.fillWithByte(r,u);var g=u*Math.ceil(p/u),m=new n.util.ByteBuffer;for(c=0;c<g;c++)m.putByte(t.at(c%p));var v=u*Math.ceil(f/u),b=new n.util.ByteBuffer;for(c=0;c<v;c++)b.putByte(d.at(c%f));var w=m;w.putBuffer(b);for(var E=Math.ceil(s/l),_=1;_<=E;_++){var S=new n.util.ByteBuffer;S.putBytes(y.bytes()),S.putBytes(w.bytes());for(var I=0;I<i;I++)o.start(),o.update(S.getBytes()),S=o.digest();var C=new n.util.ByteBuffer;for(c=0;c<u;c++)C.putByte(S.at(c%l));var A=Math.ceil(p/u)+Math.ceil(f/u),T=new n.util.ByteBuffer;for(a=0;a<A;a++){var k=new n.util.ByteBuffer(w.getBytes(u)),R=511;for(c=C.length()-1;c>=0;c--)R>>=8,R+=C.at(c)+k.at(c),k.setAt(c,255&R);T.putBuffer(k)}w=T,h.putBuffer(S)}return h.truncate(h.length()-s),h},o.pbe.getCipher=function(e,t,r){switch(e){case o.oids.pkcs5PBES2:return o.pbe.getCipherForPBES2(e,t,r);case o.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:case o.oids["pbewithSHAAnd40BitRC2-CBC"]:return o.pbe.getCipherForPKCS12PBE(e,t,r);default:var n=new Error("Cannot read encrypted PBE data block. Unsupported OID.");throw n.oid=e,n.supportedOids=["pkcs5PBES2","pbeWithSHAAnd3-KeyTripleDES-CBC","pbewithSHAAnd40BitRC2-CBC"],n}},o.pbe.getCipherForPBES2=function(e,t,r){var i,a={},c=[];if(!s.validate(t,l,a,c))throw(i=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.")).errors=c,i;if((e=s.derToOid(a.kdfOid))!==o.oids.pkcs5PBKDF2)throw(i=new Error("Cannot read encrypted private key. Unsupported key derivation function OID.")).oid=e,i.supportedOids=["pkcs5PBKDF2"],i;if((e=s.derToOid(a.encOid))!==o.oids["aes128-CBC"]&&e!==o.oids["aes192-CBC"]&&e!==o.oids["aes256-CBC"]&&e!==o.oids["des-EDE3-CBC"]&&e!==o.oids.desCBC)throw(i=new Error("Cannot read encrypted private key. Unsupported encryption scheme OID.")).oid=e,i.supportedOids=["aes128-CBC","aes192-CBC","aes256-CBC","des-EDE3-CBC","desCBC"],i;var u,h,f=a.kdfSalt,p=n.util.createBuffer(a.kdfIterationCount);switch(p=p.getInt(p.length()<<3),o.oids[e]){case"aes128-CBC":u=16,h=n.aes.createDecryptionCipher;break;case"aes192-CBC":u=24,h=n.aes.createDecryptionCipher;break;case"aes256-CBC":u=32,h=n.aes.createDecryptionCipher;break;case"des-EDE3-CBC":u=24,h=n.des.createDecryptionCipher;break;case"desCBC":u=8,h=n.des.createDecryptionCipher}var y=d(a.prfOid),g=n.pkcs5.pbkdf2(r,f,p,u,y),m=a.encIv,v=h(g);return v.start(m),v},o.pbe.getCipherForPKCS12PBE=function(e,t,r){var i={},a=[];if(!s.validate(t,u,i,a))throw(y=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.")).errors=a,y;var c,l,h,f=n.util.createBuffer(i.salt),p=n.util.createBuffer(i.iterations);switch(p=p.getInt(p.length()<<3),e){case o.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:c=24,l=8,h=n.des.startDecrypting;break;case o.oids["pbewithSHAAnd40BitRC2-CBC"]:c=5,l=8,h=function(e,t){var r=n.rc2.createDecryptionCipher(e,40);return r.start(t,null),r};break;default:var y;throw(y=new Error("Cannot read PKCS #12 PBE data block. Unsupported OID.")).oid=e,y}var g=d(i.prfOid),m=o.pbe.generatePkcs12Key(r,f,1,p,c,g);return g.start(),h(m,o.pbe.generatePkcs12Key(r,f,2,p,l,g))},o.pbe.opensslDeriveBytes=function(e,t,r,i){if("undefined"===typeof i||null===i){if(!("md5"in n.md))throw new Error('"md5" hash algorithm unavailable.');i=n.md.md5.create()}null===t&&(t="");for(var s=[h(i,e+t)],o=16,a=1;o<r;++a,o+=16)s.push(h(i,s[a-1]+e+t));return s.join("").substr(0,r)}},7068:(e,t,r)=>{var n=r(6547);r(1722),r(9893),r(5061);var i,s=n.pkcs5=n.pkcs5||{};n.util.isNodejs&&!n.options.usePureJavaScript&&(i=r(9437)),e.exports=n.pbkdf2=s.pbkdf2=function(e,t,r,s,o,a){if("function"===typeof o&&(a=o,o=null),n.util.isNodejs&&!n.options.usePureJavaScript&&i.pbkdf2&&(null===o||"object"!==typeof o)&&(i.pbkdf2Sync.length>4||!o||"sha1"===o))return"string"!==typeof o&&(o="sha1"),e=Buffer.from(e,"binary"),t=Buffer.from(t,"binary"),a?4===i.pbkdf2Sync.length?i.pbkdf2(e,t,r,s,(function(e,t){if(e)return a(e);a(null,t.toString("binary"))})):i.pbkdf2(e,t,r,s,o,(function(e,t){if(e)return a(e);a(null,t.toString("binary"))})):4===i.pbkdf2Sync.length?i.pbkdf2Sync(e,t,r,s).toString("binary"):i.pbkdf2Sync(e,t,r,s,o).toString("binary");if("undefined"!==typeof o&&null!==o||(o="sha1"),"string"===typeof o){if(!(o in n.md.algorithms))throw new Error("Unknown hash algorithm: "+o);o=n.md[o].create()}var c=o.digestLength;if(s>4294967295*c){var l=new Error("Derived key is too long.");if(a)return a(l);throw l}var u=Math.ceil(s/c),h=s-(u-1)*c,d=n.hmac.create();d.start(o,e);var f,p,y,g="";if(!a){for(var m=1;m<=u;++m){d.start(null,null),d.update(t),d.update(n.util.int32ToBytes(m)),f=y=d.digest().getBytes();for(var v=2;v<=r;++v)d.start(null,null),d.update(y),p=d.digest().getBytes(),f=n.util.xorBytes(f,p,c),y=p;g+=m<u?f:f.substr(0,h)}return g}m=1;function b(){if(m>u)return a(null,g);d.start(null,null),d.update(t),d.update(n.util.int32ToBytes(m)),f=y=d.digest().getBytes(),v=2,w()}function w(){if(v<=r)return d.start(null,null),d.update(y),p=d.digest().getBytes(),f=n.util.xorBytes(f,p,c),y=p,++v,n.util.setImmediate(w);g+=m<u?f:f.substr(0,h),++m,b()}b()}},1244:(e,t,r)=>{var n=r(6547);r(5061);var i=e.exports=n.pem=n.pem||{};function s(e){for(var t=e.name+": ",r=[],n=function(e,t){return" "+t},i=0;i<e.values.length;++i)r.push(e.values[i].replace(/^(\S+\r\n)/,n));t+=r.join(",")+"\r\n";var s=0,o=-1;for(i=0;i<t.length;++i,++s)if(s>65&&-1!==o){var a=t[o];","===a?(++o,t=t.substr(0,o)+"\r\n "+t.substr(o)):t=t.substr(0,o)+"\r\n"+a+t.substr(o+1),s=i-o-1,o=-1,++i}else" "!==t[i]&&"\t"!==t[i]&&","!==t[i]||(o=i);return t}function o(e){return e.replace(/^\s+/,"")}i.encode=function(e,t){t=t||{};var r,i="-----BEGIN "+e.type+"-----\r\n";if(e.procType&&(i+=s(r={name:"Proc-Type",values:[String(e.procType.version),e.procType.type]})),e.contentDomain&&(i+=s(r={name:"Content-Domain",values:[e.contentDomain]})),e.dekInfo&&(r={name:"DEK-Info",values:[e.dekInfo.algorithm]},e.dekInfo.parameters&&r.values.push(e.dekInfo.parameters),i+=s(r)),e.headers)for(var o=0;o<e.headers.length;++o)i+=s(e.headers[o]);return e.procType&&(i+="\r\n"),i+=n.util.encode64(e.body,t.maxline||64)+"\r\n",i+="-----END "+e.type+"-----\r\n"},i.decode=function(e){for(var t,r=[],i=/\s*-----BEGIN ([A-Z0-9- ]+)-----\r?\n?([\x21-\x7e\s]+?(?:\r?\n\r?\n))?([:A-Za-z0-9+\/=\s]+?)-----END \1-----/g,s=/([\x21-\x7e]+):\s*([\x21-\x7e\s^:]+)/,a=/\r?\n/;t=i.exec(e);){var c=t[1];"NEW CERTIFICATE REQUEST"===c&&(c="CERTIFICATE REQUEST");var l={type:c,procType:null,contentDomain:null,dekInfo:null,headers:[],body:n.util.decode64(t[3])};if(r.push(l),t[2]){for(var u=t[2].split(a),h=0;t&&h<u.length;){for(var d=u[h].replace(/\s+$/,""),f=h+1;f<u.length;++f){var p=u[f];if(!/\s/.test(p[0]))break;d+=p,h=f}if(t=d.match(s)){for(var y={name:t[1],values:[]},g=t[2].split(","),m=0;m<g.length;++m)y.values.push(o(g[m]));if(l.procType)if(l.contentDomain||"Content-Domain"!==y.name)if(l.dekInfo||"DEK-Info"!==y.name)l.headers.push(y);else{if(0===y.values.length)throw new Error('Invalid PEM formatted message. The "DEK-Info" header must have at least one subfield.');l.dekInfo={algorithm:g[0],parameters:g[1]||null}}else l.contentDomain=g[0]||"";else{if("Proc-Type"!==y.name)throw new Error('Invalid PEM formatted message. The first encapsulated header must be "Proc-Type".');if(2!==y.values.length)throw new Error('Invalid PEM formatted message. The "Proc-Type" header must have two subfields.');l.procType={version:g[0],type:g[1]}}}++h}if("ENCRYPTED"===l.procType&&!l.dekInfo)throw new Error('Invalid PEM formatted message. The "DEK-Info" header must be present if "Proc-Type" is "ENCRYPTED".')}}if(0===r.length)throw new Error("Invalid PEM formatted message.");return r}},9838:(e,t,r)=>{var n=r(6547);r(5061),r(4677),r(938);var i=e.exports=n.pkcs1=n.pkcs1||{};function s(e,t,r){r||(r=n.md.sha1.create());for(var i="",s=Math.ceil(t/r.digestLength),o=0;o<s;++o){var a=String.fromCharCode(o>>24&255,o>>16&255,o>>8&255,255&o);r.start(),r.update(e+a),i+=r.digest().getBytes()}return i.substring(0,t)}i.encode_rsa_oaep=function(e,t,r){var i,o,a,c;"string"===typeof r?(i=r,o=arguments[3]||void 0,a=arguments[4]||void 0):r&&(i=r.label||void 0,o=r.seed||void 0,a=r.md||void 0,r.mgf1&&r.mgf1.md&&(c=r.mgf1.md)),a?a.start():a=n.md.sha1.create(),c||(c=a);var l=Math.ceil(e.n.bitLength()/8),u=l-2*a.digestLength-2;if(t.length>u)throw(g=new Error("RSAES-OAEP input message length is too long.")).length=t.length,g.maxLength=u,g;i||(i=""),a.update(i,"raw");for(var h=a.digest(),d="",f=u-t.length,p=0;p<f;p++)d+="\0";var y=h.getBytes()+d+"\x01"+t;if(o){if(o.length!==a.digestLength){var g;throw(g=new Error("Invalid RSAES-OAEP seed. The seed length must match the digest length.")).seedLength=o.length,g.digestLength=a.digestLength,g}}else o=n.random.getBytes(a.digestLength);var m=s(o,l-a.digestLength-1,c),v=n.util.xorBytes(y,m,y.length),b=s(v,a.digestLength,c),w=n.util.xorBytes(o,b,o.length);return"\0"+w+v},i.decode_rsa_oaep=function(e,t,r){var i,o,a;"string"===typeof r?(i=r,o=arguments[3]||void 0):r&&(i=r.label||void 0,o=r.md||void 0,r.mgf1&&r.mgf1.md&&(a=r.mgf1.md));var c=Math.ceil(e.n.bitLength()/8);if(t.length!==c)throw(v=new Error("RSAES-OAEP encoded message length is invalid.")).length=t.length,v.expectedLength=c,v;if(void 0===o?o=n.md.sha1.create():o.start(),a||(a=o),c<2*o.digestLength+2)throw new Error("RSAES-OAEP key is too short for the hash function.");i||(i=""),o.update(i,"raw");for(var l=o.digest().getBytes(),u=t.charAt(0),h=t.substring(1,o.digestLength+1),d=t.substring(1+o.digestLength),f=s(d,o.digestLength,a),p=n.util.xorBytes(h,f,h.length),y=s(p,c-o.digestLength-1,a),g=n.util.xorBytes(d,y,d.length),m=g.substring(0,o.digestLength),v="\0"!==u,b=0;b<o.digestLength;++b)v|=l.charAt(b)!==m.charAt(b);for(var w=1,E=o.digestLength,_=o.digestLength;_<g.length;_++){var S=g.charCodeAt(_),I=1&S^1,C=w?65534:0;v|=S&C,E+=w&=I}if(v||1!==g.charCodeAt(E))throw new Error("Invalid RSAES-OAEP padding.");return g.substring(E+1)}},3308:(e,t,r)=>{var n=r(6547);r(5645),r(8791),r(3280),r(8217),r(1244),r(7099),r(4677),r(5061),r(4577);var i=n.asn1,s=e.exports=n.pkcs7=n.pkcs7||{};function o(e){var t={},r=[];if(!i.validate(e,s.asn1.recipientInfoValidator,t,r)){var o=new Error("Cannot read PKCS#7 RecipientInfo. ASN.1 object is not an PKCS#7 RecipientInfo.");throw o.errors=r,o}return{version:t.version.charCodeAt(0),issuer:n.pki.RDNAttributesAsArray(t.issuer),serialNumber:n.util.createBuffer(t.serial).toHex(),encryptedContent:{algorithm:i.derToOid(t.encAlgorithm),parameter:t.encParameter?t.encParameter.value:void 0,content:t.encKey}}}function a(e){for(var t,r=[],s=0;s<e.length;++s)r.push((t=e[s],i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.INTEGER,!1,i.integerToDer(t.version).getBytes()),i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[n.pki.distinguishedNameToAsn1({attributes:t.issuer}),i.create(i.Class.UNIVERSAL,i.Type.INTEGER,!1,n.util.hexToBytes(t.serialNumber))]),i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(t.encryptedContent.algorithm).getBytes()),i.create(i.Class.UNIVERSAL,i.Type.NULL,!1,"")]),i.create(i.Class.UNIVERSAL,i.Type.OCTETSTRING,!1,t.encryptedContent.content)])));return r}function c(e){var t=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.INTEGER,!1,i.integerToDer(e.version).getBytes()),i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[n.pki.distinguishedNameToAsn1({attributes:e.issuer}),i.create(i.Class.UNIVERSAL,i.Type.INTEGER,!1,n.util.hexToBytes(e.serialNumber))]),i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(e.digestAlgorithm).getBytes()),i.create(i.Class.UNIVERSAL,i.Type.NULL,!1,"")])]);if(e.authenticatedAttributesAsn1&&t.value.push(e.authenticatedAttributesAsn1),t.value.push(i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(e.signatureAlgorithm).getBytes()),i.create(i.Class.UNIVERSAL,i.Type.NULL,!1,"")])),t.value.push(i.create(i.Class.UNIVERSAL,i.Type.OCTETSTRING,!1,e.signature)),e.unauthenticatedAttributes.length>0){for(var r=i.create(i.Class.CONTEXT_SPECIFIC,1,!0,[]),s=0;s<e.unauthenticatedAttributes.length;++s){var o=e.unauthenticatedAttributes[s];r.values.push(l(o))}t.value.push(r)}return t}function l(e){var t;if(e.type===n.pki.oids.contentType)t=i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(e.value).getBytes());else if(e.type===n.pki.oids.messageDigest)t=i.create(i.Class.UNIVERSAL,i.Type.OCTETSTRING,!1,e.value.bytes());else if(e.type===n.pki.oids.signingTime){var r=new Date("1950-01-01T00:00:00Z"),s=new Date("2050-01-01T00:00:00Z"),o=e.value;if("string"===typeof o){var a=Date.parse(o);o=isNaN(a)?13===o.length?i.utcTimeToDate(o):i.generalizedTimeToDate(o):new Date(a)}t=o>=r&&o<s?i.create(i.Class.UNIVERSAL,i.Type.UTCTIME,!1,i.dateToUtcTime(o)):i.create(i.Class.UNIVERSAL,i.Type.GENERALIZEDTIME,!1,i.dateToGeneralizedTime(o))}return i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(e.type).getBytes()),i.create(i.Class.UNIVERSAL,i.Type.SET,!0,[t])])}function u(e,t,r){var s={};if(!i.validate(t,r,s,[])){var o=new Error("Cannot read PKCS#7 message. ASN.1 object is not a supported PKCS#7 message.");throw o.errors=o,o}if(i.derToOid(s.contentType)!==n.pki.oids.data)throw new Error("Unsupported PKCS#7 message. Only wrapped ContentType Data supported.");if(s.encryptedContent){var a="";if(n.util.isArray(s.encryptedContent))for(var c=0;c<s.encryptedContent.length;++c){if(s.encryptedContent[c].type!==i.Type.OCTETSTRING)throw new Error("Malformed PKCS#7 message, expecting encrypted content constructed of only OCTET STRING objects.");a+=s.encryptedContent[c].value}else a=s.encryptedContent;e.encryptedContent={algorithm:i.derToOid(s.encAlgorithm),parameter:n.util.createBuffer(s.encParameter.value),content:n.util.createBuffer(a)}}if(s.content){a="";if(n.util.isArray(s.content))for(c=0;c<s.content.length;++c){if(s.content[c].type!==i.Type.OCTETSTRING)throw new Error("Malformed PKCS#7 message, expecting content constructed of only OCTET STRING objects.");a+=s.content[c].value}else a=s.content;e.content=n.util.createBuffer(a)}return e.version=s.version.charCodeAt(0),e.rawCapture=s,s}function h(e){if(void 0===e.encryptedContent.key)throw new Error("Symmetric key not available.");if(void 0===e.content){var t;switch(e.encryptedContent.algorithm){case n.pki.oids["aes128-CBC"]:case n.pki.oids["aes192-CBC"]:case n.pki.oids["aes256-CBC"]:t=n.aes.createDecryptionCipher(e.encryptedContent.key);break;case n.pki.oids.desCBC:case n.pki.oids["des-EDE3-CBC"]:t=n.des.createDecryptionCipher(e.encryptedContent.key);break;default:throw new Error("Unsupported symmetric cipher, OID "+e.encryptedContent.algorithm)}if(t.start(e.encryptedContent.parameter),t.update(e.encryptedContent.content),!t.finish())throw new Error("Symmetric decryption failed.");e.content=t.output}}s.messageFromPem=function(e){var t=n.pem.decode(e)[0];if("PKCS7"!==t.type){var r=new Error('Could not convert PKCS#7 message from PEM; PEM header type is not "PKCS#7".');throw r.headerType=t.type,r}if(t.procType&&"ENCRYPTED"===t.procType.type)throw new Error("Could not convert PKCS#7 message from PEM; PEM is encrypted.");var o=i.fromDer(t.body);return s.messageFromAsn1(o)},s.messageToPem=function(e,t){var r={type:"PKCS7",body:i.toDer(e.toAsn1()).getBytes()};return n.pem.encode(r,{maxline:t})},s.messageFromAsn1=function(e){var t={},r=[];if(!i.validate(e,s.asn1.contentInfoValidator,t,r)){var o=new Error("Cannot read PKCS#7 message. ASN.1 object is not an PKCS#7 ContentInfo.");throw o.errors=r,o}var a,c=i.derToOid(t.contentType);switch(c){case n.pki.oids.envelopedData:a=s.createEnvelopedData();break;case n.pki.oids.encryptedData:a=s.createEncryptedData();break;case n.pki.oids.signedData:a=s.createSignedData();break;default:throw new Error("Cannot read PKCS#7 message. ContentType with OID "+c+" is not (yet) supported.")}return a.fromAsn1(t.content.value[0]),a},s.createSignedData=function(){var e=null;return e={type:n.pki.oids.signedData,version:1,certificates:[],crls:[],signers:[],digestAlgorithmIdentifiers:[],contentInfo:null,signerInfos:[],fromAsn1:function(t){if(u(e,t,s.asn1.signedDataValidator),e.certificates=[],e.crls=[],e.digestAlgorithmIdentifiers=[],e.contentInfo=null,e.signerInfos=[],e.rawCapture.certificates)for(var r=e.rawCapture.certificates.value,i=0;i<r.length;++i)e.certificates.push(n.pki.certificateFromAsn1(r[i]))},toAsn1:function(){e.contentInfo||e.sign();for(var t=[],r=0;r<e.certificates.length;++r)t.push(n.pki.certificateToAsn1(e.certificates[r]));var s=[],o=i.create(i.Class.CONTEXT_SPECIFIC,0,!0,[i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.INTEGER,!1,i.integerToDer(e.version).getBytes()),i.create(i.Class.UNIVERSAL,i.Type.SET,!0,e.digestAlgorithmIdentifiers),e.contentInfo])]);return t.length>0&&o.value[0].value.push(i.create(i.Class.CONTEXT_SPECIFIC,0,!0,t)),s.length>0&&o.value[0].value.push(i.create(i.Class.CONTEXT_SPECIFIC,1,!0,s)),o.value[0].value.push(i.create(i.Class.UNIVERSAL,i.Type.SET,!0,e.signerInfos)),i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(e.type).getBytes()),o])},addSigner:function(t){var r=t.issuer,i=t.serialNumber;if(t.certificate){var s=t.certificate;"string"===typeof s&&(s=n.pki.certificateFromPem(s)),r=s.issuer.attributes,i=s.serialNumber}var o=t.key;if(!o)throw new Error("Could not add PKCS#7 signer; no private key specified.");"string"===typeof o&&(o=n.pki.privateKeyFromPem(o));var a=t.digestAlgorithm||n.pki.oids.sha1;switch(a){case n.pki.oids.sha1:case n.pki.oids.sha256:case n.pki.oids.sha384:case n.pki.oids.sha512:case n.pki.oids.md5:break;default:throw new Error("Could not add PKCS#7 signer; unknown message digest algorithm: "+a)}var c=t.authenticatedAttributes||[];if(c.length>0){for(var l=!1,u=!1,h=0;h<c.length;++h){var d=c[h];if(l||d.type!==n.pki.oids.contentType){if(u||d.type!==n.pki.oids.messageDigest);else if(u=!0,l)break}else if(l=!0,u)break}if(!l||!u)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.")}e.signers.push({key:o,version:1,issuer:r,serialNumber:i,digestAlgorithm:a,signatureAlgorithm:n.pki.oids.rsaEncryption,signature:null,authenticatedAttributes:c,unauthenticatedAttributes:[]})},sign:function(t){var r;(t=t||{},"object"!==typeof e.content||null===e.contentInfo)&&(e.contentInfo=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(n.pki.oids.data).getBytes())]),"content"in e&&(e.content instanceof n.util.ByteBuffer?r=e.content.bytes():"string"===typeof e.content&&(r=n.util.encodeUtf8(e.content)),t.detached?e.detachedContent=i.create(i.Class.UNIVERSAL,i.Type.OCTETSTRING,!1,r):e.contentInfo.value.push(i.create(i.Class.CONTEXT_SPECIFIC,0,!0,[i.create(i.Class.UNIVERSAL,i.Type.OCTETSTRING,!1,r)]))));0!==e.signers.length&&function(t){var r;r=e.detachedContent?e.detachedContent:(r=e.contentInfo.value[1]).value[0];if(!r)throw new Error("Could not sign PKCS#7 message; there is no content to sign.");var s=i.derToOid(e.contentInfo.value[0].value),o=i.toDer(r);for(var a in o.getByte(),i.getBerValueLength(o),o=o.getBytes(),t)t[a].start().update(o);for(var u=new Date,h=0;h<e.signers.length;++h){var d=e.signers[h];if(0===d.authenticatedAttributes.length){if(s!==n.pki.oids.data)throw new Error("Invalid signer; authenticatedAttributes must be present when the ContentInfo content type is not PKCS#7 Data.")}else{d.authenticatedAttributesAsn1=i.create(i.Class.CONTEXT_SPECIFIC,0,!0,[]);for(var f=i.create(i.Class.UNIVERSAL,i.Type.SET,!0,[]),p=0;p<d.authenticatedAttributes.length;++p){var y=d.authenticatedAttributes[p];y.type===n.pki.oids.messageDigest?y.value=t[d.digestAlgorithm].digest():y.type===n.pki.oids.signingTime&&(y.value||(y.value=u)),f.value.push(l(y)),d.authenticatedAttributesAsn1.value.push(l(y))}o=i.toDer(f).getBytes(),d.md.start().update(o)}d.signature=d.key.sign(d.md,"RSASSA-PKCS1-V1_5")}e.signerInfos=function(e){for(var t=[],r=0;r<e.length;++r)t.push(c(e[r]));return t}(e.signers)}(function(){for(var t={},r=0;r<e.signers.length;++r){var s=e.signers[r];(o=s.digestAlgorithm)in t||(t[o]=n.md[n.pki.oids[o]].create()),0===s.authenticatedAttributes.length?s.md=t[o]:s.md=n.md[n.pki.oids[o]].create()}for(var o in e.digestAlgorithmIdentifiers=[],t)e.digestAlgorithmIdentifiers.push(i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(o).getBytes()),i.create(i.Class.UNIVERSAL,i.Type.NULL,!1,"")]));return t}())},verify:function(){throw new Error("PKCS#7 signature verification not yet implemented.")},addCertificate:function(t){"string"===typeof t&&(t=n.pki.certificateFromPem(t)),e.certificates.push(t)},addCertificateRevokationList:function(e){throw new Error("PKCS#7 CRL support not yet implemented.")}}},s.createEncryptedData=function(){var e=null;return e={type:n.pki.oids.encryptedData,version:0,encryptedContent:{algorithm:n.pki.oids["aes256-CBC"]},fromAsn1:function(t){u(e,t,s.asn1.encryptedDataValidator)},decrypt:function(t){void 0!==t&&(e.encryptedContent.key=t),h(e)}}},s.createEnvelopedData=function(){var e=null;return e={type:n.pki.oids.envelopedData,version:0,recipients:[],encryptedContent:{algorithm:n.pki.oids["aes256-CBC"]},fromAsn1:function(t){var r=u(e,t,s.asn1.envelopedDataValidator);e.recipients=function(e){for(var t=[],r=0;r<e.length;++r)t.push(o(e[r]));return t}(r.recipientInfos.value)},toAsn1:function(){return i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(e.type).getBytes()),i.create(i.Class.CONTEXT_SPECIFIC,0,!0,[i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.INTEGER,!1,i.integerToDer(e.version).getBytes()),i.create(i.Class.UNIVERSAL,i.Type.SET,!0,a(e.recipients)),i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,(t=e.encryptedContent,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(n.pki.oids.data).getBytes()),i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(t.algorithm).getBytes()),t.parameter?i.create(i.Class.UNIVERSAL,i.Type.OCTETSTRING,!1,t.parameter.getBytes()):void 0]),i.create(i.Class.CONTEXT_SPECIFIC,0,!0,[i.create(i.Class.UNIVERSAL,i.Type.OCTETSTRING,!1,t.content.getBytes())])]))])])]);var t},findRecipient:function(t){for(var r=t.issuer.attributes,n=0;n<e.recipients.length;++n){var i=e.recipients[n],s=i.issuer;if(i.serialNumber===t.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 i}}return null},decrypt:function(t,r){if(void 0===e.encryptedContent.key&&void 0!==t&&void 0!==r)switch(t.encryptedContent.algorithm){case n.pki.oids.rsaEncryption:case n.pki.oids.desCBC:var i=r.decrypt(t.encryptedContent.content);e.encryptedContent.key=n.util.createBuffer(i);break;default:throw new Error("Unsupported asymmetric cipher, OID "+t.encryptedContent.algorithm)}h(e)},addRecipient:function(t){e.recipients.push({version:0,issuer:t.issuer.attributes,serialNumber:t.serialNumber,encryptedContent:{algorithm:n.pki.oids.rsaEncryption,key:t.publicKey}})},encrypt:function(t,r){if(void 0===e.encryptedContent.content){var i,s,o;switch(r=r||e.encryptedContent.algorithm,t=t||e.encryptedContent.key,r){case n.pki.oids["aes128-CBC"]:i=16,s=16,o=n.aes.createEncryptionCipher;break;case n.pki.oids["aes192-CBC"]:i=24,s=16,o=n.aes.createEncryptionCipher;break;case n.pki.oids["aes256-CBC"]:i=32,s=16,o=n.aes.createEncryptionCipher;break;case n.pki.oids["des-EDE3-CBC"]:i=24,s=8,o=n.des.createEncryptionCipher;break;default:throw new Error("Unsupported symmetric cipher, OID "+r)}if(void 0===t)t=n.util.createBuffer(n.random.getBytes(i));else if(t.length()!=i)throw new Error("Symmetric key has wrong length; got "+t.length()+" bytes, expected "+i+".");e.encryptedContent.algorithm=r,e.encryptedContent.key=t,e.encryptedContent.parameter=n.util.createBuffer(n.random.getBytes(s));var a=o(t);if(a.start(e.encryptedContent.parameter.copy()),a.update(e.content),!a.finish())throw new Error("Symmetric encryption failed.");e.encryptedContent.content=a.output}for(var c=0;c<e.recipients.length;++c){var l=e.recipients[c];if(void 0===l.encryptedContent.content){if(l.encryptedContent.algorithm!==n.pki.oids.rsaEncryption)throw new Error("Unsupported asymmetric cipher, OID "+l.encryptedContent.algorithm);l.encryptedContent.content=l.encryptedContent.key.encrypt(e.encryptedContent.key.data)}}}}}},7099:(e,t,r)=>{var n=r(6547);r(8791),r(5061);var i=n.asn1,s=e.exports=n.pkcs7asn1=n.pkcs7asn1||{};n.pkcs7=n.pkcs7||{},n.pkcs7.asn1=s;var o={name:"ContentInfo",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"ContentInfo.ContentType",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"contentType"},{name:"ContentInfo.content",tagClass:i.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,captureAsn1:"content"}]};s.contentInfoValidator=o;var a={name:"EncryptedContentInfo",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedContentInfo.contentType",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"contentType"},{name:"EncryptedContentInfo.contentEncryptionAlgorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedContentInfo.contentEncryptionAlgorithm.algorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"encAlgorithm"},{name:"EncryptedContentInfo.contentEncryptionAlgorithm.parameter",tagClass:i.Class.UNIVERSAL,captureAsn1:"encParameter"}]},{name:"EncryptedContentInfo.encryptedContent",tagClass:i.Class.CONTEXT_SPECIFIC,type:0,capture:"encryptedContent",captureAsn1:"encryptedContentAsn1"}]};s.envelopedDataValidator={name:"EnvelopedData",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"EnvelopedData.Version",tagClass:i.Class.UNIVERSAL,type:i.Type.INTEGER,constructed:!1,capture:"version"},{name:"EnvelopedData.RecipientInfos",tagClass:i.Class.UNIVERSAL,type:i.Type.SET,constructed:!0,captureAsn1:"recipientInfos"}].concat(a)},s.encryptedDataValidator={name:"EncryptedData",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedData.Version",tagClass:i.Class.UNIVERSAL,type:i.Type.INTEGER,constructed:!1,capture:"version"}].concat(a)};var c={name:"SignerInfo",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.version",tagClass:i.Class.UNIVERSAL,type:i.Type.INTEGER,constructed:!1},{name:"SignerInfo.issuerAndSerialNumber",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.issuerAndSerialNumber.issuer",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,captureAsn1:"issuer"},{name:"SignerInfo.issuerAndSerialNumber.serialNumber",tagClass:i.Class.UNIVERSAL,type:i.Type.INTEGER,constructed:!1,capture:"serial"}]},{name:"SignerInfo.digestAlgorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.digestAlgorithm.algorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"digestAlgorithm"},{name:"SignerInfo.digestAlgorithm.parameter",tagClass:i.Class.UNIVERSAL,constructed:!1,captureAsn1:"digestParameter",optional:!0}]},{name:"SignerInfo.authenticatedAttributes",tagClass:i.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,capture:"authenticatedAttributes"},{name:"SignerInfo.digestEncryptionAlgorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,capture:"signatureAlgorithm"},{name:"SignerInfo.encryptedDigest",tagClass:i.Class.UNIVERSAL,type:i.Type.OCTETSTRING,constructed:!1,capture:"signature"},{name:"SignerInfo.unauthenticatedAttributes",tagClass:i.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,optional:!0,capture:"unauthenticatedAttributes"}]};s.signedDataValidator={name:"SignedData",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"SignedData.Version",tagClass:i.Class.UNIVERSAL,type:i.Type.INTEGER,constructed:!1,capture:"version"},{name:"SignedData.DigestAlgorithms",tagClass:i.Class.UNIVERSAL,type:i.Type.SET,constructed:!0,captureAsn1:"digestAlgorithms"},o,{name:"SignedData.Certificates",tagClass:i.Class.CONTEXT_SPECIFIC,type:0,optional:!0,captureAsn1:"certificates"},{name:"SignedData.CertificateRevocationLists",tagClass:i.Class.CONTEXT_SPECIFIC,type:1,optional:!0,captureAsn1:"crls"},{name:"SignedData.SignerInfos",tagClass:i.Class.UNIVERSAL,type:i.Type.SET,capture:"signerInfos",optional:!0,value:[c]}]},s.recipientInfoValidator={name:"RecipientInfo",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.version",tagClass:i.Class.UNIVERSAL,type:i.Type.INTEGER,constructed:!1,capture:"version"},{name:"RecipientInfo.issuerAndSerial",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.issuerAndSerial.issuer",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,captureAsn1:"issuer"},{name:"RecipientInfo.issuerAndSerial.serialNumber",tagClass:i.Class.UNIVERSAL,type:i.Type.INTEGER,constructed:!1,capture:"serial"}]},{name:"RecipientInfo.keyEncryptionAlgorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.keyEncryptionAlgorithm.algorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"encAlgorithm"},{name:"RecipientInfo.keyEncryptionAlgorithm.parameter",tagClass:i.Class.UNIVERSAL,constructed:!1,captureAsn1:"encParameter",optional:!0}]},{name:"RecipientInfo.encryptedKey",tagClass:i.Class.UNIVERSAL,type:i.Type.OCTETSTRING,constructed:!1,capture:"encKey"}]}},5509:(e,t,r)=>{var n=r(6547);r(5061),r(9259),r(4677),function(){if(n.prime)e.exports=n.prime;else{var t=e.exports=n.prime=n.prime||{},r=n.jsbn.BigInteger,i=[6,4,2,4,2,4,6,2],s=new r(null);s.fromInt(30);var o=function(e,t){return e|t};t.generateProbablePrime=function(e,t,i){"function"===typeof t&&(i=t,t={});var s=(t=t||{}).algorithm||"PRIMEINC";"string"===typeof s&&(s={name:s}),s.options=s.options||{};var o=t.prng||n.random,c={nextBytes:function(e){for(var t=o.getBytesSync(e.length),r=0;r<e.length;++r)e[r]=t.charCodeAt(r)}};if("PRIMEINC"===s.name)return function(e,t,i,s){if("workers"in i)return function(e,t,i,s){if("undefined"===typeof Worker)return a(e,t,i,s);var o=l(e,t),c=i.workers,u=i.workLoad||100,h=30*u/8,d=i.workerScript||"forge/prime.worker.js";if(-1===c)return n.util.estimateCores((function(e,t){e&&(t=2),c=t-1,f()}));function f(){c=Math.max(1,c);for(var n=[],i=0;i<c;++i)n[i]=new Worker(d);for(i=0;i<c;++i)n[i].addEventListener("message",f);var a=!1;function f(i){if(!a){0;var c=i.data;if(c.found){for(var d=0;d<n.length;++d)n[d].terminate();return a=!0,s(null,new r(c.prime,16))}o.bitLength()>e&&(o=l(e,t));var f=o.toString(16);i.target.postMessage({hex:f,workLoad:u}),o.dAddOffset(h,0)}}}f()}(e,t,i,s);return a(e,t,i,s)}(e,c,s.options,i);throw new Error("Invalid prime generation algorithm: "+s.name)}}function a(e,t,r,n){var i=l(e,t),s=function(e){return e<=100?27:e<=150?18:e<=200?15:e<=250?12:e<=300?9:e<=350?8:e<=400?7:e<=500?6:e<=600?5:e<=800?4:e<=1250?3:2}(i.bitLength());"millerRabinTests"in r&&(s=r.millerRabinTests);var o=10;"maxBlockTime"in r&&(o=r.maxBlockTime),c(i,e,t,0,s,o,n)}function c(e,t,r,s,o,a,u){var h=+new Date;do{if(e.bitLength()>t&&(e=l(t,r)),e.isProbablePrime(o))return u(null,e);e.dAddOffset(i[s++%8],0)}while(a<0||+new Date-h<a);n.util.setImmediate((function(){c(e,t,r,s,o,a,u)}))}function l(e,t){var n=new r(e,t),i=e-1;return n.testBit(i)||n.bitwiseTo(r.ONE.shiftLeft(i),o,n),n.dAddOffset(31-n.mod(s).byteValue(),0),n}}()},9162:(e,t,r)=>{var n=r(6547);r(5061);var i=null;!n.util.isNodejs||n.options.usePureJavaScript||process.versions["node-webkit"]||(i=r(9437)),(e.exports=n.prng=n.prng||{}).create=function(e){for(var t={plugin:e,key:null,seed:null,time:null,reseeds:0,generated:0,keyBytes:""},r=e.md,s=new Array(32),o=0;o<32;++o)s[o]=r.create();function a(){if(t.pools[0].messageLength>=32)return c();var e=32-t.pools[0].messageLength<<5;t.collect(t.seedFileSync(e)),c()}function c(){t.reseeds=4294967295===t.reseeds?0:t.reseeds+1;var e=t.plugin.md.create();e.update(t.keyBytes);for(var r=1,n=0;n<32;++n)t.reseeds%r===0&&(e.update(t.pools[n].digest().getBytes()),t.pools[n].start()),r<<=1;t.keyBytes=e.digest().getBytes(),e.start(),e.update(t.keyBytes);var i=e.digest().getBytes();t.key=t.plugin.formatKey(t.keyBytes),t.seed=t.plugin.formatSeed(i),t.generated=0}function l(e){var t=null,r=n.util.globalScope,i=r.crypto||r.msCrypto;i&&i.getRandomValues&&(t=function(e){return i.getRandomValues(e)});var s=n.util.createBuffer();if(t)for(;s.length()<e;){var o=Math.max(1,Math.min(e-s.length(),65536)/4),a=new Uint32Array(Math.floor(o));try{t(a);for(var c=0;c<a.length;++c)s.putInt32(a[c])}catch(f){if(!("undefined"!==typeof QuotaExceededError&&f instanceof QuotaExceededError))throw f}}if(s.length()<e)for(var l,u,h,d=Math.floor(65536*Math.random());s.length()<e;){u=16807*(65535&d),u+=(32767&(l=16807*(d>>16)))<<16,d=4294967295&(u=(2147483647&(u+=l>>15))+(u>>31));for(c=0;c<3;++c)h=d>>>(c<<3),h^=Math.floor(256*Math.random()),s.putByte(255&h)}return s.getBytes(e)}return t.pools=s,t.pool=0,t.generate=function(e,r){if(!r)return t.generateSync(e);var i=t.plugin.cipher,s=t.plugin.increment,o=t.plugin.formatKey,a=t.plugin.formatSeed,l=n.util.createBuffer();t.key=null,function u(h){if(h)return r(h);if(l.length()>=e)return r(null,l.getBytes(e));t.generated>1048575&&(t.key=null);if(null===t.key)return n.util.nextTick((function(){!function(e){if(t.pools[0].messageLength>=32)return c(),e();var r=32-t.pools[0].messageLength<<5;t.seedFile(r,(function(r,n){if(r)return e(r);t.collect(n),c(),e()}))}(u)}));var d=i(t.key,t.seed);t.generated+=d.length,l.putBytes(d),t.key=o(i(t.key,s(t.seed))),t.seed=a(i(t.key,t.seed)),n.util.setImmediate(u)}()},t.generateSync=function(e){var r=t.plugin.cipher,i=t.plugin.increment,s=t.plugin.formatKey,o=t.plugin.formatSeed;t.key=null;for(var c=n.util.createBuffer();c.length()<e;){t.generated>1048575&&(t.key=null),null===t.key&&a();var l=r(t.key,t.seed);t.generated+=l.length,c.putBytes(l),t.key=s(r(t.key,i(t.seed))),t.seed=o(r(t.key,t.seed))}return c.getBytes(e)},i?(t.seedFile=function(e,t){i.randomBytes(e,(function(e,r){if(e)return t(e);t(null,r.toString())}))},t.seedFileSync=function(e){return i.randomBytes(e).toString()}):(t.seedFile=function(e,t){try{t(null,l(e))}catch(r){t(r)}},t.seedFileSync=l),t.collect=function(e){for(var r=e.length,n=0;n<r;++n)t.pools[t.pool].update(e.substr(n,1)),t.pool=31===t.pool?0:t.pool+1},t.collectInt=function(e,r){for(var n="",i=0;i<r;i+=8)n+=String.fromCharCode(e>>i&255);t.collect(n)},t.registerWorker=function(e){if(e===self)t.seedFile=function(e,t){self.addEventListener("message",(function e(r){var n=r.data;n.forge&&n.forge.prng&&(self.removeEventListener("message",e),t(n.forge.prng.err,n.forge.prng.bytes))})),self.postMessage({forge:{prng:{needed:e}}})};else{e.addEventListener("message",(function(r){var n=r.data;n.forge&&n.forge.prng&&t.seedFile(n.forge.prng.needed,(function(t,r){e.postMessage({forge:{prng:{err:t,bytes:r}}})}))}))}},t}},8504:(e,t,r)=>{var n=r(6547);r(4677),r(5061),(e.exports=n.pss=n.pss||{}).create=function(e){3===arguments.length&&(e={md:arguments[0],mgf:arguments[1],saltLength:arguments[2]});var t,r=e.md,i=e.mgf,s=r.digestLength,o=e.salt||null;if("string"===typeof o&&(o=n.util.createBuffer(o)),"saltLength"in e)t=e.saltLength;else{if(null===o)throw new Error("Salt length not specified or specific salt not given.");t=o.length()}if(null!==o&&o.length()!==t)throw new Error("Given salt length does not match length of given salt.");var a=e.prng||n.random,c={encode:function(e,c){var l,u,h=c-1,d=Math.ceil(h/8),f=e.digest().getBytes();if(d<s+t+2)throw new Error("Message is too long to encrypt.");u=null===o?a.getBytesSync(t):o.bytes();var p=new n.util.ByteBuffer;p.fillWithByte(0,8),p.putBytes(f),p.putBytes(u),r.start(),r.update(p.getBytes());var y=r.digest().getBytes(),g=new n.util.ByteBuffer;g.fillWithByte(0,d-t-s-2),g.putByte(1),g.putBytes(u);var m=g.getBytes(),v=d-s-1,b=i.generate(y,v),w="";for(l=0;l<v;l++)w+=String.fromCharCode(m.charCodeAt(l)^b.charCodeAt(l));var E=65280>>8*d-h&255;return(w=String.fromCharCode(w.charCodeAt(0)&~E)+w.substr(1))+y+String.fromCharCode(188)},verify:function(e,o,a){var c,l=a-1,u=Math.ceil(l/8);if(o=o.substr(-u),u<s+t+2)throw new Error("Inconsistent parameters to PSS signature verification.");if(188!==o.charCodeAt(u-1))throw new Error("Encoded message does not end in 0xBC.");var h=u-s-1,d=o.substr(0,h),f=o.substr(h,s),p=65280>>8*u-l&255;if(0!==(d.charCodeAt(0)&p))throw new Error("Bits beyond keysize not zero as expected.");var y=i.generate(f,h),g="";for(c=0;c<h;c++)g+=String.fromCharCode(d.charCodeAt(c)^y.charCodeAt(c));g=String.fromCharCode(g.charCodeAt(0)&~p)+g.substr(1);var m=u-s-t-2;for(c=0;c<m;c++)if(0!==g.charCodeAt(c))throw new Error("Leftmost octets not zero as expected");if(1!==g.charCodeAt(m))throw new Error("Inconsistent PSS signature, 0x01 marker not found");var v=g.substr(-t),b=new n.util.ByteBuffer;return b.fillWithByte(0,8),b.putBytes(e),b.putBytes(v),r.start(),r.update(b.getBytes()),f===r.digest().getBytes()}};return c}},4677:(e,t,r)=>{var n=r(6547);r(5645),r(1571),r(9162),r(5061),n.random&&n.random.getBytes?e.exports=n.random:function(t){var r={},i=new Array(4),s=n.util.createBuffer();function o(){var e=n.prng.create(r);return e.getBytes=function(t,r){return e.generate(t,r)},e.getBytesSync=function(t){return e.generate(t)},e}r.formatKey=function(e){var t=n.util.createBuffer(e);return(e=new Array(4))[0]=t.getInt32(),e[1]=t.getInt32(),e[2]=t.getInt32(),e[3]=t.getInt32(),n.aes._expandKey(e,!1)},r.formatSeed=function(e){var t=n.util.createBuffer(e);return(e=new Array(4))[0]=t.getInt32(),e[1]=t.getInt32(),e[2]=t.getInt32(),e[3]=t.getInt32(),e},r.cipher=function(e,t){return n.aes._updateBlock(e,t,i,!1),s.putInt32(i[0]),s.putInt32(i[1]),s.putInt32(i[2]),s.putInt32(i[3]),s.getBytes()},r.increment=function(e){return++e[3],e},r.md=n.md.sha256;var a=o(),c=null,l=n.util.globalScope,u=l.crypto||l.msCrypto;if(u&&u.getRandomValues&&(c=function(e){return u.getRandomValues(e)}),n.options.usePureJavaScript||!n.util.isNodejs&&!c){if("undefined"===typeof window||window.document,a.collectInt(+new Date,32),"undefined"!==typeof navigator){var h="";for(var d in navigator)try{"string"==typeof navigator[d]&&(h+=navigator[d])}catch(f){}a.collect(h),h=null}t&&(t().mousemove((function(e){a.collectInt(e.clientX,16),a.collectInt(e.clientY,16)})),t().keypress((function(e){a.collectInt(e.charCode,8)})))}if(n.random)for(var d in a)n.random[d]=a[d];else n.random=a;n.random.createInstance=o,e.exports=n.random}("undefined"!==typeof jQuery?jQuery:null)},9707:(e,t,r)=>{var n=r(6547);r(5061);var i=[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],s=[1,2,3,5],o=function(e,t){return e<<t&65535|(65535&e)>>16-t},a=function(e,t){return(65535&e)>>t|e<<16-t&65535};e.exports=n.rc2=n.rc2||{},n.rc2.expandKey=function(e,t){"string"===typeof e&&(e=n.util.createBuffer(e)),t=t||128;var r,s=e,o=e.length(),a=t,c=Math.ceil(a/8),l=255>>(7&a);for(r=o;r<128;r++)s.putByte(i[s.at(r-1)+s.at(r-o)&255]);for(s.setAt(128-c,i[s.at(128-c)&l]),r=127-c;r>=0;r--)s.setAt(r,i[s.at(r+1)^s.at(r+c)]);return s};var c=function(e,t,r){var i,c,l,u,h=!1,d=null,f=null,p=null,y=[];for(e=n.rc2.expandKey(e,t),l=0;l<64;l++)y.push(e.getInt16Le());r?(i=function(e){for(l=0;l<4;l++)e[l]+=y[u]+(e[(l+3)%4]&e[(l+2)%4])+(~e[(l+3)%4]&e[(l+1)%4]),e[l]=o(e[l],s[l]),u++},c=function(e){for(l=0;l<4;l++)e[l]+=y[63&e[(l+3)%4]]}):(i=function(e){for(l=3;l>=0;l--)e[l]=a(e[l],s[l]),e[l]-=y[u]+(e[(l+3)%4]&e[(l+2)%4])+(~e[(l+3)%4]&e[(l+1)%4]),u--},c=function(e){for(l=3;l>=0;l--)e[l]-=y[63&e[(l+3)%4]]});var g=function(e){var t=[];for(l=0;l<4;l++){var n=d.getInt16Le();null!==p&&(r?n^=p.getInt16Le():p.putInt16Le(n)),t.push(65535&n)}u=r?0:63;for(var i=0;i<e.length;i++)for(var s=0;s<e[i][0];s++)e[i][1](t);for(l=0;l<4;l++)null!==p&&(r?p.putInt16Le(t[l]):t[l]^=p.getInt16Le()),f.putInt16Le(t[l])},m=null;return m={start:function(e,t){e&&"string"===typeof e&&(e=n.util.createBuffer(e)),h=!1,d=n.util.createBuffer(),f=t||new n.util.createBuffer,p=e,m.output=f},update:function(e){for(h||d.putBuffer(e);d.length()>=8;)g([[5,i],[1,c],[6,i],[1,c],[5,i]])},finish:function(e){var t=!0;if(r)if(e)t=e(8,d,!r);else{var n=8===d.length()?8:8-d.length();d.fillWithByte(n,n)}if(t&&(h=!0,m.update()),!r&&(t=0===d.length()))if(e)t=e(8,f,!r);else{var i=f.length(),s=f.at(i-1);s>i?t=!1:f.truncate(s)}return t}}};n.rc2.startEncrypting=function(e,t,r){var i=n.rc2.createEncryptionCipher(e,128);return i.start(t,r),i},n.rc2.createEncryptionCipher=function(e,t){return c(e,t,!0)},n.rc2.startDecrypting=function(e,t,r){var i=n.rc2.createDecryptionCipher(e,128);return i.start(t,r),i},n.rc2.createDecryptionCipher=function(e,t){return c(e,t,!1)}},8690:(e,t,r)=>{var n=r(6547);if(r(8791),r(9259),r(8217),r(9838),r(5509),r(4677),r(5061),"undefined"===typeof i)var i=n.jsbn.BigInteger;var s=n.util.isNodejs?r(9437):null,o=n.asn1,a=n.util;n.pki=n.pki||{},e.exports=n.pki.rsa=n.rsa=n.rsa||{};var c=n.pki,l=[6,4,2,4,2,4,6,2],u={name:"PrivateKeyInfo",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"PrivateKeyInfo.version",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"PrivateKeyInfo.privateKeyAlgorithm",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:o.Class.UNIVERSAL,type:o.Type.OID,constructed:!1,capture:"privateKeyOid"}]},{name:"PrivateKeyInfo",tagClass:o.Class.UNIVERSAL,type:o.Type.OCTETSTRING,constructed:!1,capture:"privateKey"}]},h={name:"RSAPrivateKey",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPrivateKey.version",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"RSAPrivateKey.modulus",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"privateKeyModulus"},{name:"RSAPrivateKey.publicExponent",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"privateKeyPublicExponent"},{name:"RSAPrivateKey.privateExponent",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"privateKeyPrivateExponent"},{name:"RSAPrivateKey.prime1",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"privateKeyPrime1"},{name:"RSAPrivateKey.prime2",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"privateKeyPrime2"},{name:"RSAPrivateKey.exponent1",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"privateKeyExponent1"},{name:"RSAPrivateKey.exponent2",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"privateKeyExponent2"},{name:"RSAPrivateKey.coefficient",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"privateKeyCoefficient"}]},d={name:"RSAPublicKey",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPublicKey.modulus",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"publicKeyModulus"},{name:"RSAPublicKey.exponent",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"publicKeyExponent"}]},f=n.pki.rsa.publicKeyValidator={name:"SubjectPublicKeyInfo",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,captureAsn1:"subjectPublicKeyInfo",value:[{name:"SubjectPublicKeyInfo.AlgorithmIdentifier",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:o.Class.UNIVERSAL,type:o.Type.OID,constructed:!1,capture:"publicKeyOid"}]},{name:"SubjectPublicKeyInfo.subjectPublicKey",tagClass:o.Class.UNIVERSAL,type:o.Type.BITSTRING,constructed:!1,value:[{name:"SubjectPublicKeyInfo.subjectPublicKey.RSAPublicKey",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,optional:!0,captureAsn1:"rsaPublicKey"}]}]},p={name:"DigestInfo",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"DigestInfo.DigestAlgorithm",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"DigestInfo.DigestAlgorithm.algorithmIdentifier",tagClass:o.Class.UNIVERSAL,type:o.Type.OID,constructed:!1,capture:"algorithmIdentifier"},{name:"DigestInfo.DigestAlgorithm.parameters",tagClass:o.Class.UNIVERSAL,type:o.Type.NULL,capture:"parameters",optional:!0,constructed:!1}]},{name:"DigestInfo.digest",tagClass:o.Class.UNIVERSAL,type:o.Type.OCTETSTRING,constructed:!1,capture:"digest"}]},y=function(e){var t;if(!(e.algorithm in c.oids)){var r=new Error("Unknown message digest algorithm.");throw r.algorithm=e.algorithm,r}t=c.oids[e.algorithm];var n=o.oidToDer(t).getBytes(),i=o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[]),s=o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[]);s.value.push(o.create(o.Class.UNIVERSAL,o.Type.OID,!1,n)),s.value.push(o.create(o.Class.UNIVERSAL,o.Type.NULL,!1,""));var a=o.create(o.Class.UNIVERSAL,o.Type.OCTETSTRING,!1,e.digest().getBytes());return i.value.push(s),i.value.push(a),o.toDer(i).getBytes()},g=function(e,t,r){if(r)return e.modPow(t.e,t.n);if(!t.p||!t.q)return e.modPow(t.d,t.n);var s;t.dP||(t.dP=t.d.mod(t.p.subtract(i.ONE))),t.dQ||(t.dQ=t.d.mod(t.q.subtract(i.ONE))),t.qInv||(t.qInv=t.q.modInverse(t.p));do{s=new i(n.util.bytesToHex(n.random.getBytes(t.n.bitLength()/8)),16)}while(s.compareTo(t.n)>=0||!s.gcd(t.n).equals(i.ONE));for(var o=(e=e.multiply(s.modPow(t.e,t.n)).mod(t.n)).mod(t.p).modPow(t.dP,t.p),a=e.mod(t.q).modPow(t.dQ,t.q);o.compareTo(a)<0;)o=o.add(t.p);var c=o.subtract(a).multiply(t.qInv).mod(t.p).multiply(t.q).add(a);return c=c.multiply(s.modInverse(t.n)).mod(t.n)};function m(e,t,r){var i=n.util.createBuffer(),s=Math.ceil(t.n.bitLength()/8);if(e.length>s-11){var o=new Error("Message is too long for PKCS#1 v1.5 padding.");throw o.length=e.length,o.max=s-11,o}i.putByte(0),i.putByte(r);var a,c=s-3-e.length;if(0===r||1===r){a=0===r?0:255;for(var l=0;l<c;++l)i.putByte(a)}else for(;c>0;){var u=0,h=n.random.getBytes(c);for(l=0;l<c;++l)0===(a=h.charCodeAt(l))?++u:i.putByte(a);c=u}return i.putByte(0),i.putBytes(e),i}function v(e,t,r,i){var s=Math.ceil(t.n.bitLength()/8),o=n.util.createBuffer(e),a=o.getByte(),c=o.getByte();if(0!==a||r&&0!==c&&1!==c||!r&&2!=c||r&&0===c&&"undefined"===typeof i)throw new Error("Encryption block is invalid.");var l=0;if(0===c){l=s-3-i;for(var u=0;u<l;++u)if(0!==o.getByte())throw new Error("Encryption block is invalid.")}else if(1===c)for(l=0;o.length()>1;){if(255!==o.getByte()){--o.read;break}++l}else if(2===c)for(l=0;o.length()>1;){if(0===o.getByte()){--o.read;break}++l}if(0!==o.getByte()||l!==s-3-o.length())throw new Error("Encryption block is invalid.");return o.getBytes()}function b(e,t,r){"function"===typeof t&&(r=t,t={});var s={algorithm:{name:(t=t||{}).algorithm||"PRIMEINC",options:{workers:t.workers||2,workLoad:t.workLoad||100,workerScript:t.workerScript}}};function o(){a(e.pBits,(function(t,n){return t?r(t):(e.p=n,null!==e.q?l(t,e.q):void a(e.qBits,l))}))}function a(e,t){n.prime.generateProbablePrime(e,s,t)}function l(t,n){if(t)return r(t);if(e.q=n,e.p.compareTo(e.q)<0){var s=e.p;e.p=e.q,e.q=s}if(0!==e.p.subtract(i.ONE).gcd(e.e).compareTo(i.ONE))return e.p=null,void o();if(0!==e.q.subtract(i.ONE).gcd(e.e).compareTo(i.ONE))return e.q=null,void a(e.qBits,l);if(e.p1=e.p.subtract(i.ONE),e.q1=e.q.subtract(i.ONE),e.phi=e.p1.multiply(e.q1),0!==e.phi.gcd(e.e).compareTo(i.ONE))return e.p=e.q=null,void o();if(e.n=e.p.multiply(e.q),e.n.bitLength()!==e.bits)return e.q=null,void a(e.qBits,l);var u=e.e.modInverse(e.phi);e.keys={privateKey:c.rsa.setPrivateKey(e.n,e.e,u,e.p,e.q,u.mod(e.p1),u.mod(e.q1),e.q.modInverse(e.p)),publicKey:c.rsa.setPublicKey(e.n,e.e)},r(null,e.keys)}"prng"in t&&(s.prng=t.prng),o()}function w(e){var t=e.toString(16);t[0]>="8"&&(t="00"+t);var r=n.util.hexToBytes(t);return r.length>1&&(0===r.charCodeAt(0)&&0===(128&r.charCodeAt(1))||255===r.charCodeAt(0)&&128===(128&r.charCodeAt(1)))?r.substr(1):r}function E(e){return e<=100?27:e<=150?18:e<=200?15:e<=250?12:e<=300?9:e<=350?8:e<=400?7:e<=500?6:e<=600?5:e<=800?4:e<=1250?3:2}function _(e){return n.util.isNodejs&&"function"===typeof s[e]}function S(e){return"undefined"!==typeof a.globalScope&&"object"===typeof a.globalScope.crypto&&"object"===typeof a.globalScope.crypto.subtle&&"function"===typeof a.globalScope.crypto.subtle[e]}function I(e){return"undefined"!==typeof a.globalScope&&"object"===typeof a.globalScope.msCrypto&&"object"===typeof a.globalScope.msCrypto.subtle&&"function"===typeof a.globalScope.msCrypto.subtle[e]}function C(e){for(var t=n.util.hexToBytes(e.toString(16)),r=new Uint8Array(t.length),i=0;i<t.length;++i)r[i]=t.charCodeAt(i);return r}c.rsa.encrypt=function(e,t,r){var s,o=r,a=Math.ceil(t.n.bitLength()/8);!1!==r&&!0!==r?(o=2===r,s=m(e,t,r)):(s=n.util.createBuffer()).putBytes(e);for(var c=new i(s.toHex(),16),l=g(c,t,o).toString(16),u=n.util.createBuffer(),h=a-Math.ceil(l.length/2);h>0;)u.putByte(0),--h;return u.putBytes(n.util.hexToBytes(l)),u.getBytes()},c.rsa.decrypt=function(e,t,r,s){var o=Math.ceil(t.n.bitLength()/8);if(e.length!==o){var a=new Error("Encrypted message length is invalid.");throw a.length=e.length,a.expected=o,a}var c=new i(n.util.createBuffer(e).toHex(),16);if(c.compareTo(t.n)>=0)throw new Error("Encrypted message is invalid.");for(var l=g(c,t,r).toString(16),u=n.util.createBuffer(),h=o-Math.ceil(l.length/2);h>0;)u.putByte(0),--h;return u.putBytes(n.util.hexToBytes(l)),!1!==s?v(u.getBytes(),t,r):u.getBytes()},c.rsa.createKeyPairGenerationState=function(e,t,r){"string"===typeof e&&(e=parseInt(e,10)),e=e||2048;var s,o=(r=r||{}).prng||n.random,a={nextBytes:function(e){for(var t=o.getBytesSync(e.length),r=0;r<e.length;++r)e[r]=t.charCodeAt(r)}},c=r.algorithm||"PRIMEINC";if("PRIMEINC"!==c)throw new Error("Invalid key generation algorithm: "+c);return(s={algorithm:c,state:0,bits:e,rng:a,eInt:t||65537,e:new i(null),p:null,q:null,qBits:e>>1,pBits:e-(e>>1),pqState:0,num:null,keys:null}).e.fromInt(s.eInt),s},c.rsa.stepKeyPairGenerationState=function(e,t){"algorithm"in e||(e.algorithm="PRIMEINC");var r=new i(null);r.fromInt(30);for(var n,s=0,o=function(e,t){return e|t},a=+new Date,u=0;null===e.keys&&(t<=0||u<t);){if(0===e.state){var h=null===e.p?e.pBits:e.qBits,d=h-1;0===e.pqState?(e.num=new i(h,e.rng),e.num.testBit(d)||e.num.bitwiseTo(i.ONE.shiftLeft(d),o,e.num),e.num.dAddOffset(31-e.num.mod(r).byteValue(),0),s=0,++e.pqState):1===e.pqState?e.num.bitLength()>h?e.pqState=0:e.num.isProbablePrime(E(e.num.bitLength()))?++e.pqState:e.num.dAddOffset(l[s++%8],0):2===e.pqState?e.pqState=0===e.num.subtract(i.ONE).gcd(e.e).compareTo(i.ONE)?3:0:3===e.pqState&&(e.pqState=0,null===e.p?e.p=e.num:e.q=e.num,null!==e.p&&null!==e.q&&++e.state,e.num=null)}else if(1===e.state)e.p.compareTo(e.q)<0&&(e.num=e.p,e.p=e.q,e.q=e.num),++e.state;else if(2===e.state)e.p1=e.p.subtract(i.ONE),e.q1=e.q.subtract(i.ONE),e.phi=e.p1.multiply(e.q1),++e.state;else if(3===e.state)0===e.phi.gcd(e.e).compareTo(i.ONE)?++e.state:(e.p=null,e.q=null,e.state=0);else if(4===e.state)e.n=e.p.multiply(e.q),e.n.bitLength()===e.bits?++e.state:(e.q=null,e.state=0);else if(5===e.state){var f=e.e.modInverse(e.phi);e.keys={privateKey:c.rsa.setPrivateKey(e.n,e.e,f,e.p,e.q,f.mod(e.p1),f.mod(e.q1),e.q.modInverse(e.p)),publicKey:c.rsa.setPublicKey(e.n,e.e)}}u+=(n=+new Date)-a,a=n}return null!==e.keys},c.rsa.generateKeyPair=function(e,t,r,i){if(1===arguments.length?"object"===typeof e?(r=e,e=void 0):"function"===typeof e&&(i=e,e=void 0):2===arguments.length?"number"===typeof e?"function"===typeof t?(i=t,t=void 0):"number"!==typeof t&&(r=t,t=void 0):(r=e,i=t,e=void 0,t=void 0):3===arguments.length&&("number"===typeof t?"function"===typeof r&&(i=r,r=void 0):(i=r,r=t,t=void 0)),r=r||{},void 0===e&&(e=r.bits||2048),void 0===t&&(t=r.e||65537),!n.options.usePureJavaScript&&!r.prng&&e>=256&&e<=16384&&(65537===t||3===t))if(i){if(_("generateKeyPair"))return s.generateKeyPair("rsa",{modulusLength:e,publicExponent:t,publicKeyEncoding:{type:"spki",format:"pem"},privateKeyEncoding:{type:"pkcs8",format:"pem"}},(function(e,t,r){if(e)return i(e);i(null,{privateKey:c.privateKeyFromPem(r),publicKey:c.publicKeyFromPem(t)})}));if(S("generateKey")&&S("exportKey"))return a.globalScope.crypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:e,publicExponent:C(t),hash:{name:"SHA-256"}},!0,["sign","verify"]).then((function(e){return a.globalScope.crypto.subtle.exportKey("pkcs8",e.privateKey)})).then(void 0,(function(e){i(e)})).then((function(e){if(e){var t=c.privateKeyFromAsn1(o.fromDer(n.util.createBuffer(e)));i(null,{privateKey:t,publicKey:c.setRsaPublicKey(t.n,t.e)})}}));if(I("generateKey")&&I("exportKey")){var l=a.globalScope.msCrypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:e,publicExponent:C(t),hash:{name:"SHA-256"}},!0,["sign","verify"]);return l.oncomplete=function(e){var t=e.target.result,r=a.globalScope.msCrypto.subtle.exportKey("pkcs8",t.privateKey);r.oncomplete=function(e){var t=e.target.result,r=c.privateKeyFromAsn1(o.fromDer(n.util.createBuffer(t)));i(null,{privateKey:r,publicKey:c.setRsaPublicKey(r.n,r.e)})},r.onerror=function(e){i(e)}},void(l.onerror=function(e){i(e)})}}else if(_("generateKeyPairSync")){var u=s.generateKeyPairSync("rsa",{modulusLength:e,publicExponent:t,publicKeyEncoding:{type:"spki",format:"pem"},privateKeyEncoding:{type:"pkcs8",format:"pem"}});return{privateKey:c.privateKeyFromPem(u.privateKey),publicKey:c.publicKeyFromPem(u.publicKey)}}var h=c.rsa.createKeyPairGenerationState(e,t,r);if(!i)return c.rsa.stepKeyPairGenerationState(h,0),h.keys;b(h,r,i)},c.setRsaPublicKey=c.rsa.setPublicKey=function(e,t){var r={n:e,e:t,encrypt:function(e,t,i){if("string"===typeof t?t=t.toUpperCase():void 0===t&&(t="RSAES-PKCS1-V1_5"),"RSAES-PKCS1-V1_5"===t)t={encode:function(e,t,r){return m(e,t,2).getBytes()}};else if("RSA-OAEP"===t||"RSAES-OAEP"===t)t={encode:function(e,t){return n.pkcs1.encode_rsa_oaep(t,e,i)}};else if(-1!==["RAW","NONE","NULL",null].indexOf(t))t={encode:function(e){return e}};else if("string"===typeof t)throw new Error('Unsupported encryption scheme: "'+t+'".');var s=t.encode(e,r,!0);return c.rsa.encrypt(s,r,!0)},verify:function(e,t,i,s){"string"===typeof i?i=i.toUpperCase():void 0===i&&(i="RSASSA-PKCS1-V1_5"),void 0===s&&(s={_parseAllDigestBytes:!0}),"_parseAllDigestBytes"in s||(s._parseAllDigestBytes=!0),"RSASSA-PKCS1-V1_5"===i?i={verify:function(e,t){t=v(t,r,!0);var i=o.fromDer(t,{parseAllBytes:s._parseAllDigestBytes}),a={},c=[];if(!o.validate(i,p,a,c))throw(l=new Error("ASN.1 object does not contain a valid RSASSA-PKCS1-v1_5 DigestInfo value.")).errors=c,l;var l,u=o.derToOid(a.algorithmIdentifier);if(u!==n.oids.md2&&u!==n.oids.md5&&u!==n.oids.sha1&&u!==n.oids.sha224&&u!==n.oids.sha256&&u!==n.oids.sha384&&u!==n.oids.sha512&&u!==n.oids["sha512-224"]&&u!==n.oids["sha512-256"])throw(l=new Error("Unknown RSASSA-PKCS1-v1_5 DigestAlgorithm identifier.")).oid=u,l;if((u===n.oids.md2||u===n.oids.md5)&&!("parameters"in a))throw new Error("ASN.1 object does not contain a valid RSASSA-PKCS1-v1_5 DigestInfo value. Missing algorithm identifer NULL parameters.");return e===a.digest}}:"NONE"!==i&&"NULL"!==i&&null!==i||(i={verify:function(e,t){return e===(t=v(t,r,!0))}});var a=c.rsa.decrypt(t,r,!0,!1);return i.verify(e,a,r.n.bitLength())}};return r},c.setRsaPrivateKey=c.rsa.setPrivateKey=function(e,t,r,i,s,o,a,l){var u={n:e,e:t,d:r,p:i,q:s,dP:o,dQ:a,qInv:l,decrypt:function(e,t,r){"string"===typeof t?t=t.toUpperCase():void 0===t&&(t="RSAES-PKCS1-V1_5");var i=c.rsa.decrypt(e,u,!1,!1);if("RSAES-PKCS1-V1_5"===t)t={decode:v};else if("RSA-OAEP"===t||"RSAES-OAEP"===t)t={decode:function(e,t){return n.pkcs1.decode_rsa_oaep(t,e,r)}};else{if(-1===["RAW","NONE","NULL",null].indexOf(t))throw new Error('Unsupported encryption scheme: "'+t+'".');t={decode:function(e){return e}}}return t.decode(i,u,!1)},sign:function(e,t){var r=!1;"string"===typeof t&&(t=t.toUpperCase()),void 0===t||"RSASSA-PKCS1-V1_5"===t?(t={encode:y},r=1):"NONE"!==t&&"NULL"!==t&&null!==t||(t={encode:function(){return e}},r=1);var n=t.encode(e,u.n.bitLength());return c.rsa.encrypt(n,u,r)}};return u},c.wrapRsaPrivateKey=function(e){return o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,o.integerToDer(0).getBytes()),o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.OID,!1,o.oidToDer(c.oids.rsaEncryption).getBytes()),o.create(o.Class.UNIVERSAL,o.Type.NULL,!1,"")]),o.create(o.Class.UNIVERSAL,o.Type.OCTETSTRING,!1,o.toDer(e).getBytes())])},c.privateKeyFromAsn1=function(e){var t,r,s,a,l,d,f,p,y={},g=[];if(o.validate(e,u,y,g)&&(e=o.fromDer(n.util.createBuffer(y.privateKey))),y={},g=[],!o.validate(e,h,y,g)){var m=new Error("Cannot read private key. ASN.1 object does not contain an RSAPrivateKey.");throw m.errors=g,m}return t=n.util.createBuffer(y.privateKeyModulus).toHex(),r=n.util.createBuffer(y.privateKeyPublicExponent).toHex(),s=n.util.createBuffer(y.privateKeyPrivateExponent).toHex(),a=n.util.createBuffer(y.privateKeyPrime1).toHex(),l=n.util.createBuffer(y.privateKeyPrime2).toHex(),d=n.util.createBuffer(y.privateKeyExponent1).toHex(),f=n.util.createBuffer(y.privateKeyExponent2).toHex(),p=n.util.createBuffer(y.privateKeyCoefficient).toHex(),c.setRsaPrivateKey(new i(t,16),new i(r,16),new i(s,16),new i(a,16),new i(l,16),new i(d,16),new i(f,16),new i(p,16))},c.privateKeyToAsn1=c.privateKeyToRSAPrivateKey=function(e){return o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,o.integerToDer(0).getBytes()),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,w(e.n)),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,w(e.e)),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,w(e.d)),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,w(e.p)),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,w(e.q)),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,w(e.dP)),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,w(e.dQ)),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,w(e.qInv))])},c.publicKeyFromAsn1=function(e){var t={},r=[];if(o.validate(e,f,t,r)){var s,a=o.derToOid(t.publicKeyOid);if(a!==c.oids.rsaEncryption)throw(s=new Error("Cannot read public key. Unknown OID.")).oid=a,s;e=t.rsaPublicKey}if(r=[],!o.validate(e,d,t,r))throw(s=new Error("Cannot read public key. ASN.1 object does not contain an RSAPublicKey.")).errors=r,s;var l=n.util.createBuffer(t.publicKeyModulus).toHex(),u=n.util.createBuffer(t.publicKeyExponent).toHex();return c.setRsaPublicKey(new i(l,16),new i(u,16))},c.publicKeyToAsn1=c.publicKeyToSubjectPublicKeyInfo=function(e){return o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.OID,!1,o.oidToDer(c.oids.rsaEncryption).getBytes()),o.create(o.Class.UNIVERSAL,o.Type.NULL,!1,"")]),o.create(o.Class.UNIVERSAL,o.Type.BITSTRING,!1,[c.publicKeyToRSAPublicKey(e)])])},c.publicKeyToRSAPublicKey=function(e){return o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,w(e.n)),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,w(e.e))])}},938:(e,t,r)=>{var n=r(6547);r(9893),r(5061);var i=e.exports=n.sha1=n.sha1||{};n.md.sha1=n.md.algorithms.sha1=i,i.create=function(){o||(s=String.fromCharCode(128),s+=n.util.fillString(String.fromCharCode(0),64),o=!0);var e=null,t=n.util.createBuffer(),r=new Array(80),i={algorithm:"sha1",blockLength:64,digestLength:20,messageLength:0,fullMessageLength:null,messageLengthSize:8,start:function(){i.messageLength=0,i.fullMessageLength=i.messageLength64=[];for(var r=i.messageLengthSize/4,s=0;s<r;++s)i.fullMessageLength.push(0);return t=n.util.createBuffer(),e={h0:1732584193,h1:4023233417,h2:2562383102,h3:271733878,h4:3285377520},i}};return i.start(),i.update=function(s,o){"utf8"===o&&(s=n.util.encodeUtf8(s));var c=s.length;i.messageLength+=c,c=[c/4294967296>>>0,c>>>0];for(var l=i.fullMessageLength.length-1;l>=0;--l)i.fullMessageLength[l]+=c[1],c[1]=c[0]+(i.fullMessageLength[l]/4294967296>>>0),i.fullMessageLength[l]=i.fullMessageLength[l]>>>0,c[0]=c[1]/4294967296>>>0;return t.putBytes(s),a(e,r,t),(t.read>2048||0===t.length())&&t.compact(),i},i.digest=function(){var o=n.util.createBuffer();o.putBytes(t.bytes());var c,l=i.fullMessageLength[i.fullMessageLength.length-1]+i.messageLengthSize&i.blockLength-1;o.putBytes(s.substr(0,i.blockLength-l));for(var u=8*i.fullMessageLength[0],h=0;h<i.fullMessageLength.length-1;++h)u+=(c=8*i.fullMessageLength[h+1])/4294967296>>>0,o.putInt32(u>>>0),u=c>>>0;o.putInt32(u);var d={h0:e.h0,h1:e.h1,h2:e.h2,h3:e.h3,h4:e.h4};a(d,r,o);var f=n.util.createBuffer();return f.putInt32(d.h0),f.putInt32(d.h1),f.putInt32(d.h2),f.putInt32(d.h3),f.putInt32(d.h4),f},i};var s=null,o=!1;function a(e,t,r){for(var n,i,s,o,a,c,l,u=r.length();u>=64;){for(i=e.h0,s=e.h1,o=e.h2,a=e.h3,c=e.h4,l=0;l<16;++l)n=r.getInt32(),t[l]=n,n=(i<<5|i>>>27)+(a^s&(o^a))+c+1518500249+n,c=a,a=o,o=(s<<30|s>>>2)>>>0,s=i,i=n;for(;l<20;++l)n=(n=t[l-3]^t[l-8]^t[l-14]^t[l-16])<<1|n>>>31,t[l]=n,n=(i<<5|i>>>27)+(a^s&(o^a))+c+1518500249+n,c=a,a=o,o=(s<<30|s>>>2)>>>0,s=i,i=n;for(;l<32;++l)n=(n=t[l-3]^t[l-8]^t[l-14]^t[l-16])<<1|n>>>31,t[l]=n,n=(i<<5|i>>>27)+(s^o^a)+c+1859775393+n,c=a,a=o,o=(s<<30|s>>>2)>>>0,s=i,i=n;for(;l<40;++l)n=(n=t[l-6]^t[l-16]^t[l-28]^t[l-32])<<2|n>>>30,t[l]=n,n=(i<<5|i>>>27)+(s^o^a)+c+1859775393+n,c=a,a=o,o=(s<<30|s>>>2)>>>0,s=i,i=n;for(;l<60;++l)n=(n=t[l-6]^t[l-16]^t[l-28]^t[l-32])<<2|n>>>30,t[l]=n,n=(i<<5|i>>>27)+(s&o|a&(s^o))+c+2400959708+n,c=a,a=o,o=(s<<30|s>>>2)>>>0,s=i,i=n;for(;l<80;++l)n=(n=t[l-6]^t[l-16]^t[l-28]^t[l-32])<<2|n>>>30,t[l]=n,n=(i<<5|i>>>27)+(s^o^a)+c+3395469782+n,c=a,a=o,o=(s<<30|s>>>2)>>>0,s=i,i=n;e.h0=e.h0+i|0,e.h1=e.h1+s|0,e.h2=e.h2+o|0,e.h3=e.h3+a|0,e.h4=e.h4+c|0,u-=64}}},1571:(e,t,r)=>{var n=r(6547);r(9893),r(5061);var i=e.exports=n.sha256=n.sha256||{};n.md.sha256=n.md.algorithms.sha256=i,i.create=function(){o||(s=String.fromCharCode(128),s+=n.util.fillString(String.fromCharCode(0),64),a=[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],o=!0);var e=null,t=n.util.createBuffer(),r=new Array(64),i={algorithm:"sha256",blockLength:64,digestLength:32,messageLength:0,fullMessageLength:null,messageLengthSize:8,start:function(){i.messageLength=0,i.fullMessageLength=i.messageLength64=[];for(var r=i.messageLengthSize/4,s=0;s<r;++s)i.fullMessageLength.push(0);return t=n.util.createBuffer(),e={h0:1779033703,h1:3144134277,h2:1013904242,h3:2773480762,h4:1359893119,h5:2600822924,h6:528734635,h7:1541459225},i}};return i.start(),i.update=function(s,o){"utf8"===o&&(s=n.util.encodeUtf8(s));var a=s.length;i.messageLength+=a,a=[a/4294967296>>>0,a>>>0];for(var l=i.fullMessageLength.length-1;l>=0;--l)i.fullMessageLength[l]+=a[1],a[1]=a[0]+(i.fullMessageLength[l]/4294967296>>>0),i.fullMessageLength[l]=i.fullMessageLength[l]>>>0,a[0]=a[1]/4294967296>>>0;return t.putBytes(s),c(e,r,t),(t.read>2048||0===t.length())&&t.compact(),i},i.digest=function(){var o=n.util.createBuffer();o.putBytes(t.bytes());var a,l=i.fullMessageLength[i.fullMessageLength.length-1]+i.messageLengthSize&i.blockLength-1;o.putBytes(s.substr(0,i.blockLength-l));for(var u=8*i.fullMessageLength[0],h=0;h<i.fullMessageLength.length-1;++h)u+=(a=8*i.fullMessageLength[h+1])/4294967296>>>0,o.putInt32(u>>>0),u=a>>>0;o.putInt32(u);var d={h0:e.h0,h1:e.h1,h2:e.h2,h3:e.h3,h4:e.h4,h5:e.h5,h6:e.h6,h7:e.h7};c(d,r,o);var f=n.util.createBuffer();return f.putInt32(d.h0),f.putInt32(d.h1),f.putInt32(d.h2),f.putInt32(d.h3),f.putInt32(d.h4),f.putInt32(d.h5),f.putInt32(d.h6),f.putInt32(d.h7),f},i};var s=null,o=!1,a=null;function c(e,t,r){for(var n,i,s,o,c,l,u,h,d,f,p,y,g,m=r.length();m>=64;){for(c=0;c<16;++c)t[c]=r.getInt32();for(;c<64;++c)n=((n=t[c-2])>>>17|n<<15)^(n>>>19|n<<13)^n>>>10,i=((i=t[c-15])>>>7|i<<25)^(i>>>18|i<<14)^i>>>3,t[c]=n+t[c-7]+i+t[c-16]|0;for(l=e.h0,u=e.h1,h=e.h2,d=e.h3,f=e.h4,p=e.h5,y=e.h6,g=e.h7,c=0;c<64;++c)s=(l>>>2|l<<30)^(l>>>13|l<<19)^(l>>>22|l<<10),o=l&u|h&(l^u),n=g+((f>>>6|f<<26)^(f>>>11|f<<21)^(f>>>25|f<<7))+(y^f&(p^y))+a[c]+t[c],g=y,y=p,p=f,f=d+n>>>0,d=h,h=u,u=l,l=n+(i=s+o)>>>0;e.h0=e.h0+l|0,e.h1=e.h1+u|0,e.h2=e.h2+h|0,e.h3=e.h3+d|0,e.h4=e.h4+f|0,e.h5=e.h5+p|0,e.h6=e.h6+y|0,e.h7=e.h7+g|0,m-=64}}},8667:(e,t,r)=>{var n=r(6547);r(9893),r(5061);var i=e.exports=n.sha512=n.sha512||{};n.md.sha512=n.md.algorithms.sha512=i;var s=n.sha384=n.sha512.sha384=n.sha512.sha384||{};s.create=function(){return i.create("SHA-384")},n.md.sha384=n.md.algorithms.sha384=s,n.sha512.sha256=n.sha512.sha256||{create:function(){return i.create("SHA-512/256")}},n.md["sha512/256"]=n.md.algorithms["sha512/256"]=n.sha512.sha256,n.sha512.sha224=n.sha512.sha224||{create:function(){return i.create("SHA-512/224")}},n.md["sha512/224"]=n.md.algorithms["sha512/224"]=n.sha512.sha224,i.create=function(e){if(a||(o=String.fromCharCode(128),o+=n.util.fillString(String.fromCharCode(0),128),c=[[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]],(l={})["SHA-512"]=[[1779033703,4089235720],[3144134277,2227873595],[1013904242,4271175723],[2773480762,1595750129],[1359893119,2917565137],[2600822924,725511199],[528734635,4215389547],[1541459225,327033209]],l["SHA-384"]=[[3418070365,3238371032],[1654270250,914150663],[2438529370,812702999],[355462360,4144912697],[1731405415,4290775857],[2394180231,1750603025],[3675008525,1694076839],[1203062813,3204075428]],l["SHA-512/256"]=[[573645204,4230739756],[2673172387,3360449730],[596883563,1867755857],[2520282905,1497426621],[2519219938,2827943907],[3193839141,1401305490],[721525244,746961066],[246885852,2177182882]],l["SHA-512/224"]=[[2352822216,424955298],[1944164710,2312950998],[502970286,855612546],[1738396948,1479516111],[258812777,2077511080],[2011393907,79989058],[1067287976,1780299464],[286451373,2446758561]],a=!0),"undefined"===typeof e&&(e="SHA-512"),!(e in l))throw new Error("Invalid SHA-512 algorithm: "+e);for(var t=l[e],r=null,i=n.util.createBuffer(),s=new Array(80),h=0;h<80;++h)s[h]=new Array(2);var d=64;switch(e){case"SHA-384":d=48;break;case"SHA-512/256":d=32;break;case"SHA-512/224":d=28}var f={algorithm:e.replace("-","").toLowerCase(),blockLength:128,digestLength:d,messageLength:0,fullMessageLength:null,messageLengthSize:16,start:function(){f.messageLength=0,f.fullMessageLength=f.messageLength128=[];for(var e=f.messageLengthSize/4,s=0;s<e;++s)f.fullMessageLength.push(0);i=n.util.createBuffer(),r=new Array(t.length);for(s=0;s<t.length;++s)r[s]=t[s].slice(0);return f}};return f.start(),f.update=function(e,t){"utf8"===t&&(e=n.util.encodeUtf8(e));var o=e.length;f.messageLength+=o,o=[o/4294967296>>>0,o>>>0];for(var a=f.fullMessageLength.length-1;a>=0;--a)f.fullMessageLength[a]+=o[1],o[1]=o[0]+(f.fullMessageLength[a]/4294967296>>>0),f.fullMessageLength[a]=f.fullMessageLength[a]>>>0,o[0]=o[1]/4294967296>>>0;return i.putBytes(e),u(r,s,i),(i.read>2048||0===i.length())&&i.compact(),f},f.digest=function(){var t=n.util.createBuffer();t.putBytes(i.bytes());var a,c=f.fullMessageLength[f.fullMessageLength.length-1]+f.messageLengthSize&f.blockLength-1;t.putBytes(o.substr(0,f.blockLength-c));for(var l=8*f.fullMessageLength[0],h=0;h<f.fullMessageLength.length-1;++h)l+=(a=8*f.fullMessageLength[h+1])/4294967296>>>0,t.putInt32(l>>>0),l=a>>>0;t.putInt32(l);var d=new Array(r.length);for(h=0;h<r.length;++h)d[h]=r[h].slice(0);u(d,s,t);var p,y=n.util.createBuffer();p="SHA-512"===e?d.length:"SHA-384"===e?d.length-2:d.length-4;for(h=0;h<p;++h)y.putInt32(d[h][0]),h===p-1&&"SHA-512/224"===e||y.putInt32(d[h][1]);return y},f};var o=null,a=!1,c=null,l=null;function u(e,t,r){for(var n,i,s,o,a,l,u,h,d,f,p,y,g,m,v,b,w,E,_,S,I,C,A,T,k,R,P,D,N,x,L,O,B,M=r.length();M>=128;){for(P=0;P<16;++P)t[P][0]=r.getInt32()>>>0,t[P][1]=r.getInt32()>>>0;for(;P<80;++P)n=(((D=(x=t[P-2])[0])>>>19|(N=x[1])<<13)^(N>>>29|D<<3)^D>>>6)>>>0,i=((D<<13|N>>>19)^(N<<3|D>>>29)^(D<<26|N>>>6))>>>0,s=(((D=(O=t[P-15])[0])>>>1|(N=O[1])<<31)^(D>>>8|N<<24)^D>>>7)>>>0,o=((D<<31|N>>>1)^(D<<24|N>>>8)^(D<<25|N>>>7))>>>0,L=t[P-7],B=t[P-16],N=i+L[1]+o+B[1],t[P][0]=n+L[0]+s+B[0]+(N/4294967296>>>0)>>>0,t[P][1]=N>>>0;for(p=e[0][0],y=e[0][1],g=e[1][0],m=e[1][1],v=e[2][0],b=e[2][1],w=e[3][0],E=e[3][1],_=e[4][0],S=e[4][1],I=e[5][0],C=e[5][1],A=e[6][0],T=e[6][1],k=e[7][0],R=e[7][1],P=0;P<80;++P)u=((_>>>14|S<<18)^(_>>>18|S<<14)^(S>>>9|_<<23))>>>0,h=(A^_&(I^A))>>>0,a=((p>>>28|y<<4)^(y>>>2|p<<30)^(y>>>7|p<<25))>>>0,l=((p<<4|y>>>28)^(y<<30|p>>>2)^(y<<25|p>>>7))>>>0,d=(p&g|v&(p^g))>>>0,f=(y&m|b&(y^m))>>>0,N=R+(((_<<18|S>>>14)^(_<<14|S>>>18)^(S<<23|_>>>9))>>>0)+((T^S&(C^T))>>>0)+c[P][1]+t[P][1],n=k+u+h+c[P][0]+t[P][0]+(N/4294967296>>>0)>>>0,i=N>>>0,s=a+d+((N=l+f)/4294967296>>>0)>>>0,o=N>>>0,k=A,R=T,A=I,T=C,I=_,C=S,_=w+n+((N=E+i)/4294967296>>>0)>>>0,S=N>>>0,w=v,E=b,v=g,b=m,g=p,m=y,p=n+s+((N=i+o)/4294967296>>>0)>>>0,y=N>>>0;N=e[0][1]+y,e[0][0]=e[0][0]+p+(N/4294967296>>>0)>>>0,e[0][1]=N>>>0,N=e[1][1]+m,e[1][0]=e[1][0]+g+(N/4294967296>>>0)>>>0,e[1][1]=N>>>0,N=e[2][1]+b,e[2][0]=e[2][0]+v+(N/4294967296>>>0)>>>0,e[2][1]=N>>>0,N=e[3][1]+E,e[3][0]=e[3][0]+w+(N/4294967296>>>0)>>>0,e[3][1]=N>>>0,N=e[4][1]+S,e[4][0]=e[4][0]+_+(N/4294967296>>>0)>>>0,e[4][1]=N>>>0,N=e[5][1]+C,e[5][0]=e[5][0]+I+(N/4294967296>>>0)>>>0,e[5][1]=N>>>0,N=e[6][1]+T,e[6][0]=e[6][0]+A+(N/4294967296>>>0)>>>0,e[6][1]=N>>>0,N=e[7][1]+R,e[7][0]=e[7][0]+k+(N/4294967296>>>0)>>>0,e[7][1]=N>>>0,M-=128}}},5061:(e,t,r)=>{var n=r(6547),i=r(4626),s=e.exports=n.util=n.util||{};function o(e){if(8!==e&&16!==e&&24!==e&&32!==e)throw new Error("Only 8, 16, 24, or 32 bits supported: "+e)}function a(e){if(this.data="",this.read=0,"string"===typeof e)this.data=e;else if(s.isArrayBuffer(e)||s.isArrayBufferView(e))if("undefined"!==typeof Buffer&&e instanceof Buffer)this.data=e.toString("binary");else{var t=new Uint8Array(e);try{this.data=String.fromCharCode.apply(null,t)}catch(n){for(var r=0;r<t.length;++r)this.putByte(t[r])}}else(e instanceof a||"object"===typeof e&&"string"===typeof e.data&&"number"===typeof e.read)&&(this.data=e.data,this.read=e.read);this._constructedStringLength=0}!function(){if("undefined"!==typeof process&&process.nextTick&&!process.browser)return s.nextTick=process.nextTick,void("function"===typeof setImmediate?s.setImmediate=setImmediate:s.setImmediate=s.nextTick);if("function"===typeof setImmediate)return s.setImmediate=function(){return setImmediate.apply(void 0,arguments)},void(s.nextTick=function(e){return setImmediate(e)});if(s.setImmediate=function(e){setTimeout(e,0)},"undefined"!==typeof window&&"function"===typeof window.postMessage){var e="forge.setImmediate",t=[];s.setImmediate=function(r){t.push(r),1===t.length&&window.postMessage(e,"*")},window.addEventListener("message",(function(r){if(r.source===window&&r.data===e){r.stopPropagation();var n=t.slice();t.length=0,n.forEach((function(e){e()}))}}),!0)}if("undefined"!==typeof MutationObserver){var r=Date.now(),n=!0,i=document.createElement("div");t=[];new MutationObserver((function(){var e=t.slice();t.length=0,e.forEach((function(e){e()}))})).observe(i,{attributes:!0});var o=s.setImmediate;s.setImmediate=function(e){Date.now()-r>15?(r=Date.now(),o(e)):(t.push(e),1===t.length&&i.setAttribute("a",n=!n))}}s.nextTick=s.setImmediate}(),s.isNodejs="undefined"!==typeof process&&process.versions&&process.versions.node,s.globalScope=s.isNodejs?r.g:"undefined"===typeof self?window:self,s.isArray=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)},s.isArrayBuffer=function(e){return"undefined"!==typeof ArrayBuffer&&e instanceof ArrayBuffer},s.isArrayBufferView=function(e){return e&&s.isArrayBuffer(e.buffer)&&void 0!==e.byteLength},s.ByteBuffer=a,s.ByteStringBuffer=a;s.ByteStringBuffer.prototype._optimizeConstructedString=function(e){this._constructedStringLength+=e,this._constructedStringLength>4096&&(this.data.substr(0,1),this._constructedStringLength=0)},s.ByteStringBuffer.prototype.length=function(){return this.data.length-this.read},s.ByteStringBuffer.prototype.isEmpty=function(){return this.length()<=0},s.ByteStringBuffer.prototype.putByte=function(e){return this.putBytes(String.fromCharCode(e))},s.ByteStringBuffer.prototype.fillWithByte=function(e,t){e=String.fromCharCode(e);for(var r=this.data;t>0;)1&t&&(r+=e),(t>>>=1)>0&&(e+=e);return this.data=r,this._optimizeConstructedString(t),this},s.ByteStringBuffer.prototype.putBytes=function(e){return this.data+=e,this._optimizeConstructedString(e.length),this},s.ByteStringBuffer.prototype.putString=function(e){return this.putBytes(s.encodeUtf8(e))},s.ByteStringBuffer.prototype.putInt16=function(e){return this.putBytes(String.fromCharCode(e>>8&255)+String.fromCharCode(255&e))},s.ByteStringBuffer.prototype.putInt24=function(e){return this.putBytes(String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(255&e))},s.ByteStringBuffer.prototype.putInt32=function(e){return this.putBytes(String.fromCharCode(e>>24&255)+String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(255&e))},s.ByteStringBuffer.prototype.putInt16Le=function(e){return this.putBytes(String.fromCharCode(255&e)+String.fromCharCode(e>>8&255))},s.ByteStringBuffer.prototype.putInt24Le=function(e){return this.putBytes(String.fromCharCode(255&e)+String.fromCharCode(e>>8&255)+String.fromCharCode(e>>16&255))},s.ByteStringBuffer.prototype.putInt32Le=function(e){return this.putBytes(String.fromCharCode(255&e)+String.fromCharCode(e>>8&255)+String.fromCharCode(e>>16&255)+String.fromCharCode(e>>24&255))},s.ByteStringBuffer.prototype.putInt=function(e,t){o(t);var r="";do{t-=8,r+=String.fromCharCode(e>>t&255)}while(t>0);return this.putBytes(r)},s.ByteStringBuffer.prototype.putSignedInt=function(e,t){return e<0&&(e+=2<<t-1),this.putInt(e,t)},s.ByteStringBuffer.prototype.putBuffer=function(e){return this.putBytes(e.getBytes())},s.ByteStringBuffer.prototype.getByte=function(){return this.data.charCodeAt(this.read++)},s.ByteStringBuffer.prototype.getInt16=function(){var e=this.data.charCodeAt(this.read)<<8^this.data.charCodeAt(this.read+1);return this.read+=2,e},s.ByteStringBuffer.prototype.getInt24=function(){var e=this.data.charCodeAt(this.read)<<16^this.data.charCodeAt(this.read+1)<<8^this.data.charCodeAt(this.read+2);return this.read+=3,e},s.ByteStringBuffer.prototype.getInt32=function(){var e=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,e},s.ByteStringBuffer.prototype.getInt16Le=function(){var e=this.data.charCodeAt(this.read)^this.data.charCodeAt(this.read+1)<<8;return this.read+=2,e},s.ByteStringBuffer.prototype.getInt24Le=function(){var e=this.data.charCodeAt(this.read)^this.data.charCodeAt(this.read+1)<<8^this.data.charCodeAt(this.read+2)<<16;return this.read+=3,e},s.ByteStringBuffer.prototype.getInt32Le=function(){var e=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,e},s.ByteStringBuffer.prototype.getInt=function(e){o(e);var t=0;do{t=(t<<8)+this.data.charCodeAt(this.read++),e-=8}while(e>0);return t},s.ByteStringBuffer.prototype.getSignedInt=function(e){var t=this.getInt(e),r=2<<e-2;return t>=r&&(t-=r<<1),t},s.ByteStringBuffer.prototype.getBytes=function(e){var t;return e?(e=Math.min(this.length(),e),t=this.data.slice(this.read,this.read+e),this.read+=e):0===e?t="":(t=0===this.read?this.data:this.data.slice(this.read),this.clear()),t},s.ByteStringBuffer.prototype.bytes=function(e){return"undefined"===typeof e?this.data.slice(this.read):this.data.slice(this.read,this.read+e)},s.ByteStringBuffer.prototype.at=function(e){return this.data.charCodeAt(this.read+e)},s.ByteStringBuffer.prototype.setAt=function(e,t){return this.data=this.data.substr(0,this.read+e)+String.fromCharCode(t)+this.data.substr(this.read+e+1),this},s.ByteStringBuffer.prototype.last=function(){return this.data.charCodeAt(this.data.length-1)},s.ByteStringBuffer.prototype.copy=function(){var e=s.createBuffer(this.data);return e.read=this.read,e},s.ByteStringBuffer.prototype.compact=function(){return this.read>0&&(this.data=this.data.slice(this.read),this.read=0),this},s.ByteStringBuffer.prototype.clear=function(){return this.data="",this.read=0,this},s.ByteStringBuffer.prototype.truncate=function(e){var t=Math.max(0,this.length()-e);return this.data=this.data.substr(this.read,t),this.read=0,this},s.ByteStringBuffer.prototype.toHex=function(){for(var e="",t=this.read;t<this.data.length;++t){var r=this.data.charCodeAt(t);r<16&&(e+="0"),e+=r.toString(16)}return e},s.ByteStringBuffer.prototype.toString=function(){return s.decodeUtf8(this.bytes())},s.DataBuffer=function(e,t){t=t||{},this.read=t.readOffset||0,this.growSize=t.growSize||1024;var r=s.isArrayBuffer(e),n=s.isArrayBufferView(e);if(r||n)return this.data=r?new DataView(e):new DataView(e.buffer,e.byteOffset,e.byteLength),void(this.write="writeOffset"in t?t.writeOffset:this.data.byteLength);this.data=new DataView(new ArrayBuffer(0)),this.write=0,null!==e&&void 0!==e&&this.putBytes(e),"writeOffset"in t&&(this.write=t.writeOffset)},s.DataBuffer.prototype.length=function(){return this.write-this.read},s.DataBuffer.prototype.isEmpty=function(){return this.length()<=0},s.DataBuffer.prototype.accommodate=function(e,t){if(this.length()>=e)return this;t=Math.max(t||this.growSize,e);var r=new Uint8Array(this.data.buffer,this.data.byteOffset,this.data.byteLength),n=new Uint8Array(this.length()+t);return n.set(r),this.data=new DataView(n.buffer),this},s.DataBuffer.prototype.putByte=function(e){return this.accommodate(1),this.data.setUint8(this.write++,e),this},s.DataBuffer.prototype.fillWithByte=function(e,t){this.accommodate(t);for(var r=0;r<t;++r)this.data.setUint8(e);return this},s.DataBuffer.prototype.putBytes=function(e,t){if(s.isArrayBufferView(e)){var r=(n=new Uint8Array(e.buffer,e.byteOffset,e.byteLength)).byteLength-n.byteOffset;return this.accommodate(r),new Uint8Array(this.data.buffer,this.write).set(n),this.write+=r,this}if(s.isArrayBuffer(e)){var n=new Uint8Array(e);return this.accommodate(n.byteLength),new Uint8Array(this.data.buffer).set(n,this.write),this.write+=n.byteLength,this}if(e instanceof s.DataBuffer||"object"===typeof e&&"number"===typeof e.read&&"number"===typeof e.write&&s.isArrayBufferView(e.data)){n=new Uint8Array(e.data.byteLength,e.read,e.length());return this.accommodate(n.byteLength),new Uint8Array(e.data.byteLength,this.write).set(n),this.write+=n.byteLength,this}if(e instanceof s.ByteStringBuffer&&(e=e.data,t="binary"),t=t||"binary","string"===typeof e){var i;if("hex"===t)return this.accommodate(Math.ceil(e.length/2)),i=new Uint8Array(this.data.buffer,this.write),this.write+=s.binary.hex.decode(e,i,this.write),this;if("base64"===t)return this.accommodate(3*Math.ceil(e.length/4)),i=new Uint8Array(this.data.buffer,this.write),this.write+=s.binary.base64.decode(e,i,this.write),this;if("utf8"===t&&(e=s.encodeUtf8(e),t="binary"),"binary"===t||"raw"===t)return this.accommodate(e.length),i=new Uint8Array(this.data.buffer,this.write),this.write+=s.binary.raw.decode(i),this;if("utf16"===t)return this.accommodate(2*e.length),i=new Uint16Array(this.data.buffer,this.write),this.write+=s.text.utf16.encode(i),this;throw new Error("Invalid encoding: "+t)}throw Error("Invalid parameter: "+e)},s.DataBuffer.prototype.putBuffer=function(e){return this.putBytes(e),e.clear(),this},s.DataBuffer.prototype.putString=function(e){return this.putBytes(e,"utf16")},s.DataBuffer.prototype.putInt16=function(e){return this.accommodate(2),this.data.setInt16(this.write,e),this.write+=2,this},s.DataBuffer.prototype.putInt24=function(e){return this.accommodate(3),this.data.setInt16(this.write,e>>8&65535),this.data.setInt8(this.write,e>>16&255),this.write+=3,this},s.DataBuffer.prototype.putInt32=function(e){return this.accommodate(4),this.data.setInt32(this.write,e),this.write+=4,this},s.DataBuffer.prototype.putInt16Le=function(e){return this.accommodate(2),this.data.setInt16(this.write,e,!0),this.write+=2,this},s.DataBuffer.prototype.putInt24Le=function(e){return this.accommodate(3),this.data.setInt8(this.write,e>>16&255),this.data.setInt16(this.write,e>>8&65535,!0),this.write+=3,this},s.DataBuffer.prototype.putInt32Le=function(e){return this.accommodate(4),this.data.setInt32(this.write,e,!0),this.write+=4,this},s.DataBuffer.prototype.putInt=function(e,t){o(t),this.accommodate(t/8);do{t-=8,this.data.setInt8(this.write++,e>>t&255)}while(t>0);return this},s.DataBuffer.prototype.putSignedInt=function(e,t){return o(t),this.accommodate(t/8),e<0&&(e+=2<<t-1),this.putInt(e,t)},s.DataBuffer.prototype.getByte=function(){return this.data.getInt8(this.read++)},s.DataBuffer.prototype.getInt16=function(){var e=this.data.getInt16(this.read);return this.read+=2,e},s.DataBuffer.prototype.getInt24=function(){var e=this.data.getInt16(this.read)<<8^this.data.getInt8(this.read+2);return this.read+=3,e},s.DataBuffer.prototype.getInt32=function(){var e=this.data.getInt32(this.read);return this.read+=4,e},s.DataBuffer.prototype.getInt16Le=function(){var e=this.data.getInt16(this.read,!0);return this.read+=2,e},s.DataBuffer.prototype.getInt24Le=function(){var e=this.data.getInt8(this.read)^this.data.getInt16(this.read+1,!0)<<8;return this.read+=3,e},s.DataBuffer.prototype.getInt32Le=function(){var e=this.data.getInt32(this.read,!0);return this.read+=4,e},s.DataBuffer.prototype.getInt=function(e){o(e);var t=0;do{t=(t<<8)+this.data.getInt8(this.read++),e-=8}while(e>0);return t},s.DataBuffer.prototype.getSignedInt=function(e){var t=this.getInt(e),r=2<<e-2;return t>=r&&(t-=r<<1),t},s.DataBuffer.prototype.getBytes=function(e){var t;return e?(e=Math.min(this.length(),e),t=this.data.slice(this.read,this.read+e),this.read+=e):0===e?t="":(t=0===this.read?this.data:this.data.slice(this.read),this.clear()),t},s.DataBuffer.prototype.bytes=function(e){return"undefined"===typeof e?this.data.slice(this.read):this.data.slice(this.read,this.read+e)},s.DataBuffer.prototype.at=function(e){return this.data.getUint8(this.read+e)},s.DataBuffer.prototype.setAt=function(e,t){return this.data.setUint8(e,t),this},s.DataBuffer.prototype.last=function(){return this.data.getUint8(this.write-1)},s.DataBuffer.prototype.copy=function(){return new s.DataBuffer(this)},s.DataBuffer.prototype.compact=function(){if(this.read>0){var e=new Uint8Array(this.data.buffer,this.read),t=new Uint8Array(e.byteLength);t.set(e),this.data=new DataView(t),this.write-=this.read,this.read=0}return this},s.DataBuffer.prototype.clear=function(){return this.data=new DataView(new ArrayBuffer(0)),this.read=this.write=0,this},s.DataBuffer.prototype.truncate=function(e){return this.write=Math.max(0,this.length()-e),this.read=Math.min(this.read,this.write),this},s.DataBuffer.prototype.toHex=function(){for(var e="",t=this.read;t<this.data.byteLength;++t){var r=this.data.getUint8(t);r<16&&(e+="0"),e+=r.toString(16)}return e},s.DataBuffer.prototype.toString=function(e){var t=new Uint8Array(this.data,this.read,this.length());if("binary"===(e=e||"utf8")||"raw"===e)return s.binary.raw.encode(t);if("hex"===e)return s.binary.hex.encode(t);if("base64"===e)return s.binary.base64.encode(t);if("utf8"===e)return s.text.utf8.decode(t);if("utf16"===e)return s.text.utf16.decode(t);throw new Error("Invalid encoding: "+e)},s.createBuffer=function(e,t){return t=t||"raw",void 0!==e&&"utf8"===t&&(e=s.encodeUtf8(e)),new s.ByteBuffer(e)},s.fillString=function(e,t){for(var r="";t>0;)1&t&&(r+=e),(t>>>=1)>0&&(e+=e);return r},s.xorBytes=function(e,t,r){for(var n="",i="",s="",o=0,a=0;r>0;--r,++o)i=e.charCodeAt(o)^t.charCodeAt(o),a>=10&&(n+=s,s="",a=0),s+=String.fromCharCode(i),++a;return n+=s},s.hexToBytes=function(e){var t="",r=0;for(!0&e.length&&(r=1,t+=String.fromCharCode(parseInt(e[0],16)));r<e.length;r+=2)t+=String.fromCharCode(parseInt(e.substr(r,2),16));return t},s.bytesToHex=function(e){return s.createBuffer(e).toHex()},s.int32ToBytes=function(e){return String.fromCharCode(e>>24&255)+String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(255&e)};var c="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",l=[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],u="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";s.encode64=function(e,t){for(var r,n,i,s="",o="",a=0;a<e.length;)r=e.charCodeAt(a++),n=e.charCodeAt(a++),i=e.charCodeAt(a++),s+=c.charAt(r>>2),s+=c.charAt((3&r)<<4|n>>4),isNaN(n)?s+="==":(s+=c.charAt((15&n)<<2|i>>6),s+=isNaN(i)?"=":c.charAt(63&i)),t&&s.length>t&&(o+=s.substr(0,t)+"\r\n",s=s.substr(t));return o+=s},s.decode64=function(e){e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");for(var t,r,n,i,s="",o=0;o<e.length;)t=l[e.charCodeAt(o++)-43],r=l[e.charCodeAt(o++)-43],n=l[e.charCodeAt(o++)-43],i=l[e.charCodeAt(o++)-43],s+=String.fromCharCode(t<<2|r>>4),64!==n&&(s+=String.fromCharCode((15&r)<<4|n>>2),64!==i&&(s+=String.fromCharCode((3&n)<<6|i)));return s},s.encodeUtf8=function(e){return unescape(encodeURIComponent(e))},s.decodeUtf8=function(e){return decodeURIComponent(escape(e))},s.binary={raw:{},hex:{},base64:{},base58:{},baseN:{encode:i.encode,decode:i.decode}},s.binary.raw.encode=function(e){return String.fromCharCode.apply(null,e)},s.binary.raw.decode=function(e,t,r){var n=t;n||(n=new Uint8Array(e.length));for(var i=r=r||0,s=0;s<e.length;++s)n[i++]=e.charCodeAt(s);return t?i-r:n},s.binary.hex.encode=s.bytesToHex,s.binary.hex.decode=function(e,t,r){var n=t;n||(n=new Uint8Array(Math.ceil(e.length/2)));var i=0,s=r=r||0;for(1&e.length&&(i=1,n[s++]=parseInt(e[0],16));i<e.length;i+=2)n[s++]=parseInt(e.substr(i,2),16);return t?s-r:n},s.binary.base64.encode=function(e,t){for(var r,n,i,s="",o="",a=0;a<e.byteLength;)r=e[a++],n=e[a++],i=e[a++],s+=c.charAt(r>>2),s+=c.charAt((3&r)<<4|n>>4),isNaN(n)?s+="==":(s+=c.charAt((15&n)<<2|i>>6),s+=isNaN(i)?"=":c.charAt(63&i)),t&&s.length>t&&(o+=s.substr(0,t)+"\r\n",s=s.substr(t));return o+=s},s.binary.base64.decode=function(e,t,r){var n,i,s,o,a=t;a||(a=new Uint8Array(3*Math.ceil(e.length/4))),e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");for(var c=0,u=r=r||0;c<e.length;)n=l[e.charCodeAt(c++)-43],i=l[e.charCodeAt(c++)-43],s=l[e.charCodeAt(c++)-43],o=l[e.charCodeAt(c++)-43],a[u++]=n<<2|i>>4,64!==s&&(a[u++]=(15&i)<<4|s>>2,64!==o&&(a[u++]=(3&s)<<6|o));return t?u-r:a.subarray(0,u)},s.binary.base58.encode=function(e,t){return s.binary.baseN.encode(e,u,t)},s.binary.base58.decode=function(e,t){return s.binary.baseN.decode(e,u,t)},s.text={utf8:{},utf16:{}},s.text.utf8.encode=function(e,t,r){e=s.encodeUtf8(e);var n=t;n||(n=new Uint8Array(e.length));for(var i=r=r||0,o=0;o<e.length;++o)n[i++]=e.charCodeAt(o);return t?i-r:n},s.text.utf8.decode=function(e){return s.decodeUtf8(String.fromCharCode.apply(null,e))},s.text.utf16.encode=function(e,t,r){var n=t;n||(n=new Uint8Array(2*e.length));for(var i=new Uint16Array(n.buffer),s=r=r||0,o=r,a=0;a<e.length;++a)i[o++]=e.charCodeAt(a),s+=2;return t?s-r:n},s.text.utf16.decode=function(e){return String.fromCharCode.apply(null,new Uint16Array(e.buffer))},s.deflate=function(e,t,r){if(t=s.decode64(e.deflate(s.encode64(t)).rval),r){var n=2;32&t.charCodeAt(1)&&(n=6),t=t.substring(n,t.length-4)}return t},s.inflate=function(e,t,r){var n=e.inflate(s.encode64(t)).rval;return null===n?null:s.decode64(n)};var h=function(e,t,r){if(!e)throw new Error("WebStorage not available.");var n;if(null===r?n=e.removeItem(t):(r=s.encode64(JSON.stringify(r)),n=e.setItem(t,r)),"undefined"!==typeof n&&!0!==n.rval){var i=new Error(n.error.message);throw i.id=n.error.id,i.name=n.error.name,i}},d=function(e,t){if(!e)throw new Error("WebStorage not available.");var r=e.getItem(t);if(e.init)if(null===r.rval){if(r.error){var n=new Error(r.error.message);throw n.id=r.error.id,n.name=r.error.name,n}r=null}else r=r.rval;return null!==r&&(r=JSON.parse(s.decode64(r))),r},f=function(e,t,r,n){var i=d(e,t);null===i&&(i={}),i[r]=n,h(e,t,i)},p=function(e,t,r){var n=d(e,t);return null!==n&&(n=r in n?n[r]:null),n},y=function(e,t,r){var n=d(e,t);if(null!==n&&r in n){delete n[r];var i=!0;for(var s in n){i=!1;break}i&&(n=null),h(e,t,n)}},g=function(e,t){h(e,t,null)},m=function(e,t,r){var n,i=null;"undefined"===typeof r&&(r=["web","flash"]);var s=!1,o=null;for(var a in r){n=r[a];try{if("flash"===n||"both"===n){if(null===t[0])throw new Error("Flash local storage not available.");i=e.apply(this,t),s="flash"===n}"web"!==n&&"both"!==n||(t[0]=localStorage,i=e.apply(this,t),s=!0)}catch(c){o=c}if(s)break}if(!s)throw o;return i};s.setItem=function(e,t,r,n,i){m(f,arguments,i)},s.getItem=function(e,t,r,n){return m(p,arguments,n)},s.removeItem=function(e,t,r,n){m(y,arguments,n)},s.clearItems=function(e,t,r){m(g,arguments,r)},s.isEmpty=function(e){for(var t in e)if(e.hasOwnProperty(t))return!1;return!0},s.format=function(e){for(var t,r,n=/%./g,i=0,s=[],o=0;t=n.exec(e);){(r=e.substring(o,n.lastIndex-2)).length>0&&s.push(r),o=n.lastIndex;var a=t[0][1];switch(a){case"s":case"o":i<arguments.length?s.push(arguments[1+i++]):s.push("<?>");break;case"%":s.push("%");break;default:s.push("<%"+a+"?>")}}return s.push(e.substring(o)),s.join("")},s.formatNumber=function(e,t,r,n){var i=e,s=isNaN(t=Math.abs(t))?2:t,o=void 0===r?",":r,a=void 0===n?".":n,c=i<0?"-":"",l=parseInt(i=Math.abs(+i||0).toFixed(s),10)+"",u=l.length>3?l.length%3:0;return c+(u?l.substr(0,u)+a:"")+l.substr(u).replace(/(\d{3})(?=\d)/g,"$1"+a)+(s?o+Math.abs(i-l).toFixed(s).slice(2):"")},s.formatSize=function(e){return e=e>=1073741824?s.formatNumber(e/1073741824,2,".","")+" GiB":e>=1048576?s.formatNumber(e/1048576,2,".","")+" MiB":e>=1024?s.formatNumber(e/1024,0)+" KiB":s.formatNumber(e,0)+" bytes"},s.bytesFromIP=function(e){return-1!==e.indexOf(".")?s.bytesFromIPv4(e):-1!==e.indexOf(":")?s.bytesFromIPv6(e):null},s.bytesFromIPv4=function(e){if(4!==(e=e.split(".")).length)return null;for(var t=s.createBuffer(),r=0;r<e.length;++r){var n=parseInt(e[r],10);if(isNaN(n))return null;t.putByte(n)}return t.getBytes()},s.bytesFromIPv6=function(e){for(var t=0,r=2*(8-(e=e.split(":").filter((function(e){return 0===e.length&&++t,!0}))).length+t),n=s.createBuffer(),i=0;i<8;++i)if(e[i]&&0!==e[i].length){var o=s.hexToBytes(e[i]);o.length<2&&n.putByte(0),n.putBytes(o)}else n.fillWithByte(0,r),r=0;return n.getBytes()},s.bytesToIP=function(e){return 4===e.length?s.bytesToIPv4(e):16===e.length?s.bytesToIPv6(e):null},s.bytesToIPv4=function(e){if(4!==e.length)return null;for(var t=[],r=0;r<e.length;++r)t.push(e.charCodeAt(r));return t.join(".")},s.bytesToIPv6=function(e){if(16!==e.length)return null;for(var t=[],r=[],n=0,i=0;i<e.length;i+=2){for(var o=s.bytesToHex(e[i]+e[i+1]);"0"===o[0]&&"0"!==o;)o=o.substr(1);if("0"===o){var a=r[r.length-1],c=t.length;a&&c===a.end+1?(a.end=c,a.end-a.start>r[n].end-r[n].start&&(n=r.length-1)):r.push({start:c,end:c})}t.push(o)}if(r.length>0){var l=r[n];l.end-l.start>0&&(t.splice(l.start,l.end-l.start+1,""),0===l.start&&t.unshift(""),7===l.end&&t.push(""))}return t.join(":")},s.estimateCores=function(e,t){if("function"===typeof e&&(t=e,e={}),e=e||{},"cores"in s&&!e.update)return t(null,s.cores);if("undefined"!==typeof navigator&&"hardwareConcurrency"in navigator&&navigator.hardwareConcurrency>0)return s.cores=navigator.hardwareConcurrency,t(null,s.cores);if("undefined"===typeof Worker)return s.cores=1,t(null,s.cores);if("undefined"===typeof Blob)return s.cores=2,t(null,s.cores);var r=URL.createObjectURL(new Blob(["(",function(){self.addEventListener("message",(function(e){for(var t=Date.now(),r=t+4;Date.now()<r;);self.postMessage({st:t,et:r})}))}.toString(),")()"],{type:"application/javascript"}));!function e(n,i,o){if(0===i){var a=Math.floor(n.reduce((function(e,t){return e+t}),0)/n.length);return s.cores=Math.max(1,a),URL.revokeObjectURL(r),t(null,s.cores)}!function(e,t){for(var n=[],i=[],s=0;s<e;++s){var o=new Worker(r);o.addEventListener("message",(function(r){if(i.push(r.data),i.length===e){for(var s=0;s<e;++s)n[s].terminate();t(null,i)}})),n.push(o)}for(s=0;s<e;++s)n[s].postMessage(s)}(o,(function(t,r){n.push(function(e,t){for(var r=[],n=0;n<e;++n)for(var i=t[n],s=r[n]=[],o=0;o<e;++o)if(n!==o){var a=t[o];(i.st>a.st&&i.st<a.et||a.st>i.st&&a.st<i.et)&&s.push(o)}return r.reduce((function(e,t){return Math.max(e,t.length)}),0)}(o,r)),e(n,i-1,o)}))}([],5,16)}},4577:(e,t,r)=>{var n=r(6547);r(5645),r(8791),r(3280),r(9893),r(6935),r(8217),r(1244),r(8504),r(8690),r(5061);var i=n.asn1,s=e.exports=n.pki=n.pki||{},o=s.oids,a={};a.CN=o.commonName,a.commonName="CN",a.C=o.countryName,a.countryName="C",a.L=o.localityName,a.localityName="L",a.ST=o.stateOrProvinceName,a.stateOrProvinceName="ST",a.O=o.organizationName,a.organizationName="O",a.OU=o.organizationalUnitName,a.organizationalUnitName="OU",a.E=o.emailAddress,a.emailAddress="E";var c=n.pki.rsa.publicKeyValidator,l={name:"Certificate",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,captureAsn1:"tbsCertificate",value:[{name:"Certificate.TBSCertificate.version",tagClass:i.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.version.integer",tagClass:i.Class.UNIVERSAL,type:i.Type.INTEGER,constructed:!1,capture:"certVersion"}]},{name:"Certificate.TBSCertificate.serialNumber",tagClass:i.Class.UNIVERSAL,type:i.Type.INTEGER,constructed:!1,capture:"certSerialNumber"},{name:"Certificate.TBSCertificate.signature",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate.signature.algorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"certinfoSignatureOid"},{name:"Certificate.TBSCertificate.signature.parameters",tagClass:i.Class.UNIVERSAL,optional:!0,captureAsn1:"certinfoSignatureParams"}]},{name:"Certificate.TBSCertificate.issuer",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,captureAsn1:"certIssuer"},{name:"Certificate.TBSCertificate.validity",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate.validity.notBefore (utc)",tagClass:i.Class.UNIVERSAL,type:i.Type.UTCTIME,constructed:!1,optional:!0,capture:"certValidity1UTCTime"},{name:"Certificate.TBSCertificate.validity.notBefore (generalized)",tagClass:i.Class.UNIVERSAL,type:i.Type.GENERALIZEDTIME,constructed:!1,optional:!0,capture:"certValidity2GeneralizedTime"},{name:"Certificate.TBSCertificate.validity.notAfter (utc)",tagClass:i.Class.UNIVERSAL,type:i.Type.UTCTIME,constructed:!1,optional:!0,capture:"certValidity3UTCTime"},{name:"Certificate.TBSCertificate.validity.notAfter (generalized)",tagClass:i.Class.UNIVERSAL,type:i.Type.GENERALIZEDTIME,constructed:!1,optional:!0,capture:"certValidity4GeneralizedTime"}]},{name:"Certificate.TBSCertificate.subject",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,captureAsn1:"certSubject"},c,{name:"Certificate.TBSCertificate.issuerUniqueID",tagClass:i.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.issuerUniqueID.id",tagClass:i.Class.UNIVERSAL,type:i.Type.BITSTRING,constructed:!1,captureBitStringValue:"certIssuerUniqueId"}]},{name:"Certificate.TBSCertificate.subjectUniqueID",tagClass:i.Class.CONTEXT_SPECIFIC,type:2,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.subjectUniqueID.id",tagClass:i.Class.UNIVERSAL,type:i.Type.BITSTRING,constructed:!1,captureBitStringValue:"certSubjectUniqueId"}]},{name:"Certificate.TBSCertificate.extensions",tagClass:i.Class.CONTEXT_SPECIFIC,type:3,constructed:!0,captureAsn1:"certExtensions",optional:!0}]},{name:"Certificate.signatureAlgorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.signatureAlgorithm.algorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"certSignatureOid"},{name:"Certificate.TBSCertificate.signature.parameters",tagClass:i.Class.UNIVERSAL,optional:!0,captureAsn1:"certSignatureParams"}]},{name:"Certificate.signatureValue",tagClass:i.Class.UNIVERSAL,type:i.Type.BITSTRING,constructed:!1,captureBitStringValue:"certSignature"}]},u={name:"rsapss",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"rsapss.hashAlgorithm",tagClass:i.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,value:[{name:"rsapss.hashAlgorithm.AlgorithmIdentifier",tagClass:i.Class.UNIVERSAL,type:i.Class.SEQUENCE,constructed:!0,optional:!0,value:[{name:"rsapss.hashAlgorithm.AlgorithmIdentifier.algorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"hashOid"}]}]},{name:"rsapss.maskGenAlgorithm",tagClass:i.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier",tagClass:i.Class.UNIVERSAL,type:i.Class.SEQUENCE,constructed:!0,optional:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.algorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"maskGenOid"},{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.params",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.params.algorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"maskGenHashOid"}]}]}]},{name:"rsapss.saltLength",tagClass:i.Class.CONTEXT_SPECIFIC,type:2,optional:!0,value:[{name:"rsapss.saltLength.saltLength",tagClass:i.Class.UNIVERSAL,type:i.Class.INTEGER,constructed:!1,capture:"saltLength"}]},{name:"rsapss.trailerField",tagClass:i.Class.CONTEXT_SPECIFIC,type:3,optional:!0,value:[{name:"rsapss.trailer.trailer",tagClass:i.Class.UNIVERSAL,type:i.Class.INTEGER,constructed:!1,capture:"trailer"}]}]},h={name:"CertificationRequestInfo",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,captureAsn1:"certificationRequestInfo",value:[{name:"CertificationRequestInfo.integer",tagClass:i.Class.UNIVERSAL,type:i.Type.INTEGER,constructed:!1,capture:"certificationRequestInfoVersion"},{name:"CertificationRequestInfo.subject",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,captureAsn1:"certificationRequestInfoSubject"},c,{name:"CertificationRequestInfo.attributes",tagClass:i.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,capture:"certificationRequestInfoAttributes",value:[{name:"CertificationRequestInfo.attributes",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"CertificationRequestInfo.attributes.type",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1},{name:"CertificationRequestInfo.attributes.value",tagClass:i.Class.UNIVERSAL,type:i.Type.SET,constructed:!0}]}]}]},d={name:"CertificationRequest",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,captureAsn1:"csr",value:[h,{name:"CertificationRequest.signatureAlgorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"CertificationRequest.signatureAlgorithm.algorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"csrSignatureOid"},{name:"CertificationRequest.signatureAlgorithm.parameters",tagClass:i.Class.UNIVERSAL,optional:!0,captureAsn1:"csrSignatureParams"}]},{name:"CertificationRequest.signature",tagClass:i.Class.UNIVERSAL,type:i.Type.BITSTRING,constructed:!1,captureBitStringValue:"csrSignature"}]};function f(e,t){"string"===typeof t&&(t={shortName:t});for(var r,n=null,i=0;null===n&&i<e.attributes.length;++i)r=e.attributes[i],(t.type&&t.type===r.type||t.name&&t.name===r.name||t.shortName&&t.shortName===r.shortName)&&(n=r);return n}s.RDNAttributesAsArray=function(e,t){for(var r,n,s,c=[],l=0;l<e.value.length;++l){r=e.value[l];for(var u=0;u<r.value.length;++u)s={},n=r.value[u],s.type=i.derToOid(n.value[0].value),s.value=n.value[1].value,s.valueTagClass=n.value[1].type,s.type in o&&(s.name=o[s.type],s.name in a&&(s.shortName=a[s.name])),t&&(t.update(s.type),t.update(s.value)),c.push(s)}return c},s.CRIAttributesAsArray=function(e){for(var t=[],r=0;r<e.length;++r)for(var n=e[r],c=i.derToOid(n.value[0].value),l=n.value[1].value,u=0;u<l.length;++u){var h={};if(h.type=c,h.value=l[u].value,h.valueTagClass=l[u].type,h.type in o&&(h.name=o[h.type],h.name in a&&(h.shortName=a[h.name])),h.type===o.extensionRequest){h.extensions=[];for(var d=0;d<h.value.length;++d)h.extensions.push(s.certificateExtensionFromAsn1(h.value[d]))}t.push(h)}return t};var p=function(e,t,r){var n={};if(e!==o["RSASSA-PSS"])return n;r&&(n={hash:{algorithmOid:o.sha1},mgf:{algorithmOid:o.mgf1,hash:{algorithmOid:o.sha1}},saltLength:20});var s={},a=[];if(!i.validate(t,u,s,a)){var c=new Error("Cannot read RSASSA-PSS parameter block.");throw c.errors=a,c}return void 0!==s.hashOid&&(n.hash=n.hash||{},n.hash.algorithmOid=i.derToOid(s.hashOid)),void 0!==s.maskGenOid&&(n.mgf=n.mgf||{},n.mgf.algorithmOid=i.derToOid(s.maskGenOid),n.mgf.hash=n.mgf.hash||{},n.mgf.hash.algorithmOid=i.derToOid(s.maskGenHashOid)),void 0!==s.saltLength&&(n.saltLength=s.saltLength.charCodeAt(0)),n},y=function(e){switch(o[e.signatureOid]){case"sha1WithRSAEncryption":case"sha1WithRSASignature":return n.md.sha1.create();case"md5WithRSAEncryption":return n.md.md5.create();case"sha256WithRSAEncryption":case"RSASSA-PSS":return n.md.sha256.create();case"sha384WithRSAEncryption":return n.md.sha384.create();case"sha512WithRSAEncryption":return n.md.sha512.create();default:var t=new Error("Could not compute "+e.type+" digest. Unknown signature OID.");throw t.signatureOid=e.signatureOid,t}},g=function(e){var t,r=e.certificate;switch(r.signatureOid){case o.sha1WithRSAEncryption:case o.sha1WithRSASignature:break;case o["RSASSA-PSS"]:var i,s,a;if(void 0===(i=o[r.signatureParameters.mgf.hash.algorithmOid])||void 0===n.md[i])throw(a=new Error("Unsupported MGF hash function.")).oid=r.signatureParameters.mgf.hash.algorithmOid,a.name=i,a;if(void 0===(s=o[r.signatureParameters.mgf.algorithmOid])||void 0===n.mgf[s])throw(a=new Error("Unsupported MGF function.")).oid=r.signatureParameters.mgf.algorithmOid,a.name=s,a;if(s=n.mgf[s].create(n.md[i].create()),void 0===(i=o[r.signatureParameters.hash.algorithmOid])||void 0===n.md[i])throw(a=new Error("Unsupported RSASSA-PSS hash function.")).oid=r.signatureParameters.hash.algorithmOid,a.name=i,a;t=n.pss.create(n.md[i].create(),s,r.signatureParameters.saltLength)}return r.publicKey.verify(e.md.digest().getBytes(),e.signature,t)};function m(e){for(var t,r,s=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[]),o=e.attributes,a=0;a<o.length;++a){var c=(t=o[a]).value,l=i.Type.PRINTABLESTRING;"valueTagClass"in t&&(l=t.valueTagClass)===i.Type.UTF8&&(c=n.util.encodeUtf8(c)),r=i.create(i.Class.UNIVERSAL,i.Type.SET,!0,[i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(t.type).getBytes()),i.create(i.Class.UNIVERSAL,l,!1,c)])]),s.value.push(r)}return s}function v(e){for(var t,r=0;r<e.length;++r){if("undefined"===typeof(t=e[r]).name&&(t.type&&t.type in s.oids?t.name=s.oids[t.type]:t.shortName&&t.shortName in a&&(t.name=s.oids[a[t.shortName]])),"undefined"===typeof t.type){if(!t.name||!(t.name in s.oids))throw(c=new Error("Attribute type not specified.")).attribute=t,c;t.type=s.oids[t.name]}if("undefined"===typeof t.shortName&&t.name&&t.name in a&&(t.shortName=a[t.name]),t.type===o.extensionRequest&&(t.valueConstructed=!0,t.valueTagClass=i.Type.SEQUENCE,!t.value&&t.extensions)){t.value=[];for(var n=0;n<t.extensions.length;++n)t.value.push(s.certificateExtensionToAsn1(b(t.extensions[n])))}var c;if("undefined"===typeof t.value)throw(c=new Error("Attribute value not specified.")).attribute=t,c}}function b(e,t){if(t=t||{},"undefined"===typeof e.name&&e.id&&e.id in s.oids&&(e.name=s.oids[e.id]),"undefined"===typeof e.id){if(!e.name||!(e.name in s.oids))throw(E=new Error("Extension ID not specified.")).extension=e,E;e.id=s.oids[e.name]}if("undefined"!==typeof e.value)return e;if("keyUsage"===e.name){var r=0,a=0,c=0;e.digitalSignature&&(a|=128,r=7),e.nonRepudiation&&(a|=64,r=6),e.keyEncipherment&&(a|=32,r=5),e.dataEncipherment&&(a|=16,r=4),e.keyAgreement&&(a|=8,r=3),e.keyCertSign&&(a|=4,r=2),e.cRLSign&&(a|=2,r=1),e.encipherOnly&&(a|=1,r=0),e.decipherOnly&&(c|=128,r=7);var l=String.fromCharCode(r);0!==c?l+=String.fromCharCode(a)+String.fromCharCode(c):0!==a&&(l+=String.fromCharCode(a)),e.value=i.create(i.Class.UNIVERSAL,i.Type.BITSTRING,!1,l)}else if("basicConstraints"===e.name)e.value=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[]),e.cA&&e.value.value.push(i.create(i.Class.UNIVERSAL,i.Type.BOOLEAN,!1,String.fromCharCode(255))),"pathLenConstraint"in e&&e.value.value.push(i.create(i.Class.UNIVERSAL,i.Type.INTEGER,!1,i.integerToDer(e.pathLenConstraint).getBytes()));else if("extKeyUsage"===e.name){e.value=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[]);var u=e.value.value;for(var h in e)!0===e[h]&&(h in o?u.push(i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(o[h]).getBytes())):-1!==h.indexOf(".")&&u.push(i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(h).getBytes())))}else if("nsCertType"===e.name){r=0,a=0;e.client&&(a|=128,r=7),e.server&&(a|=64,r=6),e.email&&(a|=32,r=5),e.objsign&&(a|=16,r=4),e.reserved&&(a|=8,r=3),e.sslCA&&(a|=4,r=2),e.emailCA&&(a|=2,r=1),e.objCA&&(a|=1,r=0);l=String.fromCharCode(r);0!==a&&(l+=String.fromCharCode(a)),e.value=i.create(i.Class.UNIVERSAL,i.Type.BITSTRING,!1,l)}else if("subjectAltName"===e.name||"issuerAltName"===e.name){e.value=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[]);for(var d=0;d<e.altNames.length;++d){l=(v=e.altNames[d]).value;if(7===v.type&&v.ip){if(null===(l=n.util.bytesFromIP(v.ip)))throw(E=new Error('Extension "ip" value is not a valid IPv4 or IPv6 address.')).extension=e,E}else 8===v.type&&(l=v.oid?i.oidToDer(i.oidToDer(v.oid)):i.oidToDer(l));e.value.value.push(i.create(i.Class.CONTEXT_SPECIFIC,v.type,!1,l))}}else if("nsComment"===e.name&&t.cert){if(!/^[\x00-\x7F]*$/.test(e.comment)||e.comment.length<1||e.comment.length>128)throw new Error('Invalid "nsComment" content.');e.value=i.create(i.Class.UNIVERSAL,i.Type.IA5STRING,!1,e.comment)}else if("subjectKeyIdentifier"===e.name&&t.cert){var f=t.cert.generateSubjectKeyIdentifier();e.subjectKeyIdentifier=f.toHex(),e.value=i.create(i.Class.UNIVERSAL,i.Type.OCTETSTRING,!1,f.getBytes())}else if("authorityKeyIdentifier"===e.name&&t.cert){e.value=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[]);u=e.value.value;if(e.keyIdentifier){var p=!0===e.keyIdentifier?t.cert.generateSubjectKeyIdentifier().getBytes():e.keyIdentifier;u.push(i.create(i.Class.CONTEXT_SPECIFIC,0,!1,p))}if(e.authorityCertIssuer){var y=[i.create(i.Class.CONTEXT_SPECIFIC,4,!0,[m(!0===e.authorityCertIssuer?t.cert.issuer:e.authorityCertIssuer)])];u.push(i.create(i.Class.CONTEXT_SPECIFIC,1,!0,y))}if(e.serialNumber){var g=n.util.hexToBytes(!0===e.serialNumber?t.cert.serialNumber:e.serialNumber);u.push(i.create(i.Class.CONTEXT_SPECIFIC,2,!1,g))}}else if("cRLDistributionPoints"===e.name){e.value=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[]);u=e.value.value;var v,b=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[]),w=i.create(i.Class.CONTEXT_SPECIFIC,0,!0,[]);for(d=0;d<e.altNames.length;++d){l=(v=e.altNames[d]).value;if(7===v.type&&v.ip){if(null===(l=n.util.bytesFromIP(v.ip)))throw(E=new Error('Extension "ip" value is not a valid IPv4 or IPv6 address.')).extension=e,E}else 8===v.type&&(l=v.oid?i.oidToDer(i.oidToDer(v.oid)):i.oidToDer(l));w.value.push(i.create(i.Class.CONTEXT_SPECIFIC,v.type,!1,l))}b.value.push(i.create(i.Class.CONTEXT_SPECIFIC,0,!0,[w])),u.push(b)}var E;if("undefined"===typeof e.value)throw(E=new Error("Extension value not specified.")).extension=e,E;return e}function w(e,t){if(e===o["RSASSA-PSS"]){var r=[];return void 0!==t.hash.algorithmOid&&r.push(i.create(i.Class.CONTEXT_SPECIFIC,0,!0,[i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(t.hash.algorithmOid).getBytes()),i.create(i.Class.UNIVERSAL,i.Type.NULL,!1,"")])])),void 0!==t.mgf.algorithmOid&&r.push(i.create(i.Class.CONTEXT_SPECIFIC,1,!0,[i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(t.mgf.algorithmOid).getBytes()),i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(t.mgf.hash.algorithmOid).getBytes()),i.create(i.Class.UNIVERSAL,i.Type.NULL,!1,"")])])])),void 0!==t.saltLength&&r.push(i.create(i.Class.CONTEXT_SPECIFIC,2,!0,[i.create(i.Class.UNIVERSAL,i.Type.INTEGER,!1,i.integerToDer(t.saltLength).getBytes())])),i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,r)}return i.create(i.Class.UNIVERSAL,i.Type.NULL,!1,"")}function E(e){var t=i.create(i.Class.CONTEXT_SPECIFIC,0,!0,[]);if(0===e.attributes.length)return t;for(var r=e.attributes,s=0;s<r.length;++s){var o=r[s],a=o.value,c=i.Type.UTF8;"valueTagClass"in o&&(c=o.valueTagClass),c===i.Type.UTF8&&(a=n.util.encodeUtf8(a));var l=!1;"valueConstructed"in o&&(l=o.valueConstructed);var u=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(o.type).getBytes()),i.create(i.Class.UNIVERSAL,i.Type.SET,!0,[i.create(i.Class.UNIVERSAL,c,l,a)])]);t.value.push(u)}return t}s.certificateFromPem=function(e,t,r){var o=n.pem.decode(e)[0];if("CERTIFICATE"!==o.type&&"X509 CERTIFICATE"!==o.type&&"TRUSTED CERTIFICATE"!==o.type){var a=new Error('Could not convert certificate from PEM; PEM header type is not "CERTIFICATE", "X509 CERTIFICATE", or "TRUSTED CERTIFICATE".');throw a.headerType=o.type,a}if(o.procType&&"ENCRYPTED"===o.procType.type)throw new Error("Could not convert certificate from PEM; PEM is encrypted.");var c=i.fromDer(o.body,r);return s.certificateFromAsn1(c,t)},s.certificateToPem=function(e,t){var r={type:"CERTIFICATE",body:i.toDer(s.certificateToAsn1(e)).getBytes()};return n.pem.encode(r,{maxline:t})},s.publicKeyFromPem=function(e){var t=n.pem.decode(e)[0];if("PUBLIC KEY"!==t.type&&"RSA PUBLIC KEY"!==t.type){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=t.type,r}if(t.procType&&"ENCRYPTED"===t.procType.type)throw new Error("Could not convert public key from PEM; PEM is encrypted.");var o=i.fromDer(t.body);return s.publicKeyFromAsn1(o)},s.publicKeyToPem=function(e,t){var r={type:"PUBLIC KEY",body:i.toDer(s.publicKeyToAsn1(e)).getBytes()};return n.pem.encode(r,{maxline:t})},s.publicKeyToRSAPublicKeyPem=function(e,t){var r={type:"RSA PUBLIC KEY",body:i.toDer(s.publicKeyToRSAPublicKey(e)).getBytes()};return n.pem.encode(r,{maxline:t})},s.getPublicKeyFingerprint=function(e,t){var r,o=(t=t||{}).md||n.md.sha1.create();switch(t.type||"RSAPublicKey"){case"RSAPublicKey":r=i.toDer(s.publicKeyToRSAPublicKey(e)).getBytes();break;case"SubjectPublicKeyInfo":r=i.toDer(s.publicKeyToAsn1(e)).getBytes();break;default:throw new Error('Unknown fingerprint type "'+t.type+'".')}o.start(),o.update(r);var a=o.digest();if("hex"===t.encoding){var c=a.toHex();return t.delimiter?c.match(/.{2}/g).join(t.delimiter):c}if("binary"===t.encoding)return a.getBytes();if(t.encoding)throw new Error('Unknown encoding "'+t.encoding+'".');return a},s.certificationRequestFromPem=function(e,t,r){var o=n.pem.decode(e)[0];if("CERTIFICATE REQUEST"!==o.type){var a=new Error('Could not convert certification request from PEM; PEM header type is not "CERTIFICATE REQUEST".');throw a.headerType=o.type,a}if(o.procType&&"ENCRYPTED"===o.procType.type)throw new Error("Could not convert certification request from PEM; PEM is encrypted.");var c=i.fromDer(o.body,r);return s.certificationRequestFromAsn1(c,t)},s.certificationRequestToPem=function(e,t){var r={type:"CERTIFICATE REQUEST",body:i.toDer(s.certificationRequestToAsn1(e)).getBytes()};return n.pem.encode(r,{maxline:t})},s.createCertificate=function(){var e={version:2,serialNumber:"00",signatureOid:null,signature:null,siginfo:{}};return e.siginfo.algorithmOid=null,e.validity={},e.validity.notBefore=new Date,e.validity.notAfter=new Date,e.issuer={},e.issuer.getField=function(t){return f(e.issuer,t)},e.issuer.addField=function(t){v([t]),e.issuer.attributes.push(t)},e.issuer.attributes=[],e.issuer.hash=null,e.subject={},e.subject.getField=function(t){return f(e.subject,t)},e.subject.addField=function(t){v([t]),e.subject.attributes.push(t)},e.subject.attributes=[],e.subject.hash=null,e.extensions=[],e.publicKey=null,e.md=null,e.setSubject=function(t,r){v(t),e.subject.attributes=t,delete e.subject.uniqueId,r&&(e.subject.uniqueId=r),e.subject.hash=null},e.setIssuer=function(t,r){v(t),e.issuer.attributes=t,delete e.issuer.uniqueId,r&&(e.issuer.uniqueId=r),e.issuer.hash=null},e.setExtensions=function(t){for(var r=0;r<t.length;++r)b(t[r],{cert:e});e.extensions=t},e.getExtension=function(t){"string"===typeof t&&(t={name:t});for(var r,n=null,i=0;null===n&&i<e.extensions.length;++i)r=e.extensions[i],(t.id&&r.id===t.id||t.name&&r.name===t.name)&&(n=r);return n},e.sign=function(t,r){e.md=r||n.md.sha1.create();var a=o[e.md.algorithm+"WithRSAEncryption"];if(!a){var c=new Error("Could not compute certificate digest. Unknown message digest algorithm OID.");throw c.algorithm=e.md.algorithm,c}e.signatureOid=e.siginfo.algorithmOid=a,e.tbsCertificate=s.getTBSCertificate(e);var l=i.toDer(e.tbsCertificate);e.md.update(l.getBytes()),e.signature=t.sign(e.md)},e.verify=function(t){var r=!1;if(!e.issued(t)){var n=t.issuer,o=e.subject,a=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 a.expectedIssuer=o.attributes,a.actualIssuer=n.attributes,a}var c=t.md;if(null===c){c=y({signatureOid:t.signatureOid,type:"certificate"});var l=t.tbsCertificate||s.getTBSCertificate(t),u=i.toDer(l);c.update(u.getBytes())}return null!==c&&(r=g({certificate:e,md:c,signature:t.signature})),r},e.isIssuer=function(t){var r=!1,n=e.issuer,i=t.subject;if(n.hash&&i.hash)r=n.hash===i.hash;else if(n.attributes.length===i.attributes.length){var s,o;r=!0;for(var a=0;r&&a<n.attributes.length;++a)s=n.attributes[a],o=i.attributes[a],s.type===o.type&&s.value===o.value||(r=!1)}return r},e.issued=function(t){return t.isIssuer(e)},e.generateSubjectKeyIdentifier=function(){return s.getPublicKeyFingerprint(e.publicKey,{type:"RSAPublicKey"})},e.verifySubjectKeyIdentifier=function(){for(var t=o.subjectKeyIdentifier,r=0;r<e.extensions.length;++r){var i=e.extensions[r];if(i.id===t){var s=e.generateSubjectKeyIdentifier().getBytes();return n.util.hexToBytes(i.subjectKeyIdentifier)===s}}return!1},e},s.certificateFromAsn1=function(e,t){var r={},o=[];if(!i.validate(e,l,r,o)){var a=new Error("Cannot read X.509 certificate. ASN.1 object is not an X509v3 Certificate.");throw a.errors=o,a}if(i.derToOid(r.publicKeyOid)!==s.oids.rsaEncryption)throw new Error("Cannot read public key. OID is not RSA.");var c=s.createCertificate();c.version=r.certVersion?r.certVersion.charCodeAt(0):0;var u=n.util.createBuffer(r.certSerialNumber);c.serialNumber=u.toHex(),c.signatureOid=n.asn1.derToOid(r.certSignatureOid),c.signatureParameters=p(c.signatureOid,r.certSignatureParams,!0),c.siginfo.algorithmOid=n.asn1.derToOid(r.certinfoSignatureOid),c.siginfo.parameters=p(c.siginfo.algorithmOid,r.certinfoSignatureParams,!1),c.signature=r.certSignature;var h=[];if(void 0!==r.certValidity1UTCTime&&h.push(i.utcTimeToDate(r.certValidity1UTCTime)),void 0!==r.certValidity2GeneralizedTime&&h.push(i.generalizedTimeToDate(r.certValidity2GeneralizedTime)),void 0!==r.certValidity3UTCTime&&h.push(i.utcTimeToDate(r.certValidity3UTCTime)),void 0!==r.certValidity4GeneralizedTime&&h.push(i.generalizedTimeToDate(r.certValidity4GeneralizedTime)),h.length>2)throw new Error("Cannot read notBefore/notAfter validity times; more than two times were provided in the certificate.");if(h.length<2)throw new Error("Cannot read notBefore/notAfter validity times; they were not provided as either UTCTime or GeneralizedTime.");if(c.validity.notBefore=h[0],c.validity.notAfter=h[1],c.tbsCertificate=r.tbsCertificate,t){c.md=y({signatureOid:c.signatureOid,type:"certificate"});var d=i.toDer(c.tbsCertificate);c.md.update(d.getBytes())}var g=n.md.sha1.create(),m=i.toDer(r.certIssuer);g.update(m.getBytes()),c.issuer.getField=function(e){return f(c.issuer,e)},c.issuer.addField=function(e){v([e]),c.issuer.attributes.push(e)},c.issuer.attributes=s.RDNAttributesAsArray(r.certIssuer),r.certIssuerUniqueId&&(c.issuer.uniqueId=r.certIssuerUniqueId),c.issuer.hash=g.digest().toHex();var b=n.md.sha1.create(),w=i.toDer(r.certSubject);return b.update(w.getBytes()),c.subject.getField=function(e){return f(c.subject,e)},c.subject.addField=function(e){v([e]),c.subject.attributes.push(e)},c.subject.attributes=s.RDNAttributesAsArray(r.certSubject),r.certSubjectUniqueId&&(c.subject.uniqueId=r.certSubjectUniqueId),c.subject.hash=b.digest().toHex(),r.certExtensions?c.extensions=s.certificateExtensionsFromAsn1(r.certExtensions):c.extensions=[],c.publicKey=s.publicKeyFromAsn1(r.subjectPublicKeyInfo),c},s.certificateExtensionsFromAsn1=function(e){for(var t=[],r=0;r<e.value.length;++r)for(var n=e.value[r],i=0;i<n.value.length;++i)t.push(s.certificateExtensionFromAsn1(n.value[i]));return t},s.certificateExtensionFromAsn1=function(e){var t={};if(t.id=i.derToOid(e.value[0].value),t.critical=!1,e.value[1].type===i.Type.BOOLEAN?(t.critical=0!==e.value[1].value.charCodeAt(0),t.value=e.value[2].value):t.value=e.value[1].value,t.id in o)if(t.name=o[t.id],"keyUsage"===t.name){var r=0,s=0;(c=i.fromDer(t.value)).value.length>1&&(r=c.value.charCodeAt(1),s=c.value.length>2?c.value.charCodeAt(2):0),t.digitalSignature=128===(128&r),t.nonRepudiation=64===(64&r),t.keyEncipherment=32===(32&r),t.dataEncipherment=16===(16&r),t.keyAgreement=8===(8&r),t.keyCertSign=4===(4&r),t.cRLSign=2===(2&r),t.encipherOnly=1===(1&r),t.decipherOnly=128===(128&s)}else if("basicConstraints"===t.name){(c=i.fromDer(t.value)).value.length>0&&c.value[0].type===i.Type.BOOLEAN?t.cA=0!==c.value[0].value.charCodeAt(0):t.cA=!1;var a=null;c.value.length>0&&c.value[0].type===i.Type.INTEGER?a=c.value[0].value:c.value.length>1&&(a=c.value[1].value),null!==a&&(t.pathLenConstraint=i.derToInteger(a))}else if("extKeyUsage"===t.name)for(var c=i.fromDer(t.value),l=0;l<c.value.length;++l){var u=i.derToOid(c.value[l].value);u in o?t[o[u]]=!0:t[u]=!0}else if("nsCertType"===t.name){r=0;(c=i.fromDer(t.value)).value.length>1&&(r=c.value.charCodeAt(1)),t.client=128===(128&r),t.server=64===(64&r),t.email=32===(32&r),t.objsign=16===(16&r),t.reserved=8===(8&r),t.sslCA=4===(4&r),t.emailCA=2===(2&r),t.objCA=1===(1&r)}else if("subjectAltName"===t.name||"issuerAltName"===t.name){var h;t.altNames=[];c=i.fromDer(t.value);for(var d=0;d<c.value.length;++d){var f={type:(h=c.value[d]).type,value:h.value};switch(t.altNames.push(f),h.type){case 1:case 2:case 6:break;case 7:f.ip=n.util.bytesToIP(h.value);break;case 8:f.oid=i.derToOid(h.value)}}}else if("subjectKeyIdentifier"===t.name){c=i.fromDer(t.value);t.subjectKeyIdentifier=n.util.bytesToHex(c.value)}return t},s.certificationRequestFromAsn1=function(e,t){var r={},o=[];if(!i.validate(e,d,r,o)){var a=new Error("Cannot read PKCS#10 certificate request. ASN.1 object is not a PKCS#10 CertificationRequest.");throw a.errors=o,a}if(i.derToOid(r.publicKeyOid)!==s.oids.rsaEncryption)throw new Error("Cannot read public key. OID is not RSA.");var c=s.createCertificationRequest();if(c.version=r.csrVersion?r.csrVersion.charCodeAt(0):0,c.signatureOid=n.asn1.derToOid(r.csrSignatureOid),c.signatureParameters=p(c.signatureOid,r.csrSignatureParams,!0),c.siginfo.algorithmOid=n.asn1.derToOid(r.csrSignatureOid),c.siginfo.parameters=p(c.siginfo.algorithmOid,r.csrSignatureParams,!1),c.signature=r.csrSignature,c.certificationRequestInfo=r.certificationRequestInfo,t){c.md=y({signatureOid:c.signatureOid,type:"certification request"});var l=i.toDer(c.certificationRequestInfo);c.md.update(l.getBytes())}var u=n.md.sha1.create();return c.subject.getField=function(e){return f(c.subject,e)},c.subject.addField=function(e){v([e]),c.subject.attributes.push(e)},c.subject.attributes=s.RDNAttributesAsArray(r.certificationRequestInfoSubject,u),c.subject.hash=u.digest().toHex(),c.publicKey=s.publicKeyFromAsn1(r.subjectPublicKeyInfo),c.getAttribute=function(e){return f(c,e)},c.addAttribute=function(e){v([e]),c.attributes.push(e)},c.attributes=s.CRIAttributesAsArray(r.certificationRequestInfoAttributes||[]),c},s.createCertificationRequest=function(){var e={version:0,signatureOid:null,signature:null,siginfo:{}};return e.siginfo.algorithmOid=null,e.subject={},e.subject.getField=function(t){return f(e.subject,t)},e.subject.addField=function(t){v([t]),e.subject.attributes.push(t)},e.subject.attributes=[],e.subject.hash=null,e.publicKey=null,e.attributes=[],e.getAttribute=function(t){return f(e,t)},e.addAttribute=function(t){v([t]),e.attributes.push(t)},e.md=null,e.setSubject=function(t){v(t),e.subject.attributes=t,e.subject.hash=null},e.setAttributes=function(t){v(t),e.attributes=t},e.sign=function(t,r){e.md=r||n.md.sha1.create();var a=o[e.md.algorithm+"WithRSAEncryption"];if(!a){var c=new Error("Could not compute certification request digest. Unknown message digest algorithm OID.");throw c.algorithm=e.md.algorithm,c}e.signatureOid=e.siginfo.algorithmOid=a,e.certificationRequestInfo=s.getCertificationRequestInfo(e);var l=i.toDer(e.certificationRequestInfo);e.md.update(l.getBytes()),e.signature=t.sign(e.md)},e.verify=function(){var t=!1,r=e.md;if(null===r){r=y({signatureOid:e.signatureOid,type:"certification request"});var n=e.certificationRequestInfo||s.getCertificationRequestInfo(e),o=i.toDer(n);r.update(o.getBytes())}return null!==r&&(t=g({certificate:e,md:r,signature:e.signature})),t},e};var _=new Date("1950-01-01T00:00:00Z"),S=new Date("2050-01-01T00:00:00Z");function I(e){return e>=_&&e<S?i.create(i.Class.UNIVERSAL,i.Type.UTCTIME,!1,i.dateToUtcTime(e)):i.create(i.Class.UNIVERSAL,i.Type.GENERALIZEDTIME,!1,i.dateToGeneralizedTime(e))}s.getTBSCertificate=function(e){var t=I(e.validity.notBefore),r=I(e.validity.notAfter),o=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.CONTEXT_SPECIFIC,0,!0,[i.create(i.Class.UNIVERSAL,i.Type.INTEGER,!1,i.integerToDer(e.version).getBytes())]),i.create(i.Class.UNIVERSAL,i.Type.INTEGER,!1,n.util.hexToBytes(e.serialNumber)),i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(e.siginfo.algorithmOid).getBytes()),w(e.siginfo.algorithmOid,e.siginfo.parameters)]),m(e.issuer),i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[t,r]),m(e.subject),s.publicKeyToAsn1(e.publicKey)]);return e.issuer.uniqueId&&o.value.push(i.create(i.Class.CONTEXT_SPECIFIC,1,!0,[i.create(i.Class.UNIVERSAL,i.Type.BITSTRING,!1,String.fromCharCode(0)+e.issuer.uniqueId)])),e.subject.uniqueId&&o.value.push(i.create(i.Class.CONTEXT_SPECIFIC,2,!0,[i.create(i.Class.UNIVERSAL,i.Type.BITSTRING,!1,String.fromCharCode(0)+e.subject.uniqueId)])),e.extensions.length>0&&o.value.push(s.certificateExtensionsToAsn1(e.extensions)),o},s.getCertificationRequestInfo=function(e){return i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.INTEGER,!1,i.integerToDer(e.version).getBytes()),m(e.subject),s.publicKeyToAsn1(e.publicKey),E(e)])},s.distinguishedNameToAsn1=function(e){return m(e)},s.certificateToAsn1=function(e){var t=e.tbsCertificate||s.getTBSCertificate(e);return i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[t,i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(e.signatureOid).getBytes()),w(e.signatureOid,e.signatureParameters)]),i.create(i.Class.UNIVERSAL,i.Type.BITSTRING,!1,String.fromCharCode(0)+e.signature)])},s.certificateExtensionsToAsn1=function(e){var t=i.create(i.Class.CONTEXT_SPECIFIC,3,!0,[]),r=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[]);t.value.push(r);for(var n=0;n<e.length;++n)r.value.push(s.certificateExtensionToAsn1(e[n]));return t},s.certificateExtensionToAsn1=function(e){var t=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[]);t.value.push(i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(e.id).getBytes())),e.critical&&t.value.push(i.create(i.Class.UNIVERSAL,i.Type.BOOLEAN,!1,String.fromCharCode(255)));var r=e.value;return"string"!==typeof e.value&&(r=i.toDer(r).getBytes()),t.value.push(i.create(i.Class.UNIVERSAL,i.Type.OCTETSTRING,!1,r)),t},s.certificationRequestToAsn1=function(e){var t=e.certificationRequestInfo||s.getCertificationRequestInfo(e);return i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[t,i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(e.signatureOid).getBytes()),w(e.signatureOid,e.signatureParameters)]),i.create(i.Class.UNIVERSAL,i.Type.BITSTRING,!1,String.fromCharCode(0)+e.signature)])},s.createCaStore=function(e){var t={certs:{}};function r(e){return o(e),t.certs[e.hash]||null}function o(e){if(!e.hash){var t=n.md.sha1.create();e.attributes=s.RDNAttributesAsArray(m(e),t),e.hash=t.digest().toHex()}}if(t.getIssuer=function(e){return r(e.issuer)},t.addCertificate=function(e){if("string"===typeof e&&(e=n.pki.certificateFromPem(e)),o(e.subject),!t.hasCertificate(e))if(e.subject.hash in t.certs){var r=t.certs[e.subject.hash];n.util.isArray(r)||(r=[r]),r.push(e),t.certs[e.subject.hash]=r}else t.certs[e.subject.hash]=e},t.hasCertificate=function(e){"string"===typeof e&&(e=n.pki.certificateFromPem(e));var t=r(e.subject);if(!t)return!1;n.util.isArray(t)||(t=[t]);for(var o=i.toDer(s.certificateToAsn1(e)).getBytes(),a=0;a<t.length;++a){if(o===i.toDer(s.certificateToAsn1(t[a])).getBytes())return!0}return!1},t.listAllCertificates=function(){var e=[];for(var r in t.certs)if(t.certs.hasOwnProperty(r)){var i=t.certs[r];if(n.util.isArray(i))for(var s=0;s<i.length;++s)e.push(i[s]);else e.push(i)}return e},t.removeCertificate=function(e){var a;if("string"===typeof e&&(e=n.pki.certificateFromPem(e)),o(e.subject),!t.hasCertificate(e))return null;var c=r(e.subject);if(!n.util.isArray(c))return a=t.certs[e.subject.hash],delete t.certs[e.subject.hash],a;for(var l=i.toDer(s.certificateToAsn1(e)).getBytes(),u=0;u<c.length;++u){l===i.toDer(s.certificateToAsn1(c[u])).getBytes()&&(a=c[u],c.splice(u,1))}return 0===c.length&&delete t.certs[e.subject.hash],a},e)for(var a=0;a<e.length;++a){var c=e[a];t.addCertificate(c)}return t},s.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"},s.verifyCertificateChain=function(e,t,r){"function"===typeof r&&(r={verify:r}),r=r||{};var i=(t=t.slice(0)).slice(0),o=r.validityCheckDate;"undefined"===typeof o&&(o=new Date);var a=!0,c=null,l=0;do{var u=t.shift(),h=null,d=!1;if(o&&(o<u.validity.notBefore||o>u.validity.notAfter)&&(c={message:"Certificate is not valid yet or has expired.",error:s.certificateError.certificate_expired,notBefore:u.validity.notBefore,notAfter:u.validity.notAfter,now:o}),null===c){if(null===(h=t[0]||e.getIssuer(u))&&u.isIssuer(u)&&(d=!0,h=u),h){var f=h;n.util.isArray(f)||(f=[f]);for(var p=!1;!p&&f.length>0;){h=f.shift();try{p=h.verify(u)}catch(_){}}p||(c={message:"Certificate signature is invalid.",error:s.certificateError.bad_certificate})}null!==c||h&&!d||e.hasCertificate(u)||(c={message:"Certificate is not trusted.",error:s.certificateError.unknown_ca})}if(null===c&&h&&!u.isIssuer(h)&&(c={message:"Certificate issuer is invalid.",error:s.certificateError.bad_certificate}),null===c)for(var y={keyUsage:!0,basicConstraints:!0},g=0;null===c&&g<u.extensions.length;++g){var m=u.extensions[g];m.critical&&!(m.name in y)&&(c={message:"Certificate has an unsupported critical extension.",error:s.certificateError.unsupported_certificate})}if(null===c&&(!a||0===t.length&&(!h||d))){var v=u.getExtension("basicConstraints"),b=u.getExtension("keyUsage");if(null!==b&&(b.keyCertSign&&null!==v||(c={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:s.certificateError.bad_certificate})),null!==c||null===v||v.cA||(c={message:"Certificate basicConstraints indicates the certificate is not a CA.",error:s.certificateError.bad_certificate}),null===c&&null!==b&&"pathLenConstraint"in v)l-1>v.pathLenConstraint&&(c={message:"Certificate basicConstraints pathLenConstraint violated.",error:s.certificateError.bad_certificate})}var w=null===c||c.error,E=r.verify?r.verify(w,l,i):w;if(!0!==E)throw!0===w&&(c={message:"The application rejected the certificate.",error:s.certificateError.bad_certificate}),(E||0===E)&&("object"!==typeof E||n.util.isArray(E)?"string"===typeof E&&(c.error=E):(E.message&&(c.message=E.message),E.error&&(c.error=E.error))),c;c=null,a=!1,++l}while(t.length>0);return!0}},4375:e=>{"use strict";e.exports=()=>{const e={};return e.promise=new Promise(((t,r)=>{e.resolve=t,e.reject=r})),e}},7091:(e,t,r)=>{const n=r(8443),i=r(4375);e.exports=class{constructor(){this._buffer=new n,this._waitingConsumers=new n}push(e){const{promise:t,resolve:r}=i();return this._buffer.push({chunk:e,resolve:r}),this._consume(),t}_consume(){for(;!this._waitingConsumers.isEmpty()&&!this._buffer.isEmpty();){const e=this._waitingConsumers.shift(),t=this._buffer.shift();e.resolve(t.chunk),t.resolve()}}shift(){const{promise:e,resolve:t}=i();return this._waitingConsumers.push({resolve:t}),this._consume(),e}isEmpty(){return this._buffer.isEmpty()}}},3780:(e,t,r)=>{"use strict";e.exports=r(3148).default},3148:function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const i=r(4982),s=n(r(8380)),o=n(r(8224)),a=r(4974),c=["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"].map((e=>new i.Netmask(e)));function l(e){return/^::$/.test(e)||/^::1$/.test(e)||/^::f{4}:([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$/.test(e)||/^::f{4}:0.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$/.test(e)||/^64:ff9b::([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$/.test(e)||/^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(e)||/^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(e)||/^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(e)||/^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(e)||/^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(e)||/^f[c-d]([0-9a-fA-F]{2,2}):/i.test(e)||/^fe[8-9a-bA-B][0-9a-fA-F]:/i.test(e)||/^ff([0-9a-fA-F]{2,2}):/i.test(e)}t.default=e=>{if((0,a.isValid)(e)){const t=(0,a.parse)(e);if("ipv4"===t.kind())return function(e){for(let t of c)if(t.contains(e))return!0;return!1}(t.toNormalizedString());if("ipv6"===t.kind())return l(e)}else if((0,o.default)(e)&&s.default.v6().test(e))return l(e)}},2376:(e,t,r)=>{"use strict";e.exports=r(6273)},6273:(e,t,r)=>{"use strict";var n=t;function i(){n.util._configure(),n.Writer._configure(n.BufferWriter),n.Reader._configure(n.BufferReader)}n.build="minimal",n.Writer=r(1046),n.BufferWriter=r(8608),n.Reader=r(1845),n.BufferReader=r(3899),n.util=r(1172),n.rpc=r(6436),n.roots=r(7600),n.configure=i,i()},1845:(e,t,r)=>{"use strict";e.exports=c;var n,i=r(1172),s=i.LongBits,o=i.utf8;function a(e,t){return RangeError("index out of range: "+e.pos+" + "+(t||1)+" > "+e.len)}function c(e){this.buf=e,this.pos=0,this.len=e.length}var l="undefined"!==typeof Uint8Array?function(e){if(e instanceof Uint8Array||Array.isArray(e))return new c(e);throw Error("illegal buffer")}:function(e){if(Array.isArray(e))return new c(e);throw Error("illegal buffer")},u=function(){return i.Buffer?function(e){return(c.create=function(e){return i.Buffer.isBuffer(e)?new n(e):l(e)})(e)}:l};function h(){var e=new s(0,0),t=0;if(!(this.len-this.pos>4)){for(;t<3;++t){if(this.pos>=this.len)throw a(this);if(e.lo=(e.lo|(127&this.buf[this.pos])<<7*t)>>>0,this.buf[this.pos++]<128)return e}return e.lo=(e.lo|(127&this.buf[this.pos++])<<7*t)>>>0,e}for(;t<4;++t)if(e.lo=(e.lo|(127&this.buf[this.pos])<<7*t)>>>0,this.buf[this.pos++]<128)return e;if(e.lo=(e.lo|(127&this.buf[this.pos])<<28)>>>0,e.hi=(e.hi|(127&this.buf[this.pos])>>4)>>>0,this.buf[this.pos++]<128)return e;if(t=0,this.len-this.pos>4){for(;t<5;++t)if(e.hi=(e.hi|(127&this.buf[this.pos])<<7*t+3)>>>0,this.buf[this.pos++]<128)return e}else for(;t<5;++t){if(this.pos>=this.len)throw a(this);if(e.hi=(e.hi|(127&this.buf[this.pos])<<7*t+3)>>>0,this.buf[this.pos++]<128)return e}throw Error("invalid varint encoding")}function d(e,t){return(e[t-4]|e[t-3]<<8|e[t-2]<<16|e[t-1]<<24)>>>0}function f(){if(this.pos+8>this.len)throw a(this,8);return new s(d(this.buf,this.pos+=4),d(this.buf,this.pos+=4))}c.create=u(),c.prototype._slice=i.Array.prototype.subarray||i.Array.prototype.slice,c.prototype.uint32=function(){var e=4294967295;return function(){if(e=(127&this.buf[this.pos])>>>0,this.buf[this.pos++]<128)return e;if(e=(e|(127&this.buf[this.pos])<<7)>>>0,this.buf[this.pos++]<128)return e;if(e=(e|(127&this.buf[this.pos])<<14)>>>0,this.buf[this.pos++]<128)return e;if(e=(e|(127&this.buf[this.pos])<<21)>>>0,this.buf[this.pos++]<128)return e;if(e=(e|(15&this.buf[this.pos])<<28)>>>0,this.buf[this.pos++]<128)return e;if((this.pos+=5)>this.len)throw this.pos=this.len,a(this,10);return e}}(),c.prototype.int32=function(){return 0|this.uint32()},c.prototype.sint32=function(){var e=this.uint32();return e>>>1^-(1&e)|0},c.prototype.bool=function(){return 0!==this.uint32()},c.prototype.fixed32=function(){if(this.pos+4>this.len)throw a(this,4);return d(this.buf,this.pos+=4)},c.prototype.sfixed32=function(){if(this.pos+4>this.len)throw a(this,4);return 0|d(this.buf,this.pos+=4)},c.prototype.float=function(){if(this.pos+4>this.len)throw a(this,4);var e=i.float.readFloatLE(this.buf,this.pos);return this.pos+=4,e},c.prototype.double=function(){if(this.pos+8>this.len)throw a(this,4);var e=i.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,e},c.prototype.bytes=function(){var e=this.uint32(),t=this.pos,r=this.pos+e;if(r>this.len)throw a(this,e);return this.pos+=e,Array.isArray(this.buf)?this.buf.slice(t,r):t===r?new this.buf.constructor(0):this._slice.call(this.buf,t,r)},c.prototype.string=function(){var e=this.bytes();return o.read(e,0,e.length)},c.prototype.skip=function(e){if("number"===typeof e){if(this.pos+e>this.len)throw a(this,e);this.pos+=e}else do{if(this.pos>=this.len)throw a(this)}while(128&this.buf[this.pos++]);return this},c.prototype.skipType=function(e){switch(e){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;4!==(e=7&this.uint32());)this.skipType(e);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+e+" at offset "+this.pos)}return this},c._configure=function(e){n=e,c.create=u(),n._configure();var t=i.Long?"toLong":"toNumber";i.merge(c.prototype,{int64:function(){return h.call(this)[t](!1)},uint64:function(){return h.call(this)[t](!0)},sint64:function(){return h.call(this).zzDecode()[t](!1)},fixed64:function(){return f.call(this)[t](!0)},sfixed64:function(){return f.call(this)[t](!1)}})}},3899:(e,t,r)=>{"use strict";e.exports=s;var n=r(1845);(s.prototype=Object.create(n.prototype)).constructor=s;var i=r(1172);function s(e){n.call(this,e)}s._configure=function(){i.Buffer&&(s.prototype._slice=i.Buffer.prototype.slice)},s.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))},s._configure()},7600:e=>{"use strict";e.exports={}},6436:(e,t,r)=>{"use strict";t.Service=r(3031)},3031:(e,t,r)=>{"use strict";e.exports=i;var n=r(1172);function i(e,t,r){if("function"!==typeof e)throw TypeError("rpcImpl must be a function");n.EventEmitter.call(this),this.rpcImpl=e,this.requestDelimited=Boolean(t),this.responseDelimited=Boolean(r)}(i.prototype=Object.create(n.EventEmitter.prototype)).constructor=i,i.prototype.rpcCall=function e(t,r,i,s,o){if(!s)throw TypeError("request must be specified");var a=this;if(!o)return n.asPromise(e,a,t,r,i,s);if(a.rpcImpl)try{return a.rpcImpl(t,r[a.requestDelimited?"encodeDelimited":"encode"](s).finish(),(function(e,r){if(e)return a.emit("error",e,t),o(e);if(null!==r){if(!(r instanceof i))try{r=i[a.responseDelimited?"decodeDelimited":"decode"](r)}catch(e){return a.emit("error",e,t),o(e)}return a.emit("data",r,t),o(null,r)}a.end(!0)}))}catch(c){return a.emit("error",c,t),void setTimeout((function(){o(c)}),0)}else setTimeout((function(){o(Error("already ended"))}),0)},i.prototype.end=function(e){return this.rpcImpl&&(e||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this}},6846:(e,t,r)=>{"use strict";e.exports=i;var n=r(1172);function i(e,t){this.lo=e>>>0,this.hi=t>>>0}var s=i.zero=new i(0,0);s.toNumber=function(){return 0},s.zzEncode=s.zzDecode=function(){return this},s.length=function(){return 1};var o=i.zeroHash="\0\0\0\0\0\0\0\0";i.fromNumber=function(e){if(0===e)return s;var t=e<0;t&&(e=-e);var r=e>>>0,n=(e-r)/4294967296>>>0;return t&&(n=~n>>>0,r=~r>>>0,++r>4294967295&&(r=0,++n>4294967295&&(n=0))),new i(r,n)},i.from=function(e){if("number"===typeof e)return i.fromNumber(e);if(n.isString(e)){if(!n.Long)return i.fromNumber(parseInt(e,10));e=n.Long.fromString(e)}return e.low||e.high?new i(e.low>>>0,e.high>>>0):s},i.prototype.toNumber=function(e){if(!e&&this.hi>>>31){var t=1+~this.lo>>>0,r=~this.hi>>>0;return t||(r=r+1>>>0),-(t+4294967296*r)}return this.lo+4294967296*this.hi},i.prototype.toLong=function(e){return n.Long?new n.Long(0|this.lo,0|this.hi,Boolean(e)):{low:0|this.lo,high:0|this.hi,unsigned:Boolean(e)}};var a=String.prototype.charCodeAt;i.fromHash=function(e){return e===o?s:new i((a.call(e,0)|a.call(e,1)<<8|a.call(e,2)<<16|a.call(e,3)<<24)>>>0,(a.call(e,4)|a.call(e,5)<<8|a.call(e,6)<<16|a.call(e,7)<<24)>>>0)},i.prototype.toHash=function(){return String.fromCharCode(255&this.lo,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,255&this.hi,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)},i.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},i.prototype.zzDecode=function(){var e=-(1&this.lo);return this.lo=((this.lo>>>1|this.hi<<31)^e)>>>0,this.hi=(this.hi>>>1^e)>>>0,this},i.prototype.length=function(){var e=this.lo,t=(this.lo>>>28|this.hi<<4)>>>0,r=this.hi>>>24;return 0===r?0===t?e<16384?e<128?1:2:e<2097152?3:4:t<16384?t<128?5:6:t<2097152?7:8:r<128?9:10}},1172:function(e,t,r){"use strict";var n=t;function i(e,t,r){for(var n=Object.keys(t),i=0;i<n.length;++i)void 0!==e[n[i]]&&r||(e[n[i]]=t[n[i]]);return e}function s(e){function t(e,r){if(!(this instanceof t))return new t(e,r);Object.defineProperty(this,"message",{get:function(){return e}}),Error.captureStackTrace?Error.captureStackTrace(this,t):Object.defineProperty(this,"stack",{value:(new Error).stack||""}),r&&i(this,r)}return(t.prototype=Object.create(Error.prototype)).constructor=t,Object.defineProperty(t.prototype,"name",{get:function(){return e}}),t.prototype.toString=function(){return this.name+": "+this.message},t}n.asPromise=r(5943),n.base64=r(7195),n.EventEmitter=r(3745),n.float=r(1448),n.inquire=r(4638),n.utf8=r(8557),n.pool=r(8071),n.LongBits=r(6846),n.isNode=Boolean("undefined"!==typeof r.g&&r.g&&r.g.process&&r.g.process.versions&&r.g.process.versions.node),n.global=n.isNode&&r.g||"undefined"!==typeof window&&window||"undefined"!==typeof self&&self||this,n.emptyArray=Object.freeze?Object.freeze([]):[],n.emptyObject=Object.freeze?Object.freeze({}):{},n.isInteger=Number.isInteger||function(e){return"number"===typeof e&&isFinite(e)&&Math.floor(e)===e},n.isString=function(e){return"string"===typeof e||e instanceof String},n.isObject=function(e){return e&&"object"===typeof e},n.isset=n.isSet=function(e,t){var r=e[t];return!(null==r||!e.hasOwnProperty(t))&&("object"!==typeof r||(Array.isArray(r)?r.length:Object.keys(r).length)>0)},n.Buffer=function(){try{var e=n.inquire("buffer").Buffer;return e.prototype.utf8Write?e:null}catch(t){return null}}(),n._Buffer_from=null,n._Buffer_allocUnsafe=null,n.newBuffer=function(e){return"number"===typeof e?n.Buffer?n._Buffer_allocUnsafe(e):new n.Array(e):n.Buffer?n._Buffer_from(e):"undefined"===typeof Uint8Array?e:new Uint8Array(e)},n.Array="undefined"!==typeof Uint8Array?Uint8Array:Array,n.Long=n.global.dcodeIO&&n.global.dcodeIO.Long||n.global.Long||n.inquire("long"),n.key2Re=/^true|false|0|1$/,n.key32Re=/^-?(?:0|[1-9][0-9]*)$/,n.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/,n.longToHash=function(e){return e?n.LongBits.from(e).toHash():n.LongBits.zeroHash},n.longFromHash=function(e,t){var r=n.LongBits.fromHash(e);return n.Long?n.Long.fromBits(r.lo,r.hi,t):r.toNumber(Boolean(t))},n.merge=i,n.lcFirst=function(e){return e.charAt(0).toLowerCase()+e.substring(1)},n.newError=s,n.ProtocolError=s("ProtocolError"),n.oneOfGetter=function(e){for(var t={},r=0;r<e.length;++r)t[e[r]]=1;return function(){for(var e=Object.keys(this),r=e.length-1;r>-1;--r)if(1===t[e[r]]&&void 0!==this[e[r]]&&null!==this[e[r]])return e[r]}},n.oneOfSetter=function(e){return function(t){for(var r=0;r<e.length;++r)e[r]!==t&&delete this[e[r]]}},n.toJSONOptions={longs:String,enums:String,bytes:String,json:!0},n._configure=function(){var e=n.Buffer;e?(n._Buffer_from=e.from!==Uint8Array.from&&e.from||function(t,r){return new e(t,r)},n._Buffer_allocUnsafe=e.allocUnsafe||function(t){return new e(t)}):n._Buffer_from=n._Buffer_allocUnsafe=null}},1046:(e,t,r)=>{"use strict";e.exports=h;var n,i=r(1172),s=i.LongBits,o=i.base64,a=i.utf8;function c(e,t,r){this.fn=e,this.len=t,this.next=void 0,this.val=r}function l(){}function u(e){this.head=e.head,this.tail=e.tail,this.len=e.len,this.next=e.states}function h(){this.len=0,this.head=new c(l,0,0),this.tail=this.head,this.states=null}var d=function(){return i.Buffer?function(){return(h.create=function(){return new n})()}:function(){return new h}};function f(e,t,r){t[r]=255&e}function p(e,t){this.len=e,this.next=void 0,this.val=t}function y(e,t,r){for(;e.hi;)t[r++]=127&e.lo|128,e.lo=(e.lo>>>7|e.hi<<25)>>>0,e.hi>>>=7;for(;e.lo>127;)t[r++]=127&e.lo|128,e.lo=e.lo>>>7;t[r++]=e.lo}function g(e,t,r){t[r]=255&e,t[r+1]=e>>>8&255,t[r+2]=e>>>16&255,t[r+3]=e>>>24}h.create=d(),h.alloc=function(e){return new i.Array(e)},i.Array!==Array&&(h.alloc=i.pool(h.alloc,i.Array.prototype.subarray)),h.prototype._push=function(e,t,r){return this.tail=this.tail.next=new c(e,t,r),this.len+=t,this},p.prototype=Object.create(c.prototype),p.prototype.fn=function(e,t,r){for(;e>127;)t[r++]=127&e|128,e>>>=7;t[r]=e},h.prototype.uint32=function(e){return this.len+=(this.tail=this.tail.next=new p((e>>>=0)<128?1:e<16384?2:e<2097152?3:e<268435456?4:5,e)).len,this},h.prototype.int32=function(e){return e<0?this._push(y,10,s.fromNumber(e)):this.uint32(e)},h.prototype.sint32=function(e){return this.uint32((e<<1^e>>31)>>>0)},h.prototype.uint64=function(e){var t=s.from(e);return this._push(y,t.length(),t)},h.prototype.int64=h.prototype.uint64,h.prototype.sint64=function(e){var t=s.from(e).zzEncode();return this._push(y,t.length(),t)},h.prototype.bool=function(e){return this._push(f,1,e?1:0)},h.prototype.fixed32=function(e){return this._push(g,4,e>>>0)},h.prototype.sfixed32=h.prototype.fixed32,h.prototype.fixed64=function(e){var t=s.from(e);return this._push(g,4,t.lo)._push(g,4,t.hi)},h.prototype.sfixed64=h.prototype.fixed64,h.prototype.float=function(e){return this._push(i.float.writeFloatLE,4,e)},h.prototype.double=function(e){return this._push(i.float.writeDoubleLE,8,e)};var m=i.Array.prototype.set?function(e,t,r){t.set(e,r)}:function(e,t,r){for(var n=0;n<e.length;++n)t[r+n]=e[n]};h.prototype.bytes=function(e){var t=e.length>>>0;if(!t)return this._push(f,1,0);if(i.isString(e)){var r=h.alloc(t=o.length(e));o.decode(e,r,0),e=r}return this.uint32(t)._push(m,t,e)},h.prototype.string=function(e){var t=a.length(e);return t?this.uint32(t)._push(a.write,t,e):this._push(f,1,0)},h.prototype.fork=function(){return this.states=new u(this),this.head=this.tail=new c(l,0,0),this.len=0,this},h.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 c(l,0,0),this.len=0),this},h.prototype.ldelim=function(){var e=this.head,t=this.tail,r=this.len;return this.reset().uint32(r),r&&(this.tail.next=e.next,this.tail=t,this.len+=r),this},h.prototype.finish=function(){for(var e=this.head.next,t=this.constructor.alloc(this.len),r=0;e;)e.fn(e.val,t,r),r+=e.len,e=e.next;return t},h._configure=function(e){n=e,h.create=d(),n._configure()}},8608:(e,t,r)=>{"use strict";e.exports=s;var n=r(1046);(s.prototype=Object.create(n.prototype)).constructor=s;var i=r(1172);function s(){n.call(this)}function o(e,t,r){e.length<40?i.utf8.write(e,t,r):t.utf8Write?t.utf8Write(e,r):t.write(e,r)}s._configure=function(){s.alloc=i._Buffer_allocUnsafe,s.writeBytesBuffer=i.Buffer&&i.Buffer.prototype instanceof Uint8Array&&"set"===i.Buffer.prototype.set.name?function(e,t,r){t.set(e,r)}:function(e,t,r){if(e.copy)e.copy(t,r,0,e.length);else for(var n=0;n<e.length;)t[r++]=e[n++]}},s.prototype.bytes=function(e){i.isString(e)&&(e=i._Buffer_from(e,"base64"));var t=e.length>>>0;return this.uint32(t),t&&this._push(s.writeBytesBuffer,t,e),this},s.prototype.string=function(e){var t=i.Buffer.byteLength(e);return this.uint32(t),t&&this._push(o,t,e),this},s._configure()},835:(e,t,r)=>{"use strict";e.exports=r(9131)},6130:e=>{"use strict";e.exports=n;var t,r=/\/|\./;function n(e,t){r.test(e)||(e="google/protobuf/"+e+".proto",t={nested:{google:{nested:{protobuf:{nested:t}}}}}),n[e]=t}n("any",{Any:{fields:{type_url:{type:"string",id:1},value:{type:"bytes",id:2}}}}),n("duration",{Duration:t={fields:{seconds:{type:"int64",id:1},nanos:{type:"int32",id:2}}}}),n("timestamp",{Timestamp:t}),n("empty",{Empty:{fields:{}}}),n("struct",{Struct:{fields:{fields:{keyType:"string",type:"Value",id:1}}},Value:{oneofs:{kind:{oneof:["nullValue","numberValue","stringValue","boolValue","structValue","listValue"]}},fields:{nullValue:{type:"NullValue",id:1},numberValue:{type:"double",id:2},stringValue:{type:"string",id:3},boolValue:{type:"bool",id:4},structValue:{type:"Struct",id:5},listValue:{type:"ListValue",id:6}}},NullValue:{values:{NULL_VALUE:0}},ListValue:{fields:{values:{rule:"repeated",type:"Value",id:1}}}}),n("wrappers",{DoubleValue:{fields:{value:{type:"double",id:1}}},FloatValue:{fields:{value:{type:"float",id:1}}},Int64Value:{fields:{value:{type:"int64",id:1}}},UInt64Value:{fields:{value:{type:"uint64",id:1}}},Int32Value:{fields:{value:{type:"int32",id:1}}},UInt32Value:{fields:{value:{type:"uint32",id:1}}},BoolValue:{fields:{value:{type:"bool",id:1}}},StringValue:{fields:{value:{type:"string",id:1}}},BytesValue:{fields:{value:{type:"bytes",id:1}}}}),n("field_mask",{FieldMask:{fields:{paths:{rule:"repeated",type:"string",id:1}}}}),n.get=function(e){return n[e]||null}},8331:(e,t,r)=>{"use strict";var n=t,i=r(6199),s=r(5399);function o(e,t,r,n){if(t.resolvedType)if(t.resolvedType instanceof i){e("switch(d%s){",n);for(var s=t.resolvedType.values,o=Object.keys(s),a=0;a<o.length;++a)t.repeated&&s[o[a]]===t.typeDefault&&e("default:"),e("case%j:",o[a])("case %i:",s[o[a]])("m%s=%j",n,s[o[a]])("break");e("}")}else e('if(typeof d%s!=="object")',n)("throw TypeError(%j)",t.fullName+": object expected")("m%s=types[%i].fromObject(d%s)",n,r,n);else{var c=!1;switch(t.type){case"double":case"float":e("m%s=Number(d%s)",n,n);break;case"uint32":case"fixed32":e("m%s=d%s>>>0",n,n);break;case"int32":case"sint32":case"sfixed32":e("m%s=d%s|0",n,n);break;case"uint64":c=!0;case"int64":case"sint64":case"fixed64":case"sfixed64":e("if(util.Long)")("(m%s=util.Long.fromValue(d%s)).unsigned=%j",n,n,c)('else if(typeof d%s==="string")',n)("m%s=parseInt(d%s,10)",n,n)('else if(typeof d%s==="number")',n)("m%s=d%s",n,n)('else if(typeof d%s==="object")',n)("m%s=new util.LongBits(d%s.low>>>0,d%s.high>>>0).toNumber(%s)",n,n,n,c?"true":"");break;case"bytes":e('if(typeof d%s==="string")',n)("util.base64.decode(d%s,m%s=util.newBuffer(util.base64.length(d%s)),0)",n,n,n)("else if(d%s.length >= 0)",n)("m%s=d%s",n,n);break;case"string":e("m%s=String(d%s)",n,n);break;case"bool":e("m%s=Boolean(d%s)",n,n)}}return e}function a(e,t,r,n){if(t.resolvedType)t.resolvedType instanceof i?e("d%s=o.enums===String?types[%i].values[m%s]:m%s",n,r,n,n):e("d%s=types[%i].toObject(m%s,o)",n,r,n);else{var s=!1;switch(t.type){case"double":case"float":e("d%s=o.json&&!isFinite(m%s)?String(m%s):m%s",n,n,n,n);break;case"uint64":s=!0;case"int64":case"sint64":case"fixed64":case"sfixed64":e('if(typeof m%s==="number")',n)("d%s=o.longs===String?String(m%s):m%s",n,n,n)("else")("d%s=o.longs===String?util.Long.prototype.toString.call(m%s):o.longs===Number?new util.LongBits(m%s.low>>>0,m%s.high>>>0).toNumber(%s):m%s",n,n,n,n,s?"true":"",n);break;case"bytes":e("d%s=o.bytes===String?util.base64.encode(m%s,0,m%s.length):o.bytes===Array?Array.prototype.slice.call(m%s):m%s",n,n,n,n,n);break;default:e("d%s=m%s",n,n)}}return e}n.fromObject=function(e){var t=e.fieldsArray,r=s.codegen(["d"],e.name+"$fromObject")("if(d instanceof this.ctor)")("return d");if(!t.length)return r("return new this.ctor");r("var m=new this.ctor");for(var n=0;n<t.length;++n){var a=t[n].resolve(),c=s.safeProp(a.name);a.map?(r("if(d%s){",c)('if(typeof d%s!=="object")',c)("throw TypeError(%j)",a.fullName+": object expected")("m%s={}",c)("for(var ks=Object.keys(d%s),i=0;i<ks.length;++i){",c),o(r,a,n,c+"[ks[i]]")("}")("}")):a.repeated?(r("if(d%s){",c)("if(!Array.isArray(d%s))",c)("throw TypeError(%j)",a.fullName+": array expected")("m%s=[]",c)("for(var i=0;i<d%s.length;++i){",c),o(r,a,n,c+"[i]")("}")("}")):(a.resolvedType instanceof i||r("if(d%s!=null){",c),o(r,a,n,c),a.resolvedType instanceof i||r("}"))}return r("return m")},n.toObject=function(e){var t=e.fieldsArray.slice().sort(s.compareFieldsById);if(!t.length)return s.codegen()("return {}");for(var r=s.codegen(["m","o"],e.name+"$toObject")("if(!o)")("o={}")("var d={}"),n=[],o=[],c=[],l=0;l<t.length;++l)t[l].partOf||(t[l].resolve().repeated?n:t[l].map?o:c).push(t[l]);if(n.length){for(r("if(o.arrays||o.defaults){"),l=0;l<n.length;++l)r("d%s=[]",s.safeProp(n[l].name));r("}")}if(o.length){for(r("if(o.objects||o.defaults){"),l=0;l<o.length;++l)r("d%s={}",s.safeProp(o[l].name));r("}")}if(c.length){for(r("if(o.defaults){"),l=0;l<c.length;++l){var u=c[l],h=s.safeProp(u.name);if(u.resolvedType instanceof i)r("d%s=o.enums===String?%j:%j",h,u.resolvedType.valuesById[u.typeDefault],u.typeDefault);else if(u.long)r("if(util.Long){")("var n=new util.Long(%i,%i,%j)",u.typeDefault.low,u.typeDefault.high,u.typeDefault.unsigned)("d%s=o.longs===String?n.toString():o.longs===Number?n.toNumber():n",h)("}else")("d%s=o.longs===String?%j:%i",h,u.typeDefault.toString(),u.typeDefault.toNumber());else if(u.bytes){var d="["+Array.prototype.slice.call(u.typeDefault).join(",")+"]";r("if(o.bytes===String)d%s=%j",h,String.fromCharCode.apply(String,u.typeDefault))("else{")("d%s=%s",h,d)("if(o.bytes!==Array)d%s=util.newBuffer(d%s)",h,h)("}")}else r("d%s=%j",h,u.typeDefault)}r("}")}var f=!1;for(l=0;l<t.length;++l){u=t[l];var p=e._fieldsArray.indexOf(u);h=s.safeProp(u.name);u.map?(f||(f=!0,r("var ks2")),r("if(m%s&&(ks2=Object.keys(m%s)).length){",h,h)("d%s={}",h)("for(var j=0;j<ks2.length;++j){"),a(r,u,p,h+"[ks2[j]]")("}")):u.repeated?(r("if(m%s&&m%s.length){",h,h)("d%s=[]",h)("for(var j=0;j<m%s.length;++j){",h),a(r,u,p,h+"[j]")("}")):(r("if(m%s!=null&&m.hasOwnProperty(%j)){",h,u.name),a(r,u,p,h),u.partOf&&r("if(o.oneofs)")("d%s=%j",s.safeProp(u.partOf.name),u.name)),r("}")}return r("return d")}},6922:(e,t,r)=>{"use strict";e.exports=function(e){var t=s.codegen(["r","l"],e.name+"$decode")("if(!(r instanceof Reader))")("r=Reader.create(r)")("var c=l===undefined?r.len:r.pos+l,m=new this.ctor"+(e.fieldsArray.filter((function(e){return e.map})).length?",k,value":""))("while(r.pos<c){")("var t=r.uint32()");e.group&&t("if((t&7)===4)")("break");t("switch(t>>>3){");for(var r=0;r<e.fieldsArray.length;++r){var a=e._fieldsArray[r].resolve(),c=a.resolvedType instanceof n?"int32":a.type,l="m"+s.safeProp(a.name);t("case %i: {",a.id),a.map?(t("if(%s===util.emptyObject)",l)("%s={}",l)("var c2 = r.uint32()+r.pos"),void 0!==i.defaults[a.keyType]?t("k=%j",i.defaults[a.keyType]):t("k=null"),void 0!==i.defaults[c]?t("value=%j",i.defaults[c]):t("value=null"),t("while(r.pos<c2){")("var tag2=r.uint32()")("switch(tag2>>>3){")("case 1: k=r.%s(); break",a.keyType)("case 2:"),void 0===i.basic[c]?t("value=types[%i].decode(r,r.uint32())",r):t("value=r.%s()",c),t("break")("default:")("r.skipType(tag2&7)")("break")("}")("}"),void 0!==i.long[a.keyType]?t('%s[typeof k==="object"?util.longToHash(k):k]=value',l):t("%s[k]=value",l)):a.repeated?(t("if(!(%s&&%s.length))",l,l)("%s=[]",l),void 0!==i.packed[c]&&t("if((t&7)===2){")("var c2=r.uint32()+r.pos")("while(r.pos<c2)")("%s.push(r.%s())",l,c)("}else"),void 0===i.basic[c]?t(a.resolvedType.group?"%s.push(types[%i].decode(r))":"%s.push(types[%i].decode(r,r.uint32()))",l,r):t("%s.push(r.%s())",l,c)):void 0===i.basic[c]?t(a.resolvedType.group?"%s=types[%i].decode(r)":"%s=types[%i].decode(r,r.uint32())",l,r):t("%s=r.%s()",l,c),t("break")("}")}for(t("default:")("r.skipType(t&7)")("break")("}")("}"),r=0;r<e._fieldsArray.length;++r){var u=e._fieldsArray[r];u.required&&t("if(!m.hasOwnProperty(%j))",u.name)("throw util.ProtocolError(%j,{instance:m})",o(u))}return t("return m")};var n=r(6199),i=r(4653),s=r(5399);function o(e){return"missing required '"+e.name+"'"}},9979:(e,t,r)=>{"use strict";e.exports=function(e){for(var t,r=s.codegen(["m","w"],e.name+"$encode")("if(!w)")("w=Writer.create()"),a=e.fieldsArray.slice().sort(s.compareFieldsById),c=0;c<a.length;++c){var l=a[c].resolve(),u=e._fieldsArray.indexOf(l),h=l.resolvedType instanceof n?"int32":l.type,d=i.basic[h];t="m"+s.safeProp(l.name),l.map?(r("if(%s!=null&&Object.hasOwnProperty.call(m,%j)){",t,l.name)("for(var ks=Object.keys(%s),i=0;i<ks.length;++i){",t)("w.uint32(%i).fork().uint32(%i).%s(ks[i])",(l.id<<3|2)>>>0,8|i.mapKey[l.keyType],l.keyType),void 0===d?r("types[%i].encode(%s[ks[i]],w.uint32(18).fork()).ldelim().ldelim()",u,t):r(".uint32(%i).%s(%s[ks[i]]).ldelim()",16|d,h,t),r("}")("}")):l.repeated?(r("if(%s!=null&&%s.length){",t,t),l.packed&&void 0!==i.packed[h]?r("w.uint32(%i).fork()",(l.id<<3|2)>>>0)("for(var i=0;i<%s.length;++i)",t)("w.%s(%s[i])",h,t)("w.ldelim()"):(r("for(var i=0;i<%s.length;++i)",t),void 0===d?o(r,l,u,t+"[i]"):r("w.uint32(%i).%s(%s[i])",(l.id<<3|d)>>>0,h,t)),r("}")):(l.optional&&r("if(%s!=null&&Object.hasOwnProperty.call(m,%j))",t,l.name),void 0===d?o(r,l,u,t):r("w.uint32(%i).%s(%s)",(l.id<<3|d)>>>0,h,t))}return r("return w")};var n=r(6199),i=r(4653),s=r(5399);function o(e,t,r,n){return t.resolvedType.group?e("types[%i].encode(%s,w.uint32(%i)).uint32(%i)",r,n,(t.id<<3|3)>>>0,(t.id<<3|4)>>>0):e("types[%i].encode(%s,w.uint32(%i).fork()).ldelim()",r,n,(t.id<<3|2)>>>0)}},6199:(e,t,r)=>{"use strict";e.exports=o;var n=r(1160);((o.prototype=Object.create(n.prototype)).constructor=o).className="Enum";var i=r(3703),s=r(5399);function o(e,t,r,i,s){if(n.call(this,e,r),t&&"object"!==typeof t)throw TypeError("values must be an object");if(this.valuesById={},this.values=Object.create(this.valuesById),this.comment=i,this.comments=s||{},this.reserved=void 0,t)for(var o=Object.keys(t),a=0;a<o.length;++a)"number"===typeof t[o[a]]&&(this.valuesById[this.values[o[a]]=t[o[a]]]=o[a])}o.fromJSON=function(e,t){var r=new o(e,t.values,t.options,t.comment,t.comments);return r.reserved=t.reserved,r},o.prototype.toJSON=function(e){var t=!!e&&Boolean(e.keepComments);return s.toObject(["options",this.options,"values",this.values,"reserved",this.reserved&&this.reserved.length?this.reserved:void 0,"comment",t?this.comment:void 0,"comments",t?this.comments:void 0])},o.prototype.add=function(e,t,r){if(!s.isString(e))throw TypeError("name must be a string");if(!s.isInteger(t))throw TypeError("id must be an integer");if(void 0!==this.values[e])throw Error("duplicate name '"+e+"' in "+this);if(this.isReservedId(t))throw Error("id "+t+" is reserved in "+this);if(this.isReservedName(e))throw Error("name '"+e+"' is reserved in "+this);if(void 0!==this.valuesById[t]){if(!this.options||!this.options.allow_alias)throw Error("duplicate id "+t+" in "+this);this.values[e]=t}else this.valuesById[this.values[e]=t]=e;return this.comments[e]=r||null,this},o.prototype.remove=function(e){if(!s.isString(e))throw TypeError("name must be a string");var t=this.values[e];if(null==t)throw Error("name '"+e+"' does not exist in "+this);return delete this.valuesById[t],delete this.values[e],delete this.comments[e],this},o.prototype.isReservedId=function(e){return i.isReservedId(this.reserved,e)},o.prototype.isReservedName=function(e){return i.isReservedName(this.reserved,e)}},866:(e,t,r)=>{"use strict";e.exports=l;var n=r(1160);((l.prototype=Object.create(n.prototype)).constructor=l).className="Field";var i,s=r(6199),o=r(4653),a=r(5399),c=/^required|optional|repeated$/;function l(e,t,r,i,s,l,u){if(a.isObject(i)?(u=s,l=i,i=s=void 0):a.isObject(s)&&(u=l,l=s,s=void 0),n.call(this,e,l),!a.isInteger(t)||t<0)throw TypeError("id must be a non-negative integer");if(!a.isString(r))throw TypeError("type must be a string");if(void 0!==i&&!c.test(i=i.toString().toLowerCase()))throw TypeError("rule must be a string rule");if(void 0!==s&&!a.isString(s))throw TypeError("extend must be a string");"proto3_optional"===i&&(i="optional"),this.rule=i&&"optional"!==i?i:void 0,this.type=r,this.id=t,this.extend=s||void 0,this.required="required"===i,this.optional=!this.required,this.repeated="repeated"===i,this.map=!1,this.message=null,this.partOf=null,this.typeDefault=null,this.defaultValue=null,this.long=!!a.Long&&void 0!==o.long[r],this.bytes="bytes"===r,this.resolvedType=null,this.extensionField=null,this.declaringField=null,this._packed=null,this.comment=u}l.fromJSON=function(e,t){return new l(e,t.id,t.type,t.rule,t.extend,t.options,t.comment)},Object.defineProperty(l.prototype,"packed",{get:function(){return null===this._packed&&(this._packed=!1!==this.getOption("packed")),this._packed}}),l.prototype.setOption=function(e,t,r){return"packed"===e&&(this._packed=null),n.prototype.setOption.call(this,e,t,r)},l.prototype.toJSON=function(e){var t=!!e&&Boolean(e.keepComments);return a.toObject(["rule","optional"!==this.rule&&this.rule||void 0,"type",this.type,"id",this.id,"extend",this.extend,"options",this.options,"comment",t?this.comment:void 0])},l.prototype.resolve=function(){if(this.resolved)return this;if(void 0===(this.typeDefault=o.defaults[this.type])?(this.resolvedType=(this.declaringField?this.declaringField.parent:this.parent).lookupTypeOrEnum(this.type),this.resolvedType instanceof i?this.typeDefault=null:this.typeDefault=this.resolvedType.values[Object.keys(this.resolvedType.values)[0]]):this.options&&this.options.proto3_optional&&(this.typeDefault=null),this.options&&null!=this.options.default&&(this.typeDefault=this.options.default,this.resolvedType instanceof s&&"string"===typeof this.typeDefault&&(this.typeDefault=this.resolvedType.values[this.typeDefault])),this.options&&(!0!==this.options.packed&&(void 0===this.options.packed||!this.resolvedType||this.resolvedType instanceof s)||delete this.options.packed,Object.keys(this.options).length||(this.options=void 0)),this.long)this.typeDefault=a.Long.fromNumber(this.typeDefault,"u"===this.type.charAt(0)),Object.freeze&&Object.freeze(this.typeDefault);else if(this.bytes&&"string"===typeof this.typeDefault){var e;a.base64.test(this.typeDefault)?a.base64.decode(this.typeDefault,e=a.newBuffer(a.base64.length(this.typeDefault)),0):a.utf8.write(this.typeDefault,e=a.newBuffer(a.utf8.length(this.typeDefault)),0),this.typeDefault=e}return this.map?this.defaultValue=a.emptyObject:this.repeated?this.defaultValue=a.emptyArray:this.defaultValue=this.typeDefault,this.parent instanceof i&&(this.parent.ctor.prototype[this.name]=this.defaultValue),n.prototype.resolve.call(this)},l.d=function(e,t,r,n){return"function"===typeof t?t=a.decorateType(t).name:t&&"object"===typeof t&&(t=a.decorateEnum(t).name),function(i,s){a.decorateType(i.constructor).add(new l(s,e,t,r,{default:n}))}},l._configure=function(e){i=e}},5081:(e,t,r)=>{"use strict";var n=e.exports=r(624);n.build="light",n.load=function(e,t,r){return"function"===typeof t?(r=t,t=new n.Root):t||(t=new n.Root),t.load(e,r)},n.loadSync=function(e,t){return t||(t=new n.Root),t.loadSync(e)},n.encoder=r(9979),n.decoder=r(6922),n.verifier=r(9554),n.converter=r(8331),n.ReflectionObject=r(1160),n.Namespace=r(3703),n.Root=r(7783),n.Enum=r(6199),n.Type=r(1262),n.Field=r(866),n.OneOf=r(6488),n.MapField=r(3947),n.Service=r(4784),n.Method=r(180),n.Message=r(5032),n.wrappers=r(3014),n.types=r(4653),n.util=r(5399),n.ReflectionObject._configure(n.Root),n.Namespace._configure(n.Type,n.Service,n.Enum),n.Root._configure(n.Type),n.Field._configure(n.Type)},624:(e,t,r)=>{"use strict";var n=t;function i(){n.util._configure(),n.Writer._configure(n.BufferWriter),n.Reader._configure(n.BufferReader)}n.build="minimal",n.Writer=r(3461),n.BufferWriter=r(1223),n.Reader=r(4382),n.BufferReader=r(8536),n.util=r(9584),n.rpc=r(6403),n.roots=r(8231),n.configure=i,i()},9131:(e,t,r)=>{"use strict";var n=e.exports=r(5081);n.build="full",n.tokenize=r(9879),n.parse=r(5250),n.common=r(6130),n.Root._configure(n.Type,n.parse,n.common)},3947:(e,t,r)=>{"use strict";e.exports=o;var n=r(866);((o.prototype=Object.create(n.prototype)).constructor=o).className="MapField";var i=r(4653),s=r(5399);function o(e,t,r,i,o,a){if(n.call(this,e,t,i,void 0,void 0,o,a),!s.isString(r))throw TypeError("keyType must be a string");this.keyType=r,this.resolvedKeyType=null,this.map=!0}o.fromJSON=function(e,t){return new o(e,t.id,t.keyType,t.type,t.options,t.comment)},o.prototype.toJSON=function(e){var t=!!e&&Boolean(e.keepComments);return s.toObject(["keyType",this.keyType,"type",this.type,"id",this.id,"extend",this.extend,"options",this.options,"comment",t?this.comment:void 0])},o.prototype.resolve=function(){if(this.resolved)return this;if(void 0===i.mapKey[this.keyType])throw Error("invalid key type: "+this.keyType);return n.prototype.resolve.call(this)},o.d=function(e,t,r){return"function"===typeof r?r=s.decorateType(r).name:r&&"object"===typeof r&&(r=s.decorateEnum(r).name),function(n,i){s.decorateType(n.constructor).add(new o(i,e,t,r))}}},5032:(e,t,r)=>{"use strict";e.exports=i;var n=r(9584);function i(e){if(e)for(var t=Object.keys(e),r=0;r<t.length;++r)this[t[r]]=e[t[r]]}i.create=function(e){return this.$type.create(e)},i.encode=function(e,t){return this.$type.encode(e,t)},i.encodeDelimited=function(e,t){return this.$type.encodeDelimited(e,t)},i.decode=function(e){return this.$type.decode(e)},i.decodeDelimited=function(e){return this.$type.decodeDelimited(e)},i.verify=function(e){return this.$type.verify(e)},i.fromObject=function(e){return this.$type.fromObject(e)},i.toObject=function(e,t){return this.$type.toObject(e,t)},i.prototype.toJSON=function(){return this.$type.toObject(this,n.toJSONOptions)}},180:(e,t,r)=>{"use strict";e.exports=s;var n=r(1160);((s.prototype=Object.create(n.prototype)).constructor=s).className="Method";var i=r(5399);function s(e,t,r,s,o,a,c,l,u){if(i.isObject(o)?(c=o,o=a=void 0):i.isObject(a)&&(c=a,a=void 0),void 0!==t&&!i.isString(t))throw TypeError("type must be a string");if(!i.isString(r))throw TypeError("requestType must be a string");if(!i.isString(s))throw TypeError("responseType must be a string");n.call(this,e,c),this.type=t||"rpc",this.requestType=r,this.requestStream=!!o||void 0,this.responseType=s,this.responseStream=!!a||void 0,this.resolvedRequestType=null,this.resolvedResponseType=null,this.comment=l,this.parsedOptions=u}s.fromJSON=function(e,t){return new s(e,t.type,t.requestType,t.responseType,t.requestStream,t.responseStream,t.options,t.comment,t.parsedOptions)},s.prototype.toJSON=function(e){var t=!!e&&Boolean(e.keepComments);return i.toObject(["type","rpc"!==this.type&&this.type||void 0,"requestType",this.requestType,"requestStream",this.requestStream,"responseType",this.responseType,"responseStream",this.responseStream,"options",this.options,"comment",t?this.comment:void 0,"parsedOptions",this.parsedOptions])},s.prototype.resolve=function(){return this.resolved?this:(this.resolvedRequestType=this.parent.lookupType(this.requestType),this.resolvedResponseType=this.parent.lookupType(this.responseType),n.prototype.resolve.call(this))}},3703:(e,t,r)=>{"use strict";e.exports=u;var n=r(1160);((u.prototype=Object.create(n.prototype)).constructor=u).className="Namespace";var i,s,o,a=r(866),c=r(5399);function l(e,t){if(e&&e.length){for(var r={},n=0;n<e.length;++n)r[e[n].name]=e[n].toJSON(t);return r}}function u(e,t){n.call(this,e,t),this.nested=void 0,this._nestedArray=null}function h(e){return e._nestedArray=null,e}u.fromJSON=function(e,t){return new u(e,t.options).addJSON(t.nested)},u.arrayToJSON=l,u.isReservedId=function(e,t){if(e)for(var r=0;r<e.length;++r)if("string"!==typeof e[r]&&e[r][0]<=t&&e[r][1]>t)return!0;return!1},u.isReservedName=function(e,t){if(e)for(var r=0;r<e.length;++r)if(e[r]===t)return!0;return!1},Object.defineProperty(u.prototype,"nestedArray",{get:function(){return this._nestedArray||(this._nestedArray=c.toArray(this.nested))}}),u.prototype.toJSON=function(e){return c.toObject(["options",this.options,"nested",l(this.nestedArray,e)])},u.prototype.addJSON=function(e){if(e)for(var t,r=Object.keys(e),n=0;n<r.length;++n)t=e[r[n]],this.add((void 0!==t.fields?i.fromJSON:void 0!==t.values?o.fromJSON:void 0!==t.methods?s.fromJSON:void 0!==t.id?a.fromJSON:u.fromJSON)(r[n],t));return this},u.prototype.get=function(e){return this.nested&&this.nested[e]||null},u.prototype.getEnum=function(e){if(this.nested&&this.nested[e]instanceof o)return this.nested[e].values;throw Error("no such enum: "+e)},u.prototype.add=function(e){if(!(e instanceof a&&void 0!==e.extend||e instanceof i||e instanceof o||e instanceof s||e instanceof u))throw TypeError("object must be a valid nested object");if(this.nested){var t=this.get(e.name);if(t){if(!(t instanceof u&&e instanceof u)||t instanceof i||t instanceof s)throw Error("duplicate name '"+e.name+"' in "+this);for(var r=t.nestedArray,n=0;n<r.length;++n)e.add(r[n]);this.remove(t),this.nested||(this.nested={}),e.setOptions(t.options,!0)}}else this.nested={};return this.nested[e.name]=e,e.onAdd(this),h(this)},u.prototype.remove=function(e){if(!(e instanceof n))throw TypeError("object must be a ReflectionObject");if(e.parent!==this)throw Error(e+" is not a member of "+this);return delete this.nested[e.name],Object.keys(this.nested).length||(this.nested=void 0),e.onRemove(this),h(this)},u.prototype.define=function(e,t){if(c.isString(e))e=e.split(".");else if(!Array.isArray(e))throw TypeError("illegal path");if(e&&e.length&&""===e[0])throw Error("path must be relative");for(var r=this;e.length>0;){var n=e.shift();if(r.nested&&r.nested[n]){if(!((r=r.nested[n])instanceof u))throw Error("path conflicts with non-namespace objects")}else r.add(r=new u(n))}return t&&r.addJSON(t),r},u.prototype.resolveAll=function(){for(var e=this.nestedArray,t=0;t<e.length;)e[t]instanceof u?e[t++].resolveAll():e[t++].resolve();return this.resolve()},u.prototype.lookup=function(e,t,r){if("boolean"===typeof t?(r=t,t=void 0):t&&!Array.isArray(t)&&(t=[t]),c.isString(e)&&e.length){if("."===e)return this.root;e=e.split(".")}else if(!e.length)return this;if(""===e[0])return this.root.lookup(e.slice(1),t);var n=this.get(e[0]);if(n){if(1===e.length){if(!t||t.indexOf(n.constructor)>-1)return n}else if(n instanceof u&&(n=n.lookup(e.slice(1),t,!0)))return n}else for(var i=0;i<this.nestedArray.length;++i)if(this._nestedArray[i]instanceof u&&(n=this._nestedArray[i].lookup(e,t,!0)))return n;return null===this.parent||r?null:this.parent.lookup(e,t)},u.prototype.lookupType=function(e){var t=this.lookup(e,[i]);if(!t)throw Error("no such type: "+e);return t},u.prototype.lookupEnum=function(e){var t=this.lookup(e,[o]);if(!t)throw Error("no such Enum '"+e+"' in "+this);return t},u.prototype.lookupTypeOrEnum=function(e){var t=this.lookup(e,[i,o]);if(!t)throw Error("no such Type or Enum '"+e+"' in "+this);return t},u.prototype.lookupService=function(e){var t=this.lookup(e,[s]);if(!t)throw Error("no such Service '"+e+"' in "+this);return t},u._configure=function(e,t,r){i=e,s=t,o=r}},1160:(e,t,r)=>{"use strict";e.exports=s,s.className="ReflectionObject";var n,i=r(5399);function s(e,t){if(!i.isString(e))throw TypeError("name must be a string");if(t&&!i.isObject(t))throw TypeError("options must be an object");this.options=t,this.parsedOptions=null,this.name=e,this.parent=null,this.resolved=!1,this.comment=null,this.filename=null}Object.defineProperties(s.prototype,{root:{get:function(){for(var e=this;null!==e.parent;)e=e.parent;return e}},fullName:{get:function(){for(var e=[this.name],t=this.parent;t;)e.unshift(t.name),t=t.parent;return e.join(".")}}}),s.prototype.toJSON=function(){throw Error()},s.prototype.onAdd=function(e){this.parent&&this.parent!==e&&this.parent.remove(this),this.parent=e,this.resolved=!1;var t=e.root;t instanceof n&&t._handleAdd(this)},s.prototype.onRemove=function(e){var t=e.root;t instanceof n&&t._handleRemove(this),this.parent=null,this.resolved=!1},s.prototype.resolve=function(){return this.resolved||this.root instanceof n&&(this.resolved=!0),this},s.prototype.getOption=function(e){if(this.options)return this.options[e]},s.prototype.setOption=function(e,t,r){return r&&this.options&&void 0!==this.options[e]||((this.options||(this.options={}))[e]=t),this},s.prototype.setParsedOption=function(e,t,r){this.parsedOptions||(this.parsedOptions=[]);var n=this.parsedOptions;if(r){var s=n.find((function(t){return Object.prototype.hasOwnProperty.call(t,e)}));if(s){var o=s[e];i.setProperty(o,r,t)}else(s={})[e]=i.setProperty({},r,t),n.push(s)}else{var a={};a[e]=t,n.push(a)}return this},s.prototype.setOptions=function(e,t){if(e)for(var r=Object.keys(e),n=0;n<r.length;++n)this.setOption(r[n],e[r[n]],t);return this},s.prototype.toString=function(){var e=this.constructor.className,t=this.fullName;return t.length?e+" "+t:e},s._configure=function(e){n=e}},6488:(e,t,r)=>{"use strict";e.exports=o;var n=r(1160);((o.prototype=Object.create(n.prototype)).constructor=o).className="OneOf";var i=r(866),s=r(5399);function o(e,t,r,i){if(Array.isArray(t)||(r=t,t=void 0),n.call(this,e,r),void 0!==t&&!Array.isArray(t))throw TypeError("fieldNames must be an Array");this.oneof=t||[],this.fieldsArray=[],this.comment=i}function a(e){if(e.parent)for(var t=0;t<e.fieldsArray.length;++t)e.fieldsArray[t].parent||e.parent.add(e.fieldsArray[t])}o.fromJSON=function(e,t){return new o(e,t.oneof,t.options,t.comment)},o.prototype.toJSON=function(e){var t=!!e&&Boolean(e.keepComments);return s.toObject(["options",this.options,"oneof",this.oneof,"comment",t?this.comment:void 0])},o.prototype.add=function(e){if(!(e instanceof i))throw TypeError("field must be a Field");return e.parent&&e.parent!==this.parent&&e.parent.remove(e),this.oneof.push(e.name),this.fieldsArray.push(e),e.partOf=this,a(this),this},o.prototype.remove=function(e){if(!(e instanceof i))throw TypeError("field must be a Field");var t=this.fieldsArray.indexOf(e);if(t<0)throw Error(e+" is not a member of "+this);return this.fieldsArray.splice(t,1),(t=this.oneof.indexOf(e.name))>-1&&this.oneof.splice(t,1),e.partOf=null,this},o.prototype.onAdd=function(e){n.prototype.onAdd.call(this,e);for(var t=0;t<this.oneof.length;++t){var r=e.get(this.oneof[t]);r&&!r.partOf&&(r.partOf=this,this.fieldsArray.push(r))}a(this)},o.prototype.onRemove=function(e){for(var t,r=0;r<this.fieldsArray.length;++r)(t=this.fieldsArray[r]).parent&&t.parent.remove(t);n.prototype.onRemove.call(this,e)},o.d=function(){for(var e=new Array(arguments.length),t=0;t<arguments.length;)e[t]=arguments[t++];return function(t,r){s.decorateType(t.constructor).add(new o(r,e)),Object.defineProperty(t,r,{get:s.oneOfGetter(e),set:s.oneOfSetter(e)})}}},5250:(e,t,r)=>{"use strict";e.exports=I,I.filename=null,I.defaults={keepCase:!1};var n=r(9879),i=r(7783),s=r(1262),o=r(866),a=r(3947),c=r(6488),l=r(6199),u=r(4784),h=r(180),d=r(4653),f=r(5399),p=/^[1-9][0-9]*$/,y=/^-?[1-9][0-9]*$/,g=/^0[x][0-9a-fA-F]+$/,m=/^-?0[x][0-9a-fA-F]+$/,v=/^0[0-7]+$/,b=/^-?0[0-7]+$/,w=/^(?![eE])[0-9]*(?:\.[0-9]*)?(?:[eE][+-]?[0-9]+)?$/,E=/^[a-zA-Z_][a-zA-Z_0-9]*$/,_=/^(?:\.?[a-zA-Z_][a-zA-Z_0-9]*)(?:\.[a-zA-Z_][a-zA-Z_0-9]*)*$/,S=/^(?:\.[a-zA-Z_][a-zA-Z_0-9]*)+$/;function I(e,t,r){t instanceof i||(r=t,t=new i),r||(r=I.defaults);var C,A,T,k,R,P=r.preferTrailingComment||!1,D=n(e,r.alternateCommentMode||!1),N=D.next,x=D.push,L=D.peek,O=D.skip,B=D.cmnt,M=!0,U=!1,F=t,V=r.keepCase?function(e){return e}:f.camelCase;function j(e,t,r){var n=I.filename;return r||(I.filename=null),Error("illegal "+(t||"token")+" '"+e+"' ("+(n?n+", ":"")+"line "+D.line+")")}function K(){var e,t=[];do{if('"'!==(e=N())&&"'"!==e)throw j(e);t.push(N()),O(e),e=L()}while('"'===e||"'"===e);return t.join("")}function q(e){var t=N();switch(t){case"'":case'"':return x(t),K();case"true":case"TRUE":return!0;case"false":case"FALSE":return!1}try{return function(e,t){var r=1;"-"===e.charAt(0)&&(r=-1,e=e.substring(1));switch(e){case"inf":case"INF":case"Inf":return r*(1/0);case"nan":case"NAN":case"Nan":case"NaN":return NaN;case"0":return 0}if(p.test(e))return r*parseInt(e,10);if(g.test(e))return r*parseInt(e,16);if(v.test(e))return r*parseInt(e,8);if(w.test(e))return r*parseFloat(e);throw j(e,"number",t)}(t,!0)}catch(r){if(e&&_.test(t))return t;throw j(t,"value")}}function z(e,t){var r,n;do{!t||'"'!==(r=L())&&"'"!==r?e.push([n=H(N()),O("to",!0)?H(N()):n]):e.push(K())}while(O(",",!0));O(";")}function H(e,t){switch(e){case"max":case"MAX":case"Max":return 536870911;case"0":return 0}if(!t&&"-"===e.charAt(0))throw j(e,"id");if(y.test(e))return parseInt(e,10);if(m.test(e))return parseInt(e,16);if(b.test(e))return parseInt(e,8);throw j(e,"id")}function W(){if(void 0!==C)throw j("package");if(C=N(),!_.test(C))throw j(C,"name");F=F.define(C),O(";")}function G(){var e,t=L();switch(t){case"weak":e=T||(T=[]),N();break;case"public":N();default:e=A||(A=[])}t=K(),O(";"),e.push(t)}function Q(){if(O("="),k=K(),!(U="proto3"===k)&&"proto2"!==k)throw j(k,"syntax");O(";")}function Y(e,t){switch(t){case"option":return J(e,t),O(";"),!0;case"message":return function(e,t){if(!E.test(t=N()))throw j(t,"type name");var r=new s(t);$(r,(function(e){if(!Y(r,e))switch(e){case"map":!function(e){O("<");var t=N();if(void 0===d.mapKey[t])throw j(t,"type");O(",");var r=N();if(!_.test(r))throw j(r,"type");O(">");var n=N();if(!E.test(n))throw j(n,"name");O("=");var i=new a(V(n),H(N()),t,r);$(i,(function(e){if("option"!==e)throw j(e);J(i,e),O(";")}),(function(){te(i)})),e.add(i)}(r);break;case"required":case"repeated":X(r,e);break;case"optional":X(r,U?"proto3_optional":"optional");break;case"oneof":!function(e,t){if(!E.test(t=N()))throw j(t,"name");var r=new c(V(t));$(r,(function(e){"option"===e?(J(r,e),O(";")):(x(e),X(r,"optional"))})),e.add(r)}(r,e);break;case"extensions":z(r.extensions||(r.extensions=[]));break;case"reserved":z(r.reserved||(r.reserved=[]),!0);break;default:if(!U||!_.test(e))throw j(e);x(e),X(r,"optional")}})),e.add(r)}(e,t),!0;case"enum":return function(e,t){if(!E.test(t=N()))throw j(t,"name");var r=new l(t);$(r,(function(e){switch(e){case"option":J(r,e),O(";");break;case"reserved":z(r.reserved||(r.reserved=[]),!0);break;default:!function(e,t){if(!E.test(t))throw j(t,"name");O("=");var r=H(N(),!0),n={};$(n,(function(e){if("option"!==e)throw j(e);J(n,e),O(";")}),(function(){te(n)})),e.add(t,r,n.comment)}(r,e)}})),e.add(r)}(e,t),!0;case"service":return function(e,t){if(!E.test(t=N()))throw j(t,"service name");var r=new u(t);$(r,(function(e){if(!Y(r,e)){if("rpc"!==e)throw j(e);!function(e,t){var r=B(),n=t;if(!E.test(t=N()))throw j(t,"name");var i,s,o,a,c=t;O("("),O("stream",!0)&&(s=!0);if(!_.test(t=N()))throw j(t);i=t,O(")"),O("returns"),O("("),O("stream",!0)&&(a=!0);if(!_.test(t=N()))throw j(t);o=t,O(")");var l=new h(c,n,i,o,s,a);l.comment=r,$(l,(function(e){if("option"!==e)throw j(e);J(l,e),O(";")})),e.add(l)}(r,e)}})),e.add(r)}(e,t),!0;case"extend":return function(e,t){if(!_.test(t=N()))throw j(t,"reference");var r=t;$(null,(function(t){switch(t){case"required":case"repeated":X(e,t,r);break;case"optional":X(e,U?"proto3_optional":"optional",r);break;default:if(!U||!_.test(t))throw j(t);x(t),X(e,"optional",r)}}))}(e,t),!0}return!1}function $(e,t,r){var n=D.line;if(e&&("string"!==typeof e.comment&&(e.comment=B()),e.filename=I.filename),O("{",!0)){for(var i;"}"!==(i=N());)t(i);O(";",!0)}else r&&r(),O(";"),e&&("string"!==typeof e.comment||P)&&(e.comment=B(n)||e.comment)}function X(e,t,r){var n=N();if("group"!==n){if(!_.test(n))throw j(n,"type");var i=N();if(!E.test(i))throw j(i,"name");i=V(i),O("=");var a=new o(i,H(N()),n,t,r);if($(a,(function(e){if("option"!==e)throw j(e);J(a,e),O(";")}),(function(){te(a)})),"proto3_optional"===t){var l=new c("_"+i);a.setOption("proto3_optional",!0),l.add(a),e.add(l)}else e.add(a);U||!a.repeated||void 0===d.packed[n]&&void 0!==d.basic[n]||a.setOption("packed",!1,!0)}else!function(e,t){var r=N();if(!E.test(r))throw j(r,"name");var n=f.lcFirst(r);r===n&&(r=f.ucFirst(r));O("=");var i=H(N()),a=new s(r);a.group=!0;var c=new o(n,i,r,t);c.filename=I.filename,$(a,(function(e){switch(e){case"option":J(a,e),O(";");break;case"required":case"repeated":X(a,e);break;case"optional":X(a,U?"proto3_optional":"optional");break;default:throw j(e)}})),e.add(a).add(c)}(e,t)}function J(e,t){var r=O("(",!0);if(!_.test(t=N()))throw j(t,"name");var n,i=t,s=i;r&&(O(")"),s=i="("+i+")",t=L(),S.test(t)&&(n=t.slice(1),i+=t,N())),O("="),function(e,t,r,n){e.setParsedOption&&e.setParsedOption(t,r,n)}(e,s,Z(e,i),n)}function Z(e,t){if(O("{",!0)){for(var r={};!O("}",!0);){if(!E.test(R=N()))throw j(R,"name");var n,i=R;if(O(":",!0),"{"===L())n=Z(e,t+"."+R);else if("["===L()){var s;if(n=[],O("[",!0)){do{s=q(!0),n.push(s)}while(O(",",!0));O("]"),"undefined"!==typeof s&&ee(e,t+"."+R,s)}}else n=q(!0),ee(e,t+"."+R,n);var o=r[i];o&&(n=[].concat(o).concat(n)),r[i]=n,O(",",!0),O(";",!0)}return r}var a=q(!0);return ee(e,t,a),a}function ee(e,t,r){e.setOption&&e.setOption(t,r)}function te(e){if(O("[",!0)){do{J(e,"option")}while(O(",",!0));O("]")}return e}for(;null!==(R=N());)switch(R){case"package":if(!M)throw j(R);W();break;case"import":if(!M)throw j(R);G();break;case"syntax":if(!M)throw j(R);Q();break;case"option":J(F,R),O(";");break;default:if(Y(F,R)){M=!1;continue}throw j(R)}return I.filename=null,{package:C,imports:A,weakImports:T,syntax:k,root:t}}},4382:(e,t,r)=>{"use strict";e.exports=c;var n,i=r(9584),s=i.LongBits,o=i.utf8;function a(e,t){return RangeError("index out of range: "+e.pos+" + "+(t||1)+" > "+e.len)}function c(e){this.buf=e,this.pos=0,this.len=e.length}var l="undefined"!==typeof Uint8Array?function(e){if(e instanceof Uint8Array||Array.isArray(e))return new c(e);throw Error("illegal buffer")}:function(e){if(Array.isArray(e))return new c(e);throw Error("illegal buffer")},u=function(){return i.Buffer?function(e){return(c.create=function(e){return i.Buffer.isBuffer(e)?new n(e):l(e)})(e)}:l};function h(){var e=new s(0,0),t=0;if(!(this.len-this.pos>4)){for(;t<3;++t){if(this.pos>=this.len)throw a(this);if(e.lo=(e.lo|(127&this.buf[this.pos])<<7*t)>>>0,this.buf[this.pos++]<128)return e}return e.lo=(e.lo|(127&this.buf[this.pos++])<<7*t)>>>0,e}for(;t<4;++t)if(e.lo=(e.lo|(127&this.buf[this.pos])<<7*t)>>>0,this.buf[this.pos++]<128)return e;if(e.lo=(e.lo|(127&this.buf[this.pos])<<28)>>>0,e.hi=(e.hi|(127&this.buf[this.pos])>>4)>>>0,this.buf[this.pos++]<128)return e;if(t=0,this.len-this.pos>4){for(;t<5;++t)if(e.hi=(e.hi|(127&this.buf[this.pos])<<7*t+3)>>>0,this.buf[this.pos++]<128)return e}else for(;t<5;++t){if(this.pos>=this.len)throw a(this);if(e.hi=(e.hi|(127&this.buf[this.pos])<<7*t+3)>>>0,this.buf[this.pos++]<128)return e}throw Error("invalid varint encoding")}function d(e,t){return(e[t-4]|e[t-3]<<8|e[t-2]<<16|e[t-1]<<24)>>>0}function f(){if(this.pos+8>this.len)throw a(this,8);return new s(d(this.buf,this.pos+=4),d(this.buf,this.pos+=4))}c.create=u(),c.prototype._slice=i.Array.prototype.subarray||i.Array.prototype.slice,c.prototype.uint32=function(){var e=4294967295;return function(){if(e=(127&this.buf[this.pos])>>>0,this.buf[this.pos++]<128)return e;if(e=(e|(127&this.buf[this.pos])<<7)>>>0,this.buf[this.pos++]<128)return e;if(e=(e|(127&this.buf[this.pos])<<14)>>>0,this.buf[this.pos++]<128)return e;if(e=(e|(127&this.buf[this.pos])<<21)>>>0,this.buf[this.pos++]<128)return e;if(e=(e|(15&this.buf[this.pos])<<28)>>>0,this.buf[this.pos++]<128)return e;if((this.pos+=5)>this.len)throw this.pos=this.len,a(this,10);return e}}(),c.prototype.int32=function(){return 0|this.uint32()},c.prototype.sint32=function(){var e=this.uint32();return e>>>1^-(1&e)|0},c.prototype.bool=function(){return 0!==this.uint32()},c.prototype.fixed32=function(){if(this.pos+4>this.len)throw a(this,4);return d(this.buf,this.pos+=4)},c.prototype.sfixed32=function(){if(this.pos+4>this.len)throw a(this,4);return 0|d(this.buf,this.pos+=4)},c.prototype.float=function(){if(this.pos+4>this.len)throw a(this,4);var e=i.float.readFloatLE(this.buf,this.pos);return this.pos+=4,e},c.prototype.double=function(){if(this.pos+8>this.len)throw a(this,4);var e=i.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,e},c.prototype.bytes=function(){var e=this.uint32(),t=this.pos,r=this.pos+e;if(r>this.len)throw a(this,e);return this.pos+=e,Array.isArray(this.buf)?this.buf.slice(t,r):t===r?new this.buf.constructor(0):this._slice.call(this.buf,t,r)},c.prototype.string=function(){var e=this.bytes();return o.read(e,0,e.length)},c.prototype.skip=function(e){if("number"===typeof e){if(this.pos+e>this.len)throw a(this,e);this.pos+=e}else do{if(this.pos>=this.len)throw a(this)}while(128&this.buf[this.pos++]);return this},c.prototype.skipType=function(e){switch(e){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;4!==(e=7&this.uint32());)this.skipType(e);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+e+" at offset "+this.pos)}return this},c._configure=function(e){n=e,c.create=u(),n._configure();var t=i.Long?"toLong":"toNumber";i.merge(c.prototype,{int64:function(){return h.call(this)[t](!1)},uint64:function(){return h.call(this)[t](!0)},sint64:function(){return h.call(this).zzDecode()[t](!1)},fixed64:function(){return f.call(this)[t](!0)},sfixed64:function(){return f.call(this)[t](!1)}})}},8536:(e,t,r)=>{"use strict";e.exports=s;var n=r(4382);(s.prototype=Object.create(n.prototype)).constructor=s;var i=r(9584);function s(e){n.call(this,e)}s._configure=function(){i.Buffer&&(s.prototype._slice=i.Buffer.prototype.slice)},s.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))},s._configure()},7783:(e,t,r)=>{"use strict";e.exports=h;var n=r(3703);((h.prototype=Object.create(n.prototype)).constructor=h).className="Root";var i,s,o,a=r(866),c=r(6199),l=r(6488),u=r(5399);function h(e){n.call(this,"",e),this.deferred=[],this.files=[]}function d(){}h.fromJSON=function(e,t){return t||(t=new h),e.options&&t.setOptions(e.options),t.addJSON(e.nested)},h.prototype.resolvePath=u.path.resolve,h.prototype.fetch=u.fetch,h.prototype.load=function e(t,r,n){"function"===typeof r&&(n=r,r=void 0);var i=this;if(!n)return u.asPromise(e,i,t,r);var a=n===d;function c(e,t){if(n){var r=n;if(n=null,a)throw e;r(e,t)}}function l(e){var t=e.lastIndexOf("google/protobuf/");if(t>-1){var r=e.substring(t);if(r in o)return r}return null}function h(e,t){try{if(u.isString(t)&&"{"===t.charAt(0)&&(t=JSON.parse(t)),u.isString(t)){s.filename=e;var n,o=s(t,i,r),h=0;if(o.imports)for(;h<o.imports.length;++h)(n=l(o.imports[h])||i.resolvePath(e,o.imports[h]))&&f(n);if(o.weakImports)for(h=0;h<o.weakImports.length;++h)(n=l(o.weakImports[h])||i.resolvePath(e,o.weakImports[h]))&&f(n,!0)}else i.setOptions(t.options).addJSON(t.nested)}catch(d){c(d)}a||p||c(null,i)}function f(e,t){if(!(i.files.indexOf(e)>-1))if(i.files.push(e),e in o)a?h(e,o[e]):(++p,setTimeout((function(){--p,h(e,o[e])})));else if(a){var r;try{r=u.fs.readFileSync(e).toString("utf8")}catch(s){return void(t||c(s))}h(e,r)}else++p,i.fetch(e,(function(r,s){--p,n&&(r?t?p||c(null,i):c(r):h(e,s))}))}var p=0;u.isString(t)&&(t=[t]);for(var y,g=0;g<t.length;++g)(y=i.resolvePath("",t[g]))&&f(y);if(a)return i;p||c(null,i)},h.prototype.loadSync=function(e,t){if(!u.isNode)throw Error("not supported");return this.load(e,t,d)},h.prototype.resolveAll=function(){if(this.deferred.length)throw Error("unresolvable extensions: "+this.deferred.map((function(e){return"'extend "+e.extend+"' in "+e.parent.fullName})).join(", "));return n.prototype.resolveAll.call(this)};var f=/^[A-Z]/;function p(e,t){var r=t.parent.lookup(t.extend);if(r){var n=new a(t.fullName,t.id,t.type,t.rule,void 0,t.options);return n.declaringField=t,t.extensionField=n,r.add(n),!0}return!1}h.prototype._handleAdd=function(e){if(e instanceof a)void 0===e.extend||e.extensionField||p(0,e)||this.deferred.push(e);else if(e instanceof c)f.test(e.name)&&(e.parent[e.name]=e.values);else if(!(e instanceof l)){if(e instanceof i)for(var t=0;t<this.deferred.length;)p(0,this.deferred[t])?this.deferred.splice(t,1):++t;for(var r=0;r<e.nestedArray.length;++r)this._handleAdd(e._nestedArray[r]);f.test(e.name)&&(e.parent[e.name]=e)}},h.prototype._handleRemove=function(e){if(e instanceof a){if(void 0!==e.extend)if(e.extensionField)e.extensionField.parent.remove(e.extensionField),e.extensionField=null;else{var t=this.deferred.indexOf(e);t>-1&&this.deferred.splice(t,1)}}else if(e instanceof c)f.test(e.name)&&delete e.parent[e.name];else if(e instanceof n){for(var r=0;r<e.nestedArray.length;++r)this._handleRemove(e._nestedArray[r]);f.test(e.name)&&delete e.parent[e.name]}},h._configure=function(e,t,r){i=e,s=t,o=r}},8231:e=>{"use strict";e.exports={}},6403:(e,t,r)=>{"use strict";t.Service=r(7264)},7264:(e,t,r)=>{"use strict";e.exports=i;var n=r(9584);function i(e,t,r){if("function"!==typeof e)throw TypeError("rpcImpl must be a function");n.EventEmitter.call(this),this.rpcImpl=e,this.requestDelimited=Boolean(t),this.responseDelimited=Boolean(r)}(i.prototype=Object.create(n.EventEmitter.prototype)).constructor=i,i.prototype.rpcCall=function e(t,r,i,s,o){if(!s)throw TypeError("request must be specified");var a=this;if(!o)return n.asPromise(e,a,t,r,i,s);if(a.rpcImpl)try{return a.rpcImpl(t,r[a.requestDelimited?"encodeDelimited":"encode"](s).finish(),(function(e,r){if(e)return a.emit("error",e,t),o(e);if(null!==r){if(!(r instanceof i))try{r=i[a.responseDelimited?"decodeDelimited":"decode"](r)}catch(e){return a.emit("error",e,t),o(e)}return a.emit("data",r,t),o(null,r)}a.end(!0)}))}catch(c){return a.emit("error",c,t),void setTimeout((function(){o(c)}),0)}else setTimeout((function(){o(Error("already ended"))}),0)},i.prototype.end=function(e){return this.rpcImpl&&(e||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this}},4784:(e,t,r)=>{"use strict";e.exports=a;var n=r(3703);((a.prototype=Object.create(n.prototype)).constructor=a).className="Service";var i=r(180),s=r(5399),o=r(6403);function a(e,t){n.call(this,e,t),this.methods={},this._methodsArray=null}function c(e){return e._methodsArray=null,e}a.fromJSON=function(e,t){var r=new a(e,t.options);if(t.methods)for(var n=Object.keys(t.methods),s=0;s<n.length;++s)r.add(i.fromJSON(n[s],t.methods[n[s]]));return t.nested&&r.addJSON(t.nested),r.comment=t.comment,r},a.prototype.toJSON=function(e){var t=n.prototype.toJSON.call(this,e),r=!!e&&Boolean(e.keepComments);return s.toObject(["options",t&&t.options||void 0,"methods",n.arrayToJSON(this.methodsArray,e)||{},"nested",t&&t.nested||void 0,"comment",r?this.comment:void 0])},Object.defineProperty(a.prototype,"methodsArray",{get:function(){return this._methodsArray||(this._methodsArray=s.toArray(this.methods))}}),a.prototype.get=function(e){return this.methods[e]||n.prototype.get.call(this,e)},a.prototype.resolveAll=function(){for(var e=this.methodsArray,t=0;t<e.length;++t)e[t].resolve();return n.prototype.resolve.call(this)},a.prototype.add=function(e){if(this.get(e.name))throw Error("duplicate name '"+e.name+"' in "+this);return e instanceof i?(this.methods[e.name]=e,e.parent=this,c(this)):n.prototype.add.call(this,e)},a.prototype.remove=function(e){if(e instanceof i){if(this.methods[e.name]!==e)throw Error(e+" is not a member of "+this);return delete this.methods[e.name],e.parent=null,c(this)}return n.prototype.remove.call(this,e)},a.prototype.create=function(e,t,r){for(var n,i=new o.Service(e,t,r),a=0;a<this.methodsArray.length;++a){var c=s.lcFirst((n=this._methodsArray[a]).resolve().name).replace(/[^$\w_]/g,"");i[c]=s.codegen(["r","c"],s.isReserved(c)?c+"_":c)("return this.rpcCall(m,q,s,r,c)")({m:n,q:n.resolvedRequestType.ctor,s:n.resolvedResponseType.ctor})}return i}},9879:e=>{"use strict";e.exports=h;var t=/[\s{}=;:[\],'"()<>]/g,r=/(?:"([^"\\]*(?:\\.[^"\\]*)*)")/g,n=/(?:'([^'\\]*(?:\\.[^'\\]*)*)')/g,i=/^ *[*/]+ */,s=/^\s*\*?\/*/,o=/\n/g,a=/\s/,c=/\\(.?)/g,l={0:"\0",r:"\r",n:"\n",t:"\t"};function u(e){return e.replace(c,(function(e,t){switch(t){case"\\":case"":return t;default:return l[t]||""}}))}function h(e,c){e=e.toString();var l=0,h=e.length,d=1,f=0,p={},y=[],g=null;function m(e){return Error("illegal "+e+" (line "+d+")")}function v(t){return e.charAt(t)}function b(t,r,n){var a,l={type:e.charAt(t++),lineEmpty:!1,leading:n},u=t-(c?2:3);do{if(--u<0||"\n"===(a=e.charAt(u))){l.lineEmpty=!0;break}}while(" "===a||"\t"===a);for(var h=e.substring(t,r).split(o),y=0;y<h.length;++y)h[y]=h[y].replace(c?s:i,"").trim();l.text=h.join("\n").trim(),p[d]=l,f=d}function w(t){var r=E(t),n=e.substring(t,r);return/^\s*\/{1,2}/.test(n)}function E(e){for(var t=e;t<h&&"\n"!==v(t);)t++;return t}function _(){if(y.length>0)return y.shift();if(g)return function(){var t="'"===g?n:r;t.lastIndex=l-1;var i=t.exec(e);if(!i)throw m("string");return l=t.lastIndex,S(g),g=null,u(i[1])}();var i,s,o,f,p,_=0===l;do{if(l===h)return null;for(i=!1;a.test(o=v(l));)if("\n"===o&&(_=!0,++d),++l===h)return null;if("/"===v(l)){if(++l===h)throw m("comment");if("/"===v(l))if(c){if(f=l,p=!1,w(l)){p=!0;do{if((l=E(l))===h)break;if(l++,!_)break}while(w(l))}else l=Math.min(h,E(l)+1);p&&(b(f,l,_),_=!0),d++,i=!0}else{for(p="/"===v(f=l+1);"\n"!==v(++l);)if(l===h)return null;++l,p&&(b(f,l-1,_),_=!0),++d,i=!0}else{if("*"!==(o=v(l)))return"/";f=l+1,p=c||"*"===v(f);do{if("\n"===o&&++d,++l===h)throw m("comment");s=o,o=v(l)}while("*"!==s||"/"!==o);++l,p&&(b(f,l-2,_),_=!0),i=!0}}}while(i);var I=l;if(t.lastIndex=0,!t.test(v(I++)))for(;I<h&&!t.test(v(I));)++I;var C=e.substring(l,l=I);return'"'!==C&&"'"!==C||(g=C),C}function S(e){y.push(e)}function I(){if(!y.length){var e=_();if(null===e)return null;S(e)}return y[0]}return Object.defineProperty({next:_,peek:I,push:S,skip:function(e,t){var r=I();if(r===e)return _(),!0;if(!t)throw m("token '"+r+"', '"+e+"' expected");return!1},cmnt:function(e){var t,r=null;return void 0===e?(t=p[d-1],delete p[d-1],t&&(c||"*"===t.type||t.lineEmpty)&&(r=t.leading?t.text:null)):(f<e&&I(),t=p[e],delete p[e],!t||t.lineEmpty||!c&&"/"!==t.type||(r=t.leading?null:t.text)),r}},"line",{get:function(){return d}})}h.unescape=u},1262:(e,t,r)=>{"use strict";e.exports=v;var n=r(3703);((v.prototype=Object.create(n.prototype)).constructor=v).className="Type";var i=r(6199),s=r(6488),o=r(866),a=r(3947),c=r(4784),l=r(5032),u=r(4382),h=r(3461),d=r(5399),f=r(9979),p=r(6922),y=r(9554),g=r(8331),m=r(3014);function v(e,t){n.call(this,e,t),this.fields={},this.oneofs=void 0,this.extensions=void 0,this.reserved=void 0,this.group=void 0,this._fieldsById=null,this._fieldsArray=null,this._oneofsArray=null,this._ctor=null}function b(e){return e._fieldsById=e._fieldsArray=e._oneofsArray=null,delete e.encode,delete e.decode,delete e.verify,e}Object.defineProperties(v.prototype,{fieldsById:{get:function(){if(this._fieldsById)return this._fieldsById;this._fieldsById={};for(var e=Object.keys(this.fields),t=0;t<e.length;++t){var r=this.fields[e[t]],n=r.id;if(this._fieldsById[n])throw Error("duplicate id "+n+" in "+this);this._fieldsById[n]=r}return this._fieldsById}},fieldsArray:{get:function(){return this._fieldsArray||(this._fieldsArray=d.toArray(this.fields))}},oneofsArray:{get:function(){return this._oneofsArray||(this._oneofsArray=d.toArray(this.oneofs))}},ctor:{get:function(){return this._ctor||(this.ctor=v.generateConstructor(this)())},set:function(e){var t=e.prototype;t instanceof l||((e.prototype=new l).constructor=e,d.merge(e.prototype,t)),e.$type=e.prototype.$type=this,d.merge(e,l,!0),this._ctor=e;for(var r=0;r<this.fieldsArray.length;++r)this._fieldsArray[r].resolve();var n={};for(r=0;r<this.oneofsArray.length;++r)n[this._oneofsArray[r].resolve().name]={get:d.oneOfGetter(this._oneofsArray[r].oneof),set:d.oneOfSetter(this._oneofsArray[r].oneof)};r&&Object.defineProperties(e.prototype,n)}}}),v.generateConstructor=function(e){for(var t,r=d.codegen(["p"],e.name),n=0;n<e.fieldsArray.length;++n)(t=e._fieldsArray[n]).map?r("this%s={}",d.safeProp(t.name)):t.repeated&&r("this%s=[]",d.safeProp(t.name));return r("if(p)for(var ks=Object.keys(p),i=0;i<ks.length;++i)if(p[ks[i]]!=null)")("this[ks[i]]=p[ks[i]]")},v.fromJSON=function(e,t){var r=new v(e,t.options);r.extensions=t.extensions,r.reserved=t.reserved;for(var l=Object.keys(t.fields),u=0;u<l.length;++u)r.add(("undefined"!==typeof t.fields[l[u]].keyType?a.fromJSON:o.fromJSON)(l[u],t.fields[l[u]]));if(t.oneofs)for(l=Object.keys(t.oneofs),u=0;u<l.length;++u)r.add(s.fromJSON(l[u],t.oneofs[l[u]]));if(t.nested)for(l=Object.keys(t.nested),u=0;u<l.length;++u){var h=t.nested[l[u]];r.add((void 0!==h.id?o.fromJSON:void 0!==h.fields?v.fromJSON:void 0!==h.values?i.fromJSON:void 0!==h.methods?c.fromJSON:n.fromJSON)(l[u],h))}return t.extensions&&t.extensions.length&&(r.extensions=t.extensions),t.reserved&&t.reserved.length&&(r.reserved=t.reserved),t.group&&(r.group=!0),t.comment&&(r.comment=t.comment),r},v.prototype.toJSON=function(e){var t=n.prototype.toJSON.call(this,e),r=!!e&&Boolean(e.keepComments);return d.toObject(["options",t&&t.options||void 0,"oneofs",n.arrayToJSON(this.oneofsArray,e),"fields",n.arrayToJSON(this.fieldsArray.filter((function(e){return!e.declaringField})),e)||{},"extensions",this.extensions&&this.extensions.length?this.extensions:void 0,"reserved",this.reserved&&this.reserved.length?this.reserved:void 0,"group",this.group||void 0,"nested",t&&t.nested||void 0,"comment",r?this.comment:void 0])},v.prototype.resolveAll=function(){for(var e=this.fieldsArray,t=0;t<e.length;)e[t++].resolve();var r=this.oneofsArray;for(t=0;t<r.length;)r[t++].resolve();return n.prototype.resolveAll.call(this)},v.prototype.get=function(e){return this.fields[e]||this.oneofs&&this.oneofs[e]||this.nested&&this.nested[e]||null},v.prototype.add=function(e){if(this.get(e.name))throw Error("duplicate name '"+e.name+"' in "+this);if(e instanceof o&&void 0===e.extend){if(this._fieldsById?this._fieldsById[e.id]:this.fieldsById[e.id])throw Error("duplicate id "+e.id+" in "+this);if(this.isReservedId(e.id))throw Error("id "+e.id+" is reserved in "+this);if(this.isReservedName(e.name))throw Error("name '"+e.name+"' is reserved in "+this);return e.parent&&e.parent.remove(e),this.fields[e.name]=e,e.message=this,e.onAdd(this),b(this)}return e instanceof s?(this.oneofs||(this.oneofs={}),this.oneofs[e.name]=e,e.onAdd(this),b(this)):n.prototype.add.call(this,e)},v.prototype.remove=function(e){if(e instanceof o&&void 0===e.extend){if(!this.fields||this.fields[e.name]!==e)throw Error(e+" is not a member of "+this);return delete this.fields[e.name],e.parent=null,e.onRemove(this),b(this)}if(e instanceof s){if(!this.oneofs||this.oneofs[e.name]!==e)throw Error(e+" is not a member of "+this);return delete this.oneofs[e.name],e.parent=null,e.onRemove(this),b(this)}return n.prototype.remove.call(this,e)},v.prototype.isReservedId=function(e){return n.isReservedId(this.reserved,e)},v.prototype.isReservedName=function(e){return n.isReservedName(this.reserved,e)},v.prototype.create=function(e){return new this.ctor(e)},v.prototype.setup=function(){for(var e=this.fullName,t=[],r=0;r<this.fieldsArray.length;++r)t.push(this._fieldsArray[r].resolve().resolvedType);this.encode=f(this)({Writer:h,types:t,util:d}),this.decode=p(this)({Reader:u,types:t,util:d}),this.verify=y(this)({types:t,util:d}),this.fromObject=g.fromObject(this)({types:t,util:d}),this.toObject=g.toObject(this)({types:t,util:d});var n=m[e];if(n){var i=Object.create(this);i.fromObject=this.fromObject,this.fromObject=n.fromObject.bind(i),i.toObject=this.toObject,this.toObject=n.toObject.bind(i)}return this},v.prototype.encode=function(e,t){return this.setup().encode(e,t)},v.prototype.encodeDelimited=function(e,t){return this.encode(e,t&&t.len?t.fork():t).ldelim()},v.prototype.decode=function(e,t){return this.setup().decode(e,t)},v.prototype.decodeDelimited=function(e){return e instanceof u||(e=u.create(e)),this.decode(e,e.uint32())},v.prototype.verify=function(e){return this.setup().verify(e)},v.prototype.fromObject=function(e){return this.setup().fromObject(e)},v.prototype.toObject=function(e,t){return this.setup().toObject(e,t)},v.d=function(e){return function(t){d.decorateType(t,e)}}},4653:(e,t,r)=>{"use strict";var n=t,i=r(5399),s=["double","float","int32","uint32","sint32","fixed32","sfixed32","int64","uint64","sint64","fixed64","sfixed64","bool","string","bytes"];function o(e,t){var r=0,n={};for(t|=0;r<e.length;)n[s[r+t]]=e[r++];return n}n.basic=o([1,5,0,0,0,5,5,0,0,0,1,1,0,2,2]),n.defaults=o([0,0,0,0,0,0,0,0,0,0,0,0,!1,"",i.emptyArray,null]),n.long=o([0,0,0,1,1],7),n.mapKey=o([0,0,0,5,5,0,0,0,1,1,0,2],2),n.packed=o([1,5,0,0,0,5,5,0,0,0,1,1,0])},5399:(e,t,r)=>{"use strict";var n,i,s=e.exports=r(9584),o=r(8231);s.codegen=r(1035),s.fetch=r(1289),s.path=r(4022),s.fs=s.inquire("fs"),s.toArray=function(e){if(e){for(var t=Object.keys(e),r=new Array(t.length),n=0;n<t.length;)r[n]=e[t[n++]];return r}return[]},s.toObject=function(e){for(var t={},r=0;r<e.length;){var n=e[r++],i=e[r++];void 0!==i&&(t[n]=i)}return t};var a=/\\/g,c=/"/g;s.isReserved=function(e){return/^(?:do|if|in|for|let|new|try|var|case|else|enum|eval|false|null|this|true|void|with|break|catch|class|const|super|throw|while|yield|delete|export|import|public|return|static|switch|typeof|default|extends|finally|package|private|continue|debugger|function|arguments|interface|protected|implements|instanceof)$/.test(e)},s.safeProp=function(e){return!/^[$\w_]+$/.test(e)||s.isReserved(e)?'["'+e.replace(a,"\\\\").replace(c,'\\"')+'"]':"."+e},s.ucFirst=function(e){return e.charAt(0).toUpperCase()+e.substring(1)};var l=/_([a-z])/g;s.camelCase=function(e){return e.substring(0,1)+e.substring(1).replace(l,(function(e,t){return t.toUpperCase()}))},s.compareFieldsById=function(e,t){return e.id-t.id},s.decorateType=function(e,t){if(e.$type)return t&&e.$type.name!==t&&(s.decorateRoot.remove(e.$type),e.$type.name=t,s.decorateRoot.add(e.$type)),e.$type;n||(n=r(1262));var i=new n(t||e.name);return s.decorateRoot.add(i),i.ctor=e,Object.defineProperty(e,"$type",{value:i,enumerable:!1}),Object.defineProperty(e.prototype,"$type",{value:i,enumerable:!1}),i};var u=0;s.decorateEnum=function(e){if(e.$type)return e.$type;i||(i=r(6199));var t=new i("Enum"+u++,e);return s.decorateRoot.add(t),Object.defineProperty(e,"$type",{value:t,enumerable:!1}),t},s.setProperty=function(e,t,r){if("object"!==typeof e)throw TypeError("dst must be an object");if(!t)throw TypeError("path must be specified");return function e(t,r,n){var i=r.shift();if("__proto__"===i)return t;if(r.length>0)t[i]=e(t[i]||{},r,n);else{var s=t[i];s&&(n=[].concat(s).concat(n)),t[i]=n}return t}(e,t=t.split("."),r)},Object.defineProperty(s,"decorateRoot",{get:function(){return o.decorated||(o.decorated=new(r(7783)))}})},1132:(e,t,r)=>{"use strict";e.exports=i;var n=r(9584);function i(e,t){this.lo=e>>>0,this.hi=t>>>0}var s=i.zero=new i(0,0);s.toNumber=function(){return 0},s.zzEncode=s.zzDecode=function(){return this},s.length=function(){return 1};var o=i.zeroHash="\0\0\0\0\0\0\0\0";i.fromNumber=function(e){if(0===e)return s;var t=e<0;t&&(e=-e);var r=e>>>0,n=(e-r)/4294967296>>>0;return t&&(n=~n>>>0,r=~r>>>0,++r>4294967295&&(r=0,++n>4294967295&&(n=0))),new i(r,n)},i.from=function(e){if("number"===typeof e)return i.fromNumber(e);if(n.isString(e)){if(!n.Long)return i.fromNumber(parseInt(e,10));e=n.Long.fromString(e)}return e.low||e.high?new i(e.low>>>0,e.high>>>0):s},i.prototype.toNumber=function(e){if(!e&&this.hi>>>31){var t=1+~this.lo>>>0,r=~this.hi>>>0;return t||(r=r+1>>>0),-(t+4294967296*r)}return this.lo+4294967296*this.hi},i.prototype.toLong=function(e){return n.Long?new n.Long(0|this.lo,0|this.hi,Boolean(e)):{low:0|this.lo,high:0|this.hi,unsigned:Boolean(e)}};var a=String.prototype.charCodeAt;i.fromHash=function(e){return e===o?s:new i((a.call(e,0)|a.call(e,1)<<8|a.call(e,2)<<16|a.call(e,3)<<24)>>>0,(a.call(e,4)|a.call(e,5)<<8|a.call(e,6)<<16|a.call(e,7)<<24)>>>0)},i.prototype.toHash=function(){return String.fromCharCode(255&this.lo,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,255&this.hi,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)},i.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},i.prototype.zzDecode=function(){var e=-(1&this.lo);return this.lo=((this.lo>>>1|this.hi<<31)^e)>>>0,this.hi=(this.hi>>>1^e)>>>0,this},i.prototype.length=function(){var e=this.lo,t=(this.lo>>>28|this.hi<<4)>>>0,r=this.hi>>>24;return 0===r?0===t?e<16384?e<128?1:2:e<2097152?3:4:t<16384?t<128?5:6:t<2097152?7:8:r<128?9:10}},9584:function(e,t,r){"use strict";var n=t;function i(e,t,r){for(var n=Object.keys(t),i=0;i<n.length;++i)void 0!==e[n[i]]&&r||(e[n[i]]=t[n[i]]);return e}function s(e){function t(e,r){if(!(this instanceof t))return new t(e,r);Object.defineProperty(this,"message",{get:function(){return e}}),Error.captureStackTrace?Error.captureStackTrace(this,t):Object.defineProperty(this,"stack",{value:(new Error).stack||""}),r&&i(this,r)}return t.prototype=Object.create(Error.prototype,{constructor:{value:t,writable:!0,enumerable:!1,configurable:!0},name:{get:()=>e,set:void 0,enumerable:!1,configurable:!0},toString:{value(){return this.name+": "+this.message},writable:!0,enumerable:!1,configurable:!0}}),t}n.asPromise=r(5943),n.base64=r(7195),n.EventEmitter=r(3745),n.float=r(1448),n.inquire=r(4638),n.utf8=r(8557),n.pool=r(8071),n.LongBits=r(1132),n.isNode=Boolean("undefined"!==typeof r.g&&r.g&&r.g.process&&r.g.process.versions&&r.g.process.versions.node),n.global=n.isNode&&r.g||"undefined"!==typeof window&&window||"undefined"!==typeof self&&self||this,n.emptyArray=Object.freeze?Object.freeze([]):[],n.emptyObject=Object.freeze?Object.freeze({}):{},n.isInteger=Number.isInteger||function(e){return"number"===typeof e&&isFinite(e)&&Math.floor(e)===e},n.isString=function(e){return"string"===typeof e||e instanceof String},n.isObject=function(e){return e&&"object"===typeof e},n.isset=n.isSet=function(e,t){var r=e[t];return!(null==r||!e.hasOwnProperty(t))&&("object"!==typeof r||(Array.isArray(r)?r.length:Object.keys(r).length)>0)},n.Buffer=function(){try{var e=n.inquire("buffer").Buffer;return e.prototype.utf8Write?e:null}catch(t){return null}}(),n._Buffer_from=null,n._Buffer_allocUnsafe=null,n.newBuffer=function(e){return"number"===typeof e?n.Buffer?n._Buffer_allocUnsafe(e):new n.Array(e):n.Buffer?n._Buffer_from(e):"undefined"===typeof Uint8Array?e:new Uint8Array(e)},n.Array="undefined"!==typeof Uint8Array?Uint8Array:Array,n.Long=n.global.dcodeIO&&n.global.dcodeIO.Long||n.global.Long||n.inquire("long"),n.key2Re=/^true|false|0|1$/,n.key32Re=/^-?(?:0|[1-9][0-9]*)$/,n.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/,n.longToHash=function(e){return e?n.LongBits.from(e).toHash():n.LongBits.zeroHash},n.longFromHash=function(e,t){var r=n.LongBits.fromHash(e);return n.Long?n.Long.fromBits(r.lo,r.hi,t):r.toNumber(Boolean(t))},n.merge=i,n.lcFirst=function(e){return e.charAt(0).toLowerCase()+e.substring(1)},n.newError=s,n.ProtocolError=s("ProtocolError"),n.oneOfGetter=function(e){for(var t={},r=0;r<e.length;++r)t[e[r]]=1;return function(){for(var e=Object.keys(this),r=e.length-1;r>-1;--r)if(1===t[e[r]]&&void 0!==this[e[r]]&&null!==this[e[r]])return e[r]}},n.oneOfSetter=function(e){return function(t){for(var r=0;r<e.length;++r)e[r]!==t&&delete this[e[r]]}},n.toJSONOptions={longs:String,enums:String,bytes:String,json:!0},n._configure=function(){var e=n.Buffer;e?(n._Buffer_from=e.from!==Uint8Array.from&&e.from||function(t,r){return new e(t,r)},n._Buffer_allocUnsafe=e.allocUnsafe||function(t){return new e(t)}):n._Buffer_from=n._Buffer_allocUnsafe=null}},9554:(e,t,r)=>{"use strict";e.exports=function(e){var t=i.codegen(["m"],e.name+"$verify")('if(typeof m!=="object"||m===null)')("return%j","object expected"),r=e.oneofsArray,n={};r.length&&t("var p={}");for(var c=0;c<e.fieldsArray.length;++c){var l=e._fieldsArray[c].resolve(),u="m"+i.safeProp(l.name);if(l.optional&&t("if(%s!=null&&m.hasOwnProperty(%j)){",u,l.name),l.map)t("if(!util.isObject(%s))",u)("return%j",s(l,"object"))("var k=Object.keys(%s)",u)("for(var i=0;i<k.length;++i){"),a(t,l,"k[i]"),o(t,l,c,u+"[k[i]]")("}");else if(l.repeated)t("if(!Array.isArray(%s))",u)("return%j",s(l,"array"))("for(var i=0;i<%s.length;++i){",u),o(t,l,c,u+"[i]")("}");else{if(l.partOf){var h=i.safeProp(l.partOf.name);1===n[l.partOf.name]&&t("if(p%s===1)",h)("return%j",l.partOf.name+": multiple values"),n[l.partOf.name]=1,t("p%s=1",h)}o(t,l,c,u)}l.optional&&t("}")}return t("return null")};var n=r(6199),i=r(5399);function s(e,t){return e.name+": "+t+(e.repeated&&"array"!==t?"[]":e.map&&"object"!==t?"{k:"+e.keyType+"}":"")+" expected"}function o(e,t,r,i){if(t.resolvedType)if(t.resolvedType instanceof n){e("switch(%s){",i)("default:")("return%j",s(t,"enum value"));for(var o=Object.keys(t.resolvedType.values),a=0;a<o.length;++a)e("case %i:",t.resolvedType.values[o[a]]);e("break")("}")}else e("{")("var e=types[%i].verify(%s);",r,i)("if(e)")("return%j+e",t.name+".")("}");else switch(t.type){case"int32":case"uint32":case"sint32":case"fixed32":case"sfixed32":e("if(!util.isInteger(%s))",i)("return%j",s(t,"integer"));break;case"int64":case"uint64":case"sint64":case"fixed64":case"sfixed64":e("if(!util.isInteger(%s)&&!(%s&&util.isInteger(%s.low)&&util.isInteger(%s.high)))",i,i,i,i)("return%j",s(t,"integer|Long"));break;case"float":case"double":e('if(typeof %s!=="number")',i)("return%j",s(t,"number"));break;case"bool":e('if(typeof %s!=="boolean")',i)("return%j",s(t,"boolean"));break;case"string":e("if(!util.isString(%s))",i)("return%j",s(t,"string"));break;case"bytes":e('if(!(%s&&typeof %s.length==="number"||util.isString(%s)))',i,i,i)("return%j",s(t,"buffer"))}return e}function a(e,t,r){switch(t.keyType){case"int32":case"uint32":case"sint32":case"fixed32":case"sfixed32":e("if(!util.key32Re.test(%s))",r)("return%j",s(t,"integer key"));break;case"int64":case"uint64":case"sint64":case"fixed64":case"sfixed64":e("if(!util.key64Re.test(%s))",r)("return%j",s(t,"integer|Long key"));break;case"bool":e("if(!util.key2Re.test(%s))",r)("return%j",s(t,"boolean key"))}return e}},3014:(e,t,r)=>{"use strict";var n=t,i=r(5032);n[".google.protobuf.Any"]={fromObject:function(e){if(e&&e["@type"]){var t=e["@type"].substring(e["@type"].lastIndexOf("/")+1),r=this.lookup(t);if(r){var n="."===e["@type"].charAt(0)?e["@type"].slice(1):e["@type"];return-1===n.indexOf("/")&&(n="/"+n),this.create({type_url:n,value:r.encode(r.fromObject(e)).finish()})}}return this.fromObject(e)},toObject:function(e,t){var r="",n="";if(t&&t.json&&e.type_url&&e.value){n=e.type_url.substring(e.type_url.lastIndexOf("/")+1),r=e.type_url.substring(0,e.type_url.lastIndexOf("/")+1);var s=this.lookup(n);s&&(e=s.decode(e.value))}if(!(e instanceof this.ctor)&&e instanceof i){var o=e.$type.toObject(e,t);return""===r&&(r="type.googleapis.com/"),n=r+("."===e.$type.fullName[0]?e.$type.fullName.slice(1):e.$type.fullName),o["@type"]=n,o}return this.toObject(e,t)}}},3461:(e,t,r)=>{"use strict";e.exports=h;var n,i=r(9584),s=i.LongBits,o=i.base64,a=i.utf8;function c(e,t,r){this.fn=e,this.len=t,this.next=void 0,this.val=r}function l(){}function u(e){this.head=e.head,this.tail=e.tail,this.len=e.len,this.next=e.states}function h(){this.len=0,this.head=new c(l,0,0),this.tail=this.head,this.states=null}var d=function(){return i.Buffer?function(){return(h.create=function(){return new n})()}:function(){return new h}};function f(e,t,r){t[r]=255&e}function p(e,t){this.len=e,this.next=void 0,this.val=t}function y(e,t,r){for(;e.hi;)t[r++]=127&e.lo|128,e.lo=(e.lo>>>7|e.hi<<25)>>>0,e.hi>>>=7;for(;e.lo>127;)t[r++]=127&e.lo|128,e.lo=e.lo>>>7;t[r++]=e.lo}function g(e,t,r){t[r]=255&e,t[r+1]=e>>>8&255,t[r+2]=e>>>16&255,t[r+3]=e>>>24}h.create=d(),h.alloc=function(e){return new i.Array(e)},i.Array!==Array&&(h.alloc=i.pool(h.alloc,i.Array.prototype.subarray)),h.prototype._push=function(e,t,r){return this.tail=this.tail.next=new c(e,t,r),this.len+=t,this},p.prototype=Object.create(c.prototype),p.prototype.fn=function(e,t,r){for(;e>127;)t[r++]=127&e|128,e>>>=7;t[r]=e},h.prototype.uint32=function(e){return this.len+=(this.tail=this.tail.next=new p((e>>>=0)<128?1:e<16384?2:e<2097152?3:e<268435456?4:5,e)).len,this},h.prototype.int32=function(e){return e<0?this._push(y,10,s.fromNumber(e)):this.uint32(e)},h.prototype.sint32=function(e){return this.uint32((e<<1^e>>31)>>>0)},h.prototype.uint64=function(e){var t=s.from(e);return this._push(y,t.length(),t)},h.prototype.int64=h.prototype.uint64,h.prototype.sint64=function(e){var t=s.from(e).zzEncode();return this._push(y,t.length(),t)},h.prototype.bool=function(e){return this._push(f,1,e?1:0)},h.prototype.fixed32=function(e){return this._push(g,4,e>>>0)},h.prototype.sfixed32=h.prototype.fixed32,h.prototype.fixed64=function(e){var t=s.from(e);return this._push(g,4,t.lo)._push(g,4,t.hi)},h.prototype.sfixed64=h.prototype.fixed64,h.prototype.float=function(e){return this._push(i.float.writeFloatLE,4,e)},h.prototype.double=function(e){return this._push(i.float.writeDoubleLE,8,e)};var m=i.Array.prototype.set?function(e,t,r){t.set(e,r)}:function(e,t,r){for(var n=0;n<e.length;++n)t[r+n]=e[n]};h.prototype.bytes=function(e){var t=e.length>>>0;if(!t)return this._push(f,1,0);if(i.isString(e)){var r=h.alloc(t=o.length(e));o.decode(e,r,0),e=r}return this.uint32(t)._push(m,t,e)},h.prototype.string=function(e){var t=a.length(e);return t?this.uint32(t)._push(a.write,t,e):this._push(f,1,0)},h.prototype.fork=function(){return this.states=new u(this),this.head=this.tail=new c(l,0,0),this.len=0,this},h.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 c(l,0,0),this.len=0),this},h.prototype.ldelim=function(){var e=this.head,t=this.tail,r=this.len;return this.reset().uint32(r),r&&(this.tail.next=e.next,this.tail=t,this.len+=r),this},h.prototype.finish=function(){for(var e=this.head.next,t=this.constructor.alloc(this.len),r=0;e;)e.fn(e.val,t,r),r+=e.len,e=e.next;return t},h._configure=function(e){n=e,h.create=d(),n._configure()}},1223:(e,t,r)=>{"use strict";e.exports=s;var n=r(3461);(s.prototype=Object.create(n.prototype)).constructor=s;var i=r(9584);function s(){n.call(this)}function o(e,t,r){e.length<40?i.utf8.write(e,t,r):t.utf8Write?t.utf8Write(e,r):t.write(e,r)}s._configure=function(){s.alloc=i._Buffer_allocUnsafe,s.writeBytesBuffer=i.Buffer&&i.Buffer.prototype instanceof Uint8Array&&"set"===i.Buffer.prototype.set.name?function(e,t,r){t.set(e,r)}:function(e,t,r){if(e.copy)e.copy(t,r,0,e.length);else for(var n=0;n<e.length;)t[r++]=e[n++]}},s.prototype.bytes=function(e){i.isString(e)&&(e=i._Buffer_from(e,"base64"));var t=e.length>>>0;return this.uint32(t),t&&this._push(s.writeBytesBuffer,t,e),this},s.prototype.string=function(e){var t=i.Buffer.byteLength(e);return this.uint32(t),t&&this._push(o,t,e),this},s._configure()},6631:(e,t,r)=>{const n=r(4588),i=r(8236),s=r(2113),o=r(8153),{RateLimiterClusterMaster:a,RateLimiterClusterMasterPM2:c,RateLimiterCluster:l}=r(1373),u=r(5974),h=r(2971),d=r(4959),f=r(6483),p=r(8029),y=r(1799),g=r(8297);e.exports={RateLimiterRedis:n,RateLimiterMongo:i,RateLimiterMySQL:s,RateLimiterPostgres:o,RateLimiterMemory:u,RateLimiterMemcache:h,RateLimiterClusterMaster:a,RateLimiterClusterMasterPM2:c,RateLimiterCluster:l,RLWrapperBlackAndWhite:d,RateLimiterUnion:f,RateLimiterQueue:p,BurstyRateLimiter:y,RateLimiterRes:g}},1799:(e,t,r)=>{const n=r(8297);e.exports=class{constructor(e,t){this._rateLimiter=e,this._burstLimiter=t}_combineRes(e,t){return new n(e.remainingPoints,Math.min(e.msBeforeNext,t.msBeforeNext),e.consumedPoints,e.isFirstInDuration)}consume(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this._rateLimiter.consume(e,t,r).catch((i=>i instanceof n?this._burstLimiter.consume(e,t,r).then((e=>Promise.resolve(this._combineRes(i,e)))).catch((e=>e instanceof n?Promise.reject(this._combineRes(i,e)):Promise.reject(e))):Promise.reject(i)))}get(e){return Promise.all([this._rateLimiter.get(e),this._burstLimiter.get(e)]).then((e=>{let[t,r]=e;return this._combineRes(t,r)}))}get points(){return this._rateLimiter.points}}},4959:(e,t,r)=>{const n=r(8297);e.exports=class{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.limiter=e.limiter,this.blackList=e.blackList,this.whiteList=e.whiteList,this.isBlackListed=e.isBlackListed,this.isWhiteListed=e.isWhiteListed,this.runActionAnyway=e.runActionAnyway}get limiter(){return this._limiter}set limiter(e){if("undefined"===typeof e)throw new Error("limiter is not set");this._limiter=e}get runActionAnyway(){return this._runActionAnyway}set runActionAnyway(e){this._runActionAnyway="undefined"!==typeof e&&e}get blackList(){return this._blackList}set blackList(e){this._blackList=Array.isArray(e)?e:[]}get isBlackListed(){return this._isBlackListed}set isBlackListed(e){if("undefined"===typeof e&&(e=()=>!1),"function"!==typeof e)throw new Error("isBlackListed must be function");this._isBlackListed=e}get whiteList(){return this._whiteList}set whiteList(e){this._whiteList=Array.isArray(e)?e:[]}get isWhiteListed(){return this._isWhiteListed}set isWhiteListed(e){if("undefined"===typeof e&&(e=()=>!1),"function"!==typeof e)throw new Error("isWhiteListed must be function");this._isWhiteListed=e}isBlackListedSomewhere(e){return this.blackList.indexOf(e)>=0||this.isBlackListed(e)}isWhiteListedSomewhere(e){return this.whiteList.indexOf(e)>=0||this.isWhiteListed(e)}getBlackRes(){return new n(0,Number.MAX_SAFE_INTEGER,0,!1)}getWhiteRes(){return new n(Number.MAX_SAFE_INTEGER,0,0,!1)}rejectBlack(){return Promise.reject(this.getBlackRes())}resolveBlack(){return Promise.resolve(this.getBlackRes())}resolveWhite(){return Promise.resolve(this.getWhiteRes())}consume(e){let t,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return this.isWhiteListedSomewhere(e)?t=this.resolveWhite():this.isBlackListedSomewhere(e)&&(t=this.rejectBlack()),"undefined"===typeof t?this.limiter.consume(e,r):(this.runActionAnyway&&this.limiter.consume(e,r).catch((()=>{})),t)}block(e,t){let r;return this.isWhiteListedSomewhere(e)?r=this.resolveWhite():this.isBlackListedSomewhere(e)&&(r=this.resolveBlack()),"undefined"===typeof r?this.limiter.block(e,t):(this.runActionAnyway&&this.limiter.block(e,t).catch((()=>{})),r)}penalty(e,t){let r;return this.isWhiteListedSomewhere(e)?r=this.resolveWhite():this.isBlackListedSomewhere(e)&&(r=this.resolveBlack()),"undefined"===typeof r?this.limiter.penalty(e,t):(this.runActionAnyway&&this.limiter.penalty(e,t).catch((()=>{})),r)}reward(e,t){let r;return this.isWhiteListedSomewhere(e)?r=this.resolveWhite():this.isBlackListedSomewhere(e)&&(r=this.resolveBlack()),"undefined"===typeof r?this.limiter.reward(e,t):(this.runActionAnyway&&this.limiter.reward(e,t).catch((()=>{})),r)}get(e){let t;return this.isWhiteListedSomewhere(e)?t=this.resolveWhite():this.isBlackListedSomewhere(e)&&(t=this.resolveBlack()),"undefined"===typeof t||this.runActionAnyway?this.limiter.get(e):t}delete(e){return this.limiter.delete(e)}}},4284:e=>{e.exports=class{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.points=e.points,this.duration=e.duration,this.blockDuration=e.blockDuration,this.execEvenly=e.execEvenly,this.execEvenlyMinDelayMs=e.execEvenlyMinDelayMs,this.keyPrefix=e.keyPrefix}get points(){return this._points}set points(e){this._points=e>=0?e:4}get duration(){return this._duration}set duration(e){this._duration="undefined"===typeof e?1:e}get msDuration(){return 1e3*this.duration}get blockDuration(){return this._blockDuration}set blockDuration(e){this._blockDuration="undefined"===typeof e?0:e}get msBlockDuration(){return 1e3*this.blockDuration}get execEvenly(){return this._execEvenly}set execEvenly(e){this._execEvenly="undefined"!==typeof e&&Boolean(e)}get execEvenlyMinDelayMs(){return this._execEvenlyMinDelayMs}set execEvenlyMinDelayMs(e){this._execEvenlyMinDelayMs="undefined"===typeof e?Math.ceil(this.msDuration/this.points):e}get keyPrefix(){return this._keyPrefix}set keyPrefix(e){if("undefined"===typeof e&&(e="rlflx"),"string"!==typeof e)throw new Error("keyPrefix must be string");this._keyPrefix=e}_getKeySecDuration(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return e&&e.customDuration>=0?e.customDuration:this.duration}getKey(e){return this.keyPrefix.length>0?"".concat(this.keyPrefix,":").concat(e):e}parseKey(e){return e.substring(this.keyPrefix.length)}consume(){throw new Error("You have to implement the method 'consume'!")}penalty(){throw new Error("You have to implement the method 'penalty'!")}reward(){throw new Error("You have to implement the method 'reward'!")}get(){throw new Error("You have to implement the method 'get'!")}set(){throw new Error("You have to implement the method 'set'!")}block(){throw new Error("You have to implement the method 'block'!")}delete(){throw new Error("You have to implement the method 'delete'!")}}},1373:(e,t,r)=>{const n=r(5238),i=r(9580),s=r(4284),o=r(5974),a=r(8297),c="rate_limiter_flexible";let l=null;const u=function(e,t,r,n){let i;i=null===n||!0===n||!1===n?n:{remainingPoints:n.remainingPoints,msBeforeNext:n.msBeforeNext,consumedPoints:n.consumedPoints,isFirstInDuration:n.isFirstInDuration},e.send({channel:c,keyPrefix:t.keyPrefix,promiseId:t.promiseId,type:r,data:i})},h=function(e){setTimeout((()=>{this._initiated?process.send(e):"undefined"!==typeof this._promises[e.promiseId]&&h.call(this,e)}),30)},d=function(e,t,r,n,i){const s={channel:c,keyPrefix:this.keyPrefix,func:e,promiseId:t,data:{key:r,arg:n,opts:i}};this._initiated?process.send(s):h.call(this,s)},f=function(e,t){if(!t||t.channel!==c||"undefined"===typeof this._rateLimiters[t.keyPrefix])return!1;let r;switch(t.func){case"consume":r=this._rateLimiters[t.keyPrefix].consume(t.data.key,t.data.arg,t.data.opts);break;case"penalty":r=this._rateLimiters[t.keyPrefix].penalty(t.data.key,t.data.arg,t.data.opts);break;case"reward":r=this._rateLimiters[t.keyPrefix].reward(t.data.key,t.data.arg,t.data.opts);break;case"block":r=this._rateLimiters[t.keyPrefix].block(t.data.key,t.data.arg,t.data.opts);break;case"get":r=this._rateLimiters[t.keyPrefix].get(t.data.key,t.data.opts);break;case"delete":r=this._rateLimiters[t.keyPrefix].delete(t.data.key,t.data.opts);break;default:return!1}r&&r.then((r=>{u(e,t,"resolve",r)})).catch((r=>{u(e,t,"reject",r)}))},p=function(e){if(!e||e.channel!==c||e.keyPrefix!==this.keyPrefix)return!1;if(this._promises[e.promiseId]){let t;switch(clearTimeout(this._promises[e.promiseId].timeoutId),t=null===e.data||!0===e.data||!1===e.data?e.data:new a(e.data.remainingPoints,e.data.msBeforeNext,e.data.consumedPoints,e.data.isFirstInDuration),e.type){case"resolve":this._promises[e.promiseId].resolve(t);break;case"reject":this._promises[e.promiseId].reject(t);break;default:throw new Error("RateLimiterCluster: no such message type '".concat(e.type,"'"))}delete this._promises[e.promiseId]}},y=function(){return{points:this.points,duration:this.duration,blockDuration:this.blockDuration,execEvenly:this.execEvenly,execEvenlyMinDelayMs:this.execEvenlyMinDelayMs,keyPrefix:this.keyPrefix}},g=function(e,t){const r=process.hrtime();let n=r[0].toString()+r[1].toString();return"undefined"!==typeof this._promises[n]&&(n+=i.randomBytes(12).toString("base64")),this._promises[n]={resolve:e,reject:t,timeoutId:setTimeout((()=>{delete this._promises[n],t(new Error("RateLimiterCluster timeout: no answer from master in time"))}),this.timeoutMs)},n};e.exports={RateLimiterClusterMaster:class{constructor(){if(l)return l;this._rateLimiters={},n.setMaxListeners(0),n.on("message",((e,t)=>{t&&t.channel===c&&"init"===t.type?("undefined"===typeof this._rateLimiters[t.opts.keyPrefix]&&(this._rateLimiters[t.opts.keyPrefix]=new o(t.opts)),e.send({channel:c,type:"init",keyPrefix:t.opts.keyPrefix})):f.call(this,e,t)})),l=this}},RateLimiterClusterMasterPM2:class{constructor(e){if(l)return l;this._rateLimiters={},e.launchBus(((t,r)=>{r.on("process:msg",(t=>{const r=t.raw;if(r&&r.channel===c&&"init"===r.type)"undefined"===typeof this._rateLimiters[r.opts.keyPrefix]&&(this._rateLimiters[r.opts.keyPrefix]=new o(r.opts)),e.sendDataToProcessId(t.process.pm_id,{data:{},topic:c,channel:c,type:"init",keyPrefix:r.opts.keyPrefix},((e,t)=>{e&&console.log(e,t)}));else{f.call(this,{send:r=>{const n=r;n.topic=c,"undefined"===typeof n.data&&(n.data={}),e.sendDataToProcessId(t.process.pm_id,n,((e,t)=>{e&&console.log(e,t)}))}},r)}}))})),l=this}},RateLimiterCluster:class extends s{get timeoutMs(){return this._timeoutMs}set timeoutMs(e){this._timeoutMs="undefined"===typeof e?5e3:Math.abs(parseInt(e))}constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};super(e),process.setMaxListeners(0),this.timeoutMs=e.timeoutMs,this._initiated=!1,process.on("message",(e=>{e&&e.channel===c&&"init"===e.type&&e.keyPrefix===this.keyPrefix?this._initiated=!0:p.call(this,e)})),process.send({channel:c,type:"init",opts:y.call(this)}),this._promises={}}consume(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return new Promise(((n,i)=>{const s=g.call(this,n,i);d.call(this,"consume",s,e,t,r)}))}penalty(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return new Promise(((n,i)=>{const s=g.call(this,n,i);d.call(this,"penalty",s,e,t,r)}))}reward(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return new Promise(((n,i)=>{const s=g.call(this,n,i);d.call(this,"reward",s,e,t,r)}))}block(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return new Promise(((n,i)=>{const s=g.call(this,n,i);d.call(this,"block",s,e,t,r)}))}get(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise(((r,n)=>{const i=g.call(this,r,n);d.call(this,"get",i,e,t)}))}delete(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise(((r,n)=>{const i=g.call(this,r,n);d.call(this,"delete",i,e,t)}))}}}},2971:(e,t,r)=>{const n=r(1493),i=r(8297);e.exports=class extends n{constructor(e){super(e),this.client=e.storeClient}_getRateLimiterRes(e,t,r){const n=new i;return n.consumedPoints=parseInt(r.consumedPoints),n.isFirstInDuration=r.consumedPoints===t,n.remainingPoints=Math.max(this.points-n.consumedPoints,0),n.msBeforeNext=r.msBeforeNext,n}_upsert(e,t,r){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3],i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};return new Promise(((s,o)=>{const a=Date.now(),c=Math.floor(r/1e3);n?this.client.set(e,t,c,(r=>{r?o(r):this.client.set("".concat(e,"_expire"),c>0?a+1e3*c:-1,c,(()=>{s({consumedPoints:t,msBeforeNext:c>0?1e3*c:-1})}))})):this.client.incr(e,t,((l,u)=>{l||!1===u?this.client.add(e,t,c,((l,u)=>{if(l||!u)if("undefined"===typeof i.attemptNumber||i.attemptNumber<3){const a=Object.assign({},i);a.attemptNumber=a.attemptNumber?a.attemptNumber+1:1,this._upsert(e,t,r,n,a).then((e=>s(e))).catch((e=>o(e)))}else o(new Error("Can not add key"));else this.client.add("".concat(e,"_expire"),c>0?a+1e3*c:-1,c,(()=>{s({consumedPoints:t,msBeforeNext:c>0?1e3*c:-1})}))})):this.client.get("".concat(e,"_expire"),((e,t)=>{if(e)o(e);else{const e=!1===t?0:t,r={consumedPoints:u,msBeforeNext:e>=0?Math.max(e-a,0):-1};s(r)}}))}))}))}_get(e){return new Promise(((t,r)=>{const n=Date.now();this.client.get(e,((i,s)=>{s?this.client.get("".concat(e,"_expire"),((e,i)=>{if(e)r(e);else{const e=!1===i?0:i,r={consumedPoints:s,msBeforeNext:e>=0?Math.max(e-n,0):-1};t(r)}})):t(null)}))}))}_delete(e){return new Promise(((t,r)=>{this.client.del(e,((n,i)=>{n?r(n):!1===i?t(i):this.client.del("".concat(e,"_expire"),(e=>{e?r(e):t(i)}))}))}))}}},5974:(e,t,r)=>{const n=r(4284),i=r(6658),s=r(8297);e.exports=class extends n{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),this._memoryStorage=new i}consume(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return new Promise(((n,i)=>{const s=this.getKey(e),o=this._getKeySecDuration(r);let a=this._memoryStorage.incrby(s,t,o);if(a.remainingPoints=Math.max(this.points-a.consumedPoints,0),a.consumedPoints>this.points)this.blockDuration>0&&a.consumedPoints<=this.points+t&&(a=this._memoryStorage.set(s,a.consumedPoints,this.blockDuration)),i(a);else if(this.execEvenly&&a.msBeforeNext>0&&!a.isFirstInDuration){let e=Math.ceil(a.msBeforeNext/(a.remainingPoints+2));e<this.execEvenlyMinDelayMs&&(e=a.consumedPoints*this.execEvenlyMinDelayMs),setTimeout(n,e,a)}else n(a)}))}penalty(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const n=this.getKey(e);return new Promise((e=>{const i=this._getKeySecDuration(r),s=this._memoryStorage.incrby(n,t,i);s.remainingPoints=Math.max(this.points-s.consumedPoints,0),e(s)}))}reward(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const n=this.getKey(e);return new Promise((e=>{const i=this._getKeySecDuration(r),s=this._memoryStorage.incrby(n,-t,i);s.remainingPoints=Math.max(this.points-s.consumedPoints,0),e(s)}))}block(e,t){const r=1e3*t,n=this.points+1;return this._memoryStorage.set(this.getKey(e),n,t),Promise.resolve(new s(0,0===r?-1:r,n))}set(e,t,r){const n=1e3*(r>=0?r:this.duration);return this._memoryStorage.set(this.getKey(e),t,r),Promise.resolve(new s(0,0===n?-1:n,t))}get(e){const t=this._memoryStorage.get(this.getKey(e));return null!==t&&(t.remainingPoints=Math.max(this.points-t.consumedPoints,0)),Promise.resolve(t)}delete(e){return Promise.resolve(this._memoryStorage.delete(this.getKey(e)))}}},8236:(e,t,r)=>{const n=r(1493),i=r(8297);function s(e){try{const t=e.client?e.client:e,{version:r}=t.topology.s.options.metadata.driver,n=r.split(".").map((e=>parseInt(e)));return{major:n[0],feature:n[1],patch:n[2]}}catch(t){return{major:0,feature:0,patch:0}}}class o extends n{constructor(e){super(e),this.dbName=e.dbName,this.tableName=e.tableName,this.indexKeyPrefix=e.indexKeyPrefix,e.mongo?this.client=e.mongo:this.client=e.storeClient,"function"===typeof this.client.then?this.client.then((e=>{this.client=e,this._initCollection(),this._driverVersion=s(this.client)})):(this._initCollection(),this._driverVersion=s(this.client))}get dbName(){return this._dbName}set dbName(e){this._dbName="undefined"===typeof e?o.getDbName():e}static getDbName(){return"node-rate-limiter-flexible"}get tableName(){return this._tableName}set tableName(e){this._tableName="undefined"===typeof e?this.keyPrefix:e}get client(){return this._client}set client(e){if("undefined"===typeof e)throw new Error("mongo is not set");this._client=e}get indexKeyPrefix(){return this._indexKeyPrefix}set indexKeyPrefix(e){this._indexKeyPrefix=e||{}}_initCollection(){const e=("function"===typeof this.client.db?this.client.db(this.dbName):this.client).collection(this.tableName);e.createIndex({expire:-1},{expireAfterSeconds:0}),e.createIndex(Object.assign({},this.indexKeyPrefix,{key:1}),{unique:!0}),this._collection=e}_getRateLimiterRes(e,t,r){const n=new i;let s;return s="undefined"===typeof r.value?r:r.value,n.isFirstInDuration=s.points===t,n.consumedPoints=s.points,n.remainingPoints=Math.max(this.points-n.consumedPoints,0),n.msBeforeNext=null!==s.expire?Math.max(new Date(s.expire).getTime()-Date.now(),0):-1,n}_upsert(e,t,r){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3],i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};if(!this._collection)return Promise.reject(Error("Mongo connection is not established"));const s=i.attrs||{};let o,a;n?(o={key:e},o=Object.assign(o,s),a={$set:{key:e,points:t,expire:r>0?new Date(Date.now()+r):null}},a.$set=Object.assign(a.$set,s)):(o={$or:[{expire:{$gt:new Date}},{expire:{$eq:null}}],key:e},o=Object.assign(o,s),a={$setOnInsert:{key:e,expire:r>0?new Date(Date.now()+r):null},$inc:{points:t}},a.$setOnInsert=Object.assign(a.$setOnInsert,s));const c={upsert:!0};return this._driverVersion.major>=4||3===this._driverVersion.major&&this._driverVersion.feature>=7||this._driverVersion.feature>=6&&this._driverVersion.patch>=7?c.returnDocument="after":c.returnOriginal=!1,new Promise(((i,l)=>{this._collection.findOneAndUpdate(o,a,c).then((e=>{i(e)})).catch((o=>{if(o&&11e3===o.code){const o=Object.assign({$or:[{expire:{$lte:new Date}},{expire:{$eq:null}}],key:e},s),a={$set:Object.assign({key:e,points:t,expire:r>0?new Date(Date.now()+r):null},s)};this._collection.findOneAndUpdate(o,a,c).then((e=>{i(e)})).catch((s=>{s&&11e3===s.code?this._upsert(e,t,r,n).then((e=>i(e))).catch((e=>l(e))):l(s)}))}else l(o)}))}))}_get(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!this._collection)return Promise.reject(Error("Mongo connection is not established"));const r=t.attrs||{},n=Object.assign({key:e,$or:[{expire:{$gt:new Date}},{expire:{$eq:null}}]},r);return this._collection.findOne(n)}_delete(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!this._collection)return Promise.reject(Error("Mongo connection is not established"));const r=t.attrs||{},n=Object.assign({key:e},r);return this._collection.deleteOne(n).then((e=>e.deletedCount>0))}}e.exports=o},2113:(e,t,r)=>{const n=r(1493),i=r(8297);e.exports=class extends n{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;super(e),this.client=e.storeClient,this.clientType=e.storeType,this.dbName=e.dbName,this.tableName=e.tableName,this.clearExpiredByTimeout=e.clearExpiredByTimeout,this.tableCreated=e.tableCreated,this.tableCreated?(this.clearExpiredByTimeout&&this._clearExpiredHourAgo(),"function"===typeof t&&t()):this._createDbAndTable().then((()=>{this.tableCreated=!0,this.clearExpiredByTimeout&&this._clearExpiredHourAgo(),"function"===typeof t&&t()})).catch((e=>{if("function"!==typeof t)throw e;t(e)}))}clearExpired(e){return new Promise((t=>{this._getConnection().then((r=>{r.query("DELETE FROM ??.?? WHERE expire < ?",[this.dbName,this.tableName,e],(()=>{this._releaseConnection(r),t()}))})).catch((()=>{t()}))}))}_clearExpiredHourAgo(){this._clearExpiredTimeoutId&&clearTimeout(this._clearExpiredTimeoutId),this._clearExpiredTimeoutId=setTimeout((()=>{this.clearExpired(Date.now()-36e5).then((()=>{this._clearExpiredHourAgo()}))}),3e5),this._clearExpiredTimeoutId.unref()}_getConnection(){switch(this.clientType){case"pool":return new Promise(((e,t)=>{this.client.getConnection(((r,n)=>{if(r)return t(r);e(n)}))}));case"sequelize":return this.client.connectionManager.getConnection();case"knex":return this.client.client.acquireConnection();default:return Promise.resolve(this.client)}}_releaseConnection(e){switch(this.clientType){case"pool":return e.release();case"sequelize":return this.client.connectionManager.releaseConnection(e);case"knex":return this.client.client.releaseConnection(e);default:return!0}}_createDbAndTable(){return new Promise(((e,t)=>{this._getConnection().then((r=>{r.query("CREATE DATABASE IF NOT EXISTS `".concat(this.dbName,"`;"),(n=>{if(n)return this._releaseConnection(r),t(n);r.query(this._getCreateTableStmt(),(n=>{if(n)return this._releaseConnection(r),t(n);this._releaseConnection(r),e()}))}))})).catch((e=>{t(e)}))}))}_getCreateTableStmt(){return"CREATE TABLE IF NOT EXISTS `".concat(this.dbName,"`.`").concat(this.tableName,"` (")+"`key` VARCHAR(255) CHARACTER SET utf8 NOT NULL,`points` INT(9) NOT NULL default 0,`expire` BIGINT UNSIGNED,PRIMARY KEY (`key`)) ENGINE = INNODB;"}get clientType(){return this._clientType}set clientType(e){if("undefined"===typeof e)if("Connection"===this.client.constructor.name)e="connection";else if("Pool"===this.client.constructor.name)e="pool";else{if("Sequelize"!==this.client.constructor.name)throw new Error("storeType is not defined");e="sequelize"}this._clientType=e.toLowerCase()}get dbName(){return this._dbName}set dbName(e){this._dbName="undefined"===typeof e?"rtlmtrflx":e}get tableName(){return this._tableName}set tableName(e){this._tableName="undefined"===typeof e?this.keyPrefix:e}get tableCreated(){return this._tableCreated}set tableCreated(e){this._tableCreated="undefined"!==typeof e&&!!e}get clearExpiredByTimeout(){return this._clearExpiredByTimeout}set clearExpiredByTimeout(e){this._clearExpiredByTimeout="undefined"===typeof e||Boolean(e)}_getRateLimiterRes(e,t,r){const n=new i,[s]=r;return n.isFirstInDuration=t===s.points,n.consumedPoints=n.isFirstInDuration?t:s.points,n.remainingPoints=Math.max(this.points-n.consumedPoints,0),n.msBeforeNext=s.expire?Math.max(s.expire-Date.now(),0):-1,n}_upsertTransaction(e,t,r,n,i){return new Promise(((s,o)=>{e.query("BEGIN",(a=>{if(a)return e.rollback(),o(a);const c=Date.now(),l=n>0?c+n:null;let u,h;i?(u="INSERT INTO ??.?? VALUES (?, ?, ?)\n ON DUPLICATE KEY UPDATE \n points = ?, \n expire = ?;",h=[this.dbName,this.tableName,t,r,l,r,l]):(u="INSERT INTO ??.?? VALUES (?, ?, ?)\n ON DUPLICATE KEY UPDATE \n points = IF(expire <= ?, ?, points + (?)), \n expire = IF(expire <= ?, ?, expire);",h=[this.dbName,this.tableName,t,r,l,c,r,r,c,l]),e.query(u,h,(r=>{if(r)return e.rollback(),o(r);e.query("SELECT points, expire FROM ??.?? WHERE `key` = ?;",[this.dbName,this.tableName,t],((t,r)=>{if(t)return e.rollback(),o(t);e.query("COMMIT",(t=>{if(t)return e.rollback(),o(t);s(r)}))}))}))}))}))}_upsert(e,t,r){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];return this.tableCreated?new Promise(((i,s)=>{this._getConnection().then((o=>{this._upsertTransaction(o,e,t,r,n).then((e=>{i(e),this._releaseConnection(o)})).catch((e=>{s(e),this._releaseConnection(o)}))})).catch((e=>{s(e)}))})):Promise.reject(Error("Table is not created yet"))}_get(e){return this.tableCreated?new Promise(((t,r)=>{this._getConnection().then((n=>{n.query("SELECT points, expire FROM ??.?? WHERE `key` = ? AND (`expire` > ? OR `expire` IS NULL)",[this.dbName,this.tableName,e,Date.now()],((e,i)=>{e?r(e):0===i.length?t(null):t(i),this._releaseConnection(n)}))})).catch((e=>{r(e)}))})):Promise.reject(Error("Table is not created yet"))}_delete(e){return this.tableCreated?new Promise(((t,r)=>{this._getConnection().then((n=>{n.query("DELETE FROM ??.?? WHERE `key` = ?",[this.dbName,this.tableName,e],((e,i)=>{e?r(e):t(i.affectedRows>0),this._releaseConnection(n)}))})).catch((e=>{r(e)}))})):Promise.reject(Error("Table is not created yet"))}}},8153:(e,t,r)=>{const n=r(1493),i=r(8297);e.exports=class extends n{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;super(e),this.client=e.storeClient,this.clientType=e.storeType,this.tableName=e.tableName,this.clearExpiredByTimeout=e.clearExpiredByTimeout,this.tableCreated=e.tableCreated,this.tableCreated?"function"===typeof t&&t():this._createTable().then((()=>{this.tableCreated=!0,this.clearExpiredByTimeout&&this._clearExpiredHourAgo(),"function"===typeof t&&t()})).catch((e=>{if("function"!==typeof t)throw e;t(e)}))}clearExpired(e){return new Promise((t=>{const r={name:"rlflx-clear-expired",text:"DELETE FROM ".concat(this.tableName," WHERE expire < $1"),values:[e]};this._query(r).then((()=>{t()})).catch((()=>{t()}))}))}_clearExpiredHourAgo(){this._clearExpiredTimeoutId&&clearTimeout(this._clearExpiredTimeoutId),this._clearExpiredTimeoutId=setTimeout((()=>{this.clearExpired(Date.now()-36e5).then((()=>{this._clearExpiredHourAgo()}))}),3e5),this._clearExpiredTimeoutId.unref()}_getConnection(){switch(this.clientType){case"pool":default:return Promise.resolve(this.client);case"sequelize":return this.client.connectionManager.getConnection();case"knex":return this.client.client.acquireConnection();case"typeorm":return Promise.resolve(this.client.driver.master)}}_releaseConnection(e){switch(this.clientType){case"pool":case"typeorm":default:return!0;case"sequelize":return this.client.connectionManager.releaseConnection(e);case"knex":return this.client.client.releaseConnection(e)}}_createTable(){return new Promise(((e,t)=>{this._query({text:this._getCreateTableStmt()}).then((()=>{e()})).catch((r=>{"23505"===r.code?e():t(r)}))}))}_getCreateTableStmt(){return"CREATE TABLE IF NOT EXISTS ".concat(this.tableName," ( \n key varchar(255) PRIMARY KEY,\n points integer NOT NULL DEFAULT 0,\n expire bigint\n );")}get clientType(){return this._clientType}set clientType(e){const t=this.client.constructor.name;if("undefined"===typeof e)if("Client"===t)e="client";else if("Pool"===t||"BoundPool"===t)e="pool";else{if("Sequelize"!==t)throw new Error("storeType is not defined");e="sequelize"}this._clientType=e.toLowerCase()}get tableName(){return this._tableName}set tableName(e){this._tableName="undefined"===typeof e?this.keyPrefix:e}get tableCreated(){return this._tableCreated}set tableCreated(e){this._tableCreated="undefined"!==typeof e&&!!e}get clearExpiredByTimeout(){return this._clearExpiredByTimeout}set clearExpiredByTimeout(e){this._clearExpiredByTimeout="undefined"===typeof e||Boolean(e)}_getRateLimiterRes(e,t,r){const n=new i,s=r.rows[0];return n.isFirstInDuration=t===s.points,n.consumedPoints=n.isFirstInDuration?t:s.points,n.remainingPoints=Math.max(this.points-n.consumedPoints,0),n.msBeforeNext=s.expire?Math.max(s.expire-Date.now(),0):-1,n}_query(e){const t=this.tableName.toLowerCase(),r={name:"".concat(t,":").concat(e.name),text:e.text,values:e.values};return new Promise(((e,t)=>{this._getConnection().then((n=>{n.query(r).then((t=>{e(t),this._releaseConnection(n)})).catch((e=>{t(e),this._releaseConnection(n)}))})).catch((e=>{t(e)}))}))}_upsert(e,t,r){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(!this.tableCreated)return Promise.reject(Error("Table is not created yet"));const i=r>0?Date.now()+r:null,s=n?" $3 ":" CASE\n WHEN ".concat(this.tableName,".expire <= $4 THEN $3\n ELSE ").concat(this.tableName,".expire\n END ");return this._query({name:n?"rlflx-upsert-force":"rlflx-upsert",text:"\n INSERT INTO ".concat(this.tableName," VALUES ($1, $2, $3)\n ON CONFLICT(key) DO UPDATE SET\n points = CASE\n WHEN (").concat(this.tableName,".expire <= $4 OR 1=").concat(n?1:0,") THEN $2\n ELSE ").concat(this.tableName,".points + ($2)\n END,\n expire = ").concat(s,"\n RETURNING points, expire;"),values:[e,t,i,Date.now()]})}_get(e){return this.tableCreated?new Promise(((t,r)=>{this._query({name:"rlflx-get",text:"\n SELECT points, expire FROM ".concat(this.tableName," WHERE key = $1 AND (expire > $2 OR expire IS NULL);"),values:[e,Date.now()]}).then((e=>{0===e.rowCount&&(e=null),t(e)})).catch((e=>{r(e)}))})):Promise.reject(Error("Table is not created yet"))}_delete(e){return this.tableCreated?this._query({name:"rlflx-delete",text:"DELETE FROM ".concat(this.tableName," WHERE key = $1"),values:[e]}).then((e=>e.rowCount>0)):Promise.reject(Error("Table is not created yet"))}}},8029:(e,t,r)=>{const n=r(1941),i=4294967295,s="limiter";e.exports=class{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{maxQueueSize:i};this._queueLimiters={KEY_DEFAULT:new o(e,t)},this._limiterFlexible=e,this._maxQueueSize=t.maxQueueSize}getTokensRemaining(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:s;return this._queueLimiters[e]?this._queueLimiters[e].getTokensRemaining():Promise.resolve(this._limiterFlexible.points)}removeTokens(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:s;return this._queueLimiters[t]||(this._queueLimiters[t]=new o(this._limiterFlexible,{key:t,maxQueueSize:this._maxQueueSize})),this._queueLimiters[t].removeTokens(e)}};class o{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{maxQueueSize:i,key:s};this._key=t.key,this._waitTimeout=null,this._queue=[],this._limiterFlexible=e,this._maxQueueSize=t.maxQueueSize}getTokensRemaining(){return this._limiterFlexible.get(this._key).then((e=>null!==e?e.remainingPoints:this._limiterFlexible.points))}removeTokens(e){const t=this;return new Promise(((r,i)=>{e>t._limiterFlexible.points?i(new n("Requested tokens ".concat(e," exceeds maximum ").concat(t._limiterFlexible.points," tokens per interval"))):t._queue.length>0?t._queueRequest.call(t,r,i,e):t._limiterFlexible.consume(t._key,e).then((e=>{r(e.remainingPoints)})).catch((n=>{n instanceof Error?i(n):(t._queueRequest.call(t,r,i,e),null===t._waitTimeout&&(t._waitTimeout=setTimeout(t._processFIFO.bind(t),n.msBeforeNext)))}))}))}_queueRequest(e,t,r){const i=this;i._queue.length<i._maxQueueSize?i._queue.push({resolve:e,reject:t,tokens:r}):t(new n("Number of requests reached it's maximum ".concat(i._maxQueueSize)))}_processFIFO(){const e=this;if(null!==e._waitTimeout&&(clearTimeout(e._waitTimeout),e._waitTimeout=null),0===e._queue.length)return;const t=e._queue.shift();e._limiterFlexible.consume(e._key,t.tokens).then((r=>{t.resolve(r.remainingPoints),e._processFIFO.call(e)})).catch((r=>{r instanceof Error?(t.reject(r),e._processFIFO.call(e)):(e._queue.unshift(t),null===e._waitTimeout&&(e._waitTimeout=setTimeout(e._processFIFO.bind(e),r.msBeforeNext)))}))}}},4588:(e,t,r)=>{const n=r(1493),i=r(8297),s="redis.call('set', KEYS[1], 0, 'EX', ARGV[2], 'NX') local consumed = redis.call('incrby', KEYS[1], ARGV[1]) local ttl = redis.call('pttl', KEYS[1]) if ttl == -1 then redis.call('expire', KEYS[1], ARGV[2]) ttl = 1000 * ARGV[2] end return {consumed, ttl} ";e.exports=class extends n{constructor(e){super(e),e.redis?this.client=e.redis:this.client=e.storeClient,this._rejectIfRedisNotReady=!!e.rejectIfRedisNotReady,"function"===typeof this.client.defineCommand&&this.client.defineCommand("rlflxIncr",{numberOfKeys:1,lua:s})}_isRedisReady(){return!this._rejectIfRedisNotReady||(!this.client.status||"ready"===this.client.status)&&!("function"===typeof this.client.isReady&&!this.client.isReady())}_getRateLimiterRes(e,t,r){let[n,s]=r;Array.isArray(n)&&([,n]=n,[,s]=s);const o=new i;return o.consumedPoints=parseInt(n),o.isFirstInDuration=o.consumedPoints===t,o.remainingPoints=Math.max(this.points-o.consumedPoints,0),o.msBeforeNext=s,o}_upsert(e,t,r){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];return new Promise(((i,o)=>{if(!this._isRedisReady())return o(new Error("Redis connection is not ready"));const a=Math.floor(r/1e3),c=this.client.multi();if(n)a>0?c.set(e,t,"EX",a):c.set(e,t),c.pttl(e).exec(((e,t)=>e?o(e):i(t)));else if(a>0){const r=function(e,t){return e?o(e):i(t)};"function"===typeof this.client.rlflxIncr?this.client.rlflxIncr(e,t,a,r):this.client.eval(s,1,e,t,a,r)}else c.incrby(e,t).pttl(e).exec(((e,t)=>e?o(e):i(t)))}))}_get(e){return new Promise(((t,r)=>{if(!this._isRedisReady())return r(new Error("Redis connection is not ready"));this.client.multi().get(e).pttl(e).exec(((e,n)=>{if(e)r(e);else{const[e]=n;if(null===e)return t(null);t(n)}}))}))}_delete(e){return new Promise(((t,r)=>{this.client.del(e,((e,n)=>{e?r(e):t(n>0)}))}))}}},8297:e=>{e.exports=class{constructor(e,t,r,n){this.remainingPoints="undefined"===typeof e?0:e,this.msBeforeNext="undefined"===typeof t?0:t,this.consumedPoints="undefined"===typeof r?0:r,this.isFirstInDuration="undefined"!==typeof n&&n}get msBeforeNext(){return this._msBeforeNext}set msBeforeNext(e){return this._msBeforeNext=e,this}get remainingPoints(){return this._remainingPoints}set remainingPoints(e){return this._remainingPoints=e,this}get consumedPoints(){return this._consumedPoints}set consumedPoints(e){return this._consumedPoints=e,this}get isFirstInDuration(){return this._isFirstInDuration}set isFirstInDuration(e){this._isFirstInDuration=Boolean(e)}_getDecoratedProperties(){return{remainingPoints:this.remainingPoints,msBeforeNext:this.msBeforeNext,consumedPoints:this.consumedPoints,isFirstInDuration:this.isFirstInDuration}}[Symbol.for("nodejs.util.inspect.custom")](){return this._getDecoratedProperties()}toString(){return JSON.stringify(this._getDecoratedProperties())}toJSON(){return this._getDecoratedProperties()}}},1493:(e,t,r)=>{const n=r(4284),i=r(5552),s=r(8297);e.exports=class extends n{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};super(e),this.inMemoryBlockOnConsumed=e.inMemoryBlockOnConsumed||e.inmemoryBlockOnConsumed,this.inMemoryBlockDuration=e.inMemoryBlockDuration||e.inmemoryBlockDuration,this.insuranceLimiter=e.insuranceLimiter,this._inMemoryBlockedKeys=new i}get client(){return this._client}set client(e){if("undefined"===typeof e)throw new Error("storeClient is not set");this._client=e}_afterConsume(e,t,r,n,i){let s=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{};const o=this._getRateLimiterRes(r,n,i);if(this.inMemoryBlockOnConsumed>0&&!(this.inMemoryBlockDuration>0)&&o.consumedPoints>=this.inMemoryBlockOnConsumed)return this._inMemoryBlockedKeys.addMs(r,o.msBeforeNext),o.consumedPoints>this.points?t(o):e(o);if(o.consumedPoints>this.points){let e=Promise.resolve();this.blockDuration>0&&o.consumedPoints<=this.points+n&&(o.msBeforeNext=this.msBlockDuration,e=this._block(r,o.consumedPoints,this.msBlockDuration,s)),this.inMemoryBlockOnConsumed>0&&o.consumedPoints>=this.inMemoryBlockOnConsumed&&(this._inMemoryBlockedKeys.add(r,this.inMemoryBlockDuration),o.msBeforeNext=this.msInMemoryBlockDuration),e.then((()=>{t(o)})).catch((e=>{t(e)}))}else if(this.execEvenly&&o.msBeforeNext>0&&!o.isFirstInDuration){let t=Math.ceil(o.msBeforeNext/(o.remainingPoints+2));t<this.execEvenlyMinDelayMs&&(t=o.consumedPoints*this.execEvenlyMinDelayMs),setTimeout(e,t,o)}else e(o)}_handleError(e,t,r,i,s){let o=arguments.length>5&&void 0!==arguments[5]&&arguments[5],a=arguments.length>6&&void 0!==arguments[6]?arguments[6]:{};this.insuranceLimiter instanceof n?this.insuranceLimiter[t](s,o,a).then((e=>{r(e)})).catch((e=>{i(e)})):i(e)}get _inmemoryBlockedKeys(){return this._inMemoryBlockedKeys}getInmemoryBlockMsBeforeExpire(e){return this.getInMemoryBlockMsBeforeExpire(e)}get inmemoryBlockOnConsumed(){return this.inMemoryBlockOnConsumed}set inmemoryBlockOnConsumed(e){this.inMemoryBlockOnConsumed=e}get inmemoryBlockDuration(){return this.inMemoryBlockDuration}set inmemoryBlockDuration(e){this.inMemoryBlockDuration=e}get msInmemoryBlockDuration(){return 1e3*this.inMemoryBlockDuration}getInMemoryBlockMsBeforeExpire(e){return this.inMemoryBlockOnConsumed>0?this._inMemoryBlockedKeys.msBeforeExpire(e):0}get inMemoryBlockOnConsumed(){return this._inMemoryBlockOnConsumed}set inMemoryBlockOnConsumed(e){if(this._inMemoryBlockOnConsumed=e?parseInt(e):0,this.inMemoryBlockOnConsumed>0&&this.points>this.inMemoryBlockOnConsumed)throw new Error('inMemoryBlockOnConsumed option must be greater or equal "points" option')}get inMemoryBlockDuration(){return this._inMemoryBlockDuration}set inMemoryBlockDuration(e){if(this._inMemoryBlockDuration=e?parseInt(e):0,this.inMemoryBlockDuration>0&&0===this.inMemoryBlockOnConsumed)throw new Error("inMemoryBlockOnConsumed option must be set up")}get msInMemoryBlockDuration(){return 1e3*this._inMemoryBlockDuration}get insuranceLimiter(){return this._insuranceLimiter}set insuranceLimiter(e){if("undefined"!==typeof e&&!(e instanceof n))throw new Error("insuranceLimiter must be instance of RateLimiterAbstract");this._insuranceLimiter=e,this._insuranceLimiter&&(this._insuranceLimiter.blockDuration=this.blockDuration,this._insuranceLimiter.execEvenly=this.execEvenly)}block(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const n=1e3*t;return this._block(this.getKey(e),this.points+1,n,r)}set(e,t,r){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};const i=1e3*(r>=0?r:this.duration);return this._block(this.getKey(e),t,i,n)}consume(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return new Promise(((n,i)=>{const o=this.getKey(e),a=this.getInMemoryBlockMsBeforeExpire(o);if(a>0)return i(new s(0,a));this._upsert(o,t,1e3*this._getKeySecDuration(r),!1,r).then((e=>{this._afterConsume(n,i,o,t,e)})).catch((s=>{this._handleError(s,"consume",n,i,e,t,r)}))}))}penalty(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const n=this.getKey(e);return new Promise(((i,s)=>{this._upsert(n,t,1e3*this._getKeySecDuration(r),!1,r).then((e=>{i(this._getRateLimiterRes(n,t,e))})).catch((n=>{this._handleError(n,"penalty",i,s,e,t,r)}))}))}reward(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const n=this.getKey(e);return new Promise(((i,s)=>{this._upsert(n,-t,1e3*this._getKeySecDuration(r),!1,r).then((e=>{i(this._getRateLimiterRes(n,-t,e))})).catch((n=>{this._handleError(n,"reward",i,s,e,t,r)}))}))}get(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const r=this.getKey(e);return new Promise(((n,i)=>{this._get(r,t).then((e=>{n(null===e||"undefined"===typeof e?null:this._getRateLimiterRes(r,0,e))})).catch((r=>{this._handleError(r,"get",n,i,e,t)}))}))}delete(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const r=this.getKey(e);return new Promise(((n,i)=>{this._delete(r,t).then((e=>{this._inMemoryBlockedKeys.delete(r),n(e)})).catch((r=>{this._handleError(r,"delete",n,i,e,t)}))}))}deleteInMemoryBlockedAll(){this._inMemoryBlockedKeys.delete()}_getRateLimiterRes(e,t,r){throw new Error("You have to implement the method '_getRateLimiterRes'!")}_block(e,t,r){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return new Promise(((i,o)=>{this._upsert(e,t,r,!0,n).then((()=>{i(new s(0,r>0?r:-1,t))})).catch((t=>{this._handleError(t,"block",i,o,this.parseKey(e),r/1e3,n)}))}))}_get(e){throw new Error("You have to implement the method '_get'!")}_delete(e){throw new Error("You have to implement the method '_delete'!")}_upsert(e,t,r){throw new Error("You have to implement the method '_upsert'!")}}},6483:(e,t,r)=>{const n=r(4284);e.exports=class{constructor(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];if(t.length<1)throw new Error("RateLimiterUnion: at least one limiter have to be passed");t.forEach((e=>{if(!(e instanceof n))throw new Error("RateLimiterUnion: all limiters have to be instance of RateLimiterAbstract")})),this._limiters=t}consume(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return new Promise(((r,n)=>{const i=[];this._limiters.forEach((r=>{i.push(r.consume(e,t).catch((e=>({rejected:!0,rej:e}))))})),Promise.all(i).then((e=>{const t={};let i=!1;e.forEach((e=>{!0===e.rejected&&(i=!0)}));for(let r=0;r<e.length;r++)i&&!0===e[r].rejected?t[this._limiters[r].keyPrefix]=e[r].rej:i||(t[this._limiters[r].keyPrefix]=e[r]);i?n(t):r(t)}))}))}}},7253:e=>{e.exports=class{constructor(){this._keys={},this._addedKeysAmount=0}collectExpired(){const e=Date.now();Object.keys(this._keys).forEach((t=>{this._keys[t]<=e&&delete this._keys[t]})),this._addedKeysAmount=Object.keys(this._keys).length}add(e,t){this.addMs(e,1e3*t)}addMs(e,t){this._keys[e]=Date.now()+t,this._addedKeysAmount++,this._addedKeysAmount>999&&this.collectExpired()}msBeforeExpire(e){const t=this._keys[e];if(t&&t>=Date.now()){this.collectExpired();const e=Date.now();return t>=e?t-e:0}return 0}delete(e){e?delete this._keys[e]:Object.keys(this._keys).forEach((e=>{delete this._keys[e]}))}}},5552:(e,t,r)=>{const n=r(7253);e.exports=n},6658:(e,t,r)=>{const n=r(5265),i=r(8297);e.exports=class{constructor(){this._storage={}}incrby(e,t,r){if(this._storage[e]){const n=this._storage[e].expiresAt?this._storage[e].expiresAt.getTime()-(new Date).getTime():-1;return 0!==n?(this._storage[e].value=this._storage[e].value+t,new i(0,n,this._storage[e].value,!1)):this.set(e,t,r)}return this.set(e,t,r)}set(e,t,r){const s=1e3*r;return this._storage[e]&&this._storage[e].timeoutId&&clearTimeout(this._storage[e].timeoutId),this._storage[e]=new n(t,s>0?new Date(Date.now()+s):null),s>0&&(this._storage[e].timeoutId=setTimeout((()=>{delete this._storage[e]}),s),this._storage[e].timeoutId.unref&&this._storage[e].timeoutId.unref()),new i(0,0===s?-1:s,this._storage[e].value,!0)}get(e){if(this._storage[e]){const t=this._storage[e].expiresAt?this._storage[e].expiresAt.getTime()-(new Date).getTime():-1;return new i(0,t,this._storage[e].value,!1)}return null}delete(e){return!!this._storage[e]&&(this._storage[e].timeoutId&&clearTimeout(this._storage[e].timeoutId),delete this._storage[e],!0)}}},5265:e=>{e.exports=class{constructor(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;this.value=e,this.expiresAt=t,this.timeoutId=r}get value(){return this._value}set value(e){this._value=parseInt(e)}get expiresAt(){return this._expiresAt}set expiresAt(e){e instanceof Date||!Number.isInteger(e)||(e=new Date(e)),this._expiresAt=e}get timeoutId(){return this._timeoutId}set timeoutId(e){this._timeoutId=e}}},1941:e=>{e.exports=class extends Error{constructor(e,t){super(),Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor),this.name="CustomError",this.message=e,t&&(this.extra=t)}}},6421:(e,t,r)=>{"use strict";var n=r(5146),i=r(4339);function s(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,r=1;r<arguments.length;r++)t+="&args[]="+encodeURIComponent(arguments[r]);return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var o=new Set,a={};function c(e,t){l(e,t),l(e+"Capture",t)}function l(e,t){for(a[e]=t,e=0;e<t.length;e++)o.add(t[e])}var u=!("undefined"===typeof window||"undefined"===typeof window.document||"undefined"===typeof window.document.createElement),h=Object.prototype.hasOwnProperty,d=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,f={},p={};function y(e,t,r,n,i,s,o){this.acceptsBooleans=2===t||3===t||4===t,this.attributeName=n,this.attributeNamespace=i,this.mustUseProperty=r,this.propertyName=e,this.type=t,this.sanitizeURL=s,this.removeEmptyString=o}var g={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach((function(e){g[e]=new y(e,0,!1,e,null,!1,!1)})),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach((function(e){var t=e[0];g[t]=new y(t,1,!1,e[1],null,!1,!1)})),["contentEditable","draggable","spellCheck","value"].forEach((function(e){g[e]=new y(e,2,!1,e.toLowerCase(),null,!1,!1)})),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach((function(e){g[e]=new y(e,2,!1,e,null,!1,!1)})),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach((function(e){g[e]=new y(e,3,!1,e.toLowerCase(),null,!1,!1)})),["checked","multiple","muted","selected"].forEach((function(e){g[e]=new y(e,3,!0,e,null,!1,!1)})),["capture","download"].forEach((function(e){g[e]=new y(e,4,!1,e,null,!1,!1)})),["cols","rows","size","span"].forEach((function(e){g[e]=new y(e,6,!1,e,null,!1,!1)})),["rowSpan","start"].forEach((function(e){g[e]=new y(e,5,!1,e.toLowerCase(),null,!1,!1)}));var m=/[\-:]([a-z])/g;function v(e){return e[1].toUpperCase()}function b(e,t,r,n){var i=g.hasOwnProperty(t)?g[t]:null;(null!==i?0!==i.type:n||!(2<t.length)||"o"!==t[0]&&"O"!==t[0]||"n"!==t[1]&&"N"!==t[1])&&(function(e,t,r,n){if(null===t||"undefined"===typeof t||function(e,t,r,n){if(null!==r&&0===r.type)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return!n&&(null!==r?!r.acceptsBooleans:"data-"!==(e=e.toLowerCase().slice(0,5))&&"aria-"!==e);default:return!1}}(e,t,r,n))return!0;if(n)return!1;if(null!==r)switch(r.type){case 3:return!t;case 4:return!1===t;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}(t,r,i,n)&&(r=null),n||null===i?function(e){return!!h.call(p,e)||!h.call(f,e)&&(d.test(e)?p[e]=!0:(f[e]=!0,!1))}(t)&&(null===r?e.removeAttribute(t):e.setAttribute(t,""+r)):i.mustUseProperty?e[i.propertyName]=null===r?3!==i.type&&"":r:(t=i.attributeName,n=i.attributeNamespace,null===r?e.removeAttribute(t):(r=3===(i=i.type)||4===i&&!0===r?"":""+r,n?e.setAttributeNS(n,t,r):e.setAttribute(t,r))))}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach((function(e){var t=e.replace(m,v);g[t]=new y(t,1,!1,e,null,!1,!1)})),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach((function(e){var t=e.replace(m,v);g[t]=new y(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)})),["xml:base","xml:lang","xml:space"].forEach((function(e){var t=e.replace(m,v);g[t]=new y(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)})),["tabIndex","crossOrigin"].forEach((function(e){g[e]=new y(e,1,!1,e.toLowerCase(),null,!1,!1)})),g.xlinkHref=new y("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach((function(e){g[e]=new y(e,1,!1,e.toLowerCase(),null,!0,!0)}));var w=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,E=Symbol.for("react.element"),_=Symbol.for("react.portal"),S=Symbol.for("react.fragment"),I=Symbol.for("react.strict_mode"),C=Symbol.for("react.profiler"),A=Symbol.for("react.provider"),T=Symbol.for("react.context"),k=Symbol.for("react.forward_ref"),R=Symbol.for("react.suspense"),P=Symbol.for("react.suspense_list"),D=Symbol.for("react.memo"),N=Symbol.for("react.lazy");Symbol.for("react.scope"),Symbol.for("react.debug_trace_mode");var x=Symbol.for("react.offscreen");Symbol.for("react.legacy_hidden"),Symbol.for("react.cache"),Symbol.for("react.tracing_marker");var L=Symbol.iterator;function O(e){return null===e||"object"!==typeof e?null:"function"===typeof(e=L&&e[L]||e["@@iterator"])?e:null}var B,M=Object.assign;function U(e){if(void 0===B)try{throw Error()}catch(r){var t=r.stack.trim().match(/\n( *(at )?)/);B=t&&t[1]||""}return"\n"+B+e}var F=!1;function V(e,t){if(!e||F)return"";F=!0;var r=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(t)if(t=function(){throw Error()},Object.defineProperty(t.prototype,"props",{set:function(){throw Error()}}),"object"===typeof Reflect&&Reflect.construct){try{Reflect.construct(t,[])}catch(l){var n=l}Reflect.construct(e,[],t)}else{try{t.call()}catch(l){n=l}e.call(t.prototype)}else{try{throw Error()}catch(l){n=l}e()}}catch(l){if(l&&n&&"string"===typeof l.stack){for(var i=l.stack.split("\n"),s=n.stack.split("\n"),o=i.length-1,a=s.length-1;1<=o&&0<=a&&i[o]!==s[a];)a--;for(;1<=o&&0<=a;o--,a--)if(i[o]!==s[a]){if(1!==o||1!==a)do{if(o--,0>--a||i[o]!==s[a]){var c="\n"+i[o].replace(" at new "," at ");return e.displayName&&c.includes("<anonymous>")&&(c=c.replace("<anonymous>",e.displayName)),c}}while(1<=o&&0<=a);break}}}finally{F=!1,Error.prepareStackTrace=r}return(e=e?e.displayName||e.name:"")?U(e):""}function j(e){switch(e.tag){case 5:return U(e.type);case 16:return U("Lazy");case 13:return U("Suspense");case 19:return U("SuspenseList");case 0:case 2:case 15:return e=V(e.type,!1);case 11:return e=V(e.type.render,!1);case 1:return e=V(e.type,!0);default:return""}}function K(e){if(null==e)return null;if("function"===typeof e)return e.displayName||e.name||null;if("string"===typeof e)return e;switch(e){case S:return"Fragment";case _:return"Portal";case C:return"Profiler";case I:return"StrictMode";case R:return"Suspense";case P:return"SuspenseList"}if("object"===typeof e)switch(e.$$typeof){case T:return(e.displayName||"Context")+".Consumer";case A:return(e._context.displayName||"Context")+".Provider";case k:var t=e.render;return(e=e.displayName)||(e=""!==(e=t.displayName||t.name||"")?"ForwardRef("+e+")":"ForwardRef"),e;case D:return null!==(t=e.displayName||null)?t:K(e.type)||"Memo";case N:t=e._payload,e=e._init;try{return K(e(t))}catch(r){}}return null}function q(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=(e=t.render).displayName||e.name||"",t.displayName||(""!==e?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return K(t);case 8:return t===I?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if("function"===typeof t)return t.displayName||t.name||null;if("string"===typeof t)return t}return null}function z(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":case"object":return e;default:return""}}function H(e){var t=e.type;return(e=e.nodeName)&&"input"===e.toLowerCase()&&("checkbox"===t||"radio"===t)}function W(e){e._valueTracker||(e._valueTracker=function(e){var t=H(e)?"checked":"value",r=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),n=""+e[t];if(!e.hasOwnProperty(t)&&"undefined"!==typeof r&&"function"===typeof r.get&&"function"===typeof r.set){var i=r.get,s=r.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(e){n=""+e,s.call(this,e)}}),Object.defineProperty(e,t,{enumerable:r.enumerable}),{getValue:function(){return n},setValue:function(e){n=""+e},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}(e))}function G(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var r=t.getValue(),n="";return e&&(n=H(e)?e.checked?"true":"false":e.value),(e=n)!==r&&(t.setValue(e),!0)}function Q(e){if("undefined"===typeof(e=e||("undefined"!==typeof document?document:void 0)))return null;try{return e.activeElement||e.body}catch(t){return e.body}}function Y(e,t){var r=t.checked;return M({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:null!=r?r:e._wrapperState.initialChecked})}function $(e,t){var r=null==t.defaultValue?"":t.defaultValue,n=null!=t.checked?t.checked:t.defaultChecked;r=z(null!=t.value?t.value:r),e._wrapperState={initialChecked:n,initialValue:r,controlled:"checkbox"===t.type||"radio"===t.type?null!=t.checked:null!=t.value}}function X(e,t){null!=(t=t.checked)&&b(e,"checked",t,!1)}function J(e,t){X(e,t);var r=z(t.value),n=t.type;if(null!=r)"number"===n?(0===r&&""===e.value||e.value!=r)&&(e.value=""+r):e.value!==""+r&&(e.value=""+r);else if("submit"===n||"reset"===n)return void e.removeAttribute("value");t.hasOwnProperty("value")?ee(e,t.type,r):t.hasOwnProperty("defaultValue")&&ee(e,t.type,z(t.defaultValue)),null==t.checked&&null!=t.defaultChecked&&(e.defaultChecked=!!t.defaultChecked)}function Z(e,t,r){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var n=t.type;if(!("submit"!==n&&"reset"!==n||void 0!==t.value&&null!==t.value))return;t=""+e._wrapperState.initialValue,r||t===e.value||(e.value=t),e.defaultValue=t}""!==(r=e.name)&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,""!==r&&(e.name=r)}function ee(e,t,r){"number"===t&&Q(e.ownerDocument)===e||(null==r?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+r&&(e.defaultValue=""+r))}var te=Array.isArray;function re(e,t,r,n){if(e=e.options,t){t={};for(var i=0;i<r.length;i++)t["$"+r[i]]=!0;for(r=0;r<e.length;r++)i=t.hasOwnProperty("$"+e[r].value),e[r].selected!==i&&(e[r].selected=i),i&&n&&(e[r].defaultSelected=!0)}else{for(r=""+z(r),t=null,i=0;i<e.length;i++){if(e[i].value===r)return e[i].selected=!0,void(n&&(e[i].defaultSelected=!0));null!==t||e[i].disabled||(t=e[i])}null!==t&&(t.selected=!0)}}function ne(e,t){if(null!=t.dangerouslySetInnerHTML)throw Error(s(91));return M({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function ie(e,t){var r=t.value;if(null==r){if(r=t.children,t=t.defaultValue,null!=r){if(null!=t)throw Error(s(92));if(te(r)){if(1<r.length)throw Error(s(93));r=r[0]}t=r}null==t&&(t=""),r=t}e._wrapperState={initialValue:z(r)}}function se(e,t){var r=z(t.value),n=z(t.defaultValue);null!=r&&((r=""+r)!==e.value&&(e.value=r),null==t.defaultValue&&e.defaultValue!==r&&(e.defaultValue=r)),null!=n&&(e.defaultValue=""+n)}function oe(e){var t=e.textContent;t===e._wrapperState.initialValue&&""!==t&&null!==t&&(e.value=t)}function ae(e){switch(e){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function ce(e,t){return null==e||"http://www.w3.org/1999/xhtml"===e?ae(t):"http://www.w3.org/2000/svg"===e&&"foreignObject"===t?"http://www.w3.org/1999/xhtml":e}var le,ue,he=(ue=function(e,t){if("http://www.w3.org/2000/svg"!==e.namespaceURI||"innerHTML"in e)e.innerHTML=t;else{for((le=le||document.createElement("div")).innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=le.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}},"undefined"!==typeof MSApp&&MSApp.execUnsafeLocalFunction?function(e,t,r,n){MSApp.execUnsafeLocalFunction((function(){return ue(e,t)}))}:ue);function de(e,t){if(t){var r=e.firstChild;if(r&&r===e.lastChild&&3===r.nodeType)return void(r.nodeValue=t)}e.textContent=t}var fe={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},pe=["Webkit","ms","Moz","O"];function ye(e,t,r){return null==t||"boolean"===typeof t||""===t?"":r||"number"!==typeof t||0===t||fe.hasOwnProperty(e)&&fe[e]?(""+t).trim():t+"px"}function ge(e,t){for(var r in e=e.style,t)if(t.hasOwnProperty(r)){var n=0===r.indexOf("--"),i=ye(r,t[r],n);"float"===r&&(r="cssFloat"),n?e.setProperty(r,i):e[r]=i}}Object.keys(fe).forEach((function(e){pe.forEach((function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),fe[t]=fe[e]}))}));var me=M({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function ve(e,t){if(t){if(me[e]&&(null!=t.children||null!=t.dangerouslySetInnerHTML))throw Error(s(137,e));if(null!=t.dangerouslySetInnerHTML){if(null!=t.children)throw Error(s(60));if("object"!==typeof t.dangerouslySetInnerHTML||!("__html"in t.dangerouslySetInnerHTML))throw Error(s(61))}if(null!=t.style&&"object"!==typeof t.style)throw Error(s(62))}}function be(e,t){if(-1===e.indexOf("-"))return"string"===typeof t.is;switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var we=null;function Ee(e){return(e=e.target||e.srcElement||window).correspondingUseElement&&(e=e.correspondingUseElement),3===e.nodeType?e.parentNode:e}var _e=null,Se=null,Ie=null;function Ce(e){if(e=bi(e)){if("function"!==typeof _e)throw Error(s(280));var t=e.stateNode;t&&(t=Ei(t),_e(e.stateNode,e.type,t))}}function Ae(e){Se?Ie?Ie.push(e):Ie=[e]:Se=e}function Te(){if(Se){var e=Se,t=Ie;if(Ie=Se=null,Ce(e),t)for(e=0;e<t.length;e++)Ce(t[e])}}function ke(e,t){return e(t)}function Re(){}var Pe=!1;function De(e,t,r){if(Pe)return e(t,r);Pe=!0;try{return ke(e,t,r)}finally{Pe=!1,(null!==Se||null!==Ie)&&(Re(),Te())}}function Ne(e,t){var r=e.stateNode;if(null===r)return null;var n=Ei(r);if(null===n)return null;r=n[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(n=!n.disabled)||(n=!("button"===(e=e.type)||"input"===e||"select"===e||"textarea"===e)),e=!n;break e;default:e=!1}if(e)return null;if(r&&"function"!==typeof r)throw Error(s(231,t,typeof r));return r}var xe=!1;if(u)try{var Le={};Object.defineProperty(Le,"passive",{get:function(){xe=!0}}),window.addEventListener("test",Le,Le),window.removeEventListener("test",Le,Le)}catch(ue){xe=!1}function Oe(e,t,r,n,i,s,o,a,c){var l=Array.prototype.slice.call(arguments,3);try{t.apply(r,l)}catch(u){this.onError(u)}}var Be=!1,Me=null,Ue=!1,Fe=null,Ve={onError:function(e){Be=!0,Me=e}};function je(e,t,r,n,i,s,o,a,c){Be=!1,Me=null,Oe.apply(Ve,arguments)}function Ke(e){var t=e,r=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do{0!==(4098&(t=e).flags)&&(r=t.return),e=t.return}while(e)}return 3===t.tag?r:null}function qe(e){if(13===e.tag){var t=e.memoizedState;if(null===t&&(null!==(e=e.alternate)&&(t=e.memoizedState)),null!==t)return t.dehydrated}return null}function ze(e){if(Ke(e)!==e)throw Error(s(188))}function He(e){return null!==(e=function(e){var t=e.alternate;if(!t){if(null===(t=Ke(e)))throw Error(s(188));return t!==e?null:e}for(var r=e,n=t;;){var i=r.return;if(null===i)break;var o=i.alternate;if(null===o){if(null!==(n=i.return)){r=n;continue}break}if(i.child===o.child){for(o=i.child;o;){if(o===r)return ze(i),e;if(o===n)return ze(i),t;o=o.sibling}throw Error(s(188))}if(r.return!==n.return)r=i,n=o;else{for(var a=!1,c=i.child;c;){if(c===r){a=!0,r=i,n=o;break}if(c===n){a=!0,n=i,r=o;break}c=c.sibling}if(!a){for(c=o.child;c;){if(c===r){a=!0,r=o,n=i;break}if(c===n){a=!0,n=o,r=i;break}c=c.sibling}if(!a)throw Error(s(189))}}if(r.alternate!==n)throw Error(s(190))}if(3!==r.tag)throw Error(s(188));return r.stateNode.current===r?e:t}(e))?We(e):null}function We(e){if(5===e.tag||6===e.tag)return e;for(e=e.child;null!==e;){var t=We(e);if(null!==t)return t;e=e.sibling}return null}var Ge=i.unstable_scheduleCallback,Qe=i.unstable_cancelCallback,Ye=i.unstable_shouldYield,$e=i.unstable_requestPaint,Xe=i.unstable_now,Je=i.unstable_getCurrentPriorityLevel,Ze=i.unstable_ImmediatePriority,et=i.unstable_UserBlockingPriority,tt=i.unstable_NormalPriority,rt=i.unstable_LowPriority,nt=i.unstable_IdlePriority,it=null,st=null;var ot=Math.clz32?Math.clz32:function(e){return 0===(e>>>=0)?32:31-(at(e)/ct|0)|0},at=Math.log,ct=Math.LN2;var lt=64,ut=4194304;function ht(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return 4194240&e;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return 130023424&e;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function dt(e,t){var r=e.pendingLanes;if(0===r)return 0;var n=0,i=e.suspendedLanes,s=e.pingedLanes,o=268435455&r;if(0!==o){var a=o&~i;0!==a?n=ht(a):0!==(s&=o)&&(n=ht(s))}else 0!==(o=r&~i)?n=ht(o):0!==s&&(n=ht(s));if(0===n)return 0;if(0!==t&&t!==n&&0===(t&i)&&((i=n&-n)>=(s=t&-t)||16===i&&0!==(4194240&s)))return t;if(0!==(4&n)&&(n|=16&r),0!==(t=e.entangledLanes))for(e=e.entanglements,t&=n;0<t;)i=1<<(r=31-ot(t)),n|=e[r],t&=~i;return n}function ft(e,t){switch(e){case 1:case 2:case 4:return t+250;case 8:case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;default:return-1}}function pt(e){return 0!==(e=-1073741825&e.pendingLanes)?e:1073741824&e?1073741824:0}function yt(){var e=lt;return 0===(4194240&(lt<<=1))&&(lt=64),e}function gt(e){for(var t=[],r=0;31>r;r++)t.push(e);return t}function mt(e,t,r){e.pendingLanes|=t,536870912!==t&&(e.suspendedLanes=0,e.pingedLanes=0),(e=e.eventTimes)[t=31-ot(t)]=r}function vt(e,t){var r=e.entangledLanes|=t;for(e=e.entanglements;r;){var n=31-ot(r),i=1<<n;i&t|e[n]&t&&(e[n]|=t),r&=~i}}var bt=0;function wt(e){return 1<(e&=-e)?4<e?0!==(268435455&e)?16:536870912:4:1}var Et,_t,St,It,Ct,At=!1,Tt=[],kt=null,Rt=null,Pt=null,Dt=new Map,Nt=new Map,xt=[],Lt="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset submit".split(" ");function Ot(e,t){switch(e){case"focusin":case"focusout":kt=null;break;case"dragenter":case"dragleave":Rt=null;break;case"mouseover":case"mouseout":Pt=null;break;case"pointerover":case"pointerout":Dt.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":Nt.delete(t.pointerId)}}function Bt(e,t,r,n,i,s){return null===e||e.nativeEvent!==s?(e={blockedOn:t,domEventName:r,eventSystemFlags:n,nativeEvent:s,targetContainers:[i]},null!==t&&(null!==(t=bi(t))&&_t(t)),e):(e.eventSystemFlags|=n,t=e.targetContainers,null!==i&&-1===t.indexOf(i)&&t.push(i),e)}function Mt(e){var t=vi(e.target);if(null!==t){var r=Ke(t);if(null!==r)if(13===(t=r.tag)){if(null!==(t=qe(r)))return e.blockedOn=t,void Ct(e.priority,(function(){St(r)}))}else if(3===t&&r.stateNode.current.memoizedState.isDehydrated)return void(e.blockedOn=3===r.tag?r.stateNode.containerInfo:null)}e.blockedOn=null}function Ut(e){if(null!==e.blockedOn)return!1;for(var t=e.targetContainers;0<t.length;){var r=Yt(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(null!==r)return null!==(t=bi(r))&&_t(t),e.blockedOn=r,!1;var n=new(r=e.nativeEvent).constructor(r.type,r);we=n,r.target.dispatchEvent(n),we=null,t.shift()}return!0}function Ft(e,t,r){Ut(e)&&r.delete(t)}function Vt(){At=!1,null!==kt&&Ut(kt)&&(kt=null),null!==Rt&&Ut(Rt)&&(Rt=null),null!==Pt&&Ut(Pt)&&(Pt=null),Dt.forEach(Ft),Nt.forEach(Ft)}function jt(e,t){e.blockedOn===t&&(e.blockedOn=null,At||(At=!0,i.unstable_scheduleCallback(i.unstable_NormalPriority,Vt)))}function Kt(e){function t(t){return jt(t,e)}if(0<Tt.length){jt(Tt[0],e);for(var r=1;r<Tt.length;r++){var n=Tt[r];n.blockedOn===e&&(n.blockedOn=null)}}for(null!==kt&&jt(kt,e),null!==Rt&&jt(Rt,e),null!==Pt&&jt(Pt,e),Dt.forEach(t),Nt.forEach(t),r=0;r<xt.length;r++)(n=xt[r]).blockedOn===e&&(n.blockedOn=null);for(;0<xt.length&&null===(r=xt[0]).blockedOn;)Mt(r),null===r.blockedOn&&xt.shift()}var qt=w.ReactCurrentBatchConfig,zt=!0;function Ht(e,t,r,n){var i=bt,s=qt.transition;qt.transition=null;try{bt=1,Gt(e,t,r,n)}finally{bt=i,qt.transition=s}}function Wt(e,t,r,n){var i=bt,s=qt.transition;qt.transition=null;try{bt=4,Gt(e,t,r,n)}finally{bt=i,qt.transition=s}}function Gt(e,t,r,n){if(zt){var i=Yt(e,t,r,n);if(null===i)zn(e,t,n,Qt,r),Ot(e,n);else if(function(e,t,r,n,i){switch(t){case"focusin":return kt=Bt(kt,e,t,r,n,i),!0;case"dragenter":return Rt=Bt(Rt,e,t,r,n,i),!0;case"mouseover":return Pt=Bt(Pt,e,t,r,n,i),!0;case"pointerover":var s=i.pointerId;return Dt.set(s,Bt(Dt.get(s)||null,e,t,r,n,i)),!0;case"gotpointercapture":return s=i.pointerId,Nt.set(s,Bt(Nt.get(s)||null,e,t,r,n,i)),!0}return!1}(i,e,t,r,n))n.stopPropagation();else if(Ot(e,n),4&t&&-1<Lt.indexOf(e)){for(;null!==i;){var s=bi(i);if(null!==s&&Et(s),null===(s=Yt(e,t,r,n))&&zn(e,t,n,Qt,r),s===i)break;i=s}null!==i&&n.stopPropagation()}else zn(e,t,n,null,r)}}var Qt=null;function Yt(e,t,r,n){if(Qt=null,null!==(e=vi(e=Ee(n))))if(null===(t=Ke(e)))e=null;else if(13===(r=t.tag)){if(null!==(e=qe(t)))return e;e=null}else if(3===r){if(t.stateNode.current.memoizedState.isDehydrated)return 3===t.tag?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null);return Qt=e,null}function $t(e){switch(e){case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 1;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(Je()){case Ze:return 1;case et:return 4;case tt:case rt:return 16;case nt:return 536870912;default:return 16}default:return 16}}var Xt=null,Jt=null,Zt=null;function er(){if(Zt)return Zt;var e,t,r=Jt,n=r.length,i="value"in Xt?Xt.value:Xt.textContent,s=i.length;for(e=0;e<n&&r[e]===i[e];e++);var o=n-e;for(t=1;t<=o&&r[n-t]===i[s-t];t++);return Zt=i.slice(e,1<t?1-t:void 0)}function tr(e){var t=e.keyCode;return"charCode"in e?0===(e=e.charCode)&&13===t&&(e=13):e=t,10===e&&(e=13),32<=e||13===e?e:0}function rr(){return!0}function nr(){return!1}function ir(e){function t(t,r,n,i,s){for(var o in this._reactName=t,this._targetInst=n,this.type=r,this.nativeEvent=i,this.target=s,this.currentTarget=null,e)e.hasOwnProperty(o)&&(t=e[o],this[o]=t?t(i):i[o]);return this.isDefaultPrevented=(null!=i.defaultPrevented?i.defaultPrevented:!1===i.returnValue)?rr:nr,this.isPropagationStopped=nr,this}return M(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var e=this.nativeEvent;e&&(e.preventDefault?e.preventDefault():"unknown"!==typeof e.returnValue&&(e.returnValue=!1),this.isDefaultPrevented=rr)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():"unknown"!==typeof e.cancelBubble&&(e.cancelBubble=!0),this.isPropagationStopped=rr)},persist:function(){},isPersistent:rr}),t}var sr,or,ar,cr={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},lr=ir(cr),ur=M({},cr,{view:0,detail:0}),hr=ir(ur),dr=M({},ur,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Ir,button:0,buttons:0,relatedTarget:function(e){return void 0===e.relatedTarget?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==ar&&(ar&&"mousemove"===e.type?(sr=e.screenX-ar.screenX,or=e.screenY-ar.screenY):or=sr=0,ar=e),sr)},movementY:function(e){return"movementY"in e?e.movementY:or}}),fr=ir(dr),pr=ir(M({},dr,{dataTransfer:0})),yr=ir(M({},ur,{relatedTarget:0})),gr=ir(M({},cr,{animationName:0,elapsedTime:0,pseudoElement:0})),mr=M({},cr,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),vr=ir(mr),br=ir(M({},cr,{data:0})),wr={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Er={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},_r={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Sr(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):!!(e=_r[e])&&!!t[e]}function Ir(){return Sr}var Cr=M({},ur,{key:function(e){if(e.key){var t=wr[e.key]||e.key;if("Unidentified"!==t)return t}return"keypress"===e.type?13===(e=tr(e))?"Enter":String.fromCharCode(e):"keydown"===e.type||"keyup"===e.type?Er[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Ir,charCode:function(e){return"keypress"===e.type?tr(e):0},keyCode:function(e){return"keydown"===e.type||"keyup"===e.type?e.keyCode:0},which:function(e){return"keypress"===e.type?tr(e):"keydown"===e.type||"keyup"===e.type?e.keyCode:0}}),Ar=ir(Cr),Tr=ir(M({},dr,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0})),kr=ir(M({},ur,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Ir})),Rr=ir(M({},cr,{propertyName:0,elapsedTime:0,pseudoElement:0})),Pr=M({},dr,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),Dr=ir(Pr),Nr=[9,13,27,32],xr=u&&"CompositionEvent"in window,Lr=null;u&&"documentMode"in document&&(Lr=document.documentMode);var Or=u&&"TextEvent"in window&&!Lr,Br=u&&(!xr||Lr&&8<Lr&&11>=Lr),Mr=String.fromCharCode(32),Ur=!1;function Fr(e,t){switch(e){case"keyup":return-1!==Nr.indexOf(t.keyCode);case"keydown":return 229!==t.keyCode;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Vr(e){return"object"===typeof(e=e.detail)&&"data"in e?e.data:null}var jr=!1;var Kr={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function qr(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return"input"===t?!!Kr[e.type]:"textarea"===t}function zr(e,t,r,n){Ae(n),0<(t=Wn(t,"onChange")).length&&(r=new lr("onChange","change",null,r,n),e.push({event:r,listeners:t}))}var Hr=null,Wr=null;function Gr(e){Un(e,0)}function Qr(e){if(G(wi(e)))return e}function Yr(e,t){if("change"===e)return t}var $r=!1;if(u){var Xr;if(u){var Jr="oninput"in document;if(!Jr){var Zr=document.createElement("div");Zr.setAttribute("oninput","return;"),Jr="function"===typeof Zr.oninput}Xr=Jr}else Xr=!1;$r=Xr&&(!document.documentMode||9<document.documentMode)}function en(){Hr&&(Hr.detachEvent("onpropertychange",tn),Wr=Hr=null)}function tn(e){if("value"===e.propertyName&&Qr(Wr)){var t=[];zr(t,Wr,e,Ee(e)),De(Gr,t)}}function rn(e,t,r){"focusin"===e?(en(),Wr=r,(Hr=t).attachEvent("onpropertychange",tn)):"focusout"===e&&en()}function nn(e){if("selectionchange"===e||"keyup"===e||"keydown"===e)return Qr(Wr)}function sn(e,t){if("click"===e)return Qr(t)}function on(e,t){if("input"===e||"change"===e)return Qr(t)}var an="function"===typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e===1/t)||e!==e&&t!==t};function cn(e,t){if(an(e,t))return!0;if("object"!==typeof e||null===e||"object"!==typeof t||null===t)return!1;var r=Object.keys(e),n=Object.keys(t);if(r.length!==n.length)return!1;for(n=0;n<r.length;n++){var i=r[n];if(!h.call(t,i)||!an(e[i],t[i]))return!1}return!0}function ln(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function un(e,t){var r,n=ln(e);for(e=0;n;){if(3===n.nodeType){if(r=e+n.textContent.length,e<=t&&r>=t)return{node:n,offset:t-e};e=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=ln(n)}}function hn(e,t){return!(!e||!t)&&(e===t||(!e||3!==e.nodeType)&&(t&&3===t.nodeType?hn(e,t.parentNode):"contains"in e?e.contains(t):!!e.compareDocumentPosition&&!!(16&e.compareDocumentPosition(t))))}function dn(){for(var e=window,t=Q();t instanceof e.HTMLIFrameElement;){try{var r="string"===typeof t.contentWindow.location.href}catch(n){r=!1}if(!r)break;t=Q((e=t.contentWindow).document)}return t}function fn(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&("input"===t&&("text"===e.type||"search"===e.type||"tel"===e.type||"url"===e.type||"password"===e.type)||"textarea"===t||"true"===e.contentEditable)}function pn(e){var t=dn(),r=e.focusedElem,n=e.selectionRange;if(t!==r&&r&&r.ownerDocument&&hn(r.ownerDocument.documentElement,r)){if(null!==n&&fn(r))if(t=n.start,void 0===(e=n.end)&&(e=t),"selectionStart"in r)r.selectionStart=t,r.selectionEnd=Math.min(e,r.value.length);else if((e=(t=r.ownerDocument||document)&&t.defaultView||window).getSelection){e=e.getSelection();var i=r.textContent.length,s=Math.min(n.start,i);n=void 0===n.end?s:Math.min(n.end,i),!e.extend&&s>n&&(i=n,n=s,s=i),i=un(r,s);var o=un(r,n);i&&o&&(1!==e.rangeCount||e.anchorNode!==i.node||e.anchorOffset!==i.offset||e.focusNode!==o.node||e.focusOffset!==o.offset)&&((t=t.createRange()).setStart(i.node,i.offset),e.removeAllRanges(),s>n?(e.addRange(t),e.extend(o.node,o.offset)):(t.setEnd(o.node,o.offset),e.addRange(t)))}for(t=[],e=r;e=e.parentNode;)1===e.nodeType&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for("function"===typeof r.focus&&r.focus(),r=0;r<t.length;r++)(e=t[r]).element.scrollLeft=e.left,e.element.scrollTop=e.top}}var yn=u&&"documentMode"in document&&11>=document.documentMode,gn=null,mn=null,vn=null,bn=!1;function wn(e,t,r){var n=r.window===r?r.document:9===r.nodeType?r:r.ownerDocument;bn||null==gn||gn!==Q(n)||("selectionStart"in(n=gn)&&fn(n)?n={start:n.selectionStart,end:n.selectionEnd}:n={anchorNode:(n=(n.ownerDocument&&n.ownerDocument.defaultView||window).getSelection()).anchorNode,anchorOffset:n.anchorOffset,focusNode:n.focusNode,focusOffset:n.focusOffset},vn&&cn(vn,n)||(vn=n,0<(n=Wn(mn,"onSelect")).length&&(t=new lr("onSelect","select",null,t,r),e.push({event:t,listeners:n}),t.target=gn)))}function En(e,t){var r={};return r[e.toLowerCase()]=t.toLowerCase(),r["Webkit"+e]="webkit"+t,r["Moz"+e]="moz"+t,r}var _n={animationend:En("Animation","AnimationEnd"),animationiteration:En("Animation","AnimationIteration"),animationstart:En("Animation","AnimationStart"),transitionend:En("Transition","TransitionEnd")},Sn={},In={};function Cn(e){if(Sn[e])return Sn[e];if(!_n[e])return e;var t,r=_n[e];for(t in r)if(r.hasOwnProperty(t)&&t in In)return Sn[e]=r[t];return e}u&&(In=document.createElement("div").style,"AnimationEvent"in window||(delete _n.animationend.animation,delete _n.animationiteration.animation,delete _n.animationstart.animation),"TransitionEvent"in window||delete _n.transitionend.transition);var An=Cn("animationend"),Tn=Cn("animationiteration"),kn=Cn("animationstart"),Rn=Cn("transitionend"),Pn=new Map,Dn="abort auxClick cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");function Nn(e,t){Pn.set(e,t),c(t,[e])}for(var xn=0;xn<Dn.length;xn++){var Ln=Dn[xn];Nn(Ln.toLowerCase(),"on"+(Ln[0].toUpperCase()+Ln.slice(1)))}Nn(An,"onAnimationEnd"),Nn(Tn,"onAnimationIteration"),Nn(kn,"onAnimationStart"),Nn("dblclick","onDoubleClick"),Nn("focusin","onFocus"),Nn("focusout","onBlur"),Nn(Rn,"onTransitionEnd"),l("onMouseEnter",["mouseout","mouseover"]),l("onMouseLeave",["mouseout","mouseover"]),l("onPointerEnter",["pointerout","pointerover"]),l("onPointerLeave",["pointerout","pointerover"]),c("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),c("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),c("onBeforeInput",["compositionend","keypress","textInput","paste"]),c("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),c("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),c("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var On="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),Bn=new Set("cancel close invalid load scroll toggle".split(" ").concat(On));function Mn(e,t,r){var n=e.type||"unknown-event";e.currentTarget=r,function(e,t,r,n,i,o,a,c,l){if(je.apply(this,arguments),Be){if(!Be)throw Error(s(198));var u=Me;Be=!1,Me=null,Ue||(Ue=!0,Fe=u)}}(n,t,void 0,e),e.currentTarget=null}function Un(e,t){t=0!==(4&t);for(var r=0;r<e.length;r++){var n=e[r],i=n.event;n=n.listeners;e:{var s=void 0;if(t)for(var o=n.length-1;0<=o;o--){var a=n[o],c=a.instance,l=a.currentTarget;if(a=a.listener,c!==s&&i.isPropagationStopped())break e;Mn(i,a,l),s=c}else for(o=0;o<n.length;o++){if(c=(a=n[o]).instance,l=a.currentTarget,a=a.listener,c!==s&&i.isPropagationStopped())break e;Mn(i,a,l),s=c}}}if(Ue)throw e=Fe,Ue=!1,Fe=null,e}function Fn(e,t){var r=t[yi];void 0===r&&(r=t[yi]=new Set);var n=e+"__bubble";r.has(n)||(qn(t,e,2,!1),r.add(n))}function Vn(e,t,r){var n=0;t&&(n|=4),qn(r,e,n,t)}var jn="_reactListening"+Math.random().toString(36).slice(2);function Kn(e){if(!e[jn]){e[jn]=!0,o.forEach((function(t){"selectionchange"!==t&&(Bn.has(t)||Vn(t,!1,e),Vn(t,!0,e))}));var t=9===e.nodeType?e:e.ownerDocument;null===t||t[jn]||(t[jn]=!0,Vn("selectionchange",!1,t))}}function qn(e,t,r,n){switch($t(t)){case 1:var i=Ht;break;case 4:i=Wt;break;default:i=Gt}r=i.bind(null,t,r,e),i=void 0,!xe||"touchstart"!==t&&"touchmove"!==t&&"wheel"!==t||(i=!0),n?void 0!==i?e.addEventListener(t,r,{capture:!0,passive:i}):e.addEventListener(t,r,!0):void 0!==i?e.addEventListener(t,r,{passive:i}):e.addEventListener(t,r,!1)}function zn(e,t,r,n,i){var s=n;if(0===(1&t)&&0===(2&t)&&null!==n)e:for(;;){if(null===n)return;var o=n.tag;if(3===o||4===o){var a=n.stateNode.containerInfo;if(a===i||8===a.nodeType&&a.parentNode===i)break;if(4===o)for(o=n.return;null!==o;){var c=o.tag;if((3===c||4===c)&&((c=o.stateNode.containerInfo)===i||8===c.nodeType&&c.parentNode===i))return;o=o.return}for(;null!==a;){if(null===(o=vi(a)))return;if(5===(c=o.tag)||6===c){n=s=o;continue e}a=a.parentNode}}n=n.return}De((function(){var n=s,i=Ee(r),o=[];e:{var a=Pn.get(e);if(void 0!==a){var c=lr,l=e;switch(e){case"keypress":if(0===tr(r))break e;case"keydown":case"keyup":c=Ar;break;case"focusin":l="focus",c=yr;break;case"focusout":l="blur",c=yr;break;case"beforeblur":case"afterblur":c=yr;break;case"click":if(2===r.button)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":c=fr;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":c=pr;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":c=kr;break;case An:case Tn:case kn:c=gr;break;case Rn:c=Rr;break;case"scroll":c=hr;break;case"wheel":c=Dr;break;case"copy":case"cut":case"paste":c=vr;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":c=Tr}var u=0!==(4&t),h=!u&&"scroll"===e,d=u?null!==a?a+"Capture":null:a;u=[];for(var f,p=n;null!==p;){var y=(f=p).stateNode;if(5===f.tag&&null!==y&&(f=y,null!==d&&(null!=(y=Ne(p,d))&&u.push(Hn(p,y,f)))),h)break;p=p.return}0<u.length&&(a=new c(a,l,null,r,i),o.push({event:a,listeners:u}))}}if(0===(7&t)){if(c="mouseout"===e||"pointerout"===e,(!(a="mouseover"===e||"pointerover"===e)||r===we||!(l=r.relatedTarget||r.fromElement)||!vi(l)&&!l[pi])&&(c||a)&&(a=i.window===i?i:(a=i.ownerDocument)?a.defaultView||a.parentWindow:window,c?(c=n,null!==(l=(l=r.relatedTarget||r.toElement)?vi(l):null)&&(l!==(h=Ke(l))||5!==l.tag&&6!==l.tag)&&(l=null)):(c=null,l=n),c!==l)){if(u=fr,y="onMouseLeave",d="onMouseEnter",p="mouse","pointerout"!==e&&"pointerover"!==e||(u=Tr,y="onPointerLeave",d="onPointerEnter",p="pointer"),h=null==c?a:wi(c),f=null==l?a:wi(l),(a=new u(y,p+"leave",c,r,i)).target=h,a.relatedTarget=f,y=null,vi(i)===n&&((u=new u(d,p+"enter",l,r,i)).target=f,u.relatedTarget=h,y=u),h=y,c&&l)e:{for(d=l,p=0,f=u=c;f;f=Gn(f))p++;for(f=0,y=d;y;y=Gn(y))f++;for(;0<p-f;)u=Gn(u),p--;for(;0<f-p;)d=Gn(d),f--;for(;p--;){if(u===d||null!==d&&u===d.alternate)break e;u=Gn(u),d=Gn(d)}u=null}else u=null;null!==c&&Qn(o,a,c,u,!1),null!==l&&null!==h&&Qn(o,h,l,u,!0)}if("select"===(c=(a=n?wi(n):window).nodeName&&a.nodeName.toLowerCase())||"input"===c&&"file"===a.type)var g=Yr;else if(qr(a))if($r)g=on;else{g=nn;var m=rn}else(c=a.nodeName)&&"input"===c.toLowerCase()&&("checkbox"===a.type||"radio"===a.type)&&(g=sn);switch(g&&(g=g(e,n))?zr(o,g,r,i):(m&&m(e,a,n),"focusout"===e&&(m=a._wrapperState)&&m.controlled&&"number"===a.type&&ee(a,"number",a.value)),m=n?wi(n):window,e){case"focusin":(qr(m)||"true"===m.contentEditable)&&(gn=m,mn=n,vn=null);break;case"focusout":vn=mn=gn=null;break;case"mousedown":bn=!0;break;case"contextmenu":case"mouseup":case"dragend":bn=!1,wn(o,r,i);break;case"selectionchange":if(yn)break;case"keydown":case"keyup":wn(o,r,i)}var v;if(xr)e:{switch(e){case"compositionstart":var b="onCompositionStart";break e;case"compositionend":b="onCompositionEnd";break e;case"compositionupdate":b="onCompositionUpdate";break e}b=void 0}else jr?Fr(e,r)&&(b="onCompositionEnd"):"keydown"===e&&229===r.keyCode&&(b="onCompositionStart");b&&(Br&&"ko"!==r.locale&&(jr||"onCompositionStart"!==b?"onCompositionEnd"===b&&jr&&(v=er()):(Jt="value"in(Xt=i)?Xt.value:Xt.textContent,jr=!0)),0<(m=Wn(n,b)).length&&(b=new br(b,e,null,r,i),o.push({event:b,listeners:m}),v?b.data=v:null!==(v=Vr(r))&&(b.data=v))),(v=Or?function(e,t){switch(e){case"compositionend":return Vr(t);case"keypress":return 32!==t.which?null:(Ur=!0,Mr);case"textInput":return(e=t.data)===Mr&&Ur?null:e;default:return null}}(e,r):function(e,t){if(jr)return"compositionend"===e||!xr&&Fr(e,t)?(e=er(),Zt=Jt=Xt=null,jr=!1,e):null;switch(e){case"paste":default:return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return Br&&"ko"!==t.locale?null:t.data}}(e,r))&&(0<(n=Wn(n,"onBeforeInput")).length&&(i=new br("onBeforeInput","beforeinput",null,r,i),o.push({event:i,listeners:n}),i.data=v))}Un(o,t)}))}function Hn(e,t,r){return{instance:e,listener:t,currentTarget:r}}function Wn(e,t){for(var r=t+"Capture",n=[];null!==e;){var i=e,s=i.stateNode;5===i.tag&&null!==s&&(i=s,null!=(s=Ne(e,r))&&n.unshift(Hn(e,s,i)),null!=(s=Ne(e,t))&&n.push(Hn(e,s,i))),e=e.return}return n}function Gn(e){if(null===e)return null;do{e=e.return}while(e&&5!==e.tag);return e||null}function Qn(e,t,r,n,i){for(var s=t._reactName,o=[];null!==r&&r!==n;){var a=r,c=a.alternate,l=a.stateNode;if(null!==c&&c===n)break;5===a.tag&&null!==l&&(a=l,i?null!=(c=Ne(r,s))&&o.unshift(Hn(r,c,a)):i||null!=(c=Ne(r,s))&&o.push(Hn(r,c,a))),r=r.return}0!==o.length&&e.push({event:t,listeners:o})}var Yn=/\r\n?/g,$n=/\u0000|\uFFFD/g;function Xn(e){return("string"===typeof e?e:""+e).replace(Yn,"\n").replace($n,"")}function Jn(e,t,r){if(t=Xn(t),Xn(e)!==t&&r)throw Error(s(425))}function Zn(){}var ei=null,ti=null;function ri(e,t){return"textarea"===e||"noscript"===e||"string"===typeof t.children||"number"===typeof t.children||"object"===typeof t.dangerouslySetInnerHTML&&null!==t.dangerouslySetInnerHTML&&null!=t.dangerouslySetInnerHTML.__html}var ni="function"===typeof setTimeout?setTimeout:void 0,ii="function"===typeof clearTimeout?clearTimeout:void 0,si="function"===typeof Promise?Promise:void 0,oi="function"===typeof queueMicrotask?queueMicrotask:"undefined"!==typeof si?function(e){return si.resolve(null).then(e).catch(ai)}:ni;function ai(e){setTimeout((function(){throw e}))}function ci(e,t){var r=t,n=0;do{var i=r.nextSibling;if(e.removeChild(r),i&&8===i.nodeType)if("/$"===(r=i.data)){if(0===n)return e.removeChild(i),void Kt(t);n--}else"$"!==r&&"$?"!==r&&"$!"!==r||n++;r=i}while(r);Kt(t)}function li(e){for(;null!=e;e=e.nextSibling){var t=e.nodeType;if(1===t||3===t)break;if(8===t){if("$"===(t=e.data)||"$!"===t||"$?"===t)break;if("/$"===t)return null}}return e}function ui(e){e=e.previousSibling;for(var t=0;e;){if(8===e.nodeType){var r=e.data;if("$"===r||"$!"===r||"$?"===r){if(0===t)return e;t--}else"/$"===r&&t++}e=e.previousSibling}return null}var hi=Math.random().toString(36).slice(2),di="__reactFiber$"+hi,fi="__reactProps$"+hi,pi="__reactContainer$"+hi,yi="__reactEvents$"+hi,gi="__reactListeners$"+hi,mi="__reactHandles$"+hi;function vi(e){var t=e[di];if(t)return t;for(var r=e.parentNode;r;){if(t=r[pi]||r[di]){if(r=t.alternate,null!==t.child||null!==r&&null!==r.child)for(e=ui(e);null!==e;){if(r=e[di])return r;e=ui(e)}return t}r=(e=r).parentNode}return null}function bi(e){return!(e=e[di]||e[pi])||5!==e.tag&&6!==e.tag&&13!==e.tag&&3!==e.tag?null:e}function wi(e){if(5===e.tag||6===e.tag)return e.stateNode;throw Error(s(33))}function Ei(e){return e[fi]||null}var _i=[],Si=-1;function Ii(e){return{current:e}}function Ci(e){0>Si||(e.current=_i[Si],_i[Si]=null,Si--)}function Ai(e,t){Si++,_i[Si]=e.current,e.current=t}var Ti={},ki=Ii(Ti),Ri=Ii(!1),Pi=Ti;function Di(e,t){var r=e.type.contextTypes;if(!r)return Ti;var n=e.stateNode;if(n&&n.__reactInternalMemoizedUnmaskedChildContext===t)return n.__reactInternalMemoizedMaskedChildContext;var i,s={};for(i in r)s[i]=t[i];return n&&((e=e.stateNode).__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=s),s}function Ni(e){return null!==(e=e.childContextTypes)&&void 0!==e}function xi(){Ci(Ri),Ci(ki)}function Li(e,t,r){if(ki.current!==Ti)throw Error(s(168));Ai(ki,t),Ai(Ri,r)}function Oi(e,t,r){var n=e.stateNode;if(t=t.childContextTypes,"function"!==typeof n.getChildContext)return r;for(var i in n=n.getChildContext())if(!(i in t))throw Error(s(108,q(e)||"Unknown",i));return M({},r,n)}function Bi(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Ti,Pi=ki.current,Ai(ki,e),Ai(Ri,Ri.current),!0}function Mi(e,t,r){var n=e.stateNode;if(!n)throw Error(s(169));r?(e=Oi(e,t,Pi),n.__reactInternalMemoizedMergedChildContext=e,Ci(Ri),Ci(ki),Ai(ki,e)):Ci(Ri),Ai(Ri,r)}var Ui=null,Fi=!1,Vi=!1;function ji(e){null===Ui?Ui=[e]:Ui.push(e)}function Ki(){if(!Vi&&null!==Ui){Vi=!0;var e=0,t=bt;try{var r=Ui;for(bt=1;e<r.length;e++){var n=r[e];do{n=n(!0)}while(null!==n)}Ui=null,Fi=!1}catch(i){throw null!==Ui&&(Ui=Ui.slice(e+1)),Ge(Ze,Ki),i}finally{bt=t,Vi=!1}}return null}var qi=[],zi=0,Hi=null,Wi=0,Gi=[],Qi=0,Yi=null,$i=1,Xi="";function Ji(e,t){qi[zi++]=Wi,qi[zi++]=Hi,Hi=e,Wi=t}function Zi(e,t,r){Gi[Qi++]=$i,Gi[Qi++]=Xi,Gi[Qi++]=Yi,Yi=e;var n=$i;e=Xi;var i=32-ot(n)-1;n&=~(1<<i),r+=1;var s=32-ot(t)+i;if(30<s){var o=i-i%5;s=(n&(1<<o)-1).toString(32),n>>=o,i-=o,$i=1<<32-ot(t)+i|r<<i|n,Xi=s+e}else $i=1<<s|r<<i|n,Xi=e}function es(e){null!==e.return&&(Ji(e,1),Zi(e,1,0))}function ts(e){for(;e===Hi;)Hi=qi[--zi],qi[zi]=null,Wi=qi[--zi],qi[zi]=null;for(;e===Yi;)Yi=Gi[--Qi],Gi[Qi]=null,Xi=Gi[--Qi],Gi[Qi]=null,$i=Gi[--Qi],Gi[Qi]=null}var rs=null,ns=null,is=!1,ss=null;function os(e,t){var r=Dl(5,null,null,0);r.elementType="DELETED",r.stateNode=t,r.return=e,null===(t=e.deletions)?(e.deletions=[r],e.flags|=16):t.push(r)}function as(e,t){switch(e.tag){case 5:var r=e.type;return null!==(t=1!==t.nodeType||r.toLowerCase()!==t.nodeName.toLowerCase()?null:t)&&(e.stateNode=t,rs=e,ns=li(t.firstChild),!0);case 6:return null!==(t=""===e.pendingProps||3!==t.nodeType?null:t)&&(e.stateNode=t,rs=e,ns=null,!0);case 13:return null!==(t=8!==t.nodeType?null:t)&&(r=null!==Yi?{id:$i,overflow:Xi}:null,e.memoizedState={dehydrated:t,treeContext:r,retryLane:1073741824},(r=Dl(18,null,null,0)).stateNode=t,r.return=e,e.child=r,rs=e,ns=null,!0);default:return!1}}function cs(e){return 0!==(1&e.mode)&&0===(128&e.flags)}function ls(e){if(is){var t=ns;if(t){var r=t;if(!as(e,t)){if(cs(e))throw Error(s(418));t=li(r.nextSibling);var n=rs;t&&as(e,t)?os(n,r):(e.flags=-4097&e.flags|2,is=!1,rs=e)}}else{if(cs(e))throw Error(s(418));e.flags=-4097&e.flags|2,is=!1,rs=e}}}function us(e){for(e=e.return;null!==e&&5!==e.tag&&3!==e.tag&&13!==e.tag;)e=e.return;rs=e}function hs(e){if(e!==rs)return!1;if(!is)return us(e),is=!0,!1;var t;if((t=3!==e.tag)&&!(t=5!==e.tag)&&(t="head"!==(t=e.type)&&"body"!==t&&!ri(e.type,e.memoizedProps)),t&&(t=ns)){if(cs(e))throw ds(),Error(s(418));for(;t;)os(e,t),t=li(t.nextSibling)}if(us(e),13===e.tag){if(!(e=null!==(e=e.memoizedState)?e.dehydrated:null))throw Error(s(317));e:{for(e=e.nextSibling,t=0;e;){if(8===e.nodeType){var r=e.data;if("/$"===r){if(0===t){ns=li(e.nextSibling);break e}t--}else"$"!==r&&"$!"!==r&&"$?"!==r||t++}e=e.nextSibling}ns=null}}else ns=rs?li(e.stateNode.nextSibling):null;return!0}function ds(){for(var e=ns;e;)e=li(e.nextSibling)}function fs(){ns=rs=null,is=!1}function ps(e){null===ss?ss=[e]:ss.push(e)}var ys=w.ReactCurrentBatchConfig;function gs(e,t){if(e&&e.defaultProps){for(var r in t=M({},t),e=e.defaultProps)void 0===t[r]&&(t[r]=e[r]);return t}return t}var ms=Ii(null),vs=null,bs=null,ws=null;function Es(){ws=bs=vs=null}function _s(e){var t=ms.current;Ci(ms),e._currentValue=t}function Ss(e,t,r){for(;null!==e;){var n=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,null!==n&&(n.childLanes|=t)):null!==n&&(n.childLanes&t)!==t&&(n.childLanes|=t),e===r)break;e=e.return}}function Is(e,t){vs=e,ws=bs=null,null!==(e=e.dependencies)&&null!==e.firstContext&&(0!==(e.lanes&t)&&(wa=!0),e.firstContext=null)}function Cs(e){var t=e._currentValue;if(ws!==e)if(e={context:e,memoizedValue:t,next:null},null===bs){if(null===vs)throw Error(s(308));bs=e,vs.dependencies={lanes:0,firstContext:e}}else bs=bs.next=e;return t}var As=null;function Ts(e){null===As?As=[e]:As.push(e)}function ks(e,t,r,n){var i=t.interleaved;return null===i?(r.next=r,Ts(t)):(r.next=i.next,i.next=r),t.interleaved=r,Rs(e,n)}function Rs(e,t){e.lanes|=t;var r=e.alternate;for(null!==r&&(r.lanes|=t),r=e,e=e.return;null!==e;)e.childLanes|=t,null!==(r=e.alternate)&&(r.childLanes|=t),r=e,e=e.return;return 3===r.tag?r.stateNode:null}var Ps=!1;function Ds(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Ns(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function xs(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function Ls(e,t,r){var n=e.updateQueue;if(null===n)return null;if(n=n.shared,0!==(2&kc)){var i=n.pending;return null===i?t.next=t:(t.next=i.next,i.next=t),n.pending=t,Rs(e,r)}return null===(i=n.interleaved)?(t.next=t,Ts(n)):(t.next=i.next,i.next=t),n.interleaved=t,Rs(e,r)}function Os(e,t,r){if(null!==(t=t.updateQueue)&&(t=t.shared,0!==(4194240&r))){var n=t.lanes;r|=n&=e.pendingLanes,t.lanes=r,vt(e,r)}}function Bs(e,t){var r=e.updateQueue,n=e.alternate;if(null!==n&&r===(n=n.updateQueue)){var i=null,s=null;if(null!==(r=r.firstBaseUpdate)){do{var o={eventTime:r.eventTime,lane:r.lane,tag:r.tag,payload:r.payload,callback:r.callback,next:null};null===s?i=s=o:s=s.next=o,r=r.next}while(null!==r);null===s?i=s=t:s=s.next=t}else i=s=t;return r={baseState:n.baseState,firstBaseUpdate:i,lastBaseUpdate:s,shared:n.shared,effects:n.effects},void(e.updateQueue=r)}null===(e=r.lastBaseUpdate)?r.firstBaseUpdate=t:e.next=t,r.lastBaseUpdate=t}function Ms(e,t,r,n){var i=e.updateQueue;Ps=!1;var s=i.firstBaseUpdate,o=i.lastBaseUpdate,a=i.shared.pending;if(null!==a){i.shared.pending=null;var c=a,l=c.next;c.next=null,null===o?s=l:o.next=l,o=c;var u=e.alternate;null!==u&&((a=(u=u.updateQueue).lastBaseUpdate)!==o&&(null===a?u.firstBaseUpdate=l:a.next=l,u.lastBaseUpdate=c))}if(null!==s){var h=i.baseState;for(o=0,u=l=c=null,a=s;;){var d=a.lane,f=a.eventTime;if((n&d)===d){null!==u&&(u=u.next={eventTime:f,lane:0,tag:a.tag,payload:a.payload,callback:a.callback,next:null});e:{var p=e,y=a;switch(d=t,f=r,y.tag){case 1:if("function"===typeof(p=y.payload)){h=p.call(f,h,d);break e}h=p;break e;case 3:p.flags=-65537&p.flags|128;case 0:if(null===(d="function"===typeof(p=y.payload)?p.call(f,h,d):p)||void 0===d)break e;h=M({},h,d);break e;case 2:Ps=!0}}null!==a.callback&&0!==a.lane&&(e.flags|=64,null===(d=i.effects)?i.effects=[a]:d.push(a))}else f={eventTime:f,lane:d,tag:a.tag,payload:a.payload,callback:a.callback,next:null},null===u?(l=u=f,c=h):u=u.next=f,o|=d;if(null===(a=a.next)){if(null===(a=i.shared.pending))break;a=(d=a).next,d.next=null,i.lastBaseUpdate=d,i.shared.pending=null}}if(null===u&&(c=h),i.baseState=c,i.firstBaseUpdate=l,i.lastBaseUpdate=u,null!==(t=i.shared.interleaved)){i=t;do{o|=i.lane,i=i.next}while(i!==t)}else null===s&&(i.shared.lanes=0);Bc|=o,e.lanes=o,e.memoizedState=h}}function Us(e,t,r){if(e=t.effects,t.effects=null,null!==e)for(t=0;t<e.length;t++){var n=e[t],i=n.callback;if(null!==i){if(n.callback=null,n=r,"function"!==typeof i)throw Error(s(191,i));i.call(n)}}}var Fs=(new n.Component).refs;function Vs(e,t,r,n){r=null===(r=r(n,t=e.memoizedState))||void 0===r?t:M({},t,r),e.memoizedState=r,0===e.lanes&&(e.updateQueue.baseState=r)}var js={isMounted:function(e){return!!(e=e._reactInternals)&&Ke(e)===e},enqueueSetState:function(e,t,r){e=e._reactInternals;var n=el(),i=tl(e),s=xs(n,i);s.payload=t,void 0!==r&&null!==r&&(s.callback=r),null!==(t=Ls(e,s,i))&&(rl(t,e,i,n),Os(t,e,i))},enqueueReplaceState:function(e,t,r){e=e._reactInternals;var n=el(),i=tl(e),s=xs(n,i);s.tag=1,s.payload=t,void 0!==r&&null!==r&&(s.callback=r),null!==(t=Ls(e,s,i))&&(rl(t,e,i,n),Os(t,e,i))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var r=el(),n=tl(e),i=xs(r,n);i.tag=2,void 0!==t&&null!==t&&(i.callback=t),null!==(t=Ls(e,i,n))&&(rl(t,e,n,r),Os(t,e,n))}};function Ks(e,t,r,n,i,s,o){return"function"===typeof(e=e.stateNode).shouldComponentUpdate?e.shouldComponentUpdate(n,s,o):!t.prototype||!t.prototype.isPureReactComponent||(!cn(r,n)||!cn(i,s))}function qs(e,t,r){var n=!1,i=Ti,s=t.contextType;return"object"===typeof s&&null!==s?s=Cs(s):(i=Ni(t)?Pi:ki.current,s=(n=null!==(n=t.contextTypes)&&void 0!==n)?Di(e,i):Ti),t=new t(r,s),e.memoizedState=null!==t.state&&void 0!==t.state?t.state:null,t.updater=js,e.stateNode=t,t._reactInternals=e,n&&((e=e.stateNode).__reactInternalMemoizedUnmaskedChildContext=i,e.__reactInternalMemoizedMaskedChildContext=s),t}function zs(e,t,r,n){e=t.state,"function"===typeof t.componentWillReceiveProps&&t.componentWillReceiveProps(r,n),"function"===typeof t.UNSAFE_componentWillReceiveProps&&t.UNSAFE_componentWillReceiveProps(r,n),t.state!==e&&js.enqueueReplaceState(t,t.state,null)}function Hs(e,t,r,n){var i=e.stateNode;i.props=r,i.state=e.memoizedState,i.refs=Fs,Ds(e);var s=t.contextType;"object"===typeof s&&null!==s?i.context=Cs(s):(s=Ni(t)?Pi:ki.current,i.context=Di(e,s)),i.state=e.memoizedState,"function"===typeof(s=t.getDerivedStateFromProps)&&(Vs(e,t,s,r),i.state=e.memoizedState),"function"===typeof t.getDerivedStateFromProps||"function"===typeof i.getSnapshotBeforeUpdate||"function"!==typeof i.UNSAFE_componentWillMount&&"function"!==typeof i.componentWillMount||(t=i.state,"function"===typeof i.componentWillMount&&i.componentWillMount(),"function"===typeof i.UNSAFE_componentWillMount&&i.UNSAFE_componentWillMount(),t!==i.state&&js.enqueueReplaceState(i,i.state,null),Ms(e,r,i,n),i.state=e.memoizedState),"function"===typeof i.componentDidMount&&(e.flags|=4194308)}function Ws(e,t,r){if(null!==(e=r.ref)&&"function"!==typeof e&&"object"!==typeof e){if(r._owner){if(r=r._owner){if(1!==r.tag)throw Error(s(309));var n=r.stateNode}if(!n)throw Error(s(147,e));var i=n,o=""+e;return null!==t&&null!==t.ref&&"function"===typeof t.ref&&t.ref._stringRef===o?t.ref:(t=function(e){var t=i.refs;t===Fs&&(t=i.refs={}),null===e?delete t[o]:t[o]=e},t._stringRef=o,t)}if("string"!==typeof e)throw Error(s(284));if(!r._owner)throw Error(s(290,e))}return e}function Gs(e,t){throw e=Object.prototype.toString.call(t),Error(s(31,"[object Object]"===e?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function Qs(e){return(0,e._init)(e._payload)}function Ys(e){function t(t,r){if(e){var n=t.deletions;null===n?(t.deletions=[r],t.flags|=16):n.push(r)}}function r(r,n){if(!e)return null;for(;null!==n;)t(r,n),n=n.sibling;return null}function n(e,t){for(e=new Map;null!==t;)null!==t.key?e.set(t.key,t):e.set(t.index,t),t=t.sibling;return e}function i(e,t){return(e=xl(e,t)).index=0,e.sibling=null,e}function o(t,r,n){return t.index=n,e?null!==(n=t.alternate)?(n=n.index)<r?(t.flags|=2,r):n:(t.flags|=2,r):(t.flags|=1048576,r)}function a(t){return e&&null===t.alternate&&(t.flags|=2),t}function c(e,t,r,n){return null===t||6!==t.tag?((t=Ml(r,e.mode,n)).return=e,t):((t=i(t,r)).return=e,t)}function l(e,t,r,n){var s=r.type;return s===S?h(e,t,r.props.children,n,r.key):null!==t&&(t.elementType===s||"object"===typeof s&&null!==s&&s.$$typeof===N&&Qs(s)===t.type)?((n=i(t,r.props)).ref=Ws(e,t,r),n.return=e,n):((n=Ll(r.type,r.key,r.props,null,e.mode,n)).ref=Ws(e,t,r),n.return=e,n)}function u(e,t,r,n){return null===t||4!==t.tag||t.stateNode.containerInfo!==r.containerInfo||t.stateNode.implementation!==r.implementation?((t=Ul(r,e.mode,n)).return=e,t):((t=i(t,r.children||[])).return=e,t)}function h(e,t,r,n,s){return null===t||7!==t.tag?((t=Ol(r,e.mode,n,s)).return=e,t):((t=i(t,r)).return=e,t)}function d(e,t,r){if("string"===typeof t&&""!==t||"number"===typeof t)return(t=Ml(""+t,e.mode,r)).return=e,t;if("object"===typeof t&&null!==t){switch(t.$$typeof){case E:return(r=Ll(t.type,t.key,t.props,null,e.mode,r)).ref=Ws(e,null,t),r.return=e,r;case _:return(t=Ul(t,e.mode,r)).return=e,t;case N:return d(e,(0,t._init)(t._payload),r)}if(te(t)||O(t))return(t=Ol(t,e.mode,r,null)).return=e,t;Gs(e,t)}return null}function f(e,t,r,n){var i=null!==t?t.key:null;if("string"===typeof r&&""!==r||"number"===typeof r)return null!==i?null:c(e,t,""+r,n);if("object"===typeof r&&null!==r){switch(r.$$typeof){case E:return r.key===i?l(e,t,r,n):null;case _:return r.key===i?u(e,t,r,n):null;case N:return f(e,t,(i=r._init)(r._payload),n)}if(te(r)||O(r))return null!==i?null:h(e,t,r,n,null);Gs(e,r)}return null}function p(e,t,r,n,i){if("string"===typeof n&&""!==n||"number"===typeof n)return c(t,e=e.get(r)||null,""+n,i);if("object"===typeof n&&null!==n){switch(n.$$typeof){case E:return l(t,e=e.get(null===n.key?r:n.key)||null,n,i);case _:return u(t,e=e.get(null===n.key?r:n.key)||null,n,i);case N:return p(e,t,r,(0,n._init)(n._payload),i)}if(te(n)||O(n))return h(t,e=e.get(r)||null,n,i,null);Gs(t,n)}return null}function y(i,s,a,c){for(var l=null,u=null,h=s,y=s=0,g=null;null!==h&&y<a.length;y++){h.index>y?(g=h,h=null):g=h.sibling;var m=f(i,h,a[y],c);if(null===m){null===h&&(h=g);break}e&&h&&null===m.alternate&&t(i,h),s=o(m,s,y),null===u?l=m:u.sibling=m,u=m,h=g}if(y===a.length)return r(i,h),is&&Ji(i,y),l;if(null===h){for(;y<a.length;y++)null!==(h=d(i,a[y],c))&&(s=o(h,s,y),null===u?l=h:u.sibling=h,u=h);return is&&Ji(i,y),l}for(h=n(i,h);y<a.length;y++)null!==(g=p(h,i,y,a[y],c))&&(e&&null!==g.alternate&&h.delete(null===g.key?y:g.key),s=o(g,s,y),null===u?l=g:u.sibling=g,u=g);return e&&h.forEach((function(e){return t(i,e)})),is&&Ji(i,y),l}function g(i,a,c,l){var u=O(c);if("function"!==typeof u)throw Error(s(150));if(null==(c=u.call(c)))throw Error(s(151));for(var h=u=null,y=a,g=a=0,m=null,v=c.next();null!==y&&!v.done;g++,v=c.next()){y.index>g?(m=y,y=null):m=y.sibling;var b=f(i,y,v.value,l);if(null===b){null===y&&(y=m);break}e&&y&&null===b.alternate&&t(i,y),a=o(b,a,g),null===h?u=b:h.sibling=b,h=b,y=m}if(v.done)return r(i,y),is&&Ji(i,g),u;if(null===y){for(;!v.done;g++,v=c.next())null!==(v=d(i,v.value,l))&&(a=o(v,a,g),null===h?u=v:h.sibling=v,h=v);return is&&Ji(i,g),u}for(y=n(i,y);!v.done;g++,v=c.next())null!==(v=p(y,i,g,v.value,l))&&(e&&null!==v.alternate&&y.delete(null===v.key?g:v.key),a=o(v,a,g),null===h?u=v:h.sibling=v,h=v);return e&&y.forEach((function(e){return t(i,e)})),is&&Ji(i,g),u}return function e(n,s,o,c){if("object"===typeof o&&null!==o&&o.type===S&&null===o.key&&(o=o.props.children),"object"===typeof o&&null!==o){switch(o.$$typeof){case E:e:{for(var l=o.key,u=s;null!==u;){if(u.key===l){if((l=o.type)===S){if(7===u.tag){r(n,u.sibling),(s=i(u,o.props.children)).return=n,n=s;break e}}else if(u.elementType===l||"object"===typeof l&&null!==l&&l.$$typeof===N&&Qs(l)===u.type){r(n,u.sibling),(s=i(u,o.props)).ref=Ws(n,u,o),s.return=n,n=s;break e}r(n,u);break}t(n,u),u=u.sibling}o.type===S?((s=Ol(o.props.children,n.mode,c,o.key)).return=n,n=s):((c=Ll(o.type,o.key,o.props,null,n.mode,c)).ref=Ws(n,s,o),c.return=n,n=c)}return a(n);case _:e:{for(u=o.key;null!==s;){if(s.key===u){if(4===s.tag&&s.stateNode.containerInfo===o.containerInfo&&s.stateNode.implementation===o.implementation){r(n,s.sibling),(s=i(s,o.children||[])).return=n,n=s;break e}r(n,s);break}t(n,s),s=s.sibling}(s=Ul(o,n.mode,c)).return=n,n=s}return a(n);case N:return e(n,s,(u=o._init)(o._payload),c)}if(te(o))return y(n,s,o,c);if(O(o))return g(n,s,o,c);Gs(n,o)}return"string"===typeof o&&""!==o||"number"===typeof o?(o=""+o,null!==s&&6===s.tag?(r(n,s.sibling),(s=i(s,o)).return=n,n=s):(r(n,s),(s=Ml(o,n.mode,c)).return=n,n=s),a(n)):r(n,s)}}var $s=Ys(!0),Xs=Ys(!1),Js={},Zs=Ii(Js),eo=Ii(Js),to=Ii(Js);function ro(e){if(e===Js)throw Error(s(174));return e}function no(e,t){switch(Ai(to,t),Ai(eo,e),Ai(Zs,Js),e=t.nodeType){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:ce(null,"");break;default:t=ce(t=(e=8===e?t.parentNode:t).namespaceURI||null,e=e.tagName)}Ci(Zs),Ai(Zs,t)}function io(){Ci(Zs),Ci(eo),Ci(to)}function so(e){ro(to.current);var t=ro(Zs.current),r=ce(t,e.type);t!==r&&(Ai(eo,e),Ai(Zs,r))}function oo(e){eo.current===e&&(Ci(Zs),Ci(eo))}var ao=Ii(0);function co(e){for(var t=e;null!==t;){if(13===t.tag){var r=t.memoizedState;if(null!==r&&(null===(r=r.dehydrated)||"$?"===r.data||"$!"===r.data))return t}else if(19===t.tag&&void 0!==t.memoizedProps.revealOrder){if(0!==(128&t.flags))return t}else if(null!==t.child){t.child.return=t,t=t.child;continue}if(t===e)break;for(;null===t.sibling;){if(null===t.return||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var lo=[];function uo(){for(var e=0;e<lo.length;e++)lo[e]._workInProgressVersionPrimary=null;lo.length=0}var ho=w.ReactCurrentDispatcher,fo=w.ReactCurrentBatchConfig,po=0,yo=null,go=null,mo=null,vo=!1,bo=!1,wo=0,Eo=0;function _o(){throw Error(s(321))}function So(e,t){if(null===t)return!1;for(var r=0;r<t.length&&r<e.length;r++)if(!an(e[r],t[r]))return!1;return!0}function Io(e,t,r,n,i,o){if(po=o,yo=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,ho.current=null===e||null===e.memoizedState?aa:ca,e=r(n,i),bo){o=0;do{if(bo=!1,wo=0,25<=o)throw Error(s(301));o+=1,mo=go=null,t.updateQueue=null,ho.current=la,e=r(n,i)}while(bo)}if(ho.current=oa,t=null!==go&&null!==go.next,po=0,mo=go=yo=null,vo=!1,t)throw Error(s(300));return e}function Co(){var e=0!==wo;return wo=0,e}function Ao(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return null===mo?yo.memoizedState=mo=e:mo=mo.next=e,mo}function To(){if(null===go){var e=yo.alternate;e=null!==e?e.memoizedState:null}else e=go.next;var t=null===mo?yo.memoizedState:mo.next;if(null!==t)mo=t,go=e;else{if(null===e)throw Error(s(310));e={memoizedState:(go=e).memoizedState,baseState:go.baseState,baseQueue:go.baseQueue,queue:go.queue,next:null},null===mo?yo.memoizedState=mo=e:mo=mo.next=e}return mo}function ko(e,t){return"function"===typeof t?t(e):t}function Ro(e){var t=To(),r=t.queue;if(null===r)throw Error(s(311));r.lastRenderedReducer=e;var n=go,i=n.baseQueue,o=r.pending;if(null!==o){if(null!==i){var a=i.next;i.next=o.next,o.next=a}n.baseQueue=i=o,r.pending=null}if(null!==i){o=i.next,n=n.baseState;var c=a=null,l=null,u=o;do{var h=u.lane;if((po&h)===h)null!==l&&(l=l.next={lane:0,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),n=u.hasEagerState?u.eagerState:e(n,u.action);else{var d={lane:h,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null};null===l?(c=l=d,a=n):l=l.next=d,yo.lanes|=h,Bc|=h}u=u.next}while(null!==u&&u!==o);null===l?a=n:l.next=c,an(n,t.memoizedState)||(wa=!0),t.memoizedState=n,t.baseState=a,t.baseQueue=l,r.lastRenderedState=n}if(null!==(e=r.interleaved)){i=e;do{o=i.lane,yo.lanes|=o,Bc|=o,i=i.next}while(i!==e)}else null===i&&(r.lanes=0);return[t.memoizedState,r.dispatch]}function Po(e){var t=To(),r=t.queue;if(null===r)throw Error(s(311));r.lastRenderedReducer=e;var n=r.dispatch,i=r.pending,o=t.memoizedState;if(null!==i){r.pending=null;var a=i=i.next;do{o=e(o,a.action),a=a.next}while(a!==i);an(o,t.memoizedState)||(wa=!0),t.memoizedState=o,null===t.baseQueue&&(t.baseState=o),r.lastRenderedState=o}return[o,n]}function Do(){}function No(e,t){var r=yo,n=To(),i=t(),o=!an(n.memoizedState,i);if(o&&(n.memoizedState=i,wa=!0),n=n.queue,zo(Oo.bind(null,r,n,e),[e]),n.getSnapshot!==t||o||null!==mo&&1&mo.memoizedState.tag){if(r.flags|=2048,Fo(9,Lo.bind(null,r,n,i,t),void 0,null),null===Rc)throw Error(s(349));0!==(30&po)||xo(r,t,i)}return i}function xo(e,t,r){e.flags|=16384,e={getSnapshot:t,value:r},null===(t=yo.updateQueue)?(t={lastEffect:null,stores:null},yo.updateQueue=t,t.stores=[e]):null===(r=t.stores)?t.stores=[e]:r.push(e)}function Lo(e,t,r,n){t.value=r,t.getSnapshot=n,Bo(t)&&Mo(e)}function Oo(e,t,r){return r((function(){Bo(t)&&Mo(e)}))}function Bo(e){var t=e.getSnapshot;e=e.value;try{var r=t();return!an(e,r)}catch(n){return!0}}function Mo(e){var t=Rs(e,1);null!==t&&rl(t,e,1,-1)}function Uo(e){var t=Ao();return"function"===typeof e&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:ko,lastRenderedState:e},t.queue=e,e=e.dispatch=ra.bind(null,yo,e),[t.memoizedState,e]}function Fo(e,t,r,n){return e={tag:e,create:t,destroy:r,deps:n,next:null},null===(t=yo.updateQueue)?(t={lastEffect:null,stores:null},yo.updateQueue=t,t.lastEffect=e.next=e):null===(r=t.lastEffect)?t.lastEffect=e.next=e:(n=r.next,r.next=e,e.next=n,t.lastEffect=e),e}function Vo(){return To().memoizedState}function jo(e,t,r,n){var i=Ao();yo.flags|=e,i.memoizedState=Fo(1|t,r,void 0,void 0===n?null:n)}function Ko(e,t,r,n){var i=To();n=void 0===n?null:n;var s=void 0;if(null!==go){var o=go.memoizedState;if(s=o.destroy,null!==n&&So(n,o.deps))return void(i.memoizedState=Fo(t,r,s,n))}yo.flags|=e,i.memoizedState=Fo(1|t,r,s,n)}function qo(e,t){return jo(8390656,8,e,t)}function zo(e,t){return Ko(2048,8,e,t)}function Ho(e,t){return Ko(4,2,e,t)}function Wo(e,t){return Ko(4,4,e,t)}function Go(e,t){return"function"===typeof t?(e=e(),t(e),function(){t(null)}):null!==t&&void 0!==t?(e=e(),t.current=e,function(){t.current=null}):void 0}function Qo(e,t,r){return r=null!==r&&void 0!==r?r.concat([e]):null,Ko(4,4,Go.bind(null,t,e),r)}function Yo(){}function $o(e,t){var r=To();t=void 0===t?null:t;var n=r.memoizedState;return null!==n&&null!==t&&So(t,n[1])?n[0]:(r.memoizedState=[e,t],e)}function Xo(e,t){var r=To();t=void 0===t?null:t;var n=r.memoizedState;return null!==n&&null!==t&&So(t,n[1])?n[0]:(e=e(),r.memoizedState=[e,t],e)}function Jo(e,t,r){return 0===(21&po)?(e.baseState&&(e.baseState=!1,wa=!0),e.memoizedState=r):(an(r,t)||(r=yt(),yo.lanes|=r,Bc|=r,e.baseState=!0),t)}function Zo(e,t){var r=bt;bt=0!==r&&4>r?r:4,e(!0);var n=fo.transition;fo.transition={};try{e(!1),t()}finally{bt=r,fo.transition=n}}function ea(){return To().memoizedState}function ta(e,t,r){var n=tl(e);if(r={lane:n,action:r,hasEagerState:!1,eagerState:null,next:null},na(e))ia(t,r);else if(null!==(r=ks(e,t,r,n))){rl(r,e,n,el()),sa(r,t,n)}}function ra(e,t,r){var n=tl(e),i={lane:n,action:r,hasEagerState:!1,eagerState:null,next:null};if(na(e))ia(t,i);else{var s=e.alternate;if(0===e.lanes&&(null===s||0===s.lanes)&&null!==(s=t.lastRenderedReducer))try{var o=t.lastRenderedState,a=s(o,r);if(i.hasEagerState=!0,i.eagerState=a,an(a,o)){var c=t.interleaved;return null===c?(i.next=i,Ts(t)):(i.next=c.next,c.next=i),void(t.interleaved=i)}}catch(l){}null!==(r=ks(e,t,i,n))&&(rl(r,e,n,i=el()),sa(r,t,n))}}function na(e){var t=e.alternate;return e===yo||null!==t&&t===yo}function ia(e,t){bo=vo=!0;var r=e.pending;null===r?t.next=t:(t.next=r.next,r.next=t),e.pending=t}function sa(e,t,r){if(0!==(4194240&r)){var n=t.lanes;r|=n&=e.pendingLanes,t.lanes=r,vt(e,r)}}var oa={readContext:Cs,useCallback:_o,useContext:_o,useEffect:_o,useImperativeHandle:_o,useInsertionEffect:_o,useLayoutEffect:_o,useMemo:_o,useReducer:_o,useRef:_o,useState:_o,useDebugValue:_o,useDeferredValue:_o,useTransition:_o,useMutableSource:_o,useSyncExternalStore:_o,useId:_o,unstable_isNewReconciler:!1},aa={readContext:Cs,useCallback:function(e,t){return Ao().memoizedState=[e,void 0===t?null:t],e},useContext:Cs,useEffect:qo,useImperativeHandle:function(e,t,r){return r=null!==r&&void 0!==r?r.concat([e]):null,jo(4194308,4,Go.bind(null,t,e),r)},useLayoutEffect:function(e,t){return jo(4194308,4,e,t)},useInsertionEffect:function(e,t){return jo(4,2,e,t)},useMemo:function(e,t){var r=Ao();return t=void 0===t?null:t,e=e(),r.memoizedState=[e,t],e},useReducer:function(e,t,r){var n=Ao();return t=void 0!==r?r(t):t,n.memoizedState=n.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},n.queue=e,e=e.dispatch=ta.bind(null,yo,e),[n.memoizedState,e]},useRef:function(e){return e={current:e},Ao().memoizedState=e},useState:Uo,useDebugValue:Yo,useDeferredValue:function(e){return Ao().memoizedState=e},useTransition:function(){var e=Uo(!1),t=e[0];return e=Zo.bind(null,e[1]),Ao().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,r){var n=yo,i=Ao();if(is){if(void 0===r)throw Error(s(407));r=r()}else{if(r=t(),null===Rc)throw Error(s(349));0!==(30&po)||xo(n,t,r)}i.memoizedState=r;var o={value:r,getSnapshot:t};return i.queue=o,qo(Oo.bind(null,n,o,e),[e]),n.flags|=2048,Fo(9,Lo.bind(null,n,o,r,t),void 0,null),r},useId:function(){var e=Ao(),t=Rc.identifierPrefix;if(is){var r=Xi;t=":"+t+"R"+(r=($i&~(1<<32-ot($i)-1)).toString(32)+r),0<(r=wo++)&&(t+="H"+r.toString(32)),t+=":"}else t=":"+t+"r"+(r=Eo++).toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},ca={readContext:Cs,useCallback:$o,useContext:Cs,useEffect:zo,useImperativeHandle:Qo,useInsertionEffect:Ho,useLayoutEffect:Wo,useMemo:Xo,useReducer:Ro,useRef:Vo,useState:function(){return Ro(ko)},useDebugValue:Yo,useDeferredValue:function(e){return Jo(To(),go.memoizedState,e)},useTransition:function(){return[Ro(ko)[0],To().memoizedState]},useMutableSource:Do,useSyncExternalStore:No,useId:ea,unstable_isNewReconciler:!1},la={readContext:Cs,useCallback:$o,useContext:Cs,useEffect:zo,useImperativeHandle:Qo,useInsertionEffect:Ho,useLayoutEffect:Wo,useMemo:Xo,useReducer:Po,useRef:Vo,useState:function(){return Po(ko)},useDebugValue:Yo,useDeferredValue:function(e){var t=To();return null===go?t.memoizedState=e:Jo(t,go.memoizedState,e)},useTransition:function(){return[Po(ko)[0],To().memoizedState]},useMutableSource:Do,useSyncExternalStore:No,useId:ea,unstable_isNewReconciler:!1};function ua(e,t){try{var r="",n=t;do{r+=j(n),n=n.return}while(n);var i=r}catch(s){i="\nError generating stack: "+s.message+"\n"+s.stack}return{value:e,source:t,stack:i,digest:null}}function ha(e,t,r){return{value:e,source:null,stack:null!=r?r:null,digest:null!=t?t:null}}function da(e,t){try{console.error(t.value)}catch(r){setTimeout((function(){throw r}))}}var fa="function"===typeof WeakMap?WeakMap:Map;function pa(e,t,r){(r=xs(-1,r)).tag=3,r.payload={element:null};var n=t.value;return r.callback=function(){zc||(zc=!0,Hc=n),da(0,t)},r}function ya(e,t,r){(r=xs(-1,r)).tag=3;var n=e.type.getDerivedStateFromError;if("function"===typeof n){var i=t.value;r.payload=function(){return n(i)},r.callback=function(){da(0,t)}}var s=e.stateNode;return null!==s&&"function"===typeof s.componentDidCatch&&(r.callback=function(){da(0,t),"function"!==typeof n&&(null===Wc?Wc=new Set([this]):Wc.add(this));var e=t.stack;this.componentDidCatch(t.value,{componentStack:null!==e?e:""})}),r}function ga(e,t,r){var n=e.pingCache;if(null===n){n=e.pingCache=new fa;var i=new Set;n.set(t,i)}else void 0===(i=n.get(t))&&(i=new Set,n.set(t,i));i.has(r)||(i.add(r),e=Cl.bind(null,e,t,r),t.then(e,e))}function ma(e){do{var t;if((t=13===e.tag)&&(t=null===(t=e.memoizedState)||null!==t.dehydrated),t)return e;e=e.return}while(null!==e);return null}function va(e,t,r,n,i){return 0===(1&e.mode)?(e===t?e.flags|=65536:(e.flags|=128,r.flags|=131072,r.flags&=-52805,1===r.tag&&(null===r.alternate?r.tag=17:((t=xs(-1,1)).tag=2,Ls(r,t,1))),r.lanes|=1),e):(e.flags|=65536,e.lanes=i,e)}var ba=w.ReactCurrentOwner,wa=!1;function Ea(e,t,r,n){t.child=null===e?Xs(t,null,r,n):$s(t,e.child,r,n)}function _a(e,t,r,n,i){r=r.render;var s=t.ref;return Is(t,i),n=Io(e,t,r,n,s,i),r=Co(),null===e||wa?(is&&r&&es(t),t.flags|=1,Ea(e,t,n,i),t.child):(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,za(e,t,i))}function Sa(e,t,r,n,i){if(null===e){var s=r.type;return"function"!==typeof s||Nl(s)||void 0!==s.defaultProps||null!==r.compare||void 0!==r.defaultProps?((e=Ll(r.type,null,n,t,t.mode,i)).ref=t.ref,e.return=t,t.child=e):(t.tag=15,t.type=s,Ia(e,t,s,n,i))}if(s=e.child,0===(e.lanes&i)){var o=s.memoizedProps;if((r=null!==(r=r.compare)?r:cn)(o,n)&&e.ref===t.ref)return za(e,t,i)}return t.flags|=1,(e=xl(s,n)).ref=t.ref,e.return=t,t.child=e}function Ia(e,t,r,n,i){if(null!==e){var s=e.memoizedProps;if(cn(s,n)&&e.ref===t.ref){if(wa=!1,t.pendingProps=n=s,0===(e.lanes&i))return t.lanes=e.lanes,za(e,t,i);0!==(131072&e.flags)&&(wa=!0)}}return Ta(e,t,r,n,i)}function Ca(e,t,r){var n=t.pendingProps,i=n.children,s=null!==e?e.memoizedState:null;if("hidden"===n.mode)if(0===(1&t.mode))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},Ai(xc,Nc),Nc|=r;else{if(0===(1073741824&r))return e=null!==s?s.baseLanes|r:r,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,Ai(xc,Nc),Nc|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},n=null!==s?s.baseLanes:r,Ai(xc,Nc),Nc|=n}else null!==s?(n=s.baseLanes|r,t.memoizedState=null):n=r,Ai(xc,Nc),Nc|=n;return Ea(e,t,i,r),t.child}function Aa(e,t){var r=t.ref;(null===e&&null!==r||null!==e&&e.ref!==r)&&(t.flags|=512,t.flags|=2097152)}function Ta(e,t,r,n,i){var s=Ni(r)?Pi:ki.current;return s=Di(t,s),Is(t,i),r=Io(e,t,r,n,s,i),n=Co(),null===e||wa?(is&&n&&es(t),t.flags|=1,Ea(e,t,r,i),t.child):(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,za(e,t,i))}function ka(e,t,r,n,i){if(Ni(r)){var s=!0;Bi(t)}else s=!1;if(Is(t,i),null===t.stateNode)qa(e,t),qs(t,r,n),Hs(t,r,n,i),n=!0;else if(null===e){var o=t.stateNode,a=t.memoizedProps;o.props=a;var c=o.context,l=r.contextType;"object"===typeof l&&null!==l?l=Cs(l):l=Di(t,l=Ni(r)?Pi:ki.current);var u=r.getDerivedStateFromProps,h="function"===typeof u||"function"===typeof o.getSnapshotBeforeUpdate;h||"function"!==typeof o.UNSAFE_componentWillReceiveProps&&"function"!==typeof o.componentWillReceiveProps||(a!==n||c!==l)&&zs(t,o,n,l),Ps=!1;var d=t.memoizedState;o.state=d,Ms(t,n,o,i),c=t.memoizedState,a!==n||d!==c||Ri.current||Ps?("function"===typeof u&&(Vs(t,r,u,n),c=t.memoizedState),(a=Ps||Ks(t,r,a,n,d,c,l))?(h||"function"!==typeof o.UNSAFE_componentWillMount&&"function"!==typeof o.componentWillMount||("function"===typeof o.componentWillMount&&o.componentWillMount(),"function"===typeof o.UNSAFE_componentWillMount&&o.UNSAFE_componentWillMount()),"function"===typeof o.componentDidMount&&(t.flags|=4194308)):("function"===typeof o.componentDidMount&&(t.flags|=4194308),t.memoizedProps=n,t.memoizedState=c),o.props=n,o.state=c,o.context=l,n=a):("function"===typeof o.componentDidMount&&(t.flags|=4194308),n=!1)}else{o=t.stateNode,Ns(e,t),a=t.memoizedProps,l=t.type===t.elementType?a:gs(t.type,a),o.props=l,h=t.pendingProps,d=o.context,"object"===typeof(c=r.contextType)&&null!==c?c=Cs(c):c=Di(t,c=Ni(r)?Pi:ki.current);var f=r.getDerivedStateFromProps;(u="function"===typeof f||"function"===typeof o.getSnapshotBeforeUpdate)||"function"!==typeof o.UNSAFE_componentWillReceiveProps&&"function"!==typeof o.componentWillReceiveProps||(a!==h||d!==c)&&zs(t,o,n,c),Ps=!1,d=t.memoizedState,o.state=d,Ms(t,n,o,i);var p=t.memoizedState;a!==h||d!==p||Ri.current||Ps?("function"===typeof f&&(Vs(t,r,f,n),p=t.memoizedState),(l=Ps||Ks(t,r,l,n,d,p,c)||!1)?(u||"function"!==typeof o.UNSAFE_componentWillUpdate&&"function"!==typeof o.componentWillUpdate||("function"===typeof o.componentWillUpdate&&o.componentWillUpdate(n,p,c),"function"===typeof o.UNSAFE_componentWillUpdate&&o.UNSAFE_componentWillUpdate(n,p,c)),"function"===typeof o.componentDidUpdate&&(t.flags|=4),"function"===typeof o.getSnapshotBeforeUpdate&&(t.flags|=1024)):("function"!==typeof o.componentDidUpdate||a===e.memoizedProps&&d===e.memoizedState||(t.flags|=4),"function"!==typeof o.getSnapshotBeforeUpdate||a===e.memoizedProps&&d===e.memoizedState||(t.flags|=1024),t.memoizedProps=n,t.memoizedState=p),o.props=n,o.state=p,o.context=c,n=l):("function"!==typeof o.componentDidUpdate||a===e.memoizedProps&&d===e.memoizedState||(t.flags|=4),"function"!==typeof o.getSnapshotBeforeUpdate||a===e.memoizedProps&&d===e.memoizedState||(t.flags|=1024),n=!1)}return Ra(e,t,r,n,s,i)}function Ra(e,t,r,n,i,s){Aa(e,t);var o=0!==(128&t.flags);if(!n&&!o)return i&&Mi(t,r,!1),za(e,t,s);n=t.stateNode,ba.current=t;var a=o&&"function"!==typeof r.getDerivedStateFromError?null:n.render();return t.flags|=1,null!==e&&o?(t.child=$s(t,e.child,null,s),t.child=$s(t,null,a,s)):Ea(e,t,a,s),t.memoizedState=n.state,i&&Mi(t,r,!0),t.child}function Pa(e){var t=e.stateNode;t.pendingContext?Li(0,t.pendingContext,t.pendingContext!==t.context):t.context&&Li(0,t.context,!1),no(e,t.containerInfo)}function Da(e,t,r,n,i){return fs(),ps(i),t.flags|=256,Ea(e,t,r,n),t.child}var Na,xa,La,Oa={dehydrated:null,treeContext:null,retryLane:0};function Ba(e){return{baseLanes:e,cachePool:null,transitions:null}}function Ma(e,t,r){var n,i=t.pendingProps,o=ao.current,a=!1,c=0!==(128&t.flags);if((n=c)||(n=(null===e||null!==e.memoizedState)&&0!==(2&o)),n?(a=!0,t.flags&=-129):null!==e&&null===e.memoizedState||(o|=1),Ai(ao,1&o),null===e)return ls(t),null!==(e=t.memoizedState)&&null!==(e=e.dehydrated)?(0===(1&t.mode)?t.lanes=1:"$!"===e.data?t.lanes=8:t.lanes=1073741824,null):(c=i.children,e=i.fallback,a?(i=t.mode,a=t.child,c={mode:"hidden",children:c},0===(1&i)&&null!==a?(a.childLanes=0,a.pendingProps=c):a=Bl(c,i,0,null),e=Ol(e,i,r,null),a.return=t,e.return=t,a.sibling=e,t.child=a,t.child.memoizedState=Ba(r),t.memoizedState=Oa,e):Ua(t,c));if(null!==(o=e.memoizedState)&&null!==(n=o.dehydrated))return function(e,t,r,n,i,o,a){if(r)return 256&t.flags?(t.flags&=-257,Fa(e,t,a,n=ha(Error(s(422))))):null!==t.memoizedState?(t.child=e.child,t.flags|=128,null):(o=n.fallback,i=t.mode,n=Bl({mode:"visible",children:n.children},i,0,null),(o=Ol(o,i,a,null)).flags|=2,n.return=t,o.return=t,n.sibling=o,t.child=n,0!==(1&t.mode)&&$s(t,e.child,null,a),t.child.memoizedState=Ba(a),t.memoizedState=Oa,o);if(0===(1&t.mode))return Fa(e,t,a,null);if("$!"===i.data){if(n=i.nextSibling&&i.nextSibling.dataset)var c=n.dgst;return n=c,Fa(e,t,a,n=ha(o=Error(s(419)),n,void 0))}if(c=0!==(a&e.childLanes),wa||c){if(null!==(n=Rc)){switch(a&-a){case 4:i=2;break;case 16:i=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:i=32;break;case 536870912:i=268435456;break;default:i=0}0!==(i=0!==(i&(n.suspendedLanes|a))?0:i)&&i!==o.retryLane&&(o.retryLane=i,Rs(e,i),rl(n,e,i,-1))}return yl(),Fa(e,t,a,n=ha(Error(s(421))))}return"$?"===i.data?(t.flags|=128,t.child=e.child,t=Tl.bind(null,e),i._reactRetry=t,null):(e=o.treeContext,ns=li(i.nextSibling),rs=t,is=!0,ss=null,null!==e&&(Gi[Qi++]=$i,Gi[Qi++]=Xi,Gi[Qi++]=Yi,$i=e.id,Xi=e.overflow,Yi=t),(t=Ua(t,n.children)).flags|=4096,t)}(e,t,c,i,n,o,r);if(a){a=i.fallback,c=t.mode,n=(o=e.child).sibling;var l={mode:"hidden",children:i.children};return 0===(1&c)&&t.child!==o?((i=t.child).childLanes=0,i.pendingProps=l,t.deletions=null):(i=xl(o,l)).subtreeFlags=14680064&o.subtreeFlags,null!==n?a=xl(n,a):(a=Ol(a,c,r,null)).flags|=2,a.return=t,i.return=t,i.sibling=a,t.child=i,i=a,a=t.child,c=null===(c=e.child.memoizedState)?Ba(r):{baseLanes:c.baseLanes|r,cachePool:null,transitions:c.transitions},a.memoizedState=c,a.childLanes=e.childLanes&~r,t.memoizedState=Oa,i}return e=(a=e.child).sibling,i=xl(a,{mode:"visible",children:i.children}),0===(1&t.mode)&&(i.lanes=r),i.return=t,i.sibling=null,null!==e&&(null===(r=t.deletions)?(t.deletions=[e],t.flags|=16):r.push(e)),t.child=i,t.memoizedState=null,i}function Ua(e,t){return(t=Bl({mode:"visible",children:t},e.mode,0,null)).return=e,e.child=t}function Fa(e,t,r,n){return null!==n&&ps(n),$s(t,e.child,null,r),(e=Ua(t,t.pendingProps.children)).flags|=2,t.memoizedState=null,e}function Va(e,t,r){e.lanes|=t;var n=e.alternate;null!==n&&(n.lanes|=t),Ss(e.return,t,r)}function ja(e,t,r,n,i){var s=e.memoizedState;null===s?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:n,tail:r,tailMode:i}:(s.isBackwards=t,s.rendering=null,s.renderingStartTime=0,s.last=n,s.tail=r,s.tailMode=i)}function Ka(e,t,r){var n=t.pendingProps,i=n.revealOrder,s=n.tail;if(Ea(e,t,n.children,r),0!==(2&(n=ao.current)))n=1&n|2,t.flags|=128;else{if(null!==e&&0!==(128&e.flags))e:for(e=t.child;null!==e;){if(13===e.tag)null!==e.memoizedState&&Va(e,r,t);else if(19===e.tag)Va(e,r,t);else if(null!==e.child){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;null===e.sibling;){if(null===e.return||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}n&=1}if(Ai(ao,n),0===(1&t.mode))t.memoizedState=null;else switch(i){case"forwards":for(r=t.child,i=null;null!==r;)null!==(e=r.alternate)&&null===co(e)&&(i=r),r=r.sibling;null===(r=i)?(i=t.child,t.child=null):(i=r.sibling,r.sibling=null),ja(t,!1,i,r,s);break;case"backwards":for(r=null,i=t.child,t.child=null;null!==i;){if(null!==(e=i.alternate)&&null===co(e)){t.child=i;break}e=i.sibling,i.sibling=r,r=i,i=e}ja(t,!0,r,null,s);break;case"together":ja(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function qa(e,t){0===(1&t.mode)&&null!==e&&(e.alternate=null,t.alternate=null,t.flags|=2)}function za(e,t,r){if(null!==e&&(t.dependencies=e.dependencies),Bc|=t.lanes,0===(r&t.childLanes))return null;if(null!==e&&t.child!==e.child)throw Error(s(153));if(null!==t.child){for(r=xl(e=t.child,e.pendingProps),t.child=r,r.return=t;null!==e.sibling;)e=e.sibling,(r=r.sibling=xl(e,e.pendingProps)).return=t;r.sibling=null}return t.child}function Ha(e,t){if(!is)switch(e.tailMode){case"hidden":t=e.tail;for(var r=null;null!==t;)null!==t.alternate&&(r=t),t=t.sibling;null===r?e.tail=null:r.sibling=null;break;case"collapsed":r=e.tail;for(var n=null;null!==r;)null!==r.alternate&&(n=r),r=r.sibling;null===n?t||null===e.tail?e.tail=null:e.tail.sibling=null:n.sibling=null}}function Wa(e){var t=null!==e.alternate&&e.alternate.child===e.child,r=0,n=0;if(t)for(var i=e.child;null!==i;)r|=i.lanes|i.childLanes,n|=14680064&i.subtreeFlags,n|=14680064&i.flags,i.return=e,i=i.sibling;else for(i=e.child;null!==i;)r|=i.lanes|i.childLanes,n|=i.subtreeFlags,n|=i.flags,i.return=e,i=i.sibling;return e.subtreeFlags|=n,e.childLanes=r,t}function Ga(e,t,r){var n=t.pendingProps;switch(ts(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Wa(t),null;case 1:case 17:return Ni(t.type)&&xi(),Wa(t),null;case 3:return n=t.stateNode,io(),Ci(Ri),Ci(ki),uo(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),null!==e&&null!==e.child||(hs(t)?t.flags|=4:null===e||e.memoizedState.isDehydrated&&0===(256&t.flags)||(t.flags|=1024,null!==ss&&(ol(ss),ss=null))),Wa(t),null;case 5:oo(t);var i=ro(to.current);if(r=t.type,null!==e&&null!=t.stateNode)xa(e,t,r,n),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!n){if(null===t.stateNode)throw Error(s(166));return Wa(t),null}if(e=ro(Zs.current),hs(t)){n=t.stateNode,r=t.type;var o=t.memoizedProps;switch(n[di]=t,n[fi]=o,e=0!==(1&t.mode),r){case"dialog":Fn("cancel",n),Fn("close",n);break;case"iframe":case"object":case"embed":Fn("load",n);break;case"video":case"audio":for(i=0;i<On.length;i++)Fn(On[i],n);break;case"source":Fn("error",n);break;case"img":case"image":case"link":Fn("error",n),Fn("load",n);break;case"details":Fn("toggle",n);break;case"input":$(n,o),Fn("invalid",n);break;case"select":n._wrapperState={wasMultiple:!!o.multiple},Fn("invalid",n);break;case"textarea":ie(n,o),Fn("invalid",n)}for(var c in ve(r,o),i=null,o)if(o.hasOwnProperty(c)){var l=o[c];"children"===c?"string"===typeof l?n.textContent!==l&&(!0!==o.suppressHydrationWarning&&Jn(n.textContent,l,e),i=["children",l]):"number"===typeof l&&n.textContent!==""+l&&(!0!==o.suppressHydrationWarning&&Jn(n.textContent,l,e),i=["children",""+l]):a.hasOwnProperty(c)&&null!=l&&"onScroll"===c&&Fn("scroll",n)}switch(r){case"input":W(n),Z(n,o,!0);break;case"textarea":W(n),oe(n);break;case"select":case"option":break;default:"function"===typeof o.onClick&&(n.onclick=Zn)}n=i,t.updateQueue=n,null!==n&&(t.flags|=4)}else{c=9===i.nodeType?i:i.ownerDocument,"http://www.w3.org/1999/xhtml"===e&&(e=ae(r)),"http://www.w3.org/1999/xhtml"===e?"script"===r?((e=c.createElement("div")).innerHTML="<script><\/script>",e=e.removeChild(e.firstChild)):"string"===typeof n.is?e=c.createElement(r,{is:n.is}):(e=c.createElement(r),"select"===r&&(c=e,n.multiple?c.multiple=!0:n.size&&(c.size=n.size))):e=c.createElementNS(e,r),e[di]=t,e[fi]=n,Na(e,t),t.stateNode=e;e:{switch(c=be(r,n),r){case"dialog":Fn("cancel",e),Fn("close",e),i=n;break;case"iframe":case"object":case"embed":Fn("load",e),i=n;break;case"video":case"audio":for(i=0;i<On.length;i++)Fn(On[i],e);i=n;break;case"source":Fn("error",e),i=n;break;case"img":case"image":case"link":Fn("error",e),Fn("load",e),i=n;break;case"details":Fn("toggle",e),i=n;break;case"input":$(e,n),i=Y(e,n),Fn("invalid",e);break;case"option":default:i=n;break;case"select":e._wrapperState={wasMultiple:!!n.multiple},i=M({},n,{value:void 0}),Fn("invalid",e);break;case"textarea":ie(e,n),i=ne(e,n),Fn("invalid",e)}for(o in ve(r,i),l=i)if(l.hasOwnProperty(o)){var u=l[o];"style"===o?ge(e,u):"dangerouslySetInnerHTML"===o?null!=(u=u?u.__html:void 0)&&he(e,u):"children"===o?"string"===typeof u?("textarea"!==r||""!==u)&&de(e,u):"number"===typeof u&&de(e,""+u):"suppressContentEditableWarning"!==o&&"suppressHydrationWarning"!==o&&"autoFocus"!==o&&(a.hasOwnProperty(o)?null!=u&&"onScroll"===o&&Fn("scroll",e):null!=u&&b(e,o,u,c))}switch(r){case"input":W(e),Z(e,n,!1);break;case"textarea":W(e),oe(e);break;case"option":null!=n.value&&e.setAttribute("value",""+z(n.value));break;case"select":e.multiple=!!n.multiple,null!=(o=n.value)?re(e,!!n.multiple,o,!1):null!=n.defaultValue&&re(e,!!n.multiple,n.defaultValue,!0);break;default:"function"===typeof i.onClick&&(e.onclick=Zn)}switch(r){case"button":case"input":case"select":case"textarea":n=!!n.autoFocus;break e;case"img":n=!0;break e;default:n=!1}}n&&(t.flags|=4)}null!==t.ref&&(t.flags|=512,t.flags|=2097152)}return Wa(t),null;case 6:if(e&&null!=t.stateNode)La(0,t,e.memoizedProps,n);else{if("string"!==typeof n&&null===t.stateNode)throw Error(s(166));if(r=ro(to.current),ro(Zs.current),hs(t)){if(n=t.stateNode,r=t.memoizedProps,n[di]=t,(o=n.nodeValue!==r)&&null!==(e=rs))switch(e.tag){case 3:Jn(n.nodeValue,r,0!==(1&e.mode));break;case 5:!0!==e.memoizedProps.suppressHydrationWarning&&Jn(n.nodeValue,r,0!==(1&e.mode))}o&&(t.flags|=4)}else(n=(9===r.nodeType?r:r.ownerDocument).createTextNode(n))[di]=t,t.stateNode=n}return Wa(t),null;case 13:if(Ci(ao),n=t.memoizedState,null===e||null!==e.memoizedState&&null!==e.memoizedState.dehydrated){if(is&&null!==ns&&0!==(1&t.mode)&&0===(128&t.flags))ds(),fs(),t.flags|=98560,o=!1;else if(o=hs(t),null!==n&&null!==n.dehydrated){if(null===e){if(!o)throw Error(s(318));if(!(o=null!==(o=t.memoizedState)?o.dehydrated:null))throw Error(s(317));o[di]=t}else fs(),0===(128&t.flags)&&(t.memoizedState=null),t.flags|=4;Wa(t),o=!1}else null!==ss&&(ol(ss),ss=null),o=!0;if(!o)return 65536&t.flags?t:null}return 0!==(128&t.flags)?(t.lanes=r,t):((n=null!==n)!==(null!==e&&null!==e.memoizedState)&&n&&(t.child.flags|=8192,0!==(1&t.mode)&&(null===e||0!==(1&ao.current)?0===Lc&&(Lc=3):yl())),null!==t.updateQueue&&(t.flags|=4),Wa(t),null);case 4:return io(),null===e&&Kn(t.stateNode.containerInfo),Wa(t),null;case 10:return _s(t.type._context),Wa(t),null;case 19:if(Ci(ao),null===(o=t.memoizedState))return Wa(t),null;if(n=0!==(128&t.flags),null===(c=o.rendering))if(n)Ha(o,!1);else{if(0!==Lc||null!==e&&0!==(128&e.flags))for(e=t.child;null!==e;){if(null!==(c=co(e))){for(t.flags|=128,Ha(o,!1),null!==(n=c.updateQueue)&&(t.updateQueue=n,t.flags|=4),t.subtreeFlags=0,n=r,r=t.child;null!==r;)e=n,(o=r).flags&=14680066,null===(c=o.alternate)?(o.childLanes=0,o.lanes=e,o.child=null,o.subtreeFlags=0,o.memoizedProps=null,o.memoizedState=null,o.updateQueue=null,o.dependencies=null,o.stateNode=null):(o.childLanes=c.childLanes,o.lanes=c.lanes,o.child=c.child,o.subtreeFlags=0,o.deletions=null,o.memoizedProps=c.memoizedProps,o.memoizedState=c.memoizedState,o.updateQueue=c.updateQueue,o.type=c.type,e=c.dependencies,o.dependencies=null===e?null:{lanes:e.lanes,firstContext:e.firstContext}),r=r.sibling;return Ai(ao,1&ao.current|2),t.child}e=e.sibling}null!==o.tail&&Xe()>Kc&&(t.flags|=128,n=!0,Ha(o,!1),t.lanes=4194304)}else{if(!n)if(null!==(e=co(c))){if(t.flags|=128,n=!0,null!==(r=e.updateQueue)&&(t.updateQueue=r,t.flags|=4),Ha(o,!0),null===o.tail&&"hidden"===o.tailMode&&!c.alternate&&!is)return Wa(t),null}else 2*Xe()-o.renderingStartTime>Kc&&1073741824!==r&&(t.flags|=128,n=!0,Ha(o,!1),t.lanes=4194304);o.isBackwards?(c.sibling=t.child,t.child=c):(null!==(r=o.last)?r.sibling=c:t.child=c,o.last=c)}return null!==o.tail?(t=o.tail,o.rendering=t,o.tail=t.sibling,o.renderingStartTime=Xe(),t.sibling=null,r=ao.current,Ai(ao,n?1&r|2:1&r),t):(Wa(t),null);case 22:case 23:return hl(),n=null!==t.memoizedState,null!==e&&null!==e.memoizedState!==n&&(t.flags|=8192),n&&0!==(1&t.mode)?0!==(1073741824&Nc)&&(Wa(t),6&t.subtreeFlags&&(t.flags|=8192)):Wa(t),null;case 24:case 25:return null}throw Error(s(156,t.tag))}function Qa(e,t){switch(ts(t),t.tag){case 1:return Ni(t.type)&&xi(),65536&(e=t.flags)?(t.flags=-65537&e|128,t):null;case 3:return io(),Ci(Ri),Ci(ki),uo(),0!==(65536&(e=t.flags))&&0===(128&e)?(t.flags=-65537&e|128,t):null;case 5:return oo(t),null;case 13:if(Ci(ao),null!==(e=t.memoizedState)&&null!==e.dehydrated){if(null===t.alternate)throw Error(s(340));fs()}return 65536&(e=t.flags)?(t.flags=-65537&e|128,t):null;case 19:return Ci(ao),null;case 4:return io(),null;case 10:return _s(t.type._context),null;case 22:case 23:return hl(),null;default:return null}}Na=function(e,t){for(var r=t.child;null!==r;){if(5===r.tag||6===r.tag)e.appendChild(r.stateNode);else if(4!==r.tag&&null!==r.child){r.child.return=r,r=r.child;continue}if(r===t)break;for(;null===r.sibling;){if(null===r.return||r.return===t)return;r=r.return}r.sibling.return=r.return,r=r.sibling}},xa=function(e,t,r,n){var i=e.memoizedProps;if(i!==n){e=t.stateNode,ro(Zs.current);var s,o=null;switch(r){case"input":i=Y(e,i),n=Y(e,n),o=[];break;case"select":i=M({},i,{value:void 0}),n=M({},n,{value:void 0}),o=[];break;case"textarea":i=ne(e,i),n=ne(e,n),o=[];break;default:"function"!==typeof i.onClick&&"function"===typeof n.onClick&&(e.onclick=Zn)}for(u in ve(r,n),r=null,i)if(!n.hasOwnProperty(u)&&i.hasOwnProperty(u)&&null!=i[u])if("style"===u){var c=i[u];for(s in c)c.hasOwnProperty(s)&&(r||(r={}),r[s]="")}else"dangerouslySetInnerHTML"!==u&&"children"!==u&&"suppressContentEditableWarning"!==u&&"suppressHydrationWarning"!==u&&"autoFocus"!==u&&(a.hasOwnProperty(u)?o||(o=[]):(o=o||[]).push(u,null));for(u in n){var l=n[u];if(c=null!=i?i[u]:void 0,n.hasOwnProperty(u)&&l!==c&&(null!=l||null!=c))if("style"===u)if(c){for(s in c)!c.hasOwnProperty(s)||l&&l.hasOwnProperty(s)||(r||(r={}),r[s]="");for(s in l)l.hasOwnProperty(s)&&c[s]!==l[s]&&(r||(r={}),r[s]=l[s])}else r||(o||(o=[]),o.push(u,r)),r=l;else"dangerouslySetInnerHTML"===u?(l=l?l.__html:void 0,c=c?c.__html:void 0,null!=l&&c!==l&&(o=o||[]).push(u,l)):"children"===u?"string"!==typeof l&&"number"!==typeof l||(o=o||[]).push(u,""+l):"suppressContentEditableWarning"!==u&&"suppressHydrationWarning"!==u&&(a.hasOwnProperty(u)?(null!=l&&"onScroll"===u&&Fn("scroll",e),o||c===l||(o=[])):(o=o||[]).push(u,l))}r&&(o=o||[]).push("style",r);var u=o;(t.updateQueue=u)&&(t.flags|=4)}},La=function(e,t,r,n){r!==n&&(t.flags|=4)};var Ya=!1,$a=!1,Xa="function"===typeof WeakSet?WeakSet:Set,Ja=null;function Za(e,t){var r=e.ref;if(null!==r)if("function"===typeof r)try{r(null)}catch(n){Il(e,t,n)}else r.current=null}function ec(e,t,r){try{r()}catch(n){Il(e,t,n)}}var tc=!1;function rc(e,t,r){var n=t.updateQueue;if(null!==(n=null!==n?n.lastEffect:null)){var i=n=n.next;do{if((i.tag&e)===e){var s=i.destroy;i.destroy=void 0,void 0!==s&&ec(t,r,s)}i=i.next}while(i!==n)}}function nc(e,t){if(null!==(t=null!==(t=t.updateQueue)?t.lastEffect:null)){var r=t=t.next;do{if((r.tag&e)===e){var n=r.create;r.destroy=n()}r=r.next}while(r!==t)}}function ic(e){var t=e.ref;if(null!==t){var r=e.stateNode;e.tag,e=r,"function"===typeof t?t(e):t.current=e}}function sc(e){var t=e.alternate;null!==t&&(e.alternate=null,sc(t)),e.child=null,e.deletions=null,e.sibling=null,5===e.tag&&(null!==(t=e.stateNode)&&(delete t[di],delete t[fi],delete t[yi],delete t[gi],delete t[mi])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function oc(e){return 5===e.tag||3===e.tag||4===e.tag}function ac(e){e:for(;;){for(;null===e.sibling;){if(null===e.return||oc(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;5!==e.tag&&6!==e.tag&&18!==e.tag;){if(2&e.flags)continue e;if(null===e.child||4===e.tag)continue e;e.child.return=e,e=e.child}if(!(2&e.flags))return e.stateNode}}function cc(e,t,r){var n=e.tag;if(5===n||6===n)e=e.stateNode,t?8===r.nodeType?r.parentNode.insertBefore(e,t):r.insertBefore(e,t):(8===r.nodeType?(t=r.parentNode).insertBefore(e,r):(t=r).appendChild(e),null!==(r=r._reactRootContainer)&&void 0!==r||null!==t.onclick||(t.onclick=Zn));else if(4!==n&&null!==(e=e.child))for(cc(e,t,r),e=e.sibling;null!==e;)cc(e,t,r),e=e.sibling}function lc(e,t,r){var n=e.tag;if(5===n||6===n)e=e.stateNode,t?r.insertBefore(e,t):r.appendChild(e);else if(4!==n&&null!==(e=e.child))for(lc(e,t,r),e=e.sibling;null!==e;)lc(e,t,r),e=e.sibling}var uc=null,hc=!1;function dc(e,t,r){for(r=r.child;null!==r;)fc(e,t,r),r=r.sibling}function fc(e,t,r){if(st&&"function"===typeof st.onCommitFiberUnmount)try{st.onCommitFiberUnmount(it,r)}catch(a){}switch(r.tag){case 5:$a||Za(r,t);case 6:var n=uc,i=hc;uc=null,dc(e,t,r),hc=i,null!==(uc=n)&&(hc?(e=uc,r=r.stateNode,8===e.nodeType?e.parentNode.removeChild(r):e.removeChild(r)):uc.removeChild(r.stateNode));break;case 18:null!==uc&&(hc?(e=uc,r=r.stateNode,8===e.nodeType?ci(e.parentNode,r):1===e.nodeType&&ci(e,r),Kt(e)):ci(uc,r.stateNode));break;case 4:n=uc,i=hc,uc=r.stateNode.containerInfo,hc=!0,dc(e,t,r),uc=n,hc=i;break;case 0:case 11:case 14:case 15:if(!$a&&(null!==(n=r.updateQueue)&&null!==(n=n.lastEffect))){i=n=n.next;do{var s=i,o=s.destroy;s=s.tag,void 0!==o&&(0!==(2&s)||0!==(4&s))&&ec(r,t,o),i=i.next}while(i!==n)}dc(e,t,r);break;case 1:if(!$a&&(Za(r,t),"function"===typeof(n=r.stateNode).componentWillUnmount))try{n.props=r.memoizedProps,n.state=r.memoizedState,n.componentWillUnmount()}catch(a){Il(r,t,a)}dc(e,t,r);break;case 21:dc(e,t,r);break;case 22:1&r.mode?($a=(n=$a)||null!==r.memoizedState,dc(e,t,r),$a=n):dc(e,t,r);break;default:dc(e,t,r)}}function pc(e){var t=e.updateQueue;if(null!==t){e.updateQueue=null;var r=e.stateNode;null===r&&(r=e.stateNode=new Xa),t.forEach((function(t){var n=kl.bind(null,e,t);r.has(t)||(r.add(t),t.then(n,n))}))}}function yc(e,t){var r=t.deletions;if(null!==r)for(var n=0;n<r.length;n++){var i=r[n];try{var o=e,a=t,c=a;e:for(;null!==c;){switch(c.tag){case 5:uc=c.stateNode,hc=!1;break e;case 3:case 4:uc=c.stateNode.containerInfo,hc=!0;break e}c=c.return}if(null===uc)throw Error(s(160));fc(o,a,i),uc=null,hc=!1;var l=i.alternate;null!==l&&(l.return=null),i.return=null}catch(u){Il(i,t,u)}}if(12854&t.subtreeFlags)for(t=t.child;null!==t;)gc(t,e),t=t.sibling}function gc(e,t){var r=e.alternate,n=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(yc(t,e),mc(e),4&n){try{rc(3,e,e.return),nc(3,e)}catch(g){Il(e,e.return,g)}try{rc(5,e,e.return)}catch(g){Il(e,e.return,g)}}break;case 1:yc(t,e),mc(e),512&n&&null!==r&&Za(r,r.return);break;case 5:if(yc(t,e),mc(e),512&n&&null!==r&&Za(r,r.return),32&e.flags){var i=e.stateNode;try{de(i,"")}catch(g){Il(e,e.return,g)}}if(4&n&&null!=(i=e.stateNode)){var o=e.memoizedProps,a=null!==r?r.memoizedProps:o,c=e.type,l=e.updateQueue;if(e.updateQueue=null,null!==l)try{"input"===c&&"radio"===o.type&&null!=o.name&&X(i,o),be(c,a);var u=be(c,o);for(a=0;a<l.length;a+=2){var h=l[a],d=l[a+1];"style"===h?ge(i,d):"dangerouslySetInnerHTML"===h?he(i,d):"children"===h?de(i,d):b(i,h,d,u)}switch(c){case"input":J(i,o);break;case"textarea":se(i,o);break;case"select":var f=i._wrapperState.wasMultiple;i._wrapperState.wasMultiple=!!o.multiple;var p=o.value;null!=p?re(i,!!o.multiple,p,!1):f!==!!o.multiple&&(null!=o.defaultValue?re(i,!!o.multiple,o.defaultValue,!0):re(i,!!o.multiple,o.multiple?[]:"",!1))}i[fi]=o}catch(g){Il(e,e.return,g)}}break;case 6:if(yc(t,e),mc(e),4&n){if(null===e.stateNode)throw Error(s(162));i=e.stateNode,o=e.memoizedProps;try{i.nodeValue=o}catch(g){Il(e,e.return,g)}}break;case 3:if(yc(t,e),mc(e),4&n&&null!==r&&r.memoizedState.isDehydrated)try{Kt(t.containerInfo)}catch(g){Il(e,e.return,g)}break;case 4:default:yc(t,e),mc(e);break;case 13:yc(t,e),mc(e),8192&(i=e.child).flags&&(o=null!==i.memoizedState,i.stateNode.isHidden=o,!o||null!==i.alternate&&null!==i.alternate.memoizedState||(jc=Xe())),4&n&&pc(e);break;case 22:if(h=null!==r&&null!==r.memoizedState,1&e.mode?($a=(u=$a)||h,yc(t,e),$a=u):yc(t,e),mc(e),8192&n){if(u=null!==e.memoizedState,(e.stateNode.isHidden=u)&&!h&&0!==(1&e.mode))for(Ja=e,h=e.child;null!==h;){for(d=Ja=h;null!==Ja;){switch(p=(f=Ja).child,f.tag){case 0:case 11:case 14:case 15:rc(4,f,f.return);break;case 1:Za(f,f.return);var y=f.stateNode;if("function"===typeof y.componentWillUnmount){n=f,r=f.return;try{t=n,y.props=t.memoizedProps,y.state=t.memoizedState,y.componentWillUnmount()}catch(g){Il(n,r,g)}}break;case 5:Za(f,f.return);break;case 22:if(null!==f.memoizedState){Ec(d);continue}}null!==p?(p.return=f,Ja=p):Ec(d)}h=h.sibling}e:for(h=null,d=e;;){if(5===d.tag){if(null===h){h=d;try{i=d.stateNode,u?"function"===typeof(o=i.style).setProperty?o.setProperty("display","none","important"):o.display="none":(c=d.stateNode,a=void 0!==(l=d.memoizedProps.style)&&null!==l&&l.hasOwnProperty("display")?l.display:null,c.style.display=ye("display",a))}catch(g){Il(e,e.return,g)}}}else if(6===d.tag){if(null===h)try{d.stateNode.nodeValue=u?"":d.memoizedProps}catch(g){Il(e,e.return,g)}}else if((22!==d.tag&&23!==d.tag||null===d.memoizedState||d===e)&&null!==d.child){d.child.return=d,d=d.child;continue}if(d===e)break e;for(;null===d.sibling;){if(null===d.return||d.return===e)break e;h===d&&(h=null),d=d.return}h===d&&(h=null),d.sibling.return=d.return,d=d.sibling}}break;case 19:yc(t,e),mc(e),4&n&&pc(e);case 21:}}function mc(e){var t=e.flags;if(2&t){try{e:{for(var r=e.return;null!==r;){if(oc(r)){var n=r;break e}r=r.return}throw Error(s(160))}switch(n.tag){case 5:var i=n.stateNode;32&n.flags&&(de(i,""),n.flags&=-33),lc(e,ac(e),i);break;case 3:case 4:var o=n.stateNode.containerInfo;cc(e,ac(e),o);break;default:throw Error(s(161))}}catch(a){Il(e,e.return,a)}e.flags&=-3}4096&t&&(e.flags&=-4097)}function vc(e,t,r){Ja=e,bc(e,t,r)}function bc(e,t,r){for(var n=0!==(1&e.mode);null!==Ja;){var i=Ja,s=i.child;if(22===i.tag&&n){var o=null!==i.memoizedState||Ya;if(!o){var a=i.alternate,c=null!==a&&null!==a.memoizedState||$a;a=Ya;var l=$a;if(Ya=o,($a=c)&&!l)for(Ja=i;null!==Ja;)c=(o=Ja).child,22===o.tag&&null!==o.memoizedState?_c(i):null!==c?(c.return=o,Ja=c):_c(i);for(;null!==s;)Ja=s,bc(s,t,r),s=s.sibling;Ja=i,Ya=a,$a=l}wc(e)}else 0!==(8772&i.subtreeFlags)&&null!==s?(s.return=i,Ja=s):wc(e)}}function wc(e){for(;null!==Ja;){var t=Ja;if(0!==(8772&t.flags)){var r=t.alternate;try{if(0!==(8772&t.flags))switch(t.tag){case 0:case 11:case 15:$a||nc(5,t);break;case 1:var n=t.stateNode;if(4&t.flags&&!$a)if(null===r)n.componentDidMount();else{var i=t.elementType===t.type?r.memoizedProps:gs(t.type,r.memoizedProps);n.componentDidUpdate(i,r.memoizedState,n.__reactInternalSnapshotBeforeUpdate)}var o=t.updateQueue;null!==o&&Us(t,o,n);break;case 3:var a=t.updateQueue;if(null!==a){if(r=null,null!==t.child)switch(t.child.tag){case 5:case 1:r=t.child.stateNode}Us(t,a,r)}break;case 5:var c=t.stateNode;if(null===r&&4&t.flags){r=c;var l=t.memoizedProps;switch(t.type){case"button":case"input":case"select":case"textarea":l.autoFocus&&r.focus();break;case"img":l.src&&(r.src=l.src)}}break;case 6:case 4:case 12:case 19:case 17:case 21:case 22:case 23:case 25:break;case 13:if(null===t.memoizedState){var u=t.alternate;if(null!==u){var h=u.memoizedState;if(null!==h){var d=h.dehydrated;null!==d&&Kt(d)}}}break;default:throw Error(s(163))}$a||512&t.flags&&ic(t)}catch(f){Il(t,t.return,f)}}if(t===e){Ja=null;break}if(null!==(r=t.sibling)){r.return=t.return,Ja=r;break}Ja=t.return}}function Ec(e){for(;null!==Ja;){var t=Ja;if(t===e){Ja=null;break}var r=t.sibling;if(null!==r){r.return=t.return,Ja=r;break}Ja=t.return}}function _c(e){for(;null!==Ja;){var t=Ja;try{switch(t.tag){case 0:case 11:case 15:var r=t.return;try{nc(4,t)}catch(c){Il(t,r,c)}break;case 1:var n=t.stateNode;if("function"===typeof n.componentDidMount){var i=t.return;try{n.componentDidMount()}catch(c){Il(t,i,c)}}var s=t.return;try{ic(t)}catch(c){Il(t,s,c)}break;case 5:var o=t.return;try{ic(t)}catch(c){Il(t,o,c)}}}catch(c){Il(t,t.return,c)}if(t===e){Ja=null;break}var a=t.sibling;if(null!==a){a.return=t.return,Ja=a;break}Ja=t.return}}var Sc,Ic=Math.ceil,Cc=w.ReactCurrentDispatcher,Ac=w.ReactCurrentOwner,Tc=w.ReactCurrentBatchConfig,kc=0,Rc=null,Pc=null,Dc=0,Nc=0,xc=Ii(0),Lc=0,Oc=null,Bc=0,Mc=0,Uc=0,Fc=null,Vc=null,jc=0,Kc=1/0,qc=null,zc=!1,Hc=null,Wc=null,Gc=!1,Qc=null,Yc=0,$c=0,Xc=null,Jc=-1,Zc=0;function el(){return 0!==(6&kc)?Xe():-1!==Jc?Jc:Jc=Xe()}function tl(e){return 0===(1&e.mode)?1:0!==(2&kc)&&0!==Dc?Dc&-Dc:null!==ys.transition?(0===Zc&&(Zc=yt()),Zc):0!==(e=bt)?e:e=void 0===(e=window.event)?16:$t(e.type)}function rl(e,t,r,n){if(50<$c)throw $c=0,Xc=null,Error(s(185));mt(e,r,n),0!==(2&kc)&&e===Rc||(e===Rc&&(0===(2&kc)&&(Mc|=r),4===Lc&&al(e,Dc)),nl(e,n),1===r&&0===kc&&0===(1&t.mode)&&(Kc=Xe()+500,Fi&&Ki()))}function nl(e,t){var r=e.callbackNode;!function(e,t){for(var r=e.suspendedLanes,n=e.pingedLanes,i=e.expirationTimes,s=e.pendingLanes;0<s;){var o=31-ot(s),a=1<<o,c=i[o];-1===c?0!==(a&r)&&0===(a&n)||(i[o]=ft(a,t)):c<=t&&(e.expiredLanes|=a),s&=~a}}(e,t);var n=dt(e,e===Rc?Dc:0);if(0===n)null!==r&&Qe(r),e.callbackNode=null,e.callbackPriority=0;else if(t=n&-n,e.callbackPriority!==t){if(null!=r&&Qe(r),1===t)0===e.tag?function(e){Fi=!0,ji(e)}(cl.bind(null,e)):ji(cl.bind(null,e)),oi((function(){0===(6&kc)&&Ki()})),r=null;else{switch(wt(n)){case 1:r=Ze;break;case 4:r=et;break;case 16:default:r=tt;break;case 536870912:r=nt}r=Rl(r,il.bind(null,e))}e.callbackPriority=t,e.callbackNode=r}}function il(e,t){if(Jc=-1,Zc=0,0!==(6&kc))throw Error(s(327));var r=e.callbackNode;if(_l()&&e.callbackNode!==r)return null;var n=dt(e,e===Rc?Dc:0);if(0===n)return null;if(0!==(30&n)||0!==(n&e.expiredLanes)||t)t=gl(e,n);else{t=n;var i=kc;kc|=2;var o=pl();for(Rc===e&&Dc===t||(qc=null,Kc=Xe()+500,dl(e,t));;)try{vl();break}catch(c){fl(e,c)}Es(),Cc.current=o,kc=i,null!==Pc?t=0:(Rc=null,Dc=0,t=Lc)}if(0!==t){if(2===t&&(0!==(i=pt(e))&&(n=i,t=sl(e,i))),1===t)throw r=Oc,dl(e,0),al(e,n),nl(e,Xe()),r;if(6===t)al(e,n);else{if(i=e.current.alternate,0===(30&n)&&!function(e){for(var t=e;;){if(16384&t.flags){var r=t.updateQueue;if(null!==r&&null!==(r=r.stores))for(var n=0;n<r.length;n++){var i=r[n],s=i.getSnapshot;i=i.value;try{if(!an(s(),i))return!1}catch(a){return!1}}}if(r=t.child,16384&t.subtreeFlags&&null!==r)r.return=t,t=r;else{if(t===e)break;for(;null===t.sibling;){if(null===t.return||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}(i)&&(2===(t=gl(e,n))&&(0!==(o=pt(e))&&(n=o,t=sl(e,o))),1===t))throw r=Oc,dl(e,0),al(e,n),nl(e,Xe()),r;switch(e.finishedWork=i,e.finishedLanes=n,t){case 0:case 1:throw Error(s(345));case 2:case 5:El(e,Vc,qc);break;case 3:if(al(e,n),(130023424&n)===n&&10<(t=jc+500-Xe())){if(0!==dt(e,0))break;if(((i=e.suspendedLanes)&n)!==n){el(),e.pingedLanes|=e.suspendedLanes&i;break}e.timeoutHandle=ni(El.bind(null,e,Vc,qc),t);break}El(e,Vc,qc);break;case 4:if(al(e,n),(4194240&n)===n)break;for(t=e.eventTimes,i=-1;0<n;){var a=31-ot(n);o=1<<a,(a=t[a])>i&&(i=a),n&=~o}if(n=i,10<(n=(120>(n=Xe()-n)?120:480>n?480:1080>n?1080:1920>n?1920:3e3>n?3e3:4320>n?4320:1960*Ic(n/1960))-n)){e.timeoutHandle=ni(El.bind(null,e,Vc,qc),n);break}El(e,Vc,qc);break;default:throw Error(s(329))}}}return nl(e,Xe()),e.callbackNode===r?il.bind(null,e):null}function sl(e,t){var r=Fc;return e.current.memoizedState.isDehydrated&&(dl(e,t).flags|=256),2!==(e=gl(e,t))&&(t=Vc,Vc=r,null!==t&&ol(t)),e}function ol(e){null===Vc?Vc=e:Vc.push.apply(Vc,e)}function al(e,t){for(t&=~Uc,t&=~Mc,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var r=31-ot(t),n=1<<r;e[r]=-1,t&=~n}}function cl(e){if(0!==(6&kc))throw Error(s(327));_l();var t=dt(e,0);if(0===(1&t))return nl(e,Xe()),null;var r=gl(e,t);if(0!==e.tag&&2===r){var n=pt(e);0!==n&&(t=n,r=sl(e,n))}if(1===r)throw r=Oc,dl(e,0),al(e,t),nl(e,Xe()),r;if(6===r)throw Error(s(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,El(e,Vc,qc),nl(e,Xe()),null}function ll(e,t){var r=kc;kc|=1;try{return e(t)}finally{0===(kc=r)&&(Kc=Xe()+500,Fi&&Ki())}}function ul(e){null!==Qc&&0===Qc.tag&&0===(6&kc)&&_l();var t=kc;kc|=1;var r=Tc.transition,n=bt;try{if(Tc.transition=null,bt=1,e)return e()}finally{bt=n,Tc.transition=r,0===(6&(kc=t))&&Ki()}}function hl(){Nc=xc.current,Ci(xc)}function dl(e,t){e.finishedWork=null,e.finishedLanes=0;var r=e.timeoutHandle;if(-1!==r&&(e.timeoutHandle=-1,ii(r)),null!==Pc)for(r=Pc.return;null!==r;){var n=r;switch(ts(n),n.tag){case 1:null!==(n=n.type.childContextTypes)&&void 0!==n&&xi();break;case 3:io(),Ci(Ri),Ci(ki),uo();break;case 5:oo(n);break;case 4:io();break;case 13:case 19:Ci(ao);break;case 10:_s(n.type._context);break;case 22:case 23:hl()}r=r.return}if(Rc=e,Pc=e=xl(e.current,null),Dc=Nc=t,Lc=0,Oc=null,Uc=Mc=Bc=0,Vc=Fc=null,null!==As){for(t=0;t<As.length;t++)if(null!==(n=(r=As[t]).interleaved)){r.interleaved=null;var i=n.next,s=r.pending;if(null!==s){var o=s.next;s.next=i,n.next=o}r.pending=n}As=null}return e}function fl(e,t){for(;;){var r=Pc;try{if(Es(),ho.current=oa,vo){for(var n=yo.memoizedState;null!==n;){var i=n.queue;null!==i&&(i.pending=null),n=n.next}vo=!1}if(po=0,mo=go=yo=null,bo=!1,wo=0,Ac.current=null,null===r||null===r.return){Lc=1,Oc=t,Pc=null;break}e:{var o=e,a=r.return,c=r,l=t;if(t=Dc,c.flags|=32768,null!==l&&"object"===typeof l&&"function"===typeof l.then){var u=l,h=c,d=h.tag;if(0===(1&h.mode)&&(0===d||11===d||15===d)){var f=h.alternate;f?(h.updateQueue=f.updateQueue,h.memoizedState=f.memoizedState,h.lanes=f.lanes):(h.updateQueue=null,h.memoizedState=null)}var p=ma(a);if(null!==p){p.flags&=-257,va(p,a,c,0,t),1&p.mode&&ga(o,u,t),l=u;var y=(t=p).updateQueue;if(null===y){var g=new Set;g.add(l),t.updateQueue=g}else y.add(l);break e}if(0===(1&t)){ga(o,u,t),yl();break e}l=Error(s(426))}else if(is&&1&c.mode){var m=ma(a);if(null!==m){0===(65536&m.flags)&&(m.flags|=256),va(m,a,c,0,t),ps(ua(l,c));break e}}o=l=ua(l,c),4!==Lc&&(Lc=2),null===Fc?Fc=[o]:Fc.push(o),o=a;do{switch(o.tag){case 3:o.flags|=65536,t&=-t,o.lanes|=t,Bs(o,pa(0,l,t));break e;case 1:c=l;var v=o.type,b=o.stateNode;if(0===(128&o.flags)&&("function"===typeof v.getDerivedStateFromError||null!==b&&"function"===typeof b.componentDidCatch&&(null===Wc||!Wc.has(b)))){o.flags|=65536,t&=-t,o.lanes|=t,Bs(o,ya(o,c,t));break e}}o=o.return}while(null!==o)}wl(r)}catch(w){t=w,Pc===r&&null!==r&&(Pc=r=r.return);continue}break}}function pl(){var e=Cc.current;return Cc.current=oa,null===e?oa:e}function yl(){0!==Lc&&3!==Lc&&2!==Lc||(Lc=4),null===Rc||0===(268435455&Bc)&&0===(268435455&Mc)||al(Rc,Dc)}function gl(e,t){var r=kc;kc|=2;var n=pl();for(Rc===e&&Dc===t||(qc=null,dl(e,t));;)try{ml();break}catch(i){fl(e,i)}if(Es(),kc=r,Cc.current=n,null!==Pc)throw Error(s(261));return Rc=null,Dc=0,Lc}function ml(){for(;null!==Pc;)bl(Pc)}function vl(){for(;null!==Pc&&!Ye();)bl(Pc)}function bl(e){var t=Sc(e.alternate,e,Nc);e.memoizedProps=e.pendingProps,null===t?wl(e):Pc=t,Ac.current=null}function wl(e){var t=e;do{var r=t.alternate;if(e=t.return,0===(32768&t.flags)){if(null!==(r=Ga(r,t,Nc)))return void(Pc=r)}else{if(null!==(r=Qa(r,t)))return r.flags&=32767,void(Pc=r);if(null===e)return Lc=6,void(Pc=null);e.flags|=32768,e.subtreeFlags=0,e.deletions=null}if(null!==(t=t.sibling))return void(Pc=t);Pc=t=e}while(null!==t);0===Lc&&(Lc=5)}function El(e,t,r){var n=bt,i=Tc.transition;try{Tc.transition=null,bt=1,function(e,t,r,n){do{_l()}while(null!==Qc);if(0!==(6&kc))throw Error(s(327));r=e.finishedWork;var i=e.finishedLanes;if(null===r)return null;if(e.finishedWork=null,e.finishedLanes=0,r===e.current)throw Error(s(177));e.callbackNode=null,e.callbackPriority=0;var o=r.lanes|r.childLanes;if(function(e,t){var r=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var n=e.eventTimes;for(e=e.expirationTimes;0<r;){var i=31-ot(r),s=1<<i;t[i]=0,n[i]=-1,e[i]=-1,r&=~s}}(e,o),e===Rc&&(Pc=Rc=null,Dc=0),0===(2064&r.subtreeFlags)&&0===(2064&r.flags)||Gc||(Gc=!0,Rl(tt,(function(){return _l(),null}))),o=0!==(15990&r.flags),0!==(15990&r.subtreeFlags)||o){o=Tc.transition,Tc.transition=null;var a=bt;bt=1;var c=kc;kc|=4,Ac.current=null,function(e,t){if(ei=zt,fn(e=dn())){if("selectionStart"in e)var r={start:e.selectionStart,end:e.selectionEnd};else e:{var n=(r=(r=e.ownerDocument)&&r.defaultView||window).getSelection&&r.getSelection();if(n&&0!==n.rangeCount){r=n.anchorNode;var i=n.anchorOffset,o=n.focusNode;n=n.focusOffset;try{r.nodeType,o.nodeType}catch(E){r=null;break e}var a=0,c=-1,l=-1,u=0,h=0,d=e,f=null;t:for(;;){for(var p;d!==r||0!==i&&3!==d.nodeType||(c=a+i),d!==o||0!==n&&3!==d.nodeType||(l=a+n),3===d.nodeType&&(a+=d.nodeValue.length),null!==(p=d.firstChild);)f=d,d=p;for(;;){if(d===e)break t;if(f===r&&++u===i&&(c=a),f===o&&++h===n&&(l=a),null!==(p=d.nextSibling))break;f=(d=f).parentNode}d=p}r=-1===c||-1===l?null:{start:c,end:l}}else r=null}r=r||{start:0,end:0}}else r=null;for(ti={focusedElem:e,selectionRange:r},zt=!1,Ja=t;null!==Ja;)if(e=(t=Ja).child,0!==(1028&t.subtreeFlags)&&null!==e)e.return=t,Ja=e;else for(;null!==Ja;){t=Ja;try{var y=t.alternate;if(0!==(1024&t.flags))switch(t.tag){case 0:case 11:case 15:case 5:case 6:case 4:case 17:break;case 1:if(null!==y){var g=y.memoizedProps,m=y.memoizedState,v=t.stateNode,b=v.getSnapshotBeforeUpdate(t.elementType===t.type?g:gs(t.type,g),m);v.__reactInternalSnapshotBeforeUpdate=b}break;case 3:var w=t.stateNode.containerInfo;1===w.nodeType?w.textContent="":9===w.nodeType&&w.documentElement&&w.removeChild(w.documentElement);break;default:throw Error(s(163))}}catch(E){Il(t,t.return,E)}if(null!==(e=t.sibling)){e.return=t.return,Ja=e;break}Ja=t.return}y=tc,tc=!1}(e,r),gc(r,e),pn(ti),zt=!!ei,ti=ei=null,e.current=r,vc(r,e,i),$e(),kc=c,bt=a,Tc.transition=o}else e.current=r;if(Gc&&(Gc=!1,Qc=e,Yc=i),0===(o=e.pendingLanes)&&(Wc=null),function(e){if(st&&"function"===typeof st.onCommitFiberRoot)try{st.onCommitFiberRoot(it,e,void 0,128===(128&e.current.flags))}catch(t){}}(r.stateNode),nl(e,Xe()),null!==t)for(n=e.onRecoverableError,r=0;r<t.length;r++)i=t[r],n(i.value,{componentStack:i.stack,digest:i.digest});if(zc)throw zc=!1,e=Hc,Hc=null,e;0!==(1&Yc)&&0!==e.tag&&_l(),0!==(1&(o=e.pendingLanes))?e===Xc?$c++:($c=0,Xc=e):$c=0,Ki()}(e,t,r,n)}finally{Tc.transition=i,bt=n}return null}function _l(){if(null!==Qc){var e=wt(Yc),t=Tc.transition,r=bt;try{if(Tc.transition=null,bt=16>e?16:e,null===Qc)var n=!1;else{if(e=Qc,Qc=null,Yc=0,0!==(6&kc))throw Error(s(331));var i=kc;for(kc|=4,Ja=e.current;null!==Ja;){var o=Ja,a=o.child;if(0!==(16&Ja.flags)){var c=o.deletions;if(null!==c){for(var l=0;l<c.length;l++){var u=c[l];for(Ja=u;null!==Ja;){var h=Ja;switch(h.tag){case 0:case 11:case 15:rc(8,h,o)}var d=h.child;if(null!==d)d.return=h,Ja=d;else for(;null!==Ja;){var f=(h=Ja).sibling,p=h.return;if(sc(h),h===u){Ja=null;break}if(null!==f){f.return=p,Ja=f;break}Ja=p}}}var y=o.alternate;if(null!==y){var g=y.child;if(null!==g){y.child=null;do{var m=g.sibling;g.sibling=null,g=m}while(null!==g)}}Ja=o}}if(0!==(2064&o.subtreeFlags)&&null!==a)a.return=o,Ja=a;else e:for(;null!==Ja;){if(0!==(2048&(o=Ja).flags))switch(o.tag){case 0:case 11:case 15:rc(9,o,o.return)}var v=o.sibling;if(null!==v){v.return=o.return,Ja=v;break e}Ja=o.return}}var b=e.current;for(Ja=b;null!==Ja;){var w=(a=Ja).child;if(0!==(2064&a.subtreeFlags)&&null!==w)w.return=a,Ja=w;else e:for(a=b;null!==Ja;){if(0!==(2048&(c=Ja).flags))try{switch(c.tag){case 0:case 11:case 15:nc(9,c)}}catch(_){Il(c,c.return,_)}if(c===a){Ja=null;break e}var E=c.sibling;if(null!==E){E.return=c.return,Ja=E;break e}Ja=c.return}}if(kc=i,Ki(),st&&"function"===typeof st.onPostCommitFiberRoot)try{st.onPostCommitFiberRoot(it,e)}catch(_){}n=!0}return n}finally{bt=r,Tc.transition=t}}return!1}function Sl(e,t,r){e=Ls(e,t=pa(0,t=ua(r,t),1),1),t=el(),null!==e&&(mt(e,1,t),nl(e,t))}function Il(e,t,r){if(3===e.tag)Sl(e,e,r);else for(;null!==t;){if(3===t.tag){Sl(t,e,r);break}if(1===t.tag){var n=t.stateNode;if("function"===typeof t.type.getDerivedStateFromError||"function"===typeof n.componentDidCatch&&(null===Wc||!Wc.has(n))){t=Ls(t,e=ya(t,e=ua(r,e),1),1),e=el(),null!==t&&(mt(t,1,e),nl(t,e));break}}t=t.return}}function Cl(e,t,r){var n=e.pingCache;null!==n&&n.delete(t),t=el(),e.pingedLanes|=e.suspendedLanes&r,Rc===e&&(Dc&r)===r&&(4===Lc||3===Lc&&(130023424&Dc)===Dc&&500>Xe()-jc?dl(e,0):Uc|=r),nl(e,t)}function Al(e,t){0===t&&(0===(1&e.mode)?t=1:(t=ut,0===(130023424&(ut<<=1))&&(ut=4194304)));var r=el();null!==(e=Rs(e,t))&&(mt(e,t,r),nl(e,r))}function Tl(e){var t=e.memoizedState,r=0;null!==t&&(r=t.retryLane),Al(e,r)}function kl(e,t){var r=0;switch(e.tag){case 13:var n=e.stateNode,i=e.memoizedState;null!==i&&(r=i.retryLane);break;case 19:n=e.stateNode;break;default:throw Error(s(314))}null!==n&&n.delete(t),Al(e,r)}function Rl(e,t){return Ge(e,t)}function Pl(e,t,r,n){this.tag=e,this.key=r,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=n,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Dl(e,t,r,n){return new Pl(e,t,r,n)}function Nl(e){return!(!(e=e.prototype)||!e.isReactComponent)}function xl(e,t){var r=e.alternate;return null===r?((r=Dl(e.tag,t,e.key,e.mode)).elementType=e.elementType,r.type=e.type,r.stateNode=e.stateNode,r.alternate=e,e.alternate=r):(r.pendingProps=t,r.type=e.type,r.flags=0,r.subtreeFlags=0,r.deletions=null),r.flags=14680064&e.flags,r.childLanes=e.childLanes,r.lanes=e.lanes,r.child=e.child,r.memoizedProps=e.memoizedProps,r.memoizedState=e.memoizedState,r.updateQueue=e.updateQueue,t=e.dependencies,r.dependencies=null===t?null:{lanes:t.lanes,firstContext:t.firstContext},r.sibling=e.sibling,r.index=e.index,r.ref=e.ref,r}function Ll(e,t,r,n,i,o){var a=2;if(n=e,"function"===typeof e)Nl(e)&&(a=1);else if("string"===typeof e)a=5;else e:switch(e){case S:return Ol(r.children,i,o,t);case I:a=8,i|=8;break;case C:return(e=Dl(12,r,t,2|i)).elementType=C,e.lanes=o,e;case R:return(e=Dl(13,r,t,i)).elementType=R,e.lanes=o,e;case P:return(e=Dl(19,r,t,i)).elementType=P,e.lanes=o,e;case x:return Bl(r,i,o,t);default:if("object"===typeof e&&null!==e)switch(e.$$typeof){case A:a=10;break e;case T:a=9;break e;case k:a=11;break e;case D:a=14;break e;case N:a=16,n=null;break e}throw Error(s(130,null==e?e:typeof e,""))}return(t=Dl(a,r,t,i)).elementType=e,t.type=n,t.lanes=o,t}function Ol(e,t,r,n){return(e=Dl(7,e,n,t)).lanes=r,e}function Bl(e,t,r,n){return(e=Dl(22,e,n,t)).elementType=x,e.lanes=r,e.stateNode={isHidden:!1},e}function Ml(e,t,r){return(e=Dl(6,e,null,t)).lanes=r,e}function Ul(e,t,r){return(t=Dl(4,null!==e.children?e.children:[],e.key,t)).lanes=r,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function Fl(e,t,r,n,i){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=gt(0),this.expirationTimes=gt(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=gt(0),this.identifierPrefix=n,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function Vl(e,t,r,n,i,s,o,a,c){return e=new Fl(e,t,r,a,c),1===t?(t=1,!0===s&&(t|=8)):t=0,s=Dl(3,null,null,t),e.current=s,s.stateNode=e,s.memoizedState={element:n,isDehydrated:r,cache:null,transitions:null,pendingSuspenseBoundaries:null},Ds(s),e}function jl(e,t,r){var n=3<arguments.length&&void 0!==arguments[3]?arguments[3]:null;return{$$typeof:_,key:null==n?null:""+n,children:e,containerInfo:t,implementation:r}}function Kl(e){if(!e)return Ti;e:{if(Ke(e=e._reactInternals)!==e||1!==e.tag)throw Error(s(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(Ni(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(null!==t);throw Error(s(171))}if(1===e.tag){var r=e.type;if(Ni(r))return Oi(e,r,t)}return t}function ql(e,t,r,n,i,s,o,a,c){return(e=Vl(r,n,!0,e,0,s,0,a,c)).context=Kl(null),r=e.current,(s=xs(n=el(),i=tl(r))).callback=void 0!==t&&null!==t?t:null,Ls(r,s,i),e.current.lanes=i,mt(e,i,n),nl(e,n),e}function zl(e,t,r,n){var i=t.current,s=el(),o=tl(i);return r=Kl(r),null===t.context?t.context=r:t.pendingContext=r,(t=xs(s,o)).payload={element:e},null!==(n=void 0===n?null:n)&&(t.callback=n),null!==(e=Ls(i,t,o))&&(rl(e,i,o,s),Os(e,i,o)),o}function Hl(e){return(e=e.current).child?(e.child.tag,e.child.stateNode):null}function Wl(e,t){if(null!==(e=e.memoizedState)&&null!==e.dehydrated){var r=e.retryLane;e.retryLane=0!==r&&r<t?r:t}}function Gl(e,t){Wl(e,t),(e=e.alternate)&&Wl(e,t)}Sc=function(e,t,r){if(null!==e)if(e.memoizedProps!==t.pendingProps||Ri.current)wa=!0;else{if(0===(e.lanes&r)&&0===(128&t.flags))return wa=!1,function(e,t,r){switch(t.tag){case 3:Pa(t),fs();break;case 5:so(t);break;case 1:Ni(t.type)&&Bi(t);break;case 4:no(t,t.stateNode.containerInfo);break;case 10:var n=t.type._context,i=t.memoizedProps.value;Ai(ms,n._currentValue),n._currentValue=i;break;case 13:if(null!==(n=t.memoizedState))return null!==n.dehydrated?(Ai(ao,1&ao.current),t.flags|=128,null):0!==(r&t.child.childLanes)?Ma(e,t,r):(Ai(ao,1&ao.current),null!==(e=za(e,t,r))?e.sibling:null);Ai(ao,1&ao.current);break;case 19:if(n=0!==(r&t.childLanes),0!==(128&e.flags)){if(n)return Ka(e,t,r);t.flags|=128}if(null!==(i=t.memoizedState)&&(i.rendering=null,i.tail=null,i.lastEffect=null),Ai(ao,ao.current),n)break;return null;case 22:case 23:return t.lanes=0,Ca(e,t,r)}return za(e,t,r)}(e,t,r);wa=0!==(131072&e.flags)}else wa=!1,is&&0!==(1048576&t.flags)&&Zi(t,Wi,t.index);switch(t.lanes=0,t.tag){case 2:var n=t.type;qa(e,t),e=t.pendingProps;var i=Di(t,ki.current);Is(t,r),i=Io(null,t,n,e,i,r);var o=Co();return t.flags|=1,"object"===typeof i&&null!==i&&"function"===typeof i.render&&void 0===i.$$typeof?(t.tag=1,t.memoizedState=null,t.updateQueue=null,Ni(n)?(o=!0,Bi(t)):o=!1,t.memoizedState=null!==i.state&&void 0!==i.state?i.state:null,Ds(t),i.updater=js,t.stateNode=i,i._reactInternals=t,Hs(t,n,e,r),t=Ra(null,t,n,!0,o,r)):(t.tag=0,is&&o&&es(t),Ea(null,t,i,r),t=t.child),t;case 16:n=t.elementType;e:{switch(qa(e,t),e=t.pendingProps,n=(i=n._init)(n._payload),t.type=n,i=t.tag=function(e){if("function"===typeof e)return Nl(e)?1:0;if(void 0!==e&&null!==e){if((e=e.$$typeof)===k)return 11;if(e===D)return 14}return 2}(n),e=gs(n,e),i){case 0:t=Ta(null,t,n,e,r);break e;case 1:t=ka(null,t,n,e,r);break e;case 11:t=_a(null,t,n,e,r);break e;case 14:t=Sa(null,t,n,gs(n.type,e),r);break e}throw Error(s(306,n,""))}return t;case 0:return n=t.type,i=t.pendingProps,Ta(e,t,n,i=t.elementType===n?i:gs(n,i),r);case 1:return n=t.type,i=t.pendingProps,ka(e,t,n,i=t.elementType===n?i:gs(n,i),r);case 3:e:{if(Pa(t),null===e)throw Error(s(387));n=t.pendingProps,i=(o=t.memoizedState).element,Ns(e,t),Ms(t,n,null,r);var a=t.memoizedState;if(n=a.element,o.isDehydrated){if(o={element:n,isDehydrated:!1,cache:a.cache,pendingSuspenseBoundaries:a.pendingSuspenseBoundaries,transitions:a.transitions},t.updateQueue.baseState=o,t.memoizedState=o,256&t.flags){t=Da(e,t,n,r,i=ua(Error(s(423)),t));break e}if(n!==i){t=Da(e,t,n,r,i=ua(Error(s(424)),t));break e}for(ns=li(t.stateNode.containerInfo.firstChild),rs=t,is=!0,ss=null,r=Xs(t,null,n,r),t.child=r;r;)r.flags=-3&r.flags|4096,r=r.sibling}else{if(fs(),n===i){t=za(e,t,r);break e}Ea(e,t,n,r)}t=t.child}return t;case 5:return so(t),null===e&&ls(t),n=t.type,i=t.pendingProps,o=null!==e?e.memoizedProps:null,a=i.children,ri(n,i)?a=null:null!==o&&ri(n,o)&&(t.flags|=32),Aa(e,t),Ea(e,t,a,r),t.child;case 6:return null===e&&ls(t),null;case 13:return Ma(e,t,r);case 4:return no(t,t.stateNode.containerInfo),n=t.pendingProps,null===e?t.child=$s(t,null,n,r):Ea(e,t,n,r),t.child;case 11:return n=t.type,i=t.pendingProps,_a(e,t,n,i=t.elementType===n?i:gs(n,i),r);case 7:return Ea(e,t,t.pendingProps,r),t.child;case 8:case 12:return Ea(e,t,t.pendingProps.children,r),t.child;case 10:e:{if(n=t.type._context,i=t.pendingProps,o=t.memoizedProps,a=i.value,Ai(ms,n._currentValue),n._currentValue=a,null!==o)if(an(o.value,a)){if(o.children===i.children&&!Ri.current){t=za(e,t,r);break e}}else for(null!==(o=t.child)&&(o.return=t);null!==o;){var c=o.dependencies;if(null!==c){a=o.child;for(var l=c.firstContext;null!==l;){if(l.context===n){if(1===o.tag){(l=xs(-1,r&-r)).tag=2;var u=o.updateQueue;if(null!==u){var h=(u=u.shared).pending;null===h?l.next=l:(l.next=h.next,h.next=l),u.pending=l}}o.lanes|=r,null!==(l=o.alternate)&&(l.lanes|=r),Ss(o.return,r,t),c.lanes|=r;break}l=l.next}}else if(10===o.tag)a=o.type===t.type?null:o.child;else if(18===o.tag){if(null===(a=o.return))throw Error(s(341));a.lanes|=r,null!==(c=a.alternate)&&(c.lanes|=r),Ss(a,r,t),a=o.sibling}else a=o.child;if(null!==a)a.return=o;else for(a=o;null!==a;){if(a===t){a=null;break}if(null!==(o=a.sibling)){o.return=a.return,a=o;break}a=a.return}o=a}Ea(e,t,i.children,r),t=t.child}return t;case 9:return i=t.type,n=t.pendingProps.children,Is(t,r),n=n(i=Cs(i)),t.flags|=1,Ea(e,t,n,r),t.child;case 14:return i=gs(n=t.type,t.pendingProps),Sa(e,t,n,i=gs(n.type,i),r);case 15:return Ia(e,t,t.type,t.pendingProps,r);case 17:return n=t.type,i=t.pendingProps,i=t.elementType===n?i:gs(n,i),qa(e,t),t.tag=1,Ni(n)?(e=!0,Bi(t)):e=!1,Is(t,r),qs(t,n,i),Hs(t,n,i,r),Ra(null,t,n,!0,e,r);case 19:return Ka(e,t,r);case 22:return Ca(e,t,r)}throw Error(s(156,t.tag))};var Ql="function"===typeof reportError?reportError:function(e){console.error(e)};function Yl(e){this._internalRoot=e}function $l(e){this._internalRoot=e}function Xl(e){return!(!e||1!==e.nodeType&&9!==e.nodeType&&11!==e.nodeType)}function Jl(e){return!(!e||1!==e.nodeType&&9!==e.nodeType&&11!==e.nodeType&&(8!==e.nodeType||" react-mount-point-unstable "!==e.nodeValue))}function Zl(){}function eu(e,t,r,n,i){var s=r._reactRootContainer;if(s){var o=s;if("function"===typeof i){var a=i;i=function(){var e=Hl(o);a.call(e)}}zl(t,o,e,i)}else o=function(e,t,r,n,i){if(i){if("function"===typeof n){var s=n;n=function(){var e=Hl(o);s.call(e)}}var o=ql(t,n,e,0,null,!1,0,"",Zl);return e._reactRootContainer=o,e[pi]=o.current,Kn(8===e.nodeType?e.parentNode:e),ul(),o}for(;i=e.lastChild;)e.removeChild(i);if("function"===typeof n){var a=n;n=function(){var e=Hl(c);a.call(e)}}var c=Vl(e,0,!1,null,0,!1,0,"",Zl);return e._reactRootContainer=c,e[pi]=c.current,Kn(8===e.nodeType?e.parentNode:e),ul((function(){zl(t,c,r,n)})),c}(r,t,e,i,n);return Hl(o)}$l.prototype.render=Yl.prototype.render=function(e){var t=this._internalRoot;if(null===t)throw Error(s(409));zl(e,t,null,null)},$l.prototype.unmount=Yl.prototype.unmount=function(){var e=this._internalRoot;if(null!==e){this._internalRoot=null;var t=e.containerInfo;ul((function(){zl(null,e,null,null)})),t[pi]=null}},$l.prototype.unstable_scheduleHydration=function(e){if(e){var t=It();e={blockedOn:null,target:e,priority:t};for(var r=0;r<xt.length&&0!==t&&t<xt[r].priority;r++);xt.splice(r,0,e),0===r&&Mt(e)}},Et=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var r=ht(t.pendingLanes);0!==r&&(vt(t,1|r),nl(t,Xe()),0===(6&kc)&&(Kc=Xe()+500,Ki()))}break;case 13:ul((function(){var t=Rs(e,1);if(null!==t){var r=el();rl(t,e,1,r)}})),Gl(e,1)}},_t=function(e){if(13===e.tag){var t=Rs(e,134217728);if(null!==t)rl(t,e,134217728,el());Gl(e,134217728)}},St=function(e){if(13===e.tag){var t=tl(e),r=Rs(e,t);if(null!==r)rl(r,e,t,el());Gl(e,t)}},It=function(){return bt},Ct=function(e,t){var r=bt;try{return bt=e,t()}finally{bt=r}},_e=function(e,t,r){switch(t){case"input":if(J(e,r),t=r.name,"radio"===r.type&&null!=t){for(r=e;r.parentNode;)r=r.parentNode;for(r=r.querySelectorAll("input[name="+JSON.stringify(""+t)+'][type="radio"]'),t=0;t<r.length;t++){var n=r[t];if(n!==e&&n.form===e.form){var i=Ei(n);if(!i)throw Error(s(90));G(n),J(n,i)}}}break;case"textarea":se(e,r);break;case"select":null!=(t=r.value)&&re(e,!!r.multiple,t,!1)}},ke=ll,Re=ul;var tu={usingClientEntryPoint:!1,Events:[bi,wi,Ei,Ae,Te,ll]},ru={findFiberByHostInstance:vi,bundleType:0,version:"18.2.0",rendererPackageName:"react-dom"},nu={bundleType:ru.bundleType,version:ru.version,rendererPackageName:ru.rendererPackageName,rendererConfig:ru.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:w.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return null===(e=He(e))?null:e.stateNode},findFiberByHostInstance:ru.findFiberByHostInstance||function(){return null},findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.2.0-next-9e3b772b8-20220608"};if("undefined"!==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__){var iu=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!iu.isDisabled&&iu.supportsFiber)try{it=iu.inject(nu),st=iu}catch(ue){}}t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=tu,t.createPortal=function(e,t){var r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:null;if(!Xl(t))throw Error(s(200));return jl(e,t,null,r)},t.createRoot=function(e,t){if(!Xl(e))throw Error(s(299));var r=!1,n="",i=Ql;return null!==t&&void 0!==t&&(!0===t.unstable_strictMode&&(r=!0),void 0!==t.identifierPrefix&&(n=t.identifierPrefix),void 0!==t.onRecoverableError&&(i=t.onRecoverableError)),t=Vl(e,1,!1,null,0,r,0,n,i),e[pi]=t.current,Kn(8===e.nodeType?e.parentNode:e),new Yl(t)},t.findDOMNode=function(e){if(null==e)return null;if(1===e.nodeType)return e;var t=e._reactInternals;if(void 0===t){if("function"===typeof e.render)throw Error(s(188));throw e=Object.keys(e).join(","),Error(s(268,e))}return e=null===(e=He(t))?null:e.stateNode},t.flushSync=function(e){return ul(e)},t.hydrate=function(e,t,r){if(!Jl(t))throw Error(s(200));return eu(null,e,t,!0,r)},t.hydrateRoot=function(e,t,r){if(!Xl(e))throw Error(s(405));var n=null!=r&&r.hydratedSources||null,i=!1,o="",a=Ql;if(null!==r&&void 0!==r&&(!0===r.unstable_strictMode&&(i=!0),void 0!==r.identifierPrefix&&(o=r.identifierPrefix),void 0!==r.onRecoverableError&&(a=r.onRecoverableError)),t=ql(t,null,e,1,null!=r?r:null,i,0,o,a),e[pi]=t.current,Kn(e),n)for(e=0;e<n.length;e++)i=(i=(r=n[e])._getVersion)(r._source),null==t.mutableSourceEagerHydrationData?t.mutableSourceEagerHydrationData=[r,i]:t.mutableSourceEagerHydrationData.push(r,i);return new $l(t)},t.render=function(e,t,r){if(!Jl(t))throw Error(s(200));return eu(null,e,t,!1,r)},t.unmountComponentAtNode=function(e){if(!Jl(e))throw Error(s(40));return!!e._reactRootContainer&&(ul((function(){eu(null,null,e,!1,(function(){e._reactRootContainer=null,e[pi]=null}))})),!0)},t.unstable_batchedUpdates=ll,t.unstable_renderSubtreeIntoContainer=function(e,t,r,n){if(!Jl(r))throw Error(s(200));if(null==e||void 0===e._reactInternals)throw Error(s(38));return eu(e,t,r,!1,n)},t.version="18.2.0-next-9e3b772b8-20220608"},2251:(e,t,r)=>{"use strict";var n=r(8317);t.createRoot=n.createRoot,t.hydrateRoot=n.hydrateRoot},8317:(e,t,r)=>{"use strict";!function e(){if("undefined"!==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"===typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE)try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}(),e.exports=r(6421)},7082:(e,t,r)=>{"use strict";var n=r(5146),i=Symbol.for("react.element"),s=Symbol.for("react.fragment"),o=Object.prototype.hasOwnProperty,a=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,c={key:!0,ref:!0,__self:!0,__source:!0};function l(e,t,r){var n,s={},l=null,u=null;for(n in void 0!==r&&(l=""+r),void 0!==t.key&&(l=""+t.key),void 0!==t.ref&&(u=t.ref),t)o.call(t,n)&&!c.hasOwnProperty(n)&&(s[n]=t[n]);if(e&&e.defaultProps)for(n in t=e.defaultProps)void 0===s[n]&&(s[n]=t[n]);return{$$typeof:i,type:e,key:l,ref:u,props:s,_owner:a.current}}t.jsx=l,t.jsxs=l},8444:(e,t)=>{"use strict";var r=Symbol.for("react.element"),n=Symbol.for("react.portal"),i=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),a=Symbol.for("react.provider"),c=Symbol.for("react.context"),l=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),h=Symbol.for("react.memo"),d=Symbol.for("react.lazy"),f=Symbol.iterator;var p={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},y=Object.assign,g={};function m(e,t,r){this.props=e,this.context=t,this.refs=g,this.updater=r||p}function v(){}function b(e,t,r){this.props=e,this.context=t,this.refs=g,this.updater=r||p}m.prototype.isReactComponent={},m.prototype.setState=function(e,t){if("object"!==typeof e&&"function"!==typeof e&&null!=e)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")},m.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")},v.prototype=m.prototype;var w=b.prototype=new v;w.constructor=b,y(w,m.prototype),w.isPureReactComponent=!0;var E=Array.isArray,_=Object.prototype.hasOwnProperty,S={current:null},I={key:!0,ref:!0,__self:!0,__source:!0};function C(e,t,n){var i,s={},o=null,a=null;if(null!=t)for(i in void 0!==t.ref&&(a=t.ref),void 0!==t.key&&(o=""+t.key),t)_.call(t,i)&&!I.hasOwnProperty(i)&&(s[i]=t[i]);var c=arguments.length-2;if(1===c)s.children=n;else if(1<c){for(var l=Array(c),u=0;u<c;u++)l[u]=arguments[u+2];s.children=l}if(e&&e.defaultProps)for(i in c=e.defaultProps)void 0===s[i]&&(s[i]=c[i]);return{$$typeof:r,type:e,key:o,ref:a,props:s,_owner:S.current}}function A(e){return"object"===typeof e&&null!==e&&e.$$typeof===r}var T=/\/+/g;function k(e,t){return"object"===typeof e&&null!==e&&null!=e.key?function(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,(function(e){return t[e]}))}(""+e.key):t.toString(36)}function R(e,t,i,s,o){var a=typeof e;"undefined"!==a&&"boolean"!==a||(e=null);var c=!1;if(null===e)c=!0;else switch(a){case"string":case"number":c=!0;break;case"object":switch(e.$$typeof){case r:case n:c=!0}}if(c)return o=o(c=e),e=""===s?"."+k(c,0):s,E(o)?(i="",null!=e&&(i=e.replace(T,"$&/")+"/"),R(o,t,i,"",(function(e){return e}))):null!=o&&(A(o)&&(o=function(e,t){return{$$typeof:r,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}(o,i+(!o.key||c&&c.key===o.key?"":(""+o.key).replace(T,"$&/")+"/")+e)),t.push(o)),1;if(c=0,s=""===s?".":s+":",E(e))for(var l=0;l<e.length;l++){var u=s+k(a=e[l],l);c+=R(a,t,i,u,o)}else if(u=function(e){return null===e||"object"!==typeof e?null:"function"===typeof(e=f&&e[f]||e["@@iterator"])?e:null}(e),"function"===typeof u)for(e=u.call(e),l=0;!(a=e.next()).done;)c+=R(a=a.value,t,i,u=s+k(a,l++),o);else if("object"===a)throw t=String(e),Error("Objects are not valid as a React child (found: "+("[object Object]"===t?"object with keys {"+Object.keys(e).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.");return c}function P(e,t,r){if(null==e)return e;var n=[],i=0;return R(e,n,"","",(function(e){return t.call(r,e,i++)})),n}function D(e){if(-1===e._status){var t=e._result;(t=t()).then((function(t){0!==e._status&&-1!==e._status||(e._status=1,e._result=t)}),(function(t){0!==e._status&&-1!==e._status||(e._status=2,e._result=t)})),-1===e._status&&(e._status=0,e._result=t)}if(1===e._status)return e._result.default;throw e._result}var N={current:null},x={transition:null},L={ReactCurrentDispatcher:N,ReactCurrentBatchConfig:x,ReactCurrentOwner:S};t.Children={map:P,forEach:function(e,t,r){P(e,(function(){t.apply(this,arguments)}),r)},count:function(e){var t=0;return P(e,(function(){t++})),t},toArray:function(e){return P(e,(function(e){return e}))||[]},only:function(e){if(!A(e))throw Error("React.Children.only expected to receive a single React element child.");return e}},t.Component=m,t.Fragment=i,t.Profiler=o,t.PureComponent=b,t.StrictMode=s,t.Suspense=u,t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=L,t.cloneElement=function(e,t,n){if(null===e||void 0===e)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+e+".");var i=y({},e.props),s=e.key,o=e.ref,a=e._owner;if(null!=t){if(void 0!==t.ref&&(o=t.ref,a=S.current),void 0!==t.key&&(s=""+t.key),e.type&&e.type.defaultProps)var c=e.type.defaultProps;for(l in t)_.call(t,l)&&!I.hasOwnProperty(l)&&(i[l]=void 0===t[l]&&void 0!==c?c[l]:t[l])}var l=arguments.length-2;if(1===l)i.children=n;else if(1<l){c=Array(l);for(var u=0;u<l;u++)c[u]=arguments[u+2];i.children=c}return{$$typeof:r,type:e.type,key:s,ref:o,props:i,_owner:a}},t.createContext=function(e){return(e={$$typeof:c,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null}).Provider={$$typeof:a,_context:e},e.Consumer=e},t.createElement=C,t.createFactory=function(e){var t=C.bind(null,e);return t.type=e,t},t.createRef=function(){return{current:null}},t.forwardRef=function(e){return{$$typeof:l,render:e}},t.isValidElement=A,t.lazy=function(e){return{$$typeof:d,_payload:{_status:-1,_result:e},_init:D}},t.memo=function(e,t){return{$$typeof:h,type:e,compare:void 0===t?null:t}},t.startTransition=function(e){var t=x.transition;x.transition={};try{e()}finally{x.transition=t}},t.unstable_act=function(){throw Error("act(...) is not supported in production builds of React.")},t.useCallback=function(e,t){return N.current.useCallback(e,t)},t.useContext=function(e){return N.current.useContext(e)},t.useDebugValue=function(){},t.useDeferredValue=function(e){return N.current.useDeferredValue(e)},t.useEffect=function(e,t){return N.current.useEffect(e,t)},t.useId=function(){return N.current.useId()},t.useImperativeHandle=function(e,t,r){return N.current.useImperativeHandle(e,t,r)},t.useInsertionEffect=function(e,t){return N.current.useInsertionEffect(e,t)},t.useLayoutEffect=function(e,t){return N.current.useLayoutEffect(e,t)},t.useMemo=function(e,t){return N.current.useMemo(e,t)},t.useReducer=function(e,t,r){return N.current.useReducer(e,t,r)},t.useRef=function(e){return N.current.useRef(e)},t.useState=function(e){return N.current.useState(e)},t.useSyncExternalStore=function(e,t,r){return N.current.useSyncExternalStore(e,t,r)},t.useTransition=function(){return N.current.useTransition()},t.version="18.2.0"},5146:(e,t,r)=>{"use strict";e.exports=r(8444)},4686:(e,t,r)=>{"use strict";e.exports=r(7082)},8062:(e,t,r)=>{"use strict";e.exports=o;var n=r(7123),i=o.prototype,s=new Date%1e9;function o(e){e=e||{},this.id=e.id||(1e9*Math.random()>>>0)+s++,this.max=e.max||1/0,this.items=e.items||[],this._lookup={},this.size=this.items.length,this.lastModified=new Date(e.lastModified||new Date);for(var t,r,n=this.items.length;n--;)t=this.items[n],r=new Date(t.expires)-new Date,this._lookup[t.key]=t,r>0?this.expire(t.key,r):r<=0&&this.delete(t.key)}i.has=function(e){return e in this._lookup},i.get=function(e){if(!this.has(e))return null;var t=this._lookup[e];return t.refresh&&this.expire(e,t.refresh),this.items.splice(this.items.indexOf(t),1),this.items.push(t),t.value},i.meta=function(e){if(!this.has(e))return null;var t=this._lookup[e];return"meta"in t?t.meta:null},i.set=function(e,t,r){var n=this._lookup[e],i=this._lookup[e]={key:e,value:t};return this.lastModified=new Date,n?(clearTimeout(n.timeout),this.items.splice(this.items.indexOf(n),1,i)):(this.size>=this.max&&this.delete(this.items[0].key),this.items.push(i),this.size++),r&&("ttl"in r&&this.expire(e,r.ttl),"meta"in r&&(i.meta=r.meta),r.refresh&&(i.refresh=r.ttl)),this},i.delete=function(e){var t=this._lookup[e];return!!t&&(this.lastModified=new Date,this.items.splice(this.items.indexOf(t),1),clearTimeout(t.timeout),delete this._lookup[e],this.size--,this)},i.expire=function(e,t){var r=t||0,i=this._lookup[e];if(!i)return this;if("string"===typeof r&&(r=n(t)),"number"!==typeof r)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},i.clear=function(){for(var e=this.items.length;e--;)this.delete(this.items[e].key);return this},i.toJSON=function(){for(var e,t=new Array(this.items.length),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}}},3658:(e,t,r)=>{"use strict";const n=r(922);class i{constructor(e,t,r){const i=this;this._started=n(),this._rescheduled=0,this._scheduled=t,this._args=r,this._triggered=!1,this._timerWrapper=()=>{i._rescheduled>0?(i._scheduled=i._rescheduled-(n()-i._started),i._schedule(i._scheduled)):(i._triggered=!0,e.apply(null,i._args))},this._timer=setTimeout(this._timerWrapper,t)}reschedule(e){e||(e=this._scheduled);const t=n();t+e-(this._started+this._scheduled)<0?(clearTimeout(this._timer),this._schedule(e)):this._triggered?this._schedule(e):(this._started=t,this._rescheduled=e)}_schedule(e){this._triggered=!1,this._started=n(),this._rescheduled=0,this._scheduled=e,this._timer=setTimeout(this._timerWrapper,e)}clear(){clearTimeout(this._timer)}}e.exports=function(){if("function"!==typeof arguments[0])throw new Error("callback needed");if("number"!==typeof arguments[1])throw new Error("timeout needed");let e;if(arguments.length>0){e=new Array(arguments.length-2);for(var t=0;t<e.length;t++)e[t]=arguments[t+2]}return new i(arguments[0],arguments[1],e)}},922:e=>{"use strict";e.exports=function(){return Date.now()}},8515:(e,t,r)=>{"use strict";var n=r(6618),i=/[\/\?<>\\:\*\|"]/g,s=/[\x00-\x1f\x80-\x9f]/g,o=/^\.+$/,a=/^(con|prn|aux|nul|com[0-9]|lpt[0-9])(\..*)?$/i,c=/[\. ]+$/;function l(e,t){if("string"!==typeof e)throw new Error("Input must be string");var r=e.replace(i,t).replace(s,t).replace(o,t).replace(a,t).replace(c,t);return n(r,255)}e.exports=function(e,t){var r=t&&t.replacement||"",n=l(e,r);return""===r?n:l(n,"")}},8570:(e,t)=>{"use strict";function r(e,t){var r=e.length;e.push(t);e:for(;0<r;){var n=r-1>>>1,i=e[n];if(!(0<s(i,t)))break e;e[n]=t,e[r]=i,r=n}}function n(e){return 0===e.length?null:e[0]}function i(e){if(0===e.length)return null;var t=e[0],r=e.pop();if(r!==t){e[0]=r;e:for(var n=0,i=e.length,o=i>>>1;n<o;){var a=2*(n+1)-1,c=e[a],l=a+1,u=e[l];if(0>s(c,r))l<i&&0>s(u,c)?(e[n]=u,e[l]=r,n=l):(e[n]=c,e[a]=r,n=a);else{if(!(l<i&&0>s(u,r)))break e;e[n]=u,e[l]=r,n=l}}}return t}function s(e,t){var r=e.sortIndex-t.sortIndex;return 0!==r?r:e.id-t.id}if("object"===typeof performance&&"function"===typeof performance.now){var o=performance;t.unstable_now=function(){return o.now()}}else{var a=Date,c=a.now();t.unstable_now=function(){return a.now()-c}}var l=[],u=[],h=1,d=null,f=3,p=!1,y=!1,g=!1,m="function"===typeof setTimeout?setTimeout:null,v="function"===typeof clearTimeout?clearTimeout:null,b="undefined"!==typeof setImmediate?setImmediate:null;function w(e){for(var t=n(u);null!==t;){if(null===t.callback)i(u);else{if(!(t.startTime<=e))break;i(u),t.sortIndex=t.expirationTime,r(l,t)}t=n(u)}}function E(e){if(g=!1,w(e),!y)if(null!==n(l))y=!0,x(_);else{var t=n(u);null!==t&&L(E,t.startTime-e)}}function _(e,r){y=!1,g&&(g=!1,v(A),A=-1),p=!0;var s=f;try{for(w(r),d=n(l);null!==d&&(!(d.expirationTime>r)||e&&!R());){var o=d.callback;if("function"===typeof o){d.callback=null,f=d.priorityLevel;var a=o(d.expirationTime<=r);r=t.unstable_now(),"function"===typeof a?d.callback=a:d===n(l)&&i(l),w(r)}else i(l);d=n(l)}if(null!==d)var c=!0;else{var h=n(u);null!==h&&L(E,h.startTime-r),c=!1}return c}finally{d=null,f=s,p=!1}}"undefined"!==typeof navigator&&void 0!==navigator.scheduling&&void 0!==navigator.scheduling.isInputPending&&navigator.scheduling.isInputPending.bind(navigator.scheduling);var S,I=!1,C=null,A=-1,T=5,k=-1;function R(){return!(t.unstable_now()-k<T)}function P(){if(null!==C){var e=t.unstable_now();k=e;var r=!0;try{r=C(!0,e)}finally{r?S():(I=!1,C=null)}}else I=!1}if("function"===typeof b)S=function(){b(P)};else if("undefined"!==typeof MessageChannel){var D=new MessageChannel,N=D.port2;D.port1.onmessage=P,S=function(){N.postMessage(null)}}else S=function(){m(P,0)};function x(e){C=e,I||(I=!0,S())}function L(e,r){A=m((function(){e(t.unstable_now())}),r)}t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(e){e.callback=null},t.unstable_continueExecution=function(){y||p||(y=!0,x(_))},t.unstable_forceFrameRate=function(e){0>e||125<e?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):T=0<e?Math.floor(1e3/e):5},t.unstable_getCurrentPriorityLevel=function(){return f},t.unstable_getFirstCallbackNode=function(){return n(l)},t.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var r=f;f=t;try{return e()}finally{f=r}},t.unstable_pauseExecution=function(){},t.unstable_requestPaint=function(){},t.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var r=f;f=e;try{return t()}finally{f=r}},t.unstable_scheduleCallback=function(e,i,s){var o=t.unstable_now();switch("object"===typeof s&&null!==s?s="number"===typeof(s=s.delay)&&0<s?o+s:o:s=o,e){case 1:var a=-1;break;case 2:a=250;break;case 5:a=1073741823;break;case 4:a=1e4;break;default:a=5e3}return e={id:h++,callback:i,priorityLevel:e,startTime:s,expirationTime:a=s+a,sortIndex:-1},s>o?(e.sortIndex=s,r(u,e),null===n(l)&&e===n(u)&&(g?(v(A),A=-1):g=!0,L(E,s-o))):(e.sortIndex=a,r(l,e),y||p||(y=!0,x(_))),e},t.unstable_shouldYield=R,t.unstable_wrapCallback=function(e){var t=f;return function(){var r=f;f=t;try{return e.apply(this,arguments)}finally{f=r}}}},4339:(e,t,r)=>{"use strict";e.exports=r(8570)},4465:e=>{"use strict";const t=new Map;e.exports={setDelayedInterval:function(e,r,n){n=n||r;const i="".concat(Date.now(),":").concat(Math.floor(1e6*Math.random())),s=setTimeout((()=>{!async function(e,r,n){for(;t.get(n);){try{await e()}catch(i){setTimeout((()=>{throw i}),1);break}if(!t.get(n))break;await new Promise((e=>{const i=setTimeout(e,r);t.set(n,i)}))}}(e,r,i)}),n);return t.set(i,s),i},clearDelayedInterval:function(e){const r=t.get(e);r&&(clearTimeout(r),t.delete(e))}}},6512:(e,t,r)=>{"use strict";const{AbortController:n}=globalThis,i=r(3658);class s extends n{constructor(e){super(),this._ms=e,this._timer=i((()=>this.abort()),e),Object.setPrototypeOf(this,s.prototype)}abort(){return this._timer.clear(),super.abort()}clear(){this._timer.clear()}reset(){this._timer.clear(),this._timer=i((()=>this.abort()),this._ms)}}e.exports={TimeoutController:s}},6618:(e,t,r)=>{"use strict";var n=r(9583),i=r(1774);e.exports=n.bind(null,i)},9583:e=>{"use strict";function t(e){return e>=55296&&e<=56319}function r(e){return e>=56320&&e<=57343}e.exports=function(e,n,i){if("string"!==typeof n)throw new Error("Input must be string");for(var s,o,a=n.length,c=0,l=0;l<a;l+=1){if(s=n.charCodeAt(l),o=n[l],t(s)&&r(n.charCodeAt(l+1))&&(o+=n[l+=1]),(c+=e(o))===i)return n.slice(0,l+1);if(c>i)return n.slice(0,l-o.length+1)}return n}},1774:e=>{"use strict";function t(e){return e>=55296&&e<=56319}function r(e){return e>=56320&&e<=57343}e.exports=function(e){if("string"!==typeof e)throw new Error("Input must be string");for(var n=e.length,i=0,s=null,o=null,a=0;a<n;a++)r(s=e.charCodeAt(a))?null!=o&&t(o)?i+=1:i+=3:s<=127?i+=1:s>=128&&s<=2047?i+=2:s>=2048&&s<=65535&&(i+=3),o=s;return i}},8610:e=>{e.exports=function e(t,r){var n,i=0,s=0,o=r=r||0,a=t.length;do{if(o>=a||s>49)throw e.bytes=0,new RangeError("Could not decode varint");n=t[o++],i+=s<28?(127&n)<<s:(127&n)*Math.pow(2,s),s+=7}while(n>=128);return e.bytes=o-r,i}},4050:e=>{e.exports=function e(r,n,i){if(Number.MAX_SAFE_INTEGER&&r>Number.MAX_SAFE_INTEGER)throw e.bytes=0,new RangeError("Could not encode varint");n=n||[];var s=i=i||0;for(;r>=t;)n[i++]=255&r|128,r/=128;for(;-128&r;)n[i++]=255&r|128,r>>>=7;return n[i]=0|r,e.bytes=i-s+1,n};var t=Math.pow(2,31)},6664:(e,t,r)=>{e.exports={encode:r(4050),decode:r(8610),encodingLength:r(8238)}},8238:e=>{var t=Math.pow(2,7),r=Math.pow(2,14),n=Math.pow(2,21),i=Math.pow(2,28),s=Math.pow(2,35),o=Math.pow(2,42),a=Math.pow(2,49),c=Math.pow(2,56),l=Math.pow(2,63);e.exports=function(e){return e<t?1:e<r?2:e<n?3:e<i?4:e<s?5:e<o?6:e<a?7:e<c?8:e<l?9:10}},9458:()=>{},7815:()=>{},1665:()=>{},9437:()=>{},5238:()=>{},9580:()=>{},4763:function(e,t,r){var n,i,s;i=[r(2376)],void 0===(s="function"===typeof(n=function(e){"use strict";var t=e.Reader,r=e.Writer,n=e.util,i=e.roots.default||(e.roots.default={});return i.RPC=function(){function s(e){if(this.subscriptions=[],this.messages=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}var o;return s.prototype.subscriptions=n.emptyArray,s.prototype.messages=n.emptyArray,s.prototype.control=null,Object.defineProperty(s.prototype,"_control",{get:n.oneOfGetter(o=["control"]),set:n.oneOfSetter(o)}),s.encode=function(e,t){if(t||(t=r.create()),null!=e.subscriptions&&e.subscriptions.length)for(var n=0;n<e.subscriptions.length;++n)i.RPC.SubOpts.encode(e.subscriptions[n],t.uint32(10).fork()).ldelim();if(null!=e.messages&&e.messages.length)for(n=0;n<e.messages.length;++n)i.RPC.Message.encode(e.messages[n],t.uint32(18).fork()).ldelim();return null!=e.control&&Object.hasOwnProperty.call(e,"control")&&i.RPC.ControlMessage.encode(e.control,t.uint32(26).fork()).ldelim(),t},s.decode=function(e,r){e instanceof t||(e=t.create(e));for(var n=void 0===r?e.len:e.pos+r,s=new i.RPC;e.pos<n;){var o=e.uint32();switch(o>>>3){case 1:s.subscriptions&&s.subscriptions.length||(s.subscriptions=[]),s.subscriptions.push(i.RPC.SubOpts.decode(e,e.uint32()));break;case 2:s.messages&&s.messages.length||(s.messages=[]),s.messages.push(i.RPC.Message.decode(e,e.uint32()));break;case 3:s.control=i.RPC.ControlMessage.decode(e,e.uint32());break;default:e.skipType(7&o)}}return s},s.fromObject=function(e){if(e instanceof i.RPC)return e;var t=new i.RPC;if(e.subscriptions){if(!Array.isArray(e.subscriptions))throw TypeError(".RPC.subscriptions: array expected");t.subscriptions=[];for(var r=0;r<e.subscriptions.length;++r){if("object"!==typeof e.subscriptions[r])throw TypeError(".RPC.subscriptions: object expected");t.subscriptions[r]=i.RPC.SubOpts.fromObject(e.subscriptions[r])}}if(e.messages){if(!Array.isArray(e.messages))throw TypeError(".RPC.messages: array expected");for(t.messages=[],r=0;r<e.messages.length;++r){if("object"!==typeof e.messages[r])throw TypeError(".RPC.messages: object expected");t.messages[r]=i.RPC.Message.fromObject(e.messages[r])}}if(null!=e.control){if("object"!==typeof e.control)throw TypeError(".RPC.control: object expected");t.control=i.RPC.ControlMessage.fromObject(e.control)}return t},s.toObject=function(e,t){t||(t={});var r={};if((t.arrays||t.defaults)&&(r.subscriptions=[],r.messages=[]),e.subscriptions&&e.subscriptions.length){r.subscriptions=[];for(var n=0;n<e.subscriptions.length;++n)r.subscriptions[n]=i.RPC.SubOpts.toObject(e.subscriptions[n],t)}if(e.messages&&e.messages.length)for(r.messages=[],n=0;n<e.messages.length;++n)r.messages[n]=i.RPC.Message.toObject(e.messages[n],t);return null!=e.control&&e.hasOwnProperty("control")&&(r.control=i.RPC.ControlMessage.toObject(e.control,t),t.oneofs&&(r._control="control")),r},s.prototype.toJSON=function(){return this.constructor.toObject(this,e.util.toJSONOptions)},s.SubOpts=function(){function s(e){if(e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}var o;return s.prototype.subscribe=null,s.prototype.topic=null,Object.defineProperty(s.prototype,"_subscribe",{get:n.oneOfGetter(o=["subscribe"]),set:n.oneOfSetter(o)}),Object.defineProperty(s.prototype,"_topic",{get:n.oneOfGetter(o=["topic"]),set:n.oneOfSetter(o)}),s.encode=function(e,t){return t||(t=r.create()),null!=e.subscribe&&Object.hasOwnProperty.call(e,"subscribe")&&t.uint32(8).bool(e.subscribe),null!=e.topic&&Object.hasOwnProperty.call(e,"topic")&&t.uint32(18).string(e.topic),t},s.decode=function(e,r){e instanceof t||(e=t.create(e));for(var n=void 0===r?e.len:e.pos+r,s=new i.RPC.SubOpts;e.pos<n;){var o=e.uint32();switch(o>>>3){case 1:s.subscribe=e.bool();break;case 2:s.topic=e.string();break;default:e.skipType(7&o)}}return s},s.fromObject=function(e){if(e instanceof i.RPC.SubOpts)return e;var t=new i.RPC.SubOpts;return null!=e.subscribe&&(t.subscribe=Boolean(e.subscribe)),null!=e.topic&&(t.topic=String(e.topic)),t},s.toObject=function(e,t){t||(t={});var r={};return null!=e.subscribe&&e.hasOwnProperty("subscribe")&&(r.subscribe=e.subscribe,t.oneofs&&(r._subscribe="subscribe")),null!=e.topic&&e.hasOwnProperty("topic")&&(r.topic=e.topic,t.oneofs&&(r._topic="topic")),r},s.prototype.toJSON=function(){return this.constructor.toObject(this,e.util.toJSONOptions)},s}(),s.Message=function(){function s(e){if(e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}var o;return s.prototype.from=null,s.prototype.data=null,s.prototype.seqno=null,s.prototype.topic="",s.prototype.signature=null,s.prototype.key=null,Object.defineProperty(s.prototype,"_from",{get:n.oneOfGetter(o=["from"]),set:n.oneOfSetter(o)}),Object.defineProperty(s.prototype,"_data",{get:n.oneOfGetter(o=["data"]),set:n.oneOfSetter(o)}),Object.defineProperty(s.prototype,"_seqno",{get:n.oneOfGetter(o=["seqno"]),set:n.oneOfSetter(o)}),Object.defineProperty(s.prototype,"_signature",{get:n.oneOfGetter(o=["signature"]),set:n.oneOfSetter(o)}),Object.defineProperty(s.prototype,"_key",{get:n.oneOfGetter(o=["key"]),set:n.oneOfSetter(o)}),s.encode=function(e,t){return t||(t=r.create()),null!=e.from&&Object.hasOwnProperty.call(e,"from")&&t.uint32(10).bytes(e.from),null!=e.data&&Object.hasOwnProperty.call(e,"data")&&t.uint32(18).bytes(e.data),null!=e.seqno&&Object.hasOwnProperty.call(e,"seqno")&&t.uint32(26).bytes(e.seqno),t.uint32(34).string(e.topic),null!=e.signature&&Object.hasOwnProperty.call(e,"signature")&&t.uint32(42).bytes(e.signature),null!=e.key&&Object.hasOwnProperty.call(e,"key")&&t.uint32(50).bytes(e.key),t},s.decode=function(e,r){e instanceof t||(e=t.create(e));for(var s=void 0===r?e.len:e.pos+r,o=new i.RPC.Message;e.pos<s;){var a=e.uint32();switch(a>>>3){case 1:o.from=e.bytes();break;case 2:o.data=e.bytes();break;case 3:o.seqno=e.bytes();break;case 4:o.topic=e.string();break;case 5:o.signature=e.bytes();break;case 6:o.key=e.bytes();break;default:e.skipType(7&a)}}if(!o.hasOwnProperty("topic"))throw n.ProtocolError("missing required 'topic'",{instance:o});return o},s.fromObject=function(e){if(e instanceof i.RPC.Message)return e;var t=new i.RPC.Message;return null!=e.from&&("string"===typeof e.from?n.base64.decode(e.from,t.from=n.newBuffer(n.base64.length(e.from)),0):e.from.length&&(t.from=e.from)),null!=e.data&&("string"===typeof e.data?n.base64.decode(e.data,t.data=n.newBuffer(n.base64.length(e.data)),0):e.data.length&&(t.data=e.data)),null!=e.seqno&&("string"===typeof e.seqno?n.base64.decode(e.seqno,t.seqno=n.newBuffer(n.base64.length(e.seqno)),0):e.seqno.length&&(t.seqno=e.seqno)),null!=e.topic&&(t.topic=String(e.topic)),null!=e.signature&&("string"===typeof e.signature?n.base64.decode(e.signature,t.signature=n.newBuffer(n.base64.length(e.signature)),0):e.signature.length&&(t.signature=e.signature)),null!=e.key&&("string"===typeof e.key?n.base64.decode(e.key,t.key=n.newBuffer(n.base64.length(e.key)),0):e.key.length&&(t.key=e.key)),t},s.toObject=function(e,t){t||(t={});var r={};return t.defaults&&(r.topic=""),null!=e.from&&e.hasOwnProperty("from")&&(r.from=t.bytes===String?n.base64.encode(e.from,0,e.from.length):t.bytes===Array?Array.prototype.slice.call(e.from):e.from,t.oneofs&&(r._from="from")),null!=e.data&&e.hasOwnProperty("data")&&(r.data=t.bytes===String?n.base64.encode(e.data,0,e.data.length):t.bytes===Array?Array.prototype.slice.call(e.data):e.data,t.oneofs&&(r._data="data")),null!=e.seqno&&e.hasOwnProperty("seqno")&&(r.seqno=t.bytes===String?n.base64.encode(e.seqno,0,e.seqno.length):t.bytes===Array?Array.prototype.slice.call(e.seqno):e.seqno,t.oneofs&&(r._seqno="seqno")),null!=e.topic&&e.hasOwnProperty("topic")&&(r.topic=e.topic),null!=e.signature&&e.hasOwnProperty("signature")&&(r.signature=t.bytes===String?n.base64.encode(e.signature,0,e.signature.length):t.bytes===Array?Array.prototype.slice.call(e.signature):e.signature,t.oneofs&&(r._signature="signature")),null!=e.key&&e.hasOwnProperty("key")&&(r.key=t.bytes===String?n.base64.encode(e.key,0,e.key.length):t.bytes===Array?Array.prototype.slice.call(e.key):e.key,t.oneofs&&(r._key="key")),r},s.prototype.toJSON=function(){return this.constructor.toObject(this,e.util.toJSONOptions)},s}(),s.ControlMessage=function(){function s(e){if(this.ihave=[],this.iwant=[],this.graft=[],this.prune=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return s.prototype.ihave=n.emptyArray,s.prototype.iwant=n.emptyArray,s.prototype.graft=n.emptyArray,s.prototype.prune=n.emptyArray,s.encode=function(e,t){if(t||(t=r.create()),null!=e.ihave&&e.ihave.length)for(var n=0;n<e.ihave.length;++n)i.RPC.ControlIHave.encode(e.ihave[n],t.uint32(10).fork()).ldelim();if(null!=e.iwant&&e.iwant.length)for(n=0;n<e.iwant.length;++n)i.RPC.ControlIWant.encode(e.iwant[n],t.uint32(18).fork()).ldelim();if(null!=e.graft&&e.graft.length)for(n=0;n<e.graft.length;++n)i.RPC.ControlGraft.encode(e.graft[n],t.uint32(26).fork()).ldelim();if(null!=e.prune&&e.prune.length)for(n=0;n<e.prune.length;++n)i.RPC.ControlPrune.encode(e.prune[n],t.uint32(34).fork()).ldelim();return t},s.decode=function(e,r){e instanceof t||(e=t.create(e));for(var n=void 0===r?e.len:e.pos+r,s=new i.RPC.ControlMessage;e.pos<n;){var o=e.uint32();switch(o>>>3){case 1:s.ihave&&s.ihave.length||(s.ihave=[]),s.ihave.push(i.RPC.ControlIHave.decode(e,e.uint32()));break;case 2:s.iwant&&s.iwant.length||(s.iwant=[]),s.iwant.push(i.RPC.ControlIWant.decode(e,e.uint32()));break;case 3:s.graft&&s.graft.length||(s.graft=[]),s.graft.push(i.RPC.ControlGraft.decode(e,e.uint32()));break;case 4:s.prune&&s.prune.length||(s.prune=[]),s.prune.push(i.RPC.ControlPrune.decode(e,e.uint32()));break;default:e.skipType(7&o)}}return s},s.fromObject=function(e){if(e instanceof i.RPC.ControlMessage)return e;var t=new i.RPC.ControlMessage;if(e.ihave){if(!Array.isArray(e.ihave))throw TypeError(".RPC.ControlMessage.ihave: array expected");t.ihave=[];for(var r=0;r<e.ihave.length;++r){if("object"!==typeof e.ihave[r])throw TypeError(".RPC.ControlMessage.ihave: object expected");t.ihave[r]=i.RPC.ControlIHave.fromObject(e.ihave[r])}}if(e.iwant){if(!Array.isArray(e.iwant))throw TypeError(".RPC.ControlMessage.iwant: array expected");for(t.iwant=[],r=0;r<e.iwant.length;++r){if("object"!==typeof e.iwant[r])throw TypeError(".RPC.ControlMessage.iwant: object expected");t.iwant[r]=i.RPC.ControlIWant.fromObject(e.iwant[r])}}if(e.graft){if(!Array.isArray(e.graft))throw TypeError(".RPC.ControlMessage.graft: array expected");for(t.graft=[],r=0;r<e.graft.length;++r){if("object"!==typeof e.graft[r])throw TypeError(".RPC.ControlMessage.graft: object expected");t.graft[r]=i.RPC.ControlGraft.fromObject(e.graft[r])}}if(e.prune){if(!Array.isArray(e.prune))throw TypeError(".RPC.ControlMessage.prune: array expected");for(t.prune=[],r=0;r<e.prune.length;++r){if("object"!==typeof e.prune[r])throw TypeError(".RPC.ControlMessage.prune: object expected");t.prune[r]=i.RPC.ControlPrune.fromObject(e.prune[r])}}return t},s.toObject=function(e,t){t||(t={});var r={};if((t.arrays||t.defaults)&&(r.ihave=[],r.iwant=[],r.graft=[],r.prune=[]),e.ihave&&e.ihave.length){r.ihave=[];for(var n=0;n<e.ihave.length;++n)r.ihave[n]=i.RPC.ControlIHave.toObject(e.ihave[n],t)}if(e.iwant&&e.iwant.length)for(r.iwant=[],n=0;n<e.iwant.length;++n)r.iwant[n]=i.RPC.ControlIWant.toObject(e.iwant[n],t);if(e.graft&&e.graft.length)for(r.graft=[],n=0;n<e.graft.length;++n)r.graft[n]=i.RPC.ControlGraft.toObject(e.graft[n],t);if(e.prune&&e.prune.length)for(r.prune=[],n=0;n<e.prune.length;++n)r.prune[n]=i.RPC.ControlPrune.toObject(e.prune[n],t);return r},s.prototype.toJSON=function(){return this.constructor.toObject(this,e.util.toJSONOptions)},s}(),s.ControlIHave=function(){function s(e){if(this.messageIDs=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}var o;return s.prototype.topicID=null,s.prototype.messageIDs=n.emptyArray,Object.defineProperty(s.prototype,"_topicID",{get:n.oneOfGetter(o=["topicID"]),set:n.oneOfSetter(o)}),s.encode=function(e,t){if(t||(t=r.create()),null!=e.topicID&&Object.hasOwnProperty.call(e,"topicID")&&t.uint32(10).string(e.topicID),null!=e.messageIDs&&e.messageIDs.length)for(var n=0;n<e.messageIDs.length;++n)t.uint32(18).bytes(e.messageIDs[n]);return t},s.decode=function(e,r){e instanceof t||(e=t.create(e));for(var n=void 0===r?e.len:e.pos+r,s=new i.RPC.ControlIHave;e.pos<n;){var o=e.uint32();switch(o>>>3){case 1:s.topicID=e.string();break;case 2:s.messageIDs&&s.messageIDs.length||(s.messageIDs=[]),s.messageIDs.push(e.bytes());break;default:e.skipType(7&o)}}return s},s.fromObject=function(e){if(e instanceof i.RPC.ControlIHave)return e;var t=new i.RPC.ControlIHave;if(null!=e.topicID&&(t.topicID=String(e.topicID)),e.messageIDs){if(!Array.isArray(e.messageIDs))throw TypeError(".RPC.ControlIHave.messageIDs: array expected");t.messageIDs=[];for(var r=0;r<e.messageIDs.length;++r)"string"===typeof e.messageIDs[r]?n.base64.decode(e.messageIDs[r],t.messageIDs[r]=n.newBuffer(n.base64.length(e.messageIDs[r])),0):e.messageIDs[r].length&&(t.messageIDs[r]=e.messageIDs[r])}return t},s.toObject=function(e,t){t||(t={});var r={};if((t.arrays||t.defaults)&&(r.messageIDs=[]),null!=e.topicID&&e.hasOwnProperty("topicID")&&(r.topicID=e.topicID,t.oneofs&&(r._topicID="topicID")),e.messageIDs&&e.messageIDs.length){r.messageIDs=[];for(var i=0;i<e.messageIDs.length;++i)r.messageIDs[i]=t.bytes===String?n.base64.encode(e.messageIDs[i],0,e.messageIDs[i].length):t.bytes===Array?Array.prototype.slice.call(e.messageIDs[i]):e.messageIDs[i]}return r},s.prototype.toJSON=function(){return this.constructor.toObject(this,e.util.toJSONOptions)},s}(),s.ControlIWant=function(){function s(e){if(this.messageIDs=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return s.prototype.messageIDs=n.emptyArray,s.encode=function(e,t){if(t||(t=r.create()),null!=e.messageIDs&&e.messageIDs.length)for(var n=0;n<e.messageIDs.length;++n)t.uint32(10).bytes(e.messageIDs[n]);return t},s.decode=function(e,r){e instanceof t||(e=t.create(e));for(var n=void 0===r?e.len:e.pos+r,s=new i.RPC.ControlIWant;e.pos<n;){var o=e.uint32();o>>>3===1?(s.messageIDs&&s.messageIDs.length||(s.messageIDs=[]),s.messageIDs.push(e.bytes())):e.skipType(7&o)}return s},s.fromObject=function(e){if(e instanceof i.RPC.ControlIWant)return e;var t=new i.RPC.ControlIWant;if(e.messageIDs){if(!Array.isArray(e.messageIDs))throw TypeError(".RPC.ControlIWant.messageIDs: array expected");t.messageIDs=[];for(var r=0;r<e.messageIDs.length;++r)"string"===typeof e.messageIDs[r]?n.base64.decode(e.messageIDs[r],t.messageIDs[r]=n.newBuffer(n.base64.length(e.messageIDs[r])),0):e.messageIDs[r].length&&(t.messageIDs[r]=e.messageIDs[r])}return t},s.toObject=function(e,t){t||(t={});var r={};if((t.arrays||t.defaults)&&(r.messageIDs=[]),e.messageIDs&&e.messageIDs.length){r.messageIDs=[];for(var i=0;i<e.messageIDs.length;++i)r.messageIDs[i]=t.bytes===String?n.base64.encode(e.messageIDs[i],0,e.messageIDs[i].length):t.bytes===Array?Array.prototype.slice.call(e.messageIDs[i]):e.messageIDs[i]}return r},s.prototype.toJSON=function(){return this.constructor.toObject(this,e.util.toJSONOptions)},s}(),s.ControlGraft=function(){function s(e){if(e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}var o;return s.prototype.topicID=null,Object.defineProperty(s.prototype,"_topicID",{get:n.oneOfGetter(o=["topicID"]),set:n.oneOfSetter(o)}),s.encode=function(e,t){return t||(t=r.create()),null!=e.topicID&&Object.hasOwnProperty.call(e,"topicID")&&t.uint32(10).string(e.topicID),t},s.decode=function(e,r){e instanceof t||(e=t.create(e));for(var n=void 0===r?e.len:e.pos+r,s=new i.RPC.ControlGraft;e.pos<n;){var o=e.uint32();o>>>3===1?s.topicID=e.string():e.skipType(7&o)}return s},s.fromObject=function(e){if(e instanceof i.RPC.ControlGraft)return e;var t=new i.RPC.ControlGraft;return null!=e.topicID&&(t.topicID=String(e.topicID)),t},s.toObject=function(e,t){t||(t={});var r={};return null!=e.topicID&&e.hasOwnProperty("topicID")&&(r.topicID=e.topicID,t.oneofs&&(r._topicID="topicID")),r},s.prototype.toJSON=function(){return this.constructor.toObject(this,e.util.toJSONOptions)},s}(),s.ControlPrune=function(){function s(e){if(this.peers=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}var o;return s.prototype.topicID=null,s.prototype.peers=n.emptyArray,s.prototype.backoff=null,Object.defineProperty(s.prototype,"_topicID",{get:n.oneOfGetter(o=["topicID"]),set:n.oneOfSetter(o)}),Object.defineProperty(s.prototype,"_backoff",{get:n.oneOfGetter(o=["backoff"]),set:n.oneOfSetter(o)}),s.encode=function(e,t){if(t||(t=r.create()),null!=e.topicID&&Object.hasOwnProperty.call(e,"topicID")&&t.uint32(10).string(e.topicID),null!=e.peers&&e.peers.length)for(var n=0;n<e.peers.length;++n)i.RPC.PeerInfo.encode(e.peers[n],t.uint32(18).fork()).ldelim();return null!=e.backoff&&Object.hasOwnProperty.call(e,"backoff")&&t.uint32(24).uint64(e.backoff),t},s.decode=function(e,r){e instanceof t||(e=t.create(e));for(var n=void 0===r?e.len:e.pos+r,s=new i.RPC.ControlPrune;e.pos<n;){var o=e.uint32();switch(o>>>3){case 1:s.topicID=e.string();break;case 2:s.peers&&s.peers.length||(s.peers=[]),s.peers.push(i.RPC.PeerInfo.decode(e,e.uint32()));break;case 3:s.backoff=e.uint64();break;default:e.skipType(7&o)}}return s},s.fromObject=function(e){if(e instanceof i.RPC.ControlPrune)return e;var t=new i.RPC.ControlPrune;if(null!=e.topicID&&(t.topicID=String(e.topicID)),e.peers){if(!Array.isArray(e.peers))throw TypeError(".RPC.ControlPrune.peers: array expected");t.peers=[];for(var r=0;r<e.peers.length;++r){if("object"!==typeof e.peers[r])throw TypeError(".RPC.ControlPrune.peers: object expected");t.peers[r]=i.RPC.PeerInfo.fromObject(e.peers[r])}}return null!=e.backoff&&(n.Long?(t.backoff=n.Long.fromValue(e.backoff)).unsigned=!0:"string"===typeof e.backoff?t.backoff=parseInt(e.backoff,10):"number"===typeof e.backoff?t.backoff=e.backoff:"object"===typeof e.backoff&&(t.backoff=new n.LongBits(e.backoff.low>>>0,e.backoff.high>>>0).toNumber(!0))),t},s.toObject=function(e,t){t||(t={});var r={};if((t.arrays||t.defaults)&&(r.peers=[]),null!=e.topicID&&e.hasOwnProperty("topicID")&&(r.topicID=e.topicID,t.oneofs&&(r._topicID="topicID")),e.peers&&e.peers.length){r.peers=[];for(var s=0;s<e.peers.length;++s)r.peers[s]=i.RPC.PeerInfo.toObject(e.peers[s],t)}return null!=e.backoff&&e.hasOwnProperty("backoff")&&("number"===typeof e.backoff?r.backoff=t.longs===String?String(e.backoff):e.backoff:r.backoff=t.longs===String?n.Long.prototype.toString.call(e.backoff):t.longs===Number?new n.LongBits(e.backoff.low>>>0,e.backoff.high>>>0).toNumber(!0):e.backoff,t.oneofs&&(r._backoff="backoff")),r},s.prototype.toJSON=function(){return this.constructor.toObject(this,e.util.toJSONOptions)},s}(),s.PeerInfo=function(){function s(e){if(e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}var o;return s.prototype.peerID=null,s.prototype.signedPeerRecord=null,Object.defineProperty(s.prototype,"_peerID",{get:n.oneOfGetter(o=["peerID"]),set:n.oneOfSetter(o)}),Object.defineProperty(s.prototype,"_signedPeerRecord",{get:n.oneOfGetter(o=["signedPeerRecord"]),set:n.oneOfSetter(o)}),s.encode=function(e,t){return t||(t=r.create()),null!=e.peerID&&Object.hasOwnProperty.call(e,"peerID")&&t.uint32(10).bytes(e.peerID),null!=e.signedPeerRecord&&Object.hasOwnProperty.call(e,"signedPeerRecord")&&t.uint32(18).bytes(e.signedPeerRecord),t},s.decode=function(e,r){e instanceof t||(e=t.create(e));for(var n=void 0===r?e.len:e.pos+r,s=new i.RPC.PeerInfo;e.pos<n;){var o=e.uint32();switch(o>>>3){case 1:s.peerID=e.bytes();break;case 2:s.signedPeerRecord=e.bytes();break;default:e.skipType(7&o)}}return s},s.fromObject=function(e){if(e instanceof i.RPC.PeerInfo)return e;var t=new i.RPC.PeerInfo;return null!=e.peerID&&("string"===typeof e.peerID?n.base64.decode(e.peerID,t.peerID=n.newBuffer(n.base64.length(e.peerID)),0):e.peerID.length&&(t.peerID=e.peerID)),null!=e.signedPeerRecord&&("string"===typeof e.signedPeerRecord?n.base64.decode(e.signedPeerRecord,t.signedPeerRecord=n.newBuffer(n.base64.length(e.signedPeerRecord)),0):e.signedPeerRecord.length&&(t.signedPeerRecord=e.signedPeerRecord)),t},s.toObject=function(e,t){t||(t={});var r={};return null!=e.peerID&&e.hasOwnProperty("peerID")&&(r.peerID=t.bytes===String?n.base64.encode(e.peerID,0,e.peerID.length):t.bytes===Array?Array.prototype.slice.call(e.peerID):e.peerID,t.oneofs&&(r._peerID="peerID")),null!=e.signedPeerRecord&&e.hasOwnProperty("signedPeerRecord")&&(r.signedPeerRecord=t.bytes===String?n.base64.encode(e.signedPeerRecord,0,e.signedPeerRecord.length):t.bytes===Array?Array.prototype.slice.call(e.signedPeerRecord):e.signedPeerRecord,t.oneofs&&(r._signedPeerRecord="signedPeerRecord")),r},s.prototype.toJSON=function(){return this.constructor.toObject(this,e.util.toJSONOptions)},s}(),s}(),i})?n.apply(t,i):n)||(e.exports=s)}},__webpack_module_cache__={};function __webpack_require__(e){var t=__webpack_module_cache__[e];if(void 0!==t)return t.exports;var r=__webpack_module_cache__[e]={exports:{}};return __webpack_modules__[e].call(r.exports,r,r.exports,__webpack_require__),r.exports}__webpack_require__.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return __webpack_require__.d(t,{a:t}),t},(()=>{var e,t=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__;__webpack_require__.t=function(r,n){if(1&n&&(r=this(r)),8&n)return r;if("object"===typeof r&&r){if(4&n&&r.__esModule)return r;if(16&n&&"function"===typeof r.then)return r}var i=Object.create(null);__webpack_require__.r(i);var s={};e=e||[null,t({}),t([]),t(t)];for(var o=2&n&&r;"object"==typeof o&&!~e.indexOf(o);o=t(o))Object.getOwnPropertyNames(o).forEach((e=>s[e]=()=>r[e]));return s.default=()=>r,__webpack_require__.d(i,s),i}})(),__webpack_require__.d=(e,t)=>{for(var r in t)__webpack_require__.o(t,r)&&!__webpack_require__.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},__webpack_require__.g=function(){if("object"===typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"===typeof window)return window}}(),__webpack_require__.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),__webpack_require__.r=e=>{"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var __webpack_exports__={};(()=>{"use strict";var e={};__webpack_require__.r(e),__webpack_require__.d(e,{identity:()=>ct});var t={};__webpack_require__.r(t),__webpack_require__.d(t,{base2:()=>lt});var r={};__webpack_require__.r(r),__webpack_require__.d(r,{base8:()=>ut});var n={};__webpack_require__.r(n),__webpack_require__.d(n,{base10:()=>ht});var i={};__webpack_require__.r(i),__webpack_require__.d(i,{base16:()=>dt,base16upper:()=>ft});var s={};__webpack_require__.r(s),__webpack_require__.d(s,{base32:()=>pt,base32hex:()=>vt,base32hexpad:()=>wt,base32hexpadupper:()=>Et,base32hexupper:()=>bt,base32pad:()=>gt,base32padupper:()=>mt,base32upper:()=>yt,base32z:()=>_t});var o={};__webpack_require__.r(o),__webpack_require__.d(o,{base36:()=>St,base36upper:()=>It});var a={};__webpack_require__.r(a),__webpack_require__.d(a,{base58btc:()=>Ct,base58flickr:()=>At});var c={};__webpack_require__.r(c),__webpack_require__.d(c,{base64:()=>Tt,base64pad:()=>kt,base64url:()=>Rt,base64urlpad:()=>Pt});var l={};__webpack_require__.r(l),__webpack_require__.d(l,{base256emoji:()=>Lt});var u={};__webpack_require__.r(u),__webpack_require__.d(u,{sha256:()=>nr,sha512:()=>ir});var h={};__webpack_require__.r(h),__webpack_require__.d(h,{identity:()=>or});var d={};__webpack_require__.r(d),__webpack_require__.d(d,{code:()=>cr,decode:()=>ur,encode:()=>lr,name:()=>ar});var f={};__webpack_require__.r(f),__webpack_require__.d(f,{code:()=>pr,decode:()=>gr,encode:()=>yr,name:()=>fr});var p={};__webpack_require__.r(p),__webpack_require__.d(p,{RsaPrivateKey:()=>$n,RsaPublicKey:()=>Yn,fromJwk:()=>Zn,generateKeyPair:()=>ei,unmarshalRsaPrivateKey:()=>Xn,unmarshalRsaPublicKey:()=>Jn});var y={};__webpack_require__.r(y),__webpack_require__.d(y,{Ed25519PrivateKey:()=>$i,Ed25519PublicKey:()=>Yi,generateKeyPair:()=>Zi,generateKeyPairFromSeed:()=>es,unmarshalEd25519PrivateKey:()=>Xi,unmarshalEd25519PublicKey:()=>Ji});var g={};__webpack_require__.r(g),__webpack_require__.d(g,{Secp256k1PrivateKey:()=>os,Secp256k1PublicKey:()=>ss,generateKeyPair:()=>ls,unmarshalSecp256k1PrivateKey:()=>as,unmarshalSecp256k1PublicKey:()=>cs});var m={};__webpack_require__.r(m),__webpack_require__.d(m,{identity:()=>Vs});var v={};__webpack_require__.r(v),__webpack_require__.d(v,{base2:()=>js});var b={};__webpack_require__.r(b),__webpack_require__.d(b,{base8:()=>Ks});var w={};__webpack_require__.r(w),__webpack_require__.d(w,{base10:()=>qs});var E={};__webpack_require__.r(E),__webpack_require__.d(E,{base16:()=>zs,base16upper:()=>Hs});var _={};__webpack_require__.r(_),__webpack_require__.d(_,{base32:()=>Ws,base32hex:()=>$s,base32hexpad:()=>Js,base32hexpadupper:()=>Zs,base32hexupper:()=>Xs,base32pad:()=>Qs,base32padupper:()=>Ys,base32upper:()=>Gs,base32z:()=>eo});var S={};__webpack_require__.r(S),__webpack_require__.d(S,{base36:()=>to,base36upper:()=>ro});var I={};__webpack_require__.r(I),__webpack_require__.d(I,{base58btc:()=>no,base58flickr:()=>io});var C={};__webpack_require__.r(C),__webpack_require__.d(C,{base64:()=>so,base64pad:()=>oo,base64url:()=>ao,base64urlpad:()=>co});var A={};__webpack_require__.r(A),__webpack_require__.d(A,{base256emoji:()=>fo});var T={};__webpack_require__.r(T),__webpack_require__.d(T,{sha256:()=>Bo,sha512:()=>Mo});var k={};__webpack_require__.r(k),__webpack_require__.d(k,{identity:()=>Fo});var R={};__webpack_require__.r(R),__webpack_require__.d(R,{code:()=>jo,decode:()=>qo,encode:()=>Ko,name:()=>Vo});var P={};__webpack_require__.r(P),__webpack_require__.d(P,{code:()=>Go,decode:()=>Yo,encode:()=>Qo,name:()=>Wo});var D=__webpack_require__(5146),N=__webpack_require__(2251),x=__webpack_require__(835),L=__webpack_require__.n(x);function O(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return null!=globalThis.Buffer&&null!=globalThis.Buffer.alloc?globalThis.Buffer.alloc(e):new Uint8Array(e)}function B(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return null!=globalThis.Buffer&&null!=globalThis.Buffer.allocUnsafe?globalThis.Buffer.allocUnsafe(e):new Uint8Array(e)}function M(e,t){t||(t=e.reduce(((e,t)=>e+t.length),0));const r=B(t);let n=0;for(const i of e)r.set(i,n),n+=i.length;return r}function U(e,t){if(e===t)return!0;if(e.byteLength!==t.byteLength)return!1;for(let r=0;r<e.byteLength;r++)if(e[r]!==t[r])return!1;return!0}const F=Symbol.for("@achingbrain/uint8arraylist");function V(e,t){if(null==t||t<0)throw new RangeError("index is out of bounds");let r=0;for(const n of e){const e=r+n.byteLength;if(t<e)return{buf:n,index:t-r};r=e}throw new RangeError("index is out of bounds")}function j(e){return Boolean(null===e||void 0===e?void 0:e[F])}class K{constructor(){Object.defineProperty(this,F,{value:!0}),this.bufs=[],this.length=0;for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];t.length>0&&this.appendAll(t)}*[Symbol.iterator](){yield*this.bufs}get byteLength(){return this.length}append(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];this.appendAll(t)}appendAll(e){let t=0;for(const r of e)if(r instanceof Uint8Array)t+=r.byteLength,this.bufs.push(r);else{if(!j(r))throw new Error("Could not append value, must be an Uint8Array or a Uint8ArrayList");t+=r.byteLength,this.bufs.push(...r.bufs)}this.length+=t}prepend(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];this.prependAll(t)}prependAll(e){let t=0;for(const r of e.reverse())if(r instanceof Uint8Array)t+=r.byteLength,this.bufs.unshift(r);else{if(!j(r))throw new Error("Could not prepend value, must be an Uint8Array or a Uint8ArrayList");t+=r.byteLength,this.bufs.unshift(...r.bufs)}this.length+=t}get(e){const t=V(this.bufs,e);return t.buf[t.index]}set(e,t){const r=V(this.bufs,e);r.buf[r.index]=t}write(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(e instanceof Uint8Array)for(let r=0;r<e.length;r++)this.set(t+r,e[r]);else{if(!j(e))throw new Error("Could not write value, must be an Uint8Array or a Uint8ArrayList");for(let r=0;r<e.length;r++)this.set(t+r,e.get(r))}}consume(e){if(e=Math.trunc(e),!(Number.isNaN(e)||e<=0))for(;this.bufs.length>0;){if(!(e>=this.bufs[0].byteLength)){this.bufs[0]=this.bufs[0].subarray(e),this.length-=e;break}e-=this.bufs[0].byteLength,this.length-=this.bufs[0].byteLength,this.bufs.shift()}}slice(e,t){const{bufs:r,length:n}=this._subList(e,t);return M(r,n)}subarray(e,t){const{bufs:r,length:n}=this._subList(e,t);return 1===r.length?r[0]:M(r,n)}sublist(e,t){const{bufs:r,length:n}=this._subList(e,t),i=new K;return i.length=n,i.bufs=r,i}_subList(e,t){var r,n;if(e=null!==(r=e)&&void 0!==r?r:0,t=null!==(n=t)&&void 0!==n?n:this.length,e<0&&(e=this.length+e),t<0&&(t=this.length+t),e<0||t>this.length)throw new RangeError("index is out of bounds");if(e===t)return{bufs:[],length:0};if(0===e&&t===this.length)return{bufs:[...this.bufs],length:this.length};const i=[];let s=0;for(let o=0;o<this.bufs.length;o++){const r=this.bufs[o],n=s,a=n+r.byteLength;if(s=a,e>=a)continue;const c=e>=n&&e<a,l=t>n&&t<=a;if(c&&l){if(e===n&&t===a){i.push(r);break}const s=e-n;i.push(r.subarray(s,s+(t-e)));break}if(c){if(0===e){i.push(r);continue}i.push(r.subarray(e-n))}else{if(l){if(t===a){i.push(r);break}i.push(r.subarray(0,t-n));break}i.push(r)}}return{bufs:i,length:t-e}}getInt8(e){const t=this.subarray(e,e+1);return new DataView(t.buffer,t.byteOffset,t.byteLength).getInt8(0)}setInt8(e,t){const r=B(1);new DataView(r.buffer,r.byteOffset,r.byteLength).setInt8(0,t),this.write(r,e)}getInt16(e,t){const r=this.subarray(e,e+2);return new DataView(r.buffer,r.byteOffset,r.byteLength).getInt16(0,t)}setInt16(e,t,r){const n=O(2);new DataView(n.buffer,n.byteOffset,n.byteLength).setInt16(0,t,r),this.write(n,e)}getInt32(e,t){const r=this.subarray(e,e+4);return new DataView(r.buffer,r.byteOffset,r.byteLength).getInt32(0,t)}setInt32(e,t,r){const n=O(4);new DataView(n.buffer,n.byteOffset,n.byteLength).setInt32(0,t,r),this.write(n,e)}getBigInt64(e,t){const r=this.subarray(e,e+8);return new DataView(r.buffer,r.byteOffset,r.byteLength).getBigInt64(0,t)}setBigInt64(e,t,r){const n=O(8);new DataView(n.buffer,n.byteOffset,n.byteLength).setBigInt64(0,t,r),this.write(n,e)}getUint8(e){const t=this.subarray(e,e+1);return new DataView(t.buffer,t.byteOffset,t.byteLength).getUint8(0)}setUint8(e,t){const r=B(1);new DataView(r.buffer,r.byteOffset,r.byteLength).setUint8(0,t),this.write(r,e)}getUint16(e,t){const r=this.subarray(e,e+2);return new DataView(r.buffer,r.byteOffset,r.byteLength).getUint16(0,t)}setUint16(e,t,r){const n=O(2);new DataView(n.buffer,n.byteOffset,n.byteLength).setUint16(0,t,r),this.write(n,e)}getUint32(e,t){const r=this.subarray(e,e+4);return new DataView(r.buffer,r.byteOffset,r.byteLength).getUint32(0,t)}setUint32(e,t,r){const n=O(4);new DataView(n.buffer,n.byteOffset,n.byteLength).setUint32(0,t,r),this.write(n,e)}getBigUint64(e,t){const r=this.subarray(e,e+8);return new DataView(r.buffer,r.byteOffset,r.byteLength).getBigUint64(0,t)}setBigUint64(e,t,r){const n=O(8);new DataView(n.buffer,n.byteOffset,n.byteLength).setBigUint64(0,t,r),this.write(n,e)}getFloat32(e,t){const r=this.subarray(e,e+4);return new DataView(r.buffer,r.byteOffset,r.byteLength).getFloat32(0,t)}setFloat32(e,t,r){const n=O(4);new DataView(n.buffer,n.byteOffset,n.byteLength).setFloat32(0,t,r),this.write(n,e)}getFloat64(e,t){const r=this.subarray(e,e+8);return new DataView(r.buffer,r.byteOffset,r.byteLength).getFloat64(0,t)}setFloat64(e,t,r){const n=O(8);new DataView(n.buffer,n.byteOffset,n.byteLength).setFloat64(0,t,r),this.write(n,e)}equals(e){if(null==e)return!1;if(!(e instanceof K))return!1;if(e.bufs.length!==this.bufs.length)return!1;for(let t=0;t<this.bufs.length;t++)if(!U(this.bufs[t],e.bufs[t]))return!1;return!0}static fromUint8Arrays(e,t){const r=new K;return r.bufs=e,null==t&&(t=e.reduce(((e,t)=>e+t.byteLength),0)),r.length=t,r}}class q{constructor(e){if(!(e>0)||0!==(e-1&e))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 void 0===this.buffer[this.top]&&(this.buffer[this.top]=e,this.top=this.top+1&this.mask,!0)}shift(){const e=this.buffer[this.btm];if(void 0!==e)return this.buffer[this.btm]=void 0,this.btm=this.btm+1&this.mask,e}isEmpty(){return void 0===this.buffer[this.btm]}}class z{constructor(){var e;let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.hwm=null!==(e=t.splitLimit)&&void 0!==e?e:16,this.head=new q(this.hwm),this.tail=this.head,this.size=0}calculateSize(e){return null!=(null===e||void 0===e?void 0:e.byteLength)?e.byteLength:1}push(e){if(null!=(null===e||void 0===e?void 0:e.value)&&(this.size+=this.calculateSize(e.value)),!this.head.push(e)){const t=this.head;this.head=t.next=new q(2*this.head.buffer.length),this.head.push(e)}}shift(){var e;let t=this.tail.shift();if(void 0===t&&null!=this.tail.next){const e=this.tail.next;this.tail.next=null,this.tail=e,t=this.tail.shift()}return null!=(null===(e=t)||void 0===e?void 0:e.value)&&(this.size-=this.calculateSize(t.value)),t}isEmpty(){return this.head.isEmpty()}}function H(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const t=e=>{const t=e.shift();if(null==t)return{done:!0};if(null!=t.error)throw t.error;return{done:!0===t.done,value:t.value}};return W(t,e)}function W(e,t){var r;let n,i,s,o=(t=null!==(r=t)&&void 0!==r?r:{}).onEnd,a=new z;const c=e=>null!=i?i(e):(a.push(e),n),l=e=>{var r;if(s)return n;if(!0!==(null===(r=t)||void 0===r?void 0:r.objectMode)&&null==(null===e||void 0===e?void 0:e.byteLength))throw new Error("objectMode was not true but tried to push non-Uint8Array value");return c({done:!1,value:e})},u=e=>s?n:(s=!0,null!=e?(e=>(a=new z,null!=i?i({error:e}):(a.push({error:e}),n)))(e):c({done:!0}));if(n={[Symbol.asyncIterator](){return this},next:async()=>a.isEmpty()?s?{done:!0}:await new Promise(((t,r)=>{i=s=>{i=null,a.push(s);try{t(e(a))}catch(o){r(o)}return n}})):e(a),return:()=>(a=new z,u(),{done:!0}),throw:e=>(u(e),{done:!0}),push:l,end:u,get readableLength(){return a.size}},null==o)return n;const h=n;return n={[Symbol.asyncIterator](){return this},next:()=>h.next(),throw:e=>(h.throw(e),null!=o&&(o(e),o=void 0),{done:!0}),return:()=>(h.return(),null!=o&&(o(),o=void 0),{done:!0}),push:l,end:e=>(h.end(e),null!=o&&(o(e),o=void 0),n),get readableLength(){return h.readableLength}},n}function G(){const e={};return e.promise=new Promise(((t,r)=>{e.resolve=t,e.reject=r})),e}function Q(e){const t=H(),r=function(e){const t=async function*(){let t=yield,r=new K;for await(const n of e)if(null!=t)for(r.append(n);r.length>=t;){const e=r.sublist(0,t);if(r.consume(t),t=yield e,null==t){r.length>0&&(t=yield r,r=new K);break}}else r.append(n),t=yield r,r=new K;if(null!=t)throw Object.assign(new Error("stream ended before ".concat(t," bytes became available")),{code:"ERR_UNDER_READ",buffer:r})}();return t.next(),t}(e.source),n=G();let i;const s=e.sink(async function*(){yield*t;const e=await n.promise;yield*e}());s.catch((e=>{i=e}));return{reader:r,writer:t,stream:{sink:async e=>null!=i?await Promise.reject(i):(n.resolve(e),await s),source:r},rest:()=>t.end(),write:t.push,read:async()=>{const e=await r.next();if(null!=e.value)return e.value}}}function Y(e){return e instanceof Uint8Array?{get:t=>e[t],set(t,r){e[t]=r}}:{get:t=>e.get(t),set(t,r){e.set(t,r)}}}const $=4294967296;class X{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;this.hi=e,this.lo=t}toBigInt(e){if(!0===e)return BigInt(this.lo>>>0)+(BigInt(this.hi>>>0)<<32n);if(this.hi>>>31!==0){const e=1+~this.lo>>>0;let t=~this.hi>>>0;return 0===e&&(t=t+1>>>0),-(BigInt(e)+(BigInt(t)<<32n))}return BigInt(this.lo>>>0)+(BigInt(this.hi>>>0)<<32n)}toNumber(e){return Number(this.toBigInt(e))}zzDecode(){const e=-(1&this.lo),t=((this.lo>>>1|this.hi<<31)^e)>>>0,r=(this.hi>>>1^e)>>>0;return new X(r,t)}zzEncode(){const e=this.hi>>31,t=((this.hi<<1|this.lo>>>31)^e)>>>0,r=(this.lo<<1^e)>>>0;return new X(t,r)}toBytes(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;const r=Y(e);for(;this.hi>0;)r.set(t++,127&this.lo|128),this.lo=(this.lo>>>7|this.hi<<25)>>>0,this.hi>>>=7;for(;this.lo>127;)r.set(t++,127&this.lo|128),this.lo=this.lo>>>7;r.set(t++,this.lo)}static fromBigInt(e){if(0n===e)return new X;const t=e<0;t&&(e=-e);let r=0|Number(e>>32n),n=0|Number(e-(BigInt(r)<<32n));return t&&(r=~r>>>0,n=~n>>>0,++n>$&&(n=0,++r>$&&(r=0))),new X(r,n)}static fromNumber(e){if(0===e)return new X;const t=e<0;t&&(e=-e);let r=e>>>0,n=(e-r)/4294967296>>>0;return t&&(n=~n>>>0,r=~r>>>0,++r>4294967295&&(r=0,++n>4294967295&&(n=0))),new X(n,r)}static fromBytes(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;const r=Y(e),n=new X;let i=0;if(e.length-t>4){for(;i<4;++i)if(n.lo=(n.lo|(127&r.get(t))<<7*i)>>>0,r.get(t++)<128)return n;if(n.lo=(n.lo|(127&r.get(t))<<28)>>>0,n.hi=(n.hi|(127&r.get(t))>>4)>>>0,r.get(t++)<128)return n;i=0}else for(;i<4;++i){if(t>=e.length)throw RangeError("index out of range: ".concat(t," > ").concat(e.length));if(n.lo=(n.lo|(127&r.get(t))<<7*i)>>>0,r.get(t++)<128)return n}if(e.length-t>4){for(;i<5;++i)if(n.hi=(n.hi|(127&r.get(t))<<7*i+3)>>>0,r.get(t++)<128)return n}else if(t<e.byteLength)for(;i<5;++i){if(t>=e.length)throw RangeError("index out of range: ".concat(t," > ").concat(e.length));if(n.hi=(n.hi|(127&r.get(t))<<7*i+3)>>>0,r.get(t++)<128)return n}throw RangeError("invalid varint encoding")}}const J=Math.pow(2,7),Z=Math.pow(2,14),ee=Math.pow(2,21),te=Math.pow(2,28),re=Math.pow(2,35),ne=Math.pow(2,42),ie=Math.pow(2,49),se=Math.pow(2,56),oe=Math.pow(2,63),ae={encodingLength:e=>e<J?1:e<Z?2:e<ee?3:e<te?4:e<re?5:e<ne?6:e<ie?7:e<se?8:e<oe?9:10,encode(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;if(null!=Number.MAX_SAFE_INTEGER&&e>Number.MAX_SAFE_INTEGER)throw new RangeError("Could not encode varint");return null==t&&(t=B(ae.encodingLength(e))),X.fromNumber(e).toBytes(t,r),t},decode(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return X.fromBytes(e,t).toNumber(!0)}};const ce=e=>{const t=ae.encodingLength(e),r=function(e){var t;return null!=(null===globalThis||void 0===globalThis||null===(t=globalThis.Buffer)||void 0===t?void 0:t.allocUnsafe)?globalThis.Buffer.allocUnsafe(e):new Uint8Array(e)}(t);return ae.encode(e,r),ce.bytes=t,r};function le(e){var t,r;const n=null!==(r=(e=null!==(t=e)&&void 0!==t?t:{}).lengthEncoder)&&void 0!==r?r:ce;return async function*(e){for await(const t of e){const e=n(t.byteLength);e instanceof Uint8Array?yield e:yield*e,t instanceof Uint8Array?yield t:yield*t}}}ce.bytes=0,le.single=(e,t)=>{var r,n;const i=null!==(n=(t=null!==(r=t)&&void 0!==r?r:{}).lengthEncoder)&&void 0!==n?n:ce;return new K(i(e.byteLength),e)};var ue=__webpack_require__(1362);var he;!function(e){e[e.LENGTH=0]="LENGTH",e[e.DATA=1]="DATA"}(he||(he={}));const de=e=>{const t=ae.decode(e);return de.bytes=ae.encodingLength(t),t};function fe(e){return async function*(t){var r,n,i;const s=new K;let o=he.LENGTH,a=-1;const c=null!==(r=null===e||void 0===e?void 0:e.lengthDecoder)&&void 0!==r?r:de,l=null!==(n=null===e||void 0===e?void 0:e.maxLengthLength)&&void 0!==n?n:8,u=null!==(i=null===e||void 0===e?void 0:e.maxDataLength)&&void 0!==i?i:4194304;for await(const d of t)for(s.append(d);s.byteLength>0;){if(o===he.LENGTH)try{if(a=c(s),a<0)throw ue(new Error("invalid message length"),"ERR_INVALID_MSG_LENGTH");if(a>u)throw ue(new Error("message length too long"),"ERR_MSG_DATA_TOO_LONG");const t=c.bytes;s.consume(t),null!=(null===e||void 0===e?void 0:e.onLength)&&e.onLength(a),o=he.DATA}catch(h){if(h instanceof RangeError){if(s.byteLength>l)throw ue(new Error("message length length too long"),"ERR_MSG_LENGTH_TOO_LONG");break}throw h}if(o===he.DATA){if(s.byteLength<a)break;const t=s.sublist(0,a);s.consume(a),null!=(null===e||void 0===e?void 0:e.onData)&&e.onData(t),yield t,o=he.LENGTH}}if(s.byteLength>0)throw ue(new Error("unexpected end of input"),"ERR_UNEXPECTED_EOF")}}function pe(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const r=Q(e),n=fe.fromReader(r.reader,t),i={read:async e=>{const{value:t}=await r.reader.next(e);if(null==t)throw new Error("Value is null");return t},readLP:async()=>{const{value:e}=await n.next();if(null==e)throw new Error("Value is null");return e},readPB:async e=>{const t=await i.readLP();if(null==t)throw new Error("Value is null");const r=t instanceof Uint8Array?t:t.slice();return e.decode(r)},write:e=>{e instanceof Uint8Array?r.writer.push(e):r.writer.push(e.slice())},writeLP:e=>{i.write(le.single(e,t))},writePB:(e,t)=>{i.writeLP(t.encode(e))},pb:e=>({read:async()=>await i.readPB(e),write:t=>i.writePB(t,e)}),unwrap:()=>(r.rest(),r.stream)};return i}function ye(){const e=G();let t=!1;return{sink:async r=>{if(t)throw new Error("already piped");t=!0,e.resolve(r)},source:async function*(){const t=await e.promise;yield*t}()}}de.bytes=0,fe.fromReader=(e,t)=>{let r=1;const n=async function*(){for(;;)try{const{done:t,value:n}=await e.next(r);if(!0===t)return;null!=n&&(yield n)}catch(t){if("ERR_UNDER_READ"===t.code)return{done:!0,value:null};throw t}finally{r=1}}();return fe({...null!==t&&void 0!==t?t:{},onLength:e=>{r=e}})(n)};var ge=__webpack_require__(5520);const me=function(){let e;for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];for(;r.length>0;)e=r.shift()(e);return e},ve=e=>null!=e&&("function"===typeof e[Symbol.asyncIterator]||"function"===typeof e[Symbol.iterator]||"function"===typeof e.next),be=e=>null!=e&&"function"===typeof e.sink&&ve(e.source),we=e=>t=>{const r=e.sink(t);if(null!=r.then){const t=H({objectMode:!0});r.then((()=>{t.end()}),(e=>{t.end(e)}));const n=async function*(){yield*e.source,t.end()};return ge(t,n())}return e.source};function Ee(e){if(be(e)){const t=e;e=()=>t.source}else if(ve(e)){const t=e;e=()=>t}for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];const i=[e,...r];if(i.length>1&&be(i[i.length-1])&&(i[i.length-1]=i[i.length-1].sink),i.length>2)for(let s=1;s<i.length-1;s++)be(i[s])&&(i[s]=we(i[s]));return me(...i)}var _e,Se;const Ie=65535,Ce=Boolean(null===(_e=globalThis.process)||void 0===_e||null===(Se=_e.env)||void 0===Se?void 0:Se.DUMP_SESSION_KEYS);var Ae=__webpack_require__(7397),Te=__webpack_require__(1063),ke=__webpack_require__(4791),Re=__webpack_require__(1277);const Pe={hashSHA256:e=>(0,ke.vp)(e),getHKDF(e,t){const r=new Ae.t(ke.mE,t,e).expand(96);return[r.subarray(0,32),r.subarray(32,64),r.subarray(64,96)]},generateX25519KeyPair(){const e=Te.Au();return{publicKey:e.publicKey,privateKey:e.secretKey}},generateX25519KeyPairFromSeed(e){const t=Te._w(e);return{publicKey:t.publicKey,privateKey:t.secretKey}},generateX25519SharedKey:(e,t)=>Te.gi(e,t),chaCha20Poly1305Encrypt:(e,t,r,n)=>new Re.OK(n).seal(t,e,r),chaCha20Poly1305Decrypt:(e,t,r,n)=>new Re.OK(n).open(t,e,r)};function De(e){return null!=globalThis.Buffer?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):e}function Ne(){var e;let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return null!=(null===(e=globalThis.Buffer)||void 0===e?void 0:e.allocUnsafe)?De(globalThis.Buffer.allocUnsafe(t)):new Uint8Array(t)}function xe(e,t){null==t&&(t=e.reduce(((e,t)=>e+t.length),0));const r=Ne(t);let n=0;for(const i of e)r.set(i,n),n+=i.length;return De(r)}const Le=e=>{const t=(r=2,globalThis.Buffer?globalThis.Buffer.allocUnsafe(r):new Uint8Array(r));var r;return new DataView(t.buffer,t.byteOffset,t.byteLength).setUint16(0,e,!1),t};Le.bytes=2;const Oe=e=>{if(e.length<2)throw RangeError("Could not decode int16BE");return e instanceof Uint8Array?new DataView(e.buffer,e.byteOffset,e.byteLength).getUint16(0,!1):e.getUint16(0)};Oe.bytes=2;class Be extends Error{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"Unexpected Peer"),this.code=Be.code}static get code(){return"ERR_UNEXPECTED_PEER"}}class Me extends Error{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"Invalid crypto exchange"),this.code=Me.code}static get code(){return"ERR_INVALID_CRYPTO_EXCHANGE"}}Error;const Ue=x.Reader;function Fe(e,t){const r=Ue.create(e instanceof Uint8Array?e:e.subarray());return t.decode(r)}["uint64","int64","sint64","fixed64","sfixed64"].forEach((e=>{const t=Ue.prototype[e];Ue.prototype[e]=function(){return BigInt(t.call(this).toString())}}));const Ve=x.Writer;function je(e,t){const r=Ve.create();return t.encode(e,r,{lengthDelimited:!1}),r.finish()}var Ke,qe,ze,He,We;function Ge(e,t,r,n){return{name:e,type:t,encode:r,decode:n}}function Qe(e){function t(t){if(null==e[t.toString()])throw new Error("Invalid enum value");return e[t]}return Ge("enum",Ke.VARINT,(function(e,r){const n=t(e);r.int32(n)}),(function(e){return t(e.uint32())}))}function Ye(e,t){return Ge("message",Ke.LENGTH_DELIMITED,e,t)}["uint64","int64","sint64","fixed64","sfixed64"].forEach((e=>{const t=Ve.prototype[e];Ve.prototype[e]=function(e){return t.call(this,e.toString())}})),function(e){e[e.VARINT=0]="VARINT",e[e.BIT64=1]="BIT64",e[e.LENGTH_DELIMITED=2]="LENGTH_DELIMITED",e[e.START_GROUP=3]="START_GROUP",e[e.END_GROUP=4]="END_GROUP",e[e.BIT32=5]="BIT32"}(Ke||(Ke={})),function(e){e.RSA="RSA",e.Ed25519="Ed25519",e.Secp256k1="Secp256k1"}(qe||(qe={})),function(e){e[e.RSA=0]="RSA",e[e.Ed25519=1]="Ed25519",e[e.Secp256k1=2]="Secp256k1"}(ze||(ze={})),function(e){e.codec=()=>Qe(ze)}(qe||(qe={})),function(e){let t;e.codec=()=>(null==t&&(t=Ye((function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!1!==r.lengthDelimited&&t.fork(),null==e.Type)throw new Error('Protocol error: required field "Type" was not found in object');if(t.uint32(8),qe.codec().encode(e.Type,t),null==e.Data)throw new Error('Protocol error: required field "Data" was not found in object');t.uint32(18),t.bytes(e.Data),!1!==r.lengthDelimited&&t.ldelim()}),((e,t)=>{const r={Type:qe.RSA,Data:new Uint8Array(0)},n=null==t?e.len:e.pos+t;for(;e.pos<n;){const t=e.uint32();switch(t>>>3){case 1:r.Type=qe.codec().decode(e);break;case 2:r.Data=e.bytes();break;default:e.skipType(7&t)}}if(null==r.Type)throw new Error('Protocol error: value for required field "Type" was not found in protobuf');if(null==r.Data)throw new Error('Protocol error: value for required field "Data" was not found in protobuf');return r}))),t),e.encode=t=>je(t,e.codec()),e.decode=t=>Fe(t,e.codec())}(He||(He={})),function(e){let t;e.codec=()=>(null==t&&(t=Ye((function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!1!==r.lengthDelimited&&t.fork(),null==e.Type)throw new Error('Protocol error: required field "Type" was not found in object');if(t.uint32(8),qe.codec().encode(e.Type,t),null==e.Data)throw new Error('Protocol error: required field "Data" was not found in object');t.uint32(18),t.bytes(e.Data),!1!==r.lengthDelimited&&t.ldelim()}),((e,t)=>{const r={Type:qe.RSA,Data:new Uint8Array(0)},n=null==t?e.len:e.pos+t;for(;e.pos<n;){const t=e.uint32();switch(t>>>3){case 1:r.Type=qe.codec().decode(e);break;case 2:r.Data=e.bytes();break;default:e.skipType(7&t)}}if(null==r.Type)throw new Error('Protocol error: value for required field "Type" was not found in protobuf');if(null==r.Data)throw new Error('Protocol error: value for required field "Data" was not found in protobuf');return r}))),t),e.encode=t=>je(t,e.codec()),e.decode=t=>Fe(t,e.codec())}(We||(We={}));__webpack_require__(8791),__webpack_require__(5040);var $e=__webpack_require__(6547);var Xe=function(e,t){if(e.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n<r.length;n++)r[n]=255;for(var i=0;i<e.length;i++){var s=e.charAt(i),o=s.charCodeAt(0);if(255!==r[o])throw new TypeError(s+" is ambiguous");r[o]=i}var a=e.length,c=e.charAt(0),l=Math.log(a)/Math.log(256),u=Math.log(256)/Math.log(a);function h(e){if("string"!==typeof e)throw new TypeError("Expected String");if(0===e.length)return new Uint8Array;var t=0;if(" "!==e[t]){for(var n=0,i=0;e[t]===c;)n++,t++;for(var s=(e.length-t)*l+1>>>0,o=new Uint8Array(s);e[t];){var u=r[e.charCodeAt(t)];if(255===u)return;for(var h=0,d=s-1;(0!==u||h<i)&&-1!==d;d--,h++)u+=a*o[d]>>>0,o[d]=u%256>>>0,u=u/256>>>0;if(0!==u)throw new Error("Non-zero carry");i=h,t++}if(" "!==e[t]){for(var f=s-i;f!==s&&0===o[f];)f++;for(var p=new Uint8Array(n+(s-f)),y=n;f!==s;)p[y++]=o[f++];return p}}}return{encode:function(t){if(t instanceof Uint8Array||(ArrayBuffer.isView(t)?t=new Uint8Array(t.buffer,t.byteOffset,t.byteLength):Array.isArray(t)&&(t=Uint8Array.from(t))),!(t instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(0===t.length)return"";for(var r=0,n=0,i=0,s=t.length;i!==s&&0===t[i];)i++,r++;for(var o=(s-i)*u+1>>>0,l=new Uint8Array(o);i!==s;){for(var h=t[i],d=0,f=o-1;(0!==h||d<n)&&-1!==f;f--,d++)h+=256*l[f]>>>0,l[f]=h%a>>>0,h=h/a>>>0;if(0!==h)throw new Error("Non-zero carry");n=d,i++}for(var p=o-n;p!==o&&0===l[p];)p++;for(var y=c.repeat(r);p<o;++p)y+=e.charAt(l[p]);return y},decodeUnsafe:h,decode:function(e){var r=h(e);if(r)return r;throw new Error("Non-".concat(t," character"))}}};const Je=Xe,Ze=(new Uint8Array(0),e=>{if(e instanceof Uint8Array&&"Uint8Array"===e.constructor.name)return e;if(e instanceof ArrayBuffer)return new Uint8Array(e);if(ArrayBuffer.isView(e))return new Uint8Array(e.buffer,e.byteOffset,e.byteLength);throw new Error("Unknown type, must be binary type")});class et{constructor(e,t,r){this.name=e,this.prefix=t,this.baseEncode=r}encode(e){if(e instanceof Uint8Array)return"".concat(this.prefix).concat(this.baseEncode(e));throw Error("Unknown type, must be binary type")}}class tt{constructor(e,t,r){if(this.name=e,this.prefix=t,void 0===t.codePointAt(0))throw new Error("Invalid prefix character");this.prefixCodePoint=t.codePointAt(0),this.baseDecode=r}decode(e){if("string"===typeof e){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error("Unable to decode multibase string ".concat(JSON.stringify(e),", ").concat(this.name," decoder only supports inputs prefixed with ").concat(this.prefix));return this.baseDecode(e.slice(this.prefix.length))}throw Error("Can only multibase decode strings")}or(e){return nt(this,e)}}class rt{constructor(e){this.decoders=e}or(e){return nt(this,e)}decode(e){const t=e[0],r=this.decoders[t];if(r)return r.decode(e);throw RangeError("Unable to decode multibase string ".concat(JSON.stringify(e),", only inputs prefixed with ").concat(Object.keys(this.decoders)," are supported"))}}const nt=(e,t)=>new rt({...e.decoders||{[e.prefix]:e},...t.decoders||{[t.prefix]:t}});class it{constructor(e,t,r,n){this.name=e,this.prefix=t,this.baseEncode=r,this.baseDecode=n,this.encoder=new et(e,t,r),this.decoder=new tt(e,t,n)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}const st=e=>{let{name:t,prefix:r,encode:n,decode:i}=e;return new it(t,r,n,i)},ot=e=>{let{prefix:t,name:r,alphabet:n}=e;const{encode:i,decode:s}=Je(n,r);return st({prefix:t,name:r,encode:i,decode:e=>Ze(s(e))})},at=e=>{let{name:t,prefix:r,bitsPerChar:n,alphabet:i}=e;return st({prefix:r,name:t,encode:e=>((e,t,r)=>{const n="="===t[t.length-1],i=(1<<r)-1;let s="",o=0,a=0;for(let c=0;c<e.length;++c)for(a=a<<8|e[c],o+=8;o>r;)o-=r,s+=t[i&a>>o];if(o&&(s+=t[i&a<<r-o]),n)for(;s.length*r&7;)s+="=";return s})(e,i,n),decode:e=>((e,t,r,n)=>{const i={};for(let u=0;u<t.length;++u)i[t[u]]=u;let s=e.length;for(;"="===e[s-1];)--s;const o=new Uint8Array(s*r/8|0);let a=0,c=0,l=0;for(let u=0;u<s;++u){const t=i[e[u]];if(void 0===t)throw new SyntaxError("Non-".concat(n," character"));c=c<<r|t,a+=r,a>=8&&(a-=8,o[l++]=255&c>>a)}if(a>=r||255&c<<8-a)throw new SyntaxError("Unexpected end of data");return o})(e,i,n,t)})},ct=st({prefix:"\0",name:"identity",encode:e=>{return t=e,(new TextDecoder).decode(t);var t},decode:e=>(e=>(new TextEncoder).encode(e))(e)}),lt=at({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1}),ut=at({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3}),ht=ot({prefix:"9",name:"base10",alphabet:"0123456789"}),dt=at({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),ft=at({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4}),pt=at({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),yt=at({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),gt=at({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),mt=at({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),vt=at({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),bt=at({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),wt=at({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),Et=at({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),_t=at({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),St=ot({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),It=ot({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),Ct=ot({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),At=ot({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),Tt=at({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),kt=at({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),Rt=at({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),Pt=at({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6}),Dt=Array.from("\ud83d\ude80\ud83e\ude90\u2604\ud83d\udef0\ud83c\udf0c\ud83c\udf11\ud83c\udf12\ud83c\udf13\ud83c\udf14\ud83c\udf15\ud83c\udf16\ud83c\udf17\ud83c\udf18\ud83c\udf0d\ud83c\udf0f\ud83c\udf0e\ud83d\udc09\u2600\ud83d\udcbb\ud83d\udda5\ud83d\udcbe\ud83d\udcbf\ud83d\ude02\u2764\ud83d\ude0d\ud83e\udd23\ud83d\ude0a\ud83d\ude4f\ud83d\udc95\ud83d\ude2d\ud83d\ude18\ud83d\udc4d\ud83d\ude05\ud83d\udc4f\ud83d\ude01\ud83d\udd25\ud83e\udd70\ud83d\udc94\ud83d\udc96\ud83d\udc99\ud83d\ude22\ud83e\udd14\ud83d\ude06\ud83d\ude44\ud83d\udcaa\ud83d\ude09\u263a\ud83d\udc4c\ud83e\udd17\ud83d\udc9c\ud83d\ude14\ud83d\ude0e\ud83d\ude07\ud83c\udf39\ud83e\udd26\ud83c\udf89\ud83d\udc9e\u270c\u2728\ud83e\udd37\ud83d\ude31\ud83d\ude0c\ud83c\udf38\ud83d\ude4c\ud83d\ude0b\ud83d\udc97\ud83d\udc9a\ud83d\ude0f\ud83d\udc9b\ud83d\ude42\ud83d\udc93\ud83e\udd29\ud83d\ude04\ud83d\ude00\ud83d\udda4\ud83d\ude03\ud83d\udcaf\ud83d\ude48\ud83d\udc47\ud83c\udfb6\ud83d\ude12\ud83e\udd2d\u2763\ud83d\ude1c\ud83d\udc8b\ud83d\udc40\ud83d\ude2a\ud83d\ude11\ud83d\udca5\ud83d\ude4b\ud83d\ude1e\ud83d\ude29\ud83d\ude21\ud83e\udd2a\ud83d\udc4a\ud83e\udd73\ud83d\ude25\ud83e\udd24\ud83d\udc49\ud83d\udc83\ud83d\ude33\u270b\ud83d\ude1a\ud83d\ude1d\ud83d\ude34\ud83c\udf1f\ud83d\ude2c\ud83d\ude43\ud83c\udf40\ud83c\udf37\ud83d\ude3b\ud83d\ude13\u2b50\u2705\ud83e\udd7a\ud83c\udf08\ud83d\ude08\ud83e\udd18\ud83d\udca6\u2714\ud83d\ude23\ud83c\udfc3\ud83d\udc90\u2639\ud83c\udf8a\ud83d\udc98\ud83d\ude20\u261d\ud83d\ude15\ud83c\udf3a\ud83c\udf82\ud83c\udf3b\ud83d\ude10\ud83d\udd95\ud83d\udc9d\ud83d\ude4a\ud83d\ude39\ud83d\udde3\ud83d\udcab\ud83d\udc80\ud83d\udc51\ud83c\udfb5\ud83e\udd1e\ud83d\ude1b\ud83d\udd34\ud83d\ude24\ud83c\udf3c\ud83d\ude2b\u26bd\ud83e\udd19\u2615\ud83c\udfc6\ud83e\udd2b\ud83d\udc48\ud83d\ude2e\ud83d\ude46\ud83c\udf7b\ud83c\udf43\ud83d\udc36\ud83d\udc81\ud83d\ude32\ud83c\udf3f\ud83e\udde1\ud83c\udf81\u26a1\ud83c\udf1e\ud83c\udf88\u274c\u270a\ud83d\udc4b\ud83d\ude30\ud83e\udd28\ud83d\ude36\ud83e\udd1d\ud83d\udeb6\ud83d\udcb0\ud83c\udf53\ud83d\udca2\ud83e\udd1f\ud83d\ude41\ud83d\udea8\ud83d\udca8\ud83e\udd2c\u2708\ud83c\udf80\ud83c\udf7a\ud83e\udd13\ud83d\ude19\ud83d\udc9f\ud83c\udf31\ud83d\ude16\ud83d\udc76\ud83e\udd74\u25b6\u27a1\u2753\ud83d\udc8e\ud83d\udcb8\u2b07\ud83d\ude28\ud83c\udf1a\ud83e\udd8b\ud83d\ude37\ud83d\udd7a\u26a0\ud83d\ude45\ud83d\ude1f\ud83d\ude35\ud83d\udc4e\ud83e\udd32\ud83e\udd20\ud83e\udd27\ud83d\udccc\ud83d\udd35\ud83d\udc85\ud83e\uddd0\ud83d\udc3e\ud83c\udf52\ud83d\ude17\ud83e\udd11\ud83c\udf0a\ud83e\udd2f\ud83d\udc37\u260e\ud83d\udca7\ud83d\ude2f\ud83d\udc86\ud83d\udc46\ud83c\udfa4\ud83d\ude47\ud83c\udf51\u2744\ud83c\udf34\ud83d\udca3\ud83d\udc38\ud83d\udc8c\ud83d\udccd\ud83e\udd40\ud83e\udd22\ud83d\udc45\ud83d\udca1\ud83d\udca9\ud83d\udc50\ud83d\udcf8\ud83d\udc7b\ud83e\udd10\ud83e\udd2e\ud83c\udfbc\ud83e\udd75\ud83d\udea9\ud83c\udf4e\ud83c\udf4a\ud83d\udc7c\ud83d\udc8d\ud83d\udce3\ud83e\udd42"),Nt=Dt.reduce(((e,t,r)=>(e[r]=t,e)),[]),xt=Dt.reduce(((e,t,r)=>(e[t.codePointAt(0)]=r,e)),[]);const Lt=st({prefix:"\ud83d\ude80",name:"base256emoji",encode:function(e){return e.reduce(((e,t)=>e+=Nt[t]),"")},decode:function(e){const t=[];for(const r of e){const e=xt[r.codePointAt(0)];if(void 0===e)throw new Error("Non-base256emoji character: ".concat(r));t.push(e)}return new Uint8Array(t)}});var Ot=function e(t,r,n){r=r||[];var i=n=n||0;for(;t>=Bt;)r[n++]=255&t|128,t/=128;for(;-128&t;)r[n++]=255&t|128,t>>>=7;return r[n]=0|t,e.bytes=n-i+1,r},Bt=Math.pow(2,31);var Mt=function e(t,r){var n,i=0,s=0,o=r=r||0,a=t.length;do{if(o>=a)throw e.bytes=0,new RangeError("Could not decode varint");n=t[o++],i+=s<28?(127&n)<<s:(127&n)*Math.pow(2,s),s+=7}while(n>=128);return e.bytes=o-r,i};var Ut=Math.pow(2,7),Ft=Math.pow(2,14),Vt=Math.pow(2,21),jt=Math.pow(2,28),Kt=Math.pow(2,35),qt=Math.pow(2,42),zt=Math.pow(2,49),Ht=Math.pow(2,56),Wt=Math.pow(2,63);const Gt={encode:Ot,decode:Mt,encodingLength:function(e){return e<Ut?1:e<Ft?2:e<Vt?3:e<jt?4:e<Kt?5:e<qt?6:e<zt?7:e<Ht?8:e<Wt?9:10}},Qt=e=>[Gt.decode(e),Gt.decode.bytes],Yt=function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return Gt.encode(e,t,r),t},$t=e=>Gt.encodingLength(e),Xt=(e,t)=>{const r=t.byteLength,n=$t(e),i=n+$t(r),s=new Uint8Array(i+r);return Yt(e,s,0),Yt(r,s,n),s.set(t,i),new Zt(e,r,t,s)},Jt=e=>{const t=Ze(e),[r,n]=Qt(t),[i,s]=Qt(t.subarray(n)),o=t.subarray(n+s);if(o.byteLength!==i)throw new Error("Incorrect length");return new Zt(r,i,o,t)};class Zt{constructor(e,t,r,n){this.code=e,this.size=t,this.digest=r,this.bytes=n}}const er=e=>{let{name:t,code:r,encode:n}=e;return new tr(t,r,n)};class tr{constructor(e,t,r){this.name=e,this.code=t,this.encode=r}digest(e){if(e instanceof Uint8Array){const t=this.encode(e);return t instanceof Uint8Array?Xt(this.code,t):t.then((e=>Xt(this.code,e)))}throw Error("Unknown type, must be binary type")}}const rr=e=>async t=>new Uint8Array(await crypto.subtle.digest(e,t)),nr=er({name:"sha2-256",code:18,encode:rr("SHA-256")}),ir=er({name:"sha2-512",code:19,encode:rr("SHA-512")}),sr=Ze,or={code:0,name:"identity",encode:sr,digest:e=>Xt(0,sr(e))},ar="raw",cr=85,lr=e=>Ze(e),ur=e=>Ze(e),hr=new TextEncoder,dr=new TextDecoder,fr="json",pr=512,yr=e=>hr.encode(JSON.stringify(e)),gr=e=>JSON.parse(dr.decode(e));class mr{constructor(e,t,r,n){this.code=t,this.version=e,this.multihash=r,this.bytes=n,this.byteOffset=n.byteOffset,this.byteLength=n.byteLength,this.asCID=this,this._baseCache=new Map,Object.defineProperties(this,{byteOffset:Ar,byteLength:Ar,code:Cr,version:Cr,multihash:Cr,bytes:Cr,_baseCache:Ar,asCID:Ar})}toV0(){if(0===this.version)return this;{const{code:e,multihash:t}=this;if(e!==Er)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(t.code!==_r)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return mr.createV0(t)}}toV1(){switch(this.version){case 0:{const{code:e,digest:t}=this.multihash,r=Xt(e,t);return mr.createV1(this.code,r)}case 1:return this;default:throw Error("Can not convert CID version ".concat(this.version," to version 0. This is a bug please report"))}}equals(e){return e&&this.code===e.code&&this.version===e.version&&(t=this.multihash,r=e.multihash,t===r||t.code===r.code&&t.size===r.size&&((e,t)=>{if(e===t)return!0;if(e.byteLength!==t.byteLength)return!1;for(let r=0;r<e.byteLength;r++)if(e[r]!==t[r])return!1;return!0})(t.bytes,r.bytes));var t,r}toString(e){const{bytes:t,version:r,_baseCache:n}=this;return 0===r?br(t,n,e||Ct.encoder):wr(t,n,e||pt.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 Tr(/^0\.0/,kr),!(!e||!e[Ir]&&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 mr)return e;if(null!=e&&e.asCID===e){const{version:t,code:r,multihash:n,bytes:i}=e;return new mr(t,r,n,i||Sr(t,r,n.bytes))}if(null!=e&&!0===e[Ir]){const{version:t,multihash:r,code:n}=e,i=Jt(r);return mr.create(t,n,i)}return null}static create(e,t,r){if("number"!==typeof t)throw new Error("String codecs are no longer supported");switch(e){case 0:if(t!==Er)throw new Error("Version 0 CID must use dag-pb (code: ".concat(Er,") block encoding"));return new mr(e,t,r,r.bytes);case 1:{const n=Sr(e,t,r.bytes);return new mr(e,t,r,n)}default:throw new Error("Invalid version")}}static createV0(e){return mr.create(0,Er,e)}static createV1(e,t){return mr.create(1,e,t)}static decode(e){const[t,r]=mr.decodeFirst(e);if(r.length)throw new Error("Incorrect length");return t}static decodeFirst(e){const t=mr.inspectBytes(e),r=t.size-t.multihashSize,n=Ze(e.subarray(r,r+t.multihashSize));if(n.byteLength!==t.multihashSize)throw new Error("Incorrect length");const i=n.subarray(t.multihashSize-t.digestSize),s=new Zt(t.multihashCode,t.digestSize,i,n);return[0===t.version?mr.createV0(s):mr.createV1(t.codec,s),e.subarray(t.size)]}static inspectBytes(e){let t=0;const r=()=>{const[r,n]=Qt(e.subarray(t));return t+=n,r};let n=r(),i=Er;if(18===n?(n=0,t=0):1===n&&(i=r()),0!==n&&1!==n)throw new RangeError("Invalid CID version ".concat(n));const s=t,o=r(),a=r(),c=t+a;return{version:n,codec:i,multihashCode:o,digestSize:a,multihashSize:c-s,size:c}}static parse(e,t){const[r,n]=vr(e,t),i=mr.decode(n);return i._baseCache.set(r,e),i}}const vr=(e,t)=>{switch(e[0]){case"Q":{const r=t||Ct;return[Ct.prefix,r.decode("".concat(Ct.prefix).concat(e))]}case Ct.prefix:{const r=t||Ct;return[Ct.prefix,r.decode(e)]}case pt.prefix:{const r=t||pt;return[pt.prefix,r.decode(e)]}default:if(null==t)throw Error("To parse non base32 or base58btc encoded CID multibase decoder must be provided");return[e[0],t.decode(e)]}},br=(e,t,r)=>{const{prefix:n}=r;if(n!==Ct.prefix)throw Error("Cannot string encode V0 in ".concat(r.name," encoding"));const i=t.get(n);if(null==i){const i=r.encode(e).slice(1);return t.set(n,i),i}return i},wr=(e,t,r)=>{const{prefix:n}=r,i=t.get(n);if(null==i){const i=r.encode(e);return t.set(n,i),i}return i},Er=112,_r=18,Sr=(e,t,r)=>{const n=$t(e),i=n+$t(t),s=new Uint8Array(i+r.byteLength);return Yt(e,s,0),Yt(t,s,n),s.set(r,i),s},Ir=Symbol.for("@ipld/js-cid/CID"),Cr={writable:!1,configurable:!1,enumerable:!0},Ar={writable:!1,enumerable:!1,configurable:!1},Tr=(e,t)=>{if(!e.test("0.0.0-dev"))throw new Error(t);console.warn(t)},kr="CID.isCID(v) is deprecated and will be removed in the next major release.\nFollowing code pattern:\n\nif (CID.isCID(value)) {\n doSomethingWithCID(value)\n}\n\nIs replaced with:\n\nconst cid = CID.asCID(value)\nif (cid) {\n // Make sure to use cid instead of value\n doSomethingWithCID(cid)\n}\n",Rr={...e,...t,...r,...n,...i,...s,...o,...a,...c,...l};function Pr(e,t,r,n){return{name:e,prefix:t,encoder:{name:e,prefix:t,encode:r},decoder:{decode:n}}}const Dr=Pr("utf8","u",(e=>"u"+new TextDecoder("utf8").decode(e)),(e=>(new TextEncoder).encode(e.substring(1)))),Nr=Pr("ascii","a",(e=>{let t="a";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return t}),(e=>{const t=B((e=e.substring(1)).length);for(let r=0;r<e.length;r++)t[r]=e.charCodeAt(r);return t})),xr={utf8:Dr,"utf-8":Dr,hex:Rr.base16,latin1:Nr,ascii:Nr,binary:Nr,...Rr};function Lr(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"utf8";const r=xr[t];if(!r)throw new Error('Unsupported encoding "'.concat(t,'"'));return"utf8"!==t&&"utf-8"!==t||null==globalThis.Buffer||null==globalThis.Buffer.from?r.decoder.decode("".concat(r.prefix).concat(e)):globalThis.Buffer.from(e,"utf8")}const Or={get(){const e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:globalThis).crypto;if(null==e||null==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 Br=__webpack_require__(5061);__webpack_require__(9259);function Mr(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"utf8";const r=xr[t];if(!r)throw new Error('Unsupported encoding "'.concat(t,'"'));return"utf8"!==t&&"utf-8"!==t||null==globalThis.Buffer||null==globalThis.Buffer.from?r.encoder.encode(e).substring(1):globalThis.Buffer.from(e.buffer,e.byteOffset,e.byteLength).toString("utf8")}function Ur(e,t){let r=Uint8Array.from(e.abs().toByteArray());if(r=0===r[0]?r.slice(1):r,null!=t){if(r.length>t)throw new Error("byte array longer than desired length");r=M([new Uint8Array(t-r.length),r])}return Mr(r,"base64url")}function Fr(e){const t=function(e,t){let r=Lr(e,"base64urlpad");if(null!=t){if(r.length>t)throw new Error("byte array longer than desired length");r=M([new Uint8Array(t-r.length),r])}return r}(e);return new $e.jsbn.BigInteger(Mr(t,"base16"),16)}const Vr={"P-256":256,"P-384":384,"P-521":521};Object.keys(Vr).join(" / ");function jr(e){var t,r,n,i,s,o;const a=null!==(t=null===e||void 0===e?void 0:e.algorithm)&&void 0!==t?t:"AES-GCM";let c=null!==(r=null===e||void 0===e?void 0:e.keyLength)&&void 0!==r?r:16;const l=null!==(n=null===e||void 0===e?void 0:e.nonceLength)&&void 0!==n?n:12,u=null!==(i=null===e||void 0===e?void 0:e.digest)&&void 0!==i?i:"SHA-256",h=null!==(s=null===e||void 0===e?void 0:e.saltLength)&&void 0!==s?s:16,d=null!==(o=null===e||void 0===e?void 0:e.iterations)&&void 0!==o?o:32767,f=Or.get();c*=8;return{encrypt:async function(e,t){const r=f.getRandomValues(new Uint8Array(h)),n=f.getRandomValues(new Uint8Array(l)),i={name:a,iv:n};"string"===typeof t&&(t=Lr(t));const s={name:"PBKDF2",salt:r,iterations:d,hash:{name:u}},o=await f.subtle.importKey("raw",t,{name:"PBKDF2"},!1,["deriveKey","deriveBits"]),p=await f.subtle.deriveKey(s,o,{name:a,length:c},!0,["encrypt"]),y=await f.subtle.encrypt(i,p,e);return M([r,i.iv,new Uint8Array(y)])},decrypt:async function(e,t){const r=e.slice(0,h),n=e.slice(h,h+l),i=e.slice(h+l),s={name:a,iv:n};"string"===typeof t&&(t=Lr(t));const o={name:"PBKDF2",salt:r,iterations:d,hash:{name:u}},p=await f.subtle.importKey("raw",t,{name:"PBKDF2"},!1,["deriveKey","deriveBits"]),y=await f.subtle.deriveKey(o,p,{name:a,length:c},!0,["decrypt"]),g=await f.subtle.decrypt(s,y,i);return new Uint8Array(g)}}}__webpack_require__(8667);var Kr=__webpack_require__(7815),qr=__webpack_require__.t(Kr,2);const zr=BigInt(0),Hr=BigInt(1),Wr=BigInt(2),Gr=BigInt(3),Qr=BigInt(8),Yr=Wr**BigInt(256),$r={a:zr,b:BigInt(7),P:Yr-Wr**BigInt(32)-BigInt(977),n:Yr-BigInt("432420386565659656852420866394968145599"),h:Hr,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee")};function Xr(e){const{a:t,b:r}=$r,n=vn(e*e),i=vn(n*e);return vn(i+t*e+r)}const Jr=$r.a===zr;class Zr{constructor(e,t,r){this.x=e,this.y=t,this.z=r}static fromAffine(e){if(!(e instanceof tn))throw new TypeError("JacobianPoint#fromAffine: expected Point");return new Zr(e.x,e.y,Hr)}static toAffineBatch(e){const t=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:$r.P;const r=new Array(e.length),n=wn(e.reduce(((e,n,i)=>n===zr?e:(r[i]=e,vn(e*n,t))),Hr),t);return e.reduceRight(((e,n,i)=>n===zr?e:(r[i]=vn(e*r[i],t),vn(e*n,t))),n),r}(e.map((e=>e.z)));return e.map(((e,r)=>e.toAffine(t[r])))}static normalizeZ(e){return Zr.toAffineBatch(e).map(Zr.fromAffine)}equals(e){if(!(e instanceof Zr))throw new TypeError("JacobianPoint expected");const{x:t,y:r,z:n}=this,{x:i,y:s,z:o}=e,a=vn(n**Wr),c=vn(o**Wr),l=vn(t*c),u=vn(i*a),h=vn(vn(r*o)*c),d=vn(vn(s*n)*a);return l===u&&h===d}negate(){return new Zr(this.x,vn(-this.y),this.z)}double(){const{x:e,y:t,z:r}=this,n=vn(e**Wr),i=vn(t**Wr),s=vn(i**Wr),o=vn(Wr*(vn((e+i)**Wr)-n-s)),a=vn(Gr*n),c=vn(a**Wr),l=vn(c-Wr*o),u=vn(a*(o-l)-Qr*s),h=vn(Wr*t*r);return new Zr(l,u,h)}add(e){if(!(e instanceof Zr))throw new TypeError("JacobianPoint expected");const{x:t,y:r,z:n}=this,{x:i,y:s,z:o}=e;if(i===zr||s===zr)return this;if(t===zr||r===zr)return e;const a=vn(n**Wr),c=vn(o**Wr),l=vn(t*c),u=vn(i*a),h=vn(vn(r*o)*c),d=vn(vn(s*n)*a),f=vn(u-l),p=vn(d-h);if(f===zr)return p===zr?this.double():Zr.ZERO;const y=vn(f**Wr),g=vn(f*y),m=vn(l*y),v=vn(p**Wr-g-Wr*m),b=vn(p*(m-v)-h*g),w=vn(n*o*f);return new Zr(v,b,w)}subtract(e){return this.add(e.negate())}multiplyUnsafe(e){const t=Zr.ZERO;if("bigint"===typeof e&&e===zr)return t;let r=mn(e);if(r===Hr)return this;if(!Jr){let e=t,n=this;for(;r>zr;)r&Hr&&(e=e.add(n)),n=n.double(),r>>=Hr;return e}let{k1neg:n,k1:i,k2neg:s,k2:o}=Sn(r),a=t,c=t,l=this;for(;i>zr||o>zr;)i&Hr&&(a=a.add(l)),o&Hr&&(c=c.add(l)),l=l.double(),i>>=Hr,o>>=Hr;return n&&(a=a.negate()),s&&(c=c.negate()),c=new Zr(vn(c.x*$r.beta),c.y,c.z),a.add(c)}precomputeWindow(e){const t=Jr?128/e+1:256/e+1,r=[];let n=this,i=n;for(let s=0;s<t;s++){i=n,r.push(i);for(let t=1;t<2**(e-1);t++)i=i.add(n),r.push(i);n=i.double()}return r}wNAF(e,t){!t&&this.equals(Zr.BASE)&&(t=tn.BASE);const r=t&&t._WINDOW_SIZE||1;if(256%r)throw new Error("Point#wNAF: Invalid precomputation window, must be power of 2");let n=t&&en.get(t);n||(n=this.precomputeWindow(r),t&&1!==r&&(n=Zr.normalizeZ(n),en.set(t,n)));let i=Zr.ZERO,s=Zr.ZERO;const o=1+(Jr?128/r:256/r),a=2**(r-1),c=BigInt(2**r-1),l=2**r,u=BigInt(r);for(let h=0;h<o;h++){const t=h*a;let r=Number(e&c);if(e>>=u,r>a&&(r-=l,e+=Hr),0===r){let e=n[t];h%2&&(e=e.negate()),s=s.add(e)}else{let e=n[t+Math.abs(r)-1];r<0&&(e=e.negate()),i=i.add(e)}}return{p:i,f:s}}multiply(e,t){let r,n,i=mn(e);if(Jr){const{k1neg:e,k1:s,k2neg:o,k2:a}=Sn(i);let{p:c,f:l}=this.wNAF(s,t),{p:u,f:h}=this.wNAF(a,t);e&&(c=c.negate()),o&&(u=u.negate()),u=new Zr(vn(u.x*$r.beta),u.y,u.z),r=c.add(u),n=l.add(h)}else{const{p:e,f:s}=this.wNAF(i,t);r=e,n=s}return Zr.normalizeZ([r,n])[0]}toAffine(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:wn(this.z);const{x:t,y:r,z:n}=this,i=e,s=vn(i*i),o=vn(s*i),a=vn(t*s),c=vn(r*o);if(vn(n*i)!==Hr)throw new Error("invZ was invalid");return new tn(a,c)}}Zr.BASE=new Zr($r.Gx,$r.Gy,Hr),Zr.ZERO=new Zr(zr,Hr,zr);const en=new WeakMap;class tn{constructor(e,t){this.x=e,this.y=t}_setWindowSize(e){this._WINDOW_SIZE=e,en.delete(this)}static fromCompressedHex(e){const t=32===e.length,r=yn(t?e:e.subarray(1));if(!Tn(r))throw new Error("Point is not on curve");let n=function(e){const{P:t}=$r,r=BigInt(6),n=BigInt(11),i=BigInt(22),s=BigInt(23),o=BigInt(44),a=BigInt(88),c=e*e*e%t,l=c*c*e%t,u=bn(l,Gr)*l%t,h=bn(u,Gr)*l%t,d=bn(h,Wr)*c%t,f=bn(d,n)*d%t,p=bn(f,i)*f%t,y=bn(p,o)*p%t,g=bn(y,a)*y%t,m=bn(g,o)*p%t,v=bn(m,Gr)*l%t,b=bn(v,s)*f%t,w=bn(b,r)*c%t;return bn(w,Wr)}(Xr(r));const i=(n&Hr)===Hr;if(t)i&&(n=vn(-n));else{1===(1&e[0])!==i&&(n=vn(-n))}const s=new tn(r,n);return s.assertValidity(),s}static fromUncompressedHex(e){const t=yn(e.subarray(1,33)),r=yn(e.subarray(33,65)),n=new tn(t,r);return n.assertValidity(),n}static fromHex(e){const t=gn(e),r=t.length,n=t[0];if(32===r||33===r&&(2===n||3===n))return this.fromCompressedHex(t);if(65===r&&4===n)return this.fromUncompressedHex(t);throw new Error("Point.fromHex: received invalid point. Expected 32-33 compressed bytes or 65 uncompressed bytes, not ".concat(r))}static fromPrivateKey(e){return tn.BASE.multiply(Rn(e))}static fromSignature(e,t,r){const n=In(e=gn(e)),{r:i,s:s}=Dn(t);if(0!==r&&1!==r)throw new Error("Cannot recover signature: invalid recovery bit");const o=1&r?"03":"02",a=tn.fromHex(o+un(i)),{n:c}=$r,l=wn(i,c),u=vn(-n*l,c),h=vn(s*l,c),d=tn.BASE.multiplyAndAddUnsafe(a,u,h);if(!d)throw new Error("Cannot recover signature: point at infinify");return d.assertValidity(),d}toRawBytes(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return pn(this.toHex(e))}toHex(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];const t=un(this.x);if(e){const e=this.y&Hr?"03":"02";return"".concat(e).concat(t)}return"04".concat(t).concat(un(this.y))}toHexX(){return this.toHex(!0).slice(2)}toRawX(){return this.toRawBytes(!0).slice(1)}assertValidity(){const e="Point is not on elliptic curve",{x:t,y:r}=this;if(!Tn(t)||!Tn(r))throw new Error(e);const n=vn(r*r);if(vn(n-Xr(t))!==zr)throw new Error(e)}equals(e){return this.x===e.x&&this.y===e.y}negate(){return new tn(this.x,vn(-this.y))}double(){return Zr.fromAffine(this).double().toAffine()}add(e){return Zr.fromAffine(this).add(Zr.fromAffine(e)).toAffine()}subtract(e){return this.add(e.negate())}multiply(e){return Zr.fromAffine(this).multiply(e,this).toAffine()}multiplyAndAddUnsafe(e,t,r){const n=Zr.fromAffine(this),i=t===zr||t===Hr||this!==tn.BASE?n.multiplyUnsafe(t):n.multiply(t),s=Zr.fromAffine(e).multiplyUnsafe(r),o=i.add(s);return o.equals(Zr.ZERO)?void 0:o.toAffine()}}function rn(e){return Number.parseInt(e[0],16)>=8?"00"+e:e}function nn(e){if(e.length<2||2!==e[0])throw new Error("Invalid signature integer tag: ".concat(ln(e)));const t=e[1],r=e.subarray(2,t+2);if(!t||r.length!==t)throw new Error("Invalid signature integer: wrong length");if(0===r[0]&&r[1]<=127)throw new Error("Invalid signature integer: trailing length");return{data:yn(r),left:e.subarray(t+2)}}tn.BASE=new tn($r.Gx,$r.Gy),tn.ZERO=new tn(zr,zr);class sn{constructor(e,t){this.r=e,this.s=t,this.assertValidity()}static fromCompact(e){const t=an(e),r="Signature.fromCompact";if("string"!==typeof e&&!t)throw new TypeError("".concat(r,": Expected string or Uint8Array"));const n=t?ln(e):e;if(128!==n.length)throw new Error("".concat(r,": Expected 64-byte hex"));return new sn(fn(n.slice(0,64)),fn(n.slice(64,128)))}static fromDER(e){const t=an(e);if("string"!==typeof e&&!t)throw new TypeError("Signature.fromDER: Expected string or Uint8Array");const{r:r,s:n}=function(e){if(e.length<2||48!=e[0])throw new Error("Invalid signature tag: ".concat(ln(e)));if(e[1]!==e.length-2)throw new Error("Invalid signature: incorrect length");const{data:t,left:r}=nn(e.subarray(2)),{data:n,left:i}=nn(r);if(i.length)throw new Error("Invalid signature: left bytes after parsing: ".concat(ln(i)));return{r:t,s:n}}(t?e:pn(e));return new sn(r,n)}static fromHex(e){return this.fromDER(e)}assertValidity(){const{r:e,s:t}=this;if(!An(e))throw new Error("Invalid Signature: r must be 0 < r < n");if(!An(t))throw new Error("Invalid Signature: s must be 0 < s < n")}hasHighS(){const e=$r.n>>Hr;return this.s>e}normalizeS(){return this.hasHighS()?new sn(this.r,$r.n-this.s):this}toDERRawBytes(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return pn(this.toDERHex(e))}toDERHex(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];const t=rn(dn(this.s));if(e)return t;const r=rn(dn(this.r)),n=dn(r.length/2),i=dn(t.length/2),s=dn(r.length/2+t.length/2+4);return"30".concat(s,"02").concat(n).concat(r,"02").concat(i).concat(t)}toRawBytes(){return this.toDERRawBytes()}toHex(){return this.toDERHex()}toCompactRawBytes(){return pn(this.toCompactHex())}toCompactHex(){return un(this.r)+un(this.s)}}function on(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];if(!t.every(an))throw new Error("Uint8Array list expected");if(1===t.length)return t[0];const n=t.reduce(((e,t)=>e+t.length),0),i=new Uint8Array(n);for(let s=0,o=0;s<t.length;s++){const e=t[s];i.set(e,o),o+=e.length}return i}function an(e){return e instanceof Uint8Array}const cn=Array.from({length:256},((e,t)=>t.toString(16).padStart(2,"0")));function ln(e){if(!(e instanceof Uint8Array))throw new Error("Expected Uint8Array");let t="";for(let r=0;r<e.length;r++)t+=cn[e[r]];return t}function un(e){if(e>Yr)throw new Error("Expected number < 2^256");return e.toString(16).padStart(64,"0")}function hn(e){return pn(un(e))}function dn(e){const t=e.toString(16);return 1&t.length?"0".concat(t):t}function fn(e){if("string"!==typeof e)throw new TypeError("hexToNumber: expected string, got "+typeof e);return BigInt("0x".concat(e))}function pn(e){if("string"!==typeof e)throw new TypeError("hexToBytes: expected string, got "+typeof e);if(e.length%2)throw new Error("hexToBytes: received invalid unpadded hex"+e.length);const t=new Uint8Array(e.length/2);for(let r=0;r<t.length;r++){const n=2*r,i=e.slice(n,n+2),s=Number.parseInt(i,16);if(Number.isNaN(s)||s<0)throw new Error("Invalid byte sequence");t[r]=s}return t}function yn(e){return fn(ln(e))}function gn(e){return e instanceof Uint8Array?Uint8Array.from(e):pn(e)}function mn(e){if("number"===typeof e&&Number.isSafeInteger(e)&&e>0)return BigInt(e);if("bigint"===typeof e&&An(e))return e;throw new TypeError("Expected valid private scalar: 0 < scalar < curve.n")}function vn(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:$r.P;const r=e%t;return r>=zr?r:t+r}function bn(e,t){const{P:r}=$r;let n=e;for(;t-- >zr;)n*=n,n%=r;return n}function wn(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:$r.P;if(e===zr||t<=zr)throw new Error("invert: expected positive integers, got n=".concat(e," mod=").concat(t));let r=vn(e,t),n=t,i=zr,s=Hr,o=Hr,a=zr;for(;r!==zr;){const e=n/r,t=n%r,c=i-o*e,l=s-a*e;n=r,r=t,i=o,s=a,o=c,a=l}const c=n;if(c!==Hr)throw new Error("invert: does not exist");return vn(i,t)}const En=(e,t)=>(e+t/Wr)/t,_n=Wr**BigInt(128);function Sn(e){const{n:t}=$r,r=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),n=-Hr*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),i=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),s=r,o=En(s*e,t),a=En(-n*e,t);let c=vn(e-o*r-a*i,t),l=vn(-o*n-a*s,t);const u=c>_n,h=l>_n;if(u&&(c=t-c),h&&(l=t-l),c>_n||l>_n)throw new Error("splitScalarEndo: Endomorphism failed, k="+e);return{k1neg:u,k1:c,k2neg:h,k2:l}}function In(e){const{n:t}=$r,r=8*e.length-256;let n=yn(e);return r>0&&(n>>=BigInt(r)),n>=t&&(n-=t),n}class Cn{constructor(){this.v=new Uint8Array(32).fill(1),this.k=new Uint8Array(32).fill(0),this.counter=0}hmac(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return jn.hmacSha256(this.k,...t)}hmacSync(){if("function"!==typeof jn.hmacSha256Sync)throw new Error("utils.hmacSha256Sync is undefined, you need to set it");for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];const n=jn.hmacSha256Sync(this.k,...t);if(n instanceof Promise)throw new Error("To use sync sign(), ensure utils.hmacSha256 is sync");return n}incr(){if(this.counter>=1e3)throw new Error("Tried 1,000 k values for sign(), all were invalid");this.counter+=1}async reseed(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Uint8Array;this.k=await this.hmac(this.v,Uint8Array.from([0]),e),this.v=await this.hmac(this.v),0!==e.length&&(this.k=await this.hmac(this.v,Uint8Array.from([1]),e),this.v=await this.hmac(this.v))}reseedSync(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Uint8Array;this.k=this.hmacSync(this.v,Uint8Array.from([0]),e),this.v=this.hmacSync(this.v),0!==e.length&&(this.k=this.hmacSync(this.v,Uint8Array.from([1]),e),this.v=this.hmacSync(this.v))}async generate(){return this.incr(),this.v=await this.hmac(this.v),this.v}generateSync(){return this.incr(),this.v=this.hmacSync(this.v),this.v}}function An(e){return zr<e&&e<$r.n}function Tn(e){return zr<e&&e<$r.P}function kn(e,t,r){const n=yn(e);if(!An(n))return;const{n:i}=$r,s=tn.BASE.multiply(n),o=vn(s.x,i);if(o===zr)return;const a=vn(wn(n,i)*vn(t+r*o,i),i);if(a===zr)return;const c=new sn(o,a);return{sig:c,recovery:(s.x===c.r?0:2)|Number(s.y&Hr)}}function Rn(e){let t;if("bigint"===typeof e)t=e;else if("number"===typeof e&&Number.isSafeInteger(e)&&e>0)t=BigInt(e);else if("string"===typeof e){if(64!==e.length)throw new Error("Expected 32 bytes of private key");t=fn(e)}else{if(!an(e))throw new TypeError("Expected valid private key");if(32!==e.length)throw new Error("Expected 32 bytes of private key");t=yn(e)}if(!An(t))throw new Error("Expected private key: 0 < key < n");return t}function Pn(e){return e instanceof tn?(e.assertValidity(),e):tn.fromHex(e)}function Dn(e){if(e instanceof sn)return e.assertValidity(),e;try{return sn.fromDER(e)}catch(t){return sn.fromCompact(e)}}function Nn(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return tn.fromPrivateKey(e).toRawBytes(t)}function xn(e){return yn(e.length>32?e.slice(0,32):e)}function Ln(e){const t=xn(e),r=vn(t,$r.n);return On(r<zr?t:r)}function On(e){if("bigint"!==typeof e)throw new Error("Expected bigint");return pn(un(e))}function Bn(e,t,r){if(null==e)throw new Error('sign: expected valid message hash, not "'.concat(e,'"'));const n=gn(e),i=Rn(t),s=[On(i),Ln(n)];if(null!=r){!0===r&&(r=jn.randomBytes(32));const e=gn(r);if(32!==e.length)throw new Error("sign: Expected 32 bytes of extra data");s.push(e)}return{seed:on(...s),m:xn(n),d:i}}function Mn(e,t){let{sig:r,recovery:n}=e;const{canonical:i,der:s,recovered:o}=Object.assign({canonical:!0,der:!0},t);i&&r.hasHighS()&&(r=r.normalizeS(),n^=1);const a=s?r.toDERRawBytes():r.toCompactRawBytes();return o?[a,n]:a}const Un={strict:!0};tn.BASE._setWindowSize(8);const Fn={node:qr,web:"object"===typeof self&&"crypto"in self?self.crypto:void 0},Vn={},jn={isValidPrivateKey(e){try{return Rn(e),!0}catch(t){return!1}},privateAdd:(e,t)=>hn(vn(Rn(e)+Rn(t),$r.n)),privateNegate:e=>{const t=Rn(e);return hn($r.n-t)},pointAddScalar:(e,t,r)=>{const n=tn.fromHex(e),i=Rn(t),s=tn.BASE.multiplyAndAddUnsafe(n,i,Hr);if(!s)throw new Error("Tweaked point at infinity");return s.toRawBytes(r)},pointMultiply:(e,t,r)=>{const n=tn.fromHex(e),i=yn(gn(t));return n.multiply(i).toRawBytes(r)},hashToPrivateKey:e=>{if((e=gn(e)).length<40||e.length>1024)throw new Error("Expected 40-1024 bytes of private key as per FIPS 186");return hn(vn(yn(e),$r.n-Hr)+Hr)},randomBytes:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:32;if(Fn.web)return Fn.web.getRandomValues(new Uint8Array(e));if(Fn.node){const{randomBytes:t}=Fn.node;return Uint8Array.from(t(e))}throw new Error("The environment doesn't have randomBytes function")},randomPrivateKey:()=>jn.hashToPrivateKey(jn.randomBytes(40)),bytesToHex:ln,hexToBytes:pn,concatBytes:on,mod:vn,invert:wn,sha256:async function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];if(Fn.web){const e=await Fn.web.subtle.digest("SHA-256",on(...t));return new Uint8Array(e)}if(Fn.node){const{createHash:e}=Fn.node,r=e("sha256");return t.forEach((e=>r.update(e))),Uint8Array.from(r.digest())}throw new Error("The environment doesn't have sha256 function")},hmacSha256:async function(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];if(Fn.web){const t=await Fn.web.subtle.importKey("raw",e,{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign"]),n=on(...r),i=await Fn.web.subtle.sign("HMAC",t,n);return new Uint8Array(i)}if(Fn.node){const{createHmac:t}=Fn.node,n=t("sha256",e);return r.forEach((e=>n.update(e))),Uint8Array.from(n.digest())}throw new Error("The environment doesn't have hmac-sha256 function")},sha256Sync:void 0,hmacSha256Sync:void 0,taggedHash:async function(e){let t=Vn[e];if(void 0===t){const r=await jn.sha256(Uint8Array.from(e,(e=>e.charCodeAt(0))));t=on(r,r),Vn[e]=t}for(var r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];return jn.sha256(t,...n)},taggedHashSync:function(e){if("function"!==typeof jn.sha256Sync)throw new Error("utils.sha256Sync is undefined, you need to set it");let t=Vn[e];if(void 0===t){const r=jn.sha256Sync(Uint8Array.from(e,(e=>e.charCodeAt(0))));t=on(r,r),Vn[e]=t}for(var r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];return jn.sha256Sync(t,...n)},precompute(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:8,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:tn.BASE;const r=t===tn.BASE?t:new tn(t.x,t.y);return r._setWindowSize(e),r.multiply(Gr),r}};function Kn(e){if(isNaN(e)||e<=0)throw ue(new Error("random bytes length must be a Number bigger than 0"),"ERR_INVALID_LENGTH");return jn.randomBytes(e)}__webpack_require__(8690);function qn(e,t){return t.map((t=>Fr(e[t])))}async function zn(e){const t=[await Or.get().subtle.importKey("jwk",e,{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!0,["sign"]),await Wn(e)],r=await Hn({privateKey:t[0],publicKey:t[1]});return{privateKey:r[0],publicKey:r[1]}}async function Hn(e){if(null==e.privateKey||null==e.publicKey)throw ue(new Error("Private and public key are required"),"ERR_INVALID_PARAMETERS");return await Promise.all([Or.get().subtle.exportKey("jwk",e.privateKey),Or.get().subtle.exportKey("jwk",e.publicKey)])}async function Wn(e){return await Or.get().subtle.importKey("jwk",{kty:e.kty,n:e.n,e:e.e},{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!0,["verify"])}function Gn(e,t,r,n){const i=t?function(e){return $e.pki.setRsaPublicKey(...qn(e,["n","e"]))}(e):function(e){return $e.pki.setRsaPrivateKey(...qn(e,["n","e","d","p","q","dp","dq","qi"]))}(e);return Lr(n(Mr(Uint8Array.from(r),"ascii"),i),"ascii")}async function Qn(e,t){const r=jr(),n=await r.encrypt(e,t);return Tt.encode(n)}class Yn{constructor(e){this._key=e}async verify(e,t){return await async function(e,t,r){const n=await Or.get().subtle.importKey("jwk",e,{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!1,["verify"]);return await Or.get().subtle.verify({name:"RSASSA-PKCS1-v1_5"},n,t,r)}(this._key,t,e)}marshal(){return function(e){if(null==e.n||null==e.e)throw ue(new Error("JWK was missing components"),"ERR_INVALID_PARAMETERS");const t=$e.pki.publicKeyToAsn1({n:Fr(e.n),e:Fr(e.e)});return Lr($e.asn1.toDer(t).getBytes(),"ascii")}(this._key)}get bytes(){return He.encode({Type:qe.RSA,Data:this.marshal()}).subarray()}encrypt(e){return Gn(this._key,!0,e,((e,t)=>t.encrypt(e)))}equals(e){return U(this.bytes,e.bytes)}async hash(){const{bytes:e}=await nr.digest(this.bytes);return e}}class $n{constructor(e,t){this._key=e,this._publicKey=t}genSecret(){return Kn(16)}async sign(e){return await async function(e,t){const r=await Or.get().subtle.importKey("jwk",e,{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!1,["sign"]),n=await Or.get().subtle.sign({name:"RSASSA-PKCS1-v1_5"},r,Uint8Array.from(t));return new Uint8Array(n,0,n.byteLength)}(this._key,e)}get public(){if(null==this._publicKey)throw ue(new Error("public key not provided"),"ERR_PUBKEY_NOT_PROVIDED");return new Yn(this._publicKey)}decrypt(e){return Gn(this._key,!1,e,((e,t)=>t.decrypt(e)))}marshal(){return function(e){if(null==e.n||null==e.e||null==e.d||null==e.p||null==e.q||null==e.dp||null==e.dq||null==e.qi)throw ue(new Error("JWK was missing components"),"ERR_INVALID_PARAMETERS");const t=$e.pki.privateKeyToAsn1({n:Fr(e.n),e:Fr(e.e),d:Fr(e.d),p:Fr(e.p),q:Fr(e.q),dP:Fr(e.dp),dQ:Fr(e.dq),qInv:Fr(e.qi)});return Lr($e.asn1.toDer(t).getBytes(),"ascii")}(this._key)}get bytes(){return We.encode({Type:qe.RSA,Data:this.marshal()}).subarray()}equals(e){return U(this.bytes,e.bytes)}async hash(){const{bytes:e}=await nr.digest(this.bytes);return e}async id(){return Mr(await this.public.hash(),"base58btc")}async export(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"pkcs-8";if("pkcs-8"===t){const t=new $e.util.ByteBuffer(this.marshal()),r=$e.asn1.fromDer(t),n=$e.pki.privateKeyFromAsn1(r),i={algorithm:"aes256",count:1e4,saltSize:16,prfAlgorithm:"sha512"};return $e.pki.encryptRsaPrivateKey(n,e,i)}if("libp2p-key"===t)return await Qn(this.bytes,e);throw ue(new Error("export format '".concat(t,"' is not supported")),"ERR_INVALID_EXPORT_FORMAT")}}async function Xn(e){const t=function(e){const t=$e.asn1.fromDer(Mr(e,"ascii")),r=$e.pki.privateKeyFromAsn1(t);return{kty:"RSA",n:Ur(r.n),e:Ur(r.e),d:Ur(r.d),p:Ur(r.p),q:Ur(r.q),dp:Ur(r.dP),dq:Ur(r.dQ),qi:Ur(r.qInv),alg:"RS256"}}(e),r=await zn(t);return new $n(r.privateKey,r.publicKey)}function Jn(e){const t=function(e){const t=$e.asn1.fromDer(Mr(e,"ascii")),r=$e.pki.publicKeyFromAsn1(t);return{kty:"RSA",n:Ur(r.n),e:Ur(r.e)}}(e);return new Yn(t)}async function Zn(e){const t=await zn(e);return new $n(t.privateKey,t.publicKey)}async function ei(e){const t=await async function(e){const t=await Or.get().subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:e,publicExponent:new Uint8Array([1,0,1]),hash:{name:"SHA-256"}},!0,["sign","verify"]),r=await Hn(t);return{privateKey:r[0],publicKey:r[1]}}(e);return new $n(t.privateKey,t.publicKey)}var ti=__webpack_require__(9458);const ri=BigInt(0),ni=BigInt(1),ii=BigInt(2),si=BigInt(255),oi=ii**BigInt(252)+BigInt("27742317777372353535851937790883648493"),ai={a:BigInt(-1),d:BigInt("37095705934669439343138083508754565189542113879843219016388785533085940283555"),P:ii**si-BigInt(19),l:oi,n:oi,h:BigInt(8),Gx:BigInt("15112221349535400772501151409588531511454012693041857206046113283949847762202"),Gy:BigInt("46316835694926478169428394003475163141307993866256225615783033603165251855960")},ci=ii**BigInt(256),li=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752"),ui=(BigInt("6853475219497561581579357271197624642482790079785650197046958215289687604742"),BigInt("25063068953384623474111414158702152701244531502492656460079210482610430750235")),hi=BigInt("54469307008909316920995813868745141605393597292927456921205312896311721017578"),di=BigInt("1159843021668779879193775521855586647937357759715417654439879720876111806838"),fi=BigInt("40440834346308536858101042469323190826248399146238708352240133220865137265952");class pi{constructor(e,t,r,n){this.x=e,this.y=t,this.z=r,this.t=n}static fromAffine(e){if(!(e instanceof wi))throw new TypeError("ExtendedPoint#fromAffine: expected Point");return e.equals(wi.ZERO)?pi.ZERO:new pi(e.x,e.y,ni,Di(e.x*e.y))}static toAffineBatch(e){const t=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:ai.P;const r=new Array(e.length),n=Ni(e.reduce(((e,n,i)=>n===ri?e:(r[i]=e,Di(e*n,t))),ni),t);return e.reduceRight(((e,n,i)=>n===ri?e:(r[i]=Di(e*r[i],t),Di(e*n,t))),n),r}(e.map((e=>e.z)));return e.map(((e,r)=>e.toAffine(t[r])))}static normalizeZ(e){return this.toAffineBatch(e).map(this.fromAffine)}equals(e){yi(e);const{x:t,y:r,z:n}=this,{x:i,y:s,z:o}=e,a=Di(t*o),c=Di(i*n),l=Di(r*o),u=Di(s*n);return a===c&&l===u}negate(){return new pi(Di(-this.x),this.y,this.z,Di(-this.t))}double(){const{x:e,y:t,z:r}=this,{a:n}=ai,i=Di(e**ii),s=Di(t**ii),o=Di(ii*Di(r**ii)),a=Di(n*i),c=Di(Di((e+t)**ii)-i-s),l=a+s,u=l-o,h=a-s,d=Di(c*u),f=Di(l*h),p=Di(c*h),y=Di(u*l);return new pi(d,f,y,p)}add(e){yi(e);const{x:t,y:r,z:n,t:i}=this,{x:s,y:o,z:a,t:c}=e,l=Di((r-t)*(o+s)),u=Di((r+t)*(o-s)),h=Di(u-l);if(h===ri)return this.double();const d=Di(n*ii*c),f=Di(i*ii*a),p=f+d,y=u+l,g=f-d,m=Di(p*h),v=Di(y*g),b=Di(p*g),w=Di(h*y);return new pi(m,v,w,b)}subtract(e){return this.add(e.negate())}precomputeWindow(e){const t=1+256/e,r=[];let n=this,i=n;for(let s=0;s<t;s++){i=n,r.push(i);for(let t=1;t<2**(e-1);t++)i=i.add(n),r.push(i);n=i.double()}return r}wNAF(e,t){!t&&this.equals(pi.BASE)&&(t=wi.BASE);const r=t&&t._WINDOW_SIZE||1;if(256%r)throw new Error("Point#wNAF: Invalid precomputation window, must be power of 2");let n=t&&bi.get(t);n||(n=this.precomputeWindow(r),t&&1!==r&&(n=pi.normalizeZ(n),bi.set(t,n)));let i=pi.ZERO,s=pi.ZERO;const o=1+256/r,a=2**(r-1),c=BigInt(2**r-1),l=2**r,u=BigInt(r);for(let h=0;h<o;h++){const t=h*a;let r=Number(e&c);if(e>>=u,r>a&&(r-=l,e+=ni),0===r){let e=n[t];h%2&&(e=e.negate()),s=s.add(e)}else{let e=n[t+Math.abs(r)-1];r<0&&(e=e.negate()),i=i.add(e)}}return pi.normalizeZ([i,s])[0]}multiply(e,t){return this.wNAF(Fi(e,ai.l),t)}multiplyUnsafe(e){let t=Fi(e,ai.l,!1);const r=pi.BASE,n=pi.ZERO;if(t===ri)return n;if(this.equals(n)||t===ni)return this;if(this.equals(r))return this.wNAF(t);let i=n,s=this;for(;t>ri;)t&ni&&(i=i.add(s)),s=s.double(),t>>=ni;return i}isSmallOrder(){return this.multiplyUnsafe(ai.h).equals(pi.ZERO)}isTorsionFree(){return this.multiplyUnsafe(ai.l).equals(pi.ZERO)}toAffine(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Ni(this.z);const{x:t,y:r,z:n}=this,i=Di(t*e),s=Di(r*e);if(Di(n*e)!==ni)throw new Error("invZ was invalid");return new wi(i,s)}fromRistrettoBytes(){mi()}toRistrettoBytes(){mi()}fromRistrettoHash(){mi()}}function yi(e){if(!(e instanceof pi))throw new TypeError("ExtendedPoint expected")}function gi(e){if(!(e instanceof vi))throw new TypeError("RistrettoPoint expected")}function mi(){throw new Error("Legacy method: switch to RistrettoPoint")}pi.BASE=new pi(ai.Gx,ai.Gy,ni,Di(ai.Gx*ai.Gy)),pi.ZERO=new pi(ri,ni,ni,ri);class vi{constructor(e){this.ep=e}static calcElligatorRistrettoMap(e){const{d:t}=ai,r=Di(li*e*e),n=Di((r+ni)*di);let i=BigInt(-1);const s=Di((i-t*r)*Di(r+t));let{isValid:o,value:a}=Oi(n,s),c=Di(a*e);ki(c)||(c=Di(-c)),o||(a=c),o||(i=r);const l=Di(i*(r-ni)*fi-s),u=a*a,h=Di((a+a)*s),d=Di(l*ui),f=Di(ni-u),p=Di(ni+u);return new pi(Di(h*p),Di(f*d),Di(d*p),Di(h*f))}static hashToCurve(e){const t=Pi((e=Ui(e,64)).slice(0,32)),r=this.calcElligatorRistrettoMap(t),n=Pi(e.slice(32,64)),i=this.calcElligatorRistrettoMap(n);return new vi(r.add(i))}static fromHex(e){e=Ui(e,32);const{a:t,d:r}=ai,n="RistrettoPoint.fromHex: the hex is not valid encoding of RistrettoPoint",i=Pi(e);if(!function(e,t){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(e[r]!==t[r])return!1;return!0}(Ti(i),e)||ki(i))throw new Error(n);const s=Di(i*i),o=Di(ni+t*s),a=Di(ni-t*s),c=Di(o*o),l=Di(a*a),u=Di(t*r*c-l),{isValid:h,value:d}=Bi(Di(u*l)),f=Di(d*a),p=Di(d*f*u);let y=Di((i+i)*f);ki(y)&&(y=Di(-y));const g=Di(o*p),m=Di(y*g);if(!h||ki(m)||g===ri)throw new Error(n);return new vi(new pi(y,g,ni,m))}toRawBytes(){let{x:e,y:t,z:r,t:n}=this.ep;const i=Di(Di(r+t)*Di(r-t)),s=Di(e*t),{value:o}=Bi(Di(i*s**ii)),a=Di(o*i),c=Di(o*s),l=Di(a*c*n);let u;if(ki(n*l)){let r=Di(t*li),n=Di(e*li);e=r,t=n,u=Di(a*hi)}else u=c;ki(e*l)&&(t=Di(-t));let h=Di((r-t)*u);return ki(h)&&(h=Di(-h)),Ti(h)}toHex(){return Ii(this.toRawBytes())}toString(){return this.toHex()}equals(e){gi(e);const t=this.ep,r=e.ep,n=Di(t.x*r.y)===Di(t.y*r.x),i=Di(t.y*r.y)===Di(t.x*r.x);return n||i}add(e){return gi(e),new vi(this.ep.add(e.ep))}subtract(e){return gi(e),new vi(this.ep.subtract(e.ep))}multiply(e){return new vi(this.ep.multiply(e))}multiplyUnsafe(e){return new vi(this.ep.multiplyUnsafe(e))}}vi.BASE=new vi(pi.BASE),vi.ZERO=new vi(pi.ZERO);const bi=new WeakMap;class wi{constructor(e,t){this.x=e,this.y=t}_setWindowSize(e){this._WINDOW_SIZE=e,bi.delete(this)}static fromHex(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const{d:r,P:n}=ai,i=(e=Ui(e,32)).slice();i[31]=-129&e[31];const s=Ri(i);if(t&&s>=n)throw new Error("Expected 0 < hex < P");if(!t&&s>=ci)throw new Error("Expected 0 < hex < 2**256");const o=Di(s*s),a=Di(o-ni),c=Di(r*o+ni);let{isValid:l,value:u}=Oi(a,c);if(!l)throw new Error("Point.fromHex: invalid y coordinate");const h=(u&ni)===ni;return 0!==(128&e[31])!==h&&(u=Di(-u)),new wi(u,s)}static async fromPrivateKey(e){return(await ji(e)).point}toRawBytes(){const e=Ti(this.y);return e[31]|=this.x&ni?128:0,e}toHex(){return Ii(this.toRawBytes())}toX25519(){const{y:e}=this;return Ti(Di((ni+e)*Ni(ni-e)))}isTorsionFree(){return pi.fromAffine(this).isTorsionFree()}equals(e){return this.x===e.x&&this.y===e.y}negate(){return new wi(Di(-this.x),this.y)}add(e){return pi.fromAffine(this).add(pi.fromAffine(e)).toAffine()}subtract(e){return this.add(e.negate())}multiply(e){return pi.fromAffine(this).multiply(e,this).toAffine()}}wi.BASE=new wi(ai.Gx,ai.Gy),wi.ZERO=new wi(ri,ni);class Ei{constructor(e,t){this.r=e,this.s=t,this.assertValidity()}static fromHex(e){const t=Ui(e,64),r=wi.fromHex(t.slice(0,32),!1),n=Ri(t.slice(32,64));return new Ei(r,n)}assertValidity(){const{r:e,s:t}=this;if(!(e instanceof wi))throw new Error("Expected Point instance");return Fi(t,ai.l,!1),this}toRawBytes(){const e=new Uint8Array(64);return e.set(this.r.toRawBytes()),e.set(Ti(this.s),32),e}toHex(){return Ii(this.toRawBytes())}}function _i(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];if(!t.every((e=>e instanceof Uint8Array)))throw new Error("Expected Uint8Array list");if(1===t.length)return t[0];const n=t.reduce(((e,t)=>e+t.length),0),i=new Uint8Array(n);for(let s=0,o=0;s<t.length;s++){const e=t[s];i.set(e,o),o+=e.length}return i}const Si=Array.from({length:256},((e,t)=>t.toString(16).padStart(2,"0")));function Ii(e){if(!(e instanceof Uint8Array))throw new Error("Uint8Array expected");let t="";for(let r=0;r<e.length;r++)t+=Si[e[r]];return t}function Ci(e){if("string"!==typeof e)throw new TypeError("hexToBytes: expected string, got "+typeof e);if(e.length%2)throw new Error("hexToBytes: received invalid unpadded hex");const t=new Uint8Array(e.length/2);for(let r=0;r<t.length;r++){const n=2*r,i=e.slice(n,n+2),s=Number.parseInt(i,16);if(Number.isNaN(s)||s<0)throw new Error("Invalid byte sequence");t[r]=s}return t}function Ai(e){return Ci(e.toString(16).padStart(64,"0"))}function Ti(e){return Ai(e).reverse()}function ki(e){return(Di(e)&ni)===ni}function Ri(e){if(!(e instanceof Uint8Array))throw new Error("Expected Uint8Array");return BigInt("0x"+Ii(Uint8Array.from(e).reverse()))}function Pi(e){return Di(Ri(e)&ii**si-ni)}function Di(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:ai.P;const r=e%t;return r>=ri?r:t+r}function Ni(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:ai.P;if(e===ri||t<=ri)throw new Error("invert: expected positive integers, got n=".concat(e," mod=").concat(t));let r=Di(e,t),n=t,i=ri,s=ni,o=ni,a=ri;for(;r!==ri;){const e=n/r,t=n%r,c=i-o*e,l=s-a*e;n=r,r=t,i=o,s=a,o=c,a=l}const c=n;if(c!==ni)throw new Error("invert: does not exist");return Di(i,t)}function xi(e,t){const{P:r}=ai;let n=e;for(;t-- >ri;)n*=n,n%=r;return n}function Li(e){const{P:t}=ai,r=BigInt(5),n=BigInt(10),i=BigInt(20),s=BigInt(40),o=BigInt(80),a=e*e%t*e%t,c=xi(a,ii)*a%t,l=xi(c,ni)*e%t,u=xi(l,r)*l%t,h=xi(u,n)*u%t,d=xi(h,i)*h%t,f=xi(d,s)*d%t,p=xi(f,o)*f%t,y=xi(p,o)*f%t,g=xi(y,n)*u%t;return{pow_p_5_8:xi(g,ii)*e%t,b2:a}}function Oi(e,t){const r=Di(t*t*t),n=Di(r*r*t);let i=Di(e*r*Li(e*n).pow_p_5_8);const s=Di(t*i*i),o=i,a=Di(i*li),c=s===e,l=s===Di(-e),u=s===Di(-e*li);return c&&(i=o),(l||u)&&(i=a),ki(i)&&(i=Di(-i)),{isValid:c||l,value:i}}function Bi(e){return Oi(ni,e)}async function Mi(){const e=await zi.sha512(_i(...arguments)),t=Ri(e);return Di(t,ai.l)}function Ui(e,t){const r=e instanceof Uint8Array?Uint8Array.from(e):Ci(e);if("number"===typeof t&&r.length!==t)throw new Error("Expected ".concat(t," bytes"));return r}function Fi(e,t){let r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(!t)throw new TypeError("Specify max value");if("number"===typeof e&&Number.isSafeInteger(e)&&(e=BigInt(e)),"bigint"===typeof e&&e<t)if(r){if(ri<e)return e}else if(ri<=e)return e;throw new TypeError("Expected valid scalar: 0 < scalar < max")}function Vi(e){return e[0]&=248,e[31]&=127,e[31]|=64,e}async function ji(e){if(32!==(e="bigint"===typeof e||"number"===typeof e?Ai(Fi(e,ci)):Ui(e)).length)throw new Error("Expected 32 bytes");const t=await zi.sha512(e),r=Vi(t.slice(0,32)),n=t.slice(32,64),i=Di(Ri(r),ai.l),s=wi.BASE.multiply(i),o=s.toRawBytes();return{head:r,prefix:n,scalar:i,point:s,pointBytes:o}}async function Ki(e){return(await ji(e)).pointBytes}wi.BASE._setWindowSize(8);const qi={node:ti,web:"object"===typeof self&&"crypto"in self?self.crypto:void 0},zi={TORSION_SUBGROUP:["0100000000000000000000000000000000000000000000000000000000000000","c7176a703d4dd84fba3c0b760d10670f2a2053fa2c39ccc64ec7fd7792ac037a","0000000000000000000000000000000000000000000000000000000000000080","26e8958fc2b227b045c3f489f2ef98f0d5dfac05d3c63339b13802886d53fc05","ecffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7f","26e8958fc2b227b045c3f489f2ef98f0d5dfac05d3c63339b13802886d53fc85","0000000000000000000000000000000000000000000000000000000000000000","c7176a703d4dd84fba3c0b760d10670f2a2053fa2c39ccc64ec7fd7792ac03fa"],bytesToHex:Ii,getExtendedPublicKey:ji,mod:Di,invert:Ni,hashToPrivateScalar:e=>{if((e=Ui(e)).length<40||e.length>1024)throw new Error("Expected 40-1024 bytes of private key as per FIPS 186");const t=Di(Ri(e),ai.l);if(t===ri||t===ni)throw new Error("Invalid private key");return t},randomBytes:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:32;if(qi.web)return qi.web.getRandomValues(new Uint8Array(e));if(qi.node){const{randomBytes:t}=qi.node;return new Uint8Array(t(e).buffer)}throw new Error("The environment doesn't have randomBytes function")},randomPrivateKey:()=>zi.randomBytes(32),sha512:async e=>{if(qi.web){const t=await qi.web.subtle.digest("SHA-512",e.buffer);return new Uint8Array(t)}if(qi.node)return Uint8Array.from(qi.node.createHash("sha512").update(e).digest());throw new Error("The environment doesn't have sha512 function")},precompute(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:8,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:wi.BASE;const r=t.equals(wi.BASE)?t:new wi(t.x,t.y);return r._setWindowSize(e),r.multiply(ii),r}},Hi=64;async function Wi(e,t){const r=e.slice(0,32);return await async function(e,t){e=Ui(e);const{prefix:r,scalar:n,pointBytes:i}=await ji(t),s=await Mi(r,e),o=wi.BASE.multiply(s),a=Di(s+await Mi(o.toRawBytes(),i,e)*n,ai.l);return new Ei(o,a).toRawBytes()}(t,r)}async function Gi(e,t,r){return await async function(e,t,r){t=Ui(t),r instanceof wi||(r=wi.fromHex(r,!1));const{r:n,s:i}=e instanceof Ei?e.assertValidity():Ei.fromHex(e),s=pi.BASE.multiplyUnsafe(i),o=await Mi(n.toRawBytes(),r.toRawBytes(),t),a=pi.fromAffine(r).multiplyUnsafe(o);return pi.fromAffine(n).add(a).subtract(s).multiplyUnsafe(ai.h).equals(pi.ZERO)}(t,r,e)}function Qi(e,t){const r=new Uint8Array(Hi);for(let n=0;n<32;n++)r[n]=e[n],r[32+n]=t[n];return r}class Yi{constructor(e){this._key=ts(e,32)}async verify(e,t){return await Gi(this._key,t,e)}marshal(){return this._key}get bytes(){return He.encode({Type:qe.Ed25519,Data:this.marshal()}).subarray()}equals(e){return U(this.bytes,e.bytes)}async hash(){const{bytes:e}=await nr.digest(this.bytes);return e}}class $i{constructor(e,t){this._key=ts(e,Hi),this._publicKey=ts(t,32)}async sign(e){return await Wi(this._key,e)}get public(){return new Yi(this._publicKey)}marshal(){return this._key}get bytes(){return We.encode({Type:qe.Ed25519,Data:this.marshal()}).subarray()}equals(e){return U(this.bytes,e.bytes)}async hash(){const{bytes:e}=await nr.digest(this.bytes);return e}async id(){const e=await or.digest(this.public.bytes);return Ct.encode(e.bytes).substring(1)}async export(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"libp2p-key";if("libp2p-key"===t)return await Qn(this.bytes,e);throw ue(new Error("export format '".concat(t,"' is not supported")),"ERR_INVALID_EXPORT_FORMAT")}}function Xi(e){if(e.length>Hi){const t=(e=ts(e,96)).slice(0,Hi),r=e.slice(Hi,e.length);return new $i(t,r)}const t=(e=ts(e,Hi)).slice(0,Hi),r=e.slice(32);return new $i(t,r)}function Ji(e){return e=ts(e,32),new Yi(e)}async function Zi(){const{privateKey:e,publicKey:t}=await async function(){const e=zi.randomPrivateKey(),t=await Ki(e);return{privateKey:Qi(e,t),publicKey:t}}();return new $i(e,t)}async function es(e){const{privateKey:t,publicKey:r}=await async function(e){if(32!==e.length)throw new TypeError('"seed" must be 32 bytes in length.');if(!(e instanceof Uint8Array))throw new TypeError('"seed" must be a node.js Buffer, or Uint8Array.');const t=e,r=await Ki(t);return{privateKey:Qi(t,r),publicKey:r}}(e);return new $i(t,r)}function ts(e,t){var r;if((e=Uint8Array.from(null!==(r=e)&&void 0!==r?r:[])).length!==t)throw ue(new Error("Key must be a Uint8Array of length ".concat(t,", got ").concat(e.length)),"ERR_INVALID_KEY_TYPE");return e}async function rs(e,t){const{digest:r}=await nr.digest(t);try{return await async function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const{seed:n,m:i,d:s}=Bn(e,t,r.extraEntropy);let o;const a=new Cn;for(await a.reseed(n);!(o=kn(await a.generate(),i,s));)await a.reseed();return Mn(o,r)}(r,e)}catch(n){throw ue(n,"ERR_INVALID_INPUT")}}async function ns(e,t,r){try{const{digest:n}=await nr.digest(r);return function(e,t,r){let n,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:Un;try{n=Dn(e),t=gn(t)}catch(p){return!1}const{r:s,s:o}=n;if(i.strict&&n.hasHighS())return!1;const a=In(t);let c;try{c=Pn(r)}catch(p){return!1}const{n:l}=$r,u=wn(o,l),h=vn(a*u,l),d=vn(s*u,l),f=tn.BASE.multiplyAndAddUnsafe(c,h,d);if(!f)return!1;return vn(f.x,l)===s}(t,n,e)}catch(n){throw ue(n,"ERR_INVALID_INPUT")}}function is(e){try{tn.fromHex(e)}catch(t){throw ue(t,"ERR_INVALID_PUBLIC_KEY")}}class ss{constructor(e){is(e),this._key=e}async verify(e,t){return await ns(this._key,t,e)}marshal(){return e=this._key,tn.fromHex(e).toRawBytes(!0);var e}get bytes(){return He.encode({Type:qe.Secp256k1,Data:this.marshal()}).subarray()}equals(e){return U(this.bytes,e.bytes)}async hash(){const{bytes:e}=await nr.digest(this.bytes);return e}}class os{constructor(e,t){this._key=e,this._publicKey=null!==t&&void 0!==t?t:function(e){try{return Nn(e,!0)}catch(t){throw ue(t,"ERR_INVALID_PRIVATE_KEY")}}(e),function(e){try{Nn(e,!0)}catch(t){throw ue(t,"ERR_INVALID_PRIVATE_KEY")}}(this._key),is(this._publicKey)}async sign(e){return await rs(this._key,e)}get public(){return new ss(this._publicKey)}marshal(){return this._key}get bytes(){return We.encode({Type:qe.Secp256k1,Data:this.marshal()}).subarray()}equals(e){return U(this.bytes,e.bytes)}async hash(){const{bytes:e}=await nr.digest(this.bytes);return e}async id(){return Mr(await this.public.hash(),"base58btc")}async export(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"libp2p-key";if("libp2p-key"===t)return await Qn(this.bytes,e);throw ue(new Error("export format '".concat(t,"' is not supported")),"ERR_INVALID_EXPORT_FORMAT")}}function as(e){return new os(e)}function cs(e){return new ss(e)}async function ls(){const e=await jn.randomPrivateKey();return new os(e)}const us={rsa:p,ed25519:y,secp256k1:g};function hs(e){const t=Object.keys(us).join(" / ");return ue(new Error("invalid or unsupported key type ".concat(e,". Must be ").concat(t)),"ERR_UNSUPPORTED_KEY_TYPE")}function ds(e){if("rsa"===(e=e.toLowerCase())||"ed25519"===e||"secp256k1"===e)return us[e];throw hs(e)}async function fs(e,t){return await ds(e).generateKeyPair(null!==t&&void 0!==t?t:2048)}function ps(e){const t=He.decode(e),r=t.Data;switch(t.Type){case qe.RSA:return us.rsa.unmarshalRsaPublicKey(r);case qe.Ed25519:return us.ed25519.unmarshalEd25519PublicKey(r);case qe.Secp256k1:return us.secp256k1.unmarshalSecp256k1PublicKey(r);default:throw hs(t.Type)}}function ys(e,t){var r;return ds(t=(null!==(r=t)&&void 0!==r?r:"rsa").toLowerCase()),e.bytes}async function gs(e){const t=We.decode(e),r=t.Data;switch(t.Type){case qe.RSA:return await us.rsa.unmarshalRsaPrivateKey(r);case qe.Ed25519:return us.ed25519.unmarshalEd25519PrivateKey(r);case qe.Secp256k1:return us.secp256k1.unmarshalSecp256k1PrivateKey(r);default:throw hs(t.Type)}}async function ms(e,t){try{const r=await async function(e,t){const r=Tt.decode(e),n=jr();return await n.decrypt(r,t)}(e,t);return await gs(r)}catch(i){}const r=$e.pki.decryptRsaPrivateKey(e,t);if(null===r)throw ue(new Error("Cannot read the key, most likely the password is wrong or not a RSA key"),"ERR_CANNOT_DECRYPT_PEM");let n=$e.asn1.toDer($e.pki.privateKeyToAsn1(r));return n=Lr(n.getBytes(),"ascii"),await us.rsa.unmarshalRsaPrivateKey(n)}const vs=Symbol.for("@libp2p/peer-id");function bs(e){return null!=e&&Boolean(e[vs])}const ws=Object.values(Rr).map((e=>e.decoder)).reduce(((e,t)=>e.or(t)),Rr.identity.decoder);class Es{constructor(e){this.type=e.type,this.multihash=e.multihash,this.privateKey=e.privateKey,Object.defineProperty(this,"string",{enumerable:!1,writable:!0})}get[Symbol.toStringTag](){return"PeerId(".concat(this.toString(),")")}get[vs](){return!0}toString(){return null==this.string&&(this.string=Ct.encode(this.multihash.bytes).slice(1)),this.string}toCID(){return mr.createV1(114,this.multihash)}toBytes(){return this.multihash.bytes}toJSON(){return this.toString()}equals(e){var t;if(e instanceof Uint8Array)return U(this.multihash.bytes,e);if("string"===typeof e)return As(e).equals(this);if(null!=(null===e||void 0===e||null===(t=e.multihash)||void 0===t?void 0:t.bytes))return U(this.multihash.bytes,e.multihash.bytes);throw new Error("not valid Id")}}class _s extends Es{constructor(e){super({...e,type:"RSA"}),this.type="RSA",this.publicKey=e.publicKey}}class Ss extends Es{constructor(e){super({...e,type:"Ed25519"}),this.type="Ed25519",this.publicKey=e.multihash.digest}}class Is extends Es{constructor(e){super({...e,type:"secp256k1"}),this.type="secp256k1",this.publicKey=e.multihash.digest}}function Cs(e){if("RSA"===e.type)return new _s(e);if("Ed25519"===e.type)return new Ss(e);if("secp256k1"===e.type)return new Is(e);throw ue(new Error("Not a PeerId"),"ERR_INVALID_PARAMETERS")}function As(e,t){var r;if(t=null!==(r=t)&&void 0!==r?r:ws,"1"===e.charAt(0)||"Q"===e.charAt(0)){const t=Jt(Ct.decode("z".concat(e)));return e.startsWith("12D")?new Ss({multihash:t}):e.startsWith("16U")?new Is({multihash:t}):new _s({multihash:t})}return Ts(ws.decode(e))}function Ts(e){try{const t=Jt(e);if(t.code===or.code){if(36===t.digest.length)return new Ss({multihash:t});if(37===t.digest.length)return new Is({multihash:t})}if(t.code===nr.code)return new _s({multihash:t})}catch{return function(e){if(null==e||null==e.multihash||null==e.version||1===e.version&&114!==e.code)throw new Error("Supplied PeerID CID is invalid");const t=e.multihash;if(t.code===nr.code)return new _s({multihash:e.multihash});if(t.code===or.code){if(36===t.digest.length)return new Ss({multihash:e.multihash});if(37===t.digest.length)return new Is({multihash:e.multihash})}throw new Error("Supplied PeerID CID is invalid")}(mr.decode(e))}throw new Error("Supplied PeerID CID is invalid")}async function ks(e,t){return 36===e.length?new Ss({multihash:Xt(or.code,e),privateKey:t}):37===e.length?new Is({multihash:Xt(or.code,e),privateKey:t}):new _s({multihash:await nr.digest(e),publicKey:e,privateKey:t})}var Rs=function(e,t){if(e.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n<r.length;n++)r[n]=255;for(var i=0;i<e.length;i++){var s=e.charAt(i),o=s.charCodeAt(0);if(255!==r[o])throw new TypeError(s+" is ambiguous");r[o]=i}var a=e.length,c=e.charAt(0),l=Math.log(a)/Math.log(256),u=Math.log(256)/Math.log(a);function h(e){if("string"!==typeof e)throw new TypeError("Expected String");if(0===e.length)return new Uint8Array;var t=0;if(" "!==e[t]){for(var n=0,i=0;e[t]===c;)n++,t++;for(var s=(e.length-t)*l+1>>>0,o=new Uint8Array(s);e[t];){var u=r[e.charCodeAt(t)];if(255===u)return;for(var h=0,d=s-1;(0!==u||h<i)&&-1!==d;d--,h++)u+=a*o[d]>>>0,o[d]=u%256>>>0,u=u/256>>>0;if(0!==u)throw new Error("Non-zero carry");i=h,t++}if(" "!==e[t]){for(var f=s-i;f!==s&&0===o[f];)f++;for(var p=new Uint8Array(n+(s-f)),y=n;f!==s;)p[y++]=o[f++];return p}}}return{encode:function(t){if(t instanceof Uint8Array||(ArrayBuffer.isView(t)?t=new Uint8Array(t.buffer,t.byteOffset,t.byteLength):Array.isArray(t)&&(t=Uint8Array.from(t))),!(t instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(0===t.length)return"";for(var r=0,n=0,i=0,s=t.length;i!==s&&0===t[i];)i++,r++;for(var o=(s-i)*u+1>>>0,l=new Uint8Array(o);i!==s;){for(var h=t[i],d=0,f=o-1;(0!==h||d<n)&&-1!==f;f--,d++)h+=256*l[f]>>>0,l[f]=h%a>>>0,h=h/a>>>0;if(0!==h)throw new Error("Non-zero carry");n=d,i++}for(var p=o-n;p!==o&&0===l[p];)p++;for(var y=c.repeat(r);p<o;++p)y+=e.charAt(l[p]);return y},decodeUnsafe:h,decode:function(e){var r=h(e);if(r)return r;throw new Error("Non-".concat(t," character"))}}};const Ps=Rs,Ds=(new Uint8Array(0),e=>{if(e instanceof Uint8Array&&"Uint8Array"===e.constructor.name)return e;if(e instanceof ArrayBuffer)return new Uint8Array(e);if(ArrayBuffer.isView(e))return new Uint8Array(e.buffer,e.byteOffset,e.byteLength);throw new Error("Unknown type, must be binary type")});class Ns{constructor(e,t,r){this.name=e,this.prefix=t,this.baseEncode=r}encode(e){if(e instanceof Uint8Array)return"".concat(this.prefix).concat(this.baseEncode(e));throw Error("Unknown type, must be binary type")}}class xs{constructor(e,t,r){if(this.name=e,this.prefix=t,void 0===t.codePointAt(0))throw new Error("Invalid prefix character");this.prefixCodePoint=t.codePointAt(0),this.baseDecode=r}decode(e){if("string"===typeof e){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error("Unable to decode multibase string ".concat(JSON.stringify(e),", ").concat(this.name," decoder only supports inputs prefixed with ").concat(this.prefix));return this.baseDecode(e.slice(this.prefix.length))}throw Error("Can only multibase decode strings")}or(e){return Os(this,e)}}class Ls{constructor(e){this.decoders=e}or(e){return Os(this,e)}decode(e){const t=e[0],r=this.decoders[t];if(r)return r.decode(e);throw RangeError("Unable to decode multibase string ".concat(JSON.stringify(e),", only inputs prefixed with ").concat(Object.keys(this.decoders)," are supported"))}}const Os=(e,t)=>new Ls({...e.decoders||{[e.prefix]:e},...t.decoders||{[t.prefix]:t}});class Bs{constructor(e,t,r,n){this.name=e,this.prefix=t,this.baseEncode=r,this.baseDecode=n,this.encoder=new Ns(e,t,r),this.decoder=new xs(e,t,n)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}const Ms=e=>{let{name:t,prefix:r,encode:n,decode:i}=e;return new Bs(t,r,n,i)},Us=e=>{let{prefix:t,name:r,alphabet:n}=e;const{encode:i,decode:s}=Ps(n,r);return Ms({prefix:t,name:r,encode:i,decode:e=>Ds(s(e))})},Fs=e=>{let{name:t,prefix:r,bitsPerChar:n,alphabet:i}=e;return Ms({prefix:r,name:t,encode:e=>((e,t,r)=>{const n="="===t[t.length-1],i=(1<<r)-1;let s="",o=0,a=0;for(let c=0;c<e.length;++c)for(a=a<<8|e[c],o+=8;o>r;)o-=r,s+=t[i&a>>o];if(o&&(s+=t[i&a<<r-o]),n)for(;s.length*r&7;)s+="=";return s})(e,i,n),decode:e=>((e,t,r,n)=>{const i={};for(let u=0;u<t.length;++u)i[t[u]]=u;let s=e.length;for(;"="===e[s-1];)--s;const o=new Uint8Array(s*r/8|0);let a=0,c=0,l=0;for(let u=0;u<s;++u){const t=i[e[u]];if(void 0===t)throw new SyntaxError("Non-".concat(n," character"));c=c<<r|t,a+=r,a>=8&&(a-=8,o[l++]=255&c>>a)}if(a>=r||255&c<<8-a)throw new SyntaxError("Unexpected end of data");return o})(e,i,n,t)})},Vs=Ms({prefix:"\0",name:"identity",encode:e=>{return t=e,(new TextDecoder).decode(t);var t},decode:e=>(e=>(new TextEncoder).encode(e))(e)}),js=Fs({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1}),Ks=Fs({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3}),qs=Us({prefix:"9",name:"base10",alphabet:"0123456789"}),zs=Fs({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),Hs=Fs({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4}),Ws=Fs({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),Gs=Fs({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),Qs=Fs({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),Ys=Fs({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),$s=Fs({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),Xs=Fs({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),Js=Fs({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),Zs=Fs({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),eo=Fs({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),to=Us({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),ro=Us({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),no=Us({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),io=Us({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),so=Fs({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),oo=Fs({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),ao=Fs({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),co=Fs({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6}),lo=Array.from("\ud83d\ude80\ud83e\ude90\u2604\ud83d\udef0\ud83c\udf0c\ud83c\udf11\ud83c\udf12\ud83c\udf13\ud83c\udf14\ud83c\udf15\ud83c\udf16\ud83c\udf17\ud83c\udf18\ud83c\udf0d\ud83c\udf0f\ud83c\udf0e\ud83d\udc09\u2600\ud83d\udcbb\ud83d\udda5\ud83d\udcbe\ud83d\udcbf\ud83d\ude02\u2764\ud83d\ude0d\ud83e\udd23\ud83d\ude0a\ud83d\ude4f\ud83d\udc95\ud83d\ude2d\ud83d\ude18\ud83d\udc4d\ud83d\ude05\ud83d\udc4f\ud83d\ude01\ud83d\udd25\ud83e\udd70\ud83d\udc94\ud83d\udc96\ud83d\udc99\ud83d\ude22\ud83e\udd14\ud83d\ude06\ud83d\ude44\ud83d\udcaa\ud83d\ude09\u263a\ud83d\udc4c\ud83e\udd17\ud83d\udc9c\ud83d\ude14\ud83d\ude0e\ud83d\ude07\ud83c\udf39\ud83e\udd26\ud83c\udf89\ud83d\udc9e\u270c\u2728\ud83e\udd37\ud83d\ude31\ud83d\ude0c\ud83c\udf38\ud83d\ude4c\ud83d\ude0b\ud83d\udc97\ud83d\udc9a\ud83d\ude0f\ud83d\udc9b\ud83d\ude42\ud83d\udc93\ud83e\udd29\ud83d\ude04\ud83d\ude00\ud83d\udda4\ud83d\ude03\ud83d\udcaf\ud83d\ude48\ud83d\udc47\ud83c\udfb6\ud83d\ude12\ud83e\udd2d\u2763\ud83d\ude1c\ud83d\udc8b\ud83d\udc40\ud83d\ude2a\ud83d\ude11\ud83d\udca5\ud83d\ude4b\ud83d\ude1e\ud83d\ude29\ud83d\ude21\ud83e\udd2a\ud83d\udc4a\ud83e\udd73\ud83d\ude25\ud83e\udd24\ud83d\udc49\ud83d\udc83\ud83d\ude33\u270b\ud83d\ude1a\ud83d\ude1d\ud83d\ude34\ud83c\udf1f\ud83d\ude2c\ud83d\ude43\ud83c\udf40\ud83c\udf37\ud83d\ude3b\ud83d\ude13\u2b50\u2705\ud83e\udd7a\ud83c\udf08\ud83d\ude08\ud83e\udd18\ud83d\udca6\u2714\ud83d\ude23\ud83c\udfc3\ud83d\udc90\u2639\ud83c\udf8a\ud83d\udc98\ud83d\ude20\u261d\ud83d\ude15\ud83c\udf3a\ud83c\udf82\ud83c\udf3b\ud83d\ude10\ud83d\udd95\ud83d\udc9d\ud83d\ude4a\ud83d\ude39\ud83d\udde3\ud83d\udcab\ud83d\udc80\ud83d\udc51\ud83c\udfb5\ud83e\udd1e\ud83d\ude1b\ud83d\udd34\ud83d\ude24\ud83c\udf3c\ud83d\ude2b\u26bd\ud83e\udd19\u2615\ud83c\udfc6\ud83e\udd2b\ud83d\udc48\ud83d\ude2e\ud83d\ude46\ud83c\udf7b\ud83c\udf43\ud83d\udc36\ud83d\udc81\ud83d\ude32\ud83c\udf3f\ud83e\udde1\ud83c\udf81\u26a1\ud83c\udf1e\ud83c\udf88\u274c\u270a\ud83d\udc4b\ud83d\ude30\ud83e\udd28\ud83d\ude36\ud83e\udd1d\ud83d\udeb6\ud83d\udcb0\ud83c\udf53\ud83d\udca2\ud83e\udd1f\ud83d\ude41\ud83d\udea8\ud83d\udca8\ud83e\udd2c\u2708\ud83c\udf80\ud83c\udf7a\ud83e\udd13\ud83d\ude19\ud83d\udc9f\ud83c\udf31\ud83d\ude16\ud83d\udc76\ud83e\udd74\u25b6\u27a1\u2753\ud83d\udc8e\ud83d\udcb8\u2b07\ud83d\ude28\ud83c\udf1a\ud83e\udd8b\ud83d\ude37\ud83d\udd7a\u26a0\ud83d\ude45\ud83d\ude1f\ud83d\ude35\ud83d\udc4e\ud83e\udd32\ud83e\udd20\ud83e\udd27\ud83d\udccc\ud83d\udd35\ud83d\udc85\ud83e\uddd0\ud83d\udc3e\ud83c\udf52\ud83d\ude17\ud83e\udd11\ud83c\udf0a\ud83e\udd2f\ud83d\udc37\u260e\ud83d\udca7\ud83d\ude2f\ud83d\udc86\ud83d\udc46\ud83c\udfa4\ud83d\ude47\ud83c\udf51\u2744\ud83c\udf34\ud83d\udca3\ud83d\udc38\ud83d\udc8c\ud83d\udccd\ud83e\udd40\ud83e\udd22\ud83d\udc45\ud83d\udca1\ud83d\udca9\ud83d\udc50\ud83d\udcf8\ud83d\udc7b\ud83e\udd10\ud83e\udd2e\ud83c\udfbc\ud83e\udd75\ud83d\udea9\ud83c\udf4e\ud83c\udf4a\ud83d\udc7c\ud83d\udc8d\ud83d\udce3\ud83e\udd42"),uo=lo.reduce(((e,t,r)=>(e[r]=t,e)),[]),ho=lo.reduce(((e,t,r)=>(e[t.codePointAt(0)]=r,e)),[]);const fo=Ms({prefix:"\ud83d\ude80",name:"base256emoji",encode:function(e){return e.reduce(((e,t)=>e+=uo[t]),"")},decode:function(e){const t=[];for(const r of e){const e=ho[r.codePointAt(0)];if(void 0===e)throw new Error("Non-base256emoji character: ".concat(r));t.push(e)}return new Uint8Array(t)}});var po=function e(t,r,n){r=r||[];var i=n=n||0;for(;t>=yo;)r[n++]=255&t|128,t/=128;for(;-128&t;)r[n++]=255&t|128,t>>>=7;return r[n]=0|t,e.bytes=n-i+1,r},yo=Math.pow(2,31);var go=function e(t,r){var n,i=0,s=0,o=r=r||0,a=t.length;do{if(o>=a)throw e.bytes=0,new RangeError("Could not decode varint");n=t[o++],i+=s<28?(127&n)<<s:(127&n)*Math.pow(2,s),s+=7}while(n>=128);return e.bytes=o-r,i};var mo=Math.pow(2,7),vo=Math.pow(2,14),bo=Math.pow(2,21),wo=Math.pow(2,28),Eo=Math.pow(2,35),_o=Math.pow(2,42),So=Math.pow(2,49),Io=Math.pow(2,56),Co=Math.pow(2,63);const Ao={encode:po,decode:go,encodingLength:function(e){return e<mo?1:e<vo?2:e<bo?3:e<wo?4:e<Eo?5:e<_o?6:e<So?7:e<Io?8:e<Co?9:10}},To=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;const r=Ao.decode(e,t);return[r,Ao.decode.bytes]},ko=function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return Ao.encode(e,t,r),t},Ro=e=>Ao.encodingLength(e),Po=(e,t)=>{const r=t.byteLength,n=Ro(e),i=n+Ro(r),s=new Uint8Array(i+r);return ko(e,s,0),ko(r,s,n),s.set(t,i),new No(e,r,t,s)},Do=e=>{const t=Ds(e),[r,n]=To(t),[i,s]=To(t.subarray(n)),o=t.subarray(n+s);if(o.byteLength!==i)throw new Error("Incorrect length");return new No(r,i,o,t)};class No{constructor(e,t,r,n){this.code=e,this.size=t,this.digest=r,this.bytes=n}}const xo=e=>{let{name:t,code:r,encode:n}=e;return new Lo(t,r,n)};class Lo{constructor(e,t,r){this.name=e,this.code=t,this.encode=r}digest(e){if(e instanceof Uint8Array){const t=this.encode(e);return t instanceof Uint8Array?Po(this.code,t):t.then((e=>Po(this.code,e)))}throw Error("Unknown type, must be binary type")}}const Oo=e=>async t=>new Uint8Array(await crypto.subtle.digest(e,t)),Bo=xo({name:"sha2-256",code:18,encode:Oo("SHA-256")}),Mo=xo({name:"sha2-512",code:19,encode:Oo("SHA-512")}),Uo=Ds,Fo={code:0,name:"identity",encode:Uo,digest:e=>Po(0,Uo(e))},Vo="raw",jo=85,Ko=e=>Ds(e),qo=e=>Ds(e),zo=new TextEncoder,Ho=new TextDecoder,Wo="json",Go=512,Qo=e=>zo.encode(JSON.stringify(e)),Yo=e=>JSON.parse(Ho.decode(e)),$o=new WeakMap,Xo=e=>{const t=$o.get(e);if(null==t){const t=new Map;return $o.set(e,t),t}return t};class Jo{constructor(e,t,r,n){this.code=t,this.version=e,this.multihash=r,this.bytes=n,this["/"]=n}get asCID(){return this}get byteOffset(){return this.bytes.byteOffset}get byteLength(){return this.bytes.byteLength}toV0(){switch(this.version){case 0:return this;case 1:{const{code:e,multihash:t}=this;if(e!==ra)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(t.code!==na)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return Jo.createV0(t)}default:throw Error("Can not convert CID version ".concat(this.version," to version 0. This is a bug please report"))}}toV1(){switch(this.version){case 0:{const{code:e,digest:t}=this.multihash,r=Po(e,t);return Jo.createV1(this.code,r)}case 1:return this;default:throw Error("Can not convert CID version ".concat(this.version," to version 1. This is a bug please report"))}}equals(e){return Jo.equals(this,e)}static equals(e,t){const r=t;return r&&e.code===r.code&&e.version===r.version&&((e,t)=>{if(e===t)return!0;{const r=t;return e.code===r.code&&e.size===r.size&&r.bytes instanceof Uint8Array&&((e,t)=>{if(e===t)return!0;if(e.byteLength!==t.byteLength)return!1;for(let r=0;r<e.byteLength;r++)if(e[r]!==t[r])return!1;return!0})(e.bytes,r.bytes)}})(e.multihash,r.multihash)}toString(e){return((e,t)=>{const{bytes:r,version:n}=e;return 0===n?ea(r,Xo(e),t||no.encoder):ta(r,Xo(e),t||Ws.encoder)})(this,e)}toJSON(){return{code:this.code,version:this.version,hash:this.multihash.bytes}}link(){return this}get[Symbol.toStringTag](){return"CID"}[Symbol.for("nodejs.util.inspect.custom")](){return"CID(".concat(this.toString(),")")}static asCID(e){if(null==e)return null;const t=e;if(t instanceof Jo)return t;if(null!=t["/"]&&t["/"]===t.bytes||t.asCID===t){const{version:e,code:r,multihash:n,bytes:i}=t;return new Jo(e,r,n,i||ia(e,r,n.bytes))}if(!0===t[sa]){const{version:e,multihash:r,code:n}=t,i=Do(r);return Jo.create(e,n,i)}return null}static create(e,t,r){if("number"!==typeof t)throw new Error("String codecs are no longer supported");if(!(r.bytes instanceof Uint8Array))throw new Error("Invalid digest");switch(e){case 0:if(t!==ra)throw new Error("Version 0 CID must use dag-pb (code: ".concat(ra,") block encoding"));return new Jo(e,t,r,r.bytes);case 1:{const n=ia(e,t,r.bytes);return new Jo(e,t,r,n)}default:throw new Error("Invalid version")}}static createV0(e){return Jo.create(0,ra,e)}static createV1(e,t){return Jo.create(1,e,t)}static decode(e){const[t,r]=Jo.decodeFirst(e);if(r.length)throw new Error("Incorrect length");return t}static decodeFirst(e){const t=Jo.inspectBytes(e),r=t.size-t.multihashSize,n=Ds(e.subarray(r,r+t.multihashSize));if(n.byteLength!==t.multihashSize)throw new Error("Incorrect length");const i=n.subarray(t.multihashSize-t.digestSize),s=new No(t.multihashCode,t.digestSize,i,n);return[0===t.version?Jo.createV0(s):Jo.createV1(t.codec,s),e.subarray(t.size)]}static inspectBytes(e){let t=0;const r=()=>{const[r,n]=To(e.subarray(t));return t+=n,r};let n=r(),i=ra;if(18===n?(n=0,t=0):i=r(),0!==n&&1!==n)throw new RangeError("Invalid CID version ".concat(n));const s=t,o=r(),a=r(),c=t+a;return{version:n,codec:i,multihashCode:o,digestSize:a,multihashSize:c-s,size:c}}static parse(e,t){const[r,n]=Zo(e,t),i=Jo.decode(n);return Xo(i).set(r,e),i}}const Zo=(e,t)=>{switch(e[0]){case"Q":{const r=t||no;return[no.prefix,r.decode("".concat(no.prefix).concat(e))]}case no.prefix:{const r=t||no;return[no.prefix,r.decode(e)]}case Ws.prefix:{const r=t||Ws;return[Ws.prefix,r.decode(e)]}default:if(null==t)throw Error("To parse non base32 or base58btc encoded CID multibase decoder must be provided");return[e[0],t.decode(e)]}},ea=(e,t,r)=>{const{prefix:n}=r;if(n!==no.prefix)throw Error("Cannot string encode V0 in ".concat(r.name," encoding"));const i=t.get(n);if(null==i){const i=r.encode(e).slice(1);return t.set(n,i),i}return i},ta=(e,t,r)=>{const{prefix:n}=r,i=t.get(n);if(null==i){const i=r.encode(e);return t.set(n,i),i}return i},ra=112,na=18,ia=(e,t,r)=>{const n=Ro(e),i=n+Ro(t),s=new Uint8Array(i+r.byteLength);return ko(e,s,0),ko(t,s,n),s.set(r,i),s},sa=Symbol.for("@ipld/js-cid/CID"),oa={...m,...v,...b,...w,...E,..._,...S,...I,...C,...A};function aa(e,t,r,n){return{name:e,prefix:t,encoder:{name:e,prefix:t,encode:r},decoder:{decode:n}}}const ca=aa("utf8","u",(e=>"u"+new TextDecoder("utf8").decode(e)),(e=>(new TextEncoder).encode(e.substring(1)))),la=aa("ascii","a",(e=>{let t="a";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return t}),(e=>{const t=Ne((e=e.substring(1)).length);for(let r=0;r<e.length;r++)t[r]=e.charCodeAt(r);return t})),ua={utf8:ca,"utf-8":ca,hex:oa.base16,latin1:la,ascii:la,binary:la,...oa};function ha(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"utf8";const r=ua[t];if(null==r)throw new Error('Unsupported encoding "'.concat(t,'"'));return"utf8"!==t&&"utf-8"!==t||null==globalThis.Buffer||null==globalThis.Buffer.from?r.decoder.decode("".concat(r.prefix).concat(e)):De(globalThis.Buffer.from(e,"utf-8"))}var da=__webpack_require__(4382),fa=__webpack_require__(8536),pa=__webpack_require__(3461),ya=__webpack_require__(1223);__webpack_require__(9584)._configure(),da._configure(fa),pa._configure(ya);const ga=["uint64","int64","sint64","fixed64","sfixed64"];function ma(e){return function(e){for(const t of ga){if(null==e[t])continue;const r=e[t];e[t]=function(){return BigInt(r.call(this).toString())}}return e}(new da(e))}function va(){return function(e){for(const t of ga){if(null==e[t])continue;const r=e[t];e[t]=function(e){return r.call(this,e.toString())}}return e}(pa.create())}function ba(e,t){const r=ma(e instanceof Uint8Array?e:e.subarray());return t.decode(r)}function wa(e,t){const r=va();return t.encode(e,r,{lengthDelimited:!1}),r.finish()}var Ea,_a,Sa;function Ia(e,t,r,n){return{name:e,type:t,encode:r,decode:n}}function Ca(e){function t(t){if(null==e[t.toString()])throw new Error("Invalid enum value");return e[t]}return Ia("enum",Ea.VARINT,(function(e,r){const n=t(e);r.int32(n)}),(function(e){return t(e.int32())}))}function Aa(e,t){return Ia("message",Ea.LENGTH_DELIMITED,e,t)}async function Ta(e,t,r){const n=await async function(e,t){if(null==e.privateKey)throw new Error("PrivateKey was missing from PeerId");const r=await gs(e.privateKey);return await r.sign(t)}(e,Pa(t));if(null==e.publicKey)throw new Error("PublicKey was missing from local PeerId");return function(e,t,r){return Sa.encode({identityKey:e,identitySig:t,extensions:null!==r&&void 0!==r?r:{webtransportCerthashes:[]}}).subarray()}(e.publicKey,n,r)}async function ka(e){return await ks(e.identityKey)}function Ra(e){return Sa.decode(e)}function Pa(e){const t=ha("noise-libp2p-static-key:");return xe([t,e],t.length+e.length)}async function Da(e,t,r){const n=await ks(t.identityKey);if(!n.equals(r))throw new Error("Peer ID doesn't match libp2p public key.");const i=Pa(e);if(null==n.publicKey)throw new Error("PublicKey was missing from PeerId");if(null==t.identitySig)throw new Error("Signature was missing from message");const s=ps(n.publicKey);if(!await s.verify(i,t.identitySig))throw new Error("Static key doesn't match to peer that signed payload!");return n}function Na(e){return e instanceof Uint8Array&&32===e.length}function xa(e,t){if(e===t)return!0;if(e.byteLength!==t.byteLength)return!1;for(let r=0;r<e.byteLength;r++)if(e[r]!==t[r])return!1;return!0}function La(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"utf8";const r=ua[t];if(null==r)throw new Error('Unsupported encoding "'.concat(t,'"'));return"utf8"!==t&&"utf-8"!==t||null==globalThis.Buffer||null==globalThis.Buffer.from?r.encoder.encode(e).substring(1):globalThis.Buffer.from(e.buffer,e.byteOffset,e.byteLength).toString("utf8")}!function(e){e[e.VARINT=0]="VARINT",e[e.BIT64=1]="BIT64",e[e.LENGTH_DELIMITED=2]="LENGTH_DELIMITED",e[e.START_GROUP=3]="START_GROUP",e[e.END_GROUP=4]="END_GROUP",e[e.BIT32=5]="BIT32"}(Ea||(Ea={})),function(e){let t;e.codec=()=>(null==t&&(t=Aa((function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!1!==r.lengthDelimited&&t.fork(),null!=e.webtransportCerthashes)for(const n of e.webtransportCerthashes)t.uint32(10),t.bytes(n);!1!==r.lengthDelimited&&t.ldelim()}),((e,t)=>{const r={webtransportCerthashes:[]},n=null==t?e.len:e.pos+t;for(;e.pos<n;){const t=e.uint32();if(t>>>3===1)r.webtransportCerthashes.push(e.bytes());else e.skipType(7&t)}return r}))),t),e.encode=t=>wa(t,e.codec()),e.decode=t=>ba(t,e.codec())}(_a||(_a={})),function(e){let t;e.codec=()=>(null==t&&(t=Aa((function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};!1!==r.lengthDelimited&&t.fork(),(!0===r.writeDefaults||null!=e.identityKey&&e.identityKey.byteLength>0)&&(t.uint32(10),t.bytes(e.identityKey)),(!0===r.writeDefaults||null!=e.identitySig&&e.identitySig.byteLength>0)&&(t.uint32(18),t.bytes(e.identitySig)),null!=e.extensions&&(t.uint32(34),_a.codec().encode(e.extensions,t,{writeDefaults:!1})),!1!==r.lengthDelimited&&t.ldelim()}),((e,t)=>{const r={identityKey:new Uint8Array(0),identitySig:new Uint8Array(0)},n=null==t?e.len:e.pos+t;for(;e.pos<n;){const t=e.uint32();switch(t>>>3){case 1:r.identityKey=e.bytes();break;case 2:r.identitySig=e.bytes();break;case 4:r.extensions=_a.codec().decode(e,e.uint32());break;default:e.skipType(7&t)}}return r}))),t),e.encode=t=>wa(t,e.codec()),e.decode=t=>ba(t,e.codec())}(Sa||(Sa={}));var Oa=__webpack_require__(7420);function Ba(e){return Object.assign(Oa(e),{error:Oa("".concat(e,":error")),trace:Oa("".concat(e,":trace"))})}Oa.formatters.b=e=>null==e?"undefined":Ct.baseEncode(e),Oa.formatters.t=e=>null==e?"undefined":pt.baseEncode(e),Oa.formatters.m=e=>null==e?"undefined":Tt.baseEncode(e),Oa.formatters.p=e=>null==e?"undefined":e.toString(),Oa.formatters.c=e=>null==e?"undefined":e.toString(),Oa.formatters.k=e=>null==e?"undefined":e.toString();const Ma=Ba("libp2p:noise");let Ua;function Fa(e){e?(Ua("LOCAL_PUBLIC_EPHEMERAL_KEY ".concat(La(e.publicKey,"hex"))),Ua("LOCAL_PRIVATE_EPHEMERAL_KEY ".concat(La(e.privateKey,"hex")))):Ua("Missing local ephemeral keys.")}function Va(e){Ua("REMOTE_EPHEMERAL_PUBLIC_KEY ".concat(La(e,"hex")))}Ua=Ce?Ma:Object.assign((()=>{}),{enabled:!1,trace:()=>{},error:()=>{}});class ja{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;this.n=e,this.bytes=new Uint8Array(12),this.view=new DataView(this.bytes.buffer,this.bytes.byteOffset,this.bytes.byteLength),this.view.setUint32(4,e,!0)}increment(){this.n++,this.view.setUint32(4,this.n,!0)}getBytes(){return this.bytes}getUint64(){return this.n}assertValue(){if(this.n>4294967295)throw new Error("Cipherstate has reached maximum n, a new handshake must be performed")}}class Ka extends class{constructor(e){this.crypto=e}encryptWithAd(e,t,r){const n=this.encrypt(e.k,e.n,t,r);return e.n.increment(),n}decryptWithAd(e,t,r){const{plaintext:n,valid:i}=this.decrypt(e.k,e.n,t,r);return i&&e.n.increment(),{plaintext:n,valid:i}}hasKey(e){return!this.isEmptyKey(e.k)}createEmptyKey(){return new Uint8Array(32)}isEmptyKey(e){return xa(this.createEmptyKey(),e)}encrypt(e,t,r,n){return t.assertValue(),this.crypto.chaCha20Poly1305Encrypt(n,t.getBytes(),r,e)}encryptAndHash(e,t){let r;return r=this.hasKey(e.cs)?this.encryptWithAd(e.cs,e.h,t):t,this.mixHash(e,r),r}decrypt(e,t,r,n){t.assertValue();const i=this.crypto.chaCha20Poly1305Decrypt(n,t.getBytes(),r,e);return i?{plaintext:i,valid:!0}:{plaintext:new Uint8Array(0),valid:!1}}decryptAndHash(e,t){let r,n=!0;return this.hasKey(e.cs)?({plaintext:r,valid:n}=this.decryptWithAd(e.cs,e.h,t)):r=t,this.mixHash(e,t),{plaintext:r,valid:n}}dh(e,t){try{const r=this.crypto.generateX25519SharedKey(e,t);return 32===r.length?r:r.subarray(0,32)}catch(r){return Ma(r.message),new Uint8Array(32)}}mixHash(e,t){e.h=this.getHash(e.h,t)}getHash(e,t){return this.crypto.hashSHA256(xe([e,t],e.length+t.length))}mixKey(e,t){const[r,n]=this.crypto.getHKDF(e.ck,t);e.cs=this.initializeKey(n),e.ck=r}initializeKey(e){return{k:e,n:new ja}}initializeSymmetric(e){const t=ha(e,"utf-8"),r=this.hashProtocolName(t),n=r,i=this.createEmptyKey();return{cs:this.initializeKey(i),ck:n,h:r}}hashProtocolName(e){if(e.length<=32){const t=new Uint8Array(32);return t.set(e),t}return this.getHash(e,new Uint8Array(0))}split(e){const[t,r]=this.crypto.getHKDF(e.ck,new Uint8Array(0));return{cs1:this.initializeKey(t),cs2:this.initializeKey(r)}}writeMessageRegular(e,t){const r=this.encryptWithAd(e,new Uint8Array(0),t);return{ne:this.createEmptyKey(),ns:new Uint8Array(0),ciphertext:r}}readMessageRegular(e,t){return this.decryptWithAd(e,new Uint8Array(0),t.ciphertext)}}{initializeInitiator(e,t,r,n){const i=this.initializeSymmetric("Noise_XX_25519_ChaChaPoly_SHA256");this.mixHash(i,e);return{ss:i,s:t,rs:r,psk:n,re:new Uint8Array(32)}}initializeResponder(e,t,r,n){const i=this.initializeSymmetric("Noise_XX_25519_ChaChaPoly_SHA256");this.mixHash(i,e);return{ss:i,s:t,rs:r,psk:n,re:new Uint8Array(32)}}writeMessageA(e,t,r){const n=new Uint8Array(0);e.e=void 0!==r?r:this.crypto.generateX25519KeyPair();const i=e.e.publicKey;this.mixHash(e.ss,i);return{ne:i,ns:n,ciphertext:this.encryptAndHash(e.ss,t)}}writeMessageB(e,t){e.e=this.crypto.generateX25519KeyPair();const r=e.e.publicKey;this.mixHash(e.ss,r),this.mixKey(e.ss,this.dh(e.e.privateKey,e.re));const n=e.s.publicKey,i=this.encryptAndHash(e.ss,n);this.mixKey(e.ss,this.dh(e.s.privateKey,e.re));return{ne:r,ns:i,ciphertext:this.encryptAndHash(e.ss,t)}}writeMessageC(e,t){const r=e.s.publicKey,n=this.encryptAndHash(e.ss,r);this.mixKey(e.ss,this.dh(e.s.privateKey,e.re));const i=this.encryptAndHash(e.ss,t),s={ne:this.createEmptyKey(),ns:n,ciphertext:i},{cs1:o,cs2:a}=this.split(e.ss);return{h:e.ss.h,messageBuffer:s,cs1:o,cs2:a}}readMessageA(e,t){return Na(t.ne)&&(e.re=t.ne),this.mixHash(e.ss,e.re),this.decryptAndHash(e.ss,t.ciphertext)}readMessageB(e,t){if(Na(t.ne)&&(e.re=t.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));const{plaintext:r,valid:n}=this.decryptAndHash(e.ss,t.ns);n&&Na(r)&&(e.rs=r),this.mixKey(e.ss,this.dh(e.e.privateKey,e.rs));const{plaintext:i,valid:s}=this.decryptAndHash(e.ss,t.ciphertext);return{plaintext:i,valid:n&&s}}readMessageC(e,t){const{plaintext:r,valid:n}=this.decryptAndHash(e.ss,t.ns);if(n&&Na(r)&&(e.rs=r),!e.e)throw new Error("Handshake state `e` param is missing.");this.mixKey(e.ss,this.dh(e.e.privateKey,e.rs));const{plaintext:i,valid:s}=this.decryptAndHash(e.ss,t.ciphertext),{cs1:o,cs2:a}=this.split(e.ss);return{h:e.ss.h,plaintext:i,valid:n&&s,cs1:o,cs2:a}}initSession(e,t,r){const n=this.createEmptyKey(),i=new Uint8Array(32);let s;return s=e?this.initializeInitiator(t,r,i,n):this.initializeResponder(t,r,i,n),{hs:s,i:e,mc:0}}sendMessage(e,t,r){let n;if(0===e.mc)n=this.writeMessageA(e.hs,t,r);else if(1===e.mc)n=this.writeMessageB(e.hs,t);else if(2===e.mc){const{h:r,messageBuffer:i,cs1:s,cs2:o}=this.writeMessageC(e.hs,t);n=i,e.h=r,e.cs1=s,e.cs2=o}else{if(!(e.mc>2))throw new Error("Session invalid.");if(e.i){if(!e.cs1)throw new Error("CS1 (cipher state) is not defined");n=this.writeMessageRegular(e.cs1,t)}else{if(!e.cs2)throw new Error("CS2 (cipher state) is not defined");n=this.writeMessageRegular(e.cs2,t)}}return e.mc++,n}recvMessage(e,t){let r=new Uint8Array(0),n=!1;if(0===e.mc)({plaintext:r,valid:n}=this.readMessageA(e.hs,t));else if(1===e.mc)({plaintext:r,valid:n}=this.readMessageB(e.hs,t));else if(2===e.mc){const{h:i,plaintext:s,valid:o,cs1:a,cs2:c}=this.readMessageC(e.hs,t);r=s,n=o,e.h=i,e.cs1=a,e.cs2=c}return e.mc++,{plaintext:r,valid:n}}}class qa{constructor(e,t,r,n,i,s,o,a){this.remoteExtensions={webtransportCerthashes:[]},this.isInitiator=e,this.payload=t,this.prologue=r,this.staticKeypair=i,this.connection=s,o&&(this.remotePeer=o),this.xx=null!==a&&void 0!==a?a:new Ka(n),this.session=this.xx.initSession(this.isInitiator,this.prologue,this.staticKeypair)}async propose(){var e;if(e=this.session.hs.s,Ua("LOCAL_STATIC_PUBLIC_KEY ".concat(La(e.publicKey,"hex"))),Ua("LOCAL_STATIC_PRIVATE_KEY ".concat(La(e.privateKey,"hex"))),this.isInitiator){Ma("Stage 0 - Initiator starting to send first message.");const e=this.xx.sendMessage(this.session,new Uint8Array(0));this.connection.writeLP(function(e){return xe([e.ne,e.ciphertext],e.ne.length+e.ciphertext.length)}(e)),Ma("Stage 0 - Initiator finished sending first message."),Fa(this.session.hs.e)}else{Ma("Stage 0 - Responder waiting to receive first message...");const e=function(e){if(e.length<32)throw new Error("Cannot decode stage 0 MessageBuffer: length less than 32 bytes.");return{ne:e.subarray(0,32),ciphertext:e.subarray(32,e.length),ns:new Uint8Array(0)}}((await this.connection.readLP()).subarray()),{valid:t}=this.xx.recvMessage(this.session,e);if(!t)throw new Me("xx handshake stage 0 validation fail");Ma("Stage 0 - Responder received first message."),Va(this.session.hs.re)}}async exchange(){if(this.isInitiator){Ma("Stage 1 - Initiator waiting to receive first message from responder...");const r=function(e){if(e.length<80)throw new Error("Cannot decode stage 1 MessageBuffer: length less than 80 bytes.");return{ne:e.subarray(0,32),ns:e.subarray(32,80),ciphertext:e.subarray(80,e.length)}}((await this.connection.readLP()).subarray()),{plaintext:n,valid:i}=this.xx.recvMessage(this.session,r);if(!i)throw new Me("xx handshake stage 1 validation fail");Ma("Stage 1 - Initiator received the message."),Va(this.session.hs.re),e=this.session.hs.rs,Ua("REMOTE_STATIC_PUBLIC_KEY ".concat(La(e,"hex"))),Ma("Initiator going to check remote's signature...");try{const e=Ra(n);this.remotePeer=this.remotePeer||await ka(e),await Da(this.session.hs.rs,e,this.remotePeer),this.setRemoteNoiseExtension(e.extensions)}catch(t){throw new Be("Error occurred while verifying signed payload: ".concat(t.message))}Ma("All good with the signature!")}else{Ma("Stage 1 - Responder sending out first message with signed payload and static key.");const e=this.xx.sendMessage(this.session,this.payload);this.connection.writeLP(function(e){return xe([e.ne,e.ns,e.ciphertext],e.ne.length+e.ns.length+e.ciphertext.length)}(e)),Ma("Stage 1 - Responder sent the second handshake message with signed payload."),Fa(this.session.hs.e)}var e}async finish(){if(this.isInitiator){Ma("Stage 2 - Initiator sending third handshake message.");const e=this.xx.sendMessage(this.session,this.payload);this.connection.writeLP(function(e){return xe([e.ns,e.ciphertext],e.ns.length+e.ciphertext.length)}(e)),Ma("Stage 2 - Initiator sent message with signed payload.")}else{Ma("Stage 2 - Responder waiting for third handshake message...");const e=function(e){if(e.length<48)throw new Error("Cannot decode stage 2 MessageBuffer: length less than 48 bytes.");return{ne:new Uint8Array(0),ns:e.subarray(0,48),ciphertext:e.subarray(48,e.length)}}((await this.connection.readLP()).subarray()),{plaintext:r,valid:n}=this.xx.recvMessage(this.session,e);if(!n)throw new Me("xx handshake stage 2 validation fail");Ma("Stage 2 - Responder received the message, finished handshake.");try{const e=Ra(r);this.remotePeer=this.remotePeer||await ka(e),await Da(this.session.hs.rs,e,this.remotePeer),this.setRemoteNoiseExtension(e.extensions)}catch(t){throw new Be("Error occurred while verifying signed payload: ".concat(t.message))}}var e;(e=this.session).cs1&&e.cs2?(Ua("CIPHER_STATE_1 ".concat(e.cs1.n.getUint64()," ").concat(La(e.cs1.k,"hex"))),Ua("CIPHER_STATE_2 ".concat(e.cs2.n.getUint64()," ").concat(La(e.cs2.k,"hex")))):Ua("Missing cipher state.")}encrypt(e,t){const r=this.getCS(t);return this.xx.encryptWithAd(r,new Uint8Array(0),e)}decrypt(e,t){const r=this.getCS(t,!1);return this.xx.decryptWithAd(r,new Uint8Array(0),e)}getRemoteStaticKey(){return this.session.hs.rs}getCS(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(!e.cs1||!e.cs2)throw new Me("Handshake not completed properly, cipher state does not exist.");return this.isInitiator?t?e.cs1:e.cs2:t?e.cs2:e.cs1}setRemoteNoiseExtension(e){e&&(this.remoteExtensions=e)}}class za{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.protocol="/noise";const{staticNoiseKey:t,extensions:r,crypto:n,prologueBytes:i,metrics:s}=e;this.crypto=null!==n&&void 0!==n?n:Pe,this.extensions=r,this.metrics=s?function(e){return{xxHandshakeSuccesses:e.registerCounter("libp2p_noise_xxhandshake_successes_total",{help:"Total count of noise xxHandshakes successes_"}),xxHandshakeErrors:e.registerCounter("libp2p_noise_xxhandshake_error_total",{help:"Total count of noise xxHandshakes errors"}),encryptedPackets:e.registerCounter("libp2p_noise_encrypted_packets_total",{help:"Total count of noise encrypted packets successfully"}),decryptedPackets:e.registerCounter("libp2p_noise_decrypted_packets_total",{help:"Total count of noise decrypted packets"}),decryptErrors:e.registerCounter("libp2p_noise_decrypt_errors_total",{help:"Total count of noise decrypt errors"})}}(s):void 0,this.staticKeys=t?this.crypto.generateX25519KeyPairFromSeed(t):this.crypto.generateX25519KeyPair(),this.prologue=null!==i&&void 0!==i?i:new Uint8Array(0)}async secureOutbound(e,t,r){const n=pe(t,{lengthEncoder:Le,lengthDecoder:Oe,maxDataLength:Ie}),i=await this.performHandshake({connection:n,isInitiator:!0,localPeer:e,remotePeer:r});return{conn:await this.createSecureConnection(n,i),remoteExtensions:i.remoteExtensions,remotePeer:i.remotePeer}}async secureInbound(e,t,r){const n=pe(t,{lengthEncoder:Le,lengthDecoder:Oe,maxDataLength:Ie}),i=await this.performHandshake({connection:n,isInitiator:!1,localPeer:e,remotePeer:r});return{conn:await this.createSecureConnection(n,i),remotePeer:i.remotePeer,remoteExtensions:i.remoteExtensions}}async performHandshake(e){const t=await Ta(e.localPeer,this.staticKeys.publicKey,this.extensions);return await this.performXXHandshake(e,t)}async performXXHandshake(e,t){const{isInitiator:r,remotePeer:n,connection:i}=e,s=new qa(r,t,this.prologue,this.crypto,this.staticKeys,i,n);try{var o;await s.propose(),await s.exchange(),await s.finish(),null===(o=this.metrics)||void 0===o||o.xxHandshakeSuccesses.increment()}catch(c){var a;if(null===(a=this.metrics)||void 0===a||a.xxHandshakeErrors.increment(),c instanceof Error)throw c.message="Error occurred during XX handshake: ".concat(c.message),c}return s}async createSecureConnection(e,t){const[r,n]=function(){const e=ye(),t=ye();return[{source:e.source,sink:t.sink},{source:t.source,sink:e.sink}]}(),i=e.unwrap();return await Ee(r,function(e,t){return async function*(r){for await(const n of r)for(let r=0;r<n.length;r+=65519){let i=r+65519;i>n.length&&(i=n.length);const s=e.encrypt(n.subarray(r,i),e.session);null===t||void 0===t||t.encryptedPackets.increment(),yield Le(s.byteLength),yield s}}}(t,this.metrics),i,fe({lengthDecoder:Oe}),function(e,t){return async function*(r){for await(const n of r)for(let r=0;r<n.length;r+=Ie){let i=r+Ie;i>n.length&&(i=n.length);const{plaintext:s,valid:o}=e.decrypt(n.subarray(r,i),e.session);if(!o)throw null===t||void 0===t||t.decryptErrors.increment(),new Error("Failed to validate decrypted chunk");null===t||void 0===t||t.decryptedPackets.increment(),yield s}}}(t,this.metrics),r),n}}function Ha(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return()=>new za(e)}function Wa(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Ga=new class{constructor(){Wa(this,"index",0),Wa(this,"input","")}new(e){return this.index=0,this.input=e,this}readAtomically(e){const t=this.index,r=e();return void 0===r&&(this.index=t),r}parseWith(e){const t=e();if(this.index===this.input.length)return t}peekChar(){if(!(this.index>=this.input.length))return this.input[this.index]}readChar(){if(!(this.index>=this.input.length))return this.input[this.index++]}readGivenChar(e){return this.readAtomically((()=>{const t=this.readChar();if(t===e)return t}))}readSeparator(e,t,r){return this.readAtomically((()=>{if(!(t>0&&void 0===this.readGivenChar(e)))return r()}))}readNumber(e,t,r,n){return this.readAtomically((()=>{let i=0,s=0;const o=this.peekChar();if(void 0===o)return;const a="0"===o,c=2**(8*n)-1;for(;;){const r=this.readAtomically((()=>{const t=this.readChar();if(void 0===t)return;const r=Number.parseInt(t,e);return Number.isNaN(r)?void 0:r}));if(void 0===r)break;if(i*=e,i+=r,i>c)return;if(s+=1,void 0!==t&&s>t)return}return 0===s||!r&&a&&s>1?void 0:i}))}readIPv4Addr(){return this.readAtomically((()=>{const e=new Uint8Array(4);for(let t=0;t<e.length;t++){const r=this.readSeparator(".",t,(()=>this.readNumber(10,3,!1,1)));if(void 0===r)return;e[t]=r}return e}))}readIPv6Addr(){const e=e=>{for(let t=0;t<e.length/2;t++){const r=2*t;if(t<e.length-3){const n=this.readSeparator(":",t,(()=>this.readIPv4Addr()));if(void 0!==n)return e[r]=n[0],e[r+1]=n[1],e[r+2]=n[2],e[r+3]=n[3],[r+4,!0]}const n=this.readSeparator(":",t,(()=>this.readNumber(16,4,!0,2)));if(void 0===n)return[r,!1];e[r]=n>>8,e[r+1]=255&n}return[e.length,!1]};return this.readAtomically((()=>{const t=new Uint8Array(16),[r,n]=e(t);if(16===r)return t;if(n)return;if(void 0===this.readGivenChar(":"))return;if(void 0===this.readGivenChar(":"))return;const i=new Uint8Array(14),s=16-(r+2),[o]=e(i.subarray(0,s));return t.set(i.subarray(0,o),16-o),t}))}readIPAddr(){var e;return null!==(e=this.readIPv4Addr())&&void 0!==e?e:this.readIPv6Addr()}};function Qa(e){return Boolean(function(e){if(!(e.length>15))return Ga.new(e).parseWith((()=>Ga.readIPv4Addr()))}(e))}function Ya(e){return Boolean(function(e){if(!(e.length>45))return Ga.new(e).parseWith((()=>Ga.readIPv6Addr()))}(e))}function $a(e){return Boolean(function(e){if(!(e.length>45))return Ga.new(e).parseWith((()=>Ga.readIPAddr()))}(e))}const Xa=Qa,Ja=Ya,Za=function(e){let t=0;if(e=e.toString().trim(),Xa(e)){const r=new Uint8Array(t+4);return e.split(/\./g).forEach((e=>{r[t++]=255&parseInt(e,10)})),r}if(Ja(e)){const r=e.split(":",8);let n;for(n=0;n<r.length;n++){let e;Xa(r[n])&&(e=Za(r[n]),r[n]=La(e.slice(0,2),"base16")),null!=e&&++n<8&&r.splice(n,0,La(e.slice(2,4),"base16"))}if(""===r[0])for(;r.length<8;)r.unshift("0");else if(""===r[r.length-1])for(;r.length<8;)r.push("0");else if(r.length<8){for(n=0;n<r.length&&""!==r[n];n++);const e=[n,1];for(n=9-r.length;n>0;n--)e.push("0");r.splice.apply(r,e)}const i=new Uint8Array(t+16);for(n=0;n<r.length;n++){const e=parseInt(r[n],16);i[t++]=e>>8&255,i[t++]=255&e}return i}throw new Error("invalid ip address")},ec=-1,tc={},rc={};function nc(e){if("number"===typeof e){if(null!=rc[e])return rc[e];throw new Error("no protocol with code: ".concat(e))}if("string"===typeof e){if(null!=tc[e])return tc[e];throw new Error("no protocol with name: ".concat(e))}throw new Error("invalid protocol id type: ".concat(typeof e))}[[4,32,"ip4"],[6,16,"tcp"],[33,16,"dccp"],[41,128,"ip6"],[42,ec,"ip6zone"],[53,ec,"dns",!0],[54,ec,"dns4",!0],[55,ec,"dns6",!0],[56,ec,"dnsaddr",!0],[132,16,"sctp"],[273,16,"udp"],[275,0,"p2p-webrtc-star"],[276,0,"p2p-webrtc-direct"],[277,0,"p2p-stardust"],[280,0,"webrtc"],[290,0,"p2p-circuit"],[301,0,"udt"],[302,0,"utp"],[400,ec,"unix",!1,!0],[421,ec,"ipfs"],[421,ec,"p2p"],[443,0,"https"],[444,96,"onion"],[445,296,"onion3"],[446,ec,"garlic64"],[460,0,"quic"],[465,0,"webtransport"],[466,ec,"certhash"],[477,0,"ws"],[478,0,"wss"],[479,0,"p2p-websocket-star"],[480,0,"http"],[777,ec,"memory"]].forEach((e=>{const t=function(e,t,r,n,i){return{code:e,size:t,name:r,resolvable:Boolean(n),path:Boolean(i)}}(...e);rc[t.code]=t,tc[t.name]=t}));var ic=__webpack_require__(6664);function sc(e,t){switch(nc(e).code){case 4:case 41:return function(e){const t=function(e){var t;let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2?arguments[2]:void 0;r=~~r,n=null!==(t=n)&&void 0!==t?t:e.length-r;const i=new DataView(e.buffer);if(4===n){const t=[];for(let i=0;i<n;i++)t.push(e[r+i]);return t.join(".")}if(16===n){const e=[];for(let t=0;t<n;t+=2)e.push(i.getUint16(r+t).toString(16));return e.join(":").replace(/(^|:)0(:0)*:0(:|$)/,"$1::$3").replace(/:{3,4}/,"::")}return""}(e,0,e.length);if(null==t)throw new Error("ipBuff is required");if(!$a(t))throw new Error("invalid ip address");return t}(t);case 6:case 273:case 33:case 132:return hc(t).toString();case 53:case 54:case 55:case 56:case 400:case 777:return function(e){const t=ic.decode(e);if((e=e.slice(ic.decode.bytes)).length!==t)throw new Error("inconsistent lengths");return La(e)}(t);case 421:return function(e){const t=ic.decode(e),r=e.slice(ic.decode.bytes);if(r.length!==t)throw new Error("inconsistent lengths");return La(r,"base58btc")}(t);case 444:case 445:return dc(t);case 466:return function(e){const t=ic.decode(e),r=e.slice(ic.decode.bytes);if(r.length!==t)throw new Error("inconsistent lengths");return"u"+La(r,"base64url")}(t);default:return La(t,"base16")}}function oc(e,t){switch(nc(e).code){case 4:case 41:return lc(t);case 6:case 273:case 33:case 132:return uc(parseInt(t,10));case 53:case 54:case 55:case 56:case 400:case 777:return function(e){const t=ha(e),r=Uint8Array.from(ic.encode(t.length));return xe([r,t],r.length+t.length)}(t);case 421:return function(e){let t;t="Q"===e[0]||"1"===e[0]?Do(no.decode("z".concat(e))).bytes:Jo.parse(e).multihash.bytes;const r=Uint8Array.from(ic.encode(t.length));return xe([r,t],r.length+t.length)}(t);case 444:return function(e){const t=e.split(":");if(2!==t.length)throw new Error("failed to parse onion addr: [\"'".concat(t.join('", "'),"'\"]' does not contain a port number"));if(16!==t[0].length)throw new Error("failed to parse onion addr: ".concat(t[0]," not a Tor onion address."));const r=Ws.decode("b"+t[0]),n=parseInt(t[1],10);if(n<1||n>65536)throw new Error("Port number is not in range(1, 65536)");const i=uc(n);return xe([r,i],r.length+i.length)}(t);case 445:return function(e){const t=e.split(":");if(2!==t.length)throw new Error("failed to parse onion addr: [\"'".concat(t.join('", "'),"'\"]' does not contain a port number"));if(56!==t[0].length)throw new Error("failed to parse onion addr: ".concat(t[0]," not a Tor onion3 address."));const r=Ws.decode("b".concat(t[0])),n=parseInt(t[1],10);if(n<1||n>65536)throw new Error("Port number is not in range(1, 65536)");const i=uc(n);return xe([r,i],r.length+i.length)}(t);case 466:return function(e){const t=cc.decode(e),r=Uint8Array.from(ic.encode(t.length));return xe([r,t],r.length+t.length)}(t);default:return ha(t,"base16")}}const ac=Object.values(oa).map((e=>e.decoder)),cc=function(){let e=ac[0].or(ac[1]);return ac.slice(2).forEach((t=>e=e.or(t))),e}();function lc(e){if(!$a(e))throw new Error("invalid ip address");return Za(e)}function uc(e){const t=new ArrayBuffer(2);return new DataView(t).setUint16(0,e),new Uint8Array(t)}function hc(e){return new DataView(e.buffer).getUint16(e.byteOffset)}function dc(e){const t=e.slice(0,e.length-2),r=e.slice(e.length-2),n=La(t,"base32"),i=hc(r);return"".concat(n,":").concat(i)}function fc(e){return e.map((e=>{const t=Sc(e);return null!=e[1]?[t.code,sc(t.code,e[1])]:[t.code]}))}function pc(e){return bc(xe(e.map((e=>{const t=Sc(e);let r=Uint8Array.from(ic.encode(t.code));return e.length>1&&null!=e[1]&&(r=xe([r,e[1]])),r}))))}function yc(e,t){if(e.size>0)return e.size/8;if(0===e.size)return 0;return ic.decode(t)+ic.decode.bytes}function gc(e){const t=[];let r=0;for(;r<e.length;){const n=ic.decode(e,r),i=ic.decode.bytes,s=yc(nc(n),e.slice(r+i));if(0===s){t.push([n]),r+=i;continue}const o=e.slice(r+i,r+i+s);if(r+=s+i,r>e.length)throw _c("Invalid address Uint8Array: "+La(e,"base16"));t.push([n,o])}return t}function mc(e){return function(e){const t=[];return e.map((e=>{const r=Sc(e);return t.push(r.name),e.length>1&&null!=e[1]&&t.push(e[1]),null})),Ec(t.join("/"))}(fc(gc(e)))}function vc(e){const t=function(e){const t=[],r=e.split("/").slice(1);if(1===r.length&&""===r[0])return[];for(let n=0;n<r.length;n++){const i=r[n],s=nc(i);if(0!==s.size){if(n++,n>=r.length)throw _c("invalid address: "+e);if(!0===s.path){t.push([i,Ec(r.slice(n).join("/"))]);break}t.push([i,r[n]])}else t.push([i])}return t}(e=Ec(e));return pc(t.map((e=>{Array.isArray(e)||(e=[e]);const t=Sc(e);return e.length>1?[t.code,oc(t.code,e[1])]:[t.code]})))}function bc(e){const t=wc(e);if(null!=t)throw t;return Uint8Array.from(e)}function wc(e){try{gc(e)}catch(t){return t}}function Ec(e){return"/"+e.trim().split("/").filter((e=>e)).join("/")}function _c(e){return new Error("Error parsing address: "+e)}function Sc(e){return nc(e[0])}var Ic,Cc,Ac,Tc,kc=function(e,t,r,n){if("a"===r&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"===typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(e):n?n.value:t.get(e)},Rc=function(e,t,r,n,i){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"===typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?i.call(e,r):i?i.value=r:t.set(e,r),r};const Pc=Symbol.for("nodejs.util.inspect.custom"),Dc=[nc("dns").code,nc("dns4").code,nc("dns6").code,nc("dnsaddr").code],Nc=[nc("p2p").code,nc("ipfs").code],xc=new Map,Lc=Symbol.for("@multiformats/js-multiaddr/multiaddr");function Oc(e,t){if(null==e)throw new Error("requires node address object");if(null==t)throw new Error("requires transport protocol");let r;switch(e.family){case 4:r="ip4";break;case 6:r="ip6";break;default:throw Error("Invalid addr family, should be 4 or 6.")}return new Mc("/"+[r,e.address,t,e.port].join("/"))}function Bc(e){return Boolean(null===e||void 0===e?void 0:e[Lc])}class Mc{constructor(e){if(Ic.set(this,void 0),Cc.set(this,void 0),Ac.set(this,void 0),this[Tc]=!0,null==e&&(e=""),e instanceof Uint8Array)this.bytes=bc(e);else if("string"===typeof e){if(e.length>0&&"/"!==e.charAt(0))throw new Error('multiaddr "'.concat(e,'" must start with a "/"'));this.bytes=vc(e)}else{if(!Bc(e))throw new Error("addr must be a string, Buffer, or another Multiaddr");this.bytes=bc(e.bytes)}}toString(){return null==kc(this,Ic,"f")&&Rc(this,Ic,mc(this.bytes),"f"),kc(this,Ic,"f")}toJSON(){return this.toString()}toOptions(){const e=this.protoCodes(),t=this.toString().split("/").slice(1);let r,n;if(t.length>2)Dc.includes(e[0])&&Nc.includes(e[1])?(r=nc("tcp").name,n=443):(r=nc(t[2]).name,n=parseInt(t[3]));else{if(!Dc.includes(e[0]))throw new Error('multiaddr must have a valid format: "/{ip4, ip6, dns4, dns6, dnsaddr}/{address}/{tcp, udp}/{port}".');r=nc("tcp").name,n=443}return{family:41===e[0]||55===e[0]?6:4,host:t[1],transport:r,port:n}}protos(){return this.protoCodes().map((e=>Object.assign({},nc(e))))}protoCodes(){const e=[],t=this.bytes;let r=0;for(;r<t.length;){const n=ic.decode(t,r),i=ic.decode.bytes;r+=yc(nc(n),t.slice(r+i))+i,e.push(n)}return e}protoNames(){return this.protos().map((e=>e.name))}tuples(){return null==kc(this,Cc,"f")&&Rc(this,Cc,gc(this.bytes),"f"),kc(this,Cc,"f")}stringTuples(){return null==kc(this,Ac,"f")&&Rc(this,Ac,fc(this.tuples()),"f"),kc(this,Ac,"f")}encapsulate(e){return e=new Mc(e),new Mc(this.toString()+e.toString())}decapsulate(e){const t=e.toString(),r=this.toString(),n=r.lastIndexOf(t);if(n<0)throw new Error("Address ".concat(this.toString()," does not contain subaddress: ").concat(e.toString()));return new Mc(r.slice(0,n))}decapsulateCode(e){const t=this.tuples();for(let r=t.length-1;r>=0;r--)if(t[r][0]===e)return new Mc(pc(t.slice(0,r)));return this}getPeerId(){try{const e=this.stringTuples().filter((e=>e[0]===tc.ipfs.code)),t=e.pop();if(null!=(null===t||void 0===t?void 0:t[1])){const e=t[1];return"Q"===e[0]||"1"===e[0]?La(no.decode("z".concat(e)),"base58btc"):La(Jo.parse(e).multihash.bytes,"base58btc")}return null}catch(e){return null}}getPath(){let e=null;try{e=this.stringTuples().filter((e=>!0===nc(e[0]).path))[0][1],null==e&&(e=null)}catch{e=null}return e}equals(e){return xa(this.bytes,e.bytes)}async resolve(e){const t=this.protos().find((e=>e.resolvable));if(null==t)return[this];const r=xc.get(t.name);if(null==r)throw ue(new Error("no available resolver for ".concat(t.name)),"ERR_NO_AVAILABLE_RESOLVER");return(await r(this,e)).map((e=>new Mc(e)))}nodeAddress(){const e=this.toOptions();if("tcp"!==e.transport&&"udp"!==e.transport)throw new Error('multiaddr must have a valid format - no protocol with name: "'.concat(e.transport,'". Must have a valid transport protocol: "{tcp, udp}"'));return{family:e.family,address:e.host,port:e.port}}isThinWaistAddress(e){const t=(null!==e&&void 0!==e?e:this).protos();return 2===t.length&&((4===t[0].code||41===t[0].code)&&(6===t[1].code||273===t[1].code))}[(Ic=new WeakMap,Cc=new WeakMap,Ac=new WeakMap,Tc=Lc,Pc)](){return this.inspect()}inspect(){return"<Multiaddr "+La(this.bytes,"base16")+" - "+mc(this.bytes)+">"}}function Uc(e){return new Mc(e)}const Fc=ll("dns4"),Vc=ll("dns6"),jc=ll("dnsaddr"),Kc=cl(ll("dns"),jc,Fc,Vc),qc=cl(ll("ip4"),ll("ip6")),zc=cl(al(qc,ll("tcp")),al(Kc,ll("tcp"))),Hc=al(qc,ll("udp")),Wc=al(Hc,ll("utp")),Gc=al(Hc,ll("quic")),Qc=cl(al(zc,ll("ws")),al(Kc,ll("ws"))),Yc=cl(al(zc,ll("wss")),al(Kc,ll("wss"))),$c=cl(al(zc,ll("http")),al(qc,ll("http")),al(Kc,ll("http"))),Xc=cl(al(zc,ll("https")),al(qc,ll("https")),al(Kc,ll("https"))),Jc=cl(al(Qc,ll("p2p-webrtc-star"),ll("p2p")),al(Yc,ll("p2p-webrtc-star"),ll("p2p")),al(Qc,ll("p2p-webrtc-star")),al(Yc,ll("p2p-webrtc-star"))),Zc=(cl(al(Qc,ll("p2p-websocket-star"),ll("p2p")),al(Yc,ll("p2p-websocket-star"),ll("p2p")),al(Qc,ll("p2p-websocket-star")),al(Yc,ll("p2p-websocket-star"))),cl(al($c,ll("p2p-webrtc-direct"),ll("p2p")),al(Xc,ll("p2p-webrtc-direct"),ll("p2p")),al($c,ll("p2p-webrtc-direct")),al(Xc,ll("p2p-webrtc-direct")))),el=cl(Qc,Yc,$c,Xc,Jc,Zc,zc,Wc,Gc,Kc),tl=(cl(al(el,ll("p2p-stardust"),ll("p2p")),al(el,ll("p2p-stardust"))),cl(al(el,ll("p2p")),Jc,Zc,ll("p2p"))),rl=cl(al(tl,ll("p2p-circuit"),tl),al(tl,ll("p2p-circuit")),al(ll("p2p-circuit"),tl),al(el,ll("p2p-circuit")),al(ll("p2p-circuit"),el),ll("p2p-circuit")),nl=()=>cl(al(rl,nl),rl),il=nl(),sl=cl(al(il,tl,il),al(tl,il),al(il,tl),il,tl);function ol(e){return function(t){let r;try{r=Uc(t)}catch(i){return!1}const n=e(r.protoNames());return null!==n&&(!0===n||!1===n?n:0===n.length)}}function al(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];function n(e){if(e.length<t.length)return null;let r=e;return t.some((t=>(r="function"===typeof t?t().partialMatch(e):t.partialMatch(e),Array.isArray(r)&&(e=r),null===r))),r}return{toString:function(){return"{ "+t.join(" ")+" }"},input:t,matches:ol(n),partialMatch:n}}function cl(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];function n(e){let r=null;return t.some((t=>{const n="function"===typeof t?t().partialMatch(e):t.partialMatch(e);return null!=n&&(r=n,!0)})),r}const i={toString:function(){return"{ "+t.join(" ")+" }"},input:t,matches:ol(n),partialMatch:n};return i}function ll(e){const t=e;return{toString:function(){return t},matches:function(e){let r;try{r=Uc(e)}catch(i){return!1}const n=r.protoNames();return 1===n.length&&n[0]===t},partialMatch:function(e){return 0===e.length?null:e[0]===t?e.slice(1):null}}}var ul,hl,dl=function(e,t,r,n){if("a"===r&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"===typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(e):n?n.value:t.get(e)};class fl extends EventTarget{constructor(){super(...arguments),hl.set(this,new Map)}listenerCount(e){const t=dl(this,hl,"f").get(e);return null==t?0:t.length}addEventListener(e,t,r){var n;super.addEventListener(e,t,r);let i=dl(this,hl,"f").get(e);null==i&&(i=[],dl(this,hl,"f").set(e,i)),i.push({callback:t,once:null!==(n=!0!==r&&!1!==r&&(null===r||void 0===r?void 0:r.once))&&void 0!==n&&n})}removeEventListener(e,t,r){super.removeEventListener(e.toString(),null!==t&&void 0!==t?t:null,r);let n=dl(this,hl,"f").get(e);null!=n&&(n=n.filter((e=>{let{callback:r}=e;return r!==t})),dl(this,hl,"f").set(e,n))}dispatchEvent(e){const t=super.dispatchEvent(e);let r=dl(this,hl,"f").get(e.type);return null==r||(r=r.filter((e=>{let{once:t}=e;return!t})),dl(this,hl,"f").set(e.type,r)),t}}hl=new WeakMap;class pl extends Event{constructor(e,t){super(e,t),this.detail=null===t||void 0===t?void 0:t.detail}}const yl=null!==(ul=globalThis.CustomEvent)&&void 0!==ul?ul:pl,gl=Symbol.for("@libp2p/peer-discovery");const ml=Ba("libp2p:bootstrap");class vl extends fl{constructor(e){var t;let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{list:[]};if(null==r.list||0===r.list.length)throw new Error("Bootstrap requires a list of peer addresses");super(),this.components=e,this.timeout=null!==(t=r.timeout)&&void 0!==t?t:1e3,this.list=[];for(const n of r.list){if(!sl.matches(n)){ml.error("Invalid multiaddr");continue}const e=Uc(n),t=e.getPeerId();if(null==t){ml.error("Invalid bootstrap multiaddr without peer id");continue}const r={id:As(t),multiaddrs:[e],protocols:[]};this.list.push(r)}this._init=r}get[gl](){return!0}get[Symbol.toStringTag](){return"@libp2p/bootstrap"}isStarted(){return Boolean(this.timer)}start(){this.isStarted()||(ml("Starting bootstrap node discovery, discovering peers after %s ms",this.timeout),this.timer=setTimeout((()=>{this._discoverBootstrapPeers().catch((e=>{ml.error(e)}))}),this.timeout))}async _discoverBootstrapPeers(){if(null!=this.timer)for(const n of this.list){var e,t,r;if(await this.components.peerStore.tagPeer(n.id,null!==(e=this._init.tagName)&&void 0!==e?e:"bootstrap",{value:null!==(t=this._init.tagValue)&&void 0!==t?t:50,ttl:null!==(r=this._init.tagTTL)&&void 0!==r?r:12e4}),null==this.timer)return;this.dispatchEvent(new yl("peer",{detail:n}))}}stop(){null!=this.timer&&clearTimeout(this.timer),this.timer=void 0}}vl.tag="bootstrap";class bl extends Error{constructor(e,t){super(null!==e&&void 0!==e?e:"The operation was aborted"),this.type="aborted",this.code=null!==t&&void 0!==t?t:"ABORT_ERR"}}function wl(e,t,r){const n=null!==r&&void 0!==r?r:{},i=function(e){if(null!=e){if("function"===typeof e[Symbol.iterator])return e[Symbol.iterator]();if("function"===typeof e[Symbol.asyncIterator])return e[Symbol.asyncIterator]();if("function"===typeof e.next)return e}throw new Error("argument is not an iterator or iterable")}(e);return async function*(){let r;const s=()=>{null!=r&&r()};for(t.addEventListener("abort",s);;){let a;try{if(t.aborted){const{abortMessage:e,abortCode:t}=n;throw new bl(e,t)}const e=new Promise(((e,t)=>{r=()=>{const{abortMessage:e,abortCode:r}=n;t(new bl(e,r))}}));a=await Promise.race([e,i.next()]),r=null}catch(o){t.removeEventListener("abort",s);const r="aborted"===o.type&&t.aborted;if(r&&null!=n.onAbort&&await n.onAbort(e),"function"===typeof i.return)try{const e=i.return();e instanceof Promise&&e.catch((e=>{null!=n.onReturnError&&n.onReturnError(e)}))}catch(o){null!=n.onReturnError&&n.onReturnError(o)}if(r&&!0===n.returnOnAbort)return;throw o}if(!0===a.done)break;yield a.value}t.removeEventListener("abort",s)}()}function El(e,t,r){return n=>e(wl(n,t,r))}function _l(e,t,r){return{sink:El(e.sink,t,{...r,onAbort:void 0}),source:wl(e.source,t,r)}}function Sl(e){return new Uint8Array(e)}var Il;!function(e){e[e.NEW_STREAM=0]="NEW_STREAM",e[e.MESSAGE_RECEIVER=1]="MESSAGE_RECEIVER",e[e.MESSAGE_INITIATOR=2]="MESSAGE_INITIATOR",e[e.CLOSE_RECEIVER=3]="CLOSE_RECEIVER",e[e.CLOSE_INITIATOR=4]="CLOSE_INITIATOR",e[e.RESET_RECEIVER=5]="RESET_RECEIVER",e[e.RESET_INITIATOR=6]="RESET_INITIATOR"}(Il||(Il={}));const Cl=Object.freeze({0:"NEW_STREAM",1:"MESSAGE_RECEIVER",2:"MESSAGE_INITIATOR",3:"CLOSE_RECEIVER",4:"CLOSE_INITIATOR",5:"RESET_RECEIVER",6:"RESET_INITIATOR"}),Al=Object.freeze({NEW_STREAM:Il.NEW_STREAM,MESSAGE:Il.MESSAGE_INITIATOR,CLOSE:Il.CLOSE_INITIATOR,RESET:Il.RESET_INITIATOR}),Tl=Object.freeze({MESSAGE:Il.MESSAGE_RECEIVER,CLOSE:Il.CLOSE_RECEIVER,RESET:Il.RESET_RECEIVER}),kl=10240;const Rl=new class{constructor(){this._pool=Sl(kl),this._poolOffset=0}write(e){const t=this._pool;let r=this._poolOffset;ic.encode(e.id<<3|e.type,t,r),r+=ic.encode.bytes,e.type!==Il.NEW_STREAM&&e.type!==Il.MESSAGE_INITIATOR&&e.type!==Il.MESSAGE_RECEIVER||null==e.data?ic.encode(0,t,r):ic.encode(e.data.length,t,r),r+=ic.encode.bytes;const n=t.subarray(this._poolOffset,r);return kl-r<100?(this._pool=Sl(kl),this._poolOffset=0):this._poolOffset=r,e.type!==Il.NEW_STREAM&&e.type!==Il.MESSAGE_INITIATOR&&e.type!==Il.MESSAGE_RECEIVER||null==e.data?[n]:[n,...e.data instanceof Uint8Array?[e.data]:e.data]}};class Pl{constructor(){this._buffer=new K,this._headerInfo=null}write(e){if(null==e||0===e.length)return[];this._buffer.append(e);const t=[];for(;0!==this._buffer.length;){if(null==this._headerInfo)try{this._headerInfo=this._decodeHeader(this._buffer)}catch(r){break}const{id:e,type:n,length:i,offset:s}=this._headerInfo;if(this._buffer.length-s<i)break;const o={id:e,type:n};n!==Il.NEW_STREAM&&n!==Il.MESSAGE_INITIATOR&&n!==Il.MESSAGE_RECEIVER||(o.data=this._buffer.sublist(s,s+i)),t.push(o),this._buffer.consume(s+i),this._headerInfo=null}return t}_decodeHeader(e){const{value:t,offset:r}=Nl(e),{value:n,offset:i}=Nl(e,r),s=7&t;if(null==Cl[s])throw new Error("Invalid type received: ".concat(s));return{id:t>>3,type:s,offset:r+i,length:n}}}const Dl=127;function Nl(e){let t,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=0,i=0,s=r;const o=e.length;do{if(s>=o||i>49)throw r=0,new RangeError("Could not decode varint");t=e.get(s++),n+=i<28?(t&Dl)<<i:(t&Dl)*Math.pow(2,i),i+=7}while(t>=128);return r=s-r,{value:n,offset:r}}async function*xl(e){const t=new Pl;for await(const r of e){const e=t.write(r);e.length>0&&(yield e)}}const Ll=1<<20;var Ol=__webpack_require__(5832);const Bl=Ba("libp2p:mplex:stream"),Ml="ERR_STREAM_RESET";var Ul=__webpack_require__(6631);const Fl=Ba("libp2p:mplex");function Vl(e){const t={...e,type:"".concat(Cl[e.type]," (").concat(e.type,")")};return e.type===Il.NEW_STREAM&&(t.data=La(e.data instanceof Uint8Array?e.data:e.data.subarray())),e.type!==Il.MESSAGE_INITIATOR&&e.type!==Il.MESSAGE_RECEIVER||(t.data=La(e.data instanceof Uint8Array?e.data:e.data.subarray(),"base16")),t}class jl{constructor(e){var t,r;this.protocol="/mplex/6.7.0",e=null!==(t=e)&&void 0!==t?t:{},this._streamId=0,this._streams={initiators:new Map,receivers:new Map},this._init=e,this.sink=this._createSink();const n=this._createSource();this._source=n,this.source=n,this.closeController=new AbortController,this.rateLimiter=new Ul.RateLimiterMemory({points:null!==(r=e.disconnectThreshold)&&void 0!==r?r:5,duration:1})}get streams(){const e=[];for(const t of this._streams.initiators.values())e.push(t);for(const t of this._streams.receivers.values())e.push(t);return e}newStream(e){if(this.closeController.signal.aborted)throw new Error("Muxer already closed");const t=this._streamId++;e=null==e?t.toString():e.toString();const r=this._streams.initiators;return this._newStream({id:t,name:e,type:"initiator",registry:r})}close(e){this.closeController.signal.aborted||(null!=e?this.streams.forEach((t=>t.abort(e))):this.streams.forEach((e=>e.close())),this.closeController.abort())}_newReceiverStream(e){const{id:t,name:r}=e,n=this._streams.receivers;return this._newStream({id:t,name:r,type:"receiver",registry:n})}_newStream(e){var t;const{id:r,name:n,type:i,registry:s}=e;if(Fl("new %s stream %s %s",i,r),"initiator"===i&&this._streams.initiators.size===(null!==(t=this._init.maxOutboundStreams)&&void 0!==t?t:1024))throw ue(new Error("Too many outbound streams open"),"ERR_TOO_MANY_OUTBOUND_STREAMS");if(s.has(r))throw new Error("".concat(i," stream ").concat(r," already exists!"));const o=function(e){const{id:t,name:r,send:n,onEnd:i,type:s="initiator",maxMsgSize:o=Ll}=e,a=new AbortController,c=new AbortController,l=new AbortController,u="initiator"===s?Al:Tl,h="initiator"===s?"i".concat(t):"r".concat(t),d="".concat(null==r?t:r);let f,p=!1,y=!1,g=!1;const m={open:Date.now()},v=e=>{y||(y=!0,Bl.trace("%s stream %s sink end - err: %o",s,d,e),null!=e&&null==f&&(f=e),p&&(m.close=Date.now(),null!=i&&i(f)))},b=H({onEnd:e=>{p||(p=!0,Bl.trace("%s stream %s source end - err: %o",s,d,e),null!=e&&null==f&&(f=e),y&&(w.stat.timeline.close=Date.now(),null!=i&&i(f)))}}),w={close:()=>{Bl.trace("%s stream %s close",s,d),w.closeRead(),w.closeWrite()},closeRead:()=>{Bl.trace("%s stream %s closeRead",s,d),p||b.end()},closeWrite:()=>{if(Bl.trace("%s stream %s closeWrite",s,d),!y){l.abort();try{n({id:t,type:u.CLOSE})}catch(e){Bl.trace("%s stream %s error sending close",s,r,e)}v()}},abort:e=>{Bl.trace("%s stream %s abort",s,d,e),b.end(e),a.abort(),v(e)},reset:()=>{const e=ue(new Error("stream reset"),Ml);c.abort(),b.end(e),v(e)},sink:async e=>{if(g)throw ue(new Error("sink already called on stream"),"ERR_DOUBLE_SINK");if(g=!0,y)throw ue(new Error("stream closed for writing"),"ERR_SINK_ENDED");e=wl(e,(0,Ol.anySignal)([a.signal,c.signal,l.signal]));try{"initiator"===s&&n({id:t,type:Al.NEW_STREAM,data:new K(ha(d))});const r=new K;for await(const i of e)if(i.length<=o)n({id:t,type:u.MESSAGE,data:i instanceof K?i:new K(i)});else for(r.append(i);0!==r.length;){if(r.length<=o){n({id:t,type:u.MESSAGE,data:r.sublist()}),r.consume(r.length);break}n({id:t,type:u.MESSAGE,data:r.sublist(0,o)}),r.consume(o)}}catch(i){if("aborted"===i.type&&"The operation was aborted"===i.message){if(l.signal.aborted)return;c.signal.aborted&&(i.message="stream reset",i.code=Ml),a.signal.aborted&&(i.message="stream aborted",i.code="ERR_STREAM_ABORT")}if(i.code===Ml)Bl.trace("%s stream %s reset",s,r);else{Bl.trace("%s stream %s error",s,r,i);try{n({id:t,type:u.RESET})}catch(i){Bl.trace("%s stream %s error sending reset",s,r,i)}}return b.end(i),void v(i)}try{n({id:t,type:u.CLOSE})}catch(i){Bl.trace("%s stream %s error sending close",s,r,i)}v()},source:b,sourcePush:e=>{b.push(e)},sourceReadableLength:()=>b.readableLength,stat:{direction:"initiator"===s?"outbound":"inbound",timeline:m},metadata:{},id:h};return w}({id:r,name:n,send:e=>{Fl.enabled&&Fl.trace("%s stream %s send",i,r,Vl(e)),this._source.push(e)},type:i,onEnd:()=>{Fl("%s stream with id %s and protocol %s ended",i,r,o.stat.protocol),s.delete(r),null!=this._init.onStreamEnd&&this._init.onStreamEnd(o)},maxMsgSize:this._init.maxMsgSize});return s.set(r,o),o}_createSink(){return async e=>{const t=[this.closeController.signal];null!=this._init.signal&&t.push(this._init.signal),e=wl(e,Ol(t));try{await Ee(e,xl,function(e){const t=null!==e&&void 0!==e?e:Ll,r=e=>{if((e.type===Il.NEW_STREAM||e.type===Il.MESSAGE_INITIATOR||e.type===Il.MESSAGE_RECEIVER)&&e.data.byteLength>t)throw Object.assign(new Error("message size too large!"),{code:"ERR_MSG_TOO_BIG"})};return e=>async function*(){for await(const t of e)Array.isArray(t)?(t.forEach(r),yield*t):(r(t),yield t)}()}(this._init.maxMsgSize),(async e=>{for await(const t of e)await this._handleIncoming(t)})),this._source.end()}catch(r){Fl("error in sink",r),this._source.end(r)}}}_createSource(){const e=function(){return W((e=>{let t;const r=[];for(;!e.isEmpty()&&(t=e.shift(),null!=t);){if(null!=t.error)throw t.error;!1===t.done&&r.push(t.value)}return null==t?{done:!0}:{done:!0===t.done,value:r}}),arguments.length>0&&void 0!==arguments[0]?arguments[0]:{})}({objectMode:!0,onEnd:e=>{this.close(e)}});return Object.assign(async function*(e){for await(const t of e)if(Array.isArray(t))for(const e of t)yield*Rl.write(e);else yield*Rl.write(t)}(e),{push:e.push,end:e.end,return:e.return})}async _handleIncoming(e){var t;const{id:r,type:n}=e;if(Fl.enabled&&Fl.trace("incoming message",Vl(e)),e.type===Il.NEW_STREAM){var i;if(this._streams.receivers.size===(null!==(i=this._init.maxInboundStreams)&&void 0!==i?i:1024)){Fl("too many inbound streams open"),this._source.push({id:r,type:Il.RESET_RECEIVER});try{await this.rateLimiter.consume("new-stream",1)}catch{return Fl("rate limit hit when opening too many new streams over the inbound stream limit - closing remote connection"),void this._source.end(new Error("Too many open streams"))}return}const t=this._newReceiverStream({id:r,name:La(e.data instanceof Uint8Array?e.data:e.data.subarray())});return void(null!=this._init.onIncomingStream&&this._init.onIncomingStream(t))}const s=(1===(1&n)?this._streams.initiators:this._streams.receivers).get(r);if(null==s)return void Fl("missing stream %s for message type %s",r,Cl[n]);const o=null!==(t=this._init.maxStreamBufferSize)&&void 0!==t?t:4194304;switch(n){case Il.MESSAGE_INITIATOR:case Il.MESSAGE_RECEIVER:if(s.sourceReadableLength()>o){this._source.push({id:e.id,type:n===Il.MESSAGE_INITIATOR?Il.RESET_RECEIVER:Il.RESET_INITIATOR});const t=ue(new Error("Input buffer full - increase Mplex maxBufferSize to accommodate slow consumers"),"ERR_STREAM_INPUT_BUFFER_FULL");return void s.abort(t)}s.sourcePush(e.data);break;case Il.CLOSE_INITIATOR:case Il.CLOSE_RECEIVER:s.closeRead();break;case Il.RESET_INITIATOR:case Il.RESET_RECEIVER:s.reset();break;default:Fl("unknown message type %s",n)}}}class Kl{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.protocol="/mplex/6.7.0",this._init=e}createStreamMuxer(){return new jl({...arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},...this._init})}}function ql(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return()=>new Kl(e)}const zl=WebSocket;var Hl=__webpack_require__(593);function Wl(e){var t;return e instanceof ArrayBuffer||"ArrayBuffer"===(null===e||void 0===e||null===(t=e.constructor)||void 0===t?void 0:t.name)&&"number"===typeof(null===e||void 0===e?void 0:e.byteLength)}const Gl=e=>{if(e.readyState>=2)throw new Error("socket closed");if(1!==e.readyState)return new Promise(((t,r)=>{function n(){e.removeEventListener("open",i),e.removeEventListener("error",s)}function i(){n(),t()}function s(t){var i;n(),r(null!==(i=t.error)&&void 0!==i?i:new Error("connect ECONNREFUSED ".concat(e.url)))}e.addEventListener("open",i),e.addEventListener("error",s)}))},Ql=(e,t)=>{var r;(t=null!==(r=t)&&void 0!==r?r:{}).closeOnEnd=!1!==t.closeOnEnd;return async r=>{for await(const t of r){try{await Gl(e)}catch(n){if("socket closed"===n.message)break;throw n}e.send(t)}if(null!=t.closeOnEnd&&e.readyState<=1)return await new Promise(((t,r)=>{e.addEventListener("close",(e=>{if(e.wasClean||1006===e.code)t();else{const t=Object.assign(new Error("ws error"),{event:e});r(t)}})),setTimeout((()=>e.close()))}))}},Yl=(e,t)=>{var r;t=null!==(r=t)&&void 0!==r?r:{};const n=(e=>{e.binaryType="arraybuffer";const t=async()=>await new Promise(((t,r)=>{if(i)return t();if(null!=n)return r(n);const s=t=>{e.removeEventListener("open",o),e.removeEventListener("error",a),t()},o=()=>s(t),a=t=>{s((()=>{var n;return r(null!==(n=t.error)&&void 0!==n?n:new Error("connect ECONNREFUSED ".concat(e.url)))}))};e.addEventListener("open",o),e.addEventListener("error",a)})),r=async function*(){const r=new Hl.zN((t=>{let{push:r,stop:n,fail:i}=t;const s=e=>{let t=null;"string"===typeof e.data&&(t=Lr(e.data)),Wl(e.data)&&(t=new Uint8Array(e.data)),e.data instanceof Uint8Array&&(t=e.data),null!=t&&r(t)},o=e=>{var t;return i(null!==(t=e.error)&&void 0!==t?t:new Error("Socket error"))};return e.addEventListener("message",s),e.addEventListener("error",o),e.addEventListener("close",n),()=>{e.removeEventListener("message",s),e.removeEventListener("error",o),e.removeEventListener("close",n)}}),{highWaterMark:1/0});await t();for await(const e of r)yield Wl(e)?new Uint8Array(e):e}();let n,i=1===e.readyState;return e.addEventListener("open",(()=>{i=!0,n=null})),e.addEventListener("close",(()=>{i=!1,n=null})),e.addEventListener("error",(t=>{var r;i||(n=null!==(r=t.error)&&void 0!==r?r:new Error("connect ECONNREFUSED ".concat(e.url)))})),Object.assign(r,{connected:t})})(e);let i=t.remoteAddress,s=t.remotePort;if(null!=e.url)try{const t=new URL(e.url);i=t.hostname,s=parseInt(t.port,10)}catch{}if(null==i||null==s)throw new Error("Remote connection did not have address and/or port");return{sink:Ql(e,t),source:n,connected:async()=>await n.connected(),close:async()=>{e.readyState!==e.CONNECTING&&e.readyState!==e.OPEN||await new Promise((t=>{e.addEventListener("close",(()=>{t()})),e.close()}))},destroy:()=>{null!=e.terminate?e.terminate():e.close()},remoteAddress:i,remotePort:s,socket:e}};var $l=__webpack_require__(9088);const Xl={http:"ws",https:"wss"};function Jl(e,t){var r;t=null!==(r=t)&&void 0!==r?r:{};const n=((e,t)=>(0,$l.relative)(e,t,Xl,"ws"))(e,("undefined"===typeof window?"":window.location).toString()),i=new zl(n,t.websocket);return Yl(i,t)}const Zl=(e,t)=>t,eu={ip4:Zl,ip6:(e,t,r,n)=>1===n.length&&"ip6"===n[0].protocol?t:"[".concat(t,"]"),tcp:(e,t,r,n,i)=>n.some((e=>["http","https","ws","wss"].includes(e.protocol)))?"".concat(e,":").concat(t):((e,t,r,n)=>{if(null!=n&&!1===n.assumeHttp)return"tcp://".concat(e,":").concat(t);let i="tcp",s=":".concat(t);return"tcp"===r[r.length-1].protocol&&(i="443"===t?"https":"http",s="443"===t||"80"===t?"":s),"".concat(i,"://").concat(e).concat(s)})(e,t,n,i),udp:(e,t)=>"udp://".concat(e,":").concat(t),dnsaddr:Zl,dns4:Zl,dns6:Zl,ipfs:(e,t)=>"".concat(e,"/ipfs/").concat(t),p2p:(e,t)=>"".concat(e,"/p2p/").concat(t),http:e=>"http://".concat(e),https:e=>"https://".concat(e),ws:e=>"ws://".concat(e),wss:e=>"wss://".concat(e),"p2p-websocket-star":e=>"".concat(e,"/p2p-websocket-star"),"p2p-webrtc-star":e=>"".concat(e,"/p2p-webrtc-star"),"p2p-webrtc-direct":e=>"".concat(e,"/p2p-webrtc-direct")};class tu extends Error{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"The operation was aborted"),this.code=tu.code,this.type=tu.type}static get code(){return"ABORT_ERR"}static get type(){return"aborted"}}var ru=__webpack_require__(7710);const nu="object"===typeof window&&"object"===typeof document&&9===document.nodeType,iu=ru(),su=nu&&!iu,ou=iu&&!nu,au=iu&&nu,cu="undefined"!==typeof globalThis.process&&"undefined"!==typeof globalThis.process.release&&"node"===globalThis.process.release.name&&!iu,lu="function"===typeof importScripts&&"undefined"!==typeof self&&"undefined"!==typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope,uu=("undefined"!==typeof globalThis.process&&"undefined"!==typeof globalThis.process.env&&globalThis.process.env.NODE_ENV,"undefined"!==typeof navigator&&"ReactNative"===navigator.product);class hu extends Error{constructor(e){super(e),this.name="TimeoutError"}}class du extends Error{constructor(e){super(),this.name="AbortError",this.message=e}}const fu=e=>void 0===globalThis.DOMException?new du(e):new DOMException(e),pu=e=>{const t=void 0===e.reason?fu("This operation was aborted."):e.reason;return t instanceof Error?t:fu(t)};function yu(e,t){const{milliseconds:r,fallback:n,message:i,customTimers:s={setTimeout:setTimeout,clearTimeout:clearTimeout}}=t;let o;const a=new Promise(((a,c)=>{if("number"!==typeof r||1!==Math.sign(r))throw new TypeError("Expected `milliseconds` to be a positive number, got `".concat(r,"`"));if(r!==Number.POSITIVE_INFINITY){if(t.signal){const{signal:e}=t;e.aborted&&c(pu(e)),e.addEventListener("abort",(()=>{c(pu(e))}))}o=s.setTimeout.call(void 0,(()=>{if(n){try{a(n())}catch(o){c(o)}return}const t="string"===typeof i?i:"Promise timed out after ".concat(r," milliseconds"),s=i instanceof Error?i:new hu(t);"function"===typeof e.cancel&&e.cancel(),c(s)}),r),(async()=>{try{a(await e)}catch(t){c(t)}finally{s.clearTimeout.call(void 0,o)}})()}else a(e)}));return a.clear=()=>{s.clearTimeout.call(void 0,o),o=void 0},a}const gu=Ba("libp2p:websockets:socket");function mu(e){return e.filter((e=>{if(e.protoCodes().includes(290))return!1;const t=e.decapsulateCode(421);return Qc.matches(t)||Yc.matches(t)}))}const vu=Symbol.for("@libp2p/transport");const bu=Ba("libp2p:websockets");class wu{constructor(e){this.init=e}get[Symbol.toStringTag](){return"@libp2p/websockets"}get[vu](){return!0}async dial(e,t){var r;bu("dialing %s",e),t=null!==(r=t)&&void 0!==r?r:{};const n=function(e,t,r){var n;const i={async sink(t){var n;null!=(null===(n=r)||void 0===n?void 0:n.signal)&&(t=wl(t,r.signal));try{await e.sink(t)}catch(i){"aborted"!==i.type&&gu.error(i)}},source:null!=(r=null!==(n=r)&&void 0!==n?n:{}).signal?wl(e.source,r.signal):e.source,remoteAddr:t,timeline:{open:Date.now()},async close(){const t=Date.now();try{await yu(e.close(),{milliseconds:2e3})}catch(r){const{host:n,port:s}=i.remoteAddr.toOptions();gu("timeout closing stream to %s:%s after %dms, destroying it manually",n,s,Date.now()-t),e.destroy()}finally{i.timeline.close=Date.now()}}};return e.socket.addEventListener("close",(()=>{null==i.timeline.close&&(i.timeline.close=Date.now())}),{once:!0}),i}(await this._connect(e,t),e);bu("new outbound connection %s",n.remoteAddr);const i=await t.upgrader.upgradeOutbound(n);return bu("outbound connection %s upgraded",n.remoteAddr),i}async _connect(e,t){var r;if(!0===(null===t||void 0===t||null===(r=t.signal)||void 0===r?void 0:r.aborted))throw new tu;const n=e.toOptions();bu("dialing %s:%s",n.host,n.port);const i=G(),s=e=>{bu.error("connection error:",e),i.reject(e)},o=Jl(function(e,t){const r=Uc(e),n=r.toString().split("/").slice(1);return r.tuples().map((e=>{var t,r;return{protocol:null!==(t=n.shift())&&void 0!==t?t:"",content:null!=e[1]&&null!==(r=n.shift())&&void 0!==r?r:""}})).reduce(((e,r,n,i)=>{const s=eu[r.protocol];if(null==s)throw new Error("Unsupported protocol ".concat(r.protocol));return s(e,r.content,n,i,t)}),"")}(e),this.init);if(null!=o.socket.on?o.socket.on("error",s):o.socket.onerror=s,null==t.signal)return await Promise.race([o.connected(),i.promise]),bu("connected %s",e),o;let a;const c=new Promise(((e,r)=>{var n,i;if(a=()=>{r(new tu),o.close().catch((e=>{bu.error("error closing raw socket",e)}))},!0===(null===t||void 0===t||null===(n=t.signal)||void 0===n?void 0:n.aborted))return a();null===t||void 0===t||null===(i=t.signal)||void 0===i||i.addEventListener("abort",a)}));try{await Promise.race([c,i.promise,o.connected()])}finally{var l;if(null!=a)null===t||void 0===t||null===(l=t.signal)||void 0===l||l.removeEventListener("abort",a)}return bu("connected %s",e),o}createListener(e){return function(){throw new Error("WebSocket Servers can not be created in the browser!")}(this.init)}filter(e){var t,r;return e=Array.isArray(e)?e:[e],null!=(null===(t=this.init)||void 0===t?void 0:t.filter)?null===(r=this.init)||void 0===r?void 0:r.filter(e):su||lu?function(e){return e.filter((e=>{if(e.protoCodes().includes(290))return!1;const t=e.decapsulateCode(421);return Yc.matches(t)&&Kc.matches(t.decapsulateCode(6).decapsulateCode(478))}))}(e):mu(e)}}function Eu(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return()=>new wu(e)}var _u,Su;!function(e){e.Relay="relay",e.Store="store",e.LightPush="lightpush",e.Filter="filter"}(_u||(_u={})),function(e){e.BACKWARD="backward",e.FORWARD="forward"}(Su||(Su={}));var Iu=__webpack_require__(533);Oa("waku:select-peer");var Cu,Au,Tu,ku,Ru;!function(e){let t,r;!function(e){let t;e.codec=()=>(null==t&&(t=Ye((function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};!1!==r.lengthDelimited&&t.fork(),null!=e.contentTopic&&(t.uint32(10),t.string(e.contentTopic)),!1!==r.lengthDelimited&&t.ldelim()}),((e,t)=>{const r={},n=null==t?e.len:e.pos+t;for(;e.pos<n;){const t=e.uint32();if(t>>>3===1)r.contentTopic=e.string();else e.skipType(7&t)}return r}))),t),e.encode=t=>je(t,e.codec()),e.decode=t=>Fe(t,e.codec())}(t=e.ContentFilter||(e.ContentFilter={})),e.codec=()=>(null==r&&(r=Ye((function(t,r){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!1!==n.lengthDelimited&&r.fork(),null!=t.subscribe&&(r.uint32(8),r.bool(t.subscribe)),null!=t.topic&&(r.uint32(18),r.string(t.topic)),null==t.contentFilters)throw new Error('Protocol error: required field "contentFilters" was not found in object');for(const i of t.contentFilters)r.uint32(26),e.ContentFilter.codec().encode(i,r);!1!==n.lengthDelimited&&r.ldelim()}),((t,r)=>{const n={contentFilters:[]},i=null==r?t.len:t.pos+r;for(;t.pos<i;){const r=t.uint32();switch(r>>>3){case 1:n.subscribe=t.bool();break;case 2:n.topic=t.string();break;case 3:n.contentFilters.push(e.ContentFilter.codec().decode(t,t.uint32()));break;default:t.skipType(7&r)}}return n}))),r),e.encode=t=>je(t,e.codec()),e.decode=t=>Fe(t,e.codec())}(Cu||(Cu={})),function(e){let t;e.codec=()=>(null==t&&(t=Ye((function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!1!==r.lengthDelimited&&t.fork(),null==e.messages)throw new Error('Protocol error: required field "messages" was not found in object');for(const n of e.messages)t.uint32(10),Ru.codec().encode(n,t);!1!==r.lengthDelimited&&t.ldelim()}),((e,t)=>{const r={messages:[]},n=null==t?e.len:e.pos+t;for(;e.pos<n;){const t=e.uint32();if(t>>>3===1)r.messages.push(Ru.codec().decode(e,e.uint32()));else e.skipType(7&t)}return r}))),t),e.encode=t=>je(t,e.codec()),e.decode=t=>Fe(t,e.codec())}(Au||(Au={})),function(e){let t;e.codec=()=>(null==t&&(t=Ye((function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};!1!==r.lengthDelimited&&t.fork(),null!=e.requestId&&(t.uint32(10),t.string(e.requestId)),null!=e.request&&(t.uint32(18),Cu.codec().encode(e.request,t)),null!=e.push&&(t.uint32(26),Au.codec().encode(e.push,t)),!1!==r.lengthDelimited&&t.ldelim()}),((e,t)=>{const r={},n=null==t?e.len:e.pos+t;for(;e.pos<n;){const t=e.uint32();switch(t>>>3){case 1:r.requestId=e.string();break;case 2:r.request=Cu.codec().decode(e,e.uint32());break;case 3:r.push=Au.codec().decode(e,e.uint32());break;default:e.skipType(7&t)}}return r}))),t),e.encode=t=>je(t,e.codec()),e.decode=t=>Fe(t,e.codec())}(Tu||(Tu={})),function(e){let t;e.codec=()=>(null==t&&(t=Ye((function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!1!==r.lengthDelimited&&t.fork(),null==e.proof)throw new Error('Protocol error: required field "proof" was not found in object');if(t.uint32(10),t.bytes(e.proof),null==e.merkleRoot)throw new Error('Protocol error: required field "merkleRoot" was not found in object');if(t.uint32(18),t.bytes(e.merkleRoot),null==e.epoch)throw new Error('Protocol error: required field "epoch" was not found in object');if(t.uint32(26),t.bytes(e.epoch),null==e.shareX)throw new Error('Protocol error: required field "shareX" was not found in object');if(t.uint32(34),t.bytes(e.shareX),null==e.shareY)throw new Error('Protocol error: required field "shareY" was not found in object');if(t.uint32(42),t.bytes(e.shareY),null==e.nullifier)throw new Error('Protocol error: required field "nullifier" was not found in object');if(t.uint32(50),t.bytes(e.nullifier),null==e.rlnIdentifier)throw new Error('Protocol error: required field "rlnIdentifier" was not found in object');t.uint32(58),t.bytes(e.rlnIdentifier),!1!==r.lengthDelimited&&t.ldelim()}),((e,t)=>{const r={proof:new Uint8Array(0),merkleRoot:new Uint8Array(0),epoch:new Uint8Array(0),shareX:new Uint8Array(0),shareY:new Uint8Array(0),nullifier:new Uint8Array(0),rlnIdentifier:new Uint8Array(0)},n=null==t?e.len:e.pos+t;for(;e.pos<n;){const t=e.uint32();switch(t>>>3){case 1:r.proof=e.bytes();break;case 2:r.merkleRoot=e.bytes();break;case 3:r.epoch=e.bytes();break;case 4:r.shareX=e.bytes();break;case 5:r.shareY=e.bytes();break;case 6:r.nullifier=e.bytes();break;case 7:r.rlnIdentifier=e.bytes();break;default:e.skipType(7&t)}}if(null==r.proof)throw new Error('Protocol error: value for required field "proof" was not found in protobuf');if(null==r.merkleRoot)throw new Error('Protocol error: value for required field "merkleRoot" was not found in protobuf');if(null==r.epoch)throw new Error('Protocol error: value for required field "epoch" was not found in protobuf');if(null==r.shareX)throw new Error('Protocol error: value for required field "shareX" was not found in protobuf');if(null==r.shareY)throw new Error('Protocol error: value for required field "shareY" was not found in protobuf');if(null==r.nullifier)throw new Error('Protocol error: value for required field "nullifier" was not found in protobuf');if(null==r.rlnIdentifier)throw new Error('Protocol error: value for required field "rlnIdentifier" was not found in protobuf');return r}))),t),e.encode=t=>je(t,e.codec()),e.decode=t=>Fe(t,e.codec())}(ku||(ku={})),function(e){let t;e.codec=()=>(null==t&&(t=Ye((function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};!1!==r.lengthDelimited&&t.fork(),null!=e.payload&&(t.uint32(10),t.bytes(e.payload)),null!=e.contentTopic&&(t.uint32(18),t.string(e.contentTopic)),null!=e.version&&(t.uint32(24),t.uint32(e.version)),null!=e.timestampDeprecated&&(t.uint32(33),t.double(e.timestampDeprecated)),null!=e.timestamp&&(t.uint32(80),t.sint64(e.timestamp)),null!=e.rateLimitProof&&(t.uint32(170),ku.codec().encode(e.rateLimitProof,t)),null!=e.ephemeral&&(t.uint32(248),t.bool(e.ephemeral)),!1!==r.lengthDelimited&&t.ldelim()}),((e,t)=>{const r={},n=null==t?e.len:e.pos+t;for(;e.pos<n;){const t=e.uint32();switch(t>>>3){case 1:r.payload=e.bytes();break;case 2:r.contentTopic=e.string();break;case 3:r.version=e.uint32();break;case 4:r.timestampDeprecated=e.double();break;case 10:r.timestamp=e.sint64();break;case 21:r.rateLimitProof=ku.codec().decode(e,e.uint32());break;case 31:r.ephemeral=e.bool();break;default:e.skipType(7&t)}}return r}))),t),e.encode=t=>je(t,e.codec()),e.decode=t=>Fe(t,e.codec())}(Ru||(Ru={}));const Pu="/vac/waku/filter/2.0.0-beta1";Oa("waku:filter");var Du,Nu,xu,Lu,Ou;!function(e){let t;e.codec=()=>(null==t&&(t=Ye((function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};!1!==r.lengthDelimited&&t.fork(),null!=e.pubSubTopic&&(t.uint32(10),t.string(e.pubSubTopic)),null!=e.message&&(t.uint32(18),Ou.codec().encode(e.message,t)),!1!==r.lengthDelimited&&t.ldelim()}),((e,t)=>{const r={},n=null==t?e.len:e.pos+t;for(;e.pos<n;){const t=e.uint32();switch(t>>>3){case 1:r.pubSubTopic=e.string();break;case 2:r.message=Ou.codec().decode(e,e.uint32());break;default:e.skipType(7&t)}}return r}))),t),e.encode=t=>je(t,e.codec()),e.decode=t=>Fe(t,e.codec())}(Du||(Du={})),function(e){let t;e.codec=()=>(null==t&&(t=Ye((function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};!1!==r.lengthDelimited&&t.fork(),null!=e.isSuccess&&(t.uint32(8),t.bool(e.isSuccess)),null!=e.info&&(t.uint32(18),t.string(e.info)),!1!==r.lengthDelimited&&t.ldelim()}),((e,t)=>{const r={},n=null==t?e.len:e.pos+t;for(;e.pos<n;){const t=e.uint32();switch(t>>>3){case 1:r.isSuccess=e.bool();break;case 2:r.info=e.string();break;default:e.skipType(7&t)}}return r}))),t),e.encode=t=>je(t,e.codec()),e.decode=t=>Fe(t,e.codec())}(Nu||(Nu={})),function(e){let t;e.codec=()=>(null==t&&(t=Ye((function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};!1!==r.lengthDelimited&&t.fork(),null!=e.requestId&&(t.uint32(10),t.string(e.requestId)),null!=e.request&&(t.uint32(18),Du.codec().encode(e.request,t)),null!=e.response&&(t.uint32(26),Nu.codec().encode(e.response,t)),!1!==r.lengthDelimited&&t.ldelim()}),((e,t)=>{const r={},n=null==t?e.len:e.pos+t;for(;e.pos<n;){const t=e.uint32();switch(t>>>3){case 1:r.requestId=e.string();break;case 2:r.request=Du.codec().decode(e,e.uint32());break;case 3:r.response=Nu.codec().decode(e,e.uint32());break;default:e.skipType(7&t)}}return r}))),t),e.encode=t=>je(t,e.codec()),e.decode=t=>Fe(t,e.codec())}(xu||(xu={})),function(e){let t;e.codec=()=>(null==t&&(t=Ye((function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!1!==r.lengthDelimited&&t.fork(),null==e.proof)throw new Error('Protocol error: required field "proof" was not found in object');if(t.uint32(10),t.bytes(e.proof),null==e.merkleRoot)throw new Error('Protocol error: required field "merkleRoot" was not found in object');if(t.uint32(18),t.bytes(e.merkleRoot),null==e.epoch)throw new Error('Protocol error: required field "epoch" was not found in object');if(t.uint32(26),t.bytes(e.epoch),null==e.shareX)throw new Error('Protocol error: required field "shareX" was not found in object');if(t.uint32(34),t.bytes(e.shareX),null==e.shareY)throw new Error('Protocol error: required field "shareY" was not found in object');if(t.uint32(42),t.bytes(e.shareY),null==e.nullifier)throw new Error('Protocol error: required field "nullifier" was not found in object');if(t.uint32(50),t.bytes(e.nullifier),null==e.rlnIdentifier)throw new Error('Protocol error: required field "rlnIdentifier" was not found in object');t.uint32(58),t.bytes(e.rlnIdentifier),!1!==r.lengthDelimited&&t.ldelim()}),((e,t)=>{const r={proof:new Uint8Array(0),merkleRoot:new Uint8Array(0),epoch:new Uint8Array(0),shareX:new Uint8Array(0),shareY:new Uint8Array(0),nullifier:new Uint8Array(0),rlnIdentifier:new Uint8Array(0)},n=null==t?e.len:e.pos+t;for(;e.pos<n;){const t=e.uint32();switch(t>>>3){case 1:r.proof=e.bytes();break;case 2:r.merkleRoot=e.bytes();break;case 3:r.epoch=e.bytes();break;case 4:r.shareX=e.bytes();break;case 5:r.shareY=e.bytes();break;case 6:r.nullifier=e.bytes();break;case 7:r.rlnIdentifier=e.bytes();break;default:e.skipType(7&t)}}if(null==r.proof)throw new Error('Protocol error: value for required field "proof" was not found in protobuf');if(null==r.merkleRoot)throw new Error('Protocol error: value for required field "merkleRoot" was not found in protobuf');if(null==r.epoch)throw new Error('Protocol error: value for required field "epoch" was not found in protobuf');if(null==r.shareX)throw new Error('Protocol error: value for required field "shareX" was not found in protobuf');if(null==r.shareY)throw new Error('Protocol error: value for required field "shareY" was not found in protobuf');if(null==r.nullifier)throw new Error('Protocol error: value for required field "nullifier" was not found in protobuf');if(null==r.rlnIdentifier)throw new Error('Protocol error: value for required field "rlnIdentifier" was not found in protobuf');return r}))),t),e.encode=t=>je(t,e.codec()),e.decode=t=>Fe(t,e.codec())}(Lu||(Lu={})),function(e){let t;e.codec=()=>(null==t&&(t=Ye((function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};!1!==r.lengthDelimited&&t.fork(),null!=e.payload&&(t.uint32(10),t.bytes(e.payload)),null!=e.contentTopic&&(t.uint32(18),t.string(e.contentTopic)),null!=e.version&&(t.uint32(24),t.uint32(e.version)),null!=e.timestampDeprecated&&(t.uint32(33),t.double(e.timestampDeprecated)),null!=e.timestamp&&(t.uint32(80),t.sint64(e.timestamp)),null!=e.rateLimitProof&&(t.uint32(170),Lu.codec().encode(e.rateLimitProof,t)),null!=e.ephemeral&&(t.uint32(248),t.bool(e.ephemeral)),!1!==r.lengthDelimited&&t.ldelim()}),((e,t)=>{const r={},n=null==t?e.len:e.pos+t;for(;e.pos<n;){const t=e.uint32();switch(t>>>3){case 1:r.payload=e.bytes();break;case 2:r.contentTopic=e.string();break;case 3:r.version=e.uint32();break;case 4:r.timestampDeprecated=e.double();break;case 10:r.timestamp=e.sint64();break;case 21:r.rateLimitProof=Lu.codec().decode(e,e.uint32());break;case 31:r.ephemeral=e.bool();break;default:e.skipType(7&t)}}return r}))),t),e.encode=t=>je(t,e.codec()),e.decode=t=>Fe(t,e.codec())}(Ou||(Ou={}));Oa("waku:light-push");const Bu="/vac/waku/lightpush/2.0.0-beta1";var Mu,Uu;!function(e){let t;e.codec=()=>(null==t&&(t=Ye((function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!1!==r.lengthDelimited&&t.fork(),null==e.proof)throw new Error('Protocol error: required field "proof" was not found in object');if(t.uint32(10),t.bytes(e.proof),null==e.merkleRoot)throw new Error('Protocol error: required field "merkleRoot" was not found in object');if(t.uint32(18),t.bytes(e.merkleRoot),null==e.epoch)throw new Error('Protocol error: required field "epoch" was not found in object');if(t.uint32(26),t.bytes(e.epoch),null==e.shareX)throw new Error('Protocol error: required field "shareX" was not found in object');if(t.uint32(34),t.bytes(e.shareX),null==e.shareY)throw new Error('Protocol error: required field "shareY" was not found in object');if(t.uint32(42),t.bytes(e.shareY),null==e.nullifier)throw new Error('Protocol error: required field "nullifier" was not found in object');if(t.uint32(50),t.bytes(e.nullifier),null==e.rlnIdentifier)throw new Error('Protocol error: required field "rlnIdentifier" was not found in object');t.uint32(58),t.bytes(e.rlnIdentifier),!1!==r.lengthDelimited&&t.ldelim()}),((e,t)=>{const r={proof:new Uint8Array(0),merkleRoot:new Uint8Array(0),epoch:new Uint8Array(0),shareX:new Uint8Array(0),shareY:new Uint8Array(0),nullifier:new Uint8Array(0),rlnIdentifier:new Uint8Array(0)},n=null==t?e.len:e.pos+t;for(;e.pos<n;){const t=e.uint32();switch(t>>>3){case 1:r.proof=e.bytes();break;case 2:r.merkleRoot=e.bytes();break;case 3:r.epoch=e.bytes();break;case 4:r.shareX=e.bytes();break;case 5:r.shareY=e.bytes();break;case 6:r.nullifier=e.bytes();break;case 7:r.rlnIdentifier=e.bytes();break;default:e.skipType(7&t)}}if(null==r.proof)throw new Error('Protocol error: value for required field "proof" was not found in protobuf');if(null==r.merkleRoot)throw new Error('Protocol error: value for required field "merkleRoot" was not found in protobuf');if(null==r.epoch)throw new Error('Protocol error: value for required field "epoch" was not found in protobuf');if(null==r.shareX)throw new Error('Protocol error: value for required field "shareX" was not found in protobuf');if(null==r.shareY)throw new Error('Protocol error: value for required field "shareY" was not found in protobuf');if(null==r.nullifier)throw new Error('Protocol error: value for required field "nullifier" was not found in protobuf');if(null==r.rlnIdentifier)throw new Error('Protocol error: value for required field "rlnIdentifier" was not found in protobuf');return r}))),t),e.encode=t=>je(t,e.codec()),e.decode=t=>Fe(t,e.codec())}(Mu||(Mu={})),function(e){let t;e.codec=()=>(null==t&&(t=Ye((function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};!1!==r.lengthDelimited&&t.fork(),null!=e.payload&&(t.uint32(10),t.bytes(e.payload)),null!=e.contentTopic&&(t.uint32(18),t.string(e.contentTopic)),null!=e.version&&(t.uint32(24),t.uint32(e.version)),null!=e.timestampDeprecated&&(t.uint32(33),t.double(e.timestampDeprecated)),null!=e.timestamp&&(t.uint32(80),t.sint64(e.timestamp)),null!=e.rateLimitProof&&(t.uint32(170),Mu.codec().encode(e.rateLimitProof,t)),null!=e.ephemeral&&(t.uint32(248),t.bool(e.ephemeral)),!1!==r.lengthDelimited&&t.ldelim()}),((e,t)=>{const r={},n=null==t?e.len:e.pos+t;for(;e.pos<n;){const t=e.uint32();switch(t>>>3){case 1:r.payload=e.bytes();break;case 2:r.contentTopic=e.string();break;case 3:r.version=e.uint32();break;case 4:r.timestampDeprecated=e.double();break;case 10:r.timestamp=e.sint64();break;case 21:r.rateLimitProof=Mu.codec().decode(e,e.uint32());break;case 31:r.ephemeral=e.bool();break;default:e.skipType(7&t)}}return r}))),t),e.encode=t=>je(t,e.codec()),e.decode=t=>Fe(t,e.codec())}(Uu||(Uu={}));const Fu=Oa("waku:message:version-0"),Vu=BigInt(1e6);class ju{constructor(e){this.proto=e}get _rawPayload(){if(this.proto.payload)return new Uint8Array(this.proto.payload)}get ephemeral(){return Boolean(this.proto.ephemeral)}get payload(){return this._rawPayload}get contentTopic(){return this.proto.contentTopic}get _rawTimestamp(){return this.proto.timestamp}get timestamp(){try{if(this.proto.timestamp){const e=this.proto.timestamp/Vu;return new Date(Number(e))}if(this.proto.timestampDeprecated)return new Date(1e3*this.proto.timestampDeprecated)}catch(e){return}}get version(){var e;return null!==(e=this.proto.version)&&void 0!==e?e:0}get rateLimitProof(){return this.proto.rateLimitProof}}class Ku{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this.contentTopic=e,this.ephemeral=t}async toWire(e){return Uu.encode(await this.toProtoObj(e))}async toProtoObj(e){var t;const r=null!==(t=e.timestamp)&&void 0!==t?t:new Date;return{payload:e.payload,version:0,contentTopic:this.contentTopic,timestamp:BigInt(r.valueOf())*Vu,rateLimitProof:e.rateLimitProof,ephemeral:this.ephemeral}}}const qu=["/vac/waku/relay/2.0.0-beta2","/vac/waku/relay/2.0.0"];function zu(e){if(!Number.isSafeInteger(e)||e<0)throw new Error("Wrong positive integer: ".concat(e))}function Hu(e){if(!(e instanceof Uint8Array))throw new TypeError("Expected Uint8Array");for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];if(r.length>0&&!r.includes(e.length))throw new TypeError("Expected Uint8Array of length ".concat(r,", not of length=").concat(e.length))}const Wu={number:zu,bool:function(e){if("boolean"!==typeof e)throw new Error("Expected boolean, not ".concat(e))},bytes:Hu,hash:function(e){if("function"!==typeof e||"function"!==typeof e.create)throw new Error("Hash should be wrapped by utils.wrapConstructor");zu(e.outputLen),zu(e.blockLen)},exists:function(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")},output:function(e,t){Hu(e);const r=t.outputLen;if(e.length<r)throw new Error("digestInto() expects output buffer of length at least ".concat(r))}},Gu=Wu,Qu=("object"===typeof self&&"crypto"in self&&self.crypto,e=>new DataView(e.buffer,e.byteOffset,e.byteLength)),Yu=(e,t)=>e<<32-t|e>>>t;if(!(68===new Uint8Array(new Uint32Array([287454020]).buffer)[0]))throw new Error("Non little-endian hardware is not supported");Array.from({length:256},((e,t)=>t.toString(16).padStart(2,"0")));function $u(e){if("string"===typeof e&&(e=function(e){if("string"!==typeof e)throw new TypeError("utf8ToBytes expected string, got ".concat(typeof e));return(new TextEncoder).encode(e)}(e)),!(e instanceof Uint8Array))throw new TypeError("Expected input type is Uint8Array (got ".concat(typeof e,")"));return e}const Xu=(e,t,r)=>e&t^e&r^t&r,Ju=new Uint32Array([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]),Zu=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),eh=new Uint32Array(64);class th extends class extends class{clone(){return this._cloneInto()}}{constructor(e,t,r,n){super(),this.blockLen=e,this.outputLen=t,this.padOffset=r,this.isLE=n,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=Qu(this.buffer)}update(e){Gu.exists(this);const{view:t,buffer:r,blockLen:n}=this,i=(e=$u(e)).length;for(let s=0;s<i;){const o=Math.min(n-this.pos,i-s);if(o!==n)r.set(e.subarray(s,s+o),this.pos),this.pos+=o,s+=o,this.pos===n&&(this.process(t,0),this.pos=0);else{const t=Qu(e);for(;n<=i-s;s+=n)this.process(t,s)}}return this.length+=e.length,this.roundClean(),this}digestInto(e){Gu.exists(this),Gu.output(e,this),this.finished=!0;const{buffer:t,view:r,blockLen:n,isLE:i}=this;let{pos:s}=this;t[s++]=128,this.buffer.subarray(s).fill(0),this.padOffset>n-s&&(this.process(r,0),s=0);for(let a=s;a<n;a++)t[a]=0;!function(e,t,r,n){if("function"===typeof e.setBigUint64)return e.setBigUint64(t,r,n);const i=BigInt(32),s=BigInt(4294967295),o=Number(r>>i&s),a=Number(r&s),c=n?4:0,l=n?0:4;e.setUint32(t+c,o,n),e.setUint32(t+l,a,n)}(r,n-8,BigInt(8*this.length),i),this.process(r,0);const o=Qu(e);this.get().forEach(((e,t)=>o.setUint32(4*t,e,i)))}digest(){const{buffer:e,outputLen:t}=this;this.digestInto(e);const r=e.slice(0,t);return this.destroy(),r}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());const{blockLen:t,buffer:r,length:n,finished:i,destroyed:s,pos:o}=this;return e.length=n,e.pos=o,e.finished=i,e.destroyed=s,n%t&&e.buffer.set(r),e}}{constructor(){super(64,32,8,!1),this.A=0|Zu[0],this.B=0|Zu[1],this.C=0|Zu[2],this.D=0|Zu[3],this.E=0|Zu[4],this.F=0|Zu[5],this.G=0|Zu[6],this.H=0|Zu[7]}get(){const{A:e,B:t,C:r,D:n,E:i,F:s,G:o,H:a}=this;return[e,t,r,n,i,s,o,a]}set(e,t,r,n,i,s,o,a){this.A=0|e,this.B=0|t,this.C=0|r,this.D=0|n,this.E=0|i,this.F=0|s,this.G=0|o,this.H=0|a}process(e,t){for(let h=0;h<16;h++,t+=4)eh[h]=e.getUint32(t,!1);for(let h=16;h<64;h++){const e=eh[h-15],t=eh[h-2],r=Yu(e,7)^Yu(e,18)^e>>>3,n=Yu(t,17)^Yu(t,19)^t>>>10;eh[h]=n+eh[h-7]+r+eh[h-16]|0}let{A:r,B:n,C:i,D:s,E:o,F:a,G:c,H:l}=this;for(let h=0;h<64;h++){const e=l+(Yu(o,6)^Yu(o,11)^Yu(o,25))+((u=o)&a^~u&c)+Ju[h]+eh[h]|0,t=(Yu(r,2)^Yu(r,13)^Yu(r,22))+Xu(r,n,i)|0;l=c,c=a,a=o,o=s+e|0,s=i,i=n,n=r,r=e+t|0}var u;r=r+this.A|0,n=n+this.B|0,i=i+this.C|0,s=s+this.D|0,o=o+this.E|0,a=a+this.F|0,c=c+this.G|0,l=l+this.H|0,this.set(r,n,i,s,o,a,c,l)}roundClean(){eh.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}!function(e){const t=t=>e().update($u(t)).digest(),r=e();t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=()=>e()}((()=>new th));var rh,nh,ih,sh,oh,ah,ch,lh;!function(e){let t;e.codec=()=>(null==t&&(t=Ye((function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};!1!==r.lengthDelimited&&t.fork(),null!=e.digest&&(t.uint32(10),t.bytes(e.digest)),null!=e.receivedTime&&(t.uint32(16),t.sint64(e.receivedTime)),null!=e.senderTime&&(t.uint32(24),t.sint64(e.senderTime)),null!=e.pubsubTopic&&(t.uint32(34),t.string(e.pubsubTopic)),!1!==r.lengthDelimited&&t.ldelim()}),((e,t)=>{const r={},n=null==t?e.len:e.pos+t;for(;e.pos<n;){const t=e.uint32();switch(t>>>3){case 1:r.digest=e.bytes();break;case 2:r.receivedTime=e.sint64();break;case 3:r.senderTime=e.sint64();break;case 4:r.pubsubTopic=e.string();break;default:e.skipType(7&t)}}return r}))),t),e.encode=t=>je(t,e.codec()),e.decode=t=>Fe(t,e.codec())}(rh||(rh={})),function(e){let t,r,n;!function(e){e.DIRECTION_BACKWARD_UNSPECIFIED="DIRECTION_BACKWARD_UNSPECIFIED",e.DIRECTION_FORWARD="DIRECTION_FORWARD"}(t=e.Direction||(e.Direction={})),function(e){e[e.DIRECTION_BACKWARD_UNSPECIFIED=0]="DIRECTION_BACKWARD_UNSPECIFIED",e[e.DIRECTION_FORWARD=1]="DIRECTION_FORWARD"}(r||(r={})),function(e){e.codec=()=>Qe(r)}(t=e.Direction||(e.Direction={})),e.codec=()=>(null==n&&(n=Ye((function(t,r){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};!1!==n.lengthDelimited&&r.fork(),null!=t.pageSize&&(r.uint32(8),r.uint64(t.pageSize)),null!=t.cursor&&(r.uint32(18),rh.codec().encode(t.cursor,r)),null!=t.direction&&(r.uint32(24),e.Direction.codec().encode(t.direction,r)),!1!==n.lengthDelimited&&r.ldelim()}),((t,r)=>{const n={},i=null==r?t.len:t.pos+r;for(;t.pos<i;){const r=t.uint32();switch(r>>>3){case 1:n.pageSize=t.uint64();break;case 2:n.cursor=rh.codec().decode(t,t.uint32());break;case 3:n.direction=e.Direction.codec().decode(t);break;default:t.skipType(7&r)}}return n}))),n),e.encode=t=>je(t,e.codec()),e.decode=t=>Fe(t,e.codec())}(nh||(nh={})),function(e){let t;e.codec=()=>(null==t&&(t=Ye((function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};!1!==r.lengthDelimited&&t.fork(),null!=e.contentTopic&&(t.uint32(10),t.string(e.contentTopic)),!1!==r.lengthDelimited&&t.ldelim()}),((e,t)=>{const r={},n=null==t?e.len:e.pos+t;for(;e.pos<n;){const t=e.uint32();if(t>>>3===1)r.contentTopic=e.string();else e.skipType(7&t)}return r}))),t),e.encode=t=>je(t,e.codec()),e.decode=t=>Fe(t,e.codec())}(ih||(ih={})),function(e){let t;e.codec=()=>(null==t&&(t=Ye((function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!1!==r.lengthDelimited&&t.fork(),null!=e.pubSubTopic&&(t.uint32(18),t.string(e.pubSubTopic)),null==e.contentFilters)throw new Error('Protocol error: required field "contentFilters" was not found in object');for(const n of e.contentFilters)t.uint32(26),ih.codec().encode(n,t);null!=e.pagingInfo&&(t.uint32(34),nh.codec().encode(e.pagingInfo,t)),null!=e.startTime&&(t.uint32(40),t.sint64(e.startTime)),null!=e.endTime&&(t.uint32(48),t.sint64(e.endTime)),!1!==r.lengthDelimited&&t.ldelim()}),((e,t)=>{const r={contentFilters:[]},n=null==t?e.len:e.pos+t;for(;e.pos<n;){const t=e.uint32();switch(t>>>3){case 2:r.pubSubTopic=e.string();break;case 3:r.contentFilters.push(ih.codec().decode(e,e.uint32()));break;case 4:r.pagingInfo=nh.codec().decode(e,e.uint32());break;case 5:r.startTime=e.sint64();break;case 6:r.endTime=e.sint64();break;default:e.skipType(7&t)}}return r}))),t),e.encode=t=>je(t,e.codec()),e.decode=t=>Fe(t,e.codec())}(sh||(sh={})),function(e){let t,r,n;!function(e){e.ERROR_NONE_UNSPECIFIED="ERROR_NONE_UNSPECIFIED",e.ERROR_INVALID_CURSOR="ERROR_INVALID_CURSOR"}(t=e.HistoryError||(e.HistoryError={})),function(e){e[e.ERROR_NONE_UNSPECIFIED=0]="ERROR_NONE_UNSPECIFIED",e[e.ERROR_INVALID_CURSOR=1]="ERROR_INVALID_CURSOR"}(r||(r={})),function(e){e.codec=()=>Qe(r)}(t=e.HistoryError||(e.HistoryError={})),e.codec=()=>(null==n&&(n=Ye((function(t,r){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!1!==n.lengthDelimited&&r.fork(),null==t.messages)throw new Error('Protocol error: required field "messages" was not found in object');for(const e of t.messages)r.uint32(18),lh.codec().encode(e,r);null!=t.pagingInfo&&(r.uint32(26),nh.codec().encode(t.pagingInfo,r)),null!=t.error&&(r.uint32(32),e.HistoryError.codec().encode(t.error,r)),!1!==n.lengthDelimited&&r.ldelim()}),((t,r)=>{const n={messages:[]},i=null==r?t.len:t.pos+r;for(;t.pos<i;){const r=t.uint32();switch(r>>>3){case 2:n.messages.push(lh.codec().decode(t,t.uint32()));break;case 3:n.pagingInfo=nh.codec().decode(t,t.uint32());break;case 4:n.error=e.HistoryError.codec().decode(t);break;default:t.skipType(7&r)}}return n}))),n),e.encode=t=>je(t,e.codec()),e.decode=t=>Fe(t,e.codec())}(oh||(oh={})),function(e){let t;e.codec=()=>(null==t&&(t=Ye((function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};!1!==r.lengthDelimited&&t.fork(),null!=e.requestId&&(t.uint32(10),t.string(e.requestId)),null!=e.query&&(t.uint32(18),sh.codec().encode(e.query,t)),null!=e.response&&(t.uint32(26),oh.codec().encode(e.response,t)),!1!==r.lengthDelimited&&t.ldelim()}),((e,t)=>{const r={},n=null==t?e.len:e.pos+t;for(;e.pos<n;){const t=e.uint32();switch(t>>>3){case 1:r.requestId=e.string();break;case 2:r.query=sh.codec().decode(e,e.uint32());break;case 3:r.response=oh.codec().decode(e,e.uint32());break;default:e.skipType(7&t)}}return r}))),t),e.encode=t=>je(t,e.codec()),e.decode=t=>Fe(t,e.codec())}(ah||(ah={})),function(e){let t;e.codec=()=>(null==t&&(t=Ye((function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!1!==r.lengthDelimited&&t.fork(),null==e.proof)throw new Error('Protocol error: required field "proof" was not found in object');if(t.uint32(10),t.bytes(e.proof),null==e.merkleRoot)throw new Error('Protocol error: required field "merkleRoot" was not found in object');if(t.uint32(18),t.bytes(e.merkleRoot),null==e.epoch)throw new Error('Protocol error: required field "epoch" was not found in object');if(t.uint32(26),t.bytes(e.epoch),null==e.shareX)throw new Error('Protocol error: required field "shareX" was not found in object');if(t.uint32(34),t.bytes(e.shareX),null==e.shareY)throw new Error('Protocol error: required field "shareY" was not found in object');if(t.uint32(42),t.bytes(e.shareY),null==e.nullifier)throw new Error('Protocol error: required field "nullifier" was not found in object');if(t.uint32(50),t.bytes(e.nullifier),null==e.rlnIdentifier)throw new Error('Protocol error: required field "rlnIdentifier" was not found in object');t.uint32(58),t.bytes(e.rlnIdentifier),!1!==r.lengthDelimited&&t.ldelim()}),((e,t)=>{const r={proof:new Uint8Array(0),merkleRoot:new Uint8Array(0),epoch:new Uint8Array(0),shareX:new Uint8Array(0),shareY:new Uint8Array(0),nullifier:new Uint8Array(0),rlnIdentifier:new Uint8Array(0)},n=null==t?e.len:e.pos+t;for(;e.pos<n;){const t=e.uint32();switch(t>>>3){case 1:r.proof=e.bytes();break;case 2:r.merkleRoot=e.bytes();break;case 3:r.epoch=e.bytes();break;case 4:r.shareX=e.bytes();break;case 5:r.shareY=e.bytes();break;case 6:r.nullifier=e.bytes();break;case 7:r.rlnIdentifier=e.bytes();break;default:e.skipType(7&t)}}if(null==r.proof)throw new Error('Protocol error: value for required field "proof" was not found in protobuf');if(null==r.merkleRoot)throw new Error('Protocol error: value for required field "merkleRoot" was not found in protobuf');if(null==r.epoch)throw new Error('Protocol error: value for required field "epoch" was not found in protobuf');if(null==r.shareX)throw new Error('Protocol error: value for required field "shareX" was not found in protobuf');if(null==r.shareY)throw new Error('Protocol error: value for required field "shareY" was not found in protobuf');if(null==r.nullifier)throw new Error('Protocol error: value for required field "nullifier" was not found in protobuf');if(null==r.rlnIdentifier)throw new Error('Protocol error: value for required field "rlnIdentifier" was not found in protobuf');return r}))),t),e.encode=t=>je(t,e.codec()),e.decode=t=>Fe(t,e.codec())}(ch||(ch={})),function(e){let t;e.codec=()=>(null==t&&(t=Ye((function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};!1!==r.lengthDelimited&&t.fork(),null!=e.payload&&(t.uint32(10),t.bytes(e.payload)),null!=e.contentTopic&&(t.uint32(18),t.string(e.contentTopic)),null!=e.version&&(t.uint32(24),t.uint32(e.version)),null!=e.timestampDeprecated&&(t.uint32(33),t.double(e.timestampDeprecated)),null!=e.timestamp&&(t.uint32(80),t.sint64(e.timestamp)),null!=e.rateLimitProof&&(t.uint32(170),ch.codec().encode(e.rateLimitProof,t)),null!=e.ephemeral&&(t.uint32(248),t.bool(e.ephemeral)),!1!==r.lengthDelimited&&t.ldelim()}),((e,t)=>{const r={},n=null==t?e.len:e.pos+t;for(;e.pos<n;){const t=e.uint32();switch(t>>>3){case 1:r.payload=e.bytes();break;case 2:r.contentTopic=e.string();break;case 3:r.version=e.uint32();break;case 4:r.timestampDeprecated=e.double();break;case 10:r.timestamp=e.sint64();break;case 21:r.rateLimitProof=ch.codec().decode(e,e.uint32());break;case 31:r.ephemeral=e.bool();break;default:e.skipType(7&t)}}return r}))),t),e.encode=t=>je(t,e.codec()),e.decode=t=>Fe(t,e.codec())}(lh||(lh={}));BigInt(1e6);var uh;!function(e){e.BACKWARD="backward",e.FORWARD="forward"}(uh||(uh={}));oh.HistoryError;Oa("waku:store");const hh="/vac/waku/store/2.0.0-beta4";const dh=Oa("waku:waku");class fh{constructor(e,t,r,n,i){this.libp2p=t;const{peerStore:s,connectionManager:o,registrar:a}=t,c={peerStore:s,connectionManager:o,registrar:a};r&&(this.store=r(c)),i&&(this.filter=i(c)),n&&(this.lightPush=n(c)),function(e){if(e)try{return e.multicodecs.includes(qu[qu.length-1])}catch(t){}return!1}(t.pubsub)&&(this.relay=t.pubsub),dh("Waku node created",this.libp2p.peerId.toString(),"relay: ".concat(!!this.relay,", store: ").concat(!!this.store,", light push: ").concat(!!this.lightPush,", filter: ").concat(!!this.filter)),this.pingKeepAliveTimers={},this.relayKeepAliveTimers={};const l=e.pingKeepAlive||0,u=this.relay?e.relayKeepAlive||300:0;t.connectionManager.addEventListener("peer:connect",(e=>{this.startKeepAlive(e.detail.remotePeer,l,u)})),t.connectionManager.addEventListener("peer:disconnect",(e=>{this.stopKeepAlive(e.detail.remotePeer)})),t.addEventListener("peer:discovery",(e=>{const r=e.detail.id;dh("Found peer ".concat(r.toString(),", dialing.")),t.dial(r).catch((e=>{dh("Fail to dial ".concat(r),e)}))}))}async dial(e,t){const r=null!==t&&void 0!==t?t:[];"undefined"===typeof t&&(this.relay&&r.push(_u.Relay),this.store&&r.push(_u.Store),this.filter&&r.push(_u.Filter),this.lightPush&&r.push(_u.LightPush));const n=[];return r.includes(_u.Relay)&&qu.forEach((e=>n.push(e))),r.includes(_u.Store)&&n.push(hh),r.includes(_u.LightPush)&&n.push(Bu),r.includes(_u.Filter)&&n.push(Pu),this.libp2p.dialProtocol(e,n)}async start(){await this.libp2p.start()}async stop(){this.stopAllKeepAlives(),await this.libp2p.stop()}isStarted(){return this.libp2p.isStarted()}getLocalMultiaddrWithID(){const e=this.libp2p.getMultiaddrs().find((e=>e.toString().match(/127\.0\.0\.1/)));if(!e||""===e.toString())throw"Not listening on localhost";return e+"/p2p/"+this.libp2p.peerId.toString()}startKeepAlive(e,t,r){this.stopKeepAlive(e);const n=e.toString();0!==t&&(this.pingKeepAliveTimers[n]=setInterval((()=>{this.libp2p.ping(e).catch((e=>{dh("Ping failed (".concat(n,")"),e)}))}),1e3*t));const i=this.relay;if(i&&0!==r){const e=new Ku("/relay-ping/1/ping/null");this.relayKeepAliveTimers[n]=setInterval((()=>{dh("Sending Waku Relay ping message"),i.send(e,{payload:new Uint8Array}).catch((e=>dh("Failed to send relay ping",e)))}),1e3*r)}}stopKeepAlive(e){const t=e.toString();this.pingKeepAliveTimers[t]&&(clearInterval(this.pingKeepAliveTimers[t]),delete this.pingKeepAliveTimers[t]),this.relayKeepAliveTimers[t]&&(clearInterval(this.relayKeepAliveTimers[t]),delete this.relayKeepAliveTimers[t])}stopAllKeepAlives(){for(const e of[...Object.values(this.pingKeepAliveTimers),...Object.values(this.relayKeepAliveTimers)])clearInterval(e);this.pingKeepAliveTimers={},this.relayKeepAliveTimers={}}}var ph;!function(e){let t;e.codec=()=>(null==t&&(t=Ye((function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};!1!==r.lengthDelimited&&t.fork(),null!=e.contentTopic&&(t.uint32(18),t.string(e.contentTopic)),!1!==r.lengthDelimited&&t.ldelim()}),((e,t)=>{const r={},n=null==t?e.len:e.pos+t;for(;e.pos<n;){const t=e.uint32();if(t>>>3===2)r.contentTopic=e.string();else e.skipType(7&t)}return r}))),t),e.encode=t=>je(t,e.codec()),e.decode=t=>Fe(t,e.codec())}(ph||(ph={}));const yh="ERR_SIGNATURE_NOT_VALID";var gh;!function(e){let t;e.codec=()=>(null==t&&(t=Ye((function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!1!==r.lengthDelimited&&t.fork(),null==e.publicKey)throw new Error('Protocol error: required field "publicKey" was not found in object');if(t.uint32(10),t.bytes(e.publicKey),null==e.payloadType)throw new Error('Protocol error: required field "payloadType" was not found in object');if(t.uint32(18),t.bytes(e.payloadType),null==e.payload)throw new Error('Protocol error: required field "payload" was not found in object');if(t.uint32(26),t.bytes(e.payload),null==e.signature)throw new Error('Protocol error: required field "signature" was not found in object');t.uint32(42),t.bytes(e.signature),!1!==r.lengthDelimited&&t.ldelim()}),((e,t)=>{const r={publicKey:new Uint8Array(0),payloadType:new Uint8Array(0),payload:new Uint8Array(0),signature:new Uint8Array(0)},n=null==t?e.len:e.pos+t;for(;e.pos<n;){const t=e.uint32();switch(t>>>3){case 1:r.publicKey=e.bytes();break;case 2:r.payloadType=e.bytes();break;case 3:r.payload=e.bytes();break;case 5:r.signature=e.bytes();break;default:e.skipType(7&t)}}if(null==r.publicKey)throw new Error('Protocol error: value for required field "publicKey" was not found in protobuf');if(null==r.payloadType)throw new Error('Protocol error: value for required field "payloadType" was not found in protobuf');if(null==r.payload)throw new Error('Protocol error: value for required field "payload" was not found in protobuf');if(null==r.signature)throw new Error('Protocol error: value for required field "signature" was not found in protobuf');return r}))),t),e.encode=t=>je(t,e.codec()),e.decode=t=>Fe(t,e.codec())}(gh||(gh={}));class mh{constructor(e){const{peerId:t,payloadType:r,payload:n,signature:i}=e;this.peerId=t,this.payloadType=r,this.payload=n,this.signature=i}marshal(){if(null==this.peerId.publicKey)throw new Error("Missing public key");return null==this.marshaled&&(this.marshaled=gh.encode({publicKey:this.peerId.publicKey,payloadType:this.payloadType,payload:this.payload.subarray(),signature:this.signature})),this.marshaled}equals(e){return U(this.marshal(),e.marshal())}async validate(e){const t=vh(e,this.payloadType,this.payload);if(null==this.peerId.publicKey)throw new Error("Missing public key");const r=ps(this.peerId.publicKey);return await r.verify(t.subarray(),this.signature)}}mh.createFromProtobuf=async e=>{const t=gh.decode(e),r=await ks(t.publicKey);return new mh({peerId:r,payloadType:t.payloadType,payload:t.payload,signature:t.signature})},mh.seal=async(e,t)=>{if(null==t.privateKey)throw new Error("Missing private key");const r=e.domain,n=e.codec,i=e.marshal(),s=vh(r,n,i),o=await gs(t.privateKey),a=await o.sign(s.subarray());return new mh({peerId:t,payloadType:n,payload:i,signature:a})},mh.openAndCertify=async(e,t)=>{const r=await mh.createFromProtobuf(e);if(!await r.validate(t))throw ue(new Error("envelope signature is not valid for the given domain"),yh);return r};const vh=(e,t,r)=>{const n=Lr(e),i=ae.encode(n.byteLength),s=ae.encode(t.length),o=ae.encode(r.length);return new K(i,n,s,t,o,r)},bh="[a-fA-F\\d:]",wh=e=>e&&e.includeBoundaries?"(?:(?<=\\s|^)(?=".concat(bh,")|(?<=").concat(bh,")(?=\\s|$))"):"",Eh="(?: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}",_h="[a-fA-F\\d]{1,4}",Sh="\n(?:\n(?:".concat(_h,":){7}(?:").concat(_h,"|:)| // 1:2:3:4:5:6:7:: 1:2:3:4:5:6:7:8\n(?:").concat(_h,":){6}(?:").concat(Eh,"|:").concat(_h,"|:)| // 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\n(?:").concat(_h,":){5}(?::").concat(Eh,"|(?::").concat(_h,"){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\n(?:").concat(_h,":){4}(?:(?::").concat(_h,"){0,1}:").concat(Eh,"|(?::").concat(_h,"){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\n(?:").concat(_h,":){3}(?:(?::").concat(_h,"){0,2}:").concat(Eh,"|(?::").concat(_h,"){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\n(?:").concat(_h,":){2}(?:(?::").concat(_h,"){0,3}:").concat(Eh,"|(?::").concat(_h,"){1,5}|:)| // 1:2:: 1:2::4:5:6:7:8 1:2::8 1:2::4:5:6:7:1.2.3.4\n(?:").concat(_h,":){1}(?:(?::").concat(_h,"){0,4}:").concat(Eh,"|(?::").concat(_h,"){1,6}|:)| // 1:: 1::3:4:5:6:7:8 1::8 1::3:4:5:6:7:1.2.3.4\n(?::(?:(?::").concat(_h,"){0,5}:").concat(Eh,"|(?::").concat(_h,"){1,7}|:)) // ::2:3:4:5:6:7:8 ::2:3:4:5:6:7:8 ::8 ::1.2.3.4\n)(?:%[0-9a-zA-Z]{1,})? // %eth0 %1\n").replace(/\s*\/\/.*$/gm,"").replace(/\n/g,"").trim(),Ih=new RegExp("(?:^".concat(Eh,"$)|(?:^").concat(Sh,"$)")),Ch=new RegExp("^".concat(Eh,"$")),Ah=new RegExp("^".concat(Sh,"$")),Th=e=>e&&e.exact?Ih:new RegExp("(?:".concat(wh(e)).concat(Eh).concat(wh(e),")|(?:").concat(wh(e)).concat(Sh).concat(wh(e),")"),"g");Th.v4=e=>e&&e.exact?Ch:new RegExp("".concat(wh(e)).concat(Eh).concat(wh(e)),"g"),Th.v6=e=>e&&e.exact?Ah:new RegExp("".concat(wh(e)).concat(Sh).concat(wh(e)),"g");const kh=Th;function Rh(e){const t=function(){return e(...arguments)};return Object.defineProperty(t,"name",{value:"functionTimeout(".concat(e.name||"<anonymous>",")"),configurable:!0}),t}const{toString:Ph}=Object.prototype;function Dh(e){return"[object RegExp]"===Ph.call(e)}const Nh={global:"g",ignoreCase:"i",multiline:"m",dotAll:"s",sticky:"y",unicode:"u"};function xh(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!Dh(e))throw new TypeError("Expected a RegExp instance");const r=Object.keys(Nh).map((r=>("boolean"===typeof t[r]?t[r]:e[r])?Nh[r]:"")).join(""),n=new RegExp(t.source||e.source,r);return n.lastIndex="number"===typeof t.lastIndex?t.lastIndex:e.lastIndex,n}function Lh(e,t){let{timeout:r}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};try{return Rh((()=>xh(e).test(t)))()}catch(n){throw n}}const Oh={timeout:400};function Bh(e){return Lh(kh({exact:!0}),e.slice(0,45),Oh)}function Mh(e){return Lh(kh.v6({exact:!0}),e.slice(0,45),Oh)}const Uh=function(e){return Lh(kh.v4({exact:!0}),e.slice(0,15),Oh)},Fh=Mh,Vh=function(e){let t,r=0;if(Uh(e))t=new Uint8Array(r+4),e.split(/\./g).forEach((e=>{t[r++]=255&parseInt(e,10)}));else if(Fh(e)){const n=e.split(":",8);let i;for(i=0;i<n.length;i++){let e;Uh(n[i])&&(e=Vh(n[i]),n[i]=Mr(e.slice(0,2),"base16")),null!=e&&++i<8&&n.splice(i,0,Mr(e.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(i=0;i<n.length&&""!==n[i];i++);const e=[i,1];for(i=9-n.length;i>0;i--)e.push("0");n.splice.apply(n,e)}for(t=new Uint8Array(r+16),i=0;i<n.length;i++){const e=parseInt(n[i],16);t[r++]=e>>8&255,t[r++]=255&e}}if(null==t)throw Error("Invalid ip address: "+e);return t},jh=-1,Kh={},qh={};function zh(e){if("number"===typeof e){if(null!=qh[e])return qh[e];throw new Error("no protocol with code: ".concat(e))}if("string"===typeof e){if(null!=Kh[e])return Kh[e];throw new Error("no protocol with name: ".concat(e))}throw new Error("invalid protocol id type: ".concat(typeof e))}function Hh(e,t){switch(zh(e).code){case 4:case 41:return function(e){const t=function(e,t,r){var n;t=~~t,r=null!==(n=r)&&void 0!==n?n:e.length-t;const i=[];let s="";const o=new DataView(e.buffer);if(4===r){for(let n=0;n<r;n++)i.push(e[t+n]);s=i.join(".")}else if(16===r){for(let e=0;e<r;e+=2)i.push(o.getUint16(t+e).toString(16));s=i.join(":"),s=s.replace(/(^|:)0(:0)*:0(:|$)/,"$1::$3"),s=s.replace(/:{3,4}/,"::")}return s}(e,0,e.length);if(null==t||!Bh(t))throw new Error("invalid ip address");return t}(t);case 6:case 273:case 33:case 132:return Xh(t).toString();case 53:case 54:case 55:case 56:case 400:case 777:return function(e){const t=ic.decode(e);if((e=e.slice(ic.decode.bytes)).length!==t)throw new Error("inconsistent lengths");return Mr(e)}(t);case 421:return function(e){const t=ic.decode(e),r=e.slice(ic.decode.bytes);if(r.length!==t)throw new Error("inconsistent lengths");return Mr(r,"base58btc")}(t);case 444:case 445:return Jh(t);case 466:return function(e){const t=ic.decode(e),r=e.slice(ic.decode.bytes);if(r.length!==t)throw new Error("inconsistent lengths");return"u"+Mr(r,"base64url")}(t);default:return Mr(t,"base16")}}function Wh(e,t){switch(zh(e).code){case 4:case 41:return Yh(t);case 6:case 273:case 33:case 132:return $h(parseInt(t,10));case 53:case 54:case 55:case 56:case 400:case 777:return function(e){const t=Lr(e),r=Uint8Array.from(ic.encode(t.length));return M([r,t],r.length+t.length)}(t);case 421:return function(e){let t;t="Q"===e[0]||"1"===e[0]?Jt(Ct.decode("z".concat(e))).bytes:mr.parse(e).multihash.bytes;const r=Uint8Array.from(ic.encode(t.length));return M([r,t],r.length+t.length)}(t);case 444:return function(e){const t=e.split(":");if(2!==t.length)throw new Error("failed to parse onion addr: [\"'".concat(t.join('", "'),"'\"]' does not contain a port number"));if(16!==t[0].length)throw new Error("failed to parse onion addr: ".concat(t[0]," not a Tor onion address."));const r=pt.decode("b"+t[0]),n=parseInt(t[1],10);if(n<1||n>65536)throw new Error("Port number is not in range(1, 65536)");const i=$h(n);return M([r,i],r.length+i.length)}(t);case 445:return function(e){const t=e.split(":");if(2!==t.length)throw new Error("failed to parse onion addr: [\"'".concat(t.join('", "'),"'\"]' does not contain a port number"));if(56!==t[0].length)throw new Error("failed to parse onion addr: ".concat(t[0]," not a Tor onion3 address."));const r=pt.decode("b".concat(t[0])),n=parseInt(t[1],10);if(n<1||n>65536)throw new Error("Port number is not in range(1, 65536)");const i=$h(n);return M([r,i],r.length+i.length)}(t);case 466:return function(e){const t=Qh.decode(e),r=Uint8Array.from(ic.encode(t.length));return M([r,t],r.length+t.length)}(t);default:return Lr(t,"base16")}}[[4,32,"ip4"],[6,16,"tcp"],[33,16,"dccp"],[41,128,"ip6"],[42,jh,"ip6zone"],[53,jh,"dns",!0],[54,jh,"dns4",!0],[55,jh,"dns6",!0],[56,jh,"dnsaddr",!0],[132,16,"sctp"],[273,16,"udp"],[275,0,"p2p-webrtc-star"],[276,0,"p2p-webrtc-direct"],[277,0,"p2p-stardust"],[280,0,"webrtc"],[290,0,"p2p-circuit"],[301,0,"udt"],[302,0,"utp"],[400,jh,"unix",!1,!0],[421,jh,"ipfs"],[421,jh,"p2p"],[443,0,"https"],[444,96,"onion"],[445,296,"onion3"],[446,jh,"garlic64"],[460,0,"quic"],[466,jh,"certhash"],[477,0,"ws"],[478,0,"wss"],[479,0,"p2p-websocket-star"],[480,0,"http"],[777,jh,"memory"]].forEach((e=>{const t=function(e,t,r,n,i){return{code:e,size:t,name:r,resolvable:Boolean(n),path:Boolean(i)}}(...e);qh[t.code]=t,Kh[t.name]=t}));const Gh=Object.values(Rr).map((e=>e.decoder)),Qh=function(){let e=Gh[0].or(Gh[1]);return Gh.slice(2).forEach((t=>e=e.or(t))),e}();function Yh(e){if(!Bh(e))throw new Error("invalid ip address");return Vh(e)}function $h(e){const t=new ArrayBuffer(2);return new DataView(t).setUint16(0,e),new Uint8Array(t)}function Xh(e){return new DataView(e.buffer).getUint16(e.byteOffset)}function Jh(e){const t=e.slice(0,e.length-2),r=e.slice(e.length-2),n=Mr(t,"base32"),i=Xh(r);return"".concat(n,":").concat(i)}function Zh(e){return e.map((e=>{const t=ld(e);return null!=e[1]?[t.code,Hh(t.code,e[1])]:[t.code]}))}function ed(e){return sd(M(e.map((e=>{const t=ld(e);let r=Uint8Array.from(ic.encode(t.code));return e.length>1&&null!=e[1]&&(r=M([r,e[1]])),r}))))}function td(e,t){if(e.size>0)return e.size/8;if(0===e.size)return 0;return ic.decode(t)+ic.decode.bytes}function rd(e){const t=[];let r=0;for(;r<e.length;){const n=ic.decode(e,r),i=ic.decode.bytes,s=td(zh(n),e.slice(r+i));if(0===s){t.push([n]),r+=i;continue}const o=e.slice(r+i,r+i+s);if(r+=s+i,r>e.length)throw cd("Invalid address Uint8Array: "+Mr(e,"base16"));t.push([n,o])}return t}function nd(e){return function(e){const t=[];return e.map((e=>{const r=ld(e);return t.push(r.name),e.length>1&&null!=e[1]&&t.push(e[1]),null})),ad(t.join("/"))}(Zh(rd(e)))}function id(e){const t=function(e){const t=[],r=e.split("/").slice(1);if(1===r.length&&""===r[0])return[];for(let n=0;n<r.length;n++){const i=r[n],s=zh(i);if(0!==s.size){if(n++,n>=r.length)throw cd("invalid address: "+e);if(!0===s.path){t.push([i,ad(r.slice(n).join("/"))]);break}t.push([i,r[n]])}else t.push([i])}return t}(e=ad(e));return ed(t.map((e=>{Array.isArray(e)||(e=[e]);const t=ld(e);return e.length>1?[t.code,Wh(t.code,e[1])]:[t.code]})))}function sd(e){const t=od(e);if(null!=t)throw t;return Uint8Array.from(e)}function od(e){try{rd(e)}catch(t){return t}}function ad(e){return"/"+e.trim().split("/").filter((e=>e)).join("/")}function cd(e){return new Error("Error parsing address: "+e)}function ld(e){return zh(e[0])}const ud=Symbol.for("nodejs.util.inspect.custom"),hd=[zh("dns").code,zh("dns4").code,zh("dns6").code,zh("dnsaddr").code],dd=[zh("p2p").code,zh("ipfs").code],fd=new Map,pd=Symbol.for("@multiformats/js-multiaddr/multiaddr");class yd{constructor(e){if(null==e&&(e=""),Object.defineProperty(this,pd,{value:!0}),e instanceof Uint8Array)this.bytes=sd(e);else if("string"===typeof e){if(e.length>0&&"/"!==e.charAt(0))throw new Error('multiaddr "'.concat(e,'" must start with a "/"'));this.bytes=id(e)}else{if(!yd.isMultiaddr(e))throw new Error("addr must be a string, Buffer, or another Multiaddr");this.bytes=sd(e.bytes)}}toString(){return nd(this.bytes)}toJSON(){return this.toString()}toOptions(){const e=this.protoCodes(),t=this.toString().split("/").slice(1);let r,n;if(t.length>2)hd.includes(e[0])&&dd.includes(e[1])?(r=zh("tcp").name,n=443):(r=zh(t[2]).name,n=parseInt(t[3]));else{if(!hd.includes(e[0]))throw new Error('multiaddr must have a valid format: "/{ip4, ip6, dns4, dns6, dnsaddr}/{address}/{tcp, udp}/{port}".');r=zh("tcp").name,n=443}return{family:41===e[0]||55===e[0]?6:4,host:t[1],transport:r,port:n}}protos(){return this.protoCodes().map((e=>Object.assign({},zh(e))))}protoCodes(){const e=[],t=this.bytes;let r=0;for(;r<t.length;){const n=ic.decode(t,r),i=ic.decode.bytes;r+=td(zh(n),t.slice(r+i))+i,e.push(n)}return e}protoNames(){return this.protos().map((e=>e.name))}tuples(){return rd(this.bytes)}stringTuples(){return Zh(rd(this.bytes))}encapsulate(e){return e=new yd(e),new yd(this.toString()+e.toString())}decapsulate(e){const t=e.toString(),r=this.toString(),n=r.lastIndexOf(t);if(n<0)throw new Error("Address ".concat(this.toString()," does not contain subaddress: ").concat(e.toString()));return new yd(r.slice(0,n))}decapsulateCode(e){const t=this.tuples();for(let r=t.length-1;r>=0;r--)if(t[r][0]===e)return new yd(ed(t.slice(0,r)));return this}getPeerId(){try{const e=this.stringTuples().filter((e=>e[0]===Kh.ipfs.code)),t=e.pop();if(null!=(null===t||void 0===t?void 0:t[1])){const e=t[1];return"Q"===e[0]||"1"===e[0]?Mr(Ct.decode("z".concat(e)),"base58btc"):Mr(mr.parse(e).multihash.bytes,"base58btc")}return null}catch(e){return null}}getPath(){let e=null;try{e=this.stringTuples().filter((e=>!0===zh(e[0]).path))[0][1],null==e&&(e=null)}catch{e=null}return e}equals(e){return U(this.bytes,e.bytes)}async resolve(e){const t=this.protos().find((e=>e.resolvable));if(null==t)return[this];const r=fd.get(t.name);if(null==r)throw ue(new Error("no available resolver for ".concat(t.name)),"ERR_NO_AVAILABLE_RESOLVER");return(await r(this,e)).map((e=>new yd(e)))}nodeAddress(){const e=this.toOptions();if("tcp"!==e.transport&&"udp"!==e.transport)throw new Error('multiaddr must have a valid format - no protocol with name: "'.concat(e.transport,'". Must have a valid transport protocol: "{tcp, udp}"'));return{family:e.family,address:e.host,port:e.port}}isThinWaistAddress(e){const t=(null!==e&&void 0!==e?e:this).protos();return 2===t.length&&((4===t[0].code||41===t[0].code)&&(6===t[1].code||273===t[1].code))}static fromNodeAddress(e,t){if(null==e)throw new Error("requires node address object");if(null==t)throw new Error("requires transport protocol");let r;switch(e.family){case 4:r="ip4";break;case 6:r="ip6";break;default:throw Error("Invalid addr family, should be 4 or 6.")}return new yd("/"+[r,e.address,t,e.port].join("/"))}static isName(e){return!!yd.isMultiaddr(e)&&e.protos().some((e=>e.resolvable))}static isMultiaddr(e){return Boolean(null===e||void 0===e?void 0:e[pd])}[ud](){return"<Multiaddr "+Mr(this.bytes,"base16")+" - "+nd(this.bytes)+">"}inspect(){return"<Multiaddr "+Mr(this.bytes,"base16")+" - "+nd(this.bytes)+">"}}var gd;yd.resolvers=fd,function(e){let t,r;!function(e){let t;e.codec=()=>(null==t&&(t=Ye((function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!1!==r.lengthDelimited&&t.fork(),null==e.multiaddr)throw new Error('Protocol error: required field "multiaddr" was not found in object');t.uint32(10),t.bytes(e.multiaddr),!1!==r.lengthDelimited&&t.ldelim()}),((e,t)=>{const r={multiaddr:new Uint8Array(0)},n=null==t?e.len:e.pos+t;for(;e.pos<n;){const t=e.uint32();if(t>>>3===1)r.multiaddr=e.bytes();else e.skipType(7&t)}if(null==r.multiaddr)throw new Error('Protocol error: value for required field "multiaddr" was not found in protobuf');return r}))),t),e.encode=t=>je(t,e.codec()),e.decode=t=>Fe(t,e.codec())}(t=e.AddressInfo||(e.AddressInfo={})),e.codec=()=>(null==r&&(r=Ye((function(t,r){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!1!==n.lengthDelimited&&r.fork(),null==t.peerId)throw new Error('Protocol error: required field "peerId" was not found in object');if(r.uint32(10),r.bytes(t.peerId),null==t.seq)throw new Error('Protocol error: required field "seq" was not found in object');if(r.uint32(16),r.uint64(t.seq),null==t.addresses)throw new Error('Protocol error: required field "addresses" was not found in object');for(const i of t.addresses)r.uint32(26),e.AddressInfo.codec().encode(i,r);!1!==n.lengthDelimited&&r.ldelim()}),((t,r)=>{const n={peerId:new Uint8Array(0),seq:0n,addresses:[]},i=null==r?t.len:t.pos+r;for(;t.pos<i;){const r=t.uint32();switch(r>>>3){case 1:n.peerId=t.bytes();break;case 2:n.seq=t.uint64();break;case 3:n.addresses.push(e.AddressInfo.codec().decode(t,t.uint32()));break;default:t.skipType(7&r)}}if(null==n.peerId)throw new Error('Protocol error: value for required field "peerId" was not found in protobuf');if(null==n.seq)throw new Error('Protocol error: value for required field "seq" was not found in protobuf');return n}))),r),e.encode=t=>je(t,e.codec()),e.decode=t=>Fe(t,e.codec())}(gd||(gd={}));const md=Uint8Array.from([3,1]);class vd{constructor(e){this.domain=vd.DOMAIN,this.codec=vd.CODEC;const{peerId:t,multiaddrs:r,seqNumber:n}=e;this.peerId=t,this.multiaddrs=null!==r&&void 0!==r?r:[],this.seqNumber=null!==n&&void 0!==n?n:BigInt(Date.now())}marshal(){return null==this.marshaled&&(this.marshaled=gd.encode({peerId:this.peerId.toBytes(),seq:BigInt(this.seqNumber),addresses:this.multiaddrs.map((e=>({multiaddr:e.bytes})))})),this.marshaled}equals(e){return e instanceof vd&&(!!this.peerId.equals(e.peerId)&&(this.seqNumber===e.seqNumber&&!!function(e,t){const r=(e,t)=>e.toString().localeCompare(t.toString());return e.length===t.length&&t.sort(r)&&e.sort(r).every(((e,r)=>t[r].equals(e)))}(this.multiaddrs,e.multiaddrs)))}}vd.createFromProtobuf=e=>{var t;const r=gd.decode(e),n=Ts(r.peerId),i=(null!==(t=r.addresses)&&void 0!==t?t:[]).map((e=>new yd(e.multiaddr))),s=r.seq;return new vd({peerId:n,multiaddrs:i,seqNumber:s})},vd.DOMAIN="libp2p-peer-record",vd.CODEC=md;const bd=Symbol.for("@libp2p/topology");const wd=()=>{};class Ed{constructor(e){var t,r,n,i;this.min=null!==(t=e.min)&&void 0!==t?t:0,this.max=null!==(r=e.max)&&void 0!==r?r:1/0,this.peers=new Set,this.onConnect=null!==(n=e.onConnect)&&void 0!==n?n:wd,this.onDisconnect=null!==(i=e.onDisconnect)&&void 0!==i?i:wd}get[Symbol.toStringTag](){return bd.toString()}get[bd](){return!0}async setRegistrar(e){this.registrar=e}disconnect(e){this.onDisconnect(e)}}class _d{constructor(e,t,r){this.gossip=e,this.msgs=new Map,this.history=[],this.notValidatedCount=0,this.msgIdToStrFn=r;for(let n=0;n<t;n++)this.history[n]=[]}get size(){return this.msgs.size}put(e,t){let r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const{msgIdStr:n}=e;return!this.msgs.has(n)&&(this.msgs.set(n,{message:t,validated:r,originatingPeers:new Set,iwantCounts:new Map}),this.history[0].push({...e,topic:t.topic}),r||this.notValidatedCount++,!0)}observeDuplicate(e,t){const r=this.msgs.get(e);r&&!r.validated&&r.originatingPeers.add(t)}get(e){var t;return null===(t=this.msgs.get(this.msgIdToStrFn(e)))||void 0===t?void 0:t.message}getWithIWantCount(e,t){var r;const n=this.msgs.get(e);if(!n)return null;const i=(null!==(r=n.iwantCounts.get(t))&&void 0!==r?r:0)+1;return n.iwantCounts.set(t,i),{msg:n.message,count:i}}getGossipIDs(e){const t=new Map;for(let r=0;r<this.gossip;r++)this.history[r].forEach((r=>{const n=this.msgs.get(r.msgIdStr);if(n&&n.validated&&e.has(r.topic)){let e=t.get(r.topic);e||(e=[],t.set(r.topic,e)),e.push(r.msgId)}}));return t}validate(e){const t=this.msgs.get(e);if(!t)return null;t.validated||this.notValidatedCount--;const{message:r,originatingPeers:n}=t;return t.validated=!0,t.originatingPeers=new Set,{message:r,originatingPeers:n}}shift(){this.history[this.history.length-1].forEach((e=>{const t=this.msgs.get(e.msgIdStr);t&&(this.msgs.delete(e.msgIdStr),t.validated||this.notValidatedCount--)})),this.history.pop(),this.history.unshift([])}remove(e){const t=this.msgs.get(e);return t?(this.msgs.delete(e),t):null}}var Sd=__webpack_require__(4763);const{RPC:Id}=Sd,Cd="/floodsub/1.0.0",Ad="/meshsub/1.0.0",Td="/meshsub/1.1.0",kd=5e3;function Rd(e){if(e.length<=1)return e;for(let t=0;t<e.length;t++){const r=Math.floor(Math.random()*Math.floor(e.length)),n=e[t];e[t]=e[r],e[r]=n}return e}function Pd(e){return La(e,"base64")}const Dd="StrictSign",Nd="StrictNoSign";var xd,Ld,Od,Bd,Md,Ud;function Fd(e){switch(e){case xd.Ignore:return Bd.Ignore;case xd.Reject:return Bd.Reject}}!function(e){e.Accept="accept",e.Ignore="ignore",e.Reject="reject"}(xd||(xd={})),function(e){e.StrictSign="StrictSign",e.StrictNoSign="StrictNoSign"}(Ld||(Ld={})),function(e){e[e.Signing=0]="Signing",e[e.Anonymous=1]="Anonymous"}(Od||(Od={})),function(e){e.Error="error",e.Ignore="ignore",e.Reject="reject",e.Blacklisted="blacklisted"}(Bd||(Bd={})),function(e){e.InvalidSignature="invalid_signature",e.InvalidSeqno="invalid_seqno",e.InvalidPeerId="invalid_peerid",e.SignaturePresent="signature_present",e.SeqnoPresent="seqno_present",e.FromPresent="from_present",e.TransformFailed="transform_failed"}(Md||(Md={})),function(e){e.duplicate="duplicate",e.invalid="invalid",e.valid="valid"}(Ud||(Ud={}));const Vd="ERR_INVALID_PEER_SCORE_PARAMS",jd={topics:{},topicScoreCap:10,appSpecificScore:()=>0,appSpecificWeight:10,IPColocationFactorWeight:-5,IPColocationFactorThreshold:10,IPColocationFactorWhitelist:new Set,behaviourPenaltyWeight:-10,behaviourPenaltyThreshold:0,behaviourPenaltyDecay:.2,decayInterval:1e3,decayToZero:.1,retainScore:36e5},Kd={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 qd(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{...jd,...e,topics:e.topics?Object.entries(e.topics).reduce(((e,t)=>{let[r,n]=t;return e[r]=zd(n),e}),{}):{}}}function zd(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{...Kd,...e}}function Hd(e){if(e.topicWeight<0)throw ue(new Error("invalid topic weight; must be >= 0"),Vd);if(0===e.timeInMeshQuantum)throw ue(new Error("invalid TimeInMeshQuantum; must be non zero"),Vd);if(e.timeInMeshWeight<0)throw ue(new Error("invalid TimeInMeshWeight; must be positive (or 0 to disable)"),Vd);if(0!==e.timeInMeshWeight&&e.timeInMeshQuantum<=0)throw ue(new Error("invalid TimeInMeshQuantum; must be positive"),Vd);if(0!==e.timeInMeshWeight&&e.timeInMeshCap<=0)throw ue(new Error("invalid TimeInMeshCap; must be positive"),Vd);if(e.firstMessageDeliveriesWeight<0)throw ue(new Error("invallid FirstMessageDeliveriesWeight; must be positive (or 0 to disable)"),Vd);if(0!==e.firstMessageDeliveriesWeight&&(e.firstMessageDeliveriesDecay<=0||e.firstMessageDeliveriesDecay>=1))throw ue(new Error("invalid FirstMessageDeliveriesDecay; must be between 0 and 1"),Vd);if(0!==e.firstMessageDeliveriesWeight&&e.firstMessageDeliveriesCap<=0)throw ue(new Error("invalid FirstMessageDeliveriesCap; must be positive"),Vd);if(e.meshMessageDeliveriesWeight>0)throw ue(new Error("invalid MeshMessageDeliveriesWeight; must be negative (or 0 to disable)"),Vd);if(0!==e.meshMessageDeliveriesWeight&&(e.meshMessageDeliveriesDecay<=0||e.meshMessageDeliveriesDecay>=1))throw ue(new Error("invalid MeshMessageDeliveriesDecay; must be between 0 and 1"),Vd);if(0!==e.meshMessageDeliveriesWeight&&e.meshMessageDeliveriesCap<=0)throw ue(new Error("invalid MeshMessageDeliveriesCap; must be positive"),Vd);if(0!==e.meshMessageDeliveriesWeight&&e.meshMessageDeliveriesThreshold<=0)throw ue(new Error("invalid MeshMessageDeliveriesThreshold; must be positive"),Vd);if(e.meshMessageDeliveriesWindow<0)throw ue(new Error("invalid MeshMessageDeliveriesWindow; must be non-negative"),Vd);if(0!==e.meshMessageDeliveriesWeight&&e.meshMessageDeliveriesActivation<1e3)throw ue(new Error("invalid MeshMessageDeliveriesActivation; must be at least 1s"),Vd);if(e.meshFailurePenaltyWeight>0)throw ue(new Error("invalid MeshFailurePenaltyWeight; must be negative (or 0 to disable)"),Vd);if(0!==e.meshFailurePenaltyWeight&&(e.meshFailurePenaltyDecay<=0||e.meshFailurePenaltyDecay>=1))throw ue(new Error("invalid MeshFailurePenaltyDecay; must be between 0 and 1"),Vd);if(e.invalidMessageDeliveriesWeight>0)throw ue(new Error("invalid InvalidMessageDeliveriesWeight; must be negative (or 0 to disable)"),Vd);if(e.invalidMessageDeliveriesDecay<=0||e.invalidMessageDeliveriesDecay>=1)throw ue(new Error("invalid InvalidMessageDeliveriesDecay; must be between 0 and 1"),Vd)}const Wd={gossipThreshold:-10,publishThreshold:-50,graylistThreshold:-80,acceptPXThreshold:10,opportunisticGraftThreshold:20};function Gd(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{...Wd,...e}}function Qd(e,t,r,n){let i=0;Object.entries(t.topics).forEach((e=>{let[t,n]=e;const s=r.topics[t];if(void 0===s)return;let o=0;if(n.inMesh){let e=n.meshTime/s.timeInMeshQuantum;e>s.timeInMeshCap&&(e=s.timeInMeshCap),o+=e*s.timeInMeshWeight}let a=n.firstMessageDeliveries;if(a>s.firstMessageDeliveriesCap&&(a=s.firstMessageDeliveriesCap),o+=a*s.firstMessageDeliveriesWeight,n.meshMessageDeliveriesActive&&n.meshMessageDeliveries<s.meshMessageDeliveriesThreshold){const e=s.meshMessageDeliveriesThreshold-n.meshMessageDeliveries;o+=e*e*s.meshMessageDeliveriesWeight}o+=n.meshFailurePenalty*s.meshFailurePenaltyWeight;o+=n.invalidMessageDeliveries*n.invalidMessageDeliveries*s.invalidMessageDeliveriesWeight,i+=o*s.topicWeight})),r.topicScoreCap>0&&i>r.topicScoreCap&&(i=r.topicScoreCap);const s=r.appSpecificScore(e);if(i+=s*r.appSpecificWeight,t.knownIPs.forEach((e=>{if(r.IPColocationFactorWhitelist.has(e))return;const t=n.get(e),s=t?t.size:0;if(s>r.IPColocationFactorThreshold){const e=s-r.IPColocationFactorThreshold;i+=e*e*r.IPColocationFactorWeight}})),t.behaviourPenalty>r.behaviourPenaltyThreshold){const e=t.behaviourPenalty-r.behaviourPenaltyThreshold;i+=e*e*r.behaviourPenaltyWeight}return i}var Yd,$d=__webpack_require__(8865);!function(e){e[e.unknown=0]="unknown",e[e.valid=1]="valid",e[e.invalid=2]="invalid",e[e.ignored=3]="ignored"}(Yd||(Yd={}));class Xd{constructor(){this.records=new Map,this.queue=new $d}ensureRecord(e){let t=this.records.get(e);if(t)return t;t={status:Yd.unknown,firstSeen:Date.now(),validated:0,peers:new Set},this.records.set(e,t);const r={msgId:e,expire:Date.now()+12e4};return this.queue.push(r),t}gc(){const e=Date.now();let t=this.queue.peekFront();for(;t&&t.expire<e;)this.records.delete(t.msgId),this.queue.shift(),t=this.queue.peekFront()}clear(){this.records.clear(),this.queue.clear()}}function Jd(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:()=>!0;const n=new Set;if(t<=0)return n;for(const i of e){if(n.size>=t)break;r(i)&&(n.add(i),e.delete(i))}return n}class Zd extends Map{constructor(e){super(),this.getDefault=e}getOrDefault(e){let t=super.get(e);return void 0===t&&(t=this.getDefault(),this.set(e,t)),t}}const ef=Ba("libp2p:gossipsub:score");class tf{constructor(e,t,r){var n;this.params=e,this.metrics=t,this.peerStats=new Map,this.peerIPs=new Zd((()=>new Set)),this.scoreCache=new Map,this.deliveryRecords=new Xd,function(e){for(const[r,n]of Object.entries(e.topics))try{Hd(n)}catch(t){throw ue(new Error("invalid score parameters for topic ".concat(r,": ").concat(t.message)),Vd)}if(e.topicScoreCap<0)throw ue(new Error("invalid topic score cap; must be positive (or 0 for no cap)"),Vd);if(null===e.appSpecificScore||void 0===e.appSpecificScore)throw ue(new Error("missing application specific score function"),Vd);if(e.IPColocationFactorWeight>0)throw ue(new Error("invalid IPColocationFactorWeight; must be negative (or 0 to disable)"),Vd);if(0!==e.IPColocationFactorWeight&&e.IPColocationFactorThreshold<1)throw ue(new Error("invalid IPColocationFactorThreshold; must be at least 1"),Vd);if(e.behaviourPenaltyWeight>0)throw ue(new Error("invalid BehaviourPenaltyWeight; must be negative (or 0 to disable)"),Vd);if(0!==e.behaviourPenaltyWeight&&(e.behaviourPenaltyDecay<=0||e.behaviourPenaltyDecay>=1))throw ue(new Error("invalid BehaviourPenaltyDecay; must be between 0 and 1"),Vd);if(e.decayInterval<1e3)throw ue(new Error("invalid DecayInterval; must be at least 1s"),Vd);if(e.decayToZero<=0||e.decayToZero>=1)throw ue(new Error("invalid DecayToZero; must be between 0 and 1"),Vd)}(e),this.scoreCacheValidityMs=r.scoreCacheValidityMs,this.computeScore=null!==(n=r.computeScore)&&void 0!==n?n:Qd}get size(){return this.peerStats.size}start(){this._backgroundInterval?ef("Peer score already running"):(this._backgroundInterval=setInterval((()=>this.background()),this.params.decayInterval),ef("started"))}stop(){this._backgroundInterval?(clearInterval(this._backgroundInterval),delete this._backgroundInterval,this.peerIPs.clear(),this.peerStats.clear(),this.deliveryRecords.clear(),ef("stopped")):ef("Peer score already stopped")}background(){this.refreshScores(),this.deliveryRecords.gc()}dumpPeerScoreStats(){return Object.fromEntries(Array.from(this.peerStats.entries()).map((e=>{let[t,r]=e;return[t,r]})))}refreshScores(){const e=Date.now(),t=this.params.decayToZero;this.peerStats.forEach(((r,n)=>{r.connected?(Object.entries(r.topics).forEach((r=>{let[n,i]=r;const s=this.params.topics[n];void 0!==s&&(i.firstMessageDeliveries*=s.firstMessageDeliveriesDecay,i.firstMessageDeliveries<t&&(i.firstMessageDeliveries=0),i.meshMessageDeliveries*=s.meshMessageDeliveriesDecay,i.meshMessageDeliveries<t&&(i.meshMessageDeliveries=0),i.meshFailurePenalty*=s.meshFailurePenaltyDecay,i.meshFailurePenalty<t&&(i.meshFailurePenalty=0),i.invalidMessageDeliveries*=s.invalidMessageDeliveriesDecay,i.invalidMessageDeliveries<t&&(i.invalidMessageDeliveries=0),i.inMesh&&(i.meshTime=e-i.graftTime,i.meshTime>s.meshMessageDeliveriesActivation&&(i.meshMessageDeliveriesActive=!0)))})),r.behaviourPenalty*=this.params.behaviourPenaltyDecay,r.behaviourPenalty<t&&(r.behaviourPenalty=0)):e>r.expire&&(this.removeIPsForPeer(n,r.knownIPs),this.peerStats.delete(n),this.scoreCache.delete(n))}))}score(e){var t,r;null===(t=this.metrics)||void 0===t||t.scoreFnCalls.inc();const n=this.peerStats.get(e);if(!n)return 0;const i=Date.now(),s=this.scoreCache.get(e);if(s&&s.cacheUntil>i)return s.score;null===(r=this.metrics)||void 0===r||r.scoreFnRuns.inc();const o=this.computeScore(e,n,this.params,this.peerIPs),a=i+this.scoreCacheValidityMs;var c;s?(null===(c=this.metrics)||void 0===c||c.scoreCachedDelta.observe(Math.abs(o-s.score)),s.score=o,s.cacheUntil=a):this.scoreCache.set(e,{score:o,cacheUntil:a});return o}addPenalty(e,t,r){const n=this.peerStats.get(e);var i;n&&(n.behaviourPenalty+=t,null===(i=this.metrics)||void 0===i||i.onScorePenalty(r))}addPeer(e){const t={connected:!0,expire:0,topics:{},knownIPs:new Set,behaviourPenalty:0};this.peerStats.set(e,t)}addIP(e,t){const r=this.peerStats.get(e);r&&r.knownIPs.add(t),this.peerIPs.getOrDefault(t).add(e)}removeIP(e,t){const r=this.peerStats.get(e);r&&r.knownIPs.delete(t);const n=this.peerIPs.get(t);n&&(n.delete(e),0===n.size&&this.peerIPs.delete(t))}removePeer(e){const t=this.peerStats.get(e);if(t){if(this.score(e)>0)return this.removeIPsForPeer(e,t.knownIPs),void this.peerStats.delete(e);Object.entries(t.topics).forEach((e=>{let[t,r]=e;r.firstMessageDeliveries=0;const n=this.params.topics[t].meshMessageDeliveriesThreshold;if(r.inMesh&&r.meshMessageDeliveriesActive&&r.meshMessageDeliveries<n){const e=n-r.meshMessageDeliveries;r.meshFailurePenalty+=e*e}r.inMesh=!1,r.meshMessageDeliveriesActive=!1})),t.connected=!1,t.expire=Date.now()+this.params.retainScore}}graft(e,t){const r=this.peerStats.get(e);if(r){const e=this.getPtopicStats(r,t);e&&(e.inMesh=!0,e.graftTime=Date.now(),e.meshTime=0,e.meshMessageDeliveriesActive=!1)}}prune(e,t){const r=this.peerStats.get(e);if(r){const e=this.getPtopicStats(r,t);if(e){const r=this.params.topics[t].meshMessageDeliveriesThreshold;if(e.meshMessageDeliveriesActive&&e.meshMessageDeliveries<r){const t=r-e.meshMessageDeliveries;e.meshFailurePenalty+=t*t}e.meshMessageDeliveriesActive=!1,e.inMesh=!1}}}validateMessage(e){this.deliveryRecords.ensureRecord(e)}deliverMessage(e,t,r){this.markFirstMessageDelivery(e,r);const n=this.deliveryRecords.ensureRecord(t),i=Date.now();n.status===Yd.unknown?(n.status=Yd.valid,n.validated=i,n.peers.forEach((t=>{t!==e.toString()&&this.markDuplicateMessageDelivery(t,r)}))):ef("unexpected delivery: message from %s was first seen %s ago and has delivery status %s",e,i-n.firstSeen,Yd[n.status])}rejectInvalidMessage(e,t){this.markInvalidMessageDelivery(e,t)}rejectMessage(e,t,r,n){switch(n){case Bd.Error:return void this.markInvalidMessageDelivery(e,r);case Bd.Blacklisted:return}const i=this.deliveryRecords.ensureRecord(t);if(i.status===Yd.unknown){if(n===Bd.Ignore)return i.status=Yd.ignored,void i.peers.clear();i.status=Yd.invalid,this.markInvalidMessageDelivery(e,r),i.peers.forEach((e=>{this.markInvalidMessageDelivery(e,r)})),i.peers.clear()}else ef("unexpected rejection: message from %s was first seen %s ago and has delivery status %d",e,Date.now()-i.firstSeen,Yd[i.status])}duplicateMessage(e,t,r){const n=this.deliveryRecords.ensureRecord(t);if(!n.peers.has(e))switch(n.status){case Yd.unknown:n.peers.add(e);break;case Yd.valid:n.peers.add(e),this.markDuplicateMessageDelivery(e,r,n.validated);break;case Yd.invalid:this.markInvalidMessageDelivery(e,r);case Yd.ignored:}}markInvalidMessageDelivery(e,t){const r=this.peerStats.get(e);if(r){const e=this.getPtopicStats(r,t);e&&(e.invalidMessageDeliveries+=1)}}markFirstMessageDelivery(e,t){const r=this.peerStats.get(e);if(r){const e=this.getPtopicStats(r,t);if(e){let r=this.params.topics[t].firstMessageDeliveriesCap;e.firstMessageDeliveries=Math.min(r,e.firstMessageDeliveries+1),e.inMesh&&(r=this.params.topics[t].meshMessageDeliveriesCap,e.meshMessageDeliveries=Math.min(r,e.meshMessageDeliveries+1))}}}markDuplicateMessageDelivery(e,t,r){const n=this.peerStats.get(e);if(n){const e=void 0!==r?Date.now():0,s=this.getPtopicStats(n,t);if(s&&s.inMesh){const n=this.params.topics[t];if(void 0!==r){var i;const s=e-r,o=s>n.meshMessageDeliveriesWindow;if(null===(i=this.metrics)||void 0===i||i.onDuplicateMsgDelivery(t,s,o),o)return}const o=n.meshMessageDeliveriesCap;s.meshMessageDeliveries=Math.min(o,s.meshMessageDeliveries+1)}}}removeIPsForPeer(e,t){for(const r of t){const t=this.peerIPs.get(r);t&&(t.delete(e),0===t.size&&this.peerIPs.delete(r))}}getPtopicStats(e,t){let r=e.topics[t];return void 0!==r?r:void 0!==this.params.topics[t]?(r={inMesh:!1,graftTime:0,meshTime:0,firstMessageDeliveries:0,meshMessageDeliveries:0,meshMessageDeliveriesActive:!1,meshFailurePenalty:0,invalidMessageDeliveries:0},e.topics[t]=r,r):null}}class rf{constructor(e,t,r){this.gossipsubIWantFollowupMs=e,this.msgIdToStrFn=t,this.metrics=r,this.promises=new Map,this.requestMsByMsg=new Map,this.requestMsByMsgExpire=10*e}get size(){return this.promises.size}get requestMsByMsgSize(){return this.requestMsByMsg.size}addPromise(e,t){const r=t[Math.floor(Math.random()*t.length)],n=this.msgIdToStrFn(r);let i=this.promises.get(n);i||(i=new Map,this.promises.set(n,i));const s=Date.now();i.has(e)||(i.set(e,s+this.gossipsubIWantFollowupMs),this.metrics&&(this.metrics.iwantPromiseStarted.inc(1),this.requestMsByMsg.has(n)||this.requestMsByMsg.set(n,s)))}getBrokenPromises(){var e;const t=Date.now(),r=new Map;let n=0;return this.promises.forEach(((e,i)=>{e.forEach(((i,s)=>{var o;i<t&&(r.set(s,(null!==(o=r.get(s))&&void 0!==o?o:0)+1),e.delete(s),n++)})),e.size||this.promises.delete(i)})),null===(e=this.metrics)||void 0===e||e.iwantPromiseBroken.inc(n),r}deliverMessage(e){this.trackMessage(e);const t=this.promises.get(e);t&&(this.promises.delete(e),this.metrics&&(this.metrics.iwantPromiseResolved.inc(1),this.metrics.iwantPromiseResolvedPeers.inc(t.size)))}rejectMessage(e,t){this.trackMessage(e),t!==Bd.Error&&this.promises.delete(e)}clear(){this.promises.clear()}prune(){const e=Date.now()-this.requestMsByMsgExpire;for(const[t,r]of this.requestMsByMsg.entries()){if(!(r<e))break;this.requestMsByMsg.delete(t)}}trackMessage(e){if(this.metrics){const t=this.requestMsByMsg.get(e);void 0!==t&&(this.metrics.iwantPromiseDeliveryTime.observe((Date.now()-t)/1e3),this.requestMsByMsg.delete(e))}}}class nf{constructor(e){this.entries=new Map,this.validityMs=e.validityMs}get size(){return this.entries.size}put(e,t){return!!this.entries.has(e)||(this.entries.set(e,{value:t,validUntilMs:Date.now()+this.validityMs}),!1)}prune(){const e=Date.now();for(const[t,r]of this.entries.entries()){if(!(r.validUntilMs<e))break;this.entries.delete(t)}}has(e){return this.entries.has(e)}get(e){const t=this.entries.get(e);return t&&t.validUntilMs>=Date.now()?t.value:void 0}clear(){this.entries.clear()}}var sf,of,af,cf,lf,uf;!function(e){e.forward="forward",e.publish="publish"}(sf||(sf={})),function(e){e.Fanout="fanout",e.Random="random",e.Subscribed="subscribed",e.Outbound="outbound",e.NotEnough="not_enough",e.Opportunistic="opportunistic"}(of||(of={})),function(e){e.Dc="disconnected",e.BadScore="bad_score",e.Prune="prune",e.Unsub="unsubscribed",e.Excess="excess"}(af||(af={})),function(e){e.GraftBackoff="graft_backoff",e.BrokenPromise="broken_promise",e.MessageDeficit="message_deficit",e.IPColocation="IP_colocation"}(cf||(cf={})),function(e){e.LowScore="low_score",e.MaxIhave="max_ihave",e.MaxIasked="max_iasked"}(lf||(lf={})),function(e){e.graylist="graylist",e.publish="publish",e.gossip="gossip",e.mesh="mesh"}(uf||(uf={}));__webpack_require__(5645);var hf=__webpack_require__(7068);const df={sha1:"sha1","sha2-256":"sha256","sha2-512":"sha512"};function ff(e,t,r,n,i){if("sha1"!==i&&"sha2-256"!==i&&"sha2-512"!==i){const e=Object.keys(df).join(" / ");throw ue(new Error("Hash '".concat(i,"' is unknown or not supported. Must be ").concat(e)),"ERR_UNSUPPORTED_HASH_TYPE")}const s=hf(e,t,r,n,df[i]);return Br.encode64(s,null)}const pf=ha("libp2p-pubsub:");function yf(e){if("signed"!==e.type)throw new Error("expected signed message type");if(null==e.sequenceNumber)throw Error("missing seqno field");return((e,t)=>{const r=ha(t.toString(16).padStart(16,"0"),"base16"),n=new Uint8Array(e.length+r.length);return n.set(e,0),n.set(r,e.length),n})(e.from.toBytes(),e.sequenceNumber)}async function gf(e){return await Bo.encode(e.data)}function mf(e,t,r,n,i){let s=0;const o=new Map;if(Object.entries(t.topics).forEach((e=>{var t;let[n,a]=e;const c=null!==(t=i.get(n))&&void 0!==t?t:"unknown",l=r.topics[n];if(void 0===l)return;let u=o.get(c);u||(u={p1w:0,p2w:0,p3w:0,p3bw:0,p4w:0},o.set(c,u));let h=0,d=0,f=0,p=0,y=0;if(a.inMesh){h+=Math.max(a.meshTime/l.timeInMeshQuantum,l.timeInMeshCap)*l.timeInMeshWeight}let g=a.firstMessageDeliveries;if(g>l.firstMessageDeliveriesCap&&(g=l.firstMessageDeliveriesCap),d+=g*l.firstMessageDeliveriesWeight,a.meshMessageDeliveriesActive&&a.meshMessageDeliveries<l.meshMessageDeliveriesThreshold){const e=l.meshMessageDeliveriesThreshold-a.meshMessageDeliveries;f+=e*e*l.meshMessageDeliveriesWeight}p+=a.meshFailurePenalty*l.meshFailurePenaltyWeight;y+=a.invalidMessageDeliveries*a.invalidMessageDeliveries*l.invalidMessageDeliveriesWeight,s+=(h+d+f+p+y)*l.topicWeight,u.p1w+=h,u.p2w+=d,u.p3w+=f,u.p3bw+=p,u.p4w+=y})),r.topicScoreCap>0&&s>r.topicScoreCap){s=r.topicScoreCap;const e=r.topicScoreCap/s;for(const t of o.values())t.p1w*=e,t.p2w*=e,t.p3w*=e,t.p3bw*=e,t.p4w*=e}let a=0,c=0,l=0;a+=r.appSpecificScore(e)*r.appSpecificWeight,t.knownIPs.forEach((e=>{if(r.IPColocationFactorWhitelist.has(e))return;const t=n.get(e),i=t?t.size:0;if(i>r.IPColocationFactorThreshold){const e=i-r.IPColocationFactorThreshold;c+=e*e*r.IPColocationFactorWeight}}));return l+=t.behaviourPenalty*t.behaviourPenalty*r.behaviourPenaltyWeight,s+=a+c+l,{byTopic:o,p5w:a,p6w:c,p7w:l,score:s}}class vf{constructor(e,t,r){var n;this.rawStream=e,this.pushable=H({objectMode:!1}),this.closeController=new AbortController,this.maxBufferSize=null!==(n=r.maxBufferSize)&&void 0!==n?n:1/0,Ee(wl(this.pushable,this.closeController.signal,{returnOnAbort:!0}),le(),this.rawStream).catch(t)}get protocol(){return this.rawStream.stat.protocol}push(e){if(this.pushable.readableLength>this.maxBufferSize)throw Error("OutboundStream buffer full, size > ".concat(this.maxBufferSize));this.pushable.push(e)}close(){this.closeController.abort(),this.pushable.return(),this.rawStream.close()}}class bf{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.rawStream=e,this.closeController=new AbortController,this.source=wl(Ee(this.rawStream,fe(t)),this.closeController.signal,{returnOnAbort:!0})}close(){this.closeController.abort(),this.rawStream.close()}}var wf=__webpack_require__(2376);const Ef={maxSubscriptions:1/0,maxMessages:1/0,maxIhaveMessageIDs:1/0,maxIwantMessageIDs:1/0,maxControlMessages:1/0,maxPeerInfos:1/0};function _f(e,t){t={...t};const r=wf.Reader.create(e),n=e.length,i=void 0===n?r.len:r.pos+n,s={};for(;r.pos<i;){const e=r.uint32();switch(e>>>3){case 1:s.subscriptions&&s.subscriptions.length||(s.subscriptions=[]),s.subscriptions.length<t.maxSubscriptions?s.subscriptions.push(Sf(r,r.uint32())):r.skipType(7&e);break;case 2:s.messages&&s.messages.length||(s.messages=[]),s.messages.length<t.maxMessages?s.messages.push(If(r,r.uint32())):r.skipType(7&e);break;case 3:s.control=Cf(r,r.uint32(),t);break;default:r.skipType(7&e)}}return s}function Sf(e,t){const r=void 0===t?e.len:e.pos+t,n={};for(;e.pos<r;){const t=e.uint32();switch(t>>>3){case 1:n.subscribe=e.bool();break;case 2:n.topic=e.string();break;default:e.skipType(7&t)}}return n}function If(e,t){const r=void 0===t?e.len:e.pos+t,n={};for(;e.pos<r;){const t=e.uint32();switch(t>>>3){case 1:n.from=e.bytes();break;case 2:n.data=e.bytes();break;case 3:n.seqno=e.bytes();break;case 4:n.topic=e.string();break;case 5:n.signature=e.bytes();break;case 6:n.key=e.bytes();break;default:e.skipType(7&t)}}if(!n.topic)throw Error("missing required 'topic'");return n}function Cf(e,t,r){const n=void 0===t?e.len:e.pos+t,i={};for(;e.pos<n;){const t=e.uint32();switch(t>>>3){case 1:i.ihave&&i.ihave.length||(i.ihave=[]),i.ihave.length<r.maxControlMessages?i.ihave.push(Af(e,e.uint32(),r)):e.skipType(7&t);break;case 2:i.iwant&&i.iwant.length||(i.iwant=[]),i.iwant.length<r.maxControlMessages?i.iwant.push(Tf(e,e.uint32(),r)):e.skipType(7&t);break;case 3:i.graft&&i.graft.length||(i.graft=[]),i.graft.length<r.maxControlMessages?i.graft.push(kf(e,e.uint32())):e.skipType(7&t);break;case 4:i.prune&&i.prune.length||(i.prune=[]),i.prune.length<r.maxControlMessages?i.prune.push(Rf(e,e.uint32(),r)):e.skipType(7&t);break;default:e.skipType(7&t)}}return i}function Af(e,t,r){const n=void 0===t?e.len:e.pos+t,i={};for(;e.pos<n;){const t=e.uint32();switch(t>>>3){case 1:i.topicID=e.string();break;case 2:i.messageIDs&&i.messageIDs.length||(i.messageIDs=[]),r.maxIhaveMessageIDs-- >0?i.messageIDs.push(e.bytes()):e.skipType(7&t);break;default:e.skipType(7&t)}}return i}function Tf(e,t,r){const n=void 0===t?e.len:e.pos+t,i={};for(;e.pos<n;){const t=e.uint32();if(t>>>3===1)i.messageIDs&&i.messageIDs.length||(i.messageIDs=[]),r.maxIwantMessageIDs-- >0?i.messageIDs.push(e.bytes()):e.skipType(7&t);else e.skipType(7&t)}return i}function kf(e,t){const r=void 0===t?e.len:e.pos+t,n={};for(;e.pos<r;){const t=e.uint32();if(t>>>3===1)n.topicID=e.string();else e.skipType(7&t)}return n}function Rf(e,t,r){const n=void 0===t?e.len:e.pos+t,i={};for(;e.pos<n;){const t=e.uint32();switch(t>>>3){case 1:i.topicID=e.string();break;case 2:i.peers&&i.peers.length||(i.peers=[]),r.maxPeerInfos-- >0?i.peers.push(Pf(e,e.uint32())):e.skipType(7&t);break;case 3:i.backoff=e.uint64();break;default:e.skipType(7&t)}}return i}function Pf(e,t){const r=void 0===t?e.len:e.pos+t,n={};for(;e.pos<r;){const t=e.uint32();switch(t>>>3){case 1:n.peerID=e.bytes();break;case 2:n.signedPeerRecord=e.bytes();break;default:e.skipType(7&t)}}return n}var Df;function Nf(e){for(const t of e.tuples())switch(t[0]){case Df.ip4:case Df.ip6:return sc(t[0],t[1])}return null}!function(e){e[e.ip4=4]="ip4",e[e.ip6=41]="ip6"}(Df||(Df={}));var xf;!function(e){e[e.started=0]="started",e[e.stopped=1]="stopped"}(xf||(xf={}));class Lf extends fl{constructor(e){var t,r,n,i;let s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};super(),this.multicodecs=[Td,Ad],this.peers=new Set,this.streamsInbound=new Map,this.streamsOutbound=new Map,this.outboundInflightQueue=H({objectMode:!0}),this.direct=new Set,this.floodsubPeers=new Set,this.acceptFromWhitelist=new Map,this.topics=new Map,this.subscriptions=new Set,this.mesh=new Map,this.fanout=new Map,this.fanoutLastpub=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.topicValidators=new Map,this.heartbeatTicks=0,this.directPeerInitial=null,this.status={code:xf.stopped},this.heartbeatTimer=null,this.onPeerAddressChange=e=>{const{peerId:t,multiaddrs:r,oldMultiaddrs:n}=e.detail,i=new Set,s=new Set;for(const a of r){const e=Nf(a);e&&i.add(e)}for(const a of n){const e=Nf(a);e&&(i.has(e)?i.delete(e):s.add(e))}const o=t.toString();for(const a of s)this.score.removeIP(o,a);for(const a of i)this.score.addIP(o,a)},this.runHeartbeat=()=>{var e;const t=null===(e=this.metrics)||void 0===e?void 0:e.heartbeatDuration.startTimer();this.heartbeat().catch((e=>{this.log("Error running heartbeat",e)})).finally((()=>{if(null!=t&&t(),this.status.code===xf.started){clearTimeout(this.status.heartbeatTimeout);let t=this.opts.heartbeatInterval-(Date.now()-this.status.hearbeatStartMs)%this.opts.heartbeatInterval;var e;if(t<.25*this.opts.heartbeatInterval)t+=this.opts.heartbeatInterval,null===(e=this.metrics)||void 0===e||e.heartbeatSkipped.inc();this.status.heartbeatTimeout=setTimeout(this.runHeartbeat,t)}}))};const o={fallbackToFloodsub:!0,floodPublish:!0,doPX:!1,directPeers:[],D:6,Dlo:4,Dhi:12,Dscore:4,Dout:2,Dlazy:6,heartbeatInterval:1e3,fanoutTTL:6e4,mcacheLength:5,mcacheGossip:3,seenTTL:12e4,gossipsubIWantFollowupMs:3e3,prunePeers:16,pruneBackoff:6e4,graftFloodThreshold:1e4,opportunisticGraftPeers:2,opportunisticGraftTicks:60,directConnectTicks:300,...s,scoreParams:qd(s.scoreParams),scoreThresholds:Gd(s.scoreThresholds)};if(this.components=e,this.decodeRpcLimits=null!==(t=o.decodeRpcLimits)&&void 0!==t?t:Ef,this.globalSignaturePolicy=null!==(r=o.globalSignaturePolicy)&&void 0!==r?r:Dd,o.fallbackToFloodsub&&this.multicodecs.push(Cd),this.log=Ba(null!==(n=o.debugName)&&void 0!==n?n:"libp2p:gossipsub"),this.opts=o,this.direct=new Set(o.directPeers.map((e=>e.id.toString()))),this.seenCache=new nf({validityMs:o.seenTTL}),this.publishedMessageIds=new nf({validityMs:o.seenTTL}),s.msgIdFn)this.msgIdFn=s.msgIdFn;else switch(this.globalSignaturePolicy){case Dd:this.msgIdFn=yf;break;case Nd:this.msgIdFn=gf}if(s.fastMsgIdFn&&(this.fastMsgIdFn=s.fastMsgIdFn,this.fastMsgIdCache=new nf({validityMs:o.seenTTL})),this.msgIdToStrFn=null!==(i=s.msgIdToStrFn)&&void 0!==i?i:Pd,this.mcache=s.messageCache||new _d(o.mcacheGossip,o.mcacheLength,this.msgIdToStrFn),s.dataTransform&&(this.dataTransform=s.dataTransform),s.metricsRegister){if(!s.metricsTopicStrToLabel)throw Error("Must set metricsTopicStrToLabel with metrics");const e=Math.max(...Object.values(o.scoreParams.topics).map((e=>e.meshMessageDeliveriesWindow)),1e3),t=function(e,t,r){return{protocolsEnabled:e.gauge({name:"gossipsub_protocol",help:"Status of enabled protocols",labelNames:["protocol"]}),topicSubscriptionStatus:e.gauge({name:"gossipsub_topic_subscription_status",help:"Status of our subscription to this topic",labelNames:["topicStr"]}),topicPeersCount:e.gauge({name:"gossipsub_topic_peer_count",help:"Number of peers subscribed to each topic",labelNames:["topicStr"]}),meshPeerCounts:e.gauge({name:"gossipsub_mesh_peer_count",help:"Number of peers in our mesh",labelNames:["topicStr"]}),meshPeerInclusionEvents:e.gauge({name:"gossipsub_mesh_peer_inclusion_events_total",help:"Number of times we include peers in a topic mesh for different reasons",labelNames:["topic","reason"]}),meshPeerChurnEvents:e.gauge({name:"gossipsub_peer_churn_events_total",help:"Number of times we remove peers in a topic mesh for different reasons",labelNames:["topic","reason"]}),peersPerProtocol:e.gauge({name:"gossipsub_peers_per_protocol_count",help:"Peers connected for each topic",labelNames:["protocol"]}),heartbeatDuration:e.histogram({name:"gossipsub_heartbeat_duration_seconds",help:"The time it takes to complete one iteration of the heartbeat",buckets:[.01,.1,1]}),heartbeatSkipped:e.gauge({name:"gossipsub_heartbeat_skipped",help:"Heartbeat run took longer than heartbeat interval so next is skipped"}),asyncValidationResult:e.gauge({name:"gossipsub_async_validation_result_total",help:"Message validation result for each topic",labelNames:["topic","acceptance"]}),asyncValidationMcacheHit:e.gauge({name:"gossipsub_async_validation_mcache_hit_total",help:"Async validation result reported by the user layer",labelNames:["hit"]}),rpcRecvBytes:e.gauge({name:"gossipsub_rpc_recv_bytes_total",help:"RPC recv"}),rpcRecvCount:e.gauge({name:"gossipsub_rpc_recv_count_total",help:"RPC recv"}),rpcRecvSubscription:e.gauge({name:"gossipsub_rpc_recv_subscription_total",help:"RPC recv"}),rpcRecvMessage:e.gauge({name:"gossipsub_rpc_recv_message_total",help:"RPC recv"}),rpcRecvControl:e.gauge({name:"gossipsub_rpc_recv_control_total",help:"RPC recv"}),rpcRecvIHave:e.gauge({name:"gossipsub_rpc_recv_ihave_total",help:"RPC recv"}),rpcRecvIWant:e.gauge({name:"gossipsub_rpc_recv_iwant_total",help:"RPC recv"}),rpcRecvGraft:e.gauge({name:"gossipsub_rpc_recv_graft_total",help:"RPC recv"}),rpcRecvPrune:e.gauge({name:"gossipsub_rpc_recv_prune_total",help:"RPC recv"}),rpcRecvNotAccepted:e.gauge({name:"gossipsub_rpc_rcv_not_accepted_total",help:"Total count of RPC dropped because acceptFrom() == false"}),rpcSentBytes:e.gauge({name:"gossipsub_rpc_sent_bytes_total",help:"RPC sent"}),rpcSentCount:e.gauge({name:"gossipsub_rpc_sent_count_total",help:"RPC sent"}),rpcSentSubscription:e.gauge({name:"gossipsub_rpc_sent_subscription_total",help:"RPC sent"}),rpcSentMessage:e.gauge({name:"gossipsub_rpc_sent_message_total",help:"RPC sent"}),rpcSentControl:e.gauge({name:"gossipsub_rpc_sent_control_total",help:"RPC sent"}),rpcSentIHave:e.gauge({name:"gossipsub_rpc_sent_ihave_total",help:"RPC sent"}),rpcSentIWant:e.gauge({name:"gossipsub_rpc_sent_iwant_total",help:"RPC sent"}),rpcSentGraft:e.gauge({name:"gossipsub_rpc_sent_graft_total",help:"RPC sent"}),rpcSentPrune:e.gauge({name:"gossipsub_rpc_sent_prune_total",help:"RPC sent"}),msgPublishCount:e.gauge({name:"gossipsub_msg_publish_count_total",help:"Total count of msg published by topic",labelNames:["topic"]}),msgPublishPeers:e.gauge({name:"gossipsub_msg_publish_peers_total",help:"Total count of peers that we publish a msg to",labelNames:["topic"]}),msgPublishPeersByGroup:e.gauge({name:"gossipsub_msg_publish_peers_by_group",help:"Total count of peers (by group) that we publish a msg to",labelNames:["topic","peerGroup"]}),msgPublishBytes:e.gauge({name:"gossipsub_msg_publish_bytes_total",help:"Total count of msg publish data.length bytes",labelNames:["topic"]}),msgForwardCount:e.gauge({name:"gossipsub_msg_forward_count_total",help:"Total count of msg forwarded by topic",labelNames:["topic"]}),msgForwardPeers:e.gauge({name:"gossipsub_msg_forward_peers_total",help:"Total count of peers that we forward a msg to",labelNames:["topic"]}),msgReceivedPreValidation:e.gauge({name:"gossipsub_msg_received_prevalidation_total",help:"Total count of recv msgs before any validation",labelNames:["topic"]}),msgReceivedStatus:e.gauge({name:"gossipsub_msg_received_status_total",help:"Tracks distribution of recv msgs by duplicate, invalid, valid",labelNames:["topic","status"]}),msgReceivedInvalid:e.gauge({name:"gossipsub_msg_received_invalid_total",help:"Tracks specific reason of invalid",labelNames:["topic","error"]}),duplicateMsgDeliveryDelay:e.histogram({name:"gossisub_duplicate_msg_delivery_delay_seconds",help:"Time since the 1st duplicated message validated",labelNames:["topic"],buckets:[.25*r.maxMeshMessageDeliveriesWindowSec,.5*r.maxMeshMessageDeliveriesWindowSec,1*r.maxMeshMessageDeliveriesWindowSec,2*r.maxMeshMessageDeliveriesWindowSec,4*r.maxMeshMessageDeliveriesWindowSec]}),duplicateMsgLateDelivery:e.gauge({name:"gossisub_duplicate_msg_late_delivery_total",help:"Total count of late duplicate message delivery by topic, which triggers P3 penalty",labelNames:["topic"]}),scoreFnCalls:e.gauge({name:"gossipsub_score_fn_calls_total",help:"Total times score() is called"}),scoreFnRuns:e.gauge({name:"gossipsub_score_fn_runs_total",help:"Total times score() call actually computed computeScore(), no cache"}),scoreCachedDelta:e.histogram({name:"gossipsub_score_cache_delta",help:"Delta of score between cached values that expired",buckets:[10,100,1e3]}),peersByScoreThreshold:e.gauge({name:"gossipsub_peers_by_score_threshold_count",help:"Current count of peers by score threshold",labelNames:["threshold"]}),score:e.avgMinMax({name:"gossipsub_score",help:"Avg min max of gossip scores",labelNames:["topic","p"]}),scoreWeights:e.avgMinMax({name:"gossipsub_score_weights",help:"Separate score weights",labelNames:["topic","p"]}),scorePerMesh:e.avgMinMax({name:"gossipsub_score_per_mesh",help:"Histogram of the scores for each mesh topic",labelNames:["topic"]}),scoringPenalties:e.gauge({name:"gossipsub_scoring_penalties_total",help:"A counter of the kind of penalties being applied to peers",labelNames:["penalty"]}),behaviourPenalty:e.histogram({name:"gossipsub_peer_stat_behaviour_penalty",help:"Current peer stat behaviour_penalty at each scrape",buckets:[.25*r.behaviourPenaltyThreshold,.5*r.behaviourPenaltyThreshold,1*r.behaviourPenaltyThreshold,2*r.behaviourPenaltyThreshold,4*r.behaviourPenaltyThreshold]}),ihaveRcvIgnored:e.gauge({name:"gossipsub_ihave_rcv_ignored_total",help:"Total received IHAVE messages that we ignore for some reason",labelNames:["reason"]}),ihaveRcvMsgids:e.gauge({name:"gossipsub_ihave_rcv_msgids_total",help:"Total received IHAVE messages by topic",labelNames:["topic"]}),ihaveRcvNotSeenMsgids:e.gauge({name:"gossipsub_ihave_rcv_not_seen_msgids_total",help:"Total messages per topic we do not have, not actual requests",labelNames:["topic"]}),iwantRcvMsgids:e.gauge({name:"gossipsub_iwant_rcv_msgids_total",help:"Total received IWANT messages by topic",labelNames:["topic"]}),iwantRcvDonthaveMsgids:e.gauge({name:"gossipsub_iwant_rcv_dont_have_msgids_total",help:"Total requested messageIDs that we do not have"}),iwantPromiseStarted:e.gauge({name:"gossipsub_iwant_promise_sent_total",help:"Total count of started IWANT promises"}),iwantPromiseResolved:e.gauge({name:"gossipsub_iwant_promise_resolved_total",help:"Total count of resolved IWANT promises"}),iwantPromiseResolvedPeers:e.gauge({name:"gossipsub_iwant_promise_resolved_peers",help:"Total count of peers we have asked IWANT promises that are resolved"}),iwantPromiseBroken:e.gauge({name:"gossipsub_iwant_promise_broken",help:"Total count of broken IWANT promises"}),iwantPromiseDeliveryTime:e.histogram({name:"gossipsub_iwant_promise_delivery_seconds",help:"Histogram of delivery time of resolved IWANT promises",buckets:[.5*r.gossipPromiseExpireSec,1*r.gossipPromiseExpireSec,2*r.gossipPromiseExpireSec,4*r.gossipPromiseExpireSec]}),cacheSize:e.gauge({name:"gossipsub_cache_size",help:"Unbounded cache sizes",labelNames:["cache"]}),mcacheSize:e.gauge({name:"gossipsub_mcache_size",help:"Current mcache msg count"}),mcacheNotValidatedCount:e.gauge({name:"gossipsub_mcache_not_validated_count",help:"Current mcache msg count not validated"}),fastMsgIdCacheCollision:e.gauge({name:"gossipsub_fastmsgid_cache_collision_total",help:"Total count of key collisions on fastmsgid cache put"}),topicStrToLabel:t,toTopic(e){var t;return null!==(t=this.topicStrToLabel.get(e))&&void 0!==t?t:e},onJoin(e){this.topicSubscriptionStatus.set({topicStr:e},1),this.meshPeerCounts.set({topicStr:e},0)},onLeave(e){this.topicSubscriptionStatus.set({topicStr:e},0),this.meshPeerCounts.set({topicStr:e},0)},onAddToMesh(e,t,r){const n=this.toTopic(e);this.meshPeerInclusionEvents.inc({topic:n,reason:t},r)},onRemoveFromMesh(e,t,r){const n=this.toTopic(e);this.meshPeerChurnEvents.inc({topic:n,reason:t},r)},onReportValidationMcacheHit(e){this.asyncValidationMcacheHit.inc({hit:e?"hit":"miss"})},onReportValidation(e,t){const r=this.toTopic(e);this.asyncValidationResult.inc({topic:r,acceptance:t})},onScorePenalty(e){this.scoringPenalties.inc({penalty:e},1)},onIhaveRcv(e,t,r){const n=this.toTopic(e);this.ihaveRcvMsgids.inc({topic:n},t),this.ihaveRcvNotSeenMsgids.inc({topic:n},r)},onIwantRcv(e,t){for(const[r,n]of e){const e=this.toTopic(r);this.iwantRcvMsgids.inc({topic:e},n)}this.iwantRcvDonthaveMsgids.inc(t)},onForwardMsg(e,t){const r=this.toTopic(e);this.msgForwardCount.inc({topic:r},1),this.msgForwardPeers.inc({topic:r},t)},onPublishMsg(e,t,r,n){const i=this.toTopic(e);this.msgPublishCount.inc({topic:i},1),this.msgPublishBytes.inc({topic:i},r*n),this.msgPublishPeers.inc({topic:i},r),this.msgPublishPeersByGroup.inc({topic:i,peerGroup:"direct"},t.direct),this.msgPublishPeersByGroup.inc({topic:i,peerGroup:"floodsub"},t.floodsub),this.msgPublishPeersByGroup.inc({topic:i,peerGroup:"mesh"},t.mesh),this.msgPublishPeersByGroup.inc({topic:i,peerGroup:"fanout"},t.fanout)},onMsgRecvPreValidation(e){const t=this.toTopic(e);this.msgReceivedPreValidation.inc({topic:t},1)},onMsgRecvResult(e,t){const r=this.toTopic(e);this.msgReceivedStatus.inc({topic:r,status:t})},onMsgRecvInvalid(e,t){const r=this.toTopic(e),n=t.reason===Bd.Error?t.error:t.reason;this.msgReceivedInvalid.inc({topic:r,error:n},1)},onDuplicateMsgDelivery(e,t,r){if(this.duplicateMsgDeliveryDelay.observe(t/1e3),r){const t=this.toTopic(e);this.duplicateMsgLateDelivery.inc({topic:t},1)}},onRpcRecv(e,t){this.rpcRecvBytes.inc(t),this.rpcRecvCount.inc(1),e.subscriptions&&this.rpcRecvSubscription.inc(e.subscriptions.length),e.messages&&this.rpcRecvMessage.inc(e.messages.length),e.control&&(this.rpcRecvControl.inc(1),e.control.ihave&&this.rpcRecvIHave.inc(e.control.ihave.length),e.control.iwant&&this.rpcRecvIWant.inc(e.control.iwant.length),e.control.graft&&this.rpcRecvGraft.inc(e.control.graft.length),e.control.prune&&this.rpcRecvPrune.inc(e.control.prune.length))},onRpcSent(e,t){if(this.rpcSentBytes.inc(t),this.rpcSentCount.inc(1),e.subscriptions&&this.rpcSentSubscription.inc(e.subscriptions.length),e.messages&&this.rpcSentMessage.inc(e.messages.length),e.control){var r,n,i,s,o,a,c,l;const t=null!==(r=null===(n=e.control.ihave)||void 0===n?void 0:n.length)&&void 0!==r?r:0,u=null!==(i=null===(s=e.control.iwant)||void 0===s?void 0:s.length)&&void 0!==i?i:0,h=null!==(o=null===(a=e.control.graft)||void 0===a?void 0:a.length)&&void 0!==o?o:0,d=null!==(c=null===(l=e.control.prune)||void 0===l?void 0:l.length)&&void 0!==c?c:0;t>0&&this.rpcSentIHave.inc(t),u>0&&this.rpcSentIWant.inc(u),h>0&&this.rpcSentGraft.inc(h),d>0&&this.rpcSentPrune.inc(d),(t>0||u>0||h>0||d>0)&&this.rpcSentControl.inc(1)}},registerScores(e,t){let r=0,n=0,i=0,s=0;for(const o of e)o>=t.graylistThreshold&&r++,o>=t.publishThreshold&&n++,o>=t.gossipThreshold&&i++,o>=0&&s++;this.peersByScoreThreshold.set({threshold:uf.graylist},r),this.peersByScoreThreshold.set({threshold:uf.publish},n),this.peersByScoreThreshold.set({threshold:uf.gossip},i),this.peersByScoreThreshold.set({threshold:uf.mesh},s),this.score.set(e)},registerScoreWeights(e){for(const[t,r]of e.byTopic)this.scoreWeights.set({topic:t,p:"p1"},r.p1w),this.scoreWeights.set({topic:t,p:"p2"},r.p2w),this.scoreWeights.set({topic:t,p:"p3"},r.p3w),this.scoreWeights.set({topic:t,p:"p3b"},r.p3bw),this.scoreWeights.set({topic:t,p:"p4"},r.p4w);this.scoreWeights.set({p:"p5"},e.p5w),this.scoreWeights.set({p:"p6"},e.p6w),this.scoreWeights.set({p:"p7"},e.p7w)},registerScorePerMesh(e,t){const r=new Map;e.forEach(((e,t)=>{var n;const i=null!==(n=this.topicStrToLabel.get(t))&&void 0!==n?n:"unknown";let s=r.get(i);s||(s=new Set,r.set(i,s)),e.forEach((e=>{var t;return null===(t=s)||void 0===t?void 0:t.add(e)}))}));for(const[n,i]of r){const e=[];i.forEach((r=>{var n;e.push(null!==(n=t.get(r))&&void 0!==n?n:0)})),this.scorePerMesh.set({topic:n},e)}}}}(s.metricsRegister,s.metricsTopicStrToLabel,{gossipPromiseExpireSec:this.opts.gossipsubIWantFollowupMs/1e3,behaviourPenaltyThreshold:o.scoreParams.behaviourPenaltyThreshold,maxMeshMessageDeliveriesWindowSec:e/1e3});t.mcacheSize.addCollect((()=>this.onScrapeMetrics(t)));for(const r of this.multicodecs)t.protocolsEnabled.set({protocol:r},1);this.metrics=t}else this.metrics=null;this.gossipTracer=new rf(this.opts.gossipsubIWantFollowupMs,this.msgIdToStrFn,this.metrics),this.score=new tf(this.opts.scoreParams,this.metrics,{scoreCacheValidityMs:o.heartbeatInterval}),this.maxInboundStreams=s.maxInboundStreams,this.maxOutboundStreams=s.maxOutboundStreams,this.allowedTopics=o.allowedTopics?new Set(o.allowedTopics):null}getPeers(){return[...this.peers.keys()].map((e=>As(e)))}isStarted(){return this.status.code===xf.started}async start(){if(this.isStarted())return;this.log("starting"),this.publishConfig=await async function(e,t){switch(e){case Dd:{if(!t)throw Error("Must provide PeerId");if(null==t.privateKey)throw Error("Cannot sign message, no private key present");if(null==t.publicKey)throw Error("Cannot sign message, no public key present");const e=await gs(t.privateKey);return{type:Od.Signing,author:t,key:t.publicKey,privateKey:e}}case Nd:return{type:Od.Anonymous};default:throw new Error('Unknown signature policy "'.concat(e,'"'))}}(this.globalSignaturePolicy,this.components.peerId),this.outboundInflightQueue=H({objectMode:!0}),Ee(this.outboundInflightQueue,(async e=>{for await(const{peerId:t,connection:r}of e)await this.createOutboundStream(t,r)})).catch((e=>this.log.error("outbound inflight queue error",e))),await Promise.all(this.opts.directPeers.map((async e=>{await this.components.peerStore.addressBook.add(e.id,e.addrs)})));const e=this.components.registrar;await Promise.all(this.multicodecs.map((t=>e.handle(t,this.onIncomingStream.bind(this),{maxInboundStreams:this.maxInboundStreams,maxOutboundStreams:this.maxOutboundStreams}))));const t=(r={onConnect:this.onPeerConnected.bind(this),onDisconnect:this.onPeerDisconnected.bind(this)},new Ed(r));var r;const n=await Promise.all(this.multicodecs.map((r=>e.register(r,t)))),i=setTimeout(this.runHeartbeat,100);this.components.peerStore.addEventListener("change:multiaddrs",this.onPeerAddressChange),this.status={code:xf.started,registrarTopologyIds:n,heartbeatTimeout:i,hearbeatStartMs:Date.now()+100},this.score.start(),this.directPeerInitial=setTimeout((()=>{Promise.resolve().then((async()=>{await Promise.all(Array.from(this.direct).map((async e=>await this.connect(e))))})).catch((e=>{this.log(e)}))}),1e3),this.log("started")}async stop(){if(this.log("stopping"),this.status.code!==xf.started)return;const{registrarTopologyIds:e}=this.status;this.status={code:xf.stopped},this.components.peerStore.removeEventListener("change:multiaddrs",this.onPeerAddressChange);const t=this.components.registrar;e.forEach((e=>t.unregister(e))),this.outboundInflightQueue.end();for(const r of this.streamsOutbound.values())r.close();this.streamsOutbound.clear();for(const r of this.streamsInbound.values())r.close();this.streamsInbound.clear(),this.peers.clear(),this.subscriptions.clear(),this.heartbeatTimer&&(this.heartbeatTimer.cancel(),this.heartbeatTimer=null),this.score.stop(),this.mesh.clear(),this.fanout.clear(),this.fanoutLastpub.clear(),this.gossip.clear(),this.control.clear(),this.peerhave.clear(),this.iasked.clear(),this.backoff.clear(),this.outbound.clear(),this.gossipTracer.clear(),this.seenCache.clear(),this.fastMsgIdCache&&this.fastMsgIdCache.clear(),this.directPeerInitial&&clearTimeout(this.directPeerInitial),this.log("stopped")}dumpPeerScoreStats(){return this.score.dumpPeerScoreStats()}onIncomingStream(e){let{stream:t,connection:r}=e;if(!this.isStarted())return;const n=r.remotePeer;this.addPeer(n,r.stat.direction,r.remoteAddr),this.createInboundStream(n,t),this.outboundInflightQueue.push({peerId:n,connection:r})}onPeerConnected(e,t){this.isStarted()&&(this.addPeer(e,t.stat.direction,t.remoteAddr),this.outboundInflightQueue.push({peerId:e,connection:t}))}onPeerDisconnected(e){this.log("connection ended %p",e),this.removePeer(e)}async createOutboundStream(e,t){if(!this.isStarted())return;const r=e.toString();if(this.peers.has(r)&&!this.streamsOutbound.has(r))try{var n;const i=new vf(await t.newStream(this.multicodecs),(e=>this.log.error("outbound pipe error",e)),{maxBufferSize:this.opts.maxOutboundBufferSize});this.log("create outbound stream %p",e),this.streamsOutbound.set(r,i);const s=i.protocol;s===Cd&&this.floodsubPeers.add(r),null===(n=this.metrics)||void 0===n||n.peersPerProtocol.inc({protocol:s},1),this.subscriptions.size>0&&(this.log("send subscriptions to",r),this.sendSubscriptions(r,Array.from(this.subscriptions),!0))}catch(i){this.log.error("createOutboundStream error",i)}}async createInboundStream(e,t){if(!this.isStarted())return;const r=e.toString();if(!this.peers.has(r))return;const n=this.streamsInbound.get(r);void 0!==n&&(this.log("replacing existing inbound steam %s",r),n.close()),this.log("create inbound stream %s",r);const i=new bf(t,{maxDataLength:this.opts.maxInboundDataLength});this.streamsInbound.set(r,i),this.pipePeerReadStream(e,i.source).catch((e=>this.log(e)))}addPeer(e,t,r){const n=e.toString();if(!this.peers.has(n)){this.log("new peer %p",e),this.peers.add(n),this.score.addPeer(n);const i=Nf(r);null!==i?this.score.addIP(n,i):this.log("Added peer has no IP in current address %s %s",n,r.toString()),this.outbound.has(n)||this.outbound.set(n,"outbound"===t)}}removePeer(e){const t=e.toString();if(!this.peers.has(t))return;this.log("delete peer %p",e),this.peers.delete(t);const r=this.streamsOutbound.get(t),n=this.streamsInbound.get(t);var i;r&&(null===(i=this.metrics)||void 0===i||i.peersPerProtocol.inc({protocol:r.protocol},-1));null===r||void 0===r||r.close(),null===n||void 0===n||n.close(),this.streamsOutbound.delete(t),this.streamsInbound.delete(t);for(const o of this.topics.values())o.delete(t);for(const[o,a]of this.mesh){var s;if(!0===a.delete(t))null===(s=this.metrics)||void 0===s||s.onRemoveFromMesh(o,af.Dc,1)}for(const o of this.fanout.values())o.delete(t);this.floodsubPeers.delete(t),this.gossip.delete(t),this.control.delete(t),this.outbound.delete(t),this.score.removePeer(t),this.acceptFromWhitelist.delete(t)}get started(){return this.status.code===xf.started}getMeshPeers(e){const t=this.mesh.get(e);return t?Array.from(t):[]}getSubscribers(e){const t=this.topics.get(e);return(t?Array.from(t):[]).map((e=>As(e)))}getTopics(){return Array.from(this.subscriptions)}async pipePeerReadStream(e,t){try{await Ee(t,(async t=>{for await(const i of t)try{var r;const t=i.subarray(),n=_f(t,this.decodeRpcLimits);null===(r=this.metrics)||void 0===r||r.onRpcRecv(n,t.length),this.opts.awaitRpcHandler?await this.handleReceivedRpc(e,n):this.handleReceivedRpc(e,n).catch((e=>this.log(e)))}catch(n){this.log(n)}}))}catch(r){this.handlePeerReadStreamError(r,e)}}handlePeerReadStreamError(e,t){this.log.error(e),this.onPeerDisconnected(t)}async handleReceivedRpc(e,t){var r;if(!this.acceptFrom(e.toString()))return this.log("received message from unacceptable peer %p",e),void(null===(r=this.metrics)||void 0===r||r.rpcRecvNotAccepted.inc());if(this.log("rpc from %p",e),t.subscriptions&&t.subscriptions.length>0){const r=[];t.subscriptions.forEach((t=>{const n=t.topic,i=!0===t.subscribe;if(null!=n){if(this.allowedTopics&&!this.allowedTopics.has(n))return;this.handleReceivedSubscription(e,n,i),r.push({topic:n,subscribe:i})}})),this.dispatchEvent(new yl("subscription-change",{detail:{peerId:e,subscriptions:r}}))}if(t.messages)for(const n of t.messages){if(this.allowedTopics&&!this.allowedTopics.has(n.topic))continue;const t=this.handleReceivedMessage(e,n).catch((e=>this.log(e)));this.opts.awaitRpcMessageHandler&&await t}t.control&&await this.handleControlMessage(e.toString(),t.control)}handleReceivedSubscription(e,t,r){this.log("subscription update from %p topic %s",e,t);let n=this.topics.get(t);null==n&&(n=new Set,this.topics.set(t,n)),r?n.add(e.toString()):n.delete(e.toString())}async handleReceivedMessage(e,t){var r,n,i;null===(r=this.metrics)||void 0===r||r.onMsgRecvPreValidation(t.topic);const s=await this.validateReceivedMessage(e,t);switch(null===(n=this.metrics)||void 0===n||n.onMsgRecvResult(t.topic,s.code),s.code){case Ud.duplicate:return this.score.duplicateMessage(e.toString(),s.msgIdStr,t.topic),void this.mcache.observeDuplicate(s.msgIdStr,e.toString());case Ud.invalid:if(s.msgIdStr){const r=s.msgIdStr;this.score.rejectMessage(e.toString(),r,t.topic,s.reason),this.gossipTracer.rejectMessage(r,s.reason)}else this.score.rejectInvalidMessage(e.toString(),t.topic);return void(null===(i=this.metrics)||void 0===i||i.onMsgRecvInvalid(t.topic,s));case Ud.valid:if(this.score.validateMessage(s.messageId.msgIdStr),this.gossipTracer.deliverMessage(s.messageId.msgIdStr),this.mcache.put(s.messageId,t,!this.opts.asyncValidation),this.subscriptions.has(t.topic)){this.components.peerId.equals(e)&&!this.opts.emitSelf||(super.dispatchEvent(new yl("gossipsub:message",{detail:{propagationSource:e,msgId:s.messageId.msgIdStr,msg:s.msg}})),super.dispatchEvent(new yl("message",{detail:s.msg})))}this.opts.asyncValidation||this.forwardMessage(s.messageId.msgIdStr,t,e.toString())}}async validateReceivedMessage(e,t){var r,n;const i=null===(r=this.fastMsgIdFn)||void 0===r?void 0:r.call(this,t),s=void 0!==i?null===(n=this.fastMsgIdCache)||void 0===n?void 0:n.get(i):void 0;if(s)return{code:Ud.duplicate,msgIdStr:s};const o=await async function(e,t){var r;switch(e){case Nd:return null!=t.signature?{valid:!1,error:Md.SignaturePresent}:null!=t.seqno?{valid:!1,error:Md.SeqnoPresent}:null!=t.key?{valid:!1,error:Md.FromPresent}:{valid:!0,message:{type:"unsigned",topic:t.topic,data:null!==(r=t.data)&&void 0!==r?r:new Uint8Array(0)}};case Dd:{var n,i;if(null==t.seqno)return{valid:!1,error:Md.InvalidSeqno};if(8!==t.seqno.length)return{valid:!1,error:Md.InvalidSeqno};if(null==t.signature)return{valid:!1,error:Md.InvalidSignature};if(null==t.from)return{valid:!1,error:Md.InvalidPeerId};let e,r;try{e=Ts(t.from)}catch(s){return{valid:!1,error:Md.InvalidPeerId}}if(t.key){if(r=ps(t.key),void 0!==e.publicKey&&!xa(r.bytes,e.publicKey))return{valid:!1,error:Md.InvalidPeerId}}else{if(null==e.publicKey)return{valid:!1,error:Md.InvalidPeerId};r=ps(e.publicKey)}const o={from:t.from,data:t.data,seqno:t.seqno,topic:t.topic,signature:void 0,key:void 0},a=xe([pf,Id.Message.encode(o).finish()]);return await r.verify(a,t.signature)?{valid:!0,message:{type:"signed",from:e,data:null!==(n=t.data)&&void 0!==n?n:new Uint8Array(0),sequenceNumber:BigInt("0x".concat(La(t.seqno,"base16"))),topic:t.topic,signature:t.signature,key:null!==(i=t.key)&&void 0!==i?i:ys(r)}}:{valid:!1,error:Md.InvalidSignature}}}}(this.globalSignaturePolicy,t);if(!o.valid)return{code:Ud.invalid,reason:Bd.Error,error:o.error};const a=o.message;try{this.dataTransform&&(a.data=this.dataTransform.inboundTransform(t.topic,a.data))}catch(f){return this.log("Invalid message, transform failed",f),{code:Ud.invalid,reason:Bd.Error,error:Md.TransformFailed}}const c=await this.msgIdFn(a),l=this.msgIdToStrFn(c),u={msgId:c,msgIdStr:l};if(void 0!==i&&this.fastMsgIdCache){var h;if(this.fastMsgIdCache.put(i,l))null===(h=this.metrics)||void 0===h||h.fastMsgIdCacheCollision.inc()}if(this.seenCache.has(l))return{code:Ud.duplicate,msgIdStr:l};this.seenCache.put(l);const d=this.topicValidators.get(t.topic);if(null!=d){let t;try{t=await d(e,a)}catch(f){const e=f.code;"ERR_TOPIC_VALIDATOR_IGNORE"===e&&(t=xd.Ignore),t="ERR_TOPIC_VALIDATOR_REJECT"===e?xd.Reject:xd.Ignore}if(t!==xd.Accept)return{code:Ud.invalid,reason:Fd(t),msgIdStr:l}}return{code:Ud.valid,messageId:u,msg:a}}getScore(e){return this.score.score(e)}sendSubscriptions(e,t,r){this.sendRpc(e,{subscriptions:t.map((e=>({topic:e,subscribe:r})))})}async handleControlMessage(e,t){if(void 0===t)return;const r=t.ihave?this.handleIHave(e,t.ihave):[],n=t.iwant?this.handleIWant(e,t.iwant):[],i=t.graft?await this.handleGraft(e,t.graft):[];t.prune&&await this.handlePrune(e,t.prune),(r.length||n.length||i.length)&&this.sendRpc(e,{messages:n,control:{iwant:r,prune:i}})}acceptFrom(e){if(this.direct.has(e))return!0;const t=Date.now(),r=this.acceptFromWhitelist.get(e);if(r&&r.messagesAccepted<128&&r.acceptUntil>=t)return r.messagesAccepted+=1,!0;const n=this.score.score(e);return n>=0?this.acceptFromWhitelist.set(e,{messagesAccepted:0,acceptUntil:t+1e3}):this.acceptFromWhitelist.delete(e),n>=this.opts.scoreThresholds.graylistThreshold}handleIHave(e,t){var r,n;if(!t.length)return[];const i=this.score.score(e);var s;if(i<this.opts.scoreThresholds.gossipThreshold)return this.log("IHAVE: ignoring peer %s with score below threshold [ score = %d ]",e,i),null===(s=this.metrics)||void 0===s||s.ihaveRcvIgnored.inc({reason:lf.LowScore}),[];const o=(null!==(r=this.peerhave.get(e))&&void 0!==r?r:0)+1;var a;if(this.peerhave.set(e,o),o>10)return this.log("IHAVE: peer %s has advertised too many times (%d) within this heartbeat interval; ignoring",e,o),null===(a=this.metrics)||void 0===a||a.ihaveRcvIgnored.inc({reason:lf.MaxIhave}),[];const c=null!==(n=this.iasked.get(e))&&void 0!==n?n:0;var l;if(c>=kd)return this.log("IHAVE: peer %s has already advertised too many messages (%d); ignoring",e,c),null===(l=this.metrics)||void 0===l||l.ihaveRcvIgnored.inc({reason:lf.MaxIasked}),[];const u=new Map;if(t.forEach((e=>{var t;let{topicID:r,messageIDs:n}=e;if(!r||!n||!this.mesh.has(r))return;let i=0;n.forEach((e=>{const t=this.msgIdToStrFn(e);this.seenCache.has(t)||(u.set(t,e),i++)})),null===(t=this.metrics)||void 0===t||t.onIhaveRcv(r,n.length,i)})),!u.size)return[];let h=u.size;h+c>kd&&(h=kd-c),this.log("IHAVE: Asking for %d out of %d messages from %s",h,u.size,e);let d=Array.from(u.values());return Rd(d),d=d.slice(0,h),this.iasked.set(e,c+h),this.gossipTracer.addPromise(e,d),[{messageIDs:d}]}handleIWant(e,t){var r;if(!t.length)return[];const n=this.score.score(e);if(n<this.opts.scoreThresholds.gossipThreshold)return this.log("IWANT: ignoring peer %s with score below threshold [score = %d]",e,n),[];const i=new Map,s=new Map;let o=0;return t.forEach((t=>{let{messageIDs:r}=t;r&&r.forEach((t=>{var r;const n=this.msgIdToStrFn(t),a=this.mcache.getWithIWantCount(n,e);null!=a?(s.set(a.msg.topic,1+(null!==(r=s.get(a.msg.topic))&&void 0!==r?r:0)),a.count>3?this.log("IWANT: Peer %s has asked for message %s too many times: ignoring request",e,t):i.set(n,a.msg)):o++}))})),null===(r=this.metrics)||void 0===r||r.onIwantRcv(s,o),i.size?(this.log("IWANT: Sending %d messages to %s",i.size,e),Array.from(i.values())):(this.log("IWANT: Could not provide any wanted messages to %s",e),[])}async handleGraft(e,t){const r=[],n=this.score.score(e),i=Date.now();let s=this.opts.doPX;return t.forEach((t=>{var o,a;let{topicID:c}=t;if(!c)return;const l=this.mesh.get(c);if(!l)return void(s=!1);if(l.has(e))return;if(this.direct.has(e))return this.log("GRAFT: ignoring request from direct peer %s",e),r.push(c),void(s=!1);const u=null===(o=this.backoff.get(c))||void 0===o?void 0:o.get(e);if("number"===typeof u&&i<u){this.log("GRAFT: ignoring backed off peer %s",e),this.score.addPenalty(e,1,cf.GraftBackoff),s=!1;const t=u+this.opts.graftFloodThreshold-this.opts.pruneBackoff;return i<t&&this.score.addPenalty(e,1,cf.GraftBackoff),this.addBackoff(e,c),void r.push(c)}return n<0?(this.log("GRAFT: ignoring peer %s with negative score: score=%d, topic=%s",e,n,c),r.push(c),s=!1,void this.addBackoff(e,c)):l.size>=this.opts.Dhi&&!this.outbound.get(e)?(r.push(c),void this.addBackoff(e,c)):(this.log("GRAFT: Add mesh link from %s in %s",e,c),this.score.graft(e,c),l.add(e),void(null===(a=this.metrics)||void 0===a||a.onAddToMesh(c,of.Subscribed,1)))})),r.length?await Promise.all(r.map((t=>this.makePrune(e,t,s)))):[]}async handlePrune(e,t){const r=this.score.score(e);for(const{topicID:i,backoff:s,peers:o}of t){if(null==i)continue;const t=this.mesh.get(i);if(!t)return;var n;if(this.log("PRUNE: Remove mesh link to %s in %s",e,i),this.score.prune(e,i),t.has(e))t.delete(e),null===(n=this.metrics)||void 0===n||n.onRemoveFromMesh(i,af.Unsub,1);if("number"===typeof s&&s>0?this.doAddBackoff(e,i,1e3*s):this.addBackoff(e,i),o&&o.length){if(r<this.opts.scoreThresholds.acceptPXThreshold){this.log("PRUNE: ignoring PX from peer %s with insufficient score [score = %d, topic = %s]",e,r,i);continue}await this.pxConnect(o)}}}addBackoff(e,t){this.doAddBackoff(e,t,this.opts.pruneBackoff)}doAddBackoff(e,t,r){var n;let i=this.backoff.get(t);i||(i=new Map,this.backoff.set(t,i));const s=Date.now()+r;(null!==(n=i.get(e))&&void 0!==n?n:0)<s&&i.set(e,s)}applyIwantPenalties(){this.gossipTracer.getBrokenPromises().forEach(((e,t)=>{this.log("peer %s didn't follow up in %d IWANT requests; adding penalty",t,e),this.score.addPenalty(t,e,cf.BrokenPromise)}))}clearBackoff(){if(this.heartbeatTicks%15!==0)return;const e=Date.now();this.backoff.forEach(((t,r)=>{t.forEach(((r,n)=>{r<e&&t.delete(n)})),0===t.size&&this.backoff.delete(r)}))}async directConnect(){const e=[];this.direct.forEach((t=>{this.streamsOutbound.has(t)||e.push(t)})),await Promise.all(e.map((async e=>await this.connect(e))))}async pxConnect(e){e.length>this.opts.prunePeers&&(Rd(e),e=e.slice(0,this.opts.prunePeers));const t=[];await Promise.all(e.map((async e=>{if(!e.peerID)return;const r=Ts(e.peerID).toString();if(!this.peers.has(r))if(e.signedPeerRecord)try{const n=await mh.openAndCertify(e.signedPeerRecord,"libp2p-peer-record"),i=n.peerId;if(!n.peerId.equals(r))return void this.log("bogus peer record obtained through px: peer ID %p doesn't match expected peer %p",i,r);if(!await this.components.peerStore.addressBook.consumePeerRecord(n))return void this.log("bogus peer record obtained through px: could not add peer record to address book");t.push(r)}catch(n){this.log("bogus peer record obtained through px: invalid signature or not a peer record")}else t.push(r)}))),t.length&&await Promise.all(t.map((async e=>await this.connect(e))))}async connect(e){this.log("Initiating connection with %s",e);const t=As(e),r=await this.components.connectionManager.openConnection(t);for(const n of this.multicodecs)for(const e of this.components.registrar.getTopologies(n))e.onConnect(t,r)}subscribe(e){if(this.status.code!==xf.started)throw new Error("Pubsub has not started");if(!this.subscriptions.has(e)){this.subscriptions.add(e);for(const t of this.peers.keys())this.sendSubscriptions(t,[e],!0)}this.join(e)}unsubscribe(e){if(this.status.code!==xf.started)throw new Error("Pubsub is not started");const t=this.subscriptions.delete(e);if(this.log("unsubscribe from %s - am subscribed %s",e,t),t)for(const r of this.peers.keys())this.sendSubscriptions(r,[e],!1);this.leave(e).catch((e=>{this.log(e)}))}join(e){var t;if(this.status.code!==xf.started)throw new Error("Gossipsub has not started");if(this.mesh.has(e))return;this.log("JOIN %s",e),null===(t=this.metrics)||void 0===t||t.onJoin(e);const r=new Set,n=this.fanout.get(e);var i;n&&(this.fanout.delete(e),this.fanoutLastpub.delete(e),n.forEach((e=>{!this.direct.has(e)&&this.score.score(e)>=0&&r.add(e)})),null===(i=this.metrics)||void 0===i||i.onAddToMesh(e,of.Fanout,r.size));if(r.size<this.opts.D){var s;const t=r.size;this.getRandomGossipPeers(e,this.opts.D,(e=>!r.has(e)&&!this.direct.has(e)&&this.score.score(e)>=0)).forEach((e=>{r.add(e)})),null===(s=this.metrics)||void 0===s||s.onAddToMesh(e,of.Random,r.size-t)}this.mesh.set(e,r),r.forEach((t=>{this.log("JOIN: Add mesh link to %s in %s",t,e),this.sendGraft(t,e)}))}async leave(e){var t;if(this.status.code!==xf.started)throw new Error("Gossipsub has not started");this.log("LEAVE %s",e),null===(t=this.metrics)||void 0===t||t.onLeave(e);const r=this.mesh.get(e);r&&(await Promise.all(Array.from(r).map((async t=>(this.log("LEAVE: Remove mesh link to %s in %s",t,e),await this.sendPrune(t,e))))),this.mesh.delete(e))}selectPeersToForward(e,t,r){const n=new Set,i=this.topics.get(e);i&&(this.direct.forEach((e=>{!i.has(e)||t===e||null!==r&&void 0!==r&&r.has(e)||n.add(e)})),this.floodsubPeers.forEach((e=>{i.has(e)&&t!==e&&(null===r||void 0===r||!r.has(e))&&this.score.score(e)>=this.opts.scoreThresholds.publishThreshold&&n.add(e)})));const s=this.mesh.get(e);return s&&s.size>0&&s.forEach((e=>{t===e||null!==r&&void 0!==r&&r.has(e)||n.add(e)})),n}selectPeersToPublish(e){const t=new Set,r={direct:0,floodsub:0,mesh:0,fanout:0},n=this.topics.get(e);if(n)if(this.opts.floodPublish)n.forEach((e=>{this.direct.has(e)?(t.add(e),r.direct++):this.score.score(e)>=this.opts.scoreThresholds.publishThreshold&&(t.add(e),r.floodsub++)}));else{this.direct.forEach((e=>{n.has(e)&&(t.add(e),r.direct++)})),this.floodsubPeers.forEach((e=>{n.has(e)&&this.score.score(e)>=this.opts.scoreThresholds.publishThreshold&&(t.add(e),r.floodsub++)}));const i=this.mesh.get(e);if(i&&i.size>0)i.forEach((e=>{t.add(e),r.mesh++}));else{const n=this.fanout.get(e);if(n&&n.size>0)n.forEach((e=>{t.add(e),r.fanout++}));else{const n=this.getRandomGossipPeers(e,this.opts.D,(e=>this.score.score(e)>=this.opts.scoreThresholds.publishThreshold));n.size>0&&(this.fanout.set(e,n),n.forEach((e=>{t.add(e),r.fanout++})))}this.fanoutLastpub.set(e,Date.now())}}return{tosend:t,tosendCount:r}}forwardMessage(e,t,r,n){var i;r&&this.score.deliverMessage(r,e,t.topic);const s=this.selectPeersToForward(t.topic,r,n);s.forEach((e=>{this.sendRpc(e,{messages:[t]})})),null===(i=this.metrics)||void 0===i||i.onForwardMsg(t.topic,s.size)}async publish(e,t){var r;const n=this.dataTransform?this.dataTransform.outboundTransform(e,t):t;if(null==this.publishConfig)throw Error("PublishError.Uninitialized");const{raw:i,msg:s}=await async function(e,t,r,n){switch(e.type){case Od.Signing:{const i={from:e.author.toBytes(),data:n,seqno:Kn(8),topic:t,signature:void 0,key:void 0},s=xe([pf,Id.Message.encode(i).finish()]);return i.signature=await e.privateKey.sign(s),i.key=e.key,{raw:i,msg:{type:"signed",from:e.author,data:r,sequenceNumber:BigInt("0x".concat(La(i.seqno,"base16"))),topic:t,signature:i.signature,key:i.key}}}case Od.Anonymous:return{raw:{from:void 0,data:n,seqno:void 0,topic:t,signature:void 0,key:void 0},msg:{type:"unsigned",data:r,topic:t}}}}(this.publishConfig,e,t,n),o=await this.msgIdFn(s),a=this.msgIdToStrFn(o);if(this.seenCache.has(a))throw Error("PublishError.Duplicate");const{tosend:c,tosendCount:l}=this.selectPeersToPublish(e),u=!0===this.opts.emitSelf&&this.subscriptions.has(e);if(0===c.size&&!this.opts.allowPublishToZeroPeers&&!u)throw Error("PublishError.InsufficientPeers");this.seenCache.put(a),this.mcache.put({msgId:o,msgIdStr:a},i,!0),this.publishedMessageIds.put(a);for(const h of c){this.sendRpc(h,{messages:[i]})||c.delete(h)}return null===(r=this.metrics)||void 0===r||r.onPublishMsg(e,l,c.size,null!=i.data?i.data.length:0),u&&(c.add(this.components.peerId.toString()),super.dispatchEvent(new yl("gossipsub:message",{detail:{propagationSource:this.components.peerId,msgId:a,msg:s}})),super.dispatchEvent(new yl("message",{detail:s}))),{recipients:Array.from(c.values()).map((e=>As(e)))}}reportMessageValidationResult(e,t,r){if(r===xd.Accept){var n;const s=this.mcache.validate(e);if(null===(n=this.metrics)||void 0===n||n.onReportValidationMcacheHit(null!==s),null!=s){var i;const{message:n,originatingPeers:o}=s;this.score.deliverMessage(t.toString(),e,n.topic),this.forwardMessage(e,s.message,t.toString(),o),null===(i=this.metrics)||void 0===i||i.onReportValidation(n.topic,r)}}else{var s;const n=this.mcache.remove(e);if(null===(s=this.metrics)||void 0===s||s.onReportValidationMcacheHit(null!==n),n){var o;const i=Fd(r),{message:s,originatingPeers:a}=n;this.score.rejectMessage(t.toString(),e,s.topic,i);for(const t of a)this.score.rejectMessage(t,e,s.topic,i);null===(o=this.metrics)||void 0===o||o.onReportValidation(s.topic,r)}}}sendGraft(e,t){const r=[{topicID:t}];this.sendRpc(e,{control:{graft:r}})}async sendPrune(e,t){const r=[await this.makePrune(e,t,this.opts.doPX)];this.sendRpc(e,{control:{prune:r}})}sendRpc(e,t){var r;const n=this.streamsOutbound.get(e);if(!n)return this.log("Cannot send RPC to ".concat(e," as there is no open stream to it available")),!1;const i=this.control.get(e);i&&(this.piggybackControl(e,t,i),this.control.delete(e));const s=this.gossip.get(e);s&&(this.piggybackGossip(e,t,s),this.gossip.delete(e));const o=Id.encode(t).finish();try{n.push(o)}catch(a){return this.log.error("Cannot send rpc to ".concat(e),a),i&&this.control.set(e,i),s&&this.gossip.set(e,s),!1}return null===(r=this.metrics)||void 0===r||r.onRpcSent(t,o.length),!0}piggybackControl(e,t,r){if(r.graft){t.control||(t.control={}),t.control.graft||(t.control.graft=[]);for(const i of r.graft){var n;i.topicID&&null!==(n=this.mesh.get(i.topicID))&&void 0!==n&&n.has(e)&&t.control.graft.push(i)}}if(r.prune){t.control||(t.control={}),t.control.prune||(t.control.prune=[]);for(const n of r.prune){var i;!n.topicID||null!==(i=this.mesh.get(n.topicID))&&void 0!==i&&i.has(e)||t.control.prune.push(n)}}}piggybackGossip(e,t,r){t.control||(t.control={}),t.control.ihave=r}async sendGraftPrune(e,t,r){const n=this.opts.doPX;for(const[i,s]of e){const e=s.map((e=>({topicID:e})));let o=[];const a=t.get(i);a&&(o=await Promise.all(a.map((async e=>{var t;return await this.makePrune(i,e,n&&!(null!==(t=r.get(i))&&void 0!==t&&t))}))),t.delete(i)),this.sendRpc(i,{control:{graft:e,prune:o}})}for(const[i,s]of t){const e=await Promise.all(s.map((async e=>{var t;return await this.makePrune(i,e,n&&!(null!==(t=r.get(i))&&void 0!==t&&t))})));this.sendRpc(i,{control:{prune:e}})}}emitGossip(e){const t=this.mcache.getGossipIDs(new Set(e.keys()));for(const[n,i]of e){var r;this.doEmitGossip(n,i,null!==(r=t.get(n))&&void 0!==r?r:[])}}doEmitGossip(e,t,r){if(!r.length)return;if(Rd(r),r.length>kd&&this.log("too many messages for gossip; will truncate IHAVE list (%d messages)",r.length),!t.size)return;let n=this.opts.Dlazy;const i=.25*t.size;let s=t;i>n&&(n=i),n>s.size?n=s.size:s=Rd(Array.from(s)).slice(0,n),s.forEach((t=>{let n=r;r.length>kd&&(n=Rd(n.slice()).slice(0,kd)),this.pushGossip(t,{topicID:e,messageIDs:n})}))}flush(){for(const[e,t]of this.gossip.entries())this.gossip.delete(e),this.sendRpc(e,{control:{ihave:t}});for(const[e,t]of this.control.entries())this.control.delete(e),this.sendRpc(e,{control:{graft:t.graft,prune:t.prune}})}pushGossip(e,t){this.log("Add gossip to %s",e);const r=this.gossip.get(e)||[];this.gossip.set(e,r.concat(t))}async makePrune(e,t,r){if(this.score.prune(e,t),this.streamsOutbound.get(e).protocol===Ad)return{topicID:t,peers:[]};const n=this.opts.pruneBackoff/1e3;if(!r)return{topicID:t,peers:[],backoff:n};const i=this.getRandomGossipPeers(t,this.opts.prunePeers,(t=>t!==e&&this.score.score(t)>=0)),s=await Promise.all(Array.from(i).map((async e=>{const t=As(e);return{peerID:t.toBytes(),signedPeerRecord:await this.components.peerStore.addressBook.getRawEnvelope(t)}})));return{topicID:t,peers:s,backoff:n}}async heartbeat(){var e,t;const{D:r,Dlo:n,Dhi:i,Dscore:s,Dout:o,fanoutTTL:a}=this.opts;this.heartbeatTicks++;const c=new Map,l=e=>{let t=c.get(e);return void 0===t&&(t=this.score.score(e),c.set(e,t)),t},u=new Map,h=new Map,d=new Map;this.clearBackoff(),this.peerhave.clear(),null===(e=this.metrics)||void 0===e||e.cacheSize.set({cache:"iasked"},this.iasked.size),this.iasked.clear(),this.applyIwantPenalties(),this.heartbeatTicks%this.opts.directConnectTicks===0&&await this.directConnect(),null===(t=this.fastMsgIdCache)||void 0===t||t.prune(),this.seenCache.prune(),this.gossipTracer.prune(),this.publishedMessageIds.prune();const f=new Map;this.mesh.forEach(((e,t)=>{const a=this.topics.get(t),c=new Set,p=new Set;if(f.set(t,p),a){const r=Rd(Array.from(a)),n=this.backoff.get(t);for(const t of r){const r=this.streamsOutbound.get(t);if(r&&this.multicodecs.includes(r.protocol)&&!e.has(t)&&!this.direct.has(t)){const e=l(t);n&&n.has(t)||!(e>=0)||c.add(t),e>=this.opts.scoreThresholds.gossipThreshold&&p.add(t)}}}const y=(r,n)=>{var i;this.log("HEARTBEAT: Remove mesh link to %s in %s",r,t),this.addBackoff(r,t),e.delete(r),l(r)>=this.opts.scoreThresholds.gossipThreshold&&p.add(r),null===(i=this.metrics)||void 0===i||i.onRemoveFromMesh(t,n,1);const s=h.get(r);s?s.push(t):h.set(r,[t])},g=(r,n)=>{var i;this.log("HEARTBEAT: Add mesh link to %s in %s",r,t),this.score.graft(r,t),e.add(r),p.delete(r),null===(i=this.metrics)||void 0===i||i.onAddToMesh(t,n,1);const s=u.get(r);s?s.push(t):u.set(r,[t])};if(e.forEach((e=>{const r=l(e);r<0&&(this.log("HEARTBEAT: Prune peer %s with negative score: score=%d, topic=%s",e,r,t),y(e,af.BadScore),d.set(e,!0))})),e.size<n){const t=function(e,t){return Jd(e,t,(()=>!0))}(c,r-e.size);t.forEach((e=>{g(e,of.NotEnough)}))}if(e.size>i){let t=Array.from(e);t.sort(((e,t)=>l(t)-l(e))),t=t.slice(0,s).concat(Rd(t.slice(s)));let n=0;if(t.slice(0,r).forEach((e=>{this.outbound.get(e)&&n++})),n<o){const e=e=>{const r=t[e];for(let n=e;n>0;n--)t[n]=t[n-1];t[0]=r};if(n>0){let i=n;for(let n=1;n<r&&i>0;n++)this.outbound.get(t[n])&&(e(n),i--)}let i=r-n;for(let n=r;n<t.length&&i>0;n++)this.outbound.get(t[n])&&(e(n),i--)}t.slice(r).forEach((e=>{y(e,af.Excess)}))}if(e.size>=n){let t=0;if(e.forEach((e=>{this.outbound.get(e)&&t++})),t<o){Jd(c,o-t,(e=>!0===this.outbound.get(e))).forEach((e=>{g(e,of.Outbound)}))}}if(this.heartbeatTicks%this.opts.opportunisticGraftTicks===0&&e.size>1){const r=Array.from(e).sort(((e,t)=>l(e)-l(t))),n=Math.floor(e.size/2),i=l(r[n]);if(i<this.opts.scoreThresholds.opportunisticGraftThreshold){const e=Jd(c,this.opts.opportunisticGraftPeers,(e=>l(e)>i));for(const r of e)this.log("HEARTBEAT: Opportunistically graft peer %s on topic %s",r,t),g(r,of.Opportunistic)}}}));const p=Date.now();this.fanoutLastpub.forEach(((e,t)=>{e+a<p&&(this.fanout.delete(t),this.fanoutLastpub.delete(t))})),this.fanout.forEach(((e,t)=>{const n=this.topics.get(t);e.forEach((t=>{(!n.has(t)||l(t)<this.opts.scoreThresholds.publishThreshold)&&e.delete(t)}));const i=this.topics.get(t),s=[],o=new Set;if(f.set(t,o),i){const t=Rd(Array.from(i));for(const r of t){const t=this.streamsOutbound.get(r);if(t&&this.multicodecs.includes(t.protocol)&&!e.has(r)&&!this.direct.has(r)){const e=l(r);e>=this.opts.scoreThresholds.publishThreshold&&s.push(r),e>=this.opts.scoreThresholds.gossipThreshold&&o.add(r)}}}if(e.size<r){const t=r-e.size;s.slice(0,t).forEach((t=>{e.add(t),null===o||void 0===o||o.delete(t)}))}})),this.emitGossip(f),await this.sendGraftPrune(u,h,d),this.flush(),this.mcache.shift(),this.dispatchEvent(new yl("gossipsub:heartbeat"))}getRandomGossipPeers(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:()=>!0;const n=this.topics.get(e);if(!n)return new Set;let i=[];return n.forEach((e=>{const t=this.streamsOutbound.get(e);t&&this.multicodecs.includes(t.protocol)&&r(e)&&i.push(e)})),i=Rd(i),t>0&&i.length>t&&(i=i.slice(0,t)),new Set(i)}onScrapeMetrics(e){var t,r;e.mcacheSize.set(this.mcache.size),e.mcacheNotValidatedCount.set(this.mcache.notValidatedCount),e.cacheSize.set({cache:"direct"},this.direct.size),e.cacheSize.set({cache:"seenCache"},this.seenCache.size),e.cacheSize.set({cache:"fastMsgIdCache"},null!==(t=null===(r=this.fastMsgIdCache)||void 0===r?void 0:r.size)&&void 0!==t?t:0),e.cacheSize.set({cache:"publishedMessageIds"},this.publishedMessageIds.size),e.cacheSize.set({cache:"mcache"},this.mcache.size),e.cacheSize.set({cache:"score"},this.score.size),e.cacheSize.set({cache:"gossipTracer.promises"},this.gossipTracer.size),e.cacheSize.set({cache:"gossipTracer.requests"},this.gossipTracer.requestMsByMsgSize),e.cacheSize.set({cache:"topics"},this.topics.size),e.cacheSize.set({cache:"subscriptions"},this.subscriptions.size),e.cacheSize.set({cache:"mesh"},this.mesh.size),e.cacheSize.set({cache:"fanout"},this.fanout.size),e.cacheSize.set({cache:"peers"},this.peers.size),e.cacheSize.set({cache:"streamsOutbound"},this.streamsOutbound.size),e.cacheSize.set({cache:"streamsInbound"},this.streamsInbound.size),e.cacheSize.set({cache:"acceptFromWhitelist"},this.acceptFromWhitelist.size),e.cacheSize.set({cache:"gossip"},this.gossip.size),e.cacheSize.set({cache:"control"},this.control.size),e.cacheSize.set({cache:"peerhave"},this.peerhave.size),e.cacheSize.set({cache:"outbound"},this.outbound.size);let n=0;for(const l of this.backoff.values())n+=l.size;e.cacheSize.set({cache:"backoff"},n);for(const[l,u]of this.topics)e.topicPeersCount.set({topicStr:l},u.size);for(const[l,u]of this.mesh)e.meshPeerCounts.set({topicStr:l},u.size);const i=[],s=new Map;e.behaviourPenalty.reset();for(const l of this.peers.keys()){var o,a;const t=this.score.score(l);i.push(t),s.set(l,t),e.behaviourPenalty.observe(null!==(o=null===(a=this.score.peerStats.get(l))||void 0===a?void 0:a.behaviourPenalty)&&void 0!==o?o:0)}e.registerScores(i,this.opts.scoreThresholds),e.registerScorePerMesh(this.mesh,s);const c=function(e,t,r,n,i){const s={byTopic:new Map,p5w:[],p6w:[],p7w:[],score:[]};for(const o of e){const e=t.get(o);if(e){const t=mf(o,e,r,n,i);for(const[e,r]of t.byTopic){let t=s.byTopic.get(e);t||(t={p1w:[],p2w:[],p3w:[],p3bw:[],p4w:[]},s.byTopic.set(e,t)),t.p1w.push(r.p1w),t.p2w.push(r.p2w),t.p3w.push(r.p3w),t.p3bw.push(r.p3bw),t.p4w.push(r.p4w)}s.p5w.push(t.p5w),s.p6w.push(t.p6w),s.p7w.push(t.p7w),s.score.push(t.score)}else s.p5w.push(0),s.p6w.push(0),s.p7w.push(0),s.score.push(0)}return s}(this.peers.keys(),this.score.peerStats,this.score.params,this.score.peerIPs,e.topicStrToLabel);e.registerScoreWeights(c)}}Lf.multicodec=Td;const Of=Oa("waku:message:topic-only");class Bf{constructor(e){this.proto=e}get contentTopic(){var e;return null!==(e=this.proto.contentTopic)&&void 0!==e?e:""}}class Mf{constructor(){this.contentTopic=""}fromWireToProtoObj(e){const t=ph.decode(e);return Of("Message decoded",t),Promise.resolve({contentTopic:t.contentTopic,payload:void 0,rateLimitProof:void 0,timestamp:void 0,version:void 0,ephemeral:void 0})}async fromProtoObj(e){return new Bf(e)}}const Uf=Oa("waku:relay");class Ff extends Lf{constructor(e,t){var r,n,i;super(e,t=Object.assign(null!==(r=t)&&void 0!==r?r:{},{globalSignaturePolicy:Ld.StrictNoSign,fallbackToFloodsub:!1})),this.multicodecs=qu,this.observers=new Map,this.pubSubTopic=null!==(n=null===(i=t)||void 0===i?void 0:i.pubSubTopic)&&void 0!==n?n:"/waku/2/default-waku/proto",this.defaultDecoder=new Mf}async start(){await super.start(),this.subscribe(this.pubSubTopic)}async send(e,t){const r=await e.toWire(t);return r?this.publish(this.pubSubTopic,r):(Uf("Failed to encode message, aborting publish"),{recipients:[]})}addObserver(e,t){const r={decoder:e,callback:t};return function(e,t,r){let n=e.get(t);"undefined"===typeof n&&(e.set(t,new Set),n=e.get(t)),n.add(r)}(this.observers,e.contentTopic,r),()=>{const t=this.observers.get(e.contentTopic);t&&t.delete(r)}}subscribe(e){this.addEventListener("gossipsub:message",(async t=>{if(t.detail.msg.topic!==e)return;Uf("Message received on ".concat(e));const r=await this.defaultDecoder.fromWireToProtoObj(t.detail.msg.data);if(!r||!r.contentTopic)return void Uf("Message does not have a content topic, skipping");const n=this.observers.get(r.contentTopic);n&&await Promise.all(Array.from(n).map((async e=>{let{decoder:n,callback:i}=e;const s=await n.fromWireToProtoObj(t.detail.msg.data);if(!s)return void Uf("Internal error: message previously decoded failed on 2nd pass.");const o=await n.fromProtoObj(s);o?i(o):Uf("Failed to decode messages on",r.contentTopic)})))})),super.subscribe(e)}getMeshPeers(e){return super.getMeshPeers(null!==e&&void 0!==e?e:this.pubSubTopic)}}function Vf(e,t){return e.length<=t||e.length<=1?e:function(e){if(e.length<=1)return e;const t=()=>Math.floor(Math.random()*Math.floor(e.length));for(let r=0;r<e.length;r++){const n=t(),i=e[r];e[r]=e[n],e[n]=i}return e}(e).slice(0,t)}Ff.multicodec=qu[0],Ff.multicodec=qu[qu.length-1];var jf;function Kf(){let e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:jf.Prod,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;if(r<=0)return[];switch(t){case jf.Prod:e=qf.fleets["wakuv2.prod"]["waku-websocket"];break;case jf.Test:e=qf.fleets["wakuv2.test"]["waku-websocket"];break;default:e=qf.fleets["wakuv2.prod"]["waku-websocket"]}return e=Object.values(e),Vf(e,r)}!function(e){e.Prod="prod",e.Test="test"}(jf||(jf={}));const qf={fleets:{"wakuv2.prod":{"waku-websocket":{"node-01.ac-cn-hongkong-c.wakuv2.prod":"/dns4/node-01.ac-cn-hongkong-c.wakuv2.prod.statusim.net/tcp/443/wss/p2p/16Uiu2HAm4v86W3bmT1BiH6oSPzcsSr24iDQpSN5Qa992BCjjwgrD","node-01.do-ams3.wakuv2.prod":"/dns4/node-01.do-ams3.wakuv2.prod.statusim.net/tcp/443/wss/p2p/16Uiu2HAmL5okWopX7NqZWBUKVqW8iUxCEmd5GMHLVPwCgzYzQv3e","node-01.gc-us-central1-a.wakuv2.prod":"/dns4/node-01.gc-us-central1-a.wakuv2.prod.statusim.net/tcp/443/wss/p2p/16Uiu2HAmVkKntsECaYfefR1V2yCR79CegLATuTPE6B9TxgxBiiiA"}},"wakuv2.test":{"waku-websocket":{"node-01.ac-cn-hongkong-c.wakuv2.test":"/dns4/node-01.ac-cn-hongkong-c.wakuv2.test.statusim.net/tcp/443/wss/p2p/16Uiu2HAkvWiyFsgRhuJEb9JfjYxEkoHLgnUQmr1N5mKWnYjxYRVm","node-01.do-ams3.wakuv2.test":"/dns4/node-01.do-ams3.wakuv2.test.statusim.net/tcp/443/wss/p2p/16Uiu2HAmPLe7Mzm8TsYUubgCAW1aJoeFScxrLj8ppHFivPo97bUZ","node-01.gc-us-central1-a.wakuv2.test":"/dns4/node-01.gc-us-central1-a.wakuv2.test.statusim.net/tcp/443/wss/p2p/16Uiu2HAmJb2e28qLXxT5kZxVUUoJt72EMzNGXB47Rxx5hw3q4YjS"}}}};function zf(e){return null!=e&&"function"===typeof e.start&&"function"===typeof e.stop}const Hf=(e,t)=>async function*(){const r=await Iu(e);yield*r.sort(t)}();var Wf=__webpack_require__(8712),Gf=__webpack_require__(7453),Qf=__webpack_require__(7693);const Yf="/",$f=(new TextEncoder).encode(Yf),Xf=$f[0];class Jf{constructor(e,t){if("string"===typeof e)this._buf=Lr(e);else{if(!(e instanceof Uint8Array))throw new Error("Invalid key, should be String of Uint8Array");this._buf=e}if(null==t&&(t=!0),t&&this.clean(),0===this._buf.byteLength||this._buf[0]!==Xf)throw new Error("Invalid key")}toString(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"utf8";return Mr(this._buf,e)}uint8Array(){return this._buf}get[Symbol.toStringTag](){return"Key(".concat(this.toString(),")")}static withNamespaces(e){return new Jf(e.join(Yf))}static random(){return new Jf(function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:21;return crypto.getRandomValues(new Uint8Array(e)).reduce(((e,t)=>e+((t&=63)<36?t.toString(36):t<62?(t-26).toString(36).toUpperCase():t>62?"-":"_")),"")}().replace(/-/g,""))}static asKey(e){return e instanceof Uint8Array||"string"===typeof e?new Jf(e):"function"===typeof e.uint8Array?new Jf(e.uint8Array()):null}clean(){if(null!=this._buf&&0!==this._buf.byteLength||(this._buf=$f),this._buf[0]!==Xf){const e=new Uint8Array(this._buf.byteLength+1);e.fill(Xf,0,1),e.set(this._buf,1),this._buf=e}for(;this._buf.byteLength>1&&this._buf[this._buf.byteLength-1]===Xf;)this._buf=this._buf.subarray(0,-1)}less(e){const t=this.list(),r=e.list();for(let n=0;n<t.length;n++){if(r.length<n+1)return!1;const e=t[n],i=r[n];if(e<i)return!0;if(e>i)return!1}return t.length<r.length}reverse(){return Jf.withNamespaces(this.list().slice().reverse())}namespaces(){return this.list()}baseNamespace(){const e=this.namespaces();return e[e.length-1]}list(){return this.toString().split(Yf).slice(1)}type(){return function(e){const t=e.split(":");if(t.length<2)return"";return t.slice(0,-1).join(":")}(this.baseNamespace())}name(){return function(e){const t=e.split(":");return t[t.length-1]}(this.baseNamespace())}instance(e){return new Jf(this.toString()+":"+e)}path(){let e=this.parent().toString();return e.endsWith(Yf)||(e+=Yf),e+=this.type(),new Jf(e)}parent(){const e=this.list();return 1===e.length?new Jf(Yf):new Jf(e.slice(0,-1).join(Yf))}child(e){return this.toString()===Yf?e:e.toString()===Yf?this:new Jf(this.toString()+e.toString(),!1)}isAncestorOf(e){return e.toString()!==this.toString()&&e.toString().startsWith(this.toString())}isDecendantOf(e){return e.toString()!==this.toString()&&this.toString().startsWith(e.toString())}isTopLevel(){return 1===this.list().length}concat(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return Jf.withNamespaces([...this.namespaces(),...(n=t.map((e=>e.namespaces())),[].concat(...n))]);var n}}class Zf extends class{open(){return Promise.reject(new Error(".open is not implemented"))}close(){return Promise.reject(new Error(".close is not implemented"))}put(e,t,r){return Promise.reject(new Error(".put is not implemented"))}get(e,t){return Promise.reject(new Error(".get is not implemented"))}has(e,t){return Promise.reject(new Error(".has is not implemented"))}delete(e,t){return Promise.reject(new Error(".delete is not implemented"))}async*putMany(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};for await(const{key:r,value:n}of e)await this.put(r,n,t),yield{key:r,value:n}}async*getMany(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};for await(const r of e)yield this.get(r,t)}async*deleteMany(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};for await(const r of e)await this.delete(r,t),yield r}batch(){let e=[],t=[];return{put(t,r){e.push({key:t,value:r})},delete(e){t.push(e)},commit:async r=>{await Wf(this.putMany(e,r)),e=[],await Wf(this.deleteMany(t,r)),t=[]}}}async*_all(e,t){throw new Error("._all is not implemented")}async*_allKeys(e,t){throw new Error("._allKeys is not implemented")}query(e,t){let r=this._all(e,t);if(null!=e.prefix&&(r=Gf(r,(t=>t.key.toString().startsWith(e.prefix)))),Array.isArray(e.filters)&&(r=e.filters.reduce(((e,t)=>Gf(e,t)),r)),Array.isArray(e.orders)&&(r=e.orders.reduce(((e,t)=>Hf(e,t)),r)),null!=e.offset){let t=0;r=Gf(r,(()=>t++>=e.offset))}return null!=e.limit&&(r=Qf(r,e.limit)),r}queryKeys(e,t){let r=this._allKeys(e,t);if(null!=e.prefix&&(r=Gf(r,(t=>t.toString().startsWith(e.prefix)))),Array.isArray(e.filters)&&(r=e.filters.reduce(((e,t)=>Gf(e,t)),r)),Array.isArray(e.orders)&&(r=e.orders.reduce(((e,t)=>Hf(e,t)),r)),null!=e.offset){let t=0;r=Gf(r,(()=>t++>=e.offset))}return null!=e.limit&&(r=Qf(r,e.limit)),r}}{constructor(){super(),this.data={}}open(){return Promise.resolve()}close(){return Promise.resolve()}async put(e,t){this.data[e.toString()]=t}async get(e){if(!await this.has(e))throw t=t||new Error("Not Found"),ue(t,"ERR_NOT_FOUND");var t;return this.data[e.toString()]}async has(e){return void 0!==this.data[e.toString()]}async delete(e){delete this.data[e.toString()]}async*_all(){yield*Object.entries(this.data).map((e=>{let[t,r]=e;return{key:new Jf(t),value:r}}))}async*_allKeys(){yield*Object.entries(this.data).map((e=>{let[t]=e;return new Jf(t)}))}}var ep,tp;async function*rp(e,t){for await(const r of e)await t(r)&&(yield r)}async function*np(e,t){for await(const r of e)yield t(r)}async function*ip(e,t){yield*np(e,(async e=>(await t.addressBook.add(e.id,e.multiaddrs),e)))}function sp(e){const t=new Set;return rp(e,(e=>!t.has(e.id.toString())&&(t.add(e.id.toString()),!0)))}async function*op(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,r=0;for await(const n of e)r++,yield n;if(r<t)throw ue(new Error("not found"),"NOT_FOUND")}!function(e){e.NOT_STARTED_YET="The libp2p node is not started yet",e.DHT_DISABLED="DHT is not available",e.PUBSUB_DISABLED="PubSub is not available",e.CONN_ENCRYPTION_REQUIRED="At least one connection encryption module is required",e.ERR_TRANSPORTS_REQUIRED="At least one transport module is required",e.ERR_PROTECTOR_REQUIRED="Private network is enforced, but no protector was provided",e.NOT_FOUND="Not found"}(ep||(ep={})),function(e){e.DHT_DISABLED="ERR_DHT_DISABLED",e.ERR_PUBSUB_DISABLED="ERR_PUBSUB_DISABLED",e.PUBSUB_NOT_STARTED="ERR_PUBSUB_NOT_STARTED",e.DHT_NOT_STARTED="ERR_DHT_NOT_STARTED",e.CONN_ENCRYPTION_REQUIRED="ERR_CONN_ENCRYPTION_REQUIRED",e.ERR_TRANSPORTS_REQUIRED="ERR_TRANSPORTS_REQUIRED",e.ERR_PROTECTOR_REQUIRED="ERR_PROTECTOR_REQUIRED",e.ERR_PEER_DIAL_INTERCEPTED="ERR_PEER_DIAL_INTERCEPTED",e.ERR_CONNECTION_INTERCEPTED="ERR_CONNECTION_INTERCEPTED",e.ERR_INVALID_PROTOCOLS_FOR_STREAM="ERR_INVALID_PROTOCOLS_FOR_STREAM",e.ERR_CONNECTION_ENDED="ERR_CONNECTION_ENDED",e.ERR_CONNECTION_FAILED="ERR_CONNECTION_FAILED",e.ERR_NODE_NOT_STARTED="ERR_NODE_NOT_STARTED",e.ERR_ALREADY_ABORTED="ERR_ALREADY_ABORTED",e.ERR_TOO_MANY_ADDRESSES="ERR_TOO_MANY_ADDRESSES",e.ERR_NO_VALID_ADDRESSES="ERR_NO_VALID_ADDRESSES",e.ERR_RELAYED_DIAL="ERR_RELAYED_DIAL",e.ERR_DIALED_SELF="ERR_DIALED_SELF",e.ERR_DISCOVERED_SELF="ERR_DISCOVERED_SELF",e.ERR_DUPLICATE_TRANSPORT="ERR_DUPLICATE_TRANSPORT",e.ERR_ENCRYPTION_FAILED="ERR_ENCRYPTION_FAILED",e.ERR_HOP_REQUEST_FAILED="ERR_HOP_REQUEST_FAILED",e.ERR_INVALID_KEY="ERR_INVALID_KEY",e.ERR_INVALID_MESSAGE="ERR_INVALID_MESSAGE",e.ERR_INVALID_PARAMETERS="ERR_INVALID_PARAMETERS",e.ERR_INVALID_PEER="ERR_INVALID_PEER",e.ERR_MUXER_UNAVAILABLE="ERR_MUXER_UNAVAILABLE",e.ERR_NOT_FOUND="ERR_NOT_FOUND",e.ERR_TIMEOUT="ERR_TIMEOUT",e.ERR_TRANSPORT_UNAVAILABLE="ERR_TRANSPORT_UNAVAILABLE",e.ERR_TRANSPORT_DIAL_FAILED="ERR_TRANSPORT_DIAL_FAILED",e.ERR_UNSUPPORTED_PROTOCOL="ERR_UNSUPPORTED_PROTOCOL",e.ERR_PROTOCOL_HANDLER_ALREADY_REGISTERED="ERR_PROTOCOL_HANDLER_ALREADY_REGISTERED",e.ERR_INVALID_MULTIADDR="ERR_INVALID_MULTIADDR",e.ERR_SIGNATURE_NOT_VALID="ERR_SIGNATURE_NOT_VALID",e.ERR_FIND_SELF="ERR_FIND_SELF",e.ERR_NO_ROUTERS_AVAILABLE="ERR_NO_ROUTERS_AVAILABLE",e.ERR_CONNECTION_NOT_MULTIPLEXED="ERR_CONNECTION_NOT_MULTIPLEXED",e.ERR_NO_DIAL_TOKENS="ERR_NO_DIAL_TOKENS",e.ERR_KEYCHAIN_REQUIRED="ERR_KEYCHAIN_REQUIRED",e.ERR_INVALID_CMS="ERR_INVALID_CMS",e.ERR_MISSING_KEYS="ERR_MISSING_KEYS",e.ERR_NO_KEY="ERR_NO_KEY",e.ERR_INVALID_KEY_NAME="ERR_INVALID_KEY_NAME",e.ERR_INVALID_KEY_TYPE="ERR_INVALID_KEY_TYPE",e.ERR_KEY_ALREADY_EXISTS="ERR_KEY_ALREADY_EXISTS",e.ERR_INVALID_KEY_SIZE="ERR_INVALID_KEY_SIZE",e.ERR_KEY_NOT_FOUND="ERR_KEY_NOT_FOUND",e.ERR_OLD_KEY_NAME_INVALID="ERR_OLD_KEY_NAME_INVALID",e.ERR_NEW_KEY_NAME_INVALID="ERR_NEW_KEY_NAME_INVALID",e.ERR_PASSWORD_REQUIRED="ERR_PASSWORD_REQUIRED",e.ERR_PEM_REQUIRED="ERR_PEM_REQUIRED",e.ERR_CANNOT_READ_KEY="ERR_CANNOT_READ_KEY",e.ERR_MISSING_PRIVATE_KEY="ERR_MISSING_PRIVATE_KEY",e.ERR_MISSING_PUBLIC_KEY="ERR_MISSING_PUBLIC_KEY",e.ERR_INVALID_OLD_PASS_TYPE="ERR_INVALID_OLD_PASS_TYPE",e.ERR_INVALID_NEW_PASS_TYPE="ERR_INVALID_NEW_PASS_TYPE",e.ERR_INVALID_PASS_LENGTH="ERR_INVALID_PASS_LENGTH",e.ERR_NOT_IMPLEMENTED="ERR_NOT_IMPLEMENTED",e.ERR_WRONG_PING_ACK="ERR_WRONG_PING_ACK",e.ERR_INVALID_RECORD="ERR_INVALID_RECORD",e.ERR_ALREADY_SUCCEEDED="ERR_ALREADY_SUCCEEDED",e.ERR_NO_HANDLER_FOR_PROTOCOL="ERR_NO_HANDLER_FOR_PROTOCOL",e.ERR_TOO_MANY_OUTBOUND_PROTOCOL_STREAMS="ERR_TOO_MANY_OUTBOUND_PROTOCOL_STREAMS",e.ERR_TOO_MANY_INBOUND_PROTOCOL_STREAMS="ERR_TOO_MANY_INBOUND_PROTOCOL_STREAMS",e.ERR_CONNECTION_DENIED="ERR_CONNECTION_DENIED"}(tp||(tp={}));var ap=__webpack_require__(6512);async function*cp(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];const n=H({objectMode:!0});Promise.resolve().then((async()=>{try{await Promise.all(t.map((async e=>{for await(const t of e)n.push(t)}))),n.end()}catch(e){n.end(e)}})),yield*n}async function lp(e){for await(const t of e)return t}async function up(e){for await(const t of e);}var hp=__webpack_require__(4465),dp=__webpack_require__(3478);const fp=Ba("libp2p:peer-routing");class pp{constructor(e,t){var r;this.components=e,this.routers=t.routers,this.refreshManagerInit=null!==(r=t.refreshManager)&&void 0!==r?r:{},this.started=!1,this._findClosestPeersTask=this._findClosestPeersTask.bind(this)}isStarted(){return this.started}async start(){this.started||0===this.routers.length||null!=this.timeoutId||!1===this.refreshManagerInit.enabled||(this.timeoutId=(0,hp.setDelayedInterval)(this._findClosestPeersTask,this.refreshManagerInit.interval,this.refreshManagerInit.bootDelay),this.started=!0)}async _findClosestPeersTask(){if(null==this.abortController)try{var e;this.abortController=new ap.TimeoutController(null!==(e=this.refreshManagerInit.timeout)&&void 0!==e?e:1e4);try{null===dp.setMaxListeners||void 0===dp.setMaxListeners||(0,dp.setMaxListeners)(1/0,this.abortController.signal)}catch{}await up(this.getClosestPeers(this.components.peerId.toBytes(),{signal:this.abortController.signal}))}catch(r){fp.error(r)}finally{var t;null===(t=this.abortController)||void 0===t||t.clear(),this.abortController=void 0}}async stop(){var e;(0,hp.clearDelayedInterval)(this.timeoutId),null===(e=this.abortController)||void 0===e||e.abort(),this.started=!1}async findPeer(e,t){if(0===this.routers.length)throw ue(new Error("No peer routers available"),tp.ERR_NO_ROUTERS_AVAILABLE);if(e.toString()===this.components.peerId.toString())throw ue(new Error("Should not try to find self"),tp.ERR_FIND_SELF);const r=await Ee(cp(...this.routers.map((r=>async function*(){try{yield await r.findPeer(e,t)}catch(n){fp.error(n)}}()))),(e=>rp(e,Boolean)),(e=>ip(e,this.components.peerStore)),(async e=>await lp(e)));if(null!=r)return r;throw ue(new Error(ep.NOT_FOUND),tp.ERR_NOT_FOUND)}async*getClosestPeers(e,t){if(0===this.routers.length)throw ue(new Error("No peer routers available"),tp.ERR_NO_ROUTERS_AVAILABLE);yield*Ee(cp(...this.routers.map((r=>r.getClosestPeers(e,t)))),(e=>ip(e,this.components.peerStore)),(e=>sp(e)),(e=>op(e)))}}class yp{constructor(e,t){var r;this.routers=null!==(r=t.routers)&&void 0!==r?r:[],this.started=!1,this.components=e}isStarted(){return this.started}async start(){this.started=!0}async stop(){this.started=!1}async*findProviders(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(0===this.routers.length)throw ue(new Error("No content this.routers available"),tp.ERR_NO_ROUTERS_AVAILABLE);yield*Ee(cp(...this.routers.map((r=>r.findProviders(e,t)))),(e=>ip(e,this.components.peerStore)),(e=>sp(e)),(e=>op(e)))}async provide(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(0===this.routers.length)throw ue(new Error("No content routers available"),tp.ERR_NO_ROUTERS_AVAILABLE);await Promise.all(this.routers.map((async r=>await r.provide(e,t))))}async put(e,t,r){if(!this.isStarted())throw ue(new Error(ep.NOT_STARTED_YET),tp.DHT_NOT_STARTED);const n=this.components.dht;null!=n&&await up(n.put(e,t,r))}async get(e,t){if(!this.isStarted())throw ue(new Error(ep.NOT_STARTED_YET),tp.DHT_NOT_STARTED);const r=this.components.dht;if(null!=r)for await(const n of r.get(e,t))if("VALUE"===n.name)return n.value;throw ue(new Error(ep.NOT_FOUND),tp.ERR_NOT_FOUND)}async*getMany(e,t,r){if(!this.isStarted())throw ue(new Error(ep.NOT_STARTED_YET),tp.DHT_NOT_STARTED);if(null==t||0===t)return;let n=0;const i=this.components.dht;if(null!=i)for await(const s of i.get(e,r))if("VALUE"===s.name&&(yield{from:s.from,val:s.value},n++,n===t))break;if(0===n)throw ue(new Error(ep.NOT_FOUND),tp.ERR_NOT_FOUND)}}function gp(e){if(bs(e))return{id:e,multiaddrs:[],protocols:[]};let t;return"string"===typeof e&&(e=Uc(e)),Bc(e)&&(t=e,e=function(e){const t=e.getPeerId();if(null==t)throw ue(new Error("".concat(e.toString()," does not have a valid peer type")),tp.ERR_INVALID_MULTIADDR);try{return As(t)}catch(r){throw ue(new Error("".concat(e.toString()," is not a valid peer type")),tp.ERR_INVALID_MULTIADDR)}}(e)),{id:e,multiaddrs:null!=t?[t]:[],protocols:[]}}const mp=e=>e;class vp extends fl{constructor(e,t){var r;super();const{listen:n=[],announce:i=[]}=t;this.components=e,this.listen=new Set(n.map((e=>e.toString()))),this.announce=new Set(i.map((e=>e.toString()))),this.observed=new Set,this.announceFilter=null!==(r=t.announceFilter)&&void 0!==r?r:mp}getListenAddrs(){return Array.from(this.listen).map((e=>Uc(e)))}getAnnounceAddrs(){return Array.from(this.announce).map((e=>Uc(e)))}getObservedAddrs(){return Array.from(this.observed).map((e=>Uc(e)))}confirmObservedAddr(e){}removeObservedAddr(e){}addObservedAddr(e){let t=Uc(e);const r=t.getPeerId();if(null!=r){As(r).equals(this.components.peerId)&&(t=t.decapsulate(Uc("/p2p/".concat(this.components.peerId.toString()))))}const n=t.toString();this.observed.has(n)||(this.observed.add(n),this.dispatchEvent(new yl("change:addresses")))}getAddresses(){let e=this.getAnnounceAddrs().map((e=>e.toString()));0===e.length&&(e=this.components.transportManager.getAddrs().map((e=>e.toString()))),e=e.concat(this.getObservedAddrs().map((e=>e.toString())));const t=new Set(e);return this.announceFilter(Array.from(t).map((e=>Uc(e)))).map((e=>e.getPeerId()===this.components.peerId.toString()?e:e.encapsulate("/p2p/".concat(this.components.peerId.toString()))))}}const bp=__webpack_require__(9217),wp=Ba("libp2p:connection-manager:latency-monitor:visibility-change-emitter");class Ep extends fl{constructor(){super(),this.hidden="hidden",this.visibilityChange="visibilityChange",null!=globalThis.document&&(this._initializeVisibilityVarNames(),this._addVisibilityChangeListener())}_initializeVisibilityVarNames(){let e="hidden",t="visibilitychange";"undefined"!==typeof globalThis.document.hidden?(e="hidden",t="visibilitychange"):"undefined"!==typeof globalThis.document.mozHidden?(e="mozHidden",t="mozvisibilitychange"):"undefined"!==typeof globalThis.document.msHidden?(e="msHidden",t="msvisibilitychange"):"undefined"!==typeof globalThis.document.webkitHidden&&(e="webkitHidden",t="webkitvisibilitychange"),this.hidden=e,this.visibilityChange=t}_addVisibilityChangeListener(){"undefined"===typeof globalThis.document.addEventListener||"undefined"===typeof document[this.hidden]?wp("Checking page visibility requires a browser that supports the Page Visibility API."):globalThis.document.addEventListener(this.visibilityChange,this._handleVisibilityChange.bind(this),!1)}isVisible(){if(void 0!==this.hidden&&void 0!==document[this.hidden])return null==document[this.hidden]}_handleVisibilityChange(){const e=!1===globalThis.document[this.hidden];wp(e?"Page Visible":"Page Hidden"),this.dispatchEvent(new yl("visibilityChange",{detail:e}))}}const _p=Ba("libp2p:connection-manager:latency-monitor");class Sp extends fl{constructor(){var e,t;let r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};super();const{latencyCheckIntervalMs:n,dataEmitIntervalMs:i,asyncTestFn:s,latencyRandomPercentage:o}=r;this.latencyCheckIntervalMs=null!==n&&void 0!==n?n:500,this.latencyRandomPercentage=null!==o&&void 0!==o?o:10,this.latencyCheckMultiply=this.latencyRandomPercentage/100*2*this.latencyCheckIntervalMs,this.latencyCheckSubtract=this.latencyCheckMultiply/2,this.dataEmitIntervalMs=null===i||0===i?void 0:null!==i&&void 0!==i?i:5e3,_p("latencyCheckIntervalMs: %s dataEmitIntervalMs: %s",this.latencyCheckIntervalMs,this.dataEmitIntervalMs),null!=this.dataEmitIntervalMs?_p("Expecting ~%s events per summary",this.latencyCheckIntervalMs/this.dataEmitIntervalMs):_p("Not emitting summaries"),this.asyncTestFn=s,null!=(null===(e=globalThis.process)||void 0===e?void 0:e.hrtime)?(_p("Using process.hrtime for timing"),this.now=globalThis.process.hrtime,this.getDeltaMS=e=>{const t=this.now(e);return 1e3*t[0]+t[1]/1e6}):"undefined"!==typeof window&&null!=(null===(t=window.performance)||void 0===t?void 0:t.now)?(_p("Using performance.now for timing"),this.now=window.performance.now.bind(window.performance),this.getDeltaMS=e=>Math.round(this.now()-e)):(_p("Using Date.now for timing"),this.now=Date.now,this.getDeltaMS=e=>this.now()-e),this.latencyData=this.initLatencyData()}start(){var e;"undefined"!==typeof globalThis.window&&(this.visibilityChangeEmitter=new Ep,this.visibilityChangeEmitter.addEventListener("visibilityChange",(e=>{const{detail:t}=e;t?this._startTimers():(this._emitSummary(),this._stopTimers())}))),!0===(null===(e=this.visibilityChangeEmitter)||void 0===e?void 0:e.isVisible())&&this._startTimers()}stop(){this._stopTimers()}_startTimers(){null==this.checkLatencyID&&(this.checkLatency(),null!=this.dataEmitIntervalMs&&(this.emitIntervalID=setInterval((()=>this._emitSummary()),this.dataEmitIntervalMs),"function"===typeof this.emitIntervalID.unref&&this.emitIntervalID.unref()))}_stopTimers(){null!=this.checkLatencyID&&(clearTimeout(this.checkLatencyID),this.checkLatencyID=void 0),null!=this.emitIntervalID&&(clearInterval(this.emitIntervalID),this.emitIntervalID=void 0)}_emitSummary(){const e=this.getSummary();e.events>0&&this.dispatchEvent(new yl("data",{detail:e}))}getSummary(){const e={events:this.latencyData.events,minMs:this.latencyData.minMs,maxMs:this.latencyData.maxMs,avgMs:this.latencyData.events>0?this.latencyData.totalMs/this.latencyData.events:Number.POSITIVE_INFINITY,lengthMs:this.getDeltaMS(this.latencyData.startTime)};return this.latencyData=this.initLatencyData(),_p.trace("Summary: %O",e),e}checkLatency(){const e=Math.random()*this.latencyCheckMultiply-this.latencyCheckSubtract,t={deltaOffset:Math.ceil(this.latencyCheckIntervalMs+e),startTime:this.now()},r=()=>{if(null==this.checkLatencyID)return;const e=this.getDeltaMS(t.startTime)-t.deltaOffset;this.checkLatency(),this.latencyData.events++,this.latencyData.minMs=Math.min(this.latencyData.minMs,e),this.latencyData.maxMs=Math.max(this.latencyData.maxMs,e),this.latencyData.totalMs+=e,_p.trace("MS: %s Data: %O",e,this.latencyData)};_p.trace("localData: %O",t),this.checkLatencyID=setTimeout((()=>{null!=this.asyncTestFn?(t.deltaOffset=0,t.startTime=this.now(),this.asyncTestFn(r)):(t.deltaOffset-=1,r())}),t.deltaOffset),"function"===typeof this.checkLatencyID.unref&&this.checkLatencyID.unref()}initLatencyData(){return{startTime:this.now(),minMs:Number.POSITIVE_INFINITY,maxMs:Number.NEGATIVE_INFINITY,events:0,totalMs:0}}}var Ip=__webpack_require__(3658);const Cp="OPEN",Ap="CLOSING",Tp="CLOSED";function kp(e,t){const r={[Symbol.iterator]:()=>r,next:()=>{const r=e.next(),n=r.value;if(!0===r.done||null==n){return{done:!0,value:void 0}}return{done:!1,value:t(n)}}};return r}class Rp{constructor(e){if(this.map=new Map,null!=e)for(const[t,r]of e.entries())this.map.set(t.toString(),r)}[Symbol.iterator](){return this.entries()}clear(){this.map.clear()}delete(e){this.map.delete(e.toString())}entries(){return kp(this.map.entries(),(e=>[As(e[0]),e[1]]))}forEach(e){this.map.forEach(((t,r)=>{e(t,As(r),this)}))}get(e){return this.map.get(e.toString())}has(e){return this.map.has(e.toString())}set(e,t){this.map.set(e.toString(),t)}keys(){return kp(this.map.keys(),(e=>As(e)))}values(){return this.map.values()}get size(){return this.map.size}}class Pp{constructor(e){if(this.set=new Set,null!=e)for(const t of e)this.set.add(t.toString())}get size(){return this.set.size}[Symbol.iterator](){return this.values()}add(e){this.set.add(e.toString())}clear(){this.set.clear()}delete(e){this.set.delete(e.toString())}entries(){return kp(this.set.entries(),(e=>{const t=As(e[0]);return[t,t]}))}forEach(e){this.set.forEach((t=>{const r=As(t);e(r,r,this)}))}has(e){return this.set.has(e.toString())}values(){return kp(this.set.values(),(e=>As(e)))}}Symbol.iterator;const Dp=Ba("libp2p:connection-manager"),Np={maxConnections:1/0,minConnections:0,maxData:1/0,maxSentData:1/0,maxReceivedData:1/0,maxEventLoopDelay:1/0,pollInterval:2e3,autoDialInterval:1e4,movingAverageInterval:6e4,inboundConnectionThreshold:5,maxIncomingPendingConnections:10},xp="libp2p",Lp="connection-manager";class Op extends fl{constructor(e,t){var r,n,i,s;if(super(),this.opts=bp.call({ignoreUndefined:!0},Np,t),this.opts.maxConnections<this.opts.minConnections)throw ue(new Error("Connection Manager maxConnections must be greater than minConnections"),tp.ERR_INVALID_PARAMETERS);Dp("options: %o",this.opts),this.components=e,this.connections=new Map,this.started=!1,this._checkMetrics=this._checkMetrics.bind(this),this.latencyMonitor=new Sp({latencyCheckIntervalMs:t.pollInterval,dataEmitIntervalMs:t.pollInterval});try{null===dp.setMaxListeners||void 0===dp.setMaxListeners||(0,dp.setMaxListeners)(1/0,this)}catch{}this.onConnect=this.onConnect.bind(this),this.onDisconnect=this.onDisconnect.bind(this),this.startupReconnectTimeout=null!==(r=t.startupReconnectTimeout)&&void 0!==r?r:6e4,this.dialTimeout=null!==(n=t.dialTimeout)&&void 0!==n?n:3e4,this.allow=(null!==(i=t.allow)&&void 0!==i?i:[]).map((e=>Uc(e))),this.deny=(null!==(s=t.deny)&&void 0!==s?s:[]).map((e=>Uc(e))),this.inboundConnectionRateLimiter=new Ul.RateLimiterMemory({points:this.opts.inboundConnectionThreshold,duration:1}),this.incomingPendingConnections=0}isStarted(){return this.started}async start(){var e,t,r,n;null!=this.components.metrics&&(this.timer=null!==(n=this.timer)&&void 0!==n?n:Ip(this._checkMetrics,this.opts.pollInterval));null===(e=this.components.metrics)||void 0===e||e.updateComponentMetric({system:xp,component:Lp,metric:"connections",label:"direction",value:()=>{const e={inbound:0,outbound:0};for(const t of this.connections.values())for(const r of t)"inbound"===r.stat.direction?e.inbound++:e.outbound++;return e}}),null===(t=this.components.metrics)||void 0===t||t.updateComponentMetric({system:xp,component:Lp,metric:"protocol-streams-total",label:"protocol",value:()=>{const e={};for(const n of this.connections.values())for(const i of n)for(const n of i.streams){var t,r;const i="".concat(n.stat.direction," ").concat(null!==(t=n.stat.protocol)&&void 0!==t?t:"unnegotiated");e[i]=(null!==(r=e[i])&&void 0!==r?r:0)+1}return e}}),null===(r=this.components.metrics)||void 0===r||r.updateComponentMetric({system:xp,component:Lp,metric:"protocol-streams-per-connection-90th-percentile",label:"protocol",value:()=>{const e={};for(const s of this.connections.values())for(const i of s){const s={};for(const e of i.streams){var t,r;const n="".concat(e.stat.direction," ").concat(null!==(t=e.stat.protocol)&&void 0!==t?t:"unnegotiated");s[n]=(null!==(r=s[n])&&void 0!==r?r:0)+1}for(const[t,r]of Object.entries(s)){var n;e[t]=null!==(n=e[t])&&void 0!==n?n:[],e[t].push(r)}}const i={};for(let[s,o]of Object.entries(e)){o=o.sort(((e,t)=>e-t));const e=Math.floor(.9*o.length);i[s]=o[e]}return i}}),this.latencyMonitor.start(),this._onLatencyMeasure=this._onLatencyMeasure.bind(this),this.latencyMonitor.addEventListener("data",this._onLatencyMeasure),this.started=!0,Dp("started")}async afterStart(){this.components.upgrader.addEventListener("connection",this.onConnect),this.components.upgrader.addEventListener("connectionEnd",this.onDisconnect),Promise.resolve().then((async()=>{var e;const t=[];for(const r of await this.components.peerStore.all()){(await this.components.peerStore.getTags(r.id)).filter((e=>"keep-alive"===e.name)).length>0&&t.push(r.id)}null===(e=this.connectOnStartupController)||void 0===e||e.clear(),this.connectOnStartupController=new ap.TimeoutController(this.startupReconnectTimeout);try{null===dp.setMaxListeners||void 0===dp.setMaxListeners||(0,dp.setMaxListeners)(1/0,this.connectOnStartupController.signal)}catch{}await Promise.all(t.map((async e=>{var t;await this.openConnection(e,{signal:null===(t=this.connectOnStartupController)||void 0===t?void 0:t.signal}).catch((e=>{Dp.error(e)}))})))})).catch((e=>{Dp.error(e)})).finally((()=>{var e;null===(e=this.connectOnStartupController)||void 0===e||e.clear()}))}async beforeStop(){var e;null===(e=this.connectOnStartupController)||void 0===e||e.abort(),this.components.upgrader.removeEventListener("connection",this.onConnect),this.components.upgrader.removeEventListener("connectionEnd",this.onDisconnect)}async stop(){var e;null===(e=this.timer)||void 0===e||e.clear(),this.latencyMonitor.removeEventListener("data",this._onLatencyMeasure),this.latencyMonitor.stop(),this.started=!1,await this._close(),Dp("stopped")}async _close(){const e=[];for(const t of this.connections.values())for(const r of t)e.push((async()=>{try{await r.close()}catch(e){Dp.error(e)}})());Dp("closing %d connections",e.length),await Promise.all(e),this.connections.clear()}async _checkMetrics(){const e=this.components.metrics;if(null!=e)try{const t=e.getGlobal().getMovingAverages(),r=t.dataReceived[this.opts.movingAverageInterval].movingAverage;await this._checkMaxLimit("maxReceivedData",r);const n=t.dataSent[this.opts.movingAverageInterval].movingAverage;await this._checkMaxLimit("maxSentData",n);const i=r+n;await this._checkMaxLimit("maxData",i),Dp.trace("metrics update",i)}finally{this.timer=Ip(this._checkMetrics,this.opts.pollInterval)}}onConnect(e){this._onConnect(e).catch((e=>{Dp.error(e)}))}async _onConnect(e){const{detail:t}=e;if(!this.started)return void await t.close();const r=t.remotePeer,n=r.toString(),i=this.connections.get(n);null!=i?i.push(t):this.connections.set(n,[t]),null!=r.publicKey&&await this.components.peerStore.keyBook.set(r,r.publicKey);const s=this.getConnections().length,o=s-this.opts.maxConnections;await this._checkMaxLimit("maxConnections",s,o),this.dispatchEvent(new yl("peer:connect",{detail:t}))}onDisconnect(e){const{detail:t}=e;if(!this.started)return;const r=t.remotePeer.toString();let n=this.connections.get(r);if(null!=n&&n.length>1)n=n.filter((e=>e.id!==t.id)),this.connections.set(r,n);else if(null!=n){var i;this.connections.delete(r),this.dispatchEvent(new yl("peer:disconnect",{detail:t})),null===(i=this.components.metrics)||void 0===i||i.onPeerDisconnected(t.remotePeer)}}getConnections(e){var t;if(null!=e)return null!==(t=this.connections.get(e.toString()))&&void 0!==t?t:[];let r=[];for(const n of this.connections.values())r=r.concat(n);return r}async openConnection(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Dp("dial to %p",e);const r=this.getConnections(e);if(r.length>0)return Dp("had an existing connection to %p",e),r[0];let n;if(null==(null===t||void 0===t?void 0:t.signal)){n=new ap.TimeoutController(this.dialTimeout),t.signal=n.signal;try{null===dp.setMaxListeners||void 0===dp.setMaxListeners||(0,dp.setMaxListeners)(1/0,n.signal)}catch{}}try{const r=await this.components.dialer.dial(e,t);let i=this.connections.get(e.toString());null==i&&(i=[],this.connections.set(e.toString(),i));let s=!1;for(const e of i)e.id===r.id&&(s=!0);return s||i.push(r),r}finally{null!=n&&n.clear()}}async closeConnections(e){var t;const r=null!==(t=this.connections.get(e.toString()))&&void 0!==t?t:[];await Promise.all(r.map((async e=>await e.close())))}getAll(e){if(!bs(e))throw ue(new Error("peerId must be an instance of peer-id"),tp.ERR_INVALID_PARAMETERS);const t=e.toString(),r=this.connections.get(t);return null!=r?r.filter((e=>e.stat.status===Cp)):[]}_onLatencyMeasure(e){const{detail:t}=e;this._checkMaxLimit("maxEventLoopDelay",t.avgMs,1).catch((e=>{Dp.error(e)}))}async _checkMaxLimit(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;const n=this.opts[e];Dp.trace("checking limit of %s. current value: %d of %d",e,t,n),t>n&&(Dp("%s: limit exceeded: %p, %d/%d, pruning %d connection(s)",this.components.peerId,e,t,n,r),await this._pruneConnections(r))}async _pruneConnections(e){const t=this.getConnections(),r=new Rp;for(const s of t){const e=s.remotePeer;if(r.has(e))continue;const t=await this.components.peerStore.getTags(e);r.set(e,t.reduce(((e,t)=>e+t.value),0))}const n=t.sort(((e,t)=>{var n,i;const s=null!==(n=r.get(e.remotePeer))&&void 0!==n?n:0,o=null!==(i=r.get(t.remotePeer))&&void 0!==i?i:0;return s>o?1:s<o?-1:0})),i=[];for(const s of n)if(Dp("too many connections open - closing a connection to %p",s.remotePeer),i.push(s),i.length===e)break;await Promise.all(i.map((async e=>{try{await e.close()}catch(t){Dp.error(t)}this.onDisconnect(new yl("connectionEnd",{detail:e}))})))}async acceptIncomingConnection(e){if(this.deny.some((t=>e.remoteAddr.toString().startsWith(t.toString()))))return Dp("connection from %s refused - connection remote address was in deny list",e.remoteAddr),!1;if(this.allow.some((t=>e.remoteAddr.toString().startsWith(t.toString()))))return this.incomingPendingConnections++,!0;if(this.incomingPendingConnections===this.opts.maxIncomingPendingConnections)return Dp("connection from %s refused - incomingPendingConnections exceeded by peer %s",e.remoteAddr),!1;if(e.remoteAddr.isThinWaistAddress()){const t=e.remoteAddr.nodeAddress().address;try{await this.inboundConnectionRateLimiter.consume(t,1)}catch{return Dp("connection from %s refused - inboundConnectionThreshold exceeded by host %s",t,e.remoteAddr),!1}}return this.getConnections().length<this.opts.maxConnections?(this.incomingPendingConnections++,!0):(Dp("connection from %s refused - maxConnections exceeded",e.remoteAddr),!1)}afterUpgradeInbound(){this.incomingPendingConnections--}}async function Bp(e){const t=[];for await(const r of e)t.push(r);return t}async function*Mp(e,t){const r=await Bp(e);yield*r.sort(t)}const Up=Ba("libp2p:connection-manager:auto-dialler"),Fp={enabled:!0,minConnections:0,autoDialInterval:1e4};class Vp{constructor(e,t){this.components=e,this.options=bp.call({ignoreUndefined:!0},Fp,t),this.running=!1,this._autoDial=this._autoDial.bind(this),Up("options: %j",this.options)}isStarted(){return this.running}async start(){this.options.enabled?(this.running=!0,this._autoDial().catch((e=>{Up.error("could start autodial",e)})),Up("started")):Up("not enabled")}async stop(){this.options.enabled?(this.running=!1,null!=this.autoDialTimeout&&this.autoDialTimeout.clear(),Up("stopped")):Up("not enabled")}async _autoDial(){null!=this.autoDialTimeout&&this.autoDialTimeout.clear();const e=this.options.minConnections;if(this.components.connectionManager.getConnections().length>=e)return void(this.autoDialTimeout=Ip(this._autoDial,this.options.autoDialInterval));const t=await this.components.peerStore.all(),r=await Ee(t.sort((()=>Math.random()>.5?1:-1)),(e=>rp(e,(e=>!e.id.equals(this.components.peerId)))),(e=>Mp(e,((e,t)=>t.protocols.length>e.protocols.length||null!=t.id.publicKey&&null==e.id.publicKey?1:-1))),(async e=>await Bp(e)));for(let i=0;this.running&&i<r.length&&this.components.connectionManager.getConnections().length<e;i++){if(!this.running)return;const e=r[i];if(0===this.components.connectionManager.getConnections(e.id).length){Up("connecting to a peerStore stored peer %p",e.id);try{await this.components.connectionManager.openConnection(e.id)}catch(n){Up.error("could not connect to peerStore stored peer",n)}}}this.running&&(this.autoDialTimeout=Ip(this._autoDial,this.options.autoDialInterval))}}const jp=uy("dns4"),Kp=uy("dns6"),qp=uy("dnsaddr"),zp=ly(uy("dns"),qp,jp,Kp),Hp=ly(uy("ip4"),uy("ip6")),Wp=ly(cy(Hp,uy("tcp")),cy(zp,uy("tcp"))),Gp=cy(Hp,uy("udp")),Qp=cy(Gp,uy("utp")),Yp=cy(Gp,uy("quic")),$p=ly(cy(Wp,uy("ws")),cy(zp,uy("ws"))),Xp=ly(cy(Wp,uy("wss")),cy(zp,uy("wss"))),Jp=ly(cy(Wp,uy("http")),cy(Hp,uy("http")),cy(zp,uy("http"))),Zp=ly(cy(Wp,uy("https")),cy(Hp,uy("https")),cy(zp,uy("https"))),ey=ly(cy($p,uy("p2p-webrtc-star"),uy("p2p")),cy(Xp,uy("p2p-webrtc-star"),uy("p2p")),cy($p,uy("p2p-webrtc-star")),cy(Xp,uy("p2p-webrtc-star"))),ty=(ly(cy($p,uy("p2p-websocket-star"),uy("p2p")),cy(Xp,uy("p2p-websocket-star"),uy("p2p")),cy($p,uy("p2p-websocket-star")),cy(Xp,uy("p2p-websocket-star"))),ly(cy(Jp,uy("p2p-webrtc-direct"),uy("p2p")),cy(Zp,uy("p2p-webrtc-direct"),uy("p2p")),cy(Jp,uy("p2p-webrtc-direct")),cy(Zp,uy("p2p-webrtc-direct")))),ry=ly($p,Xp,Jp,Zp,ey,ty,Wp,Qp,Yp,zp),ny=(ly(cy(ry,uy("p2p-stardust"),uy("p2p")),cy(ry,uy("p2p-stardust"))),ly(cy(ry,uy("p2p")),ey,ty,uy("p2p"))),iy=ly(cy(ny,uy("p2p-circuit"),ny),cy(ny,uy("p2p-circuit")),cy(uy("p2p-circuit"),ny),cy(ry,uy("p2p-circuit")),cy(uy("p2p-circuit"),ry),uy("p2p-circuit")),sy=()=>ly(cy(iy,sy),iy),oy=sy();ly(cy(oy,ny,oy),cy(ny,oy),cy(oy,ny),oy,ny);function ay(e){return function(t){let r;try{r=new yd(t)}catch(i){return!1}const n=e(r.protoNames());return null!==n&&(!0===n||!1===n?n:0===n.length)}}function cy(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];function n(e){if(e.length<t.length)return null;let r=e;return t.some((t=>(r="function"===typeof t?t().partialMatch(e):t.partialMatch(e),Array.isArray(r)&&(e=r),null===r))),r}return{toString:function(){return"{ "+t.join(" ")+" }"},input:t,matches:ay(n),partialMatch:n}}function ly(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];function n(e){let r=null;return t.some((t=>{const n="function"===typeof t?t().partialMatch(e):t.partialMatch(e);return null!=n&&(r=n,!0)})),r}const i={toString:function(){return"{ "+t.join(" ")+" }"},input:t,matches:ay(n),partialMatch:n};return i}function uy(e){const t=e;return{toString:function(){return t},matches:function(e){let r;try{r=new yd(e)}catch(i){return!1}const n=r.protoNames();return 1===n.length&&n[0]===t},partialMatch:function(e){return 0===e.length?null:e[0]===t?e.slice(1):null}}}var hy;!function(e){let t,r,n,i,s,o;!function(e){e.SUCCESS="SUCCESS",e.HOP_SRC_ADDR_TOO_LONG="HOP_SRC_ADDR_TOO_LONG",e.HOP_DST_ADDR_TOO_LONG="HOP_DST_ADDR_TOO_LONG",e.HOP_SRC_MULTIADDR_INVALID="HOP_SRC_MULTIADDR_INVALID",e.HOP_DST_MULTIADDR_INVALID="HOP_DST_MULTIADDR_INVALID",e.HOP_NO_CONN_TO_DST="HOP_NO_CONN_TO_DST",e.HOP_CANT_DIAL_DST="HOP_CANT_DIAL_DST",e.HOP_CANT_OPEN_DST_STREAM="HOP_CANT_OPEN_DST_STREAM",e.HOP_CANT_SPEAK_RELAY="HOP_CANT_SPEAK_RELAY",e.HOP_CANT_RELAY_TO_SELF="HOP_CANT_RELAY_TO_SELF",e.STOP_SRC_ADDR_TOO_LONG="STOP_SRC_ADDR_TOO_LONG",e.STOP_DST_ADDR_TOO_LONG="STOP_DST_ADDR_TOO_LONG",e.STOP_SRC_MULTIADDR_INVALID="STOP_SRC_MULTIADDR_INVALID",e.STOP_DST_MULTIADDR_INVALID="STOP_DST_MULTIADDR_INVALID",e.STOP_RELAY_REFUSED="STOP_RELAY_REFUSED",e.MALFORMED_MESSAGE="MALFORMED_MESSAGE"}(t=e.Status||(e.Status={})),function(e){e[e.SUCCESS=100]="SUCCESS",e[e.HOP_SRC_ADDR_TOO_LONG=220]="HOP_SRC_ADDR_TOO_LONG",e[e.HOP_DST_ADDR_TOO_LONG=221]="HOP_DST_ADDR_TOO_LONG",e[e.HOP_SRC_MULTIADDR_INVALID=250]="HOP_SRC_MULTIADDR_INVALID",e[e.HOP_DST_MULTIADDR_INVALID=251]="HOP_DST_MULTIADDR_INVALID",e[e.HOP_NO_CONN_TO_DST=260]="HOP_NO_CONN_TO_DST",e[e.HOP_CANT_DIAL_DST=261]="HOP_CANT_DIAL_DST",e[e.HOP_CANT_OPEN_DST_STREAM=262]="HOP_CANT_OPEN_DST_STREAM",e[e.HOP_CANT_SPEAK_RELAY=270]="HOP_CANT_SPEAK_RELAY",e[e.HOP_CANT_RELAY_TO_SELF=280]="HOP_CANT_RELAY_TO_SELF",e[e.STOP_SRC_ADDR_TOO_LONG=320]="STOP_SRC_ADDR_TOO_LONG",e[e.STOP_DST_ADDR_TOO_LONG=321]="STOP_DST_ADDR_TOO_LONG",e[e.STOP_SRC_MULTIADDR_INVALID=350]="STOP_SRC_MULTIADDR_INVALID",e[e.STOP_DST_MULTIADDR_INVALID=351]="STOP_DST_MULTIADDR_INVALID",e[e.STOP_RELAY_REFUSED=390]="STOP_RELAY_REFUSED",e[e.MALFORMED_MESSAGE=400]="MALFORMED_MESSAGE"}(r||(r={})),function(e){e.codec=()=>Ca(r)}(t=e.Status||(e.Status={})),function(e){e.HOP="HOP",e.STOP="STOP",e.STATUS="STATUS",e.CAN_HOP="CAN_HOP"}(n=e.Type||(e.Type={})),function(e){e[e.HOP=1]="HOP",e[e.STOP=2]="STOP",e[e.STATUS=3]="STATUS",e[e.CAN_HOP=4]="CAN_HOP"}(i||(i={})),function(e){e.codec=()=>Ca(i)}(n=e.Type||(e.Type={})),function(e){let t;e.codec=()=>(null==t&&(t=Aa((function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!1!==r.lengthDelimited&&t.fork(),(!0===r.writeDefaults||null!=e.id&&e.id.byteLength>0)&&(t.uint32(10),t.bytes(e.id)),null!=e.addrs)for(const n of e.addrs)t.uint32(18),t.bytes(n);!1!==r.lengthDelimited&&t.ldelim()}),((e,t)=>{const r={id:new Uint8Array(0),addrs:[]},n=null==t?e.len:e.pos+t;for(;e.pos<n;){const t=e.uint32();switch(t>>>3){case 1:r.id=e.bytes();break;case 2:r.addrs.push(e.bytes());break;default:e.skipType(7&t)}}return r}))),t),e.encode=t=>wa(t,e.codec()),e.decode=t=>ba(t,e.codec())}(s=e.Peer||(e.Peer={})),e.codec=()=>(null==o&&(o=Aa((function(t,r){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};!1!==n.lengthDelimited&&r.fork(),null!=t.type&&(r.uint32(8),e.Type.codec().encode(t.type,r)),null!=t.srcPeer&&(r.uint32(18),e.Peer.codec().encode(t.srcPeer,r,{writeDefaults:!1})),null!=t.dstPeer&&(r.uint32(26),e.Peer.codec().encode(t.dstPeer,r,{writeDefaults:!1})),null!=t.code&&(r.uint32(32),e.Status.codec().encode(t.code,r)),!1!==n.lengthDelimited&&r.ldelim()}),((t,r)=>{const n={},i=null==r?t.len:t.pos+r;for(;t.pos<i;){const r=t.uint32();switch(r>>>3){case 1:n.type=e.Type.codec().decode(t);break;case 2:n.srcPeer=e.Peer.codec().decode(t,t.uint32());break;case 3:n.dstPeer=e.Peer.codec().decode(t,t.uint32());break;case 4:n.code=e.Status.codec().decode(t);break;default:t.skipType(7&r)}}return n}))),o),e.encode=t=>wa(t,e.codec()),e.decode=t=>ba(t,e.codec())}(hy||(hy={}));const dy=Ba("libp2p:stream:converter");function fy(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{stream:r,remoteAddr:n}=e,{sink:i,source:s}=r,o=async function*(){for await(const e of s)yield*e}(),a={async sink(e){null!=t.signal&&(e=wl(e,t.signal));try{await i(e),await c()}catch(r){"aborted"!==r.type&&dy(r)}},source:null!=t.signal?wl(o,t.signal):o,remoteAddr:n,timeline:{open:Date.now(),close:void 0},async close(){await i(async function*(){yield new Uint8Array(0)}()),await c()}};async function c(){return null==a.timeline.close&&(a.timeline.close=Date.now()),await Promise.resolve()}return a}const py="/libp2p/circuit/relay/0.1.0";function yy(e,t){e.write({type:hy.Type.STATUS,code:t})}function gy(e,t){try{var r;null!=(null===(r=e.dstPeer)||void 0===r?void 0:r.addrs)&&e.dstPeer.addrs.forEach((e=>Uc(e)))}catch(i){throw yy(t,e.type===hy.Type.HOP?hy.Status.HOP_DST_MULTIADDR_INVALID:hy.Status.STOP_DST_MULTIADDR_INVALID),i}try{var n;null!=(null===(n=e.srcPeer)||void 0===n?void 0:n.addrs)&&e.srcPeer.addrs.forEach((e=>Uc(e)))}catch(i){throw yy(t,e.type===hy.Type.HOP?hy.Status.HOP_SRC_MULTIADDR_INVALID:hy.Status.STOP_SRC_MULTIADDR_INVALID),i}}const my=Ba("libp2p:circuit:stream-handler");class vy{constructor(e){const{stream:t,maxLength:r=4096}=e;this.stream=t,this.shake=Q(this.stream),this.decoder=fe.fromReader(this.shake.reader,{maxDataLength:r})}async read(){const e=await this.decoder.next();if(null!=e.value){const t=hy.decode(e.value);return my("read message type",t.type),t}my("read received no value, closing stream"),this.close()}write(e){my("write message type %s",e.type),this.shake.write(le.single(hy.encode(e)))}rest(){return this.shake.rest(),this.shake.stream}end(e){this.write(e),this.close()}close(){my("closing the stream"),this.rest().sink([]).catch((e=>{my.error(e)}))}}const by=Ba("libp2p:circuit:stop");const wy=Ba("libp2p:circuit:hop");async function Ey(e){const{connection:t,request:r,streamHandler:n,circuit:i,connectionManager:s}=e;if(!i.hopEnabled())return wy("HOP request received but we are not acting as a relay"),n.end({type:hy.Type.STATUS,code:hy.Status.HOP_CANT_SPEAK_RELAY});try{gy(r,n)}catch(h){return void wy.error("invalid hop request via peer %p %o",t.remotePeer,h)}if(null==r.dstPeer)return void wy("HOP request received but we do not receive a dstPeer");const o=Ts(r.dstPeer.id),a=s.getConnections(o);if(0===a.length&&!i.hopActive())return wy("HOP request received but we are not connected to the destination peer"),n.end({type:hy.Type.STATUS,code:hy.Status.HOP_NO_CONN_TO_DST});if(0===a.length)return wy("did not have connection to remote peer"),n.end({type:hy.Type.STATUS,code:hy.Status.HOP_NO_CONN_TO_DST});const c={type:hy.Type.STOP,dstPeer:r.dstPeer,srcPeer:r.srcPeer};let l;try{wy("performing STOP request");const e=await async function(e){const{connection:t,request:r,signal:n}=e,i=await t.newStream(py,{signal:n});by("starting stop request to %p",t.remotePeer);const s=new vy({stream:i});s.write(r);const o=await s.read();if(null!=o){if(o.code===hy.Status.SUCCESS)return by("stop request to %p was successful",t.remotePeer),s.rest();by("stop request failed with code %d",o.code),s.close()}else s.close()}({connection:a[0],request:c});if(null==e)throw new Error("Could not stop");l=e}catch(h){return void wy.error(h)}wy("hop request from %p is valid",t.remotePeer),n.write({type:hy.Type.STATUS,code:hy.Status.SUCCESS});const u=n.rest();return wy("creating related connections"),await Ee(u,l,u)}const _y=Ba("libp2p:circuit");class Sy{constructor(e,t){this._init=t,this.components=e,this._started=!1}isStarted(){return this._started}async start(){this._started||(this._started=!0,await this.components.registrar.handle(py,(e=>{this._onProtocol(e).catch((e=>{_y.error(e)}))})).catch((e=>{_y.error(e)})))}async stop(){await this.components.registrar.unhandle(py)}hopEnabled(){return!0}hopActive(){return!0}get[vu](){return!0}get[Symbol.toStringTag](){return"libp2p/circuit-relay-v1"}async _onProtocol(e){const{connection:t,stream:r}=e,n=new ap.TimeoutController(this._init.hop.timeout);try{null===dp.setMaxListeners||void 0===dp.setMaxListeners||(0,dp.setMaxListeners)(1/0,n.signal)}catch{}try{const e=_l(r,n.signal),o=new vy({stream:{...r,...e}}),a=await o.read();if(null==a)return _y("request was invalid, could not read from stream"),o.write({type:hy.Type.STATUS,code:hy.Status.MALFORMED_MESSAGE}),void o.close();let c;switch(a.type){case hy.Type.CAN_HOP:_y("received CAN_HOP request from %p",t.remotePeer),await function(e){const{connection:t,streamHandler:r,circuit:n}=e,i=n.hopEnabled();wy("can hop (%s) request from %p",i,t.remotePeer),r.end({type:hy.Type.STATUS,code:i?hy.Status.SUCCESS:hy.Status.HOP_CANT_SPEAK_RELAY})}({circuit:this,connection:t,streamHandler:o});break;case hy.Type.HOP:_y("received HOP request from %p",t.remotePeer),await Ey({connection:t,request:a,streamHandler:o,circuit:this,connectionManager:this.components.connectionManager});break;case hy.Type.STOP:_y("received STOP request from %p",t.remotePeer),c=await function(e){const{connection:t,request:r,streamHandler:n}=e;try{gy(r,n)}catch(i){return void by.error("invalid stop request via peer %p %o",t.remotePeer,i)}return by("stop request is valid"),n.write({type:hy.Type.STATUS,code:hy.Status.SUCCESS}),n.rest()}({connection:t,request:a,streamHandler:o});break;default:return _y("Request of type %s not supported",a.type),o.write({type:hy.Type.STATUS,code:hy.Status.MALFORMED_MESSAGE}),void o.close()}if(null!=c){var i,s;const e=t.remoteAddr.encapsulate("/p2p-circuit").encapsulate(Uc(null===(i=a.dstPeer)||void 0===i?void 0:i.addrs[0])),r=fy({stream:c,remoteAddr:e,localAddr:Uc(null===(s=a.srcPeer)||void 0===s?void 0:s.addrs[0])}),n=a.type===hy.Type.HOP?"relay":"inbound";_y("new %s connection %s",n,r.remoteAddr);const o=await this.components.upgrader.upgradeInbound(r);_y("%s connection %s upgraded",n,r.remoteAddr),null!=this.handler&&this.handler(o)}}finally{n.clear()}}async dial(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const r=e.toString().split("/p2p-circuit"),n=Uc(r[0]),i=Uc(r[r.length-1]),s=n.getPeerId(),o=i.getPeerId();if(null==s||null==o){const e="Circuit relay dial failed as addresses did not have peer id";throw _y.error(e),ue(new Error(e),tp.ERR_RELAYED_DIAL)}const a=As(s),c=As(o);let l=!1;let u=this.components.connectionManager.getConnections(a)[0];null==u&&(await this.components.peerStore.addressBook.add(a,[n]),u=await this.components.connectionManager.openConnection(a,t),l=!0);try{const r=await async function(e){var t;const{connection:r,request:n,signal:i}=e,s=await r.newStream(py,{signal:i}),o=new vy({stream:s});o.write(n);const a=await o.read();if(null==a)throw ue(new Error("HOP request had no response"),tp.ERR_HOP_REQUEST_FAILED);if(a.code===hy.Status.SUCCESS)return wy("hop request was successful"),o.rest();throw wy("hop request failed with code %d, closing stream",a.code),o.close(),ue(new Error('HOP request failed with code "'.concat(null!==(t=a.code)&&void 0!==t?t:"unknown",'"')),tp.ERR_HOP_REQUEST_FAILED)}({...t,connection:u,request:{type:hy.Type.HOP,srcPeer:{id:this.components.peerId.toBytes(),addrs:this.components.addressManager.getAddresses().map((e=>e.bytes))},dstPeer:{id:c.toBytes(),addrs:[Uc(i).bytes]}}}),s=fy({stream:r,remoteAddr:e,localAddr:n.encapsulate("/p2p-circuit/p2p/".concat(this.components.peerId.toString()))});return _y("new outbound connection %s",s.remoteAddr),await this.components.upgrader.upgradeOutbound(s)}catch(h){throw _y.error("Circuit relay dial failed",h),l&&await u.close(),h}}createListener(e){return this.handler=e.handler,function(e){const t=new Map,r=Object.assign(new fl,{close:async()=>await Promise.resolve(),listen:async function(n){const i=Uc(n.toString().split("/p2p-circuit").find((e=>""!==e))),s=i.getPeerId();if(null==s)throw new Error("Could not determine relay peer from multiaddr");const o=As(s);await e.peerStore.addressBook.add(o,[i]);const a=await e.connectionManager.openConnection(o),c=a.remoteAddr.encapsulate("/p2p-circuit");t.set(a.remotePeer.toString(),c),r.dispatchEvent(new yl("listening"))},getAddrs:function(){const e=[];for(const r of t.values())e.push(r);return e}});return e.connectionManager.addEventListener("peer:disconnect",(e=>{const{detail:n}=e;t.delete(n.remotePeer.toString())&&r.dispatchEvent(new yl("close"))})),r}({connectionManager:this.components.connectionManager,peerStore:this.components.peerStore})}filter(e){return(e=Array.isArray(e)?e:[e]).filter((e=>oy.matches(e)))}}async function Iy(e){const t=(new TextEncoder).encode(e),r=await Bo.digest(t);return Jo.createV0(r)}const Cy="hop_relay",Ay="true",Ty="/libp2p/relay";var ky=__webpack_require__(3780);function Ry(e){const{address:t}=e.nodeAddress();return Boolean(ky(t))}function Py(e,t){const r=Ry(e.multiaddr),n=Ry(t.multiaddr);return r&&!n?1:!r&&n||e.isCertified&&!t.isCertified?-1:!e.isCertified&&t.isCertified?1:0}const Dy=Ba("libp2p:auto-relay"),Ny=()=>{};class xy{constructor(e,t){var r,n,i;this.components=e,this.addressSorter=null!==(r=t.addressSorter)&&void 0!==r?r:Py,this.maxListeners=null!==(n=t.maxListeners)&&void 0!==n?n:1,this.listenRelays=new Set,this.onError=null!==(i=t.onError)&&void 0!==i?i:Ny,this._onProtocolChange=this._onProtocolChange.bind(this),this._onPeerDisconnected=this._onPeerDisconnected.bind(this),this.components.peerStore.addEventListener("change:protocols",(e=>{this._onProtocolChange(e).catch((e=>{Dy.error(e)}))})),this.components.connectionManager.addEventListener("peer:disconnect",this._onPeerDisconnected)}async _onProtocolChange(e){const{peerId:t,protocols:r}=e.detail,n=t.toString();if(null!=r.find((e=>e===py))){if(!this.listenRelays.has(n))try{const e=this.components.connectionManager.getConnections(t);if(0===e.length)return;const r=e[0];if(r.remoteAddr.protoCodes().includes(290))return void Dy("relayed connection to ".concat(n," will not be used to hop on"));const i=await async function(e){const{connection:t,signal:r}=e,n=await t.newStream(py,{signal:r}),i=new vy({stream:n});i.write({type:hy.Type.CAN_HOP});const s=await i.read();return await i.close(),null!=s&&s.code===hy.Status.SUCCESS}({connection:r});i&&(await this.components.peerStore.metadataBook.setValue(t,Cy,ha(Ay)),await this._addListenRelay(r,n))}catch(i){this.onError(i)}}else this.listenRelays.has(n)&&await this._removeListenRelay(n)}_onPeerDisconnected(e){const t=e.detail.remotePeer.toString();this.listenRelays.has(t)&&this._removeListenRelay(t).catch((e=>{Dy.error(e)}))}async _addListenRelay(e,t){try{if(this.listenRelays.size>=this.maxListeners)return;const r=await Ee(await this.components.peerStore.addressBook.get(e.remotePeer),(e=>Mp(e,this.addressSorter)),(async e=>await Bp(e))),n=await Promise.all(r.map((async t=>{try{let r=t.multiaddr;return null==r.getPeerId()&&(r=r.encapsulate("/p2p/".concat(e.remotePeer.toString()))),r=r.encapsulate("/p2p-circuit"),await this.components.transportManager.listen([r]),!0}catch(r){Dy.error("error listening on circuit address",r),this.onError(r)}return!1})));n.includes(!0)&&this.listenRelays.add(t)}catch(r){this.onError(r),this.listenRelays.delete(t)}}async _removeListenRelay(e){this.listenRelays.delete(e)&&await this._listenOnAvailableHopRelays([e])}async _listenOnAvailableHopRelays(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];if(this.listenRelays.size>=this.maxListeners)return;const t=[],r=await this.components.peerStore.all();for(const{id:i,metadata:s}of r){const r=i.toString();if(this.listenRelays.has(r))continue;if(e.includes(r))continue;const n=s.get(Cy);if(null==n||La(n)!==Ay)continue;const o=this.components.connectionManager.getConnections(i);if(0!==o.length){if(await this._addListenRelay(o[0],r),this.listenRelays.size>=this.maxListeners)return}else t.push(i)}for(const i of t)if(await this._tryToListenOnRelay(i),this.listenRelays.size>=this.maxListeners)return;try{const e=await Iy(Ty);for await(const t of this.components.contentRouting.findProviders(e)){if(0===t.multiaddrs.length)continue;const e=t.id;if(!e.equals(this.components.peerId)&&(await this.components.peerStore.addressBook.add(e,t.multiaddrs),await this._tryToListenOnRelay(e),this.listenRelays.size>=this.maxListeners))return}}catch(n){this.onError(n)}}async _tryToListenOnRelay(e){try{const t=await this.components.connectionManager.openConnection(e);await this._addListenRelay(t,e.toString())}catch(t){Dy.error("Could not use %p as relay",e,t),this.onError(t,"could not connect and listen on known hop relay ".concat(e.toString()))}}}const Ly=Ba("libp2p:relay");class Oy{constructor(e,t){var r;this.components=e,this.autoRelay=!1!==(null===(r=t.autoRelay)||void 0===r?void 0:r.enabled)?new xy(e,{addressSorter:t.addressSorter,...t.autoRelay}):void 0,this.started=!1,this.init=t,this._advertiseService=this._advertiseService.bind(this)}isStarted(){return this.started}async start(){!1!==this.init.hop.enabled&&!1!==this.init.advertise.enabled&&(this.timeout=(0,hp.setDelayedInterval)(this._advertiseService,this.init.advertise.ttl,this.init.advertise.bootDelay)),this.started=!0}async stop(){null!=this.timeout&&(0,hp.clearDelayedInterval)(this.timeout),this.started=!1}async _advertiseService(){try{const e=await Iy(Ty);await this.components.contentRouting.provide(e)}catch(e){e.code===tp.ERR_NO_ROUTERS_AVAILABLE?(Ly.error("a content router, such as a DHT, must be provided in order to advertise the relay service",e),await this.stop()):Ly.error(e)}}}var By=__webpack_require__(8515);__webpack_require__(3308),__webpack_require__(4577);const My=$e.pki;const Uy=Ba("libp2p:keychain:cms"),Fy=new WeakMap;class Vy{constructor(e,t){if(null==e)throw ue(new Error("keychain is required"),tp.ERR_KEYCHAIN_REQUIRED);this.keychain=e,Fy.set(this,{dek:t})}async encrypt(e,t){if(!(t instanceof Uint8Array))throw ue(new Error("Plain data must be a Uint8Array"),tp.ERR_INVALID_PARAMETERS);const r=await this.keychain.findKeyByName(e),n=await this.keychain.getPrivateKey(e),i=Fy.get(this);if(null==i)throw ue(new Error("dek missing"),tp.ERR_INVALID_PARAMETERS);const s=i.dek,o=$e.pki.decryptRsaPrivateKey(n,s),a=await((e,t)=>{const r=My.rsa.setPublicKey(t.n,t.e),n=My.createCertificate();n.publicKey=r,n.serialNumber="01",n.validity.notBefore=new Date,n.validity.notAfter=new Date,n.validity.notAfter.setFullYear(n.validity.notBefore.getFullYear()+10);const i=[{name:"organizationName",value:"ipfs"},{shortName:"OU",value:"keystore"},{name:"commonName",value:e.id}];return n.setSubject(i),n.setIssuer(i),n.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}]),n.sign(t),n})(r,o),c=$e.pkcs7.createEnvelopedData();c.addRecipient(a),c.content=$e.util.createBuffer(t),c.encrypt();return ha($e.asn1.toDer(c.toAsn1()).getBytes(),"ascii")}async decrypt(e){if(!(e instanceof Uint8Array))throw ue(new Error("CMS data is required"),tp.ERR_INVALID_PARAMETERS);let t;try{const r=$e.util.createBuffer(La(e,"ascii")),n=$e.asn1.fromDer(r);t=$e.pkcs7.messageFromAsn1(n)}catch(l){throw Uy.error(l),ue(new Error("Invalid CMS"),tp.ERR_INVALID_CMS)}const r=t.recipients.filter((e=>e.issuer.find((e=>"O"===e.shortName&&"ipfs"===e.value)))).filter((e=>e.issuer.find((e=>"CN"===e.shortName)))).map((e=>({recipient:e,keyId:e.issuer.find((e=>"CN"===e.shortName)).value}))),n=await async function(e,t){const r=e.map(t);return e[(await Promise.all(r)).findIndex((e=>e))]}(r,(async e=>{try{if(null!=await this.keychain.findKeyById(e.keyId))return!0}catch(l){return!1}return!1}));if(null==n){const e=r.map((e=>e.keyId));throw ue(new Error("Decryption needs one of the key(s): ".concat(e.join(", "))),tp.ERR_MISSING_KEYS,{missingKeys:e})}const i=await this.keychain.findKeyById(n.keyId);if(null==i)throw ue(new Error("No key available to decrypto"),tp.ERR_NO_KEY);const s=await this.keychain.getPrivateKey(i.name),o=Fy.get(this);if(null==o)throw ue(new Error("dek missing"),tp.ERR_INVALID_PARAMETERS);const a=o.dek,c=$e.pki.decryptRsaPrivateKey(s,a);return t.decrypt(n.recipient,c),ha(t.content.getBytes(),"ascii")}}const jy=Ba("libp2p:keychain"),Ky="/info/",qy=new WeakMap,zy=14,Hy=16,Wy=1e3,Gy={dek:{keyLength:64,iterationCount:1e4,salt:"you should override this value with a crypto secure random number",hash:"sha2-512"}};function Qy(e){return null!=e&&("string"===typeof e&&(e===By(e.trim())&&e.length>0))}async function Yy(){const e=800*Math.random()+200;await new Promise((t=>setTimeout(t,e)))}function $y(e){return new Jf("/pkcs8/"+e)}function Xy(e){return new Jf(Ky+e)}class Jy{constructor(e,t){var r,n,i,s,o,a,c,l,u,h;if(this.components=e,this.init=bp(Gy,t),null!=this.init.pass&&(null===(r=this.init.pass)||void 0===r?void 0:r.length)<20)throw new Error("pass must be least 20 characters");if(null!=(null===(n=this.init.dek)||void 0===n?void 0:n.keyLength)&&this.init.dek.keyLength<zy)throw new Error("dek.keyLength must be least ".concat(zy," bytes"));if(null!=(null===(i=this.init.dek)||void 0===i||null===(s=i.salt)||void 0===s?void 0:s.length)&&this.init.dek.salt.length<Hy)throw new Error("dek.saltLength must be least ".concat(Hy," bytes"));if(null!=(null===(o=this.init.dek)||void 0===o?void 0:o.iterationCount)&&this.init.dek.iterationCount<Wy)throw new Error("dek.iterationCount must be least ".concat(Wy));const d=null!=this.init.pass&&null!=(null===(a=this.init.dek)||void 0===a?void 0:a.salt)?ff(this.init.pass,null===(c=this.init.dek)||void 0===c?void 0:c.salt,null===(l=this.init.dek)||void 0===l?void 0:l.iterationCount,null===(u=this.init.dek)||void 0===u?void 0:u.keyLength,null===(h=this.init.dek)||void 0===h?void 0:h.hash):"";qy.set(this,{dek:d}),this.started=!1}isStarted(){return this.started}async start(){const e=Xy("self");await this.components.datastore.has(e)||await this.importPeer("self",this.components.peerId),this.started=!0}stop(){this.started=!1}get cms(){const e=qy.get(this);if(null==e)throw ue(new Error("dek missing"),tp.ERR_INVALID_PARAMETERS);const t=e.dek;return new Vy(this,t)}static generateOptions(){const e=Object.assign({},Gy),t=3*Math.ceil(Hy/3);return e.dek.salt=La(Kn(t),"base64"),e}static get options(){return Gy}async createKey(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:2048;if(!Qy(e)||"self"===e)throw await Yy(),ue(new Error("Invalid key name"),tp.ERR_INVALID_KEY_NAME);if("string"!==typeof t)throw await Yy(),ue(new Error("Invalid key type"),tp.ERR_INVALID_KEY_TYPE);const n=$y(e);if(await this.components.datastore.has(n))throw await Yy(),ue(new Error("Key name already exists"),tp.ERR_KEY_ALREADY_EXISTS);if("rsa"===t.toLowerCase())if(!Number.isSafeInteger(r)||r<2048)throw await Yy(),ue(new Error("Invalid RSA key size"),tp.ERR_INVALID_KEY_SIZE);let i;try{const s=await fs(t,r),o=await s.id(),a=qy.get(this);if(null==a)throw ue(new Error("dek missing"),tp.ERR_INVALID_PARAMETERS);const c=a.dek,l=await s.export(c);i={name:e,id:o};const u=this.components.datastore.batch();u.put(n,ha(l)),u.put(Xy(e),ha(JSON.stringify(i))),await u.commit()}catch(s){throw await Yy(),s}return i}async listKeys(){const e={prefix:Ky},t=[];for await(const r of this.components.datastore.query(e))t.push(JSON.parse(La(r.value)));return t}async findKeyById(e){try{return(await this.listKeys()).find((t=>t.id===e))}catch(t){throw await Yy(),t}}async findKeyByName(e){if(!Qy(e))throw await Yy(),ue(new Error("Invalid key name '".concat(e,"'")),tp.ERR_INVALID_KEY_NAME);const t=Xy(e);try{const e=await this.components.datastore.get(t);return JSON.parse(La(e))}catch(r){throw await Yy(),jy.error(r),ue(new Error("Key '".concat(e,"' does not exist.")),tp.ERR_KEY_NOT_FOUND)}}async removeKey(e){if(!Qy(e)||"self"===e)throw await Yy(),ue(new Error("Invalid key name '".concat(e,"'")),tp.ERR_INVALID_KEY_NAME);const t=$y(e),r=await this.findKeyByName(e),n=this.components.datastore.batch();return n.delete(t),n.delete(Xy(e)),await n.commit(),r}async renameKey(e,t){if(!Qy(e)||"self"===e)throw await Yy(),ue(new Error("Invalid old key name '".concat(e,"'")),tp.ERR_OLD_KEY_NAME_INVALID);if(!Qy(t)||"self"===t)throw await Yy(),ue(new Error("Invalid new key name '".concat(t,"'")),tp.ERR_NEW_KEY_NAME_INVALID);const r=$y(e),n=$y(t),i=Xy(e),s=Xy(t);if(await this.components.datastore.has(n))throw await Yy(),ue(new Error("Key '".concat(t,"' already exists")),tp.ERR_KEY_ALREADY_EXISTS);try{const e=await this.components.datastore.get(r),o=await this.components.datastore.get(i),a=JSON.parse(La(o));a.name=t;const c=this.components.datastore.batch();return c.put(n,e),c.put(s,ha(JSON.stringify(a))),c.delete(r),c.delete(i),await c.commit(),a}catch(o){throw await Yy(),o}}async exportKey(e,t){if(!Qy(e))throw await Yy(),ue(new Error("Invalid key name '".concat(e,"'")),tp.ERR_INVALID_KEY_NAME);if(null==t)throw await Yy(),ue(new Error("Password is required"),tp.ERR_PASSWORD_REQUIRED);const r=$y(e);try{const e=La(await this.components.datastore.get(r)),n=qy.get(this);if(null==n)throw ue(new Error("dek missing"),tp.ERR_INVALID_PARAMETERS);const i=n.dek,s=await ms(e,i);return await s.export(t)}catch(n){throw await Yy(),n}}async importKey(e,t,r){if(!Qy(e)||"self"===e)throw await Yy(),ue(new Error("Invalid key name '".concat(e,"'")),tp.ERR_INVALID_KEY_NAME);if(null==t)throw await Yy(),ue(new Error("PEM encoded key is required"),tp.ERR_PEM_REQUIRED);const n=$y(e);if(await this.components.datastore.has(n))throw await Yy(),ue(new Error("Key '".concat(e,"' already exists")),tp.ERR_KEY_ALREADY_EXISTS);let i,s;try{i=await ms(t,r)}catch(c){throw await Yy(),ue(new Error("Cannot read the key, most likely the password is wrong"),tp.ERR_CANNOT_READ_KEY)}try{s=await i.id();const e=qy.get(this);if(null==e)throw ue(new Error("dek missing"),tp.ERR_INVALID_PARAMETERS);const r=e.dek;t=await i.export(r)}catch(c){throw await Yy(),c}const o={name:e,id:s},a=this.components.datastore.batch();return a.put(n,ha(t)),a.put(Xy(e),ha(JSON.stringify(o))),await a.commit(),o}async importPeer(e,t){try{if(!Qy(e))throw ue(new Error("Invalid key name '".concat(e,"'")),tp.ERR_INVALID_KEY_NAME);if(null==t)throw ue(new Error("PeerId is required"),tp.ERR_MISSING_PRIVATE_KEY);if(null==t.privateKey)throw ue(new Error("PeerId.privKey is required"),tp.ERR_MISSING_PRIVATE_KEY);const r=await gs(t.privateKey),n=$y(e);if(await this.components.datastore.has(n))throw await Yy(),ue(new Error("Key '".concat(e,"' already exists")),tp.ERR_KEY_ALREADY_EXISTS);const i=qy.get(this);if(null==i)throw ue(new Error("dek missing"),tp.ERR_INVALID_PARAMETERS);const s=i.dek,o=await r.export(s),a={name:e,id:t.toString()},c=this.components.datastore.batch();return c.put(n,ha(o)),c.put(Xy(e),ha(JSON.stringify(a))),await c.commit(),a}catch(r){throw await Yy(),r}}async getPrivateKey(e){if(!Qy(e))throw await Yy(),ue(new Error("Invalid key name '".concat(e,"'")),tp.ERR_INVALID_KEY_NAME);try{const t=$y(e);return La(await this.components.datastore.get(t))}catch(t){throw await Yy(),jy.error(t),ue(new Error("Key '".concat(e,"' does not exist.")),tp.ERR_KEY_NOT_FOUND)}}async rotateKeychainPass(e,t){var r,n,i,s;if("string"!==typeof e)throw await Yy(),ue(new Error("Invalid old pass type '".concat(typeof e,"'")),tp.ERR_INVALID_OLD_PASS_TYPE);if("string"!==typeof t)throw await Yy(),ue(new Error("Invalid new pass type '".concat(typeof t,"'")),tp.ERR_INVALID_NEW_PASS_TYPE);if(t.length<20)throw await Yy(),ue(new Error("Invalid pass length ".concat(t.length)),tp.ERR_INVALID_PASS_LENGTH);jy("recreating keychain");const o=qy.get(this);if(null==o)throw ue(new Error("dek missing"),tp.ERR_INVALID_PARAMETERS);const a=o.dek;this.init.pass=t;const c=null!=t&&null!=(null===(r=this.init.dek)||void 0===r?void 0:r.salt)?ff(t,this.init.dek.salt,null===(n=this.init.dek)||void 0===n?void 0:n.iterationCount,null===(i=this.init.dek)||void 0===i?void 0:i.keyLength,null===(s=this.init.dek)||void 0===s?void 0:s.hash):"";qy.set(this,{dek:c});const l=await this.listKeys();for(const u of l){const e=La(await this.components.datastore.get($y(u.name))),t=await ms(e,a),r=c.toString(),n=await t.export(r),i=this.components.datastore.batch(),s={name:u.name,id:u.id};i.put($y(u.name),ha(n)),i.put(Xy(u.name),ha(JSON.stringify(s))),await i.commit()}jy("keychain reconstructed")}}async function*Zy(e,t){for await(const r of e)await t(r),yield r}var eg=__webpack_require__(3341);const tg=50;class rg{constructor(e){if("number"!==typeof e)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");this.timespan=e,this.movingAverage=0,this.variance=0,this.deviation=0,this.forecast=0}alpha(e,t){return 1-Math.exp(-(e-t)/this.timespan)}push(e,t){if(null!=this.previousTime){const r=this.alpha(e,this.previousTime),n=t-this.movingAverage,i=r*n;this.movingAverage=r*t+(1-r)*this.movingAverage,this.variance=(1-r)*(this.variance+n*i),this.deviation=Math.sqrt(this.variance),this.forecast=this.movingAverage+r*n}else this.movingAverage=t;this.previousTime=e}}function ng(e){return new rg(e)}class ig extends fl{constructor(e){super(),this.enabled=e.enabled,this.queue=[],this.stats={dataReceived:0n,dataSent:0n},this.frequencyLastTime=Date.now(),this.frequencyAccumulators={},this.movingAverages={dataReceived:[],dataSent:[]},this.computeThrottleMaxQueueSize=e.computeThrottleMaxQueueSize,this.computeThrottleTimeout=e.computeThrottleTimeout,this._update=this._update.bind(this),this.movingAverageIntervals=e.movingAverageIntervals;for(let t=0;t<e.initialCounters.length;t++){const r=e.initialCounters[t];this.stats[r]=0n,this.movingAverages[r]=[];for(let e=0;e<this.movingAverageIntervals.length;e++){const t=this.movingAverageIntervals[e];(this.movingAverages[r][t]=ng(t)).push(this.frequencyLastTime,0)}}}start(){this.enabled&&this.queue.length>0&&this._resetComputeTimeout()}stop(){null!=this.timeout&&(this.timeout.clear(),this.timeout=null)}getSnapshot(){return Object.assign({},this.stats)}getMovingAverages(){return Object.assign({},this.movingAverages)}push(e,t){this.queue.push([e,t,Date.now()]),this._resetComputeTimeout()}_resetComputeTimeout(){this.timeout=Ip(this._update,this._nextTimeout())}_nextTimeout(){const e=this.queue.length/this.computeThrottleMaxQueueSize;return Math.max(this.computeThrottleTimeout*(1-e),0)}_update(){if(this.timeout=null,this.queue.length>0){let e=["",0,0];for(e of this.queue)this._applyOp(e);this.queue=[],e.length>2&&""!==e[0]&&this._updateFrequency(e[2]),this.dispatchEvent(new yl("update",{detail:this.stats}))}}_updateFrequency(e){const t=e-this.frequencyLastTime;this._updateFrequencyFor("dataReceived",t,e),this._updateFrequencyFor("dataSent",t,e),this.frequencyLastTime=e}_updateFrequencyFor(e,t,r){var n;const i=null!==(n=this.frequencyAccumulators[e])&&void 0!==n?n:0;this.frequencyAccumulators[e]=0;const s=i/(null!==t&&void 0!==t?t:1)*1e3;let o=this.movingAverages[e];null==o&&(o=this.movingAverages[e]=[]);const a=this.movingAverageIntervals;for(let c=0;c<a.length;c++){const e=a[c];let t=o[e];null==t&&(t=o[e]=ng(e)),t.push(r,s)}}_applyOp(e){const t=e[0],r=e[1];if("number"!==typeof r)throw new Error("invalid increment number");let n;n=Object.prototype.hasOwnProperty.call(this.stats,t)?this.stats[t]:this.stats[t]=0n,this.stats[t]=n+BigInt(r),null==this.frequencyAccumulators[t]&&(this.frequencyAccumulators[t]=0),this.frequencyAccumulators[t]+=r}}const sg=["dataReceived","dataSent"],og={in:"dataReceived",out:"dataSent"};class ag{constructor(e){var t;this.enabled=e.enabled,this.statsInit={...e,initialCounters:sg},this.globalStats=new ig(this.statsInit),this.peerStats=new Map,this.protocolStats=new Map,this.oldPeers=eg(null!==(t=e.maxOldPeersRetention)&&void 0!==t?t:tg),this.running=!1,this._onMessage=this._onMessage.bind(this),this.systems=new Map}isStarted(){return this.running}async start(){this.enabled&&(this.running=!0)}async stop(){if(this.running){this.running=!1,this.globalStats.stop();for(const e of this.peerStats.values())e.stop();for(const e of this.protocolStats.values())e.stop()}}getGlobal(){return this.globalStats}getPeers(){return Array.from(this.peerStats.keys())}getComponentMetrics(){return this.systems}updateComponentMetric(e){const{system:t="libp2p",component:r,metric:n,value:i,label:s,help:o}=e;this.systems.has(t)||this.systems.set(t,new Map);const a=this.systems.get(t);if(null==a)throw new Error("Unknown metric system");a.has(r)||a.set(r,new Map);const c=a.get(r);if(null==c)throw new Error("Unknown metric component");c.set(n,{label:s,help:o,calculate:"function"!==typeof i?()=>i:i})}forPeer(e){var t;const r=e.toString();return null!==(t=this.peerStats.get(r))&&void 0!==t?t:this.oldPeers.get(r)}getProtocols(){return Array.from(this.protocolStats.keys())}forProtocol(e){return this.protocolStats.get(e)}onPeerDisconnected(e){const t=e.toString(),r=this.peerStats.get(t);null!=r&&(r.stop(),this.peerStats.delete(t),this.oldPeers.set(t,r))}_onMessage(e){if(!this.running)return;const{remotePeer:t,protocol:r,direction:n,dataLength:i}=e,s=og[n];let o=this.forPeer(t);if(null==o){const e=new ig(this.statsInit);this.peerStats.set(t.toString(),e),o=e}if(o.push(s,i),this.globalStats.push(s,i),null!=r){let e=this.forProtocol(r);if(null==e){const t=new ig(this.statsInit);this.protocolStats.set(r,t),e=t}e.push(s,i)}}updatePlaceholder(e,t){var r,n;if(!this.running)return;const i=e.toString(),s=null!==(r=this.peerStats.get(i))&&void 0!==r?r:this.oldPeers.get(i),o=t.toString(),a=null!==(n=this.peerStats.get(o))&&void 0!==n?n:this.oldPeers.get(o);let c=s;var l,u;null!=a&&(u=c,(l=a).stop(),u.stop(),l.queue=[...l.queue,...u.queue],c=l,this.oldPeers.remove(o)),this.peerStats.delete(e.toString()),this.peerStats.set(o,c),c.start()}trackStream(e){const{stream:t,remotePeer:r,protocol:n}=e;if(!this.running)return;const i=t.source;t.source=Zy(i,(e=>this._onMessage({remotePeer:r,protocol:n,direction:"in",dataLength:e.byteLength})));const s=t.sink;t.sink=async e=>await Ee(e,(e=>Zy(e,(e=>{this._onMessage({remotePeer:r,protocol:n,direction:"out",dataLength:e.byteLength})}))),s)}}async function cg(e){try{return{status:"fulfilled",value:await e,isFulfilled:!0,isRejected:!1}}catch(t){return{status:"rejected",reason:t,isFulfilled:!1,isRejected:!0}}}function lg(e,t,r){!function(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}(e,t),t.set(e,r)}function ug(e,t,r){if(!t.has(e))throw new TypeError("attempted to "+r+" private field on non-instance");return t.get(e)}function hg(e,t,r){return function(e,t,r){if(t.set)t.set.call(e,r);else{if(!t.writable)throw new TypeError("attempted to set read only private field");t.value=r}}(e,ug(e,t,"set"),r),r}function dg(e,t){return function(e,t){return t.get?t.get.call(e):t.value}(e,ug(e,t,"get"))}let fg;class pg{constructor(e){Wa(this,"value",void 0),Wa(this,"next",void 0),this.value=e}}var yg=new WeakMap,gg=new WeakMap,mg=new WeakMap;fg=Symbol.iterator;class vg{constructor(){lg(this,yg,{writable:!0,value:void 0}),lg(this,gg,{writable:!0,value:void 0}),lg(this,mg,{writable:!0,value:void 0}),this.clear()}enqueue(e){var t;const r=new pg(e);dg(this,yg)?(dg(this,gg).next=r,hg(this,gg,r)):(hg(this,yg,r),hg(this,gg,r)),hg(this,mg,(t=dg(this,mg),t++,t))}dequeue(){var e;const t=dg(this,yg);if(t)return hg(this,yg,dg(this,yg).next),hg(this,mg,(e=dg(this,mg),e--,e)),t.value}clear(){hg(this,yg,void 0),hg(this,gg,void 0),hg(this,mg,0)}get size(){return dg(this,mg)}*[fg](){let e=dg(this,yg);for(;e;)yield e.value,e=e.next}}function bg(e){if(!Number.isInteger(e)&&e!==Number.POSITIVE_INFINITY||!(e>0))throw new TypeError("Expected `concurrency` to be a number from 1 and up");const t=new vg;let r=0;const n=async(e,n,i)=>{r++;const s=(async()=>e(...i))();n(s);try{await s}catch{}r--,t.size>0&&t.dequeue()()},i=(i,s,o)=>{t.enqueue(n.bind(void 0,i,s,o)),(async()=>{await Promise.resolve(),r<e&&t.size>0&&t.dequeue()()})()},s=function(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];return new Promise((t=>{i(e,t,r)}))};return Object.defineProperties(s,{activeCount:{get:()=>r},pendingCount:{get:()=>t.size},clearQueue:{value:()=>{t.clear()}}}),s}async function wg(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{concurrency:r=Number.POSITIVE_INFINITY}=t,n=bg(r);return Promise.all(e.map((e=>e&&"function"===typeof e.then?cg(e):cg("function"===typeof e?n((()=>e())):Promise.resolve(e)))))}class Eg extends Map{constructor(e){super();const{system:t,component:r,metric:n,metrics:i}=e;this.system=null!==t&&void 0!==t?t:"libp2p",this.component=r,this.metric=n,this.metrics=i,this.updateComponentMetric()}set(e,t){return super.set(e,t),this.updateComponentMetric(),this}delete(e){const t=super.delete(e);return this.updateComponentMetric(),t}clear(){super.clear(),this.updateComponentMetric()}updateComponentMetric(){this.metrics.updateComponentMetric({system:this.system,component:this.component,metric:this.metric,value:this.size})}}function _g(e){const{system:t,component:r,metric:n,metrics:i}=e;let s;return s=null!=i?new Eg({system:t,component:r,metric:n,metrics:i}):new Map,s}const Sg=Ba("libp2p:transports");class Ig extends fl{constructor(e){var t;let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};super(),this.components=e,this.started=!1,this.transports=new Map,this.listeners=_g({component:"transport-manager",metric:"listeners",metrics:this.components.metrics}),this.faultTolerance=null!==(t=r.faultTolerance)&&void 0!==t?t:Cg.FATAL_ALL}add(e){const t=e[Symbol.toStringTag];if(null==t)throw ue(new Error("Transport must have a valid tag"),tp.ERR_INVALID_KEY);if(this.transports.has(t))throw ue(new Error("There is already a transport with this tag"),tp.ERR_DUPLICATE_TRANSPORT);Sg("adding transport %s",t),this.transports.set(t,e),this.listeners.has(t)||this.listeners.set(t,[])}isStarted(){return this.started}async start(){const e=this.components.addressManager.getListenAddrs();await this.listen(e),this.started=!0}async stop(){const e=[];for(const[t,r]of this.listeners)for(Sg("closing listeners for %s",t);r.length>0;){const t=r.pop();null!=t&&e.push(t.close())}await Promise.all(e),Sg("all listeners closed");for(const t of this.listeners.keys())this.listeners.set(t,[]);this.started=!1}async dial(e,t){const r=this.transportForMultiaddr(e);if(null==r)throw ue(new Error("No transport available for address ".concat(String(e))),tp.ERR_TRANSPORT_UNAVAILABLE);try{return await r.dial(e,{...t,upgrader:this.components.upgrader})}catch(n){throw null==n.code&&(n.code=tp.ERR_TRANSPORT_DIAL_FAILED),n}}getAddrs(){let e=[];for(const t of this.listeners.values())for(const r of t)e=[...e,...r.getAddrs()];return e}getTransports(){return Array.of(...this.transports.values())}transportForMultiaddr(e){for(const t of this.transports.values()){if(t.filter([e]).length>0)return t}}async listen(e){if(null==e||0===e.length)return void Sg("no addresses were provided for listening, this node is dial only");const t=[];for(const[r,n]of this.transports.entries()){const i=n.filter(e),s=[];for(const e of i){Sg("creating listener for %s on %s",r,e);const t=n.createListener({upgrader:this.components.upgrader});let i=this.listeners.get(r);null==i&&(i=[],this.listeners.set(r,i)),i.push(t),t.addEventListener("listening",(()=>{this.dispatchEvent(new yl("listener:listening",{detail:t}))})),t.addEventListener("close",(()=>{this.dispatchEvent(new yl("listener:close",{detail:t}))})),s.push(t.listen(e))}if(0===s.length){t.push(r);continue}if(null==(await wg(s)).find((e=>e.isFulfilled))&&this.faultTolerance!==Cg.NO_FATAL)throw ue(new Error("Transport (".concat(r,") could not listen on any available address")),tp.ERR_NO_VALID_ADDRESSES)}if(t.length===this.transports.size){const e="no valid addresses were provided for transports [".concat(t.join(", "),"]");if(this.faultTolerance===Cg.FATAL_ALL)throw ue(new Error(e),tp.ERR_NO_VALID_ADDRESSES);Sg("libp2p in dial mode only: ".concat(e))}}async remove(e){Sg("removing %s",e);for(const r of null!==(t=this.listeners.get(e))&&void 0!==t?t:[]){var t;await r.close()}this.transports.delete(e),this.listeners.delete(e)}async removeAll(){const e=[];for(const t of this.transports.keys())e.push(this.remove(t));await Promise.all(e)}}var Cg;!function(e){e[e.FATAL_ALL=0]="FATAL_ALL",e[e.NO_FATAL=1]="NO_FATAL"}(Cg||(Cg={}));const Ag="/multistream/1.0.0";var Tg=__webpack_require__(4092);const kg=Lr("\n");function Rg(e){const t=new K(e,kg);return le.single(t)}function Pg(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const n=Rg(t);!0===r.writeBytes?e.push(n.subarray()):e.push(n)}function Dg(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const n=new K;for(const i of t)n.append(Rg(i));!0===r.writeBytes?e.push(n.subarray()):e.push(n)}async function Ng(e,t){const r=await async function(e,t){let r=1;const n={[Symbol.asyncIterator]:()=>n,next:async()=>await e.next(r)};let i=n;null!=(null===t||void 0===t?void 0:t.signal)&&(i=wl(n,t.signal));const s=await Ee(i,fe({onLength:e=>{r=e}}),(async e=>await Tg(e)));if(null==s)throw ue(new Error("no buffer returned"),"ERR_INVALID_MULTISTREAM_SELECT_MESSAGE");if(s.get(s.byteLength-1)!==kg[0])throw ue(new Error("missing newline"),"ERR_INVALID_MULTISTREAM_SELECT_MESSAGE");return s.sublist(0,-1)}(e,t);return Mr(r.subarray())}const xg=Ba("libp2p:mss:select");async function Lg(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};t=Array.isArray(t)?[...t]:[t];const{reader:n,writer:i,rest:s,stream:o}=Q(e),a=t.shift();if(null==a)throw new Error("At least one protocol must be specified");xg('select: write ["%s", "%s"]',Ag,a);const c=Lr(Ag),l=Lr(a);Dg(i,[c,l],r);let u=await Ng(n,r);if(xg('select: read "%s"',u),u===Ag&&(u=await Ng(n,r),xg('select: read "%s"',u)),u===a)return s(),{stream:o,protocol:a};for(const h of t){xg('select: write "%s"',h),Pg(i,Lr(h),r);const e=await Ng(n,r);if(xg('select: read "%s" for "%s"',e,h),e===h)return s(),{stream:o,protocol:h}}throw s(),ue(new Error("protocol selection failed"),"ERR_UNSUPPORTED_PROTOCOL")}const Og=Ba("libp2p:mss:handle");async function Bg(e,t,r){t=Array.isArray(t)?t:[t];const{writer:n,reader:i,rest:s,stream:o}=Q(e);for(;;){const e=await Ng(i,r);if(Og('read "%s"',e),e!==Ag){if(t.includes(e))return Pg(n,Lr(e),r),Og('respond with "%s" for "%s"',e,e),s(),{stream:o,protocol:e};"ls"!==e?(Pg(n,Lr("na"),r),Og('respond with "na" for "%s"',e)):(Pg(n,new K(...t.map((e=>Rg(Lr(e))))),r),Og('respond with "%s" for %s',t,e))}else Og('respond with "%s" for "%s"',Ag,e),Pg(n,Lr(Ag),r)}}var Mg=__webpack_require__(3212);const Ug=Symbol.for("@libp2p/connection");const Fg=Ba("libp2p:connection");class Vg{constructor(e){const{remoteAddr:t,remotePeer:r,newStream:n,close:i,getStreams:s,stat:o}=e;this.id="".concat(parseInt(String(1e9*Math.random())).toString(36)).concat(Date.now()),this.remoteAddr=t,this.remotePeer=r,this.stat={...o,status:Cp},this._newStream=n,this._close=i,this._getStreams=s,this.tags=[],this._closing=!1}get[Symbol.toStringTag](){return"Connection"}get[Ug](){return!0}get streams(){return this._getStreams()}async newStream(e,t){if(this.stat.status===Ap)throw ue(new Error("the connection is being closed"),"ERR_CONNECTION_BEING_CLOSED");if(this.stat.status===Tp)throw ue(new Error("the connection is closed"),"ERR_CONNECTION_CLOSED");Array.isArray(e)||(e=[e]);const r=await this._newStream(e,t);return r.stat.direction="outbound",r}addStream(e){e.stat.direction="inbound"}removeStream(e){}async close(){if(this.stat.status!==Tp&&!this._closing){this.stat.status=Ap;try{this.streams.forEach((e=>e.close()))}catch(e){Fg.error(e)}this._closing=!0,await this._close(),this._closing=!1,this.stat.timeline.close=Date.now(),this.stat.status=Tp}}}const jg=Ba("libp2p:registrar");class Kg{constructor(e){this.topologies=new Map,this.handlers=new Map,this.components=e,this._onDisconnect=this._onDisconnect.bind(this),this._onProtocolChange=this._onProtocolChange.bind(this),this.components.connectionManager.addEventListener("peer:disconnect",this._onDisconnect),this.components.peerStore.addEventListener("change:protocols",this._onProtocolChange)}getProtocols(){return Array.from(new Set([...this.topologies.keys(),...this.handlers.keys()])).sort()}getHandler(e){const t=this.handlers.get(e);if(null==t)throw ue(new Error("No handler registered for protocol ".concat(e)),tp.ERR_NO_HANDLER_FOR_PROTOCOL);return t}getTopologies(e){const t=this.topologies.get(e);return null==t?[]:[...t.values()]}async handle(e,t,r){if(this.handlers.has(e))throw ue(new Error("Handler already registered for protocol ".concat(e)),tp.ERR_PROTOCOL_HANDLER_ALREADY_REGISTERED);const n=bp.bind({ignoreUndefined:!0})({maxInboundStreams:32,maxOutboundStreams:64},r);this.handlers.set(e,{handler:t,options:n}),await this.components.peerStore.protoBook.add(this.components.peerId,[e])}async unhandle(e){const t=Array.isArray(e)?e:[e];t.forEach((e=>{this.handlers.delete(e)})),await this.components.peerStore.protoBook.remove(this.components.peerId,t)}async register(e,t){if(null==(r=t)||!Boolean(r[bd]))throw jg.error("topology must be an instance of interfaces/topology"),ue(new Error("topology must be an instance of interfaces/topology"),tp.ERR_INVALID_PARAMETERS);var r;const n="".concat((1e9*Math.random()).toString(36)).concat(Date.now());let i=this.topologies.get(e);return null==i&&(i=new Map,this.topologies.set(e,i)),i.set(n,t),await t.setRegistrar(this),n}unregister(e){for(const[t,r]of this.topologies.entries())r.has(e)&&(r.delete(e),0===r.size&&this.topologies.delete(t))}_onDisconnect(e){const t=e.detail;this.components.peerStore.protoBook.get(t.remotePeer).then((e=>{for(const r of e){const e=this.topologies.get(r);if(null!=e)for(const r of e.values())r.onDisconnect(t.remotePeer)}})).catch((e=>{jg.error(e)}))}_onProtocolChange(e){const{peerId:t,protocols:r,oldProtocols:n}=e.detail,i=n.filter((e=>!r.includes(e))),s=r.filter((e=>!n.includes(e)));for(const o of i){const e=this.topologies.get(o);if(null!=e)for(const r of e.values())r.onDisconnect(t)}for(const o of s){const e=this.topologies.get(o);if(null!=e)for(const r of e.values()){const e=this.components.connectionManager.getConnections(t)[0];null!=e&&r.onConnect(t,e)}}}}const qg=Ba("libp2p:upgrader");function zg(e,t){try{const{options:r}=t.getHandler(e);return r.maxOutboundStreams}catch(r){if(r.code!==tp.ERR_NO_HANDLER_FOR_PROTOCOL)throw r}return 64}function Hg(e,t,r){let n=0;return r.streams.forEach((r=>{r.stat.direction===t&&r.stat.protocol===e&&n++})),n}class Wg extends fl{constructor(e,t){super(),this.components=e,this.connectionEncryption=new Map,t.connectionEncryption.forEach((e=>{this.connectionEncryption.set(e.protocol,e)})),this.muxers=new Map,t.muxers.forEach((e=>{this.muxers.set(e.protocol,e)})),this.inboundUpgradeTimeout=t.inboundUpgradeTimeout}async upgradeInbound(e){if(!await this.components.connectionManager.acceptIncomingConnection(e))throw ue(new Error("connection denied"),tp.ERR_CONNECTION_DENIED);let t,r,n,i,s,o,a;const c=this.components.metrics,l=new ap.TimeoutController(this.inboundUpgradeTimeout);try{null===dp.setMaxListeners||void 0===dp.setMaxListeners||(0,dp.setMaxListeners)(1/0,l.signal)}catch{}try{const h=_l(e,l.signal);if(e.source=h.source,e.sink=h.sink,await this.components.connectionGater.denyInboundConnection(e))throw ue(new Error("The multiaddr connection is blocked by gater.acceptConnection"),tp.ERR_CONNECTION_INTERCEPTED);if(null!=c){({setTarget:o,proxy:a}=Mg());const t="".concat((1e9*Math.random()).toString(36)).concat(Date.now());o({toString:()=>t}),c.trackStream({stream:e,remotePeer:a})}qg("starting the inbound connection upgrade");let d=e;const f=this.components.connectionProtector;null!=f&&(qg("protecting the inbound connection"),d=await f.protect(e));try{if(({conn:t,remotePeer:r,protocol:s}=await this._encryptInbound(d)),await this.components.connectionGater.denyInboundEncryptedConnection(r,{...d,...t}))throw ue(new Error("The multiaddr connection is blocked by gater.acceptEncryptedConnection"),tp.ERR_CONNECTION_INTERCEPTED);if(this.muxers.size>0){const e=await this._multiplexInbound({...d,...t},this.muxers);i=e.muxerFactory,n=e.stream}else n=t}catch(u){throw qg.error("Failed to upgrade inbound connection",u),u}if(await this.components.connectionGater.denyInboundUpgradedConnection(r,{...d,...t}))throw ue(new Error("The multiaddr connection is blocked by gater.acceptEncryptedConnection"),tp.ERR_CONNECTION_INTERCEPTED);return null!=c&&(c.updatePlaceholder(a,r),o(r)),qg("Successfully upgraded inbound connection"),this._createConnection({cryptoProtocol:s,direction:"inbound",maConn:e,upgradedConn:n,muxerFactory:i,remotePeer:r})}finally{this.components.connectionManager.afterUpgradeInbound(),l.clear()}}async upgradeOutbound(e,t){const r=e.remoteAddr.getPeerId();if(null==r)throw ue(new Error("outbound connection must have a peer id"),tp.ERR_INVALID_MULTIADDR);const n=As(r);if(await this.components.connectionGater.denyOutboundConnection(n,e))throw ue(new Error("The multiaddr connection is blocked by connectionGater.denyOutboundConnection"),tp.ERR_CONNECTION_INTERCEPTED);let i,s,o,a,c,l,u;const h=this.components.metrics;if(null!=h){({setTarget:l,proxy:u}=Mg());const t="".concat((1e9*Math.random()).toString(36)).concat(Date.now());l({toB58String:()=>t}),h.trackStream({stream:e,remotePeer:u})}qg("Starting the outbound connection upgrade");let d=e;if(!0!==(null===t||void 0===t?void 0:t.skipProtection)){const t=this.components.connectionProtector;null!=t&&(d=await t.protect(e))}try{if(i=d,!0!==(null===t||void 0===t?void 0:t.skipEncryption)){if(({conn:i,remotePeer:s,protocol:a}=await this._encryptOutbound(d,n)),await this.components.connectionGater.denyOutboundEncryptedConnection(s,{...d,...i}))throw ue(new Error("The multiaddr connection is blocked by gater.acceptEncryptedConnection"),tp.ERR_CONNECTION_INTERCEPTED)}else a="native",s=n;if(o=i,null!=(null===t||void 0===t?void 0:t.muxerFactory))c=t.muxerFactory;else if(this.muxers.size>0){const e=await this._multiplexOutbound({...d,...i},this.muxers);c=e.muxerFactory,o=e.stream}}catch(f){throw qg.error("Failed to upgrade outbound connection",f),await e.close(f),f}if(await this.components.connectionGater.denyOutboundUpgradedConnection(s,{...d,...i}))throw ue(new Error("The multiaddr connection is blocked by gater.acceptEncryptedConnection"),tp.ERR_CONNECTION_INTERCEPTED);return null!=h&&(h.updatePlaceholder(u,s),l(s)),qg("Successfully upgraded outbound connection"),this._createConnection({cryptoProtocol:a,direction:"outbound",maConn:e,upgradedConn:o,muxerFactory:c,remotePeer:s})}_createConnection(e){var t,r,n=this;const{cryptoProtocol:i,direction:s,maConn:o,upgradedConn:a,remotePeer:c,muxerFactory:l}=e;let u,h,d;null!=l&&(u=l.createStreamMuxer({direction:s,onIncomingStream:e=>{null!=d&&Promise.resolve().then((async()=>{const t=this.components.registrar.getProtocols(),{stream:r,protocol:n}=await Bg(e,t);qg("%s: incoming stream opened on %s",s,n);const i=this.components.metrics;if(null!=i&&i.trackStream({stream:r,remotePeer:c,protocol:n}),null==d)return;const o=function(e,t){try{const{options:r}=t.getHandler(e);return r.maxInboundStreams}catch(r){if(r.code!==tp.ERR_NO_HANDLER_FOR_PROTOCOL)throw r}return 32}(n,this.components.registrar);Hg(n,"inbound",d)!==o?(e.source=r.source,e.sink=r.sink,e.stat.protocol=n,this.components.peerStore.protoBook.add(c,[n]).catch((e=>qg.error(e))),d.addStream(e),this._onStream({connection:d,stream:e,protocol:n})):e.abort(ue(new Error('Too many inbound protocol streams for protocol "'.concat(n,'" - limit ').concat(o)),tp.ERR_TOO_MANY_INBOUND_PROTOCOL_STREAMS))})).catch((t=>{qg.error(t),null==e.stat.timeline.close&&e.close()}))},onStreamEnd:e=>{var t;null===(t=d)||void 0===t||t.removeStream(e.id)}}),h=async function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(null==u)throw ue(new Error("Stream is not multiplexed"),tp.ERR_MUXER_UNAVAILABLE);qg("%s: starting new stream on %s",s,e);const r=await u.newStream(),i=n.components.metrics;let o;try{if(null==t.signal){qg("No abort signal was passed while trying to negotiate protocols %s falling back to default timeout",e),o=new ap.TimeoutController(3e4),t.signal=o.signal;try{null===dp.setMaxListeners||void 0===dp.setMaxListeners||(0,dp.setMaxListeners)(1/0,o.signal)}catch{}}const{stream:s,protocol:a}=await Lg(r,e,t);null!=i&&i.trackStream({stream:s,remotePeer:c,protocol:a});const l=zg(a,n.components.registrar);if(Hg(a,"outbound",d)===l){const e=ue(new Error('Too many outbound protocol streams for protocol "'.concat(a,'" - limit ').concat(l)),tp.ERR_TOO_MANY_OUTBOUND_PROTOCOL_STREAMS);throw r.abort(e),e}return n.components.peerStore.protoBook.add(c,[a]).catch((e=>qg.error(e))),r.source=s.source,r.sink=s.sink,r.stat.protocol=a,r}catch(a){if(qg.error("could not create new stream",a),null==r.stat.timeline.close&&r.close(),null!=a.code)throw a;throw ue(a,tp.ERR_UNSUPPORTED_PROTOCOL)}finally{null!=o&&o.clear()}},Ee(a,u,a).catch(qg.error));const f=o.timeline;o.timeline=new Proxy(f,{set:function(){return null!=d&&"close"===(arguments.length<=1?void 0:arguments[1])&&null!=(arguments.length<=2?void 0:arguments[2])&&null==f.close&&(async()=>{try{"OPEN"===d.stat.status&&await d.close()}catch(e){qg.error(e)}finally{n.dispatchEvent(new yl("connectionEnd",{detail:d}))}})().catch((e=>{qg.error(e)})),Reflect.set(...arguments)}}),o.timeline.upgraded=Date.now();const p=()=>{throw ue(new Error("connection is not multiplexed"),tp.ERR_CONNECTION_NOT_MULTIPLEXED)};var y;return y={remoteAddr:o.remoteAddr,remotePeer:c,stat:{status:"OPEN",direction:s,timeline:o.timeline,multiplexer:null===(t=u)||void 0===t?void 0:t.protocol,encryption:i},newStream:null!==(r=h)&&void 0!==r?r:p,getStreams:()=>null!=u?u.streams:p(),close:async()=>{await o.close(),null!=u&&u.close()}},d=new Vg(y),this.dispatchEvent(new yl("connection",{detail:d})),d}_onStream(e){const{connection:t,stream:r,protocol:n}=e,{handler:i}=this.components.registrar.getHandler(n);i({connection:t,stream:r})}async _encryptInbound(e){const t=Array.from(this.connectionEncryption.keys());qg("handling inbound crypto protocol selection",t);try{const{stream:r,protocol:n}=await Bg(e,t,{writeBytes:!0}),i=this.connectionEncryption.get(n);if(null==i)throw new Error("no crypto module found for ".concat(n));return qg("encrypting inbound connection..."),{...await i.secureInbound(this.components.peerId,r),protocol:n}}catch(r){throw ue(r,tp.ERR_ENCRYPTION_FAILED)}}async _encryptOutbound(e,t){const r=Array.from(this.connectionEncryption.keys());qg("selecting outbound crypto protocol",r);try{const{stream:n,protocol:i}=await Lg(e,r,{writeBytes:!0}),s=this.connectionEncryption.get(i);if(null==s)throw new Error("no crypto module found for ".concat(i));return qg("encrypting outbound connection to %p",t),{...await s.secureOutbound(this.components.peerId,n,t),protocol:i}}catch(n){throw ue(n,tp.ERR_ENCRYPTION_FAILED)}}async _multiplexOutbound(e,t){const r=Array.from(t.keys());qg("outbound selecting muxer %s",r);try{const{stream:n,protocol:i}=await Lg(e,r,{writeBytes:!0});qg("%s selected as muxer protocol",i);return{stream:n,muxerFactory:t.get(i)}}catch(n){throw qg.error("error multiplexing outbound stream",n),ue(n,tp.ERR_MUXER_UNAVAILABLE)}}async _multiplexInbound(e,t){const r=Array.from(t.keys());qg("inbound handling muxers %s",r);try{const{stream:n,protocol:i}=await Bg(e,r,{writeBytes:!0});return{stream:n,muxerFactory:t.get(i)}}catch(n){throw qg.error("error multiplexing inbound stream",n),ue(n,tp.ERR_MUXER_UNAVAILABLE)}}}var Gg;!function(e){let t;e.codec=()=>(null==t&&(t=Aa((function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!1!==r.lengthDelimited&&t.fork(),null!=e.protocolVersion&&(t.uint32(42),t.string(e.protocolVersion)),null!=e.agentVersion&&(t.uint32(50),t.string(e.agentVersion)),null!=e.publicKey&&(t.uint32(10),t.bytes(e.publicKey)),null!=e.listenAddrs)for(const n of e.listenAddrs)t.uint32(18),t.bytes(n);if(null!=e.observedAddr&&(t.uint32(34),t.bytes(e.observedAddr)),null!=e.protocols)for(const n of e.protocols)t.uint32(26),t.string(n);null!=e.signedPeerRecord&&(t.uint32(66),t.bytes(e.signedPeerRecord)),!1!==r.lengthDelimited&&t.ldelim()}),((e,t)=>{const r={listenAddrs:[],protocols:[]},n=null==t?e.len:e.pos+t;for(;e.pos<n;){const t=e.uint32();switch(t>>>3){case 5:r.protocolVersion=e.string();break;case 6:r.agentVersion=e.string();break;case 1:r.publicKey=e.bytes();break;case 2:r.listenAddrs.push(e.bytes());break;case 4:r.observedAddr=e.bytes();break;case 3:r.protocols.push(e.string());break;case 8:r.signedPeerRecord=e.bytes();break;default:e.skipType(7&t)}}return r}))),t),e.encode=t=>wa(t,e.codec()),e.decode=t=>ba(t,e.codec())}(Gg||(Gg={}));const Qg="ERR_SIGNATURE_NOT_VALID";var Yg;!function(e){let t;e.codec=()=>(null==t&&(t=Aa((function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};!1!==r.lengthDelimited&&t.fork(),(!0===r.writeDefaults||null!=e.publicKey&&e.publicKey.byteLength>0)&&(t.uint32(10),t.bytes(e.publicKey)),(!0===r.writeDefaults||null!=e.payloadType&&e.payloadType.byteLength>0)&&(t.uint32(18),t.bytes(e.payloadType)),(!0===r.writeDefaults||null!=e.payload&&e.payload.byteLength>0)&&(t.uint32(26),t.bytes(e.payload)),(!0===r.writeDefaults||null!=e.signature&&e.signature.byteLength>0)&&(t.uint32(42),t.bytes(e.signature)),!1!==r.lengthDelimited&&t.ldelim()}),((e,t)=>{const r={publicKey:new Uint8Array(0),payloadType:new Uint8Array(0),payload:new Uint8Array(0),signature:new Uint8Array(0)},n=null==t?e.len:e.pos+t;for(;e.pos<n;){const t=e.uint32();switch(t>>>3){case 1:r.publicKey=e.bytes();break;case 2:r.payloadType=e.bytes();break;case 3:r.payload=e.bytes();break;case 5:r.signature=e.bytes();break;default:e.skipType(7&t)}}return r}))),t),e.encode=t=>wa(t,e.codec()),e.decode=t=>ba(t,e.codec())}(Yg||(Yg={}));class $g{constructor(e){const{peerId:t,payloadType:r,payload:n,signature:i}=e;this.peerId=t,this.payloadType=r,this.payload=n,this.signature=i}marshal(){if(null==this.peerId.publicKey)throw new Error("Missing public key");return null==this.marshaled&&(this.marshaled=Yg.encode({publicKey:this.peerId.publicKey,payloadType:this.payloadType,payload:this.payload.subarray(),signature:this.signature})),this.marshaled}equals(e){return xa(this.marshal(),e.marshal())}async validate(e){const t=Xg(e,this.payloadType,this.payload);if(null==this.peerId.publicKey)throw new Error("Missing public key");const r=ps(this.peerId.publicKey);return await r.verify(t.subarray(),this.signature)}}$g.createFromProtobuf=async e=>{const t=Yg.decode(e),r=await ks(t.publicKey);return new $g({peerId:r,payloadType:t.payloadType,payload:t.payload,signature:t.signature})},$g.seal=async(e,t)=>{if(null==t.privateKey)throw new Error("Missing private key");const r=e.domain,n=e.codec,i=e.marshal(),s=Xg(r,n,i),o=await gs(t.privateKey),a=await o.sign(s.subarray());return new $g({peerId:t,payloadType:n,payload:i,signature:a})},$g.openAndCertify=async(e,t)=>{const r=await $g.createFromProtobuf(e);if(!await r.validate(t))throw ue(new Error("envelope signature is not valid for the given domain"),Qg);return r};const Xg=(e,t,r)=>{const n=ha(e),i=ae.encode(n.byteLength),s=ae.encode(t.length),o=ae.encode(r.length);return new K(i,n,s,t,o,r)};var Jg;!function(e){let t,r;!function(e){let t;e.codec=()=>(null==t&&(t=Aa((function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};!1!==r.lengthDelimited&&t.fork(),(!0===r.writeDefaults||null!=e.multiaddr&&e.multiaddr.byteLength>0)&&(t.uint32(10),t.bytes(e.multiaddr)),!1!==r.lengthDelimited&&t.ldelim()}),((e,t)=>{const r={multiaddr:new Uint8Array(0)},n=null==t?e.len:e.pos+t;for(;e.pos<n;){const t=e.uint32();if(t>>>3===1)r.multiaddr=e.bytes();else e.skipType(7&t)}return r}))),t),e.encode=t=>wa(t,e.codec()),e.decode=t=>ba(t,e.codec())}(t=e.AddressInfo||(e.AddressInfo={})),e.codec=()=>(null==r&&(r=Aa((function(t,r){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!1!==n.lengthDelimited&&r.fork(),(!0===n.writeDefaults||null!=t.peerId&&t.peerId.byteLength>0)&&(r.uint32(10),r.bytes(t.peerId)),!0!==n.writeDefaults&&0n===t.seq||(r.uint32(16),r.uint64(t.seq)),null!=t.addresses)for(const i of t.addresses)r.uint32(26),e.AddressInfo.codec().encode(i,r,{writeDefaults:!0});!1!==n.lengthDelimited&&r.ldelim()}),((t,r)=>{const n={peerId:new Uint8Array(0),seq:0n,addresses:[]},i=null==r?t.len:t.pos+r;for(;t.pos<i;){const r=t.uint32();switch(r>>>3){case 1:n.peerId=t.bytes();break;case 2:n.seq=t.uint64();break;case 3:n.addresses.push(e.AddressInfo.codec().decode(t,t.uint32()));break;default:t.skipType(7&r)}}return n}))),r),e.encode=t=>wa(t,e.codec()),e.decode=t=>ba(t,e.codec())}(Jg||(Jg={}));const Zg=Uint8Array.from([3,1]);class em{constructor(e){this.domain=em.DOMAIN,this.codec=em.CODEC;const{peerId:t,multiaddrs:r,seqNumber:n}=e;this.peerId=t,this.multiaddrs=null!==r&&void 0!==r?r:[],this.seqNumber=null!==n&&void 0!==n?n:BigInt(Date.now())}marshal(){return null==this.marshaled&&(this.marshaled=Jg.encode({peerId:this.peerId.toBytes(),seq:BigInt(this.seqNumber),addresses:this.multiaddrs.map((e=>({multiaddr:e.bytes})))})),this.marshaled}equals(e){return e instanceof em&&(!!this.peerId.equals(e.peerId)&&(this.seqNumber===e.seqNumber&&!!function(e,t){const r=(e,t)=>e.toString().localeCompare(t.toString());return e.length===t.length&&(t.sort(r),e.sort(r).every(((e,r)=>t[r].equals(e))))}(this.multiaddrs,e.multiaddrs)))}}em.createFromProtobuf=e=>{var t;const r=Jg.decode(e),n=Ts(r.peerId),i=(null!==(t=r.addresses)&&void 0!==t?t:[]).map((e=>Uc(e.multiaddr))),s=r.seq;return new em({peerId:n,multiaddrs:i,seqNumber:s})},em.DOMAIN="libp2p-peer-record",em.CODEC=Zg;const tm="0.0.0",rm="js-libp2p/".concat(tm),nm=Ba("libp2p:identify");class im{constructor(e,t){this.components=e,this.started=!1,this.init=t,this.identifyProtocolStr="/".concat(t.protocolPrefix,"/").concat("id","/").concat("1.0.0"),this.identifyPushProtocolStr="/".concat(t.protocolPrefix,"/").concat("id/push","/").concat("1.0.0"),this.host={protocolVersion:"".concat(t.protocolPrefix,"/").concat("0.1.0"),...t.host},this.components.connectionManager.addEventListener("peer:connect",(e=>{const t=e.detail;this.identify(t).catch(nm.error)})),this.components.peerStore.addEventListener("change:multiaddrs",(e=>{const{peerId:t}=e.detail;this.components.peerId.equals(t)&&this.pushToPeerStore().catch((e=>nm.error(e)))})),this.components.peerStore.addEventListener("change:protocols",(e=>{const{peerId:t}=e.detail;this.components.peerId.equals(t)&&this.pushToPeerStore().catch((e=>nm.error(e)))}))}isStarted(){return this.started}async start(){this.started||(await this.components.peerStore.metadataBook.setValue(this.components.peerId,"AgentVersion",ha(this.host.agentVersion)),await this.components.peerStore.metadataBook.setValue(this.components.peerId,"ProtocolVersion",ha(this.host.protocolVersion)),await this.components.registrar.handle(this.identifyProtocolStr,(e=>{this._handleIdentify(e).catch((e=>{nm.error(e)}))}),{maxInboundStreams:this.init.maxInboundStreams,maxOutboundStreams:this.init.maxOutboundStreams}),await this.components.registrar.handle(this.identifyPushProtocolStr,(e=>{this._handlePush(e).catch((e=>{nm.error(e)}))}),{maxInboundStreams:this.init.maxPushIncomingStreams,maxOutboundStreams:this.init.maxPushOutgoingStreams}),this.started=!0)}async stop(){await this.components.registrar.unhandle(this.identifyProtocolStr),await this.components.registrar.unhandle(this.identifyPushProtocolStr),this.started=!1}async push(e){const t=await this.components.peerStore.addressBook.getRawEnvelope(this.components.peerId),r=this.components.addressManager.getAddresses().map((e=>e.bytes)),n=await this.components.peerStore.protoBook.get(this.components.peerId),i=e.map((async e=>{let i;const s=new ap.TimeoutController(this.init.timeout);try{null===dp.setMaxListeners||void 0===dp.setMaxListeners||(0,dp.setMaxListeners)(1/0,s.signal)}catch{}try{i=await e.newStream([this.identifyPushProtocolStr],{signal:s.signal});const o=_l(i,s.signal);await o.sink(Ee([Gg.encode({listenAddrs:r,signedPeerRecord:t,protocols:n})],le()))}catch(o){nm.error("could not push identify update to peer",o)}finally{null!=i&&i.close(),s.clear()}}));await Promise.all(i)}async pushToPeerStore(){if(!this.isStarted())return;const e=[];for(const t of this.components.connectionManager.getConnections()){const r=t.remotePeer;(await this.components.peerStore.get(r)).protocols.includes(this.identifyPushProtocolStr)&&e.push(t)}await this.push(e)}async _identify(e){let t,r,n=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}).signal;if(null==n){t=new ap.TimeoutController(this.init.timeout),n=t.signal;try{null===dp.setMaxListeners||void 0===dp.setMaxListeners||(0,dp.setMaxListeners)(1/0,t.signal)}catch{}}try{var i;r=await e.newStream([this.identifyProtocolStr],{signal:n});const o=_l(r,n),a=await Ee([],o,fe({maxDataLength:null!==(i=this.init.maxIdentifyMessageSize)&&void 0!==i?i:8192}),(async e=>await lp(e)));if(null==a)throw ue(new Error("No data could be retrieved"),tp.ERR_CONNECTION_ENDED);try{return Gg.decode(a)}catch(s){throw ue(s,tp.ERR_INVALID_MESSAGE)}}finally{null!=t&&t.clear(),null!=r&&r.close()}}async identify(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const r=await this._identify(e,t),{publicKey:n,listenAddrs:i,protocols:s,observedAddr:o,signedPeerRecord:a,agentVersion:c,protocolVersion:l}=r;if(null==n)throw ue(new Error("public key was missing from identify message"),tp.ERR_MISSING_PUBLIC_KEY);const u=await ks(n);if(!e.remotePeer.equals(u))throw ue(new Error("identified peer does not match the expected peer"),tp.ERR_INVALID_PEER);if(this.components.peerId.equals(u))throw ue(new Error("identified peer is our own peer id?"),tp.ERR_INVALID_PEER);const h=im.getCleanMultiaddr(o);if(null!=a){nm("received signed peer record from %p",u);try{const e=await $g.openAndCertify(a,em.DOMAIN);if(!e.peerId.equals(u))throw ue(new Error("identified peer does not match the expected peer"),tp.ERR_INVALID_PEER);if(await this.components.peerStore.addressBook.consumePeerRecord(e))return await this.components.peerStore.protoBook.set(u,s),null!=c&&await this.components.peerStore.metadataBook.setValue(u,"AgentVersion",ha(c)),null!=l&&await this.components.peerStore.metadataBook.setValue(u,"ProtocolVersion",ha(l)),void nm("identify completed for peer %p and protocols %o",u,s)}catch(d){nm("received invalid envelope, discard it and fallback to listenAddrs is available",d)}}else nm("no signed peer record received from %p",u);nm("falling back to legacy addresses from %p",u);try{await this.components.peerStore.addressBook.set(u,i.map((e=>Uc(e))))}catch(d){nm.error("received invalid addrs",d)}await this.components.peerStore.protoBook.set(u,s),null!=c&&await this.components.peerStore.metadataBook.setValue(u,"AgentVersion",ha(c)),null!=l&&await this.components.peerStore.metadataBook.setValue(u,"ProtocolVersion",ha(l)),nm("identify completed for peer %p and protocols %o",u,s),nm("received observed address of %s",null===h||void 0===h?void 0:h.toString())}async _handleIdentify(e){const{connection:t,stream:r}=e,n=new ap.TimeoutController(this.init.timeout);try{null===dp.setMaxListeners||void 0===dp.setMaxListeners||(0,dp.setMaxListeners)(1/0,n.signal)}catch{}try{var i;const e=null!==(i=this.components.peerId.publicKey)&&void 0!==i?i:new Uint8Array(0),s=await this.components.peerStore.get(this.components.peerId),o=this.components.addressManager.getAddresses().map((e=>e.decapsulateCode(nc("p2p").code)));let a=s.peerRecordEnvelope;if(o.length>0&&null==a){const e=new em({peerId:this.components.peerId,multiaddrs:o}),t=await $g.seal(e,this.components.peerId);await this.components.peerStore.addressBook.consumePeerRecord(t),a=t.marshal().subarray()}const c=Gg.encode({protocolVersion:this.host.protocolVersion,agentVersion:this.host.agentVersion,publicKey:e,listenAddrs:o.map((e=>e.bytes)),signedPeerRecord:a,observedAddr:t.remoteAddr.bytes,protocols:s.protocols}),l=_l(r,n.signal),u=Ee([c],le());await l.sink(u)}catch(s){nm.error("could not respond to identify request",s)}finally{r.close(),n.clear()}}async _handlePush(e){const{connection:t,stream:r}=e,n=new ap.TimeoutController(this.init.timeout);try{null===dp.setMaxListeners||void 0===dp.setMaxListeners||(0,dp.setMaxListeners)(1/0,n.signal)}catch{}let i;try{var s;const e=_l(r,n.signal),t=await Ee([],e,fe({maxDataLength:null!==(s=this.init.maxIdentifyMessageSize)&&void 0!==s?s:8192}),(async e=>await lp(e)));null!=t&&(i=Gg.decode(t))}catch(a){return nm.error("received invalid message",a)}finally{r.close(),n.clear()}if(null==i)return nm.error("received invalid message");const o=t.remotePeer;if(this.components.peerId.equals(o))nm("received push from ourselves?");else{if(nm("received push from %p",o),null!=i.signedPeerRecord){nm("received signedPeerRecord in push");try{const e=await $g.openAndCertify(i.signedPeerRecord,em.DOMAIN);if(await this.components.peerStore.addressBook.consumePeerRecord(e))return nm("consumed signedPeerRecord sent in push"),void await this.components.peerStore.protoBook.set(o,i.protocols);nm("failed to consume signedPeerRecord sent in push")}catch(a){nm("received invalid envelope, discard it and fallback to listenAddrs is available",a)}}else nm("did not receive signedPeerRecord in push");try{await this.components.peerStore.addressBook.set(o,i.listenAddrs.map((e=>Uc(e))))}catch(a){nm.error("received invalid addrs",a)}try{await this.components.peerStore.protoBook.set(o,i.protocols)}catch(a){nm.error("received invalid protocols",a)}nm("handled push from %p",o)}}static getCleanMultiaddr(e){if(null!=e&&e.length>0)try{return Uc(e)}catch{}}}var sm,om;!function(e){let t;e.codec=()=>(null==t&&(t=Aa((function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};!1!==r.lengthDelimited&&t.fork(),!0!==r.writeDefaults&&""===e.identifier||(t.uint32(10),t.string(e.identifier)),!1!==r.lengthDelimited&&t.ldelim()}),((e,t)=>{const r={identifier:""},n=null==t?e.len:e.pos+t;for(;e.pos<n;){const t=e.uint32();if(t>>>3===1)r.identifier=e.string();else e.skipType(7&t)}return r}))),t),e.encode=t=>wa(t,e.codec()),e.decode=t=>ba(t,e.codec())}(sm||(sm={})),function(e){let t,r,n;!function(e){e.OK="OK",e.NOT_FOUND="NOT_FOUND",e.ERROR="ERROR"}(t=e.StatusCode||(e.StatusCode={})),function(e){e[e.OK=0]="OK",e[e.NOT_FOUND=1]="NOT_FOUND",e[e.ERROR=2]="ERROR"}(r||(r={})),function(e){e.codec=()=>Ca(r)}(t=e.StatusCode||(e.StatusCode={})),e.codec=()=>(null==n&&(n=Aa((function(t,n){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};!1!==i.lengthDelimited&&n.fork(),(!0===i.writeDefaults||null!=t.status&&0!==r[t.status])&&(n.uint32(8),e.StatusCode.codec().encode(t.status,n)),(!0===i.writeDefaults||null!=t.data&&t.data.byteLength>0)&&(n.uint32(18),n.bytes(t.data)),!1!==i.lengthDelimited&&n.ldelim()}),((r,n)=>{const i={status:t.OK,data:new Uint8Array(0)},s=null==n?r.len:r.pos+n;for(;r.pos<s;){const t=r.uint32();switch(t>>>3){case 1:i.status=e.StatusCode.codec().decode(r);break;case 2:i.data=r.bytes();break;default:r.skipType(7&t)}}return i}))),n),e.encode=t=>wa(t,e.codec()),e.decode=t=>ba(t,e.codec())}(om||(om={}));const am=Ba("libp2p:fetch");class cm{constructor(e,t){var r;this.started=!1,this.components=e,this.protocol="/".concat(null!==(r=t.protocolPrefix)&&void 0!==r?r:"libp2p","/").concat("fetch","/").concat("0.0.1"),this.lookupFunctions=new Map,this.handleMessage=this.handleMessage.bind(this),this.init=t}async start(){await this.components.registrar.handle(this.protocol,(e=>{this.handleMessage(e).catch((e=>{am.error(e)})).finally((()=>{e.stream.close()}))}),{maxInboundStreams:this.init.maxInboundStreams,maxOutboundStreams:this.init.maxOutboundStreams}),this.started=!0}async stop(){await this.components.registrar.unhandle(this.protocol),this.started=!1}isStarted(){return this.started}async fetch(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};am("dialing %s to %p",this.protocol,e);const n=await this.components.connectionManager.openConnection(e,r);let i,s,o=r.signal;if(null==o){i=new ap.TimeoutController(this.init.timeout),o=i.signal;try{null===dp.setMaxListeners||void 0===dp.setMaxListeners||(0,dp.setMaxListeners)(1/0,i.signal)}catch{}}try{s=await n.newStream([this.protocol],{signal:o});const e=_l(s,o),r=await Ee([sm.encode({identifier:t})],le(),e,fe(),(async function(e){const t=await lp(e);if(null==t)throw ue(new Error("No data received"),tp.ERR_INVALID_MESSAGE);const r=om.decode(t);switch(r.status){case om.StatusCode.OK:return r.data;case om.StatusCode.NOT_FOUND:return null;case om.StatusCode.ERROR:{const e=(new TextDecoder).decode(r.data);throw ue(new Error("Error in fetch protocol response: "+e),tp.ERR_INVALID_PARAMETERS)}default:throw ue(new Error("Unknown response status"),tp.ERR_INVALID_MESSAGE)}}));return null!==r&&void 0!==r?r:null}finally{null!=i&&i.clear(),null!=s&&s.close()}}async handleMessage(e){const{stream:t}=e,r=this;await Ee(t,fe(),(async function*(e){const t=await lp(e);if(null==t)throw ue(new Error("No data received"),tp.ERR_INVALID_MESSAGE);const n=sm.decode(t);let i;const s=r._getLookupFunction(n.identifier);if(null!=s){const e=await s(n.identifier);i=null!=e?{status:om.StatusCode.OK,data:e}:{status:om.StatusCode.NOT_FOUND,data:new Uint8Array(0)}}else{const e=(new TextEncoder).encode("No lookup function registered for key: "+n.identifier);i={status:om.StatusCode.ERROR,data:e}}yield om.encode(i)}),le(),t)}_getLookupFunction(e){for(const t of this.lookupFunctions.keys())if(e.startsWith(t))return this.lookupFunctions.get(t)}registerLookupFunction(e,t){if(this.lookupFunctions.has(e))throw ue(new Error("Fetch protocol handler for key prefix '"+e+"' already registered"),tp.ERR_KEY_ALREADY_EXISTS);this.lookupFunctions.set(e,t)}unregisterLookupFunction(e,t){if(null!=t){if(this.lookupFunctions.get(e)!==t)return}this.lookupFunctions.delete(e)}}const lm=Ba("libp2p:ping");class um{constructor(e,t){this.components=e,this.started=!1,this.protocol="/".concat(t.protocolPrefix,"/").concat("ping","/").concat("1.0.0"),this.init=t}async start(){await this.components.registrar.handle(this.protocol,this.handleMessage,{maxInboundStreams:this.init.maxInboundStreams,maxOutboundStreams:this.init.maxOutboundStreams}),this.started=!0}async stop(){await this.components.registrar.unhandle(this.protocol),this.started=!1}isStarted(){return this.started}handleMessage(e){const{stream:t}=e;Ee(t,t).catch((e=>{lm.error(e)}))}async ping(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};lm("dialing %s to %p",this.protocol,e);const r=Date.now(),n=Kn(32),i=await this.components.connectionManager.openConnection(e,t);let s,o,a=t.signal;if(null==a){s=new ap.TimeoutController(this.init.timeout),a=s.signal;try{null===dp.setMaxListeners||void 0===dp.setMaxListeners||(0,dp.setMaxListeners)(1/0,s.signal)}catch{}}try{o=await i.newStream([this.protocol],{signal:a});const e=_l(o,a),t=await Ee([n],e,(async e=>await lp(e))),c=Date.now();if(null==t||!xa(n,t.subarray()))throw ue(new Error("Received wrong ping ack"),tp.ERR_WRONG_PING_ACK);return c-r}finally{null!=s&&s.clear(),null!=o&&o.close()}}}function hm(e){const{address:t}=e.nodeAddress();return/^127\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$/i.test(r=t)||/^::1$/.test(r);var r}const dm=Ba("libp2p:nat"),fm=7200;function pm(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1024,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:65535;return Math.floor(Math.random()*(t-e+1)+e)}class ym{constructor(e,t){var r,n,i;if(this.components=e,this.started=!1,this.enabled=t.enabled,this.externalAddress=t.externalAddress,this.localAddress=t.localAddress,this.description=null!==(r=t.description)&&void 0!==r?r:"".concat("libp2p","@").concat(tm," ").concat(this.components.peerId.toString()),this.ttl=null!==(n=t.ttl)&&void 0!==n?n:fm,this.keepAlive=null===(i=t.keepAlive)||void 0===i||i,this.gateway=t.gateway,this.ttl<fm)throw ue(new Error("NatManager ttl should be at least ".concat(fm," seconds")),tp.ERR_INVALID_PARAMETERS)}isStarted(){return this.started}start(){}afterStart(){su||!this.enabled||this.started||(this.started=!0,this._start().catch((e=>{dm.error(e)})))}async _start(){const e=this.components.transportManager.getAddrs();for(const r of e){var t;const{family:e,host:n,port:i,transport:s}=r.toOptions();if(!r.isThinWaistAddress()||"tcp"!==s)continue;if(hm(r))continue;if(4!==e)continue;const o=await this._getClient(),a=null!==(t=this.externalAddress)&&void 0!==t?t:await o.externalIp();if(ky(a))throw new Error("".concat(a," is private - please set config.nat.externalIp to an externally routable IP or ensure you are not behind a double NAT"));const c=pm();dm("opening uPnP connection from ".concat(a,":").concat(c," to ").concat(n,":").concat(i)),await o.map({publicPort:c,localPort:i,localAddress:this.localAddress,protocol:"TCP"===s.toUpperCase()?"TCP":"UDP"}),this.components.addressManager.addObservedAddr(Oc({family:4,address:a,port:c},s))}}async _getClient(){return null!=this.client||(this.client=await async function(){throw new Error("Not supported in browsers")}((this.description,this.ttl,this.keepAlive,this.gateway))),this.client}async stop(){if(!su&&null!=this.client)try{await this.client.close(),this.client=void 0}catch(e){dm.error(e)}}}const gm=Ba("libp2p:peer-record-updater");class mm{constructor(e){this.components=e,this.started=!1,this.update=this.update.bind(this)}isStarted(){return this.started}async start(){this.started=!0,this.components.transportManager.addEventListener("listener:listening",this.update),this.components.transportManager.addEventListener("listener:close",this.update),this.components.addressManager.addEventListener("change:addresses",this.update)}async stop(){this.started=!1,this.components.transportManager.removeEventListener("listener:listening",this.update),this.components.transportManager.removeEventListener("listener:close",this.update),this.components.addressManager.removeEventListener("change:addresses",this.update)}update(){Promise.resolve().then((async()=>{const e=new em({peerId:this.components.peerId,multiaddrs:this.components.addressManager.getAddresses().map((e=>e.decapsulateCode(nc("p2p").code)))}),t=await $g.seal(e,this.components.peerId);await this.components.peerStore.addressBook.consumePeerRecord(t)})).catch((e=>{gm.error("Could not update self peer record: %o",e)}))}}class vm{constructor(e){this.dht=e}async findPeer(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};for await(const r of this.dht.findPeer(e,t))if("FINAL_PEER"===r.name)return r.peer;throw ue(new Error(ep.NOT_FOUND),tp.ERR_NOT_FOUND)}async*getClosestPeers(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};for await(const r of this.dht.getClosestPeers(e,t))"FINAL_PEER"===r.name&&(yield r.peer)}}const bm="ERR_INVALID_PARAMETERS",wm="ERR_NOT_FOUND";var Em=__webpack_require__(7723),_m=__webpack_require__(587);const Sm=Ba("libp2p:peer-store:address-book"),Im="change:multiaddrs";async function Cm(){return!0}class Am{constructor(e,t,r){this.dispatchEvent=e,this.store=t,this.addressFilter=null!==r&&void 0!==r?r:Cm}async consumePeerRecord(e){Sm.trace("consumePeerRecord await write lock");const t=await this.store.lock.writeLock();let r,n,i;Sm.trace("consumePeerRecord got write lock");try{let o;try{o=em.createFromProtobuf(e.payload)}catch(s){return Sm.error("invalid peer record received"),!1}r=o.peerId;const a=o.multiaddrs;if(!r.equals(e.peerId))return Sm("signing key does not match PeerId in the PeerRecord"),!1;if(null==a||0===a.length)return!1;if(await this.store.has(r)&&(n=await this.store.load(r),null!=n.peerRecordEnvelope)){const e=await $g.createFromProtobuf(n.peerRecordEnvelope),t=em.createFromProtobuf(e.payload);if(t.seqNumber>=o.seqNumber)return Sm("sequence number was lower or equal to existing sequence number - stored: %d received: %d",t.seqNumber,o.seqNumber),!1}const c=await Tm(r,a,this.addressFilter,!0);i=await this.store.patchOrCreate(r,{addresses:c,peerRecordEnvelope:e.marshal().subarray()}),Sm("stored provided peer record for %p",o.peerId)}finally{Sm.trace("consumePeerRecord release write lock"),t()}return this.dispatchEvent(new yl(Im,{detail:{peerId:r,multiaddrs:i.addresses.map((e=>{let{multiaddr:t}=e;return t})),oldMultiaddrs:null==n?[]:n.addresses.map((e=>{let{multiaddr:t}=e;return t}))}})),!0}async getRawEnvelope(e){Sm.trace("getRawEnvelope await read lock");const t=await this.store.lock.readLock();Sm.trace("getRawEnvelope got read lock");try{return(await this.store.load(e)).peerRecordEnvelope}catch(r){if(r.code!==wm)throw r}finally{Sm.trace("getRawEnvelope release read lock"),t()}}async getPeerRecord(e){const t=await this.getRawEnvelope(e);if(null!=t)return await $g.createFromProtobuf(t)}async get(e){e=Cs(e),Sm.trace("get wait for read lock");const t=await this.store.lock.readLock();Sm.trace("get got read lock");try{return(await this.store.load(e)).addresses}catch(r){if(r.code!==wm)throw r}finally{Sm.trace("get release read lock"),t()}return[]}async set(e,t){if(e=Cs(e),!Array.isArray(t))throw Sm.error("multiaddrs must be an array of Multiaddrs"),ue(new Error("multiaddrs must be an array of Multiaddrs"),bm);Sm.trace("set await write lock");const r=await this.store.lock.writeLock();Sm.trace("set got write lock");let n,i,s=!1;try{const a=await Tm(e,t,this.addressFilter);if(0===a.length)return;try{if(n=await this.store.load(e),s=!0,new Set([...a.map((e=>{let{multiaddr:t}=e;return t.toString()})),...n.addresses.map((e=>{let{multiaddr:t}=e;return t.toString()}))]).size===n.addresses.length&&a.length===n.addresses.length)return}catch(o){if(o.code!==wm)throw o}i=await this.store.patchOrCreate(e,{addresses:a}),Sm("set multiaddrs for %p",e)}finally{Sm.trace("set multiaddrs for %p",e),Sm("set release write lock"),r()}this.dispatchEvent(new yl(Im,{detail:{peerId:e,multiaddrs:i.addresses.map((e=>e.multiaddr)),oldMultiaddrs:null==n?[]:n.addresses.map((e=>{let{multiaddr:t}=e;return t}))}})),s||this.dispatchEvent(new yl("peer",{detail:{id:e,multiaddrs:i.addresses.map((e=>e.multiaddr)),protocols:i.protocols}}))}async add(e,t){if(e=Cs(e),!Array.isArray(t))throw Sm.error("multiaddrs must be an array of Multiaddrs"),ue(new Error("multiaddrs must be an array of Multiaddrs"),bm);Sm.trace("add await write lock");const r=await this.store.lock.writeLock();let n,i,s;Sm.trace("add got write lock");try{const a=await Tm(e,t,this.addressFilter);if(0===a.length)return;try{if(i=await this.store.load(e),n=!0,new Set([...a.map((e=>{let{multiaddr:t}=e;return t.toString()})),...i.addresses.map((e=>{let{multiaddr:t}=e;return t.toString()}))]).size===i.addresses.length)return}catch(o){if(o.code!==wm)throw o}s=await this.store.mergeOrCreate(e,{addresses:a}),Sm("added multiaddrs for %p",e)}finally{Sm.trace("set release write lock"),r()}this.dispatchEvent(new yl(Im,{detail:{peerId:e,multiaddrs:s.addresses.map((e=>e.multiaddr)),oldMultiaddrs:null==i?[]:i.addresses.map((e=>{let{multiaddr:t}=e;return t}))}})),!0===n&&this.dispatchEvent(new yl("peer",{detail:{id:e,multiaddrs:s.addresses.map((e=>e.multiaddr)),protocols:s.protocols}}))}async delete(e){e=Cs(e),Sm.trace("delete await write lock");const t=await this.store.lock.writeLock();let r;Sm.trace("delete got write lock");try{try{r=await this.store.load(e)}catch(n){if(n.code!==wm)throw n}await this.store.patchOrCreate(e,{addresses:[]})}finally{Sm.trace("delete release write lock"),t()}null!=r&&this.dispatchEvent(new yl(Im,{detail:{peerId:e,multiaddrs:[],oldMultiaddrs:null==r?[]:r.addresses.map((e=>{let{multiaddr:t}=e;return t}))}}))}}async function Tm(e,t,r){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];return await Ee(t,(e=>_m(e,(e=>{if(!Bc(e))throw Sm.error("multiaddr must be an instance of Multiaddr"),ue(new Error("multiaddr must be an instance of Multiaddr"),bm)}))),(t=>Gf(t,(async t=>await r(e,t)))),(e=>Em(e,(e=>({multiaddr:e,isCertified:n})))),(async e=>await Iu(e)))}const km=Ba("libp2p:peer-store:key-book"),Rm="change:pubkey";class Pm{constructor(e,t){this.dispatchEvent=e,this.store=t}async set(e,t){if(e=Cs(e),!(t instanceof Uint8Array))throw km.error("publicKey must be an instance of Uint8Array to store data"),ue(new Error("publicKey must be an instance of PublicKey"),bm);km.trace("set await write lock");const r=await this.store.lock.writeLock();km.trace("set got write lock");let n,i=!1;try{try{if(n=await this.store.load(e),null!=n.pubKey&&xa(n.pubKey,t))return}catch(s){if(s.code!==wm)throw s}await this.store.patchOrCreate(e,{pubKey:t}),i=!0}finally{km.trace("set release write lock"),r()}i&&this.dispatchEvent(new yl(Rm,{detail:{peerId:e,publicKey:t,oldPublicKey:null==n?void 0:n.pubKey}}))}async get(e){e=Cs(e),km.trace("get await write lock");const t=await this.store.lock.readLock();km.trace("get got write lock");try{return(await this.store.load(e)).pubKey}catch(r){if(r.code!==wm)throw r}finally{km("get release write lock"),t()}}async delete(e){e=Cs(e),km.trace("delete await write lock");const t=await this.store.lock.writeLock();let r;km.trace("delete got write lock");try{try{r=await this.store.load(e)}catch(n){if(n.code!==wm)throw n}await this.store.patchOrCreate(e,{pubKey:void 0})}catch(n){if(n.code!==wm)throw n}finally{km.trace("delete release write lock"),t()}this.dispatchEvent(new yl(Rm,{detail:{peerId:e,publicKey:void 0,oldPublicKey:null==r?void 0:r.pubKey}}))}}const Dm=Ba("libp2p:peer-store:metadata-book"),Nm="change:metadata";class xm{constructor(e,t){this.dispatchEvent=e,this.store=t}async get(e){e=Cs(e),Dm.trace("get await read lock");const t=await this.store.lock.readLock();Dm.trace("get got read lock");try{return(await this.store.load(e)).metadata}catch(r){if(r.code!==wm)throw r}finally{Dm.trace("get release read lock"),t()}return new Map}async getValue(e,t){e=Cs(e),Dm.trace("getValue await read lock");const r=await this.store.lock.readLock();Dm.trace("getValue got read lock");try{return(await this.store.load(e)).metadata.get(t)}catch(n){if(n.code!==wm)throw n}finally{Dm.trace("getValue release write lock"),r()}}async set(e,t){if(e=Cs(e),!(t instanceof Map))throw Dm.error("valid metadata must be provided to store data"),ue(new Error("valid metadata must be provided"),bm);Dm.trace("set await write lock");const r=await this.store.lock.writeLock();let n;Dm.trace("set got write lock");try{try{n=await this.store.load(e)}catch(i){if(i.code!==wm)throw i}await this.store.mergeOrCreate(e,{metadata:t})}finally{Dm.trace("set release write lock"),r()}this.dispatchEvent(new yl(Nm,{detail:{peerId:e,metadata:t,oldMetadata:null==n?new Map:n.metadata}}))}async setValue(e,t,r){if(e=Cs(e),"string"!==typeof t||!(r instanceof Uint8Array))throw Dm.error("valid key and value must be provided to store data"),ue(new Error("valid key and value must be provided"),bm);Dm.trace("setValue await write lock");const n=await this.store.lock.writeLock();let i,s;Dm.trace("setValue got write lock");try{try{i=await this.store.load(e);const n=i.metadata.get(t);if(null!=n&&xa(r,n))return}catch(o){if(o.code!==wm)throw o}s=await this.store.mergeOrCreate(e,{metadata:new Map([[t,r]])})}finally{Dm.trace("setValue release write lock"),n()}this.dispatchEvent(new yl(Nm,{detail:{peerId:e,metadata:s.metadata,oldMetadata:null==i?new Map:i.metadata}}))}async delete(e){e=Cs(e),Dm.trace("delete await write lock");const t=await this.store.lock.writeLock();let r;Dm.trace("delete got write lock");try{try{r=await this.store.load(e)}catch(n){if(n.code!==wm)throw n}null!=r&&await this.store.patch(e,{metadata:new Map})}finally{Dm.trace("delete release write lock"),t()}null!=r&&this.dispatchEvent(new yl(Nm,{detail:{peerId:e,metadata:new Map,oldMetadata:r.metadata}}))}async deleteValue(e,t){e=Cs(e),Dm.trace("deleteValue await write lock");const r=await this.store.lock.writeLock();let n,i;Dm.trace("deleteValue got write lock");try{i=await this.store.load(e),n=i.metadata,n.delete(t),await this.store.patch(e,{metadata:n})}catch(s){if(s.code!==wm)throw s}finally{Dm.trace("deleteValue release write lock"),r()}null!=n&&this.dispatchEvent(new yl(Nm,{detail:{peerId:e,metadata:n,oldMetadata:null==i?new Map:i.metadata}}))}}const Lm=Ba("libp2p:peer-store:proto-book"),Om="change:protocols";class Bm{constructor(e,t){this.dispatchEvent=e,this.store=t}async get(e){Lm.trace("get wait for read lock");const t=await this.store.lock.readLock();Lm.trace("get got read lock");try{return(await this.store.load(e)).protocols}catch(r){if(r.code!==wm)throw r}finally{Lm.trace("get release read lock"),t()}return[]}async set(e,t){if(e=Cs(e),!Array.isArray(t))throw Lm.error("protocols must be provided to store data"),ue(new Error("protocols must be provided"),bm);Lm.trace("set await write lock");const r=await this.store.lock.writeLock();let n,i;Lm.trace("set got write lock");try{try{if(n=await this.store.load(e),new Set([...t]).size===n.protocols.length)return}catch(s){if(s.code!==wm)throw s}i=await this.store.patchOrCreate(e,{protocols:t}),Lm("stored provided protocols for %p",e)}finally{Lm.trace("set release write lock"),r()}this.dispatchEvent(new yl(Om,{detail:{peerId:e,protocols:i.protocols,oldProtocols:null==n?[]:n.protocols}}))}async add(e,t){if(e=Cs(e),!Array.isArray(t))throw Lm.error("protocols must be provided to store data"),ue(new Error("protocols must be provided"),bm);Lm.trace("add await write lock");const r=await this.store.lock.writeLock();let n,i;Lm.trace("add got write lock");try{try{if(n=await this.store.load(e),new Set([...n.protocols,...t]).size===n.protocols.length)return}catch(s){if(s.code!==wm)throw s}i=await this.store.mergeOrCreate(e,{protocols:t}),Lm("added provided protocols for %p",e)}finally{Lm.trace("add release write lock"),r()}this.dispatchEvent(new yl(Om,{detail:{peerId:e,protocols:i.protocols,oldProtocols:null==n?[]:n.protocols}}))}async remove(e,t){if(e=Cs(e),!Array.isArray(t))throw Lm.error("protocols must be provided to store data"),ue(new Error("protocols must be provided"),bm);Lm.trace("remove await write lock");const r=await this.store.lock.writeLock();let n,i;Lm.trace("remove got write lock");try{try{n=await this.store.load(e);const r=new Set(n.protocols);for(const e of t)r.delete(e);if(n.protocols.length===r.size)return;t=Array.from(r)}catch(s){if(s.code!==wm)throw s}i=await this.store.patchOrCreate(e,{protocols:t})}finally{Lm.trace("remove release write lock"),r()}this.dispatchEvent(new yl(Om,{detail:{peerId:e,protocols:i.protocols,oldProtocols:null==n?[]:n.protocols}}))}async delete(e){e=Cs(e),Lm.trace("delete await write lock");const t=await this.store.lock.writeLock();let r;Lm.trace("delete got write lock");try{try{r=await this.store.load(e)}catch(n){if(n.code!==wm)throw n}await this.store.patchOrCreate(e,{protocols:[]})}finally{Lm.trace("delete release write lock"),t()}null!=r&&this.dispatchEvent(new yl(Om,{detail:{peerId:e,protocols:[],oldProtocols:r.protocols}}))}}var Mm,Um,Fm;!function(e){let t;e.codec=()=>(null==t&&(t=Aa((function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!1!==r.lengthDelimited&&t.fork(),null!=e.addresses)for(const n of e.addresses)t.uint32(10),Um.codec().encode(n,t,{writeDefaults:!0});if(null!=e.protocols)for(const n of e.protocols)t.uint32(18),t.string(n);if(null!=e.metadata)for(const n of e.metadata)t.uint32(26),Fm.codec().encode(n,t,{writeDefaults:!0});null!=e.pubKey&&(t.uint32(34),t.bytes(e.pubKey)),null!=e.peerRecordEnvelope&&(t.uint32(42),t.bytes(e.peerRecordEnvelope)),!1!==r.lengthDelimited&&t.ldelim()}),((e,t)=>{const r={addresses:[],protocols:[],metadata:[]},n=null==t?e.len:e.pos+t;for(;e.pos<n;){const t=e.uint32();switch(t>>>3){case 1:r.addresses.push(Um.codec().decode(e,e.uint32()));break;case 2:r.protocols.push(e.string());break;case 3:r.metadata.push(Fm.codec().decode(e,e.uint32()));break;case 4:r.pubKey=e.bytes();break;case 5:r.peerRecordEnvelope=e.bytes();break;default:e.skipType(7&t)}}return r}))),t),e.encode=t=>wa(t,e.codec()),e.decode=t=>ba(t,e.codec())}(Mm||(Mm={})),function(e){let t;e.codec=()=>(null==t&&(t=Aa((function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};!1!==r.lengthDelimited&&t.fork(),(!0===r.writeDefaults||null!=e.multiaddr&&e.multiaddr.byteLength>0)&&(t.uint32(10),t.bytes(e.multiaddr)),null!=e.isCertified&&(t.uint32(16),t.bool(e.isCertified)),!1!==r.lengthDelimited&&t.ldelim()}),((e,t)=>{const r={multiaddr:new Uint8Array(0)},n=null==t?e.len:e.pos+t;for(;e.pos<n;){const t=e.uint32();switch(t>>>3){case 1:r.multiaddr=e.bytes();break;case 2:r.isCertified=e.bool();break;default:e.skipType(7&t)}}return r}))),t),e.encode=t=>wa(t,e.codec()),e.decode=t=>ba(t,e.codec())}(Um||(Um={})),function(e){let t;e.codec=()=>(null==t&&(t=Aa((function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};!1!==r.lengthDelimited&&t.fork(),!0!==r.writeDefaults&&""===e.key||(t.uint32(10),t.string(e.key)),(!0===r.writeDefaults||null!=e.value&&e.value.byteLength>0)&&(t.uint32(18),t.bytes(e.value)),!1!==r.lengthDelimited&&t.ldelim()}),((e,t)=>{const r={key:"",value:new Uint8Array(0)},n=null==t?e.len:e.pos+t;for(;e.pos<n;){const t=e.uint32();switch(t>>>3){case 1:r.key=e.string();break;case 2:r.value=e.bytes();break;default:e.skipType(7&t)}}return r}))),t),e.encode=t=>wa(t,e.codec()),e.decode=t=>ba(t,e.codec())}(Fm||(Fm={}));var Vm=__webpack_require__(2359);class jm extends Error{constructor(e){super(e),this.name="TimeoutError"}}class Km extends Error{constructor(e){super(),this.name="AbortError",this.message=e}}const qm=e=>void 0===globalThis.DOMException?new Km(e):new DOMException(e),zm=e=>{const t=void 0===e.reason?qm("This operation was aborted."):e.reason;return t instanceof Error?t:qm(t)};function Hm(e,t,r,n){let i;const s=new Promise(((s,o)=>{if("number"!==typeof t||1!==Math.sign(t))throw new TypeError("Expected `milliseconds` to be a positive number, got `".concat(t,"`"));if(t!==Number.POSITIVE_INFINITY){if((n={customTimers:{setTimeout:setTimeout,clearTimeout:clearTimeout},...n}).signal){const{signal:e}=n;e.aborted&&o(zm(e)),e.addEventListener("abort",(()=>{o(zm(e))}))}i=n.customTimers.setTimeout.call(void 0,(()=>{if("function"===typeof r){try{s(r())}catch(a){o(a)}return}const n="string"===typeof r?r:"Promise timed out after ".concat(t," milliseconds"),i=r instanceof Error?r:new jm(n);"function"===typeof e.cancel&&e.cancel(),o(i)}),t),(async()=>{try{s(await e)}catch(t){o(t)}finally{n.customTimers.clearTimeout.call(void 0,i)}})()}else s(e)}));return s.clear=()=>{clearTimeout(i),i=void 0},s}var Wm,Gm=function(e,t,r,n){if("a"===r&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"===typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(e):n?n.value:t.get(e)};class Qm{constructor(){Wm.set(this,[])}enqueue(e,t){const r={priority:(t={priority:0,...t}).priority,run:e};if(this.size&&Gm(this,Wm,"f")[this.size-1].priority>=t.priority)return void Gm(this,Wm,"f").push(r);const n=function(e,t,r){let n=0,i=e.length;for(;i>0;){const s=Math.trunc(i/2);let o=n+s;r(e[o],t)<=0?(n=++o,i-=s+1):i=s}return n}(Gm(this,Wm,"f"),r,((e,t)=>t.priority-e.priority));Gm(this,Wm,"f").splice(n,0,r)}dequeue(){const e=Gm(this,Wm,"f").shift();return null===e||void 0===e?void 0:e.run}filter(e){return Gm(this,Wm,"f").filter((t=>t.priority===e.priority)).map((e=>e.run))}get size(){return Gm(this,Wm,"f").length}}Wm=new WeakMap;var Ym,$m,Xm,Jm,Zm,ev,tv,rv,nv,iv,sv,ov,av,cv,lv,uv,hv,dv,fv,pv,yv,gv,mv,vv,bv,wv,Ev=function(e,t,r,n,i){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"===typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?i.call(e,r):i?i.value=r:t.set(e,r),r},_v=function(e,t,r,n){if("a"===r&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"===typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(e):n?n.value:t.get(e)};const Sv=new jm;class Iv extends Error{}class Cv extends Vm{constructor(e){var t,r,n,i;if(super(),Ym.add(this),$m.set(this,void 0),Xm.set(this,void 0),Jm.set(this,0),Zm.set(this,void 0),ev.set(this,void 0),tv.set(this,0),rv.set(this,void 0),nv.set(this,void 0),iv.set(this,void 0),sv.set(this,void 0),ov.set(this,0),av.set(this,void 0),cv.set(this,void 0),lv.set(this,void 0),Object.defineProperty(this,"timeout",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),!("number"===typeof(e={carryoverConcurrencyCount:!1,intervalCap:Number.POSITIVE_INFINITY,interval:0,concurrency:Number.POSITIVE_INFINITY,autoStart:!0,queueClass:Qm,...e}).intervalCap&&e.intervalCap>=1))throw new TypeError("Expected `intervalCap` to be a number from 1 and up, got `".concat(null!==(r=null===(t=e.intervalCap)||void 0===t?void 0:t.toString())&&void 0!==r?r:"","` (").concat(typeof e.intervalCap,")"));if(void 0===e.interval||!(Number.isFinite(e.interval)&&e.interval>=0))throw new TypeError("Expected `interval` to be a finite number >= 0, got `".concat(null!==(i=null===(n=e.interval)||void 0===n?void 0:n.toString())&&void 0!==i?i:"","` (").concat(typeof e.interval,")"));Ev(this,$m,e.carryoverConcurrencyCount,"f"),Ev(this,Xm,e.intervalCap===Number.POSITIVE_INFINITY||0===e.interval,"f"),Ev(this,Zm,e.intervalCap,"f"),Ev(this,ev,e.interval,"f"),Ev(this,iv,new e.queueClass,"f"),Ev(this,sv,e.queueClass,"f"),this.concurrency=e.concurrency,this.timeout=e.timeout,Ev(this,lv,!0===e.throwOnTimeout,"f"),Ev(this,cv,!1===e.autoStart,"f")}get concurrency(){return _v(this,av,"f")}set concurrency(e){if(!("number"===typeof e&&e>=1))throw new TypeError("Expected `concurrency` to be a number from 1 and up, got `".concat(e,"` (").concat(typeof e,")"));Ev(this,av,e,"f"),_v(this,Ym,"m",bv).call(this)}async add(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise(((r,n)=>{_v(this,iv,"f").enqueue((async()=>{var i,s,o;Ev(this,ov,(s=_v(this,ov,"f"),++s),"f"),Ev(this,Jm,(o=_v(this,Jm,"f"),++o),"f");try{if(null===(i=t.signal)||void 0===i?void 0:i.aborted)return void n(new Iv("The task was aborted."));const s=void 0===this.timeout&&void 0===t.timeout?e({signal:t.signal}):Hm(Promise.resolve(e({signal:t.signal})),void 0===t.timeout?this.timeout:t.timeout,(()=>{(void 0===t.throwOnTimeout?_v(this,lv,"f"):t.throwOnTimeout)&&n(Sv)})),o=await s;r(o),this.emit("completed",o)}catch(a){n(a),this.emit("error",a)}_v(this,Ym,"m",dv).call(this)}),t),_v(this,Ym,"m",gv).call(this),this.emit("add")}))}async addAll(e,t){return Promise.all(e.map((async e=>this.add(e,t))))}start(){return _v(this,cv,"f")?(Ev(this,cv,!1,"f"),_v(this,Ym,"m",bv).call(this),this):this}pause(){Ev(this,cv,!0,"f")}clear(){Ev(this,iv,new(_v(this,sv,"f")),"f")}async onEmpty(){0!==_v(this,iv,"f").size&&await _v(this,Ym,"m",wv).call(this,"empty")}async onSizeLessThan(e){_v(this,iv,"f").size<e||await _v(this,Ym,"m",wv).call(this,"next",(()=>_v(this,iv,"f").size<e))}async onIdle(){0===_v(this,ov,"f")&&0===_v(this,iv,"f").size||await _v(this,Ym,"m",wv).call(this,"idle")}get size(){return _v(this,iv,"f").size}sizeBy(e){return _v(this,iv,"f").filter(e).length}get pending(){return _v(this,ov,"f")}get isPaused(){return _v(this,cv,"f")}}$m=new WeakMap,Xm=new WeakMap,Jm=new WeakMap,Zm=new WeakMap,ev=new WeakMap,tv=new WeakMap,rv=new WeakMap,nv=new WeakMap,iv=new WeakMap,sv=new WeakMap,ov=new WeakMap,av=new WeakMap,cv=new WeakMap,lv=new WeakMap,Ym=new WeakSet,uv=function(){return _v(this,Xm,"f")||_v(this,Jm,"f")<_v(this,Zm,"f")},hv=function(){return _v(this,ov,"f")<_v(this,av,"f")},dv=function(){var e;Ev(this,ov,(e=_v(this,ov,"f"),--e),"f"),_v(this,Ym,"m",gv).call(this),this.emit("next")},fv=function(){this.emit("empty"),0===_v(this,ov,"f")&&this.emit("idle")},pv=function(){_v(this,Ym,"m",vv).call(this),_v(this,Ym,"m",mv).call(this),Ev(this,nv,void 0,"f")},yv=function(){const e=Date.now();if(void 0===_v(this,rv,"f")){const t=_v(this,tv,"f")-e;if(!(t<0))return void 0===_v(this,nv,"f")&&Ev(this,nv,setTimeout((()=>{_v(this,Ym,"m",pv).call(this)}),t),"f"),!0;Ev(this,Jm,_v(this,$m,"f")?_v(this,ov,"f"):0,"f")}return!1},gv=function(){if(0===_v(this,iv,"f").size)return _v(this,rv,"f")&&clearInterval(_v(this,rv,"f")),Ev(this,rv,void 0,"f"),_v(this,Ym,"m",fv).call(this),!1;if(!_v(this,cv,"f")){const e=!_v(this,Ym,"a",yv);if(_v(this,Ym,"a",uv)&&_v(this,Ym,"a",hv)){const t=_v(this,iv,"f").dequeue();return!!t&&(this.emit("active"),t(),e&&_v(this,Ym,"m",mv).call(this),!0)}}return!1},mv=function(){_v(this,Xm,"f")||void 0!==_v(this,rv,"f")||(Ev(this,rv,setInterval((()=>{_v(this,Ym,"m",vv).call(this)}),_v(this,ev,"f")),"f"),Ev(this,tv,Date.now()+_v(this,ev,"f"),"f"))},vv=function(){0===_v(this,Jm,"f")&&0===_v(this,ov,"f")&&_v(this,rv,"f")&&(clearInterval(_v(this,rv,"f")),Ev(this,rv,void 0,"f")),Ev(this,Jm,_v(this,$m,"f")?_v(this,ov,"f"):0,"f"),_v(this,Ym,"m",bv).call(this)},bv=function(){for(;_v(this,Ym,"m",gv).call(this););},wv=async function(e,t){return new Promise((r=>{const n=()=>{t&&!t()||(this.off(e,n),r())};this.on(e,n)}))};const Av="lock:worker:request-read",Tv="lock:worker:release-read",kv="lock:master:grant-read",Rv="lock:worker:request-write",Pv="lock:worker:release-write",Dv="lock:master:grant-write",Nv={},xv=e=>{e.addEventListener("message",(t=>{xv.dispatchEvent("message",e,t)})),null!=e.port&&e.port.addEventListener("message",(t=>{xv.dispatchEvent("message",e,t)}))};xv.addEventListener=(e,t)=>{null==Nv[e]&&(Nv[e]=[]),Nv[e].push(t)},xv.removeEventListener=(e,t)=>{null!=Nv[e]&&(Nv[e]=Nv[e].filter((e=>e===t)))},xv.dispatchEvent=function(e,t,r){null!=Nv[e]&&Nv[e].forEach((e=>e(t,r)))};const Lv=xv,Ov=(e,t,r,n,i)=>(s,o)=>{if(o.data.type!==r)return;const a={type:o.data.type,name:o.data.name,identifier:o.data.identifier};e.dispatchEvent(new MessageEvent(t,{data:{name:a.name,handler:async()=>(s.postMessage({type:i,name:a.name,identifier:a.identifier}),await new Promise((e=>{const t=r=>{if(null==r||null==r.data)return;const i=r.data.type,o=(r.data.name,r.data.identifier);i===n&&o===a.identifier&&(s.removeEventListener("message",t),e())};s.addEventListener("message",t)})))}}))},Bv=(e,t,r,n)=>async()=>{const i=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:21;return crypto.getRandomValues(new Uint8Array(e)).reduce(((e,t)=>e+((t&=63)<36?t.toString(36):t<62?(t-26).toString(36).toUpperCase():t>62?"-":"_")),"")}();return globalThis.postMessage({type:t,identifier:i,name:e}),await new Promise((t=>{const s=o=>{if(null==o||null==o.data)return;const a=o.data.type,c=o.data.identifier;a===r&&c===i&&(globalThis.removeEventListener("message",s),t((()=>{globalThis.postMessage({type:n,identifier:i,name:e})})))};globalThis.addEventListener("message",s)}))},Mv={singleProcess:!1},Uv={};let Fv;async function Vv(e,t){let r;const n=new Promise((e=>{r=e}));return e.add((async()=>await yu((async()=>await new Promise((e=>{r((()=>{e()}))})))(),{milliseconds:t.timeout}))),await n}const jv={name:"lock",concurrency:1/0,timeout:846e5,singleProcess:!1};function Kv(e){const t=Object.assign({},jv,e);return null==Fv&&(Fv=(e=>{if(e=Object.assign({},Mv,e),Boolean(globalThis.document)||e.singleProcess){const e=new EventTarget;return Lv.addEventListener("message",Ov(e,"requestReadLock",Av,Tv,kv)),Lv.addEventListener("message",Ov(e,"requestWriteLock",Rv,Pv,Dv)),e}return{isWorker:!0,readLock:e=>Bv(e,Av,kv,Tv),writeLock:e=>Bv(e,Rv,Dv,Pv)}})(t),!0!==Fv.isWorker&&(Fv.addEventListener("requestReadLock",(e=>{null!=Uv[e.data.name]&&Uv[e.data.name].readLock().then((async t=>await e.data.handler().finally((()=>t()))))})),Fv.addEventListener("requestWriteLock",(async e=>{null!=Uv[e.data.name]&&Uv[e.data.name].writeLock().then((async t=>await e.data.handler().finally((()=>t()))))})))),null==Uv[t.name]&&(Uv[t.name]=((e,t)=>{if(!0===Fv.isWorker)return{readLock:Fv.readLock(e,t),writeLock:Fv.writeLock(e,t)};const r=new Cv({concurrency:1});let n;return{async readLock(){if(null!=n)return await Vv(n,t);n=new Cv({concurrency:t.concurrency,autoStart:!1});const e=n,i=Vv(n,t);return r.add((async()=>(e.start(),await e.onIdle().then((()=>{n===e&&(n=null)}))))),await i},writeLock:async()=>(n=null,await Vv(r,t))}})(t.name,t)),Uv[t.name]}const qv=Ba("libp2p:peer-store:store"),zv="/peers/";class Hv{constructor(e){this.components=e,this.lock=Kv({name:"peer-store",singleProcess:!0})}_peerIdToDatastoreKey(e){if(null==e.type)throw qv.error("peerId must be an instance of peer-id to store data"),ue(new Error("peerId must be an instance of peer-id"),bm);const t=e.toCID().toString();return new Jf("".concat(zv).concat(t))}async has(e){return await this.components.datastore.has(this._peerIdToDatastoreKey(e))}async delete(e){await this.components.datastore.delete(this._peerIdToDatastoreKey(e))}async load(e){var t,r;const n=await this.components.datastore.get(this._peerIdToDatastoreKey(e)),i=Mm.decode(n),s=new Map;for(const o of i.metadata)s.set(o.key,o.value);return{...i,id:e,addresses:i.addresses.map((e=>{let{multiaddr:t,isCertified:r}=e;return{multiaddr:Uc(t),isCertified:null!==r&&void 0!==r&&r}})),metadata:s,pubKey:null!==(t=i.pubKey)&&void 0!==t?t:void 0,peerRecordEnvelope:null!==(r=i.peerRecordEnvelope)&&void 0!==r?r:void 0}}async save(e){if(null!=e.pubKey&&null!=e.id.publicKey&&!xa(e.pubKey,e.id.publicKey))throw qv.error("peer publicKey bytes do not match peer id publicKey bytes"),ue(new Error("publicKey bytes do not match peer id publicKey bytes"),bm);const t=new Set,r=e.addresses.filter((e=>!t.has(e.multiaddr.toString())&&(t.add(e.multiaddr.toString()),!0))).sort(((e,t)=>e.multiaddr.toString().localeCompare(t.multiaddr.toString()))).map((e=>{let{multiaddr:t,isCertified:r}=e;return{multiaddr:t.bytes,isCertified:r}})),n=[];[...e.metadata.keys()].sort().forEach((t=>{const r=e.metadata.get(t);null!=r&&n.push({key:t,value:r})}));const i=Mm.encode({addresses:r,protocols:e.protocols.sort(),pubKey:e.pubKey,metadata:n,peerRecordEnvelope:e.peerRecordEnvelope});return await this.components.datastore.put(this._peerIdToDatastoreKey(e.id),i.subarray()),await this.load(e.id)}async patch(e,t){const r=await this.load(e);return await this._patch(e,t,r)}async patchOrCreate(e,t){let r;try{r=await this.load(e)}catch(n){if(n.code!==wm)throw n;r={id:e,addresses:[],protocols:[],metadata:new Map}}return await this._patch(e,t,r)}async _patch(e,t,r){return await this.save({...r,...t,id:e})}async merge(e,t){const r=await this.load(e);return await this._merge(e,t,r)}async mergeOrCreate(e,t){let r;try{r=await this.load(e)}catch(n){if(n.code!==wm)throw n;r={id:e,addresses:[],protocols:[],metadata:new Map}}return await this._merge(e,t,r)}async _merge(e,t,r){var n,i,s,o,a,c,l,u,h;const d=new Map;return r.addresses.forEach((e=>{d.set(e.multiaddr.toString(),e.isCertified)})),(null!==(n=t.addresses)&&void 0!==n?n:[]).forEach((e=>{const t=e.multiaddr.toString(),r=Boolean(d.get(t))||e.isCertified;d.set(t,r)})),await this.save({id:e,addresses:Array.from(d.entries()).map((e=>{let[t,r]=e;return{multiaddr:Uc(t),isCertified:r}})),protocols:Array.from(new Set([...null!==(i=r.protocols)&&void 0!==i?i:[],...null!==(s=t.protocols)&&void 0!==s?s:[]])),metadata:new Map([...null!==(o=null===(a=r.metadata)||void 0===a?void 0:a.entries())&&void 0!==o?o:[],...null!==(c=null===(l=t.metadata)||void 0===l?void 0:l.entries())&&void 0!==c?c:[]]),pubKey:null!==(u=t.pubKey)&&void 0!==u?u:null!=r?r.pubKey:void 0,peerRecordEnvelope:null!==(h=t.peerRecordEnvelope)&&void 0!==h?h:null!=r?r.peerRecordEnvelope:void 0})}async*all(){for await(const e of this.components.datastore.queryKeys({prefix:zv})){const t=e.toString().split("/")[2],r=Ws.decode(t);yield this.load(Ts(r))}}}var Wv,Gv;!function(e){let t;e.codec=()=>(null==t&&(t=Aa((function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!1!==r.lengthDelimited&&t.fork(),null!=e.tags)for(const n of e.tags)t.uint32(10),Gv.codec().encode(n,t,{writeDefaults:!0});!1!==r.lengthDelimited&&t.ldelim()}),((e,t)=>{const r={tags:[]},n=null==t?e.len:e.pos+t;for(;e.pos<n;){const t=e.uint32();if(t>>>3===1)r.tags.push(Gv.codec().decode(e,e.uint32()));else e.skipType(7&t)}return r}))),t),e.encode=t=>wa(t,e.codec()),e.decode=t=>ba(t,e.codec())}(Wv||(Wv={})),function(e){let t;e.codec=()=>(null==t&&(t=Aa((function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};!1!==r.lengthDelimited&&t.fork(),!0!==r.writeDefaults&&""===e.name||(t.uint32(10),t.string(e.name)),null!=e.value&&(t.uint32(16),t.uint32(e.value)),null!=e.expiry&&(t.uint32(24),t.uint64(e.expiry)),!1!==r.lengthDelimited&&t.ldelim()}),((e,t)=>{const r={name:""},n=null==t?e.len:e.pos+t;for(;e.pos<n;){const t=e.uint32();switch(t>>>3){case 1:r.name=e.string();break;case 2:r.value=e.uint32();break;case 3:r.expiry=e.uint64();break;default:e.skipType(7&t)}}return r}))),t),e.encode=t=>wa(t,e.codec()),e.decode=t=>ba(t,e.codec())}(Gv||(Gv={}));const Qv=Ba("libp2p:peer-store");class Yv extends fl{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};super(),this.components=e,this.store=new Hv(e),this.addressBook=new Am(this.dispatchEvent.bind(this),this.store,t.addressFilter),this.keyBook=new Pm(this.dispatchEvent.bind(this),this.store),this.metadataBook=new xm(this.dispatchEvent.bind(this),this.store),this.protoBook=new Bm(this.dispatchEvent.bind(this),this.store)}async forEach(e){Qv.trace("getPeers await read lock");const t=await this.store.lock.readLock();Qv.trace("getPeers got read lock");try{for await(const t of this.store.all())t.id.equals(this.components.peerId)||e(t)}finally{Qv.trace("getPeers release read lock"),t()}}async all(){const e=[];return await this.forEach((t=>{e.push(t)})),e}async delete(e){Qv.trace("delete await write lock");const t=await this.store.lock.writeLock();Qv.trace("delete got write lock");try{await this.store.delete(e)}finally{Qv.trace("delete release write lock"),t()}}async get(e){Qv.trace("get await read lock");const t=await this.store.lock.readLock();Qv.trace("get got read lock");try{return await this.store.load(e)}finally{Qv.trace("get release read lock"),t()}}async has(e){Qv.trace("has await read lock");const t=await this.store.lock.readLock();Qv.trace("has got read lock");try{return await this.store.has(e)}finally{Qv.trace("has release read lock"),t()}}async tagPeer(e,t){var r,n;let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const s=null!==(r=i.value)&&void 0!==r?r:0,o=Math.round(s),a=null!==(n=i.ttl)&&void 0!==n?n:void 0;if(o!==s||o<0||o>100)throw ue(new Error("Tag value must be between 0-100"),"ERR_TAG_VALUE_OUT_OF_BOUNDS");const c=await this.metadataBook.getValue(e,"tags");let l=[];null!=c&&(l=Wv.decode(c).tags);for(const u of l)if(u.name===t)throw ue(new Error("Peer already tagged"),"ERR_DUPLICATE_TAG");l.push({name:t,value:o,expiry:null==a?void 0:BigInt(Date.now()+a)}),await this.metadataBook.setValue(e,"tags",Wv.encode({tags:l}).subarray())}async unTagPeer(e,t){const r=await this.metadataBook.getValue(e,"tags");let n=[];null!=r&&(n=Wv.decode(r).tags),n=n.filter((e=>e.name!==t)),await this.metadataBook.setValue(e,"tags",Wv.encode({tags:n}).subarray())}async getTags(e){const t=await this.metadataBook.getValue(e,"tags");let r=[];null!=t&&(r=Wv.decode(t).tags);const n=BigInt(Date.now()),i=r.filter((e=>null==e.expiry||e.expiry>n));return i.length!==r.length&&await this.metadataBook.setValue(e,"tags",Wv.encode({tags:i}).subarray()),i.map((e=>{var t;return{name:e.name,value:null!==(t=e.value)&&void 0!==t?t:0}}))}}class $v{constructor(e){this.dht=e}async provide(e){await up(this.dht.provide(e))}async*findProviders(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};for await(const r of this.dht.findProviders(e,t))"PROVIDER"===r.name&&(yield*r.providers)}async put(e,t,r){await up(this.dht.put(e,t,r))}async get(e,t){for await(const r of this.dht.get(e,t))if("VALUE"===r.name)return r.value;throw ue(new Error("Not found"),"ERR_NOT_FOUND")}}class Xv{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this._started=!1,this._peerId=e.peerId,this._addressManager=e.addressManager,this._peerStore=e.peerStore,this._upgrader=e.upgrader,this._metrics=e.metrics,this._registrar=e.registrar,this._connectionManager=e.connectionManager,this._transportManager=e.transportManager,this._connectionGater=e.connectionGater,this._contentRouting=e.contentRouting,this._peerRouting=e.peerRouting,this._datastore=e.datastore,this._connectionProtector=e.connectionProtector,this._dht=e.dht,this._pubsub=e.pubsub,this._dialer=e.dialer}isStarted(){return this._started}async beforeStart(){await Promise.all(Object.values(this).filter((e=>zf(e))).map((async e=>{null!=e.beforeStart&&await e.beforeStart()})))}async start(){await Promise.all(Object.values(this).filter((e=>zf(e))).map((async e=>{await e.start()}))),this._started=!0}async afterStart(){await Promise.all(Object.values(this).filter((e=>zf(e))).map((async e=>{null!=e.afterStart&&await e.afterStart()})))}async beforeStop(){await Promise.all(Object.values(this).filter((e=>zf(e))).map((async e=>{null!=e.beforeStop&&await e.beforeStop()})))}async stop(){await Promise.all(Object.values(this).filter((e=>zf(e))).map((async e=>{await e.stop()}))),this._started=!1}async afterStop(){await Promise.all(Object.values(this).filter((e=>zf(e))).map((async e=>{null!=e.afterStop&&await e.afterStop()})))}get peerId(){if(null==this._peerId)throw ue(new Error("peerId not set"),"ERR_SERVICE_MISSING");return this._peerId}set peerId(e){this._peerId=e}get addressManager(){if(null==this._addressManager)throw ue(new Error("addressManager not set"),"ERR_SERVICE_MISSING");return this._addressManager}set addressManager(e){this._addressManager=e}get peerStore(){if(null==this._peerStore)throw ue(new Error("peerStore not set"),"ERR_SERVICE_MISSING");return this._peerStore}set peerStore(e){this._peerStore=e}get upgrader(){if(null==this._upgrader)throw ue(new Error("upgrader not set"),"ERR_SERVICE_MISSING");return this._upgrader}set upgrader(e){this._upgrader=e}get registrar(){if(null==this._registrar)throw ue(new Error("registrar not set"),"ERR_SERVICE_MISSING");return this._registrar}set registrar(e){this._registrar=e}get connectionManager(){if(null==this._connectionManager)throw ue(new Error("connectionManager not set"),"ERR_SERVICE_MISSING");return this._connectionManager}set connectionManager(e){this._connectionManager=e}get transportManager(){if(null==this._transportManager)throw ue(new Error("transportManager not set"),"ERR_SERVICE_MISSING");return this._transportManager}set transportManager(e){this._transportManager=e}get connectionGater(){if(null==this._connectionGater)throw ue(new Error("connectionGater not set"),"ERR_SERVICE_MISSING");return this._connectionGater}set connectionGater(e){this._connectionGater=e}get contentRouting(){if(null==this._contentRouting)throw ue(new Error("contentRouting not set"),"ERR_SERVICE_MISSING");return this._contentRouting}set contentRouting(e){this._contentRouting=e}get peerRouting(){if(null==this._peerRouting)throw ue(new Error("peerRouting not set"),"ERR_SERVICE_MISSING");return this._peerRouting}set peerRouting(e){this._peerRouting=e}get datastore(){if(null==this._datastore)throw ue(new Error("datastore not set"),"ERR_SERVICE_MISSING");return this._datastore}set datastore(e){this._datastore=e}get connectionProtector(){return this._connectionProtector}set connectionProtector(e){this._connectionProtector=e}get dialer(){if(null==this._dialer)throw ue(new Error("dialer not set"),"ERR_SERVICE_MISSING");return this._dialer}set dialer(e){this._dialer=e}get metrics(){return this._metrics}set metrics(e){this._metrics=e}get dht(){return this._dht}set dht(e){this._dht=e}get pubsub(){return this._pubsub}set pubsub(e){this._pubsub=e}}var Jv=__webpack_require__(8062);const Zv=globalThis.fetch,eb=globalThis.Headers;globalThis.Request,globalThis.Response;function tb(e,t,r){return"".concat(e,"?name=").concat(t,"&type=").concat(r)}async function rb(e,t){const r=await Zv(e,{headers:new eb({accept:"application/dns-json"}),signal:t});return await r.json()}function nb(e,t){return"".concat(t,"_").concat(e)}const ib=Object.assign(Oa("dns-over-http-resolver"),{error:Oa("dns-over-http-resolver:error")});const sb=class{constructor(){var e,t,r;let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this._cache=new Jv({max:null!==(e=null===n||void 0===n?void 0:n.maxCache)&&void 0!==e?e:100}),this._TXTcache=new Jv({max:null!==(t=null===n||void 0===n?void 0:n.maxCache)&&void 0!==t?t:100}),this._servers=["https://cloudflare-dns.com/dns-query","https://dns.google/resolve"],this._request=null!==(r=n.request)&&void 0!==r?r:rb,this._abortControllers=[]}cancel(){this._abortControllers.forEach((e=>e.abort()))}getServers(){return this._servers}_getShuffledServers(){const e=[...this._servers];for(let t=e.length-1;t>0;t--){const r=Math.floor(Math.random()*t),n=e[t];e[t]=e[r],e[r]=n}return e}setServers(e){this._servers=e}async resolve(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"A";switch(t){case"A":return await this.resolve4(e);case"AAAA":return await this.resolve6(e);case"TXT":return await this.resolveTxt(e);default:throw new Error("".concat(t," is not supported"))}}async resolve4(e){const t="A",r=this._cache.get(nb(e,t));if(null!=r)return r;let n=!1;for(const s of this._getShuffledServers()){const r=new AbortController;this._abortControllers.push(r);try{const n=await this._request(tb(s,e,t),r.signal),i=n.Answer.map((e=>e.data)),o=Math.min(...n.Answer.map((e=>e.TTL)));return this._cache.set(nb(e,t),i,{ttl:o}),i}catch(i){r.signal.aborted&&(n=!0),ib.error("".concat(s," could not resolve ").concat(e," record ").concat(t))}finally{this._abortControllers=this._abortControllers.filter((e=>e!==r))}}if(n)throw Object.assign(new Error("queryA ECANCELLED"),{code:"ECANCELLED"});throw new Error("Could not resolve ".concat(e," record ").concat(t))}async resolve6(e){const t="AAAA",r=this._cache.get(nb(e,t));if(null!=r)return r;let n=!1;for(const s of this._getShuffledServers()){const r=new AbortController;this._abortControllers.push(r);try{const n=await this._request(tb(s,e,t),r.signal),i=n.Answer.map((e=>e.data)),o=Math.min(...n.Answer.map((e=>e.TTL)));return this._cache.set(nb(e,t),i,{ttl:o}),i}catch(i){r.signal.aborted&&(n=!0),ib.error("".concat(s," could not resolve ").concat(e," record ").concat(t))}finally{this._abortControllers=this._abortControllers.filter((e=>e!==r))}}if(n)throw Object.assign(new Error("queryAaaa ECANCELLED"),{code:"ECANCELLED"});throw new Error("Could not resolve ".concat(e," record ").concat(t))}async resolveTxt(e){const t="TXT",r=this._TXTcache.get(nb(e,t));if(null!=r)return r;let n=!1;for(const s of this._getShuffledServers()){const r=new AbortController;this._abortControllers.push(r);try{const n=await this._request(tb(s,e,t),r.signal),i=n.Answer.map((e=>[e.data.replace(/['"]+/g,"")])),o=Math.min(...n.Answer.map((e=>e.TTL)));return this._TXTcache.set(nb(e,t),i,{ttl:o}),i}catch(i){r.signal.aborted&&(n=!0),ib.error("".concat(s," could not resolve ").concat(e," record ").concat(t))}finally{this._abortControllers=this._abortControllers.filter((e=>e!==r))}}if(n)throw Object.assign(new Error("queryTxt ECANCELLED"),{code:"ECANCELLED"});throw new Error("Could not resolve ".concat(e," record ").concat(t))}clearCache(){this._cache.clear(),this._TXTcache.clear()}},ob=sb,{code:ab}=nc("dnsaddr");const cb={addresses:{listen:[],announce:[],noAnnounce:[],announceFilter:e=>e},connectionManager:{maxConnections:300,minConnections:50,autoDial:!0,autoDialInterval:1e4,maxParallelDials:100,maxDialsPerPeer:4,dialTimeout:3e4,inboundUpgradeTimeout:3e4,resolvers:{dnsaddr:async function(e){var t;let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const n=new ob;null!=r.signal&&r.signal.addEventListener("abort",(()=>{n.cancel()}));const i=e.getPeerId(),[,s]=null!==(t=e.stringTuples().find((e=>{let[t]=e;return t===ab})))&&void 0!==t?t:[];if(null==s)throw new Error("No hostname found in multiaddr");const o=await n.resolveTxt("_dnsaddr.".concat(s));let a=o.flat().map((e=>e.split("=")[1]));return null!=i&&(a=a.filter((e=>e.includes(i)))),a}},addressSorter:Py},connectionGater:{},transportManager:{faultTolerance:Cg.FATAL_ALL},metrics:{enabled:!1,computeThrottleMaxQueueSize:1e3,computeThrottleTimeout:2e3,movingAverageIntervals:[6e4,3e5,9e5],maxOldPeersRetention:50},peerRouting:{refreshManager:{enabled:!0,interval:6e5,bootDelay:1e4}},nat:{enabled:!0,ttl:7200,keepAlive:!0},relay:{enabled:!0,advertise:{bootDelay:9e5,enabled:!1,ttl:18e5},hop:{enabled:!1,active:!1,timeout:3e4},autoRelay:{enabled:!1,maxListeners:2}},identify:{protocolPrefix:"ipfs",host:{agentVersion:rm},timeout:6e4,maxInboundStreams:1,maxOutboundStreams:1,maxPushIncomingStreams:1,maxPushOutgoingStreams:1},ping:{protocolPrefix:"ipfs",maxInboundStreams:1,maxOutboundStreams:1,timeout:1e4},fetch:{protocolPrefix:"libp2p",maxInboundStreams:1,maxOutboundStreams:1,timeout:1e4}};var lb;!function(e){let t;e.codec=()=>(null==t&&(t=Ye((function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!1!==r.lengthDelimited&&t.fork(),null==e.id)throw new Error('Protocol error: required field "id" was not found in object');t.uint32(10),t.bytes(e.id),null!=e.pubKey&&(t.uint32(18),t.bytes(e.pubKey)),null!=e.privKey&&(t.uint32(26),t.bytes(e.privKey)),!1!==r.lengthDelimited&&t.ldelim()}),((e,t)=>{const r={id:new Uint8Array(0)},n=null==t?e.len:e.pos+t;for(;e.pos<n;){const t=e.uint32();switch(t>>>3){case 1:r.id=e.bytes();break;case 2:r.pubKey=e.bytes();break;case 3:r.privKey=e.bytes();break;default:e.skipType(7&t)}}if(null==r.id)throw new Error('Protocol error: value for required field "id" was not found in protobuf');return r}))),t),e.encode=t=>je(t,e.codec()),e.decode=t=>Fe(t,e.codec())}(lb||(lb={}));async function ub(e){return await ks(ys(e.public),function(e,t){var r;return ds(t=(null!==(r=t)&&void 0!==r?r:"rsa").toLowerCase()),e.bytes}(e))}class hb extends fl{get[gl](){return!0}get[Symbol.toStringTag](){return"@libp2p/dummy-dht"}get wan(){throw ue(new Error(ep.DHT_DISABLED),tp.DHT_DISABLED)}get lan(){throw ue(new Error(ep.DHT_DISABLED),tp.DHT_DISABLED)}get(){throw ue(new Error(ep.DHT_DISABLED),tp.DHT_DISABLED)}findProviders(){throw ue(new Error(ep.DHT_DISABLED),tp.DHT_DISABLED)}findPeer(){throw ue(new Error(ep.DHT_DISABLED),tp.DHT_DISABLED)}getClosestPeers(){throw ue(new Error(ep.DHT_DISABLED),tp.DHT_DISABLED)}provide(){throw ue(new Error(ep.DHT_DISABLED),tp.DHT_DISABLED)}put(){throw ue(new Error(ep.DHT_DISABLED),tp.DHT_DISABLED)}async getMode(){throw ue(new Error(ep.DHT_DISABLED),tp.DHT_DISABLED)}async setMode(){throw ue(new Error(ep.DHT_DISABLED),tp.DHT_DISABLED)}async refreshRoutingTable(){throw ue(new Error(ep.DHT_DISABLED),tp.DHT_DISABLED)}}class db extends fl{constructor(){super(...arguments),this.topicValidators=new Map}isStarted(){return!1}start(){}stop(){}get globalSignaturePolicy(){throw ue(new Error(ep.PUBSUB_DISABLED),tp.ERR_PUBSUB_DISABLED)}get multicodecs(){throw ue(new Error(ep.PUBSUB_DISABLED),tp.ERR_PUBSUB_DISABLED)}getPeers(){throw ue(new Error(ep.PUBSUB_DISABLED),tp.ERR_PUBSUB_DISABLED)}getTopics(){throw ue(new Error(ep.PUBSUB_DISABLED),tp.ERR_PUBSUB_DISABLED)}subscribe(){throw ue(new Error(ep.PUBSUB_DISABLED),tp.ERR_PUBSUB_DISABLED)}unsubscribe(){throw ue(new Error(ep.PUBSUB_DISABLED),tp.ERR_PUBSUB_DISABLED)}getSubscribers(){throw ue(new Error(ep.PUBSUB_DISABLED),tp.ERR_PUBSUB_DISABLED)}async publish(){throw ue(new Error(ep.PUBSUB_DISABLED),tp.ERR_PUBSUB_DISABLED)}}var fb=__webpack_require__(7091);const pb=Ba("libp2p:dialer:dial-request");class yb{constructor(e){const{addrs:t,dialAction:r,dialer:n}=e;this.addrs=t,this.dialer=n,this.dialAction=r}async run(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const t=this.dialer.getTokens(this.addrs.length);if(t.length<1)throw ue(new Error("No dial tokens available"),tp.ERR_NO_DIAL_TOKENS);const r=new fb;for(const o of t)r.push(o).catch((e=>{pb.error(e)}));const n=this.addrs.map((()=>{const e=new AbortController;try{null===dp.setMaxListeners||void 0===dp.setMaxListeners||(0,dp.setMaxListeners)(1/0,e.signal)}catch{}return e}));if(null!=e.signal)try{null===dp.setMaxListeners||void 0===dp.setMaxListeners||(0,dp.setMaxListeners)(1/0,e.signal)}catch{}let i=0,s=!1;try{return await Promise.any(this.addrs.map((async(o,a)=>{const c=await r.shift();if(s)throw this.dialer.releaseToken(t.splice(t.indexOf(c),1)[0]),ue(new Error("dialAction already succeeded"),tp.ERR_ALREADY_SUCCEEDED);const l=n[a];if(null==l)throw ue(new Error("dialAction did not come with an AbortController"),tp.ERR_INVALID_PARAMETERS);let u;try{const s=l.signal;u=await this.dialAction(o,{...e,signal:null!=e.signal?(0,Ol.anySignal)([s,e.signal]):s}),n[a]=void 0}finally{i++,this.addrs.length-i>=t.length?r.push(c).catch((e=>{pb.error(e)})):this.dialer.releaseToken(t.splice(t.indexOf(c),1)[0])}if(null==u)throw ue(new Error("dialAction led to empty object"),tp.ERR_TRANSPORT_DIAL_FAILED);return s=!0,u})))}finally{n.forEach((e=>{void 0!==e&&e.abort()})),t.forEach((e=>this.dialer.releaseToken(e)))}}}const gb=Ba("libp2p:dialer"),mb="dialler";class vb{constructor(e){var t,r,n,i,s;let o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.started=!1,this.addressSorter=null!==(t=o.addressSorter)&&void 0!==t?t:Py,this.maxAddrsToDial=null!==(r=o.maxAddrsToDial)&&void 0!==r?r:25,this.timeout=null!==(n=o.dialTimeout)&&void 0!==n?n:3e4,this.maxDialsPerPeer=null!==(i=o.maxDialsPerPeer)&&void 0!==i?i:4,this.tokens=[...new Array(null!==(s=o.maxParallelDials)&&void 0!==s?s:100)].map(((e,t)=>t)),this.components=e,this.pendingDials=_g({component:mb,metric:"pending-dials",metrics:o.metrics}),this.pendingDialTargets=_g({component:mb,metric:"pending-dial-targets",metrics:e.metrics});for(const[c,l]of Object.entries(null!==(a=o.resolvers)&&void 0!==a?a:{})){var a;xc.set(c,l)}}isStarted(){return this.started}async start(){this.started=!0}async stop(){this.started=!1;for(const t of this.pendingDials.values())try{t.controller.abort()}catch(e){gb.error(e)}this.pendingDials.clear();for(const t of this.pendingDialTargets.values())t.reject(new tu("Dialer was destroyed"));this.pendingDialTargets.clear()}async dial(e){var t;let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{id:n,multiaddrs:i}=gp(e);if(this.components.peerId.equals(n))throw ue(new Error("Tried to dial self"),tp.ERR_DIALED_SELF);if(gb("check multiaddrs %p",n),null!=i&&i.length>0&&(gb("storing multiaddrs %p",n,i),await this.components.peerStore.addressBook.add(n,i)),await this.components.connectionGater.denyDialPeer(n))throw ue(new Error("The dial request is blocked by gater.allowDialPeer"),tp.ERR_PEER_DIAL_INTERCEPTED);gb("creating dial target for %p",n);const s=await this._createCancellableDialTarget(n,r);if(0===s.addrs.length)throw ue(new Error("The dial request has no valid addresses"),tp.ERR_NO_VALID_ADDRESSES);const o=null!==(t=this.pendingDials.get(s.id))&&void 0!==t?t:this._createPendingDial(s,r);try{const e=await o.promise;return gb("dial succeeded to %s",s.id),e}catch(a){throw gb("dial failed to %s",s.id,a),o.controller.signal.aborted&&(a.code=tp.ERR_TIMEOUT),gb.error(a),a}finally{o.destroy()}}async _createCancellableDialTarget(e,t){const r="".concat(parseInt(String(1e9*Math.random()),10).toString()).concat(Date.now()),n=new Promise(((e,t)=>{this.pendingDialTargets.set(r,{resolve:e,reject:t})}));try{return await Promise.race([this._createDialTarget(e,t),n])}finally{this.pendingDialTargets.delete(r)}}async _createDialTarget(e,t){const r=this._resolve.bind(this),n=await Ee(await this.components.peerStore.addressBook.get(e),(t=>rp(t,(async t=>!await this.components.connectionGater.denyDialMultiaddr(e,t.multiaddr)))),(e=>Mp(e,this.addressSorter)),(async function*(e){for await(const n of e)yield*await r(n.multiaddr,t)}),(e=>rp(e,(e=>Boolean(this.components.transportManager.transportForMultiaddr(e))))),(t=>np(t,(t=>e.toString()===t.getPeerId()?t:t.encapsulate("/p2p/".concat(e.toString()))))),(async e=>await Bp(e)));if(n.length>this.maxAddrsToDial)throw await this.components.peerStore.delete(e),ue(new Error("dial with more addresses than allowed"),tp.ERR_TOO_MANY_ADDRESSES);return{id:e.toString(),addrs:n}}_createPendingDial(e){var t=this;let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const n=new yb({addrs:e.addrs,dialAction:async function(e){var r;let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!0===(null===(r=n.signal)||void 0===r?void 0:r.aborted))throw ue(new Error("already aborted"),tp.ERR_ALREADY_ABORTED);return await t.components.transportManager.dial(e,n).catch((t=>{throw gb.error("dial to %s failed",e,t),t}))},dialer:this}),i=new ap.TimeoutController(this.timeout),s=[i.signal];null!=r.signal&&s.push(r.signal);const o=(0,Ol.anySignal)(s);try{null===dp.setMaxListeners||void 0===dp.setMaxListeners||(0,dp.setMaxListeners)(1/0,o)}catch{}const a={dialRequest:n,controller:i,promise:n.run({...r,signal:o}),destroy:()=>{i.clear(),this.pendingDials.delete(e.id)}};return this.pendingDials.set(e.id,a),a}getTokens(e){const t=Math.min(e,this.maxDialsPerPeer,this.tokens.length),r=this.tokens.splice(0,t);return gb("%d tokens request, returning %d, %d remaining",e,t,this.tokens.length),r}releaseToken(e){this.tokens.includes(e)||(gb("token %d released",e),this.tokens.push(e))}async _resolve(e,t){if(!e.protoNames().includes("dnsaddr"))return[e];const r=await this._resolveRecord(e,t);return(await Promise.all(r.map((async e=>await this._resolve(e,t))))).flat().reduce(((e,t)=>(null==e.find((e=>e.equals(t)))&&e.push(t),e)),[])}async _resolveRecord(e,t){try{e=Uc(e.toString());return await e.resolve(t)}catch(r){return gb.error("multiaddr ".concat(e.toString()," could not be resolved"),r),[]}}}const bb=Ba("libp2p");class wb extends fl{constructor(e){var t,r,n,i,s;super(),this.started=!1,this.peerId=e.peerId;const o=this.components=new Xv({peerId:e.peerId,datastore:null!==(t=e.datastore)&&void 0!==t?t:new Zf,connectionGater:{denyDialPeer:async()=>await Promise.resolve(!1),denyDialMultiaddr:async()=>await Promise.resolve(!1),denyInboundConnection:async()=>await Promise.resolve(!1),denyOutboundConnection:async()=>await Promise.resolve(!1),denyInboundEncryptedConnection:async()=>await Promise.resolve(!1),denyOutboundEncryptedConnection:async()=>await Promise.resolve(!1),denyInboundUpgradedConnection:async()=>await Promise.resolve(!1),denyOutboundUpgradedConnection:async()=>await Promise.resolve(!1),filterMultiaddrForPeer:async()=>await Promise.resolve(!0),...e.connectionGater}});o.peerStore=new Yv(o,{addressFilter:this.components.connectionGater.filterMultiaddrForPeer,...e.peerStore}),this.services=[o],e.metrics.enabled&&(this.metrics=this.components.metrics=new ag(e.metrics)),this.peerStore=this.components.peerStore,this.peerStore.addEventListener("peer",(e=>{const{detail:t}=e;this.dispatchEvent(new yl("peer:discovery",{detail:t}))})),null!=e.connectionProtector&&(this.components.connectionProtector=e.connectionProtector(o)),this.components.upgrader=new Wg(this.components,{connectionEncryption:(null!==(r=e.connectionEncryption)&&void 0!==r?r:[]).map((e=>this.configureComponent(e(this.components)))),muxers:(null!==(n=e.streamMuxers)&&void 0!==n?n:[]).map((e=>this.configureComponent(e(this.components)))),inboundUpgradeTimeout:e.connectionManager.inboundUpgradeTimeout}),this.components.dialer=new vb(this.components,e.connectionManager),this.connectionManager=this.components.connectionManager=new Op(this.components,e.connectionManager),this.registrar=this.components.registrar=new Kg(this.components),this.components.transportManager=new Ig(this.components,e.transportManager),this.components.addressManager=new vp(this.components,e.addresses),this.configureComponent(new mm(this.components)),this.configureComponent(new Vp(this.components,{enabled:e.connectionManager.autoDial,minConnections:e.connectionManager.minConnections,autoDialInterval:e.connectionManager.autoDialInterval}));const a=Jy.generateOptions();this.keychain=this.configureComponent(new Jy(this.components,{...a,...e.keychain})),this.services.push(new ym(this.components,e.nat)),e.transports.forEach((e=>{this.components.transportManager.add(this.configureComponent(e(this.components)))})),this.identifyService=new im(this.components,{...e.identify}),this.configureComponent(this.identifyService),null!=e.dht?this.dht=this.components.dht=e.dht(this.components):this.dht=new hb,null!=e.pubsub?this.pubsub=this.components.pubsub=e.pubsub(this.components):this.pubsub=new db;const c=(null!==(i=e.peerRouters)&&void 0!==i?i:[]).map((e=>this.configureComponent(e(this.components))));null!=e.dht&&(c.push(this.configureComponent(new vm(this.dht))),this.dht.addEventListener("peer",(e=>{this.onDiscoveryPeer(e)}))),this.peerRouting=this.components.peerRouting=this.configureComponent(new pp(this.components,{...e.peerRouting,routers:c}));const l=(null!==(s=e.contentRouters)&&void 0!==s?s:[]).map((e=>this.configureComponent(e(this.components))));null!=e.dht&&l.push(this.configureComponent(new $v(this.dht))),this.contentRouting=this.components.contentRouting=this.configureComponent(new yp(this.components,{routers:l})),e.relay.enabled&&(this.components.transportManager.add(this.configureComponent(new Sy(this.components,e.relay))),this.configureComponent(new Oy(this.components,{addressSorter:e.connectionManager.addressSorter,...e.relay}))),this.fetchService=this.configureComponent(new cm(this.components,{...e.fetch})),this.pingService=this.configureComponent(new um(this.components,{...e.ping}));for(const h of null!==(u=e.peerDiscovery)&&void 0!==u?u:[]){var u;this.configureComponent(h(this.components)).addEventListener("peer",(e=>{this.onDiscoveryPeer(e)}))}}configureComponent(e){return zf(e)&&this.services.push(e),e}async start(){if(!this.started){this.started=!0,bb("libp2p is starting");try{await Promise.all(this.services.map((async e=>{null!=e.beforeStart&&await e.beforeStart()}))),await Promise.all(this.services.map((e=>e.start()))),await Promise.all(this.services.map((async e=>{null!=e.afterStart&&await e.afterStart()}))),bb("libp2p has started")}catch(e){throw bb.error("An error occurred starting libp2p",e),await this.stop(),e}}}async stop(){this.started&&(bb("libp2p is stopping"),this.started=!1,await Promise.all(this.services.map((async e=>{null!=e.beforeStop&&await e.beforeStop()}))),await Promise.all(this.services.map((e=>e.stop()))),await Promise.all(this.services.map((async e=>{null!=e.afterStop&&await e.afterStop()}))),bb("libp2p has stopped"))}isStarted(){return this.started}getConnections(e){return this.components.connectionManager.getConnections(e)}getPeers(){const e=new Pp;for(const t of this.components.connectionManager.getConnections())e.add(t.remotePeer);return Array.from(e)}async dial(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{id:r,multiaddrs:n}=gp(e);return await this.components.peerStore.addressBook.add(r,n),await this.components.connectionManager.openConnection(r,t)}async dialProtocol(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(null==t)throw ue(new Error("no protocols were provided to open a stream"),tp.ERR_INVALID_PROTOCOLS_FOR_STREAM);if(0===(t=Array.isArray(t)?t:[t]).length)throw ue(new Error("no protocols were provided to open a stream"),tp.ERR_INVALID_PROTOCOLS_FOR_STREAM);const n=await this.dial(e,r);return await n.newStream(t,r)}getMultiaddrs(){return this.components.addressManager.getAddresses()}async hangUp(e){const{id:t}=gp(e);await this.components.connectionManager.closeConnections(t)}async getPublicKey(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(bb("getPublicKey %p",e),null!=e.publicKey)return e.publicKey;const r=await this.peerStore.get(e);if(null!=r.pubKey)return r.pubKey;if(null==this.dht)throw ue(new Error("Public key was not in the peer store and the DHT is not enabled"),tp.ERR_NO_ROUTERS_AVAILABLE);const n=xe([ha("/pk/"),e.multihash.digest]);for await(const i of this.dht.get(n,t))if("VALUE"===i.name){const t=ps(i.value);return await this.peerStore.keyBook.set(e,i.value),t.bytes}throw ue(new Error("Node not responding with its public key: ".concat(e.toString())),tp.ERR_INVALID_RECORD)}async fetch(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const{id:n,multiaddrs:i}=gp(e);return null!=i&&await this.components.peerStore.addressBook.add(n,i),await this.fetchService.fetch(n,t,r)}async ping(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{id:r,multiaddrs:n}=gp(e);return n.length>0&&await this.components.peerStore.addressBook.add(r,n),await this.pingService.ping(r,t)}async handle(e,t,r){Array.isArray(e)||(e=[e]),await Promise.all(e.map((async e=>{await this.components.registrar.handle(e,t,r)})))}async unhandle(e){Array.isArray(e)||(e=[e]),await Promise.all(e.map((async e=>{await this.components.registrar.unhandle(e)})))}onDiscoveryPeer(e){const{detail:t}=e;t.id.toString()!==this.peerId.toString()?(t.multiaddrs.length>0&&this.components.peerStore.addressBook.add(t.id,t.multiaddrs).catch((e=>bb.error(e))),t.protocols.length>0&&this.components.peerStore.protoBook.set(t.id,t.protocols).catch((e=>bb.error(e))),this.dispatchEvent(new yl("peer:discovery",{detail:t}))):bb.error(new Error(tp.ERR_DISCOVERED_SELF))}}async function Eb(e){return null==e.peerId&&(e.peerId=await(async()=>{const e=await fs("Ed25519"),t=await ub(e);if("Ed25519"===t.type)return t;throw new Error('Generated unexpected PeerId type "'.concat(t.type,'"'))})()),new wb(function(e){var t,r;const n=bp(cb,e);if(null==n.transports||n.transports.length<1)throw ue(new Error(ep.ERR_TRANSPORTS_REQUIRED),tp.ERR_TRANSPORTS_REQUIRED);if(null==n.connectionEncryption||0===n.connectionEncryption.length)throw ue(new Error(ep.CONN_ENCRYPTION_REQUIRED),tp.CONN_ENCRYPTION_REQUIRED);if(null===n.connectionProtector&&null!=(null===(t=globalThis.process)||void 0===t||null===(r=t.env)||void 0===r?void 0:r.LIBP2P_FORCE_PNET))throw ue(new Error(ep.ERR_PROTECTOR_REQUIRED),tp.ERR_PROTECTOR_REQUIRED);return n.identify.host.agentVersion===rm&&(cu||ou?n.identify.host.agentVersion+=" UserAgent=".concat(globalThis.process.version):(su||lu||au||uu)&&(n.identify.host.agentVersion+=" UserAgent=".concat(globalThis.navigator.userAgent))),n}(e))}async function _b(e){var t,r;const n=null!==(t=null===e||void 0===e?void 0:e.libp2p)&&void 0!==t?t:{},i=null!==(r=n.peerDiscovery)&&void 0!==r?r:[];null!==e&&void 0!==e&&e.defaultBootstrap&&(i.push(Sb()),Object.assign(n,{peerDiscovery:i}));const s=await Ib(function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return t=>new Ff(t,e)}(e),n,null===e||void 0===e?void 0:e.userAgent);return new fh(null!==e&&void 0!==e?e:{},s)}function Sb(){return e={list:Kf()},t=>new vl(t,e);var e}async function Ib(e,t,r){return async function(e){return await Eb(e)}(Object.assign({transports:[Eu({filter:mu})],streamMuxers:[ql()],connectionEncryption:[Ha()],identify:{host:{agentVersion:null!==r&&void 0!==r?r:"js-waku"}}},e?{pubsub:e}:{},null!==t&&void 0!==t?t:{}))}const Cb=e=>{const t=e.on||e.addListener||e.addEventListener,r=e.off||e.removeListener||e.removeEventListener;if(!t||!r)throw new TypeError("Emitter is not compatible");return{addListener:t.bind(e),removeListener:r.bind(e)}};function Ab(e,t,r){"function"===typeof r&&(r={filter:r});const n=function(e,t,r){let n;const i=new Promise(((i,s)=>{if(!((r={rejectionEvents:["error"],multiArgs:!1,resolveImmediately:!1,...r}).count>=0)||r.count!==Number.POSITIVE_INFINITY&&!Number.isInteger(r.count))throw new TypeError("The `count` option should be at least 0 or more");const o=[t].flat(),a=[],{addListener:c,removeListener:l}=Cb(e),u=function(){for(var e=arguments.length,t=new Array(e),s=0;s<e;s++)t[s]=arguments[s];const o=r.multiArgs?t:t[0];r.filter&&!r.filter(o)||(a.push(o),r.count===a.length&&(n(),i(a)))},h=e=>{n(),s(e)};n=()=>{for(const e of o)l(e,u);for(const e of r.rejectionEvents)l(e,h)};for(const e of o)c(e,u);for(const e of r.rejectionEvents)c(e,h);r.resolveImmediately&&i(a)}));if(i.cancel=n,"number"===typeof r.timeout){const e=Hm(i,r.timeout);return e.cancel=n,e}return i}(e,t,r={...r,count:1,resolveImmediately:!1}),i=n.then((e=>e[0]));return i.cancel=n.cancel,i}const Tb=Oa("waku:wait-for-remote-peer");async function kb(e,t,r){var n;if(t=null!==(n=t)&&void 0!==n?n:function(e){const t=[];e.relay&&t.push(_u.Relay);e.filter&&t.push(_u.Filter);e.store&&t.push(_u.Store);e.lightPush&&t.push(_u.LightPush);return t}(e),!e.isStarted())return Promise.reject("Waku node is not started");const i=[];if(t.includes(_u.Relay)){if(!e.relay)throw new Error("Cannot wait for Relay peer: protocol not mounted");i.push(async function(e){let t=e.getMeshPeers();for(;0==t.length;)await Ab(e,"gossipsub:heartbeat"),t=e.getMeshPeers()}(e.relay))}if(t.includes(_u.Store)){if(!e.store)throw new Error("Cannot wait for Store peer: protocol not mounted");i.push(Rb(e.store,[hh]))}if(t.includes(_u.LightPush)){if(!e.lightPush)throw new Error("Cannot wait for LightPush peer: protocol not mounted");i.push(Rb(e.lightPush,[Bu]))}if(t.includes(_u.Filter)){if(!e.filter)throw new Error("Cannot wait for Filter peer: protocol not mounted");i.push(Rb(e.filter,[Pu]))}r?await async function(e,t,r){await Promise.race([e,Pb(t,r)])}(Promise.all(i),r,"Timed out waiting for a remote peer."):await Promise.all(i)}async function Rb(e,t){const r=await e.peers();r.length?Tb("".concat(t," peer found: "),r[0].id.toString()):await new Promise((r=>{const n=i=>{for(const s of t)if(i.detail.protocols.includes(s)){Tb("Resolving for",s,i.detail.protocols),e.peerStore.removeEventListener("change:protocols",n),r();break}};e.peerStore.addEventListener("change:protocols",n)}))}const Pb=(e,t)=>new Promise(((r,n)=>setTimeout((()=>n(t)),e)));var Db=__webpack_require__(4686);const Nb="/js-waku-examples/1/chat/proto",xb=new Ku(Nb),Lb=new class{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this.contentTopic=e,this.ephemeral=t}fromWireToProtoObj(e){var t,r,n,i,s,o;const a=Uu.decode(e);return Fu("Message decoded",a),Promise.resolve({payload:null!==(t=a.payload)&&void 0!==t?t:void 0,contentTopic:null!==(r=a.contentTopic)&&void 0!==r?r:void 0,version:null!==(n=a.version)&&void 0!==n?n:void 0,timestamp:null!==(i=a.timestamp)&&void 0!==i?i:void 0,rateLimitProof:null!==(s=a.rateLimitProof)&&void 0!==s?s:void 0,ephemeral:null!==(o=a.ephemeral)&&void 0!==o&&o})}async fromProtoObj(e){return void 0===e.version&&(e.version=0),0!==e.version?(Fu("Failed to decode due to incorrect version, expected:",0,", actual:",e.version),Promise.resolve(void 0)):new ju(e)}}(Nb),Ob=new(L().Type)("SimpleChatMessage").add(new(L().Field)("timestamp",1,"uint32")).add(new(L().Field)("text",2,"string"));const Bb=function(){const[e,t]=D.useState(void 0),[r,n]=D.useState("None"),[i,s]=D.useState(0),[o,a]=D.useState([]);D.useEffect((()=>{e||"None"===r&&(n("Starting"),(async()=>{const e=await _b({defaultBootstrap:!0});t(e),await e.start(),n("Connecting"),await kb(e,["relay"]),n("Ready")})())}),[e,r]);const c=D.useCallback((e=>{if(console.log("Message received",e),!e.payload)return;const{text:t,timestamp:r}=Ob.decode(e.payload),n=new Date;n.setTime(r);const i={text:t,timestamp:n};a((e=>[i].concat(e)))}),[]);return D.useEffect((()=>{if(!e)return;return e.relay.addObserver(Lb,c)}),[e,r,c]),(0,Db.jsx)("div",{className:"App",children:(0,Db.jsxs)("header",{className:"App-header",children:[(0,Db.jsx)("p",{children:r}),(0,Db.jsx)("button",{onClick:()=>{"Ready"===r&&(function(e,t,r){const n=r.getTime(),i=Ob.create({timestamp:n,text:e}),s=Ob.encode(i).finish();return t.relay.send(xb,{payload:s})}("Here is message #".concat(i),e,new Date).then((()=>console.log("Message sent"))),s(i+1))},disabled:"Ready"!==r,children:"Send Message"}),(0,Db.jsx)("ul",{children:o.map((e=>(0,Db.jsx)("li",{children:(0,Db.jsxs)("p",{children:[e.timestamp.toString(),": ",e.text]})},e.timestamp.valueOf())))})]})})};N.createRoot(document.getElementById("root")).render((0,Db.jsx)(D.StrictMode,{children:(0,Db.jsx)(Bb,{})}))})()})();
|
|
//# sourceMappingURL=main.fe5e2acc.js.map |