UNPKG

hyjs-test

Version:
6 lines 1.28 MB
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).Everpay={})}(this,function(t){"use strict";var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function r(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function n(t){if(t.__esModule)return t;var e=t.default;if("function"==typeof e){var r=function t(){if(this instanceof t){var r=[null];return r.push.apply(r,arguments),new(Function.bind.apply(e,r))}return e.apply(this,arguments)};r.prototype=e.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(t).forEach(function(e){var n=Object.getOwnPropertyDescriptor(t,e);Object.defineProperty(r,e,n.get?n:{enumerable:!0,get:function(){return t[e]}})}),r}var i={exports:{}},o="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},s=[],a=[],u="undefined"!=typeof Uint8Array?Uint8Array:Array,h=!1;function c(){h=!0;for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",e=0;e<64;++e)s[e]=t[e],a[t.charCodeAt(e)]=e;a["-".charCodeAt(0)]=62,a["_".charCodeAt(0)]=63}function f(t){return s[t>>18&63]+s[t>>12&63]+s[t>>6&63]+s[63&t]}function l(t,e,r){for(var n,i=[],o=e;o<r;o+=3)n=(t[o]<<16)+(t[o+1]<<8)+t[o+2],i.push(f(n));return i.join("")}function d(t){var e;h||c();for(var r=t.length,n=r%3,i="",o=[],a=16383,u=0,f=r-n;u<f;u+=a)o.push(l(t,u,u+a>f?f:u+a));return 1===n?(e=t[r-1],i+=s[e>>2],i+=s[e<<4&63],i+="=="):2===n&&(e=(t[r-2]<<8)+t[r-1],i+=s[e>>10],i+=s[e>>4&63],i+=s[e<<2&63],i+="="),o.push(i),o.join("")}function p(t,e,r,n,i){var o,s,a=8*i-n-1,u=(1<<a)-1,h=u>>1,c=-7,f=r?i-1:0,l=r?-1:1,d=t[e+f];for(f+=l,o=d&(1<<-c)-1,d>>=-c,c+=a;c>0;o=256*o+t[e+f],f+=l,c-=8);for(s=o&(1<<-c)-1,o>>=-c,c+=n;c>0;s=256*s+t[e+f],f+=l,c-=8);if(0===o)o=1-h;else{if(o===u)return s?NaN:1/0*(d?-1:1);s+=Math.pow(2,n),o-=h}return(d?-1:1)*s*Math.pow(2,o-n)}function m(t,e,r,n,i,o){var s,a,u,h=8*o-i-1,c=(1<<h)-1,f=c>>1,l=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,d=n?0:o-1,p=n?1:-1,m=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,s=c):(s=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-s))<1&&(s--,u*=2),(e+=s+f>=1?l/u:l*Math.pow(2,1-f))*u>=2&&(s++,u/=2),s+f>=c?(a=0,s=c):s+f>=1?(a=(e*u-1)*Math.pow(2,i),s+=f):(a=e*Math.pow(2,f-1)*Math.pow(2,i),s=0));i>=8;t[r+d]=255&a,d+=p,a/=256,i-=8);for(s=s<<i|a,h+=i;h>0;t[r+d]=255&s,d+=p,s/=256,h-=8);t[r+d-p]|=128*m}var g={}.toString,y=Array.isArray||function(t){return"[object Array]"==g.call(t)};_.TYPED_ARRAY_SUPPORT=void 0===o.TYPED_ARRAY_SUPPORT||o.TYPED_ARRAY_SUPPORT;var b=v();function v(){return _.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function w(t,e){if(v()<e)throw new RangeError("Invalid typed array length");return _.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(e)).__proto__=_.prototype:(null===t&&(t=new _(e)),t.length=e),t}function _(t,e,r){if(!(_.TYPED_ARRAY_SUPPORT||this instanceof _))return new _(t,e,r);if("number"==typeof t){if("string"==typeof e)throw new Error("If encoding is specified then the first argument must be a string");return M(this,t)}return E(this,t,e,r)}function E(t,e,r,n){if("number"==typeof e)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer?function(t,e,r,n){if(e.byteLength,r<0||e.byteLength<r)throw new RangeError("'offset' is out of bounds");if(e.byteLength<r+(n||0))throw new RangeError("'length' is out of bounds");e=void 0===r&&void 0===n?new Uint8Array(e):void 0===n?new Uint8Array(e,r):new Uint8Array(e,r,n);_.TYPED_ARRAY_SUPPORT?(t=e).__proto__=_.prototype:t=S(t,e);return t}(t,e,r,n):"string"==typeof e?function(t,e,r){"string"==typeof r&&""!==r||(r="utf8");if(!_.isEncoding(r))throw new TypeError('"encoding" must be a valid string encoding');var n=0|T(e,r);t=w(t,n);var i=t.write(e,r);i!==n&&(t=t.slice(0,i));return t}(t,e,r):function(t,e){if(x(e)){var r=0|k(e.length);return 0===(t=w(t,r)).length||e.copy(t,0,0,r),t}if(e){if("undefined"!=typeof ArrayBuffer&&e.buffer instanceof ArrayBuffer||"length"in e)return"number"!=typeof e.length||(n=e.length)!=n?w(t,0):S(t,e);if("Buffer"===e.type&&y(e.data))return S(t,e.data)}var n;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(t,e)}function A(t){if("number"!=typeof t)throw new TypeError('"size" argument must be a number');if(t<0)throw new RangeError('"size" argument must not be negative')}function M(t,e){if(A(e),t=w(t,e<0?0:0|k(e)),!_.TYPED_ARRAY_SUPPORT)for(var r=0;r<e;++r)t[r]=0;return t}function S(t,e){var r=e.length<0?0:0|k(e.length);t=w(t,r);for(var n=0;n<r;n+=1)t[n]=255&e[n];return t}function k(t){if(t>=v())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+v().toString(16)+" bytes");return 0|t}function x(t){return!(null==t||!t._isBuffer)}function T(t,e){if(x(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;"string"!=typeof t&&(t=""+t);var r=t.length;if(0===r)return 0;for(var n=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return et(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return rt(t).length;default:if(n)return et(t).length;e=(""+e).toLowerCase(),n=!0}}function R(t,e,r){var n=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return K(this,e,r);case"utf8":case"utf-8":return F(this,e,r);case"ascii":return q(this,e,r);case"latin1":case"binary":return H(this,e,r);case"base64":return U(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return G(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function B(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function N(t,e,r,n,i){if(0===t.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=i?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(i)return-1;r=t.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof e&&(e=_.from(e,n)),x(e))return 0===e.length?-1:P(t,e,r,n,i);if("number"==typeof e)return e&=255,_.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):P(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function P(t,e,r,n,i){var o,s=1,a=t.length,u=e.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return-1;s=2,a/=2,u/=2,r/=2}function h(t,e){return 1===s?t[e]:t.readUInt16BE(e*s)}if(i){var c=-1;for(o=r;o<a;o++)if(h(t,o)===h(e,-1===c?0:o-c)){if(-1===c&&(c=o),o-c+1===u)return c*s}else-1!==c&&(o-=o-c),c=-1}else for(r+u>a&&(r=a-u),o=r;o>=0;o--){for(var f=!0,l=0;l<u;l++)if(h(t,o+l)!==h(e,l)){f=!1;break}if(f)return o}return-1}function I(t,e,r,n){r=Number(r)||0;var i=t.length-r;n?(n=Number(n))>i&&(n=i):n=i;var o=e.length;if(o%2!=0)throw new TypeError("Invalid hex string");n>o/2&&(n=o/2);for(var s=0;s<n;++s){var a=parseInt(e.substr(2*s,2),16);if(isNaN(a))return s;t[r+s]=a}return s}function O(t,e,r,n){return nt(et(e,t.length-r),t,r,n)}function C(t,e,r,n){return nt(function(t){for(var e=[],r=0;r<t.length;++r)e.push(255&t.charCodeAt(r));return e}(e),t,r,n)}function L(t,e,r,n){return C(t,e,r,n)}function j(t,e,r,n){return nt(rt(e),t,r,n)}function D(t,e,r,n){return nt(function(t,e){for(var r,n,i,o=[],s=0;s<t.length&&!((e-=2)<0);++s)n=(r=t.charCodeAt(s))>>8,i=r%256,o.push(i),o.push(n);return o}(e,t.length-r),t,r,n)}function U(t,e,r){return 0===e&&r===t.length?d(t):d(t.slice(e,r))}function F(t,e,r){r=Math.min(t.length,r);for(var n=[],i=e;i<r;){var o,s,a,u,h=t[i],c=null,f=h>239?4:h>223?3:h>191?2:1;if(i+f<=r)switch(f){case 1:h<128&&(c=h);break;case 2:128==(192&(o=t[i+1]))&&(u=(31&h)<<6|63&o)>127&&(c=u);break;case 3:o=t[i+1],s=t[i+2],128==(192&o)&&128==(192&s)&&(u=(15&h)<<12|(63&o)<<6|63&s)>2047&&(u<55296||u>57343)&&(c=u);break;case 4:o=t[i+1],s=t[i+2],a=t[i+3],128==(192&o)&&128==(192&s)&&128==(192&a)&&(u=(15&h)<<18|(63&o)<<12|(63&s)<<6|63&a)>65535&&u<1114112&&(c=u)}null===c?(c=65533,f=1):c>65535&&(c-=65536,n.push(c>>>10&1023|55296),c=56320|1023&c),n.push(c),i+=f}return function(t){var e=t.length;if(e<=z)return String.fromCharCode.apply(String,t);var r="",n=0;for(;n<e;)r+=String.fromCharCode.apply(String,t.slice(n,n+=z));return r}(n)}_.poolSize=8192,_._augment=function(t){return t.__proto__=_.prototype,t},_.from=function(t,e,r){return E(null,t,e,r)},_.TYPED_ARRAY_SUPPORT&&(_.prototype.__proto__=Uint8Array.prototype,_.__proto__=Uint8Array),_.alloc=function(t,e,r){return function(t,e,r,n){return A(e),e<=0?w(t,e):void 0!==r?"string"==typeof n?w(t,e).fill(r,n):w(t,e).fill(r):w(t,e)}(null,t,e,r)},_.allocUnsafe=function(t){return M(null,t)},_.allocUnsafeSlow=function(t){return M(null,t)},_.isBuffer=it,_.compare=function(t,e){if(!x(t)||!x(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var r=t.length,n=e.length,i=0,o=Math.min(r,n);i<o;++i)if(t[i]!==e[i]){r=t[i],n=e[i];break}return r<n?-1:n<r?1:0},_.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},_.concat=function(t,e){if(!y(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return _.alloc(0);var r;if(void 0===e)for(e=0,r=0;r<t.length;++r)e+=t[r].length;var n=_.allocUnsafe(e),i=0;for(r=0;r<t.length;++r){var o=t[r];if(!x(o))throw new TypeError('"list" argument must be an Array of Buffers');o.copy(n,i),i+=o.length}return n},_.byteLength=T,_.prototype._isBuffer=!0,_.prototype.swap16=function(){var t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e<t;e+=2)B(this,e,e+1);return this},_.prototype.swap32=function(){var t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<t;e+=4)B(this,e,e+3),B(this,e+1,e+2);return this},_.prototype.swap64=function(){var t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<t;e+=8)B(this,e,e+7),B(this,e+1,e+6),B(this,e+2,e+5),B(this,e+3,e+4);return this},_.prototype.toString=function(){var t=0|this.length;return 0===t?"":0===arguments.length?F(this,0,t):R.apply(this,arguments)},_.prototype.equals=function(t){if(!x(t))throw new TypeError("Argument must be a Buffer");return this===t||0===_.compare(this,t)},_.prototype.inspect=function(){var t="";return this.length>0&&(t=this.toString("hex",0,50).match(/.{2}/g).join(" "),this.length>50&&(t+=" ... ")),"<Buffer "+t+">"},_.prototype.compare=function(t,e,r,n,i){if(!x(t))throw new TypeError("Argument must be a Buffer");if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),e<0||r>t.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&e>=r)return 0;if(n>=i)return-1;if(e>=r)return 1;if(this===t)return 0;for(var o=(i>>>=0)-(n>>>=0),s=(r>>>=0)-(e>>>=0),a=Math.min(o,s),u=this.slice(n,i),h=t.slice(e,r),c=0;c<a;++c)if(u[c]!==h[c]){o=u[c],s=h[c];break}return o<s?-1:s<o?1:0},_.prototype.includes=function(t,e,r){return-1!==this.indexOf(t,e,r)},_.prototype.indexOf=function(t,e,r){return N(this,t,e,r,!0)},_.prototype.lastIndexOf=function(t,e,r){return N(this,t,e,r,!1)},_.prototype.write=function(t,e,r,n){if(void 0===e)n="utf8",r=this.length,e=0;else if(void 0===r&&"string"==typeof e)n=e,r=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e|=0,isFinite(r)?(r|=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var i=this.length-e;if((void 0===r||r>i)&&(r=i),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var o=!1;;)switch(n){case"hex":return I(this,t,e,r);case"utf8":case"utf-8":return O(this,t,e,r);case"ascii":return C(this,t,e,r);case"latin1":case"binary":return L(this,t,e,r);case"base64":return j(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return D(this,t,e,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},_.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var z=4096;function q(t,e,r){var n="";r=Math.min(t.length,r);for(var i=e;i<r;++i)n+=String.fromCharCode(127&t[i]);return n}function H(t,e,r){var n="";r=Math.min(t.length,r);for(var i=e;i<r;++i)n+=String.fromCharCode(t[i]);return n}function K(t,e,r){var n=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>n)&&(r=n);for(var i="",o=e;o<r;++o)i+=tt(t[o]);return i}function G(t,e,r){for(var n=t.slice(e,r),i="",o=0;o<n.length;o+=2)i+=String.fromCharCode(n[o]+256*n[o+1]);return i}function V(t,e,r){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>r)throw new RangeError("Trying to access beyond buffer length")}function W(t,e,r,n,i,o){if(!x(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||e<o)throw new RangeError('"value" argument is out of bounds');if(r+n>t.length)throw new RangeError("Index out of range")}function J(t,e,r,n){e<0&&(e=65535+e+1);for(var i=0,o=Math.min(t.length-r,2);i<o;++i)t[r+i]=(e&255<<8*(n?i:1-i))>>>8*(n?i:1-i)}function Z(t,e,r,n){e<0&&(e=4294967295+e+1);for(var i=0,o=Math.min(t.length-r,4);i<o;++i)t[r+i]=e>>>8*(n?i:3-i)&255}function Y(t,e,r,n,i,o){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function X(t,e,r,n,i){return i||Y(t,0,r,4),m(t,e,r,n,23,4),r+4}function $(t,e,r,n,i){return i||Y(t,0,r,8),m(t,e,r,n,52,8),r+8}_.prototype.slice=function(t,e){var r,n=this.length;if((t=~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),(e=void 0===e?n:~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),e<t&&(e=t),_.TYPED_ARRAY_SUPPORT)(r=this.subarray(t,e)).__proto__=_.prototype;else{var i=e-t;r=new _(i,void 0);for(var o=0;o<i;++o)r[o]=this[o+t]}return r},_.prototype.readUIntLE=function(t,e,r){t|=0,e|=0,r||V(t,e,this.length);for(var n=this[t],i=1,o=0;++o<e&&(i*=256);)n+=this[t+o]*i;return n},_.prototype.readUIntBE=function(t,e,r){t|=0,e|=0,r||V(t,e,this.length);for(var n=this[t+--e],i=1;e>0&&(i*=256);)n+=this[t+--e]*i;return n},_.prototype.readUInt8=function(t,e){return e||V(t,1,this.length),this[t]},_.prototype.readUInt16LE=function(t,e){return e||V(t,2,this.length),this[t]|this[t+1]<<8},_.prototype.readUInt16BE=function(t,e){return e||V(t,2,this.length),this[t]<<8|this[t+1]},_.prototype.readUInt32LE=function(t,e){return e||V(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},_.prototype.readUInt32BE=function(t,e){return e||V(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},_.prototype.readIntLE=function(t,e,r){t|=0,e|=0,r||V(t,e,this.length);for(var n=this[t],i=1,o=0;++o<e&&(i*=256);)n+=this[t+o]*i;return n>=(i*=128)&&(n-=Math.pow(2,8*e)),n},_.prototype.readIntBE=function(t,e,r){t|=0,e|=0,r||V(t,e,this.length);for(var n=e,i=1,o=this[t+--n];n>0&&(i*=256);)o+=this[t+--n]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*e)),o},_.prototype.readInt8=function(t,e){return e||V(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},_.prototype.readInt16LE=function(t,e){e||V(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},_.prototype.readInt16BE=function(t,e){e||V(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},_.prototype.readInt32LE=function(t,e){return e||V(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},_.prototype.readInt32BE=function(t,e){return e||V(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},_.prototype.readFloatLE=function(t,e){return e||V(t,4,this.length),p(this,t,!0,23,4)},_.prototype.readFloatBE=function(t,e){return e||V(t,4,this.length),p(this,t,!1,23,4)},_.prototype.readDoubleLE=function(t,e){return e||V(t,8,this.length),p(this,t,!0,52,8)},_.prototype.readDoubleBE=function(t,e){return e||V(t,8,this.length),p(this,t,!1,52,8)},_.prototype.writeUIntLE=function(t,e,r,n){(t=+t,e|=0,r|=0,n)||W(this,t,e,r,Math.pow(2,8*r)-1,0);var i=1,o=0;for(this[e]=255&t;++o<r&&(i*=256);)this[e+o]=t/i&255;return e+r},_.prototype.writeUIntBE=function(t,e,r,n){(t=+t,e|=0,r|=0,n)||W(this,t,e,r,Math.pow(2,8*r)-1,0);var i=r-1,o=1;for(this[e+i]=255&t;--i>=0&&(o*=256);)this[e+i]=t/o&255;return e+r},_.prototype.writeUInt8=function(t,e,r){return t=+t,e|=0,r||W(this,t,e,1,255,0),_.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=255&t,e+1},_.prototype.writeUInt16LE=function(t,e,r){return t=+t,e|=0,r||W(this,t,e,2,65535,0),_.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):J(this,t,e,!0),e+2},_.prototype.writeUInt16BE=function(t,e,r){return t=+t,e|=0,r||W(this,t,e,2,65535,0),_.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):J(this,t,e,!1),e+2},_.prototype.writeUInt32LE=function(t,e,r){return t=+t,e|=0,r||W(this,t,e,4,4294967295,0),_.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t):Z(this,t,e,!0),e+4},_.prototype.writeUInt32BE=function(t,e,r){return t=+t,e|=0,r||W(this,t,e,4,4294967295,0),_.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):Z(this,t,e,!1),e+4},_.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e|=0,!n){var i=Math.pow(2,8*r-1);W(this,t,e,r,i-1,-i)}var o=0,s=1,a=0;for(this[e]=255&t;++o<r&&(s*=256);)t<0&&0===a&&0!==this[e+o-1]&&(a=1),this[e+o]=(t/s|0)-a&255;return e+r},_.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e|=0,!n){var i=Math.pow(2,8*r-1);W(this,t,e,r,i-1,-i)}var o=r-1,s=1,a=0;for(this[e+o]=255&t;--o>=0&&(s*=256);)t<0&&0===a&&0!==this[e+o+1]&&(a=1),this[e+o]=(t/s|0)-a&255;return e+r},_.prototype.writeInt8=function(t,e,r){return t=+t,e|=0,r||W(this,t,e,1,127,-128),_.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=255&t,e+1},_.prototype.writeInt16LE=function(t,e,r){return t=+t,e|=0,r||W(this,t,e,2,32767,-32768),_.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):J(this,t,e,!0),e+2},_.prototype.writeInt16BE=function(t,e,r){return t=+t,e|=0,r||W(this,t,e,2,32767,-32768),_.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):J(this,t,e,!1),e+2},_.prototype.writeInt32LE=function(t,e,r){return t=+t,e|=0,r||W(this,t,e,4,2147483647,-2147483648),_.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):Z(this,t,e,!0),e+4},_.prototype.writeInt32BE=function(t,e,r){return t=+t,e|=0,r||W(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),_.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):Z(this,t,e,!1),e+4},_.prototype.writeFloatLE=function(t,e,r){return X(this,t,e,!0,r)},_.prototype.writeFloatBE=function(t,e,r){return X(this,t,e,!1,r)},_.prototype.writeDoubleLE=function(t,e,r){return $(this,t,e,!0,r)},_.prototype.writeDoubleBE=function(t,e,r){return $(this,t,e,!1,r)},_.prototype.copy=function(t,e,r,n){if(r||(r=0),n||0===n||(n=this.length),e>=t.length&&(e=t.length),e||(e=0),n>0&&n<r&&(n=r),n===r)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-e<n-r&&(n=t.length-e+r);var i,o=n-r;if(this===t&&r<e&&e<n)for(i=o-1;i>=0;--i)t[i+e]=this[i+r];else if(o<1e3||!_.TYPED_ARRAY_SUPPORT)for(i=0;i<o;++i)t[i+e]=this[i+r];else Uint8Array.prototype.set.call(t,this.subarray(r,r+o),e);return o},_.prototype.fill=function(t,e,r,n){if("string"==typeof t){if("string"==typeof e?(n=e,e=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),1===t.length){var i=t.charCodeAt(0);i<256&&(t=i)}if(void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!_.isEncoding(n))throw new TypeError("Unknown encoding: "+n)}else"number"==typeof t&&(t&=255);if(e<0||this.length<e||this.length<r)throw new RangeError("Out of range index");if(r<=e)return this;var o;if(e>>>=0,r=void 0===r?this.length:r>>>0,t||(t=0),"number"==typeof t)for(o=e;o<r;++o)this[o]=t;else{var s=x(t)?t:et(new _(t,n).toString()),a=s.length;for(o=0;o<r-e;++o)this[o+e]=s[o%a]}return this};var Q=/[^+\/0-9A-Za-z-_]/g;function tt(t){return t<16?"0"+t.toString(16):t.toString(16)}function et(t,e){var r;e=e||1/0;for(var n=t.length,i=null,o=[],s=0;s<n;++s){if((r=t.charCodeAt(s))>55295&&r<57344){if(!i){if(r>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(s+1===n){(e-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(e-=3)>-1&&o.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((e-=1)<0)break;o.push(r)}else if(r<2048){if((e-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function rt(t){return function(t){var e,r,n,i,o,s;h||c();var f=t.length;if(f%4>0)throw new Error("Invalid string. Length must be a multiple of 4");o="="===t[f-2]?2:"="===t[f-1]?1:0,s=new u(3*f/4-o),n=o>0?f-4:f;var l=0;for(e=0,r=0;e<n;e+=4,r+=3)i=a[t.charCodeAt(e)]<<18|a[t.charCodeAt(e+1)]<<12|a[t.charCodeAt(e+2)]<<6|a[t.charCodeAt(e+3)],s[l++]=i>>16&255,s[l++]=i>>8&255,s[l++]=255&i;return 2===o?(i=a[t.charCodeAt(e)]<<2|a[t.charCodeAt(e+1)]>>4,s[l++]=255&i):1===o&&(i=a[t.charCodeAt(e)]<<10|a[t.charCodeAt(e+1)]<<4|a[t.charCodeAt(e+2)]>>2,s[l++]=i>>8&255,s[l++]=255&i),s}(function(t){if((t=function(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}(t).replace(Q,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function nt(t,e,r,n){for(var i=0;i<n&&!(i+r>=e.length||i>=t.length);++i)e[i+r]=t[i];return i}function it(t){return null!=t&&(!!t._isBuffer||ot(t)||function(t){return"function"==typeof t.readFloatLE&&"function"==typeof t.slice&&ot(t.slice(0,0))}(t))}function ot(t){return!!t.constructor&&"function"==typeof t.constructor.isBuffer&&t.constructor.isBuffer(t)}var st=n(Object.freeze({__proto__:null,Buffer:_,INSPECT_MAX_BYTES:50,SlowBuffer:function(t){return+t!=t&&(t=0),_.alloc(+t)},isBuffer:it,kMaxLength:b}));!function(t){!function(t,e){function r(t,e){if(!t)throw new Error(e||"Assertion failed")}function n(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function i(t,e,r){if(i.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(r=e,e=10),this._init(t||0,e||10,r||"be"))}var o;"object"==typeof t?t.exports=i:e.BN=i,i.BN=i,i.wordSize=26;try{o="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:st.Buffer}catch(t){}function s(t,e){var n=t.charCodeAt(e);return n>=48&&n<=57?n-48:n>=65&&n<=70?n-55:n>=97&&n<=102?n-87:void r(!1,"Invalid character in "+t)}function a(t,e,r){var n=s(t,r);return r-1>=e&&(n|=s(t,r-1)<<4),n}function u(t,e,n,i){for(var o=0,s=0,a=Math.min(t.length,n),u=e;u<a;u++){var h=t.charCodeAt(u)-48;o*=i,s=h>=49?h-49+10:h>=17?h-17+10:h,r(h>=0&&s<i,"Invalid character"),o+=s}return o}function h(t,e){t.words=e.words,t.length=e.length,t.negative=e.negative,t.red=e.red}if(i.isBN=function(t){return t instanceof i||null!==t&&"object"==typeof t&&t.constructor.wordSize===i.wordSize&&Array.isArray(t.words)},i.max=function(t,e){return t.cmp(e)>0?t:e},i.min=function(t,e){return t.cmp(e)<0?t:e},i.prototype._init=function(t,e,n){if("number"==typeof t)return this._initNumber(t,e,n);if("object"==typeof t)return this._initArray(t,e,n);"hex"===e&&(e=16),r(e===(0|e)&&e>=2&&e<=36);var i=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i<t.length&&(16===e?this._parseHex(t,i,n):(this._parseBase(t,e,i),"le"===n&&this._initArray(this.toArray(),e,n)))},i.prototype._initNumber=function(t,e,n){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(r(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===n&&this._initArray(this.toArray(),e,n)},i.prototype._initArray=function(t,e,n){if(r("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var i=0;i<this.length;i++)this.words[i]=0;var o,s,a=0;if("be"===n)for(i=t.length-1,o=0;i>=0;i-=3)s=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[o]|=s<<a&67108863,this.words[o+1]=s>>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);else if("le"===n)for(i=0,o=0;i<t.length;i+=3)s=t[i]|t[i+1]<<8|t[i+2]<<16,this.words[o]|=s<<a&67108863,this.words[o+1]=s>>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);return this._strip()},i.prototype._parseHex=function(t,e,r){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var n=0;n<this.length;n++)this.words[n]=0;var i,o=0,s=0;if("be"===r)for(n=t.length-1;n>=e;n-=2)i=a(t,e,n)<<o,this.words[s]|=67108863&i,o>=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;else for(n=(t.length-e)%2==0?e+1:e;n<t.length;n+=2)i=a(t,e,n)<<o,this.words[s]|=67108863&i,o>=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;this._strip()},i.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var n=0,i=1;i<=67108863;i*=e)n++;n--,i=i/e|0;for(var o=t.length-r,s=o%n,a=Math.min(o,o-s)+r,h=0,c=r;c<a;c+=n)h=u(t,c,c+n,e),this.imuln(i),this.words[0]+h<67108864?this.words[0]+=h:this._iaddn(h);if(0!==s){var f=1;for(h=u(t,c,t.length,e),c=0;c<s;c++)f*=e;this.imuln(f),this.words[0]+h<67108864?this.words[0]+=h:this._iaddn(h)}this._strip()},i.prototype.copy=function(t){t.words=new Array(this.length);for(var e=0;e<this.length;e++)t.words[e]=this.words[e];t.length=this.length,t.negative=this.negative,t.red=this.red},i.prototype._move=function(t){h(t,this)},i.prototype.clone=function(){var t=new i(null);return this.copy(t),t},i.prototype._expand=function(t){for(;this.length<t;)this.words[this.length++]=0;return this},i.prototype._strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},i.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for)try{i.prototype[Symbol.for("nodejs.util.inspect.custom")]=c}catch(t){i.prototype.inspect=c}else i.prototype.inspect=c;function c(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"}var f=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],l=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],d=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];i.prototype.toString=function(t,e){var n;if(e=0|e||1,16===(t=t||10)||"hex"===t){n="";for(var i=0,o=0,s=0;s<this.length;s++){var a=this.words[s],u=(16777215&(a<<i|o)).toString(16);o=a>>>24-i&16777215,(i+=2)>=26&&(i-=26,s--),n=0!==o||s!==this.length-1?f[6-u.length]+u+n:u+n}for(0!==o&&(n=o.toString(16)+n);n.length%e!==0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}if(t===(0|t)&&t>=2&&t<=36){var h=l[t],c=d[t];n="";var p=this.clone();for(p.negative=0;!p.isZero();){var m=p.modrn(c).toString(t);n=(p=p.idivn(c)).isZero()?m+n:f[h-m.length]+m+n}for(this.isZero()&&(n="0"+n);n.length%e!==0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}r(!1,"Base should be between 2 and 36")},i.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},i.prototype.toJSON=function(){return this.toString(16,2)},o&&(i.prototype.toBuffer=function(t,e){return this.toArrayLike(o,t,e)}),i.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)};function p(t,e,r){r.negative=e.negative^t.negative;var n=t.length+e.length|0;r.length=n,n=n-1|0;var i=0|t.words[0],o=0|e.words[0],s=i*o,a=67108863&s,u=s/67108864|0;r.words[0]=a;for(var h=1;h<n;h++){for(var c=u>>>26,f=67108863&u,l=Math.min(h,e.length-1),d=Math.max(0,h-t.length+1);d<=l;d++){var p=h-d|0;c+=(s=(i=0|t.words[p])*(o=0|e.words[d])+f)/67108864|0,f=67108863&s}r.words[h]=0|f,u=0|c}return 0!==u?r.words[h]=0|u:r.length--,r._strip()}i.prototype.toArrayLike=function(t,e,n){this._strip();var i=this.byteLength(),o=n||Math.max(1,i);r(i<=o,"byte array longer than desired length"),r(o>0,"Requested array length <= 0");var s=function(t,e){return t.allocUnsafe?t.allocUnsafe(e):new t(e)}(t,o);return this["_toArrayLike"+("le"===e?"LE":"BE")](s,i),s},i.prototype._toArrayLikeLE=function(t,e){for(var r=0,n=0,i=0,o=0;i<this.length;i++){var s=this.words[i]<<o|n;t[r++]=255&s,r<t.length&&(t[r++]=s>>8&255),r<t.length&&(t[r++]=s>>16&255),6===o?(r<t.length&&(t[r++]=s>>24&255),n=0,o=0):(n=s>>>24,o+=2)}if(r<t.length)for(t[r++]=n;r<t.length;)t[r++]=0},i.prototype._toArrayLikeBE=function(t,e){for(var r=t.length-1,n=0,i=0,o=0;i<this.length;i++){var s=this.words[i]<<o|n;t[r--]=255&s,r>=0&&(t[r--]=s>>8&255),r>=0&&(t[r--]=s>>16&255),6===o?(r>=0&&(t[r--]=s>>24&255),n=0,o=0):(n=s>>>24,o+=2)}if(r>=0)for(t[r--]=n;r>=0;)t[r--]=0},Math.clz32?i.prototype._countBits=function(t){return 32-Math.clz32(t)}:i.prototype._countBits=function(t){var e=t,r=0;return e>=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},i.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 8191&e||(r+=13,e>>>=13),127&e||(r+=7,e>>>=7),15&e||(r+=4,e>>>=4),3&e||(r+=2,e>>>=2),1&e||r++,r},i.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;e<this.length;e++){var r=this._zeroBits(this.words[e]);if(t+=r,26!==r)break}return t},i.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},i.prototype.toTwos=function(t){return 0!==this.negative?this.abs().inotn(t).iaddn(1):this.clone()},i.prototype.fromTwos=function(t){return this.testn(t-1)?this.notn(t).iaddn(1).ineg():this.clone()},i.prototype.isNeg=function(){return 0!==this.negative},i.prototype.neg=function(){return this.clone().ineg()},i.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},i.prototype.iuor=function(t){for(;this.length<t.length;)this.words[this.length++]=0;for(var e=0;e<t.length;e++)this.words[e]=this.words[e]|t.words[e];return this._strip()},i.prototype.ior=function(t){return r(0===(this.negative|t.negative)),this.iuor(t)},i.prototype.or=function(t){return this.length>t.length?this.clone().ior(t):t.clone().ior(this)},i.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},i.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;r<e.length;r++)this.words[r]=this.words[r]&t.words[r];return this.length=e.length,this._strip()},i.prototype.iand=function(t){return r(0===(this.negative|t.negative)),this.iuand(t)},i.prototype.and=function(t){return this.length>t.length?this.clone().iand(t):t.clone().iand(this)},i.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},i.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var n=0;n<r.length;n++)this.words[n]=e.words[n]^r.words[n];if(this!==e)for(;n<e.length;n++)this.words[n]=e.words[n];return this.length=e.length,this._strip()},i.prototype.ixor=function(t){return r(0===(this.negative|t.negative)),this.iuxor(t)},i.prototype.xor=function(t){return this.length>t.length?this.clone().ixor(t):t.clone().ixor(this)},i.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},i.prototype.inotn=function(t){r("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),n=t%26;this._expand(e),n>0&&e--;for(var i=0;i<e;i++)this.words[i]=67108863&~this.words[i];return n>0&&(this.words[i]=~this.words[i]&67108863>>26-n),this._strip()},i.prototype.notn=function(t){return this.clone().inotn(t)},i.prototype.setn=function(t,e){r("number"==typeof t&&t>=0);var n=t/26|0,i=t%26;return this._expand(n+1),this.words[n]=e?this.words[n]|1<<i:this.words[n]&~(1<<i),this._strip()},i.prototype.iadd=function(t){var e,r,n;if(0!==this.negative&&0===t.negative)return this.negative=0,e=this.isub(t),this.negative^=1,this._normSign();if(0===this.negative&&0!==t.negative)return t.negative=0,e=this.isub(t),t.negative=1,e._normSign();this.length>t.length?(r=this,n=t):(r=t,n=this);for(var i=0,o=0;o<n.length;o++)e=(0|r.words[o])+(0|n.words[o])+i,this.words[o]=67108863&e,i=e>>>26;for(;0!==i&&o<r.length;o++)e=(0|r.words[o])+i,this.words[o]=67108863&e,i=e>>>26;if(this.length=r.length,0!==i)this.words[this.length]=i,this.length++;else if(r!==this)for(;o<r.length;o++)this.words[o]=r.words[o];return this},i.prototype.add=function(t){var e;return 0!==t.negative&&0===this.negative?(t.negative=0,e=this.sub(t),t.negative^=1,e):0===t.negative&&0!==this.negative?(this.negative=0,e=t.sub(this),this.negative=1,e):this.length>t.length?this.clone().iadd(t):t.clone().iadd(this)},i.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,n,i=this.cmp(t);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(r=this,n=t):(r=t,n=this);for(var o=0,s=0;s<n.length;s++)o=(e=(0|r.words[s])-(0|n.words[s])+o)>>26,this.words[s]=67108863&e;for(;0!==o&&s<r.length;s++)o=(e=(0|r.words[s])+o)>>26,this.words[s]=67108863&e;if(0===o&&s<r.length&&r!==this)for(;s<r.length;s++)this.words[s]=r.words[s];return this.length=Math.max(this.length,s),r!==this&&(this.negative=1),this._strip()},i.prototype.sub=function(t){return this.clone().isub(t)};var m=function(t,e,r){var n,i,o,s=t.words,a=e.words,u=r.words,h=0,c=0|s[0],f=8191&c,l=c>>>13,d=0|s[1],p=8191&d,m=d>>>13,g=0|s[2],y=8191&g,b=g>>>13,v=0|s[3],w=8191&v,_=v>>>13,E=0|s[4],A=8191&E,M=E>>>13,S=0|s[5],k=8191&S,x=S>>>13,T=0|s[6],R=8191&T,B=T>>>13,N=0|s[7],P=8191&N,I=N>>>13,O=0|s[8],C=8191&O,L=O>>>13,j=0|s[9],D=8191&j,U=j>>>13,F=0|a[0],z=8191&F,q=F>>>13,H=0|a[1],K=8191&H,G=H>>>13,V=0|a[2],W=8191&V,J=V>>>13,Z=0|a[3],Y=8191&Z,X=Z>>>13,$=0|a[4],Q=8191&$,tt=$>>>13,et=0|a[5],rt=8191&et,nt=et>>>13,it=0|a[6],ot=8191&it,st=it>>>13,at=0|a[7],ut=8191&at,ht=at>>>13,ct=0|a[8],ft=8191&ct,lt=ct>>>13,dt=0|a[9],pt=8191&dt,mt=dt>>>13;r.negative=t.negative^e.negative,r.length=19;var gt=(h+(n=Math.imul(f,z))|0)+((8191&(i=(i=Math.imul(f,q))+Math.imul(l,z)|0))<<13)|0;h=((o=Math.imul(l,q))+(i>>>13)|0)+(gt>>>26)|0,gt&=67108863,n=Math.imul(p,z),i=(i=Math.imul(p,q))+Math.imul(m,z)|0,o=Math.imul(m,q);var yt=(h+(n=n+Math.imul(f,K)|0)|0)+((8191&(i=(i=i+Math.imul(f,G)|0)+Math.imul(l,K)|0))<<13)|0;h=((o=o+Math.imul(l,G)|0)+(i>>>13)|0)+(yt>>>26)|0,yt&=67108863,n=Math.imul(y,z),i=(i=Math.imul(y,q))+Math.imul(b,z)|0,o=Math.imul(b,q),n=n+Math.imul(p,K)|0,i=(i=i+Math.imul(p,G)|0)+Math.imul(m,K)|0,o=o+Math.imul(m,G)|0;var bt=(h+(n=n+Math.imul(f,W)|0)|0)+((8191&(i=(i=i+Math.imul(f,J)|0)+Math.imul(l,W)|0))<<13)|0;h=((o=o+Math.imul(l,J)|0)+(i>>>13)|0)+(bt>>>26)|0,bt&=67108863,n=Math.imul(w,z),i=(i=Math.imul(w,q))+Math.imul(_,z)|0,o=Math.imul(_,q),n=n+Math.imul(y,K)|0,i=(i=i+Math.imul(y,G)|0)+Math.imul(b,K)|0,o=o+Math.imul(b,G)|0,n=n+Math.imul(p,W)|0,i=(i=i+Math.imul(p,J)|0)+Math.imul(m,W)|0,o=o+Math.imul(m,J)|0;var vt=(h+(n=n+Math.imul(f,Y)|0)|0)+((8191&(i=(i=i+Math.imul(f,X)|0)+Math.imul(l,Y)|0))<<13)|0;h=((o=o+Math.imul(l,X)|0)+(i>>>13)|0)+(vt>>>26)|0,vt&=67108863,n=Math.imul(A,z),i=(i=Math.imul(A,q))+Math.imul(M,z)|0,o=Math.imul(M,q),n=n+Math.imul(w,K)|0,i=(i=i+Math.imul(w,G)|0)+Math.imul(_,K)|0,o=o+Math.imul(_,G)|0,n=n+Math.imul(y,W)|0,i=(i=i+Math.imul(y,J)|0)+Math.imul(b,W)|0,o=o+Math.imul(b,J)|0,n=n+Math.imul(p,Y)|0,i=(i=i+Math.imul(p,X)|0)+Math.imul(m,Y)|0,o=o+Math.imul(m,X)|0;var wt=(h+(n=n+Math.imul(f,Q)|0)|0)+((8191&(i=(i=i+Math.imul(f,tt)|0)+Math.imul(l,Q)|0))<<13)|0;h=((o=o+Math.imul(l,tt)|0)+(i>>>13)|0)+(wt>>>26)|0,wt&=67108863,n=Math.imul(k,z),i=(i=Math.imul(k,q))+Math.imul(x,z)|0,o=Math.imul(x,q),n=n+Math.imul(A,K)|0,i=(i=i+Math.imul(A,G)|0)+Math.imul(M,K)|0,o=o+Math.imul(M,G)|0,n=n+Math.imul(w,W)|0,i=(i=i+Math.imul(w,J)|0)+Math.imul(_,W)|0,o=o+Math.imul(_,J)|0,n=n+Math.imul(y,Y)|0,i=(i=i+Math.imul(y,X)|0)+Math.imul(b,Y)|0,o=o+Math.imul(b,X)|0,n=n+Math.imul(p,Q)|0,i=(i=i+Math.imul(p,tt)|0)+Math.imul(m,Q)|0,o=o+Math.imul(m,tt)|0;var _t=(h+(n=n+Math.imul(f,rt)|0)|0)+((8191&(i=(i=i+Math.imul(f,nt)|0)+Math.imul(l,rt)|0))<<13)|0;h=((o=o+Math.imul(l,nt)|0)+(i>>>13)|0)+(_t>>>26)|0,_t&=67108863,n=Math.imul(R,z),i=(i=Math.imul(R,q))+Math.imul(B,z)|0,o=Math.imul(B,q),n=n+Math.imul(k,K)|0,i=(i=i+Math.imul(k,G)|0)+Math.imul(x,K)|0,o=o+Math.imul(x,G)|0,n=n+Math.imul(A,W)|0,i=(i=i+Math.imul(A,J)|0)+Math.imul(M,W)|0,o=o+Math.imul(M,J)|0,n=n+Math.imul(w,Y)|0,i=(i=i+Math.imul(w,X)|0)+Math.imul(_,Y)|0,o=o+Math.imul(_,X)|0,n=n+Math.imul(y,Q)|0,i=(i=i+Math.imul(y,tt)|0)+Math.imul(b,Q)|0,o=o+Math.imul(b,tt)|0,n=n+Math.imul(p,rt)|0,i=(i=i+Math.imul(p,nt)|0)+Math.imul(m,rt)|0,o=o+Math.imul(m,nt)|0;var Et=(h+(n=n+Math.imul(f,ot)|0)|0)+((8191&(i=(i=i+Math.imul(f,st)|0)+Math.imul(l,ot)|0))<<13)|0;h=((o=o+Math.imul(l,st)|0)+(i>>>13)|0)+(Et>>>26)|0,Et&=67108863,n=Math.imul(P,z),i=(i=Math.imul(P,q))+Math.imul(I,z)|0,o=Math.imul(I,q),n=n+Math.imul(R,K)|0,i=(i=i+Math.imul(R,G)|0)+Math.imul(B,K)|0,o=o+Math.imul(B,G)|0,n=n+Math.imul(k,W)|0,i=(i=i+Math.imul(k,J)|0)+Math.imul(x,W)|0,o=o+Math.imul(x,J)|0,n=n+Math.imul(A,Y)|0,i=(i=i+Math.imul(A,X)|0)+Math.imul(M,Y)|0,o=o+Math.imul(M,X)|0,n=n+Math.imul(w,Q)|0,i=(i=i+Math.imul(w,tt)|0)+Math.imul(_,Q)|0,o=o+Math.imul(_,tt)|0,n=n+Math.imul(y,rt)|0,i=(i=i+Math.imul(y,nt)|0)+Math.imul(b,rt)|0,o=o+Math.imul(b,nt)|0,n=n+Math.imul(p,ot)|0,i=(i=i+Math.imul(p,st)|0)+Math.imul(m,ot)|0,o=o+Math.imul(m,st)|0;var At=(h+(n=n+Math.imul(f,ut)|0)|0)+((8191&(i=(i=i+Math.imul(f,ht)|0)+Math.imul(l,ut)|0))<<13)|0;h=((o=o+Math.imul(l,ht)|0)+(i>>>13)|0)+(At>>>26)|0,At&=67108863,n=Math.imul(C,z),i=(i=Math.imul(C,q))+Math.imul(L,z)|0,o=Math.imul(L,q),n=n+Math.imul(P,K)|0,i=(i=i+Math.imul(P,G)|0)+Math.imul(I,K)|0,o=o+Math.imul(I,G)|0,n=n+Math.imul(R,W)|0,i=(i=i+Math.imul(R,J)|0)+Math.imul(B,W)|0,o=o+Math.imul(B,J)|0,n=n+Math.imul(k,Y)|0,i=(i=i+Math.imul(k,X)|0)+Math.imul(x,Y)|0,o=o+Math.imul(x,X)|0,n=n+Math.imul(A,Q)|0,i=(i=i+Math.imul(A,tt)|0)+Math.imul(M,Q)|0,o=o+Math.imul(M,tt)|0,n=n+Math.imul(w,rt)|0,i=(i=i+Math.imul(w,nt)|0)+Math.imul(_,rt)|0,o=o+Math.imul(_,nt)|0,n=n+Math.imul(y,ot)|0,i=(i=i+Math.imul(y,st)|0)+Math.imul(b,ot)|0,o=o+Math.imul(b,st)|0,n=n+Math.imul(p,ut)|0,i=(i=i+Math.imul(p,ht)|0)+Math.imul(m,ut)|0,o=o+Math.imul(m,ht)|0;var Mt=(h+(n=n+Math.imul(f,ft)|0)|0)+((8191&(i=(i=i+Math.imul(f,lt)|0)+Math.imul(l,ft)|0))<<13)|0;h=((o=o+Math.imul(l,lt)|0)+(i>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,n=Math.imul(D,z),i=(i=Math.imul(D,q))+Math.imul(U,z)|0,o=Math.imul(U,q),n=n+Math.imul(C,K)|0,i=(i=i+Math.imul(C,G)|0)+Math.imul(L,K)|0,o=o+Math.imul(L,G)|0,n=n+Math.imul(P,W)|0,i=(i=i+Math.imul(P,J)|0)+Math.imul(I,W)|0,o=o+Math.imul(I,J)|0,n=n+Math.imul(R,Y)|0,i=(i=i+Math.imul(R,X)|0)+Math.imul(B,Y)|0,o=o+Math.imul(B,X)|0,n=n+Math.imul(k,Q)|0,i=(i=i+Math.imul(k,tt)|0)+Math.imul(x,Q)|0,o=o+Math.imul(x,tt)|0,n=n+Math.imul(A,rt)|0,i=(i=i+Math.imul(A,nt)|0)+Math.imul(M,rt)|0,o=o+Math.imul(M,nt)|0,n=n+Math.imul(w,ot)|0,i=(i=i+Math.imul(w,st)|0)+Math.imul(_,ot)|0,o=o+Math.imul(_,st)|0,n=n+Math.imul(y,ut)|0,i=(i=i+Math.imul(y,ht)|0)+Math.imul(b,ut)|0,o=o+Math.imul(b,ht)|0,n=n+Math.imul(p,ft)|0,i=(i=i+Math.imul(p,lt)|0)+Math.imul(m,ft)|0,o=o+Math.imul(m,lt)|0;var St=(h+(n=n+Math.imul(f,pt)|0)|0)+((8191&(i=(i=i+Math.imul(f,mt)|0)+Math.imul(l,pt)|0))<<13)|0;h=((o=o+Math.imul(l,mt)|0)+(i>>>13)|0)+(St>>>26)|0,St&=67108863,n=Math.imul(D,K),i=(i=Math.imul(D,G))+Math.imul(U,K)|0,o=Math.imul(U,G),n=n+Math.imul(C,W)|0,i=(i=i+Math.imul(C,J)|0)+Math.imul(L,W)|0,o=o+Math.imul(L,J)|0,n=n+Math.imul(P,Y)|0,i=(i=i+Math.imul(P,X)|0)+Math.imul(I,Y)|0,o=o+Math.imul(I,X)|0,n=n+Math.imul(R,Q)|0,i=(i=i+Math.imul(R,tt)|0)+Math.imul(B,Q)|0,o=o+Math.imul(B,tt)|0,n=n+Math.imul(k,rt)|0,i=(i=i+Math.imul(k,nt)|0)+Math.imul(x,rt)|0,o=o+Math.imul(x,nt)|0,n=n+Math.imul(A,ot)|0,i=(i=i+Math.imul(A,st)|0)+Math.imul(M,ot)|0,o=o+Math.imul(M,st)|0,n=n+Math.imul(w,ut)|0,i=(i=i+Math.imul(w,ht)|0)+Math.imul(_,ut)|0,o=o+Math.imul(_,ht)|0,n=n+Math.imul(y,ft)|0,i=(i=i+Math.imul(y,lt)|0)+Math.imul(b,ft)|0,o=o+Math.imul(b,lt)|0;var kt=(h+(n=n+Math.imul(p,pt)|0)|0)+((8191&(i=(i=i+Math.imul(p,mt)|0)+Math.imul(m,pt)|0))<<13)|0;h=((o=o+Math.imul(m,mt)|0)+(i>>>13)|0)+(kt>>>26)|0,kt&=67108863,n=Math.imul(D,W),i=(i=Math.imul(D,J))+Math.imul(U,W)|0,o=Math.imul(U,J),n=n+Math.imul(C,Y)|0,i=(i=i+Math.imul(C,X)|0)+Math.imul(L,Y)|0,o=o+Math.imul(L,X)|0,n=n+Math.imul(P,Q)|0,i=(i=i+Math.imul(P,tt)|0)+Math.imul(I,Q)|0,o=o+Math.imul(I,tt)|0,n=n+Math.imul(R,rt)|0,i=(i=i+Math.imul(R,nt)|0)+Math.imul(B,rt)|0,o=o+Math.imul(B,nt)|0,n=n+Math.imul(k,ot)|0,i=(i=i+Math.imul(k,st)|0)+Math.imul(x,ot)|0,o=o+Math.imul(x,st)|0,n=n+Math.imul(A,ut)|0,i=(i=i+Math.imul(A,ht)|0)+Math.imul(M,ut)|0,o=o+Math.imul(M,ht)|0,n=n+Math.imul(w,ft)|0,i=(i=i+Math.imul(w,lt)|0)+Math.imul(_,ft)|0,o=o+Math.imul(_,lt)|0;var xt=(h+(n=n+Math.imul(y,pt)|0)|0)+((8191&(i=(i=i+Math.imul(y,mt)|0)+Math.imul(b,pt)|0))<<13)|0;h=((o=o+Math.imul(b,mt)|0)+(i>>>13)|0)+(xt>>>26)|0,xt&=67108863,n=Math.imul(D,Y),i=(i=Math.imul(D,X))+Math.imul(U,Y)|0,o=Math.imul(U,X),n=n+Math.imul(C,Q)|0,i=(i=i+Math.imul(C,tt)|0)+Math.imul(L,Q)|0,o=o+Math.imul(L,tt)|0,n=n+Math.imul(P,rt)|0,i=(i=i+Math.imul(P,nt)|0)+Math.imul(I,rt)|0,o=o+Math.imul(I,nt)|0,n=n+Math.imul(R,ot)|0,i=(i=i+Math.imul(R,st)|0)+Math.imul(B,ot)|0,o=o+Math.imul(B,st)|0,n=n+Math.imul(k,ut)|0,i=(i=i+Math.imul(k,ht)|0)+Math.imul(x,ut)|0,o=o+Math.imul(x,ht)|0,n=n+Math.imul(A,ft)|0,i=(i=i+Math.imul(A,lt)|0)+Math.imul(M,ft)|0,o=o+Math.imul(M,lt)|0;var Tt=(h+(n=n+Math.imul(w,pt)|0)|0)+((8191&(i=(i=i+Math.imul(w,mt)|0)+Math.imul(_,pt)|0))<<13)|0;h=((o=o+Math.imul(_,mt)|0)+(i>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,n=Math.imul(D,Q),i=(i=Math.imul(D,tt))+Math.imul(U,Q)|0,o=Math.imul(U,tt),n=n+Math.imul(C,rt)|0,i=(i=i+Math.imul(C,nt)|0)+Math.imul(L,rt)|0,o=o+Math.imul(L,nt)|0,n=n+Math.imul(P,ot)|0,i=(i=i+Math.imul(P,st)|0)+Math.imul(I,ot)|0,o=o+Math.imul(I,st)|0,n=n+Math.imul(R,ut)|0,i=(i=i+Math.imul(R,ht)|0)+Math.imul(B,ut)|0,o=o+Math.imul(B,ht)|0,n=n+Math.imul(k,ft)|0,i=(i=i+Math.imul(k,lt)|0)+Math.imul(x,ft)|0,o=o+Math.imul(x,lt)|0;var Rt=(h+(n=n+Math.imul(A,pt)|0)|0)+((8191&(i=(i=i+Math.imul(A,mt)|0)+Math.imul(M,pt)|0))<<13)|0;h=((o=o+Math.imul(M,mt)|0)+(i>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,n=Math.imul(D,rt),i=(i=Math.imul(D,nt))+Math.imul(U,rt)|0,o=Math.imul(U,nt),n=n+Math.imul(C,ot)|0,i=(i=i+Math.imul(C,st)|0)+Math.imul(L,ot)|0,o=o+Math.imul(L,st)|0,n=n+Math.imul(P,ut)|0,i=(i=i+Math.imul(P,ht)|0)+Math.imul(I,ut)|0,o=o+Math.imul(I,ht)|0,n=n+Math.imul(R,ft)|0,i=(i=i+Math.imul(R,lt)|0)+Math.imul(B,ft)|0,o=o+Math.imul(B,lt)|0;var Bt=(h+(n=n+Math.imul(k,pt)|0)|0)+((8191&(i=(i=i+Math.imul(k,mt)|0)+Math.imul(x,pt)|0))<<13)|0;h=((o=o+Math.imul(x,mt)|0)+(i>>>13)|0)+(Bt>>>26)|0,Bt&=67108863,n=Math.imul(D,ot),i=(i=Math.imul(D,st))+Math.imul(U,ot)|0,o=Math.imul(U,st),n=n+Math.imul(C,ut)|0,i=(i=i+Math.imul(C,ht)|0)+Math.imul(L,ut)|0,o=o+Math.imul(L,ht)|0,n=n+Math.imul(P,ft)|0,i=(i=i+Math.imul(P,lt)|0)+Math.imul(I,ft)|0,o=o+Math.imul(I,lt)|0;var Nt=(h+(n=n+Math.imul(R,pt)|0)|0)+((8191&(i=(i=i+Math.imul(R,mt)|0)+Math.imul(B,pt)|0))<<13)|0;h=((o=o+Math.imul(B,mt)|0)+(i>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,n=Math.imul(D,ut),i=(i=Math.imul(D,ht))+Math.imul(U,ut)|0,o=Math.imul(U,ht),n=n+Math.imul(C,ft)|0,i=(i=i+Math.imul(C,lt)|0)+Math.imul(L,ft)|0,o=o+Math.imul(L,lt)|0;var Pt=(h+(n=n+Math.imul(P,pt)|0)|0)+((8191&(i=(i=i+Math.imul(P,mt)|0)+Math.imul(I,pt)|0))<<13)|0;h=((o=o+Math.imul(I,mt)|0)+(i>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,n=Math.imul(D,ft),i=(i=Math.imul(D,lt))+Math.imul(U,ft)|0,o=Math.imul(U,lt);var It=(h+(n=n+Math.imul(C,pt)|0)|0)+((8191&(i=(i=i+Math.imul(C,mt)|0)+Math.imul(L,pt)|0))<<13)|0;h=((o=o+Math.imul(L,mt)|0)+(i>>>13)|0)+(It>>>26)|0,It&=67108863;var Ot=(h+(n=Math.imul(D,pt))|0)+((8191&(i=(i=Math.imul(D,mt))+Math.imul(U,pt)|0))<<13)|0;return h=((o=Math.imul(U,mt))+(i>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,u[0]=gt,u[1]=yt,u[2]=bt,u[3]=vt,u[4]=wt,u[5]=_t,u[6]=Et,u[7]=At,u[8]=Mt,u[9]=St,u[10]=kt,u[11]=xt,u[12]=Tt,u[13]=Rt,u[14]=Bt,u[15]=Nt,u[16]=Pt,u[17]=It,u[18]=Ot,0!==h&&(u[19]=h,r.length++),r};function g(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var n=0,i=0,o=0;o<r.length-1;o++){var s=i;i=0;for(var a=67108863&n,u=Math.min(o,e.length-1),h=Math.max(0,o-t.length+1);h<=u;h++){var c=o-h,f=(0|t.words[c])*(0|e.words[h]),l=67108863&f;a=67108863&(l=l+a|0),i+=(s=(s=s+(f/67108864|0)|0)+(l>>>26)|0)>>>26,s&=67108863}r.words[o]=a,n=s,s=i}return 0!==n?r.words[o]=n:r.length--,r._strip()}function y(t,e,r){return g(t,e,r)}Math.imul||(m=p),i.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?m(this,t,e):r<63?p(this,t,e):r<1024?g(this,t,e):y(this,t,e)},i.prototype.mul=function(t){var e=new i(null);return e.words=new Array(this.length+t.length),this.mulTo(t,e)},i.prototype.mulf=function(t){var e=new i(null);return e.words=new Array(this.length+t.length),y(this,t,e)},i.prototype.imul=function(t){return this.clone().mulTo(t,this)},i.prototype.imuln=function(t){var e=t<0;e&&(t=-t),r("number"==typeof t),r(t<67108864);for(var n=0,i=0;i<this.length;i++){var o=(0|this.words[i])*t,s=(67108863&o)+(67108863&n);n>>=26,n+=o/67108864|0,n+=s>>>26,this.words[i]=67108863&s}return 0!==n&&(this.words[i]=n,this.length++),this.length=0===t?1:this.length,e?this.ineg():this},i.prototype.muln=function(t){return this.clone().imuln(t)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.imul(this.clone())},i.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r<e.length;r++){var n=r/26|0,i=r%26;e[r]=t.words[n]>>>i&1}return e}(t);if(0===e.length)return new i(1);for(var r=this,n=0;n<e.length&&0===e[n];n++,r=r.sqr());if(++n<e.length)for(var o=r.sqr();n<e.length;n++,o=o.sqr())0!==e[n]&&(r=r.mul(o));return r},i.prototype.iushln=function(t){r("number"==typeof t&&t>=0);var e,n=t%26,i=(t-n)/26,o=67108863>>>26-n<<26-n;if(0!==n){var s=0;for(e=0;e<this.length;e++){var a=this.words[e]&o,u=(0|this.words[e])-a<<n;this.words[e]=u|s,s=a>>>26-n}s&&(this.words[e]=s,this.length++)}if(0!==i){for(e=this.length-1;e>=0;e--)this.words[e+i]=this.words[e];for(e=0;e<i;e++)this.words[e]=0;this.length+=i}return this._strip()},i.prototype.ishln=function(t){return r(0===this.negative),this.iushln(t)},i.prototype.iushrn=function(t,e,n){var i;r("number"==typeof t&&t>=0),i=e?(e-e%26)/26:0;var o=t%26,s=Math.min((t-o)/26,this.length),a=67108863^67108863>>>o<<o,u=n;if(i-=s,i=Math.max(0,i),u){for(var h=0;h<s;h++)u.words[h]=this.words[h];u.length=s}if(0===s);else if(this.length>s)for(this.length-=s,h=0;h<this.length;h++)this.words[h]=this.words[h+s];else this.words[0]=0,this.length=1;var c=0;for(h=this.length-1;h>=0&&(0!==c||h>=i);h--){var f=0|this.words[h];this.words[h]=c<<26-o|f>>>o,c=f&a}return u&&0!==c&&(u.words[u.length++]=c),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},i.prototype.ishrn=function(t,e,n){return r(0===this.negative),this.iushrn(t,e,n)},i.prototype.shln=function(t){return this.clone().ishln(t)},i.prototype.ushln=function(t){return this.clone().iushln(t)},i.prototype.shrn=function(t){return this.clone().ishrn(t)},i.prototype.ushrn=function(t){return this.clone().iushrn(t)},i.prototype.testn=function(t){r("number"==typeof t&&t>=0);var e=t%26,n=(t-e)/26,i=1<<e;return!(this.length<=n)&&!!(this.words[n]&i)},i.prototype.imaskn=function(t){r("number"==typeof t&&t>=0);var e=t%26,n=(t-e)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=n)return this;if(0!==e&&n++,this.length=Math.min(n,this.length),0!==e){var i=67108863^67108863>>>e<<e;this.words[this.length-1]&=i}return this._strip()},i.prototype.maskn=function(t){return this.clone().imaskn(t)},i.prototype.iaddn=function(t){return r("number"==typeof t),r(t<67108864),t<0?this.isubn(-t):0!==this.negative?1===this.length&&(0|this.words[0])<=t?(this.words[0]=t-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(t),this.negative=1,this):this._iaddn(t)},i.prototype._iaddn=function(t){this.words[0]+=t;for(var e=0;e<this.length&&this.words[e]>=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},i.prototype.isubn=function(t){if(r("number"==typeof t),r(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e<this.length&&this.words[e]<0;e++)this.words[e]+=67108864,this.words[e+1]-=1;return this._strip()},i.prototype.addn=function(t){return this.clone().iaddn(t)},i.prototype.subn=function(t){return this.clone().isubn(t)},i.prototype.iabs=function(){return this.negative=0,this},i.prototype.abs=function(){return this.clone().iabs()},i.prototype._ishlnsubmul=function(t,e,n){var i,o,s=t.length+n;this._expand(s);var a=0;for(i=0;i<t.length;i++){o=(0|this.words[i+n])+a;var u=(0|t.words[i])*e;a=((o-=67108863&u)>>26)-(u/67108864|0),this.words[i+n]=67108863&o}for(;i<this.length-n;i++)a=(o=(0|this.words[i+n])+a)>>26,this.words[i+n]=67108863&o;if(0===a)return this._strip();for(r(-1===a),a=0,i=0;i<this.length;i++)a=(o=-(0|this.words[i])+a)>>26,this.words[i]=67108863&o;return this.negative=1,this._strip()},i.prototype._wordDiv=function(t,e){var r=(this.length,t.length),n=this.clone(),o=t,s=0|o.words[o.length-1];0!==(r=26-this._countBits(s))&&(o=o.ushln(r),n.iushln(r),s=0|o.words[o.length-1]);var a,u=n.length-o.length;if("mod"!==e){(a=new i(null)).length=u+1,a.words=new Array(a.length);for(var h=0;h<a.length;h++)a.words[h]=0}var c=n.clone()._ishlnsubmul(o,1,u);0===c.negative&&(n=c,a&&(a.words[u]=1));for(var f=u-1;f>=0;f--){var l=67108864*(0|n.words[o.length+f])+(0|n.words[o.length+f-1]);for(l=Math.min(l/s|0,67108863),n._ishlnsubmul(o,l,f);0!==n.negative;)l--,n.negative=0,n._ishlnsubmul(o,1,f),n.isZero()||(n.negative^=1);a&&(a.words[f]=l)}return a&&a._strip(),n._strip(),"div"!==e&&0!==r&&n.iushrn(r),{div:a||null,mod:n}},i.prototype.divmod=function(t,e,n){return r(!t.isZero()),this.isZero()?{div:new i(0),mod:new i(0)}:0!==this.negative&&0===t.negative?(a=this.neg().divmod(t,e),"mod"!==e&&(o=a.div.neg()),"div"!==e&&(s=a.mod.neg(),n&&0!==s.negative&&s.iadd(t)),{div:o,mod:s}):0===this.negative&&0!==t.negative?(a=this.divmod(t.neg(),e),"mod"!==e&&(o=a.div.neg()),{div:o,mod:a.mod}):0!==(this.negative&t.negative)?(a=this.neg().divmod(t.neg(),e),"div"!==e&&(s=a.mod.neg(),n&&0!==s.negative&&s.isub(t)),{div:a.div,mod:s}):t.length>this.length||this.cmp(t)<0?{div:new i(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new i(this.modrn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new i(this.modrn(t.words[0]))}:this._wordDiv(t,e);var o,s,a},i.prototype.div=function(t){return this.divmod(t,"div",!1).div},i.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},i.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},i.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,n=t.ushrn(1),i=t.andln(1),o=r.cmp(n);return o<0||1===i&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},i.prototype.modrn=function(t){var e=t<0;e&&(t=-t),r(t<=67108863);for(var n=(1<<26)%t,i=0,o=this.length-1;o>=0;o--)i=(n*i+(0|this.words[o]))%t;return e?-i:i},i.prototype.modn=function(t){return this.modrn(t)},i.prototype.idivn=function(t){var e=t<0;e&&(t=-t),r(t<=67108863);for(var n=0,i=this.length-1;i>=0;i--){var o=(0|this.words[i])+67108864*n;this.words[i]=o/t|0,n=o%t}return this._strip(),e?this.ineg():this},i.prototype.divn=function(t){return this.clone().idivn(t)},i.prototype.egcd=function(t){r(0===t.negative),r(!t.isZero());var e=this,n=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var o=new i(1),s=new i(0),a=new i(0),u=new i(1),h=0;e.isEven()&&n.isEven();)e.iushrn(1),n.iushrn(1),++h;for(var c=n.clone(),f=e.clone();!e.isZero();){for(var l=0,d=1;0===(e.words[0]&d)&&l<26;++l,d<<=1);if(l>0)for(e.iushrn(l);l-- >0;)(o.isOdd()||s.isOdd())&&(o.iadd(c),s.isub(f)),o.iushrn(1),s.iushrn(1);for(var p=0,m=1;0===(n.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(n.iushrn(p);p-- >0;)(a.isOdd()||u.isOdd())&&(a.iadd(c),u.isub(f)),a.iushrn(1),u.iushrn(1);e.cmp(n)>=0?(e.isub(n),o.isub(a),s.isub(u)):(n.isub(e),a.isub(o),u.isub(s))}return{a:a,b:u,gcd:n.iushln(h)}},i.prototype._invmp=function(t){r(0===t.negative),r(!t.isZero());var e=this,n=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var o,s=new i(1),a=new i(0),u=n.clone();e.cmpn(1)>0&&n.cmpn(1)>0;){for(var h=0,c=1;0===(e.words[0]&c)&&h<26;++h,c<<=1);if(h>0)for(e.iushrn(h);h-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);for(var f=0,l=1;0===(n.words[0]&l)&&f<26;++f,l<<=1);if(f>0)for(n.iushrn(f);f-- >0;)a.isOdd()&&a.iadd(u),a.iushrn(1);e.cmp(n)>=0?(e.isub(n),s.isub(a)):(n.isub(e),a.isub(s))}return(o=0===e.cmpn(1)?s:a).cmpn(0)<0&&o.iadd(t),o},i.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var n=0;e.isEven()&&r.isEven();n++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var i=e.cmp(r);if(i<0){var o=e;e=r,r=o}else if(0===i||0===r.cmpn(1))break;e.isub(r)}return r.iushln(n)},i.prototype.invm=function(t){return this.egcd(t).a.umod(t)},i.prototype.isEven=function(){return!(1&this.words[0])},i.prototype.isOdd=function(){return!(1&~this.words[0])},i.prototype.andln=function(t){return this.words[0]&t},i.prototype.bincn=function(t){r("number"==typeof t);var e=t%26,n=(t-e)/26,i=1<<e;if(this.length<=n)return this._expand(n+1),this.words[n]|=i,this;for(var o=i,s=n;0!==o&&s<this.length;s++){var a=0|this.words[s];o=(a+=o)>>>26,a&=67108863,this.words[s]=a}return 0!==o&&(this.words[s]=o,this.length++),this},i.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},i.prototype.cmpn=function(t){var e,n=t<0;if(0!==this.negative&&!n)return-1;if(0===this.negative&&n)return 1;if(this._strip(),this.length>1)e=1;else{n&&(t=-t),r(t<=67108863,"Number is too big");var i=0|this.words[0];e=i===t?0:i<t?-1:1}return 0!==this.negative?0|-e:e},i.prototype.cmp=function(t){if(0!==this.negative&&0===t.negative)return-1;if(0===this.negative&&0!==t.negative)return 1;var e=this.ucmp(t);return 0!==this.negative?0|-e:e},i.prototype.ucmp=function(t){if(this.length>t.length)return 1;if(this.length<t.length)return-1;for(var e=0,r=this.length-1;r>=0;r--){var n=0|this.words[r],i=0|t.words[r];if(n!==i){n<i?e=-1:n>i&&(e=1);break}}return e},i.prototype.gtn=function(t){return 1===this.cmpn(t)},i.prototype.gt=function(t){return 1===this.cmp(t)},i.prototype.gten=function(t){return this.cmpn(t)>=0},i.prototype.gte=function(t){return this.cmp(t)>=0},i.prototype.ltn=function(t){return-1===this.cmpn(t)},i.prototype.lt=function(t){return-1===this.cmp(t)},i.prototype.lten=function(t){return this.cmpn(t)<=0},i.prototype.lte=function(t){return this.cmp(t)<=0},i.prototype.eqn=function(t){return 0===this.cmpn(t)},i.prototype.eq=function(t){return 0===this.cmp(t)},i.red=function(t){return new M(t)},i.prototype.toRed=function(t){return r(!this.red,"Already a number in reduction context"),r(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},i.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function(t){return this.red=t,this},i.prototype.forceRed=function(t){return r(!this.red,"Already a number in reduction context"),this._forceRed(t)},i.prototype.redAdd=function(t){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},i.prototype.redIAdd=function(t){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},i.prototype.redSub=function(t){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},i.prototype.redISub=function(t){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},i.prototype.redShl=function(t){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},i.prototype.redMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},i.prototype.redIMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},i.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(t){return r(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var b={k256:null,p224:null,p192:null,p25519:null};function v(t,e){this.name=t,this.p=new i(e,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function w(){v.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function _(){v.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function E(){v.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function A(){v.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function M(t){if("string"==typeof t){var e=i._prime(t);this.m=e.p,this.prime=e}else r(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function S(t){M.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new i(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}v.prototype._tmp=function(){var t=new i(null);return t.words=new Array(Math.ceil(this.n/13)),t},v.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(e>this.n);var n=e<this.n?-1:r.ucmp(this.p);return 0===n?(r.words[0]=0,r.length=1):n>0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},v.prototype.split=function(t,e){t.iushrn(this.n,0,e)},v.prototype.imulK=function(t){return t.imul(this.k)},n(w,v),w.prototype.split=function(t,e){for(var r=4194303,n=Math.min(t.length,9),i=0;i<n;i++)e.words[i]=t.words[i];if(e.length=n,t.length<=9)return t.words[0]=0,void(t.length=1);var o=t.words[9];for(e.words[e.length++]=o&r,i=10;i<t.length;i++){var s=0|t.words[i];t.words[i-10]=(s&r)<<4|o>>>22,o=s}o>>>=22,t.words[i-10]=o,0===o&&t.length>10?t.length-=10:t.length-=9},w.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r<t.length;r++){var n=0|t.words[r];e+=977*n,t.words[r]=67108863&e,e=64*n+(e/67108864|0)}return 0===t.words[t.length-1]&&(t.length--,0===t.words[t.length-1]&&t.length--),t},n(_,v),n(E,v),n(A,v),A.prototype.imulK=function(t){for(var e=0,r=0;r<t.length;r++){var n=19*(0|t.words[r])+e,i=67108863&n;n>>>=26,t.words[r]=i,e=n}return 0!==e&&(t.words[t.length++]=e),t},i._prime=function(t){if(b[t])return b[t];var e;if("k256"===t)e=new w;else if("p224"===t)e=new _;else if("p192"===t)e=new E;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new A}return b[t]=e,e},M.prototype._verify1=function(t){r(0===t.negative,"red works only with positives"),r(t.red,"red works only with red numbers")},M.prototype._verify2=function(t,e){r(0===(t.negative|e.negative),"red works only with positives"),r(t.red&&t.red===e.red,"red works only with red numbers")},M.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):(h(t,t.umod(this.m)._forceRed(this)),t)},M.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},M.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},M.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},M.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},M.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},M.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},M.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},M.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},M.prototype.isqr=function(t){return this.imul(t,t.clone())},M.prototype.sqr=function(t){return this.mul(t,t)},M.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(r(e%2==1),3===e){var n=this.m.add(new i(1)).iushrn(2);return this.pow(t,n)}for(var o=this.m.subn(1),s=0;!o.isZero()&&0===o.andln(1);)s++,o.iushrn(1);r(!o.isZero());var a=new i(1).toRed(this),u=a.redNeg(),h=this.m.subn(1).iushrn(1),c=this.m.bitLength();for(c=new i(2*c*c).toRed(this);0!==this.pow(c,h).cmp(u);)c.redIAdd(u);for(var f=this.pow(c,o),l=this.pow(t,o.addn(1).iushrn(1)),d=this.pow(t,o),p=s;0!==d.cmp(a);){for(var m=d,g=0;0!==m.cmp(a);g++)m=m.redSqr();r(g<p);var y=this.pow(f,new i(1).iushln(p-g-1));l=l.redMul(y),f=y.redSqr(),d=d.redMul(f),p=g}return l},M.prototype.invm=function(t){var e=t._invmp(this.m);return 0!==e.negative?(e.negative=0,this.imod(e).redNeg()):this.imod(e)},M.prototype.pow=function(t,e){if(e.isZero())return new i(1).toRed(this);if(0===e.cmpn(1))return t.clone();var r=new Array(16);r[0]=new i(1).toRed(this),r[1]=t;for(var n=2;n<r.length;n++)r[n]=this.mul(r[n-1],t);var o=r[0],s=0,a=0,u=e.bitLength()%26;for(0===u&&(u=26),n=e.length-1;n>=0;n--){for(var h=e.words[n],c=u-1;c>=0;c--){var f=h>>c&1;o!==r[0]&&(o=this.sqr(o)),0!==f||0!==s?(s<<=1,s|=f,(4===++a||0===n&&0===c)&&(o=this.mul(o,r[s]),a=0,s=0)):a=0}u=26}return o},M.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},M.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},i.mont=function(t){return new S(t)},n(S,M),S.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},S.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},S.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},S.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new i(0)._forceRed(this);var r=t.mul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=r.isub(n).iushrn(this.shift),s=o;return o.cmp(this.m)>=0?s=o.isub(this.m):o.cmpn(0)<0&&(s=o.iadd(this.m)),s._forceRed(this)},S.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t,e)}(i);var at=r(i.exports);let ut=!1,ht=!1;const ct={debug:1,default:2,info:2,warning:3,error:4,off:5};let ft=ct.default,lt=null;const dt=function(){try{const t=[];if(["NFD","NFC","NFKD","NFKC"].forEach(e=>{try{if("test"!=="test".normalize(e))throw new Error("bad normalize")}catch(r){t.push(e)}}),t.length)throw new Error("missing "+t.join(", "));if(String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769))throw new Error("broken implementation")}catch(t){return t.message}return null}();var pt,mt;!function(t){t.DEBUG="DEBUG",t.INFO="INFO",t.WARNING="WARNING",t.ERROR="ERROR",t.OFF="OFF"}(pt||(pt={})),function(t){t.UNKNOWN_ERROR="UNKNOWN_ERROR",t.NOT_IMPLEMENTED="NOT_IMPLEMENTED",t.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",t.NETWORK_ERROR="NETWORK_ERROR",t.SERVER_ERROR="SERVER_ERROR",t.TIMEOUT="TIMEOUT",t.BUFFER_OVERRUN="BUFFER_OVERRUN",t.NUMERIC_FAULT="NUMERIC_FAULT",t.MISSING_NEW="MISSING_NEW",t.INVALID_ARGUMENT="INVALID_ARGUMENT",t.MISSING_ARGUMENT="MISSING_ARGUMENT",t.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",t.CALL_EXCEPTION="CALL_EXCEPTION",t.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",t.NONCE_EXPIRED="NONCE_EXPIRED",t.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",t.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",t.TRANSACTION_REPLACED="TRANSACTION_REPLACED",t.ACTION_REJECTED="ACTION_REJECTED"}(mt||(mt={}));const gt="0123456789abcdef";class yt{constructor(t){Object.defineProperty(this,"version",{enumerable:!0,value:t,writable:!1})}_log(t,e){const r=t.toLowerCase();null==ct[r]&&this.throwArgumentError("invalid log level name","logLevel",t),ft>ct[r]||console.log.apply(console,e)}debug(...t){this._log(yt.levels.DEBUG,t)}info(...t){this._log(yt.levels.INFO,t)}warn(...t){this._log(yt.levels.WARNING,t)}makeError(t,e,r){if(ht)return this.makeError("censored error",e,{});e||(e=yt.errors.UNKNOWN_ERROR),r||(r={});const n=[];Object.keys(r).forEach(t=>{const e=r[t];try{if(e instanceof Uint8Array){let r="";for(let t=0;t<e.length;t++)r+=gt[e[t]>>4],r+=gt[15&e[t]];n.push(t+"=Uint8Array(0x"+r+")")}else n.push(t+"="+JSON.stringify(e))}catch(e){n.push(t+"="+JSON.stringify(r[t].toString()))}}),n.push(`code=${e}`),n.push(`version=${this.version}`);const i=t;let o="";switch(e){case mt.NUMERIC_FAULT:{o="NUMERIC_FAULT";const e=t;switch(e){case"overflow":case"underflow":case"division-by-zero":o+="-"+e;break;case"negative-power":case"negative-width":o+="-unsupported";break;case"unbound-bitwise-result":o+="-unbound-result"}break}case mt.CALL_EXCEPTION:case mt.INSUFFICIENT_FUNDS:case mt.MISSING_NEW:case mt.NONCE_EXPIRED:case mt.REPLACEMENT_UNDERPRICED:case mt.TRANSACTION_REPLACED:case mt.UNPREDICTABLE_GAS_LIMIT:o=e}o&&(t+=" [ See: https://links.ethers.org/v5-errors-"+o+" ]"),n.length&&(t+=" ("+n.join(", ")+")");const s=new Error(t);return s.reason=i,s.code=e,Object.keys(r).forEach(function(t){s[t]=r[t]}),s}throwError(t,e,r){throw this.makeError(t,e,r)}throwArgumentError(t,e,r){return this.throwError(t,yt.errors.INVALID_ARGUMENT,{argument:e,value:r})}assert(t,e,r,n){t||this.throwError(e,r,n)}assertArgument(t,e,r,n){t||this.throwArgumentError(e,r,n)}checkNormalize(t){dt&&this.throwError("platform missing String.prototype.normalize",yt.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:dt})}checkSafeUint53(t,e){"number"==typeof t&&(null==e&&(e="value not safe"),(t<0||t>=9007199254740991)&&this.throwError(e,yt.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:t}),t%1&&this.throwError(e,yt.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:t}))}checkArgumentCount(t,e,r){r=r?": "+r:"",t<e&&this.throwError("missing argument"+r,yt.errors.MISSING_ARGUMENT,{count:t,expectedCount:e}),t>e&&this.throwError("too many arguments"+r,yt.errors.UNEXPECTED_ARGUMENT,{count:t,expectedCount:e})}checkNew(t,e){t!==Object&&null!=t||this.throwError("missing new",yt.errors.MISSING_NEW,{name:e.name})}checkAbstract(t,e){t===e?this.throwError("cannot instantiate abstract class "+JSON.stringify(e.name)+" directly; use a sub-class",yt.errors.UNSUPPORTED_OPERATION,{name:t.name,operation:"new"}):t!==Object&&null!=t||this.throwError("missing new",yt.errors.MISSING_NEW,{name:e.name})}static globalLogger(){return lt||(lt=new yt("logger/5.8.0")),lt}static setCensorship(t,e){if(!t&&e&&this.globalLogger().throwError("cannot permanently disable censorship",yt.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),ut){if(!t)return;this.globalLogger().throwError("error censorship permanent",yt.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}ht=!!t,ut=!!e}static setLogLevel(t){const e=ct[t.toLowerCase()];null!=e?ft=e:yt.globalLogger().warn("invalid log level - "+t)}static from(t){return new yt(t)}}yt.errors=mt,yt.levels=pt;const bt=new yt("bytes/5.8.0");function vt(t){return!!t.toHexString}function wt(t){return t.slice||(t.slice=function(){const e=Array.prototype.slice.call(arguments);return wt(new Uint8Array(Array.prototype.slice.apply(t,e)))}),t}function _t(t){return Tt(t)&&!(t.length%2)||At(t)}function Et(t){return"number"==typeof t&&t==t&&t%1==0}function At(t){if(null==t)return!1;if(t.constructor===Uint8Array)return!0;if("string"==typeof t)return!1;if(!Et(t.length)||t.length<0)return!1;for(let e=0;e<t.length;e++){const r=t[e];if(!Et(r)||r<0||r>=256)return!1}return!0}function Mt(t,e){if(e||(e={}),"number"==typeof t){bt.checkSafeUint53(t,"invalid arrayify value");const e=[];for(;t;)e.unshift(255&t),t=parseInt(String(t/256));return 0===e.length&&e.push(0),wt(new Uint8Array(e))}if(e.allowMissingPrefix&&"string"==typeof t&&"0x"!==t.substring(0,2)&&(t="0x"+t),vt(t)&&(t=t.toHexString()),Tt(t)){let r=t.substring(2);r.length%2&&("left"===e.hexPad?r="0"+r:"right"===e.hexPad?r+="0":bt.throwArgumentError("hex data is odd-length","value",t));const n=[];for(let t=0;t<r.length;t+=2)n.push(parseInt(r.substring(t,t+2),16));return wt(new Uint8Array(n))}return At(t)?wt(new Uint8Array(t)):bt.throwArgumentError("invalid arrayify value","value",t)}function St(t){const e=t.map(t=>Mt(t)),r=e.reduce((t,e)=>t+e.length,0),n=new Uint8Array(r);return e.reduce((t,e)=>(n.set(e,t),t+e.length),0),wt(n)}function kt(t){let e=Mt(t);if(0===e.length)return e;let r=0;for(;r<e.length&&0===e[r];)r++;return r&&(e=e.slice(r)),e}function xt(t,e){(t=Mt(t)).length>e&&bt.throwArgumentError("value out of range","value",arguments[0]);const r=new Uint8Array(e);return r.set(t,e-t.length),wt(r)}function Tt(t,e){return!("string"!=typeof t||!t.match(/^0x[0-9A-Fa-f]*$/))&&(!e||t.length===2+2*e)}const Rt="0123456789abcdef";function Bt(t,e){if(e||(e={}),"number"==typeof t){bt.checkSafeUint53(t,"invalid hexlify value");let e="";for(;t;)e=Rt[15&t]+e,t=Math.floor(t/16);return e.length?(e.length%2&&(e="0"+e),"0x"+e):"0x00"}if("bigint"==typeof t)return(t=t.toString(16)).length%2?"0x0"+t:"0x"+t;if(e.allowMissingPrefix&&"string"==typeof t&&"0x"!==t.substring(0,2)&&(t="0x"+t),vt(t))return t.toHexString();if(Tt(t))return t.length%2&&("left"===e.hexPad?t="0x0"+t.substring(2):"right"===e.hexPad?t+="0":bt.throwArgumentError("hex data is odd-length","value",t)),t.toLowerCase();if(At(t)){let e="0x";for(let r=0;r<t.length;r++){let n=t[r];e+=Rt[(240&n)>>4]+Rt[15&n]}return e}return bt.throwArgumentError("invalid hexlify value","value",t)}function Nt(t){if("string"!=typeof t)t=Bt(t);else if(!Tt(t)||t.length%2)return null;return(t.length-2)/2}function Pt(t,e,r){return"string"!=typeof t?t=Bt(t):(!Tt(t)||t.length%2)&&bt.throwArgumentError("invalid hexData","value",t),e=2+2*e,null!=r?"0x"+t.substring(e,2+2*r):"0x"+t.substring(e)}function It(t){let e="0x";return t.forEach(t=>{e+=Bt(t).substring(2)}),e}function Ot(t){const e=Ct(Bt(t,{hexPad:"left"}));return"0x"===e?"0x0":e}function Ct(t){"string"!=typeof t&&(t=Bt(t)),Tt(t)||bt.throwArgumentError("invalid hex string","value",t),t=t.substring(2);let e=0;for(;e<t.length&&"0"===t[e];)e++;return"0x"+t.substring(e)}function Lt(t,e){for("string"!=typeof t?t=Bt(t):Tt(t)||bt.throwArgumentError("invalid hex string","value",t),t.length>2*e+2&&bt.throwArgumentError("value out of range","value",arguments[1]);t.length<2*e+2;)t="0x0"+t.substring(2);return t}function jt(t){const e={r:"0x",s:"0x",_vs:"0x",recoveryParam:0,v:0,yParityAndS:"0x",compact:"0x"};if(_t(t)){let r=Mt(t);64===r.length?(e.v=27+(r[32]>>7),r[32]&=127,e.r=Bt(r.slice(0,32)),e.s=Bt(r.slice(32,64))):65===r.length?(e.r=Bt(r.slice(0,32)),e.s=Bt(r.slice(32,64)),e.v=r[64]):bt.throwArgumentError("invalid signature string","signature",t),e.v<27&&(0===e.v||1===e.v?e.v+=27:bt.throwArgumentError("signature invalid v byte","signature",t)),e.recoveryParam=1-e.v%2,e.recoveryParam&&(r[32]|=128),e._vs=Bt(r.slice(32,64))}else{if(e.r=t.r,e.s=t.s,e.v=t.v,e.recoveryParam=t.recoveryParam,e._vs=t._vs,null!=e._vs){const r=xt(Mt(e._vs),32);e._vs=Bt(r);const n=r[0]>=128?1:0;null==e.recoveryParam?e.recoveryParam=n:e.recoveryParam!==n&&bt.throwArgumentError("signature recoveryParam mismatch _vs","signature",t),r[0]&=127;const i=Bt(r);null==e.s?e.s=i:e.s!==i&&bt.throwArgumentError("signature v mismatch _vs","signature",t)}if(null==e.recoveryParam)null==e.v?bt.throwArgumentError("signature missing v and recoveryParam","signature",t):0===e.v||1===e.v?e.recoveryParam=e.v:e.recoveryParam=1-e.v%2;else if(null==e.v)e.v=27+e.recoveryParam;else{const r=0===e.v||1===e.v?e.v:1-e.v%2;e.recoveryParam!==r&&bt.throwArgumentError("signature recoveryParam mismatch v","signature",t)}null!=e.r&&Tt(e.r)?e.r=Lt(e.r,32):bt.throwArgumentError("signature missing or invalid r","signature",t),null!=e.s&&Tt(e.s)?e.s=Lt(e.s,32):bt.throwArgumentError("signature missing or invalid s","signature",t);const r=Mt(e.s);r[0]>=128&&bt.throwArgumentError("signature s out of range","signature",t),e.recoveryParam&&(r[0]|=128);const n=Bt(r);e._vs&&(Tt(e._vs)||bt.throwArgumentError("signature invalid _vs","signature",t),e._vs=Lt(e._vs,32)),null==e._vs?e._vs=n:e._vs!==n&&bt.throwArgumentError("signature _vs mismatch v and s","signature",t)}return e.yParityAndS=e._vs,e.compact=e.r+e.yParityAndS.substring(2),e}function Dt(t){return Bt(St([(t=jt(t)).r,t.s,t.recoveryParam?"0x1c":"0x1b"]))}const Ut="bignumber/5.8.0";var Ft=at.BN;const zt=new yt(Ut),qt={},Ht=9007199254740991;let Kt=!1,Gt=class t{constructor(t,e){t!==qt&&zt.throwError("cannot call constructor directly; use BigNumber.from",yt.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=e,this._isBigNumber=!0,Object.freeze(this)}fromTwos(t){return Wt(Jt(this).fromTwos(t))}toTwos(t){return Wt(Jt(this).toTwos(t))}abs(){return"-"===this._hex[0]?t.from(this._hex.substring(1)):this}add(t){return Wt(Jt(this).add(Jt(t)))}sub(t){return Wt(Jt(this).sub(Jt(t)))}div(e){return t.from(e).isZero()&&Zt("division-by-zero","div"),Wt(Jt(this).div(Jt(e)))}mul(t){return Wt(Jt(this).mul(Jt(t)))}mod(t){const e=Jt(t);return e.isNeg()&&Zt("division-by-zero","mod"),Wt(Jt(this).umod(e))}pow(t){const e=Jt(t);return e.isNeg()&&Zt("negative-power","pow"),Wt(Jt(this).pow(e))}and(t){const e=Jt(t);return(this.isNegative()||e.isNeg())&&Zt("unbound-bitwise-result","and"),Wt(Jt(this).and(e))}or(t){const e=Jt(t);return(this.isNegative()||e.isNeg())&&Zt("unbound-bitwise-result","or"),Wt(Jt(this).or(e))}xor(t){const e=Jt(t);return(this.isNegative()||e.isNeg())&&Zt("unbound-bitwise-result","xor"),Wt(Jt(this).xor(e))}mask(t){return(this.isNegative()||t<0)&&Zt("negative-width","mask"),Wt(Jt(this).maskn(t))}shl(t){return(this.isNegative()||t<0)&&Zt("negative-width","shl"),Wt(Jt(this).shln(t))}shr(t){return(this.isNegative()||t<0)&&Zt("negative-width","shr"),Wt(Jt(this).shrn(t))}eq(t){return Jt(this).eq(Jt(t))}lt(t){return Jt(this).lt(Jt(t))}lte(t){return Jt(this).lte(Jt(t))}gt(t){return Jt(this).gt(Jt(t))}gte(t){return Jt(this).gte(Jt(t))}isNegative(){return"-"===this._hex[0]}isZero(){return Jt(this).isZero()}toNumber(){try{return Jt(this).toNumber()}catch(t){Zt("overflow","toNumber",this.toString())}return null}toBigInt(){try{return BigInt(this.toString())}catch(t){}return zt.throwError("this platform does not support BigInt",yt.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}toString(){return arguments.length>0&&(10===arguments[0]?Kt||(Kt=!0,zt.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):16===arguments[0]?zt.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",yt.errors.UNEXPECTED_ARGUMENT,{}):zt.throwError("BigNumber.toString does not accept parameters",yt.errors.UNEXPECTED_ARGUMENT,{})),Jt(this).toString(10)}toHexString(){return this._hex}toJSON(t){return{type:"BigNumber",hex:this.toHexString()}}static from(e){if(e instanceof t)return e;if("string"==typeof e)return e.match(/^-?0x[0-9a-f]+$/i)?new t(qt,Vt(e)):e.match(/^-?[0-9]+$/)?new t(qt,Vt(new Ft(e))):zt.throwArgumentError("invalid BigNumber string","value",e);if("number"==typeof e)return e%1&&Zt("underflow","BigNumber.from",e),(e>=Ht||e<=-Ht)&&Zt("overflow","BigNumber.from",e),t.from(String(e));const r=e;if("bigint"==typeof r)return t.from(r.toString());if(At(r))return t.from(Bt(r));if(r)if(r.toHexString){const e=r.toHexString();if("string"==typeof e)return t.from(e)}else{let e=r._hex;if(null==e&&"BigNumber"===r.type&&(e=r.hex),"string"==typeof e&&(Tt(e)||"-"===e[0]&&Tt(e.substring(1))))return t.from(e)}return zt.throwArgumentError("invalid BigNumber value","value",e)}static isBigNumber(t){return!(!t||!t._isBigNumber)}};function Vt(t){if("string"!=typeof t)return Vt(t.toString(16));if("-"===t[0])return"-"===(t=t.substring(1))[0]&&zt.throwArgumentError("invalid hex","value",t),"0x00"===(t=Vt(t))?t:"-"+t;if("0x"!==t.substring(0,2)&&(t="0x"+t),"0x"===t)return"0x00";for(t.length%2&&(t="0x0"+t.substring(2));t.length>4&&"0x00"===t.substring(0,4);)t="0x"+t.substring(4);return t}function Wt(t){return Gt.from(Vt(t))}function Jt(t){const e=Gt.from(t).toHexString();return"-"===e[0]?new Ft("-"+e.substring(3),16):new Ft(e.substring(2),16)}function Zt(t,e,r){const n={fault:t,operation:e};return null!=r&&(n.value=r),zt.throwError(t,yt.errors.NUMERIC_FAULT,n)}const Yt=new yt(Ut),Xt={},$t=Gt.from(0),Qt=Gt.from(-1);function te(t,e,r,n){const i={fault:e,operation:r};return void 0!==n&&(i.value=n),Yt.throwError(t,yt.errors.NUMERIC_FAULT,i)}let ee="0";for(;ee.length<256;)ee+=ee;function re(t){if("number"!=typeof t)try{t=Gt.from(t).toNumber()}catch(t){}return"number"==typeof t&&t>=0&&t<=256&&!(t%1)?"1"+ee.substring(0,t):Yt.throwArgumentError("invalid decimal size","decimals",t)}function ne(t,e){null==e&&(e=0);const r=re(e),n=(t=Gt.from(t)).lt($t);n&&(t=t.mul(Qt));let i=t.mod(r).toString();for(;i.length<r.length-1;)i="0"+i;i=i.match(/^([0-9]*[1-9]|0)(0*)/)[1];const o=t.div(r).toString();return t=1===r.length?o:o+"."+i,n&&(t="-"+t),t}function ie(t,e){null==e&&(e=0);const r=re(e);"string"==typeof t&&t.match(/^-?[0-9.]+$/)||Yt.throwArgumentError("invalid decimal value","value",t);const n="-"===t.substring(0,1);n&&(t=t.substring(1)),"."===t&&Yt.throwArgumentError("missing value","value",t);const i=t.split(".");i.length>2&&Yt.throwArgumentError("too many decimal points","value",t);let o=i[0],s=i[1];for(o||(o="0"),s||(s="0");"0"===s[s.length-1];)s=s.substring(0,s.length-1);for(s.length>r.length-1&&te("fractional component exceeds decimals","underflow","parseFixed"),""===s&&(s="0");s.length<r.length-1;)s+="0";const a=Gt.from(o),u=Gt.from(s);let h=a.mul(r).add(u);return n&&(h=h.mul(Qt)),h}class oe{constructor(t,e,r,n){t!==Xt&&Yt.throwError("cannot use FixedFormat constructor; use FixedFormat.from",yt.errors.UNSUPPORTED_OPERATION,{operation:"new FixedFormat"}),this.signed=e,this.width=r,this.decimals=n,this.name=(e?"":"u")+"fixed"+String(r)+"x"+String(n),this._multiplier=re(n),Object.freeze(this)}static from(t){if(t instanceof oe)return t;"number"==typeof t&&(t=`fixed128x${t}`);let e=!0,r=128,n=18;if("string"==typeof t)if("fixed"===t);else if("ufixed"===t)e=!1;else{const i=t.match(/^(u?)fixed([0-9]+)x([0-9]+)$/);i||Yt.throwArgumentError("invalid fixed format","format",t),e="u"!==i[1],r=parseInt(i[2]),n=parseInt(i[3])}else if(t){const i=(e,r,n)=>null==t[e]?n:(typeof t[e]!==r&&Yt.throwArgumentError("invalid fixed format ("+e+" not "+r+")","format."+e,t[e]),t[e]);e=i("signed","boolean",e),r=i("width","number",r),n=i("decimals","number",n)}return r%8&&Yt.throwArgumentError("invalid fixed format width (not byte aligned)","format.width",r),n>80&&Yt.throwArgumentError("invalid fixed format (decimals too large)","format.decimals",n),new oe(Xt,e,r,n)}}class se{constructor(t,e,r,n){t!==Xt&&Yt.throwError("cannot use FixedNumber constructor; use FixedNumber.from",yt.errors.UNSUPPORTED_OPERATION,{operation:"new FixedFormat"}),this.format=n,this._hex=e,this._value=r,this._isFixedNumber=!0,Object.freeze(this)}_checkFormat(t){this.format.name!==t.format.name&&Yt.throwArgumentError("incompatible format; use fixedNumber.toFormat","other",t)}addUnsafe(t){this._checkFormat(t);const e=ie(this._value,this.format.decimals),r=ie(t._value,t.format.decimals);return se.fromValue(e.add(r),this.format.decimals,this.format)}subUnsafe(t){this._checkFormat(t);const e=ie(this._value,this.format.decimals),r=ie(t._value,t.format.decimals);return se.fromValue(e.sub(r),this.format.decimals,this.format)}mulUnsafe(t){this._checkFormat(t);const e=ie(this._value,this.format.decimals),r=ie(t._value,t.format.decimals);return se.fromValue(e.mul(r).div(this.format._multiplier),this.format.decimals,this.format)}divUnsafe(t){this._checkFormat(t);const e=ie(this._value,this.format.decimals),r=ie(t._value,t.format.decimals);return se.fromValue(e.mul(this.format._multiplier).div(r),this.format.decimals,this.format)}floor(){const t=this.toString().split(".");1===t.length&&t.push("0");let e=se.from(t[0],this.format);const r=!t[1].match(/^(0*)$/);return this.isNegative()&&r&&(e=e.subUnsafe(ae.toFormat(e.format))),e}ceiling(){const t=this.toString().split(".");1===t.length&&t.push("0");let e=se.from(t[0],this.format);const r=!t[1].match(/^(0*)$/);return!this.isNegative()&&r&&(e=e.addUnsafe(ae.toFormat(e.format))),e}round(t){null==t&&(t=0);const e=this.toString().split(".");if(1===e.length&&e.push("0"),(t<0||t>80||t%1)&&Yt.throwArgumentError("invalid decimal count","decimals",t),e[1].length<=t)return this;const r=se.from("1"+ee.substring(0,t),this.format),n=ue.toFormat(this.format);return this.mulUnsafe(r).addUnsafe(n).floor().divUnsafe(r)}isZero(){return"0.0"===this._value||"0"===this._value}isNegative(){return"-"===this._value[0]}toString(){return this._value}toHexString(t){if(null==t)return this._hex;t%8&&Yt.throwArgumentError("invalid byte width","width",t);return Lt(Gt.from(this._hex).fromTwos(this.format.width).toTwos(t).toHexString(),t/8)}toUnsafeFloat(){return parseFloat(this.toString())}toFormat(t){return se.fromString(this._value,t)}static fromValue(t,e,r){return null!=r||null==e||function(t){return null!=t&&(Gt.isBigNumber(t)||"number"==typeof t&&t%1==0||"string"==typeof t&&!!t.match(/^-?[0-9]+$/)||Tt(t)||"bigint"==typeof t||At(t))}(e)||(r=e,e=null),null==e&&(e=0),null==r&&(r="fixed"),se.fromString(ne(t,e),oe.from(r))}static fromString(t,e){null==e&&(e="fixed");const r=oe.from(e),n=ie(t,r.decimals);!r.signed&&n.lt($t)&&te("unsigned value cannot be negative","overflow","value",t);let i=null;r.signed?i=n.toTwos(r.width).toHexString():(i=n.toHexString(),i=Lt(i,r.width/8));const o=ne(n,r.decimals);return new se(Xt,i,o,r)}static fromBytes(t,e){null==e&&(e="fixed");const r=oe.from(e);if(Mt(t).length>r.width/8)throw new Error("overflow");let n=Gt.from(t);r.signed&&(n=n.fromTwos(r.width));const i=n.toTwos((r.signed?0:1)+r.width).toHexString(),o=ne(n,r.decimals);return new se(Xt,i,o,r)}static from(t,e){if("string"==typeof t)return se.fromString(t,e);if(At(t))return se.fromBytes(t,e);try{return se.fromValue(t,0,e)}catch(t){if(t.code!==yt.errors.INVALID_ARGUMENT)throw t}return Yt.throwArgumentError("invalid FixedNumber value","value",t)}static isFixedNumber(t){return!(!t||!t._isFixedNumber)}}const ae=se.from(1),ue=se.from("0.5");var he=function(t,e,r,n){return new(r||(r=Promise))(function(i,o){function s(t){try{u(n.next(t))}catch(t){o(t)}}function a(t){try{u(n.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r(function(t){t(e)})).then(s,a)}u((n=n.apply(t,e||[])).next())})};const ce=new yt("properties/5.8.0");function fe(t,e,r){Object.defineProperty(t,e,{enumerable:!0,value:r,writable:!1})}function le(t,e){for(let r=0;r<32;r++){if(t[e])return t[e];if(!t.prototype||"object"!=typeof t.prototype)break;t=Object.getPrototypeOf(t.prototype).constructor}return null}function de(t){return he(this,void 0,void 0,function*(){const e=Object.keys(t).map(e=>{const r=t[e];return Promise.resolve(r).then(t=>({key:e,value:t}))});return(yield Promise.all(e)).reduce((t,e)=>(t[e.key]=e.value,t),{})})}function pe(t,e){t&&"object"==typeof t||ce.throwArgumentError("invalid object","object",t),Object.keys(t).forEach(r=>{e[r]||ce.throwArgumentError("invalid object key - "+r,"transaction:"+r,t)})}function me(t){const e={};for(const r in t)e[r]=t[r];return e}const ge={bigint:!0,boolean:!0,function:!0,number:!0,string:!0};function ye(t){if(null==t||ge[typeof t])return!0;if(Array.isArray(t)||"object"==typeof t){if(!Object.isFrozen(t))return!1;const e=Object.keys(t);for(let r=0;r<e.length;r++){let n=null;try{n=t[e[r]]}catch(t){continue}if(!ye(n))return!1}return!0}return ce.throwArgumentError("Cannot deepCopy "+typeof t,"object",t)}function be(t){if(ye(t))return t;if(Array.isArray(t))return Object.freeze(t.map(t=>ve(t)));if("object"==typeof t){const e={};for(const r in t){const n=t[r];void 0!==n&&fe(e,r,ve(n))}return e}return ce.throwArgumentError("Cannot deepCopy "+typeof t,"object",t)}function ve(t){return be(t)}class we{constructor(t){for(const e in t)this[e]=ve(t[e])}}var _e=function(t,e,r,n){return new(r||(r=Promise))(function(i,o){function s(t){try{u(n.next(t))}catch(t){o(t)}}function a(t){try{u(n.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r(function(t){t(e)})).then(s,a)}u((n=n.apply(t,e||[])).next())})};const Ee=new yt("abstract-provider/5.8.0");class Ae extends we{static isForkEvent(t){return!(!t||!t._isForkEvent)}}class Me{constructor(){Ee.checkAbstract(new.target,Me),fe(this,"_isProvider",!0)}getFeeData(){return _e(this,void 0,void 0,function*(){const{block:t,gasPrice:e}=yield de({block:this.getBlock("latest"),gasPrice:this.getGasPrice().catch(t=>null)});let r=null,n=null,i=null;return t&&t.baseFeePerGas&&(r=t.baseFeePerGas,i=Gt.from("1500000000"),n=t.baseFeePerGas.mul(2).add(i)),{lastBaseFeePerGas:r,maxFeePerGas:n,maxPriorityFeePerGas:i,gasPrice:e}})}addListener(t,e){return this.on(t,e)}removeListener(t,e){return this.off(t,e)}static isProvider(t){return!(!t||!t._isProvider)}}const Se=new yt("networks/5.8.0");function ke(t){const e=function(e,r){null==r&&(r={});const n=[];if(e.InfuraProvider&&"-"!==r.infura)try{n.push(new e.InfuraProvider(t,r.infura))}catch(t){}if(e.EtherscanProvider&&"-"!==r.etherscan)try{n.push(new e.EtherscanProvider(t,r.etherscan))}catch(t){}if(e.AlchemyProvider&&"-"!==r.alchemy)try{n.push(new e.AlchemyProvider(t,r.alchemy))}catch(t){}if(e.PocketProvider&&"-"!==r.pocket){const i=["goerli","ropsten","rinkeby","sepolia"];try{const o=new e.PocketProvider(t,r.pocket);o.network&&-1===i.indexOf(o.network.name)&&n.push(o)}catch(t){}}if(e.CloudflareProvider&&"-"!==r.cloudflare)try{n.push(new e.CloudflareProvider(t))}catch(t){}if(e.AnkrProvider&&"-"!==r.ankr)try{const i=["ropsten"],o=new e.AnkrProvider(t,r.ankr);o.network&&-1===i.indexOf(o.network.name)&&n.push(o)}catch(t){}if(e.QuickNodeProvider&&"-"!==r.quicknode)try{n.push(new e.QuickNodeProvider(t,r.quicknode))}catch(t){}if(0===n.length)return null;if(e.FallbackProvider){let i=1;return null!=r.quorum?i=r.quorum:"homestead"===t&&(i=2),new e.FallbackProvider(n,i)}return n[0]};return e.renetwork=function(t){return ke(t)},e}function xe(t,e){const r=function(r,n){return r.JsonRpcProvider?new r.JsonRpcProvider(t,e):null};return r.renetwork=function(e){return xe(t,e)},r}const Te={chainId:1,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"homestead",_defaultProvider:ke("homestead")},Re={chainId:3,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"ropsten",_defaultProvider:ke("ropsten")},Be={chainId:63,name:"classicMordor",_defaultProvider:xe("https://www.ethercluster.com/mordor","classicMordor")},Ne={unspecified:{chainId:0,name:"unspecified"},homestead:Te,mainnet:Te,morden:{chainId:2,name:"morden"},ropsten:Re,testnet:Re,rinkeby:{chainId:4,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"rinkeby",_defaultProvider:ke("rinkeby")},kovan:{chainId:42,name:"kovan",_defaultProvider:ke("kovan")},goerli:{chainId:5,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"goerli",_defaultProvider:ke("goerli")},kintsugi:{chainId:1337702,name:"kintsugi"},sepolia:{chainId:11155111,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"sepolia",_defaultProvider:ke("sepolia")},holesky:{chainId:17e3,name:"holesky",_defaultProvider:ke("holesky")},classic:{chainId:61,name:"classic",_defaultProvider:xe("https://www.ethercluster.com/etc","classic")},classicMorden:{chainId:62,name:"classicMorden"},classicMordor:Be,classicTestnet:Be,classicKotti:{chainId:6,name:"classicKotti",_defaultProvider:xe("https://www.ethercluster.com/kotti","classicKotti")},xdai:{chainId:100,name:"xdai"},matic:{chainId:137,name:"matic",_defaultProvider:ke("matic")},maticmum:{chainId:80001,name:"maticmum",_defaultProvider:ke("maticmum")},optimism:{chainId:10,name:"optimism",_defaultProvider:ke("optimism")},"optimism-kovan":{chainId:69,name:"optimism-kovan"},"optimism-goerli":{chainId:420,name:"optimism-goerli"},"optimism-sepolia":{chainId:11155420,name:"optimism-sepolia"},arbitrum:{chainId:42161,name:"arbitrum"},"arbitrum-rinkeby":{chainId:421611,name:"arbitrum-rinkeby"},"arbitrum-goerli":{chainId:421613,name:"arbitrum-goerli"},"arbitrum-sepolia":{chainId:421614,name:"arbitrum-sepolia"},bnb:{chainId:56,name:"bnb"},bnbt:{chainId:97,name:"bnbt"}};function Pe(t){if(null==t)return null;if("number"==typeof t){for(const e in Ne){const r=Ne[e];if(r.chainId===t)return{name:r.name,chainId:r.chainId,ensAddress:r.ensAddress||null,_defaultProvider:r._defaultProvider||null}}return{chainId:t,name:"unknown"}}if("string"==typeof t){const e=Ne[t];return null==e?null:{name:e.name,chainId:e.chainId,ensAddress:e.ensAddress,_defaultProvider:e._defaultProvider||null}}const e=Ne[t.name];if(!e)return"number"!=typeof t.chainId&&Se.throwArgumentError("invalid network chainId","network",t),t;0!==t.chainId&&t.chainId!==e.chainId&&Se.throwArgumentError("network chainId mismatch","network",t);let r=t._defaultProvider||null;var n;return null==r&&e._defaultProvider&&(r=(n=e._defaultProvider)&&"function"==typeof n.renetwork?e._defaultProvider.renetwork(t):e._defaultProvider),{name:t.name,chainId:e.chainId,ensAddress:t.ensAddress||e.ensAddress||null,_defaultProvider:r}}function Ie(t){t=atob(t);const e=[];for(let r=0;r<t.length;r++)e.push(t.charCodeAt(r));return Mt(e)}function Oe(t){t=Mt(t);let e="";for(let r=0;r<t.length;r++)e+=String.fromCharCode(t[r]);return btoa(e)}var Ce=Object.freeze({__proto__:null,decode:Ie,encode:Oe});class Le{constructor(t){fe(this,"alphabet",t),fe(this,"base",t.length),fe(this,"_alphabetMap",{}),fe(this,"_leader",t.charAt(0));for(let e=0;e<t.length;e++)this._alphabetMap[t.charAt(e)]=e}encode(t){let e=Mt(t);if(0===e.length)return"";let r=[0];for(let t=0;t<e.length;++t){let n=e[t];for(let t=0;t<r.length;++t)n+=r[t]<<8,r[t]=n%this.base,n=n/this.base|0;for(;n>0;)r.push(n%this.base),n=n/this.base|0}let n="";for(let t=0;0===e[t]&&t<e.length-1;++t)n+=this._leader;for(let t=r.length-1;t>=0;--t)n+=this.alphabet[r[t]];return n}decode(t){if("string"!=typeof t)throw new TypeError("Expected String");let e=[];if(0===t.length)return new Uint8Array(e);e.push(0);for(let r=0;r<t.length;r++){let n=this._alphabetMap[t[r]];if(void 0===n)throw new Error("Non-base"+this.base+" character");let i=n;for(let t=0;t<e.length;++t)i+=e[t]*this.base,e[t]=255&i,i>>=8;for(;i>0;)e.push(255&i),i>>=8}for(let r=0;t[r]===this._leader&&r<t.length-1;++r)e.push(0);return Mt(new Uint8Array(e.reverse()))}}new Le("abcdefghijklmnopqrstuvwxyz234567");const je=new Le("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"),De="0x0000000000000000000000000000000000000000",Ue=Gt.from(-1),Fe=Gt.from(0),ze=Gt.from(1),qe=Gt.from(2),He=Gt.from("1000000000000000000"),Ke=Gt.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),Ge=Gt.from("-0x8000000000000000000000000000000000000000000000000000000000000000"),Ve=Gt.from("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),We="0x0000000000000000000000000000000000000000000000000000000000000000";var Je=Object.freeze({__proto__:null,AddressZero:De,EtherSymbol:"Ξ",HashZero:We,MaxInt256:Ve,MaxUint256:Ke,MinInt256:Ge,NegativeOne:Ue,One:ze,Two:qe,WeiPerEther:He,Zero:Fe});function Ze(){throw new Error("setTimeout has not been defined")}function Ye(){throw new Error("clearTimeout has not been defined")}var Xe=Ze,$e=Ye;function Qe(t){if(Xe===setTimeout)return setTimeout(t,0);if((Xe===Ze||!Xe)&&setTimeout)return Xe=setTimeout,setTimeout(t,0);try{return Xe(t,0)}catch(e){try{return Xe.call(null,t,0)}catch(e){return Xe.call(this,t,0)}}}"function"==typeof o.setTimeout&&(Xe=setTimeout),"function"==typeof o.clearTimeout&&($e=clearTimeout);var tr,er=[],rr=!1,nr=-1;function ir(){rr&&tr&&(rr=!1,tr.length?er=tr.concat(er):nr=-1,er.length&&or())}function or(){if(!rr){var t=Qe(ir);rr=!0;for(var e=er.length;e;){for(tr=er,er=[];++nr<e;)tr&&tr[nr].run();nr=-1,e=er.length}tr=null,rr=!1,function(t){if($e===clearTimeout)return clearTimeout(t);if(($e===Ye||!$e)&&clearTimeout)return $e=clearTimeout,clearTimeout(t);try{return $e(t)}catch(e){try{return $e.call(null,t)}catch(e){return $e.call(this,t)}}}(t)}}function sr(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)e[r-1]=arguments[r];er.push(new ar(t,e)),1!==er.length||rr||Qe(or)}function ar(t,e){this.fun=t,this.array=e}ar.prototype.run=function(){this.fun.apply(null,this.array)};function ur(){}var hr=ur,cr=ur,fr=ur,lr=ur,dr=ur,pr=ur,mr=ur;var gr=o.performance||{},yr=gr.now||gr.mozNow||gr.msNow||gr.oNow||gr.webkitNow||function(){return(new Date).getTime()};var br=new Date;var vr={nextTick:sr,title:"browser",browser:!0,env:{},argv:[],version:"",versions:{},on:hr,addListener:cr,once:fr,off:lr,removeListener:dr,removeAllListeners:pr,emit:mr,binding:function(t){throw new Error("process.binding is not supported")},cwd:function(){return"/"},chdir:function(t){throw new Error("process.chdir is not supported")},umask:function(){return 0},hrtime:function(t){var e=.001*yr.call(gr),r=Math.floor(e),n=Math.floor(e%1*1e9);return t&&(r-=t[0],(n-=t[1])<0&&(r--,n+=1e9)),[r,n]},platform:"browser",release:{},config:{},uptime:function(){return(new Date-br)/1e3}},wr={exports:{}};!function(t){!function(){var r="input is invalid type",n="object"==typeof window,i=n?window:{};i.JS_SHA3_NO_WINDOW&&(n=!1);var o=!n&&"object"==typeof self;!i.JS_SHA3_NO_NODE_JS&&"object"==typeof vr&&vr.versions&&vr.versions.node?i=e:o&&(i=self);var s=!i.JS_SHA3_NO_COMMON_JS&&t.exports,a=!i.JS_SHA3_NO_ARRAY_BUFFER&&"undefined"!=typeof ArrayBuffer,u="0123456789abcdef".split(""),h=[4,1024,262144,67108864],c=[0,8,16,24],f=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648],l=[224,256,384,512],d=[128,256],p=["hex","buffer","arrayBuffer","array","digest"],m={128:168,256:136};!i.JS_SHA3_NO_NODE_JS&&Array.isArray||(Array.isArray=function(t){return"[object Array]"===Object.prototype.toString.call(t)}),!a||!i.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW&&ArrayBuffer.isView||(ArrayBuffer.isView=function(t){return"object"==typeof t&&t.buffer&&t.buffer.constructor===ArrayBuffer});for(var g=function(t,e,r){return function(n){return new N(t,e,t).update(n)[r]()}},y=function(t,e,r){return function(n,i){return new N(t,e,i).update(n)[r]()}},b=function(t,e,r){return function(e,n,i,o){return A["cshake"+t].update(e,n,i,o)[r]()}},v=function(t,e,r){return function(e,n,i,o){return A["kmac"+t].update(e,n,i,o)[r]()}},w=function(t,e,r,n){for(var i=0;i<p.length;++i){var o=p[i];t[o]=e(r,n,o)}return t},_=function(t,e){var r=g(t,e,"hex");return r.create=function(){return new N(t,e,t)},r.update=function(t){return r.create().update(t)},w(r,g,t,e)},E=[{name:"keccak",padding:[1,256,65536,16777216],bits:l,createMethod:_},{name:"sha3",padding:[6,1536,393216,100663296],bits:l,createMethod:_},{name:"shake",padding:[31,7936,2031616,520093696],bits:d,createMethod:function(t,e){var r=y(t,e,"hex");return r.create=function(r){return new N(t,e,r)},r.update=function(t,e){return r.create(e).update(t)},w(r,y,t,e)}},{name:"cshake",padding:h,bits:d,createMethod:function(t,e){var r=m[t],n=b(t,0,"hex");return n.create=function(n,i,o){return i||o?new N(t,e,n).bytepad([i,o],r):A["shake"+t].create(n)},n.update=function(t,e,r,i){return n.create(e,r,i).update(t)},w(n,b,t,e)}},{name:"kmac",padding:h,bits:d,createMethod:function(t,e){var r=m[t],n=v(t,0,"hex");return n.create=function(n,i,o){return new P(t,e,i).bytepad(["KMAC",o],r).bytepad([n],r)},n.update=function(t,e,r,i){return n.create(t,r,i).update(e)},w(n,v,t,e)}}],A={},M=[],S=0;S<E.length;++S)for(var k=E[S],x=k.bits,T=0;T<x.length;++T){var R=k.name+"_"+x[T];if(M.push(R),A[R]=k.createMethod(x[T],k.padding),"sha3"!==k.name){var B=k.name+x[T];M.push(B),A[B]=A[R]}}function N(t,e,r){this.blocks=[],this.s=[],this.padding=e,this.outputBits=r,this.reset=!0,this.finalized=!1,this.block=0,this.start=0,this.blockCount=1600-(t<<1)>>5,this.byteCount=this.blockCount<<2,this.outputBlocks=r>>5,this.extraBytes=(31&r)>>3;for(var n=0;n<50;++n)this.s[n]=0}function P(t,e,r){N.call(this,t,e,r)}N.prototype.update=function(t){if(this.finalized)throw new Error("finalize already called");var e,n=typeof t;if("string"!==n){if("object"!==n)throw new Error(r);if(null===t)throw new Error(r);if(a&&t.constructor===ArrayBuffer)t=new Uint8Array(t);else if(!(Array.isArray(t)||a&&ArrayBuffer.isView(t)))throw new Error(r);e=!0}for(var i,o,s=this.blocks,u=this.byteCount,h=t.length,f=this.blockCount,l=0,d=this.s;l<h;){if(this.reset)for(this.reset=!1,s[0]=this.block,i=1;i<f+1;++i)s[i]=0;if(e)for(i=this.start;l<h&&i<u;++l)s[i>>2]|=t[l]<<c[3&i++];else for(i=this.start;l<h&&i<u;++l)(o=t.charCodeAt(l))<128?s[i>>2]|=o<<c[3&i++]:o<2048?(s[i>>2]|=(192|o>>6)<<c[3&i++],s[i>>2]|=(128|63&o)<<c[3&i++]):o<55296||o>=57344?(s[i>>2]|=(224|o>>12)<<c[3&i++],s[i>>2]|=(128|o>>6&63)<<c[3&i++],s[i>>2]|=(128|63&o)<<c[3&i++]):(o=65536+((1023&o)<<10|1023&t.charCodeAt(++l)),s[i>>2]|=(240|o>>18)<<c[3&i++],s[i>>2]|=(128|o>>12&63)<<c[3&i++],s[i>>2]|=(128|o>>6&63)<<c[3&i++],s[i>>2]|=(128|63&o)<<c[3&i++]);if(this.lastByteIndex=i,i>=u){for(this.start=i-u,this.block=s[f],i=0;i<f;++i)d[i]^=s[i];I(d),this.reset=!0}else this.start=i}return this},N.prototype.encode=function(t,e){var r=255&t,n=1,i=[r];for(r=255&(t>>=8);r>0;)i.unshift(r),r=255&(t>>=8),++n;return e?i.push(n):i.unshift(n),this.update(i),i.length},N.prototype.encodeString=function(t){var e,n=typeof t;if("string"!==n){if("object"!==n)throw new Error(r);if(null===t)throw new Error(r);if(a&&t.constructor===ArrayBuffer)t=new Uint8Array(t);else if(!(Array.isArray(t)||a&&ArrayBuffer.isView(t)))throw new Error(r);e=!0}var i=0,o=t.length;if(e)i=o;else for(var s=0;s<t.length;++s){var u=t.charCodeAt(s);u<128?i+=1:u<2048?i+=2:u<55296||u>=57344?i+=3:(u=65536+((1023&u)<<10|1023&t.charCodeAt(++s)),i+=4)}return i+=this.encode(8*i),this.update(t),i},N.prototype.bytepad=function(t,e){for(var r=this.encode(e),n=0;n<t.length;++n)r+=this.encodeString(t[n]);var i=e-r%e,o=[];return o.length=i,this.update(o),this},N.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var t=this.blocks,e=this.lastByteIndex,r=this.blockCount,n=this.s;if(t[e>>2]|=this.padding[3&e],this.lastByteIndex===this.byteCount)for(t[0]=t[r],e=1;e<r+1;++e)t[e]=0;for(t[r-1]|=2147483648,e=0;e<r;++e)n[e]^=t[e];I(n)}},N.prototype.toString=N.prototype.hex=function(){this.finalize();for(var t,e=this.blockCount,r=this.s,n=this.outputBlocks,i=this.extraBytes,o=0,s=0,a="";s<n;){for(o=0;o<e&&s<n;++o,++s)t=r[o],a+=u[t>>4&15]+u[15&t]+u[t>>12&15]+u[t>>8&15]+u[t>>20&15]+u[t>>16&15]+u[t>>28&15]+u[t>>24&15];s%e===0&&(I(r),o=0)}return i&&(t=r[o],a+=u[t>>4&15]+u[15&t],i>1&&(a+=u[t>>12&15]+u[t>>8&15]),i>2&&(a+=u[t>>20&15]+u[t>>16&15])),a},N.prototype.arrayBuffer=function(){this.finalize();var t,e=this.blockCount,r=this.s,n=this.outputBlocks,i=this.extraBytes,o=0,s=0,a=this.outputBits>>3;t=i?new ArrayBuffer(n+1<<2):new ArrayBuffer(a);for(var u=new Uint32Array(t);s<n;){for(o=0;o<e&&s<n;++o,++s)u[s]=r[o];s%e===0&&I(r)}return i&&(u[o]=r[o],t=t.slice(0,a)),t},N.prototype.buffer=N.prototype.arrayBuffer,N.prototype.digest=N.prototype.array=function(){this.finalize();for(var t,e,r=this.blockCount,n=this.s,i=this.outputBlocks,o=this.extraBytes,s=0,a=0,u=[];a<i;){for(s=0;s<r&&a<i;++s,++a)t=a<<2,e=n[s],u[t]=255&e,u[t+1]=e>>8&255,u[t+2]=e>>16&255,u[t+3]=e>>24&255;a%r===0&&I(n)}return o&&(t=a<<2,e=n[s],u[t]=255&e,o>1&&(u[t+1]=e>>8&255),o>2&&(u[t+2]=e>>16&255)),u},P.prototype=new N,P.prototype.finalize=function(){return this.encode(this.outputBits,!0),N.prototype.finalize.call(this)};var I=function(t){var e,r,n,i,o,s,a,u,h,c,l,d,p,m,g,y,b,v,w,_,E,A,M,S,k,x,T,R,B,N,P,I,O,C,L,j,D,U,F,z,q,H,K,G,V,W,J,Z,Y,X,$,Q,tt,et,rt,nt,it,ot,st,at,ut,ht,ct;for(n=0;n<48;n+=2)i=t[0]^t[10]^t[20]^t[30]^t[40],o=t[1]^t[11]^t[21]^t[31]^t[41],s=t[2]^t[12]^t[22]^t[32]^t[42],a=t[3]^t[13]^t[23]^t[33]^t[43],u=t[4]^t[14]^t[24]^t[34]^t[44],h=t[5]^t[15]^t[25]^t[35]^t[45],c=t[6]^t[16]^t[26]^t[36]^t[46],l=t[7]^t[17]^t[27]^t[37]^t[47],e=(d=t[8]^t[18]^t[28]^t[38]^t[48])^(s<<1|a>>>31),r=(p=t[9]^t[19]^t[29]^t[39]^t[49])^(a<<1|s>>>31),t[0]^=e,t[1]^=r,t[10]^=e,t[11]^=r,t[20]^=e,t[21]^=r,t[30]^=e,t[31]^=r,t[40]^=e,t[41]^=r,e=i^(u<<1|h>>>31),r=o^(h<<1|u>>>31),t[2]^=e,t[3]^=r,t[12]^=e,t[13]^=r,t[22]^=e,t[23]^=r,t[32]^=e,t[33]^=r,t[42]^=e,t[43]^=r,e=s^(c<<1|l>>>31),r=a^(l<<1|c>>>31),t[4]^=e,t[5]^=r,t[14]^=e,t[15]^=r,t[24]^=e,t[25]^=r,t[34]^=e,t[35]^=r,t[44]^=e,t[45]^=r,e=u^(d<<1|p>>>31),r=h^(p<<1|d>>>31),t[6]^=e,t[7]^=r,t[16]^=e,t[17]^=r,t[26]^=e,t[27]^=r,t[36]^=e,t[37]^=r,t[46]^=e,t[47]^=r,e=c^(i<<1|o>>>31),r=l^(o<<1|i>>>31),t[8]^=e,t[9]^=r,t[18]^=e,t[19]^=r,t[28]^=e,t[29]^=r,t[38]^=e,t[39]^=r,t[48]^=e,t[49]^=r,m=t[0],g=t[1],W=t[11]<<4|t[10]>>>28,J=t[10]<<4|t[11]>>>28,R=t[20]<<3|t[21]>>>29,B=t[21]<<3|t[20]>>>29,at=t[31]<<9|t[30]>>>23,ut=t[30]<<9|t[31]>>>23,H=t[40]<<18|t[41]>>>14,K=t[41]<<18|t[40]>>>14,C=t[2]<<1|t[3]>>>31,L=t[3]<<1|t[2]>>>31,y=t[13]<<12|t[12]>>>20,b=t[12]<<12|t[13]>>>20,Z=t[22]<<10|t[23]>>>22,Y=t[23]<<10|t[22]>>>22,N=t[33]<<13|t[32]>>>19,P=t[32]<<13|t[33]>>>19,ht=t[42]<<2|t[43]>>>30,ct=t[43]<<2|t[42]>>>30,et=t[5]<<30|t[4]>>>2,rt=t[4]<<30|t[5]>>>2,j=t[14]<<6|t[15]>>>26,D=t[15]<<6|t[14]>>>26,v=t[25]<<11|t[24]>>>21,w=t[24]<<11|t[25]>>>21,X=t[34]<<15|t[35]>>>17,$=t[35]<<15|t[34]>>>17,I=t[45]<<29|t[44]>>>3,O=t[44]<<29|t[45]>>>3,S=t[6]<<28|t[7]>>>4,k=t[7]<<28|t[6]>>>4,nt=t[17]<<23|t[16]>>>9,it=t[16]<<23|t[17]>>>9,U=t[26]<<25|t[27]>>>7,F=t[27]<<25|t[26]>>>7,_=t[36]<<21|t[37]>>>11,E=t[37]<<21|t[36]>>>11,Q=t[47]<<24|t[46]>>>8,tt=t[46]<<24|t[47]>>>8,G=t[8]<<27|t[9]>>>5,V=t[9]<<27|t[8]>>>5,x=t[18]<<20|t[19]>>>12,T=t[19]<<20|t[18]>>>12,ot=t[29]<<7|t[28]>>>25,st=t[28]<<7|t[29]>>>25,z=t[38]<<8|t[39]>>>24,q=t[39]<<8|t[38]>>>24,A=t[48]<<14|t[49]>>>18,M=t[49]<<14|t[48]>>>18,t[0]=m^~y&v,t[1]=g^~b&w,t[10]=S^~x&R,t[11]=k^~T&B,t[20]=C^~j&U,t[21]=L^~D&F,t[30]=G^~W&Z,t[31]=V^~J&Y,t[40]=et^~nt&ot,t[41]=rt^~it&st,t[2]=y^~v&_,t[3]=b^~w&E,t[12]=x^~R&N,t[13]=T^~B&P,t[22]=j^~U&z,t[23]=D^~F&q,t[32]=W^~Z&X,t[33]=J^~Y&$,t[42]=nt^~ot&at,t[43]=it^~st&ut,t[4]=v^~_&A,t[5]=w^~E&M,t[14]=R^~N&I,t[15]=B^~P&O,t[24]=U^~z&H,t[25]=F^~q&K,t[34]=Z^~X&Q,t[35]=Y^~$&tt,t[44]=ot^~at&ht,t[45]=st^~ut&ct,t[6]=_^~A&m,t[7]=E^~M&g,t[16]=N^~I&S,t[17]=P^~O&k,t[26]=z^~H&C,t[27]=q^~K&L,t[36]=X^~Q&G,t[37]=$^~tt&V,t[46]=at^~ht&et,t[47]=ut^~ct&rt,t[8]=A^~m&y,t[9]=M^~g&b,t[18]=I^~S&x,t[19]=O^~k&T,t[28]=H^~C&j,t[29]=K^~L&D,t[38]=Q^~G&W,t[39]=tt^~V&J,t[48]=ht^~et&nt,t[49]=ct^~rt&it,t[0]^=f[n],t[1]^=f[n+1]};if(s)t.exports=A;else for(S=0;S<M.length;++S)i[M[S]]=A[M[S]]}()}(wr);var _r=r(wr.exports);function Er(t){return"0x"+_r.keccak_256(Mt(t))}const Ar=new yt("strings/5.8.0");var Mr,Sr;function kr(t,e,r,n,i){if(t===Sr.BAD_PREFIX||t===Sr.UNEXPECTED_CONTINUE){let t=0;for(let n=e+1;n<r.length&&r[n]>>6==2;n++)t++;return t}return t===Sr.OVERRUN?r.length-e-1:0}!function(t){t.current="",t.NFC="NFC",t.NFD="NFD",t.NFKC="NFKC",t.NFKD="NFKD"}(Mr||(Mr={})),function(t){t.UNEXPECTED_CONTINUE="unexpected continuation byte",t.BAD_PREFIX="bad codepoint prefix",t.OVERRUN="string overrun",t.MISSING_CONTINUE="missing continuation byte",t.OUT_OF_RANGE="out of UTF-8 range",t.UTF16_SURROGATE="UTF-16 surrogate",t.OVERLONG="overlong representation"}(Sr||(Sr={}));const xr=Object.freeze({error:function(t,e,r,n,i){return Ar.throwArgumentError(`invalid codepoint at offset ${e}; ${t}`,"bytes",r)},ignore:kr,replace:function(t,e,r,n,i){return t===Sr.OVERLONG?(n.push(i),0):(n.push(65533),kr(t,e,r))}});function Tr(t,e){null==e&&(e=xr.error),t=Mt(t);const r=[];let n=0;for(;n<t.length;){const i=t[n++];if(!(i>>7)){r.push(i);continue}let o=null,s=null;if(192==(224&i))o=1,s=127;else if(224==(240&i))o=2,s=2047;else{if(240!=(248&i)){n+=e(128==(192&i)?Sr.UNEXPECTED_CONTINUE:Sr.BAD_PREFIX,n-1,t,r);continue}o=3,s=65535}if(n-1+o>=t.length){n+=e(Sr.OVERRUN,n-1,t,r);continue}let a=i&(1<<8-o-1)-1;for(let i=0;i<o;i++){let i=t[n];if(128!=(192&i)){n+=e(Sr.MISSING_CONTINUE,n,t,r),a=null;break}a=a<<6|63&i,n++}null!==a&&(a>1114111?n+=e(Sr.OUT_OF_RANGE,n-1-o,t,r,a):a>=55296&&a<=57343?n+=e(Sr.UTF16_SURROGATE,n-1-o,t,r,a):a<=s?n+=e(Sr.OVERLONG,n-1-o,t,r,a):r.push(a))}return r}function Rr(t,e=Mr.current){e!=Mr.current&&(Ar.checkNormalize(),t=t.normalize(e));let r=[];for(let e=0;e<t.length;e++){const n=t.charCodeAt(e);if(n<128)r.push(n);else if(n<2048)r.push(n>>6|192),r.push(63&n|128);else if(55296==(64512&n)){e++;const i=t.charCodeAt(e);if(e>=t.length||56320!=(64512&i))throw new Error("invalid utf-8 string");const o=65536+((1023&n)<<10)+(1023&i);r.push(o>>18|240),r.push(o>>12&63|128),r.push(o>>6&63|128),r.push(63&o|128)}else r.push(n>>12|224),r.push(n>>6&63|128),r.push(63&n|128)}return Mt(r)}function Br(t){const e="0000"+t.toString(16);return"\\u"+e.substring(e.length-4)}function Nr(t){return t.map(t=>t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode(55296+(t>>10&1023),56320+(1023&t)))).join("")}function Pr(t,e){return Nr(Tr(t,e))}function Ir(t,e=Mr.current){return Tr(Rr(t,e))}function Or(t,e){e||(e=function(t){return[parseInt(t,16)]});let r=0,n={};return t.split(",").forEach(t=>{let i=t.split(":");r+=parseInt(i[0],16),n[r]=e(i[1])}),n}function Cr(t){let e=0;return t.split(",").map(t=>{let r=t.split("-");1===r.length?r[1]="0":""===r[1]&&(r[1]="1");let n=e+parseInt(r[0],16);return e=parseInt(r[1],16),{l:n,h:e}})}function Lr(t,e){let r=0;for(let n=0;n<e.length;n++){let i=e[n];if(r+=i.l,t>=r&&t<=r+i.h&&(t-r)%(i.d||1)===0){if(i.e&&-1!==i.e.indexOf(t-r))continue;return i}}return null}const jr=Cr("221,13-1b,5f-,40-10,51-f,11-3,3-3,2-2,2-4,8,2,15,2d,28-8,88,48,27-,3-5,11-20,27-,8,28,3-5,12,18,b-a,1c-4,6-16,2-d,2-2,2,1b-4,17-9,8f-,10,f,1f-2,1c-34,33-14e,4,36-,13-,6-2,1a-f,4,9-,3-,17,8,2-2,5-,2,8-,3-,4-8,2-3,3,6-,16-6,2-,7-3,3-,17,8,3,3,3-,2,6-3,3-,4-a,5,2-6,10-b,4,8,2,4,17,8,3,6-,b,4,4-,2-e,2-4,b-10,4,9-,3-,17,8,3-,5-,9-2,3-,4-7,3-3,3,4-3,c-10,3,7-2,4,5-2,3,2,3-2,3-2,4-2,9,4-3,6-2,4,5-8,2-e,d-d,4,9,4,18,b,6-3,8,4,5-6,3-8,3-3,b-11,3,9,4,18,b,6-3,8,4,5-6,3-6,2,3-3,b-11,3,9,4,18,11-3,7-,4,5-8,2-7,3-3,b-11,3,13-2,19,a,2-,8-2,2-3,7,2,9-11,4-b,3b-3,1e-24,3,2-,3,2-,2-5,5,8,4,2,2-,3,e,4-,6,2,7-,b-,3-21,49,23-5,1c-3,9,25,10-,2-2f,23,6,3,8-2,5-5,1b-45,27-9,2a-,2-3,5b-4,45-4,53-5,8,40,2,5-,8,2,5-,28,2,5-,20,2,5-,8,2,5-,8,8,18,20,2,5-,8,28,14-5,1d-22,56-b,277-8,1e-2,52-e,e,8-a,18-8,15-b,e,4,3-b,5e-2,b-15,10,b-5,59-7,2b-555,9d-3,5b-5,17-,7-,27-,7-,9,2,2,2,20-,36,10,f-,7,14-,4,a,54-3,2-6,6-5,9-,1c-10,13-1d,1c-14,3c-,10-6,32-b,240-30,28-18,c-14,a0,115-,3,66-,b-76,5,5-,1d,24,2,5-2,2,8-,35-2,19,f-10,1d-3,311-37f,1b,5a-b,d7-19,d-3,41,57-,68-4,29-3,5f,29-37,2e-2,25-c,2c-2,4e-3,30,78-3,64-,20,19b7-49,51a7-59,48e-2,38-738,2ba5-5b,222f-,3c-94,8-b,6-4,1b,6,2,3,3,6d-20,16e-f,41-,37-7,2e-2,11-f,5-b,18-,b,14,5-3,6,88-,2,bf-2,7-,7-,7-,4-2,8,8-9,8-2ff,20,5-b,1c-b4,27-,27-cbb1,f7-9,28-2,b5-221,56,48,3-,2-,3-,5,d,2,5,3,42,5-,9,8,1d,5,6,2-2,8,153-3,123-3,33-27fd,a6da-5128,21f-5df,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3,2-1d,61-ff7d"),Dr="ad,34f,1806,180b,180c,180d,200b,200c,200d,2060,feff".split(",").map(t=>parseInt(t,16)),Ur=[{h:25,s:32,l:65},{h:30,s:32,e:[23],l:127},{h:54,s:1,e:[48],l:64,d:2},{h:14,s:1,l:57,d:2},{h:44,s:1,l:17,d:2},{h:10,s:1,e:[2,6,8],l:61,d:2},{h:16,s:1,l:68,d:2},{h:84,s:1,e:[18,24,66],l:19,d:2},{h:26,s:32,e:[17],l:435},{h:22,s:1,l:71,d:2},{h:15,s:80,l:40},{h:31,s:32,l:16},{h:32,s:1,l:80,d:2},{h:52,s:1,l:42,d:2},{h:12,s:1,l:55,d:2},{h:40,s:1,e:[38],l:15,d:2},{h:14,s:1,l:48,d:2},{h:37,s:48,l:49},{h:148,s:1,l:6351,d:2},{h:88,s:1,l:160,d:2},{h:15,s:16,l:704},{h:25,s:26,l:854},{h:25,s:32,l:55915},{h:37,s:40,l:1247},{h:25,s:-119711,l:53248},{h:25,s:-119763,l:52},{h:25,s:-119815,l:52},{h:25,s:-119867,e:[1,4,5,7,8,11,12,17],l:52},{h:25,s:-119919,l:52},{h:24,s:-119971,e:[2,7,8,17],l:52},{h:24,s:-120023,e:[2,7,13,15,16,17],l:52},{h:25,s:-120075,l:52},{h:25,s:-120127,l:52},{h:25,s:-120179,l:52},{h:25,s:-120231,l:52},{h:25,s:-120283,l:52},{h:25,s:-120335,l:52},{h:24,s:-119543,e:[17],l:56},{h:24,s:-119601,e:[17],l:58},{h:24,s:-119659,e:[17],l:58},{h:24,s:-119717,e:[17],l:58},{h:24,s:-119775,e:[17],l:58}],Fr=Or("b5:3bc,c3:ff,7:73,2:253,5:254,3:256,1:257,5:259,1:25b,3:260,1:263,2:269,1:268,5:26f,1:272,2:275,7:280,3:283,5:288,3:28a,1:28b,5:292,3f:195,1:1bf,29:19e,125:3b9,8b:3b2,1:3b8,1:3c5,3:3c6,1:3c0,1a:3ba,1:3c1,1:3c3,2:3b8,1:3b5,1bc9:3b9,1c:1f76,1:1f77,f:1f7a,1:1f7b,d:1f78,1:1f79,1:1f7c,1:1f7d,107:63,5:25b,4:68,1:68,1:68,3:69,1:69,1:6c,3:6e,4:70,1:71,1:72,1:72,1:72,7:7a,2:3c9,2:7a,2:6b,1:e5,1:62,1:63,3:65,1:66,2:6d,b:3b3,1:3c0,6:64,1b574:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3"),zr=Or("179:1,2:1,2:1,5:1,2:1,a:4f,a:1,8:1,2:1,2:1,3:1,5:1,3:1,4:1,2:1,3:1,4:1,8:2,1:1,2:2,1:1,2:2,27:2,195:26,2:25,1:25,1:25,2:40,2:3f,1:3f,33:1,11:-6,1:-9,1ac7:-3a,6d:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,b:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,c:-8,2:-8,2:-8,2:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,49:-8,1:-8,1:-4a,1:-4a,d:-56,1:-56,1:-56,1:-56,d:-8,1:-8,f:-8,1:-8,3:-7"),qr=Or("df:00730073,51:00690307,19:02BC006E,a7:006A030C,18a:002003B9,16:03B903080301,20:03C503080301,1d7:05650582,190f:00680331,1:00740308,1:0077030A,1:0079030A,1:006102BE,b6:03C50313,2:03C503130300,2:03C503130301,2:03C503130342,2a:1F0003B9,1:1F0103B9,1:1F0203B9,1:1F0303B9,1:1F0403B9,1:1F0503B9,1:1F0603B9,1:1F0703B9,1:1F0003B9,1:1F0103B9,1:1F0203B9,1:1F0303B9,1:1F0403B9,1:1F0503B9,1:1F0603B9,1:1F0703B9,1:1F2003B9,1:1F2103B9,1:1F2203B9,1:1F2303B9,1:1F2403B9,1:1F2503B9,1:1F2603B9,1:1F2703B9,1:1F2003B9,1:1F2103B9,1:1F2203B9,1:1F2303B9,1:1F2403B9,1:1F2503B9,1:1F2603B9,1:1F2703B9,1:1F6003B9,1:1F6103B9,1:1F6203B9,1:1F6303B9,1:1F6403B9,1:1F6503B9,1:1F6603B9,1:1F6703B9,1:1F6003B9,1:1F6103B9,1:1F6203B9,1:1F6303B9,1:1F6403B9,1:1F6503B9,1:1F6603B9,1:1F6703B9,3:1F7003B9,1:03B103B9,1:03AC03B9,2:03B10342,1:03B1034203B9,5:03B103B9,6:1F7403B9,1:03B703B9,1:03AE03B9,2:03B70342,1:03B7034203B9,5:03B703B9,6:03B903080300,1:03B903080301,3:03B90342,1:03B903080342,b:03C503080300,1:03C503080301,1:03C10313,2:03C50342,1:03C503080342,b:1F7C03B9,1:03C903B9,1:03CE03B9,2:03C90342,1:03C9034203B9,5:03C903B9,ac:00720073,5b:00B00063,6:00B00066,d:006E006F,a:0073006D,1:00740065006C,1:0074006D,124f:006800700061,2:00610075,2:006F0076,b:00700061,1:006E0061,1:03BC0061,1:006D0061,1:006B0061,1:006B0062,1:006D0062,1:00670062,3:00700066,1:006E0066,1:03BC0066,4:0068007A,1:006B0068007A,1:006D0068007A,1:00670068007A,1:00740068007A,15:00700061,1:006B00700061,1:006D00700061,1:006700700061,8:00700076,1:006E0076,1:03BC0076,1:006D0076,1:006B0076,1:006D0076,1:00700077,1:006E0077,1:03BC0077,1:006D0077,1:006B0077,1:006D0077,1:006B03C9,1:006D03C9,2:00620071,3:00632215006B0067,1:0063006F002E,1:00640062,1:00670079,2:00680070,2:006B006B,1:006B006D,9:00700068,2:00700070006D,1:00700072,2:00730076,1:00770062,c723:00660066,1:00660069,1:0066006C,1:006600660069,1:00660066006C,1:00730074,1:00730074,d:05740576,1:05740565,1:0574056B,1:057E0576,1:0574056D",function(t){if(t.length%4!=0)throw new Error("bad data");let e=[];for(let r=0;r<t.length;r+=4)e.push(parseInt(t.substring(r,r+4),16));return e}),Hr=Cr("80-20,2a0-,39c,32,f71,18e,7f2-f,19-7,30-4,7-5,f81-b,5,a800-20ff,4d1-1f,110,fa-6,d174-7,2e84-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,2,1f-5f,ff7f-20001");function Kr(t){return Er(Rr(t))}const Gr="hash/5.8.0";function Vr(t,e){null==e&&(e=1);const r=[],n=r.forEach,i=function(t,e){n.call(t,function(t){e>0&&Array.isArray(t)?i(t,e-1):r.push(t)})};return i(t,e),r}function Wr(t){return function(t){let e=0;return()=>t[e++]}(function(t){let e=0;function r(){return t[e++]<<8|t[e++]}let n=r(),i=1,o=[0,1];for(let t=1;t<n;t++)o.push(i+=r());let s=r(),a=e;e+=s;let u=0,h=0;function c(){return 0==u&&(h=h<<8|t[e++],u=8),h>>--u&1}const f=Math.pow(2,31),l=f>>>1,d=l>>1,p=f-1;let m=0;for(let t=0;t<31;t++)m=m<<1|c();let g=[],y=0,b=f;for(;;){let t=Math.floor(((m-y+1)*i-1)/b),e=0,r=n;for(;r-e>1;){let n=e+r>>>1;t<o[n]?r=n:e=n}if(0==e)break;g.push(e);let s=y+Math.floor(b*o[e]/i),a=y+Math.floor(b*o[e+1]/i)-1;for(;0==((s^a)&l);)m=m<<1&p|c(),s=s<<1&p,a=a<<1&p|1;for(;s&~a&d;)m=m&l|m<<1&p>>>1|c(),s=s<<1^l,a=(a^l)<<1|l|1;y=s,b=1+a-s}let v=n-4;return g.map(e=>{switch(e-v){case 3:return v+65792+(t[a++]<<16|t[a++]<<8|t[a++]);case 2:return v+256+(t[a++]<<8|t[a++]);case 1:return v+t[a++];default:return e-1}})}(t))}function Jr(t){return 1&t?~t>>1:t>>1}function Zr(t,e){let r=Array(t);for(let n=0,i=-1;n<t;n++)r[n]=i+=1+e();return r}function Yr(t,e){let r=Array(t);for(let n=0,i=0;n<t;n++)r[n]=i+=Jr(e());return r}function Xr(t,e){let r=Zr(t(),t),n=t(),i=Zr(n,t),o=function(t,e){let r=Array(t);for(let n=0;n<t;n++)r[n]=1+e();return r}(n,t);for(let t=0;t<n;t++)for(let e=0;e<o[t];e++)r.push(i[t]+e);return e?r.map(t=>e[t]):r}function $r(t,e,r){let n=Array(t).fill(void 0).map(()=>[]);for(let i=0;i<e;i++)Yr(t,r).forEach((t,e)=>n[e].push(t));return n}function Qr(t,e){let r=1+e(),n=e(),i=function(t){let e=[];for(;;){let r=t();if(0==r)break;e.push(r)}return e}(e);return Vr($r(i.length,1+t,e).map((t,e)=>{const o=t[0],s=t.slice(1);return Array(i[e]).fill(void 0).map((t,e)=>{let i=e*n;return[o+e*r,s.map(t=>t+i)]})}))}function tn(t,e){return $r(1+e(),1+t,e).map(t=>[t[0],t.slice(1)])}const en=Wr(Ie("AEQF2AO2DEsA2wIrAGsBRABxAN8AZwCcAEwAqgA0AGwAUgByADcATAAVAFYAIQAyACEAKAAYAFgAGwAjABQAMAAmADIAFAAfABQAKwATACoADgAbAA8AHQAYABoAGQAxADgALAAoADwAEwA9ABMAGgARAA4ADwAWABMAFgAIAA8AHgQXBYMA5BHJAS8JtAYoAe4AExozi0UAH21tAaMnBT8CrnIyhrMDhRgDygIBUAEHcoFHUPe8AXBjAewCjgDQR8IICIcEcQLwATXCDgzvHwBmBoHNAqsBdBcUAykgDhAMShskMgo8AY8jqAQfAUAfHw8BDw87MioGlCIPBwZCa4ELatMAAMspJVgsDl8AIhckSg8XAHdvTwBcIQEiDT4OPhUqbyECAEoAS34Aej8Ybx83JgT/Xw8gHxZ/7w8RICxPHA9vBw+Pfw8PHwAPFv+fAsAvCc8vEr8ivwD/EQ8Bol8OEBa/A78hrwAPCU8vESNvvwWfHwNfAVoDHr+ZAAED34YaAdJPAK7PLwSEgDLHAGo1Pz8Pvx9fUwMrpb8O/58VTzAPIBoXIyQJNF8hpwIVAT8YGAUADDNBaX3RAMomJCg9EhUeA29MABsZBTMNJipjOhc19gcIDR8bBwQHEggCWi6DIgLuAQYA+BAFCha3A5XiAEsqM7UFFgFLhAMjFTMYE1Klnw74nRVBG/ASCm0BYRN/BrsU3VoWy+S0vV8LQx+vN8gF2AC2AK5EAWwApgYDKmAAroQ0NDQ0AT+OCg7wAAIHRAbpNgVcBV0APTA5BfbPFgMLzcYL/QqqA82eBALKCjQCjqYCht0/k2+OAsXQAoP3ASTKDgDw6ACKAUYCMpIKJpRaAE4A5womABzZvs0REEKiACIQAd5QdAECAj4Ywg/wGqY2AVgAYADYvAoCGAEubA0gvAY2ALAAbpbvqpyEAGAEpgQAJgAG7gAgAEACmghUFwCqAMpAINQIwC4DthRAAPcycKgApoIdABwBfCisABoATwBqASIAvhnSBP8aH/ECeAKXAq40NjgDBTwFYQU6AXs3oABgAD4XNgmcCY1eCl5tIFZeUqGgyoNHABgAEQAaABNwWQAmABMATPMa3T34ADldyprmM1M2XociUQgLzvwAXT3xABgAEQAaABNwIGFAnADD8AAgAD4BBJWzaCcIAIEBFMAWwKoAAdq9BWAF5wLQpALEtQAKUSGkahR4GnJM+gsAwCgeFAiUAECQ0BQuL8AAIAAAADKeIheclvFqQAAETr4iAMxIARMgAMIoHhQIAn0E0pDQFC4HhznoAAAAIAI2C0/4lvFqQAAETgBJJwYCAy4ABgYAFAA8MBKYEH4eRhTkAjYeFcgACAYAeABsOqyQ5gRwDayqugEgaIIAtgoACgDmEABmBAWGme5OBJJA2m4cDeoAmITWAXwrMgOgAGwBCh6CBXYF1Tzg1wKAAFdiuABRAFwAXQBsAG8AdgBrAHYAbwCEAHEwfxQBVE5TEQADVFhTBwBDANILAqcCzgLTApQCrQL6vAAMAL8APLhNBKkE6glGKTAU4Dr4N2EYEwBCkABKk8rHAbYBmwIoAiU4Ajf/Aq4CowCAANIChzgaNBsCsTgeODcFXrgClQKdAqQBiQGYAqsCsjTsNHsfNPA0ixsAWTWiOAMFPDQSNCk2BDZHNow2TTZUNhk28Jk9VzI3QkEoAoICoQKwAqcAQAAxBV4FXbS9BW47YkIXP1ciUqs05DS/FwABUwJW11e6nHuYZmSh/RAYA8oMKvZ8KASoUAJYWAJ6ILAsAZSoqjpgA0ocBIhmDgDWAAawRDQoAAcuAj5iAHABZiR2AIgiHgCaAU68ACxuHAG0ygM8MiZIAlgBdF4GagJqAPZOHAMuBgoATkYAsABiAHgAMLoGDPj0HpKEBAAOJgAuALggTAHWAeAMEDbd20Uege0ADwAWADkAQgA9OHd+2MUQZBBhBgNNDkxxPxUQArEPqwvqERoM1irQ090ANK4H8ANYB/ADWANYB/AH8ANYB/ADWANYA1gDWBwP8B/YxRBkD00EcgWTBZAE2wiIJk4RhgctCNdUEnQjHEwDSgEBIypJITuYMxAlR0wRTQgIATZHbKx9PQNMMbBU+pCnA9AyVDlxBgMedhKlAC8PeCE1uk6DekxxpQpQT7NX9wBFBgASqwAS5gBJDSgAUCwGPQBI4zTYABNGAE2bAE3KAExdGABKaAbgAFBXAFCOAFBJABI2SWdObALDOq0//QomCZhvwHdTBkIQHCemEPgMNAG2ATwN7kvZBPIGPATKH34ZGg/OlZ0Ipi3eDO4m5C6igFsj9iqEBe5L9TzeC05RaQ9aC2YJ5DpkgU8DIgEOIowK3g06CG4Q9ArKbA3mEUYHOgPWSZsApgcCCxIdNhW2JhFirQsKOXgG/Br3C5AmsBMqev0F1BoiBk4BKhsAANAu6IWxWjJcHU9gBgQLJiPIFKlQIQ0mQLh4SRocBxYlqgKSQ3FKiFE3HpQh9zw+DWcuFFF9B/Y8BhlQC4I8n0asRQ8R0z6OPUkiSkwtBDaALDAnjAnQD4YMunxzAVoJIgmyDHITMhEYN8YIOgcaLpclJxYIIkaWYJsE+KAD9BPSAwwFQAlCBxQDthwuEy8VKgUOgSXYAvQ21i60ApBWgQEYBcwPJh/gEFFH4Q7qCJwCZgOEJewALhUiABginAhEZABgj9lTBi7MCMhqbSN1A2gU6GIRdAeSDlgHqBw0FcAc4nDJXgyGCSiksAlcAXYJmgFgBOQICjVcjKEgQmdUi1kYnCBiQUBd/QIyDGYVoES+h3kCjA9sEhwBNgF0BzoNAgJ4Ee4RbBCWCOyGBTW2M/k6JgRQIYQgEgooA1BszwsoJvoM+WoBpBJjAw00PnfvZ6xgtyUX/gcaMsZBYSHyC5NPzgydGsIYQ1QvGeUHwAP0GvQn60FYBgADpAQUOk4z7wS+C2oIjAlAAEoOpBgH2BhrCnKM0QEyjAG4mgNYkoQCcJAGOAcMAGgMiAV65gAeAqgIpAAGANADWAA6Aq4HngAaAIZCAT4DKDABIuYCkAOUCDLMAZYwAfQqBBzEDBYA+DhuSwLDsgKAa2ajBd5ZAo8CSjYBTiYEBk9IUgOwcuIA3ABMBhTgSAEWrEvMG+REAeBwLADIAPwABjYHBkIBzgH0bgC4AWALMgmjtLYBTuoqAIQAFmwB2AKKAN4ANgCA8gFUAE4FWvoF1AJQSgESMhksWGIBvAMgATQBDgB6BsyOpsoIIARuB9QCEBwV4gLvLwe2AgMi4BPOQsYCvd9WADIXUu5eZwqoCqdeaAC0YTQHMnM9UQAPH6k+yAdy/BZIiQImSwBQ5gBQQzSaNTFWSTYBpwGqKQK38AFtqwBI/wK37gK3rQK3sAK6280C0gK33AK3zxAAUEIAUD9SklKDArekArw5AEQAzAHCO147WTteO1k7XjtZO147WTteO1kDmChYI03AVU0oJqkKbV9GYewMpw3VRMk6ShPcYFJgMxPJLbgUwhXPJVcZPhq9JwYl5VUKDwUt1GYxCC00dhe9AEApaYNCY4ceMQpMHOhTklT5LRwAskujM7ANrRsWREEFSHXuYisWDwojAmSCAmJDXE6wXDchAqH4AmiZAmYKAp+FOBwMAmY8AmYnBG8EgAN/FAN+kzkHOXgYOYM6JCQCbB4CMjc4CwJtyAJtr/CLADRoRiwBaADfAOIASwYHmQyOAP8MwwAOtgJ3MAJ2o0ACeUxEAni7Hl3cRa9G9AJ8QAJ6yQJ9CgJ88UgBSH5kJQAsFklZSlwWGErNAtECAtDNSygDiFADh+dExpEzAvKiXQQDA69Lz0wuJgTQTU1NsAKLQAKK2cIcCB5EaAa4Ao44Ao5dQZiCAo7aAo5deVG1UzYLUtVUhgKT/AKTDQDqAB1VH1WwVdEHLBwplocy4nhnRTw6ApegAu+zWCKpAFomApaQApZ9nQCqWa1aCoJOADwClrYClk9cRVzSApnMApllXMtdCBoCnJw5wzqeApwXAp+cAp65iwAeEDIrEAKd8gKekwC2PmE1YfACntQCoG8BqgKeoCACnk+mY8lkKCYsAiewAiZ/AqD8AqBN2AKmMAKlzwKoAAB+AqfzaH1osgAESmodatICrOQCrK8CrWgCrQMCVx4CVd0CseLYAx9PbJgCsr4OArLpGGzhbWRtSWADJc4Ctl08QG6RAylGArhfArlIFgK5K3hwN3DiAr0aAy2zAzISAr6JcgMDM3ICvhtzI3NQAsPMAsMFc4N0TDZGdOEDPKgDPJsDPcACxX0CxkgCxhGKAshqUgLIRQLJUALJLwJkngLd03h6YniveSZL0QMYpGcDAmH1GfSVJXsMXpNevBICz2wCz20wTFTT9BSgAMeuAs90ASrrA04TfkwGAtwoAtuLAtJQA1JdA1NgAQIDVY2AikABzBfuYUZ2AILPg44C2sgC2d+EEYRKpz0DhqYAMANkD4ZyWvoAVgLfZgLeuXR4AuIw7RUB8zEoAfScAfLTiALr9ALpcXoAAur6AurlAPpIAboC7ooC652Wq5cEAu5AA4XhmHpw4XGiAvMEAGoDjheZlAL3FAORbwOSiAL3mQL52gL4Z5odmqy8OJsfA52EAv77ARwAOp8dn7QDBY4DpmsDptoA0sYDBmuhiaIGCgMMSgFgASACtgNGAJwEgLpoBgC8BGzAEowcggCEDC6kdjoAJAM0C5IKRoABZCgiAIzw3AYBLACkfng9ogigkgNmWAN6AEQCvrkEVqTGAwCsBRbAA+4iQkMCHR072jI2PTbUNsk2RjY5NvA23TZKNiU3EDcZN5I+RTxDRTBCJkK5VBYKFhZfwQCWygU3AJBRHpu+OytgNxa61A40GMsYjsn7BVwFXQVcBV0FaAVdBVwFXQVcBV0FXAVdBVwFXUsaCNyKAK4AAQUHBwKU7oICoW1e7jAEzgPxA+YDwgCkBFDAwADABKzAAOxFLhitA1UFTDeyPkM+bj51QkRCuwTQWWQ8X+0AWBYzsACNA8xwzAGm7EZ/QisoCTAbLDs6fnLfb8H2GccsbgFw13M1HAVkBW/Jxsm9CNRO8E8FDD0FBQw9FkcClOYCoMFegpDfADgcMiA2AJQACB8AsigKAIzIEAJKeBIApY5yPZQIAKQiHb4fvj5BKSRPQrZCOz0oXyxgOywfKAnGbgMClQaCAkILXgdeCD9IIGUgQj5fPoY+dT52Ao5CM0dAX9BTVG9SDzFwWTQAbxBzJF/lOEIQQglCCkKJIAls5AcClQICoKPMODEFxhi6KSAbiyfIRrMjtCgdWCAkPlFBIitCsEJRzAbMAV/OEyQzDg0OAQQEJ36i328/Mk9AybDJsQlq3tDRApUKAkFzXf1d/j9uALYP6hCoFgCTGD8kPsFKQiobrm0+zj0KSD8kPnVCRBwMDyJRTHFgMTJa5rwXQiQ2YfI/JD7BMEJEHGINTw4TOFlIRzwJO0icMQpyPyQ+wzJCRBv6DVgnKB01NgUKj2bwYzMqCoBkznBgEF+zYDIocwRIX+NgHj4HICNfh2C4CwdwFWpTG/lgUhYGAwRfv2Ts8mAaXzVgml/XYIJfuWC4HI1gUF9pYJZgMR6ilQHMAOwLAlDRefC0in4AXAEJA6PjCwc0IamOANMMCAECRQDFNRTZBgd+CwQlRA+r6+gLBDEFBnwUBXgKATIArwAGRAAHA3cDdAN2A3kDdwN9A3oDdQN7A30DfAN4A3oDfQAYEAAlAtYASwMAUAFsAHcKAHcAmgB3AHUAdQB2AHVu8UgAygDAAHcAdQB1AHYAdQALCgB3AAsAmgB3AAsCOwB3AAtu8UgAygDAAHgKAJoAdwB3AHUAdQB2AHUAeAB1AHUAdgB1bvFIAMoAwAALCgCaAHcACwB3AAsCOwB3AAtu8UgAygDAAH4ACwGgALcBpwC6AahdAu0COwLtbvFIAMoAwAALCgCaAu0ACwLtAAsCOwLtAAtu8UgAygDAA24ACwNvAAu0VsQAAzsAABCkjUIpAAsAUIusOggWcgMeBxVsGwL67U/2HlzmWOEeOgALASvuAAseAfpKUpnpGgYJDCIZM6YyARUE9ThqAD5iXQgnAJYJPnOzw0ZAEZxEKsIAkA4DhAHnTAIDxxUDK0lxCQlPYgIvIQVYJQBVqE1GakUAKGYiDToSBA1EtAYAXQJYAIF8GgMHRyAAIAjOe9YncekRAA0KACUrjwE7Ayc6AAYWAqaiKG4McEcqANoN3+Mg9TwCBhIkuCny+JwUQ29L008JluRxu3K+oAdqiHOqFH0AG5SUIfUJ5SxCGfxdipRzqTmT4V5Zb+r1Uo4Vm+NqSSEl2mNvR2JhIa8SpYO6ntdwFXHCWTCK8f2+Hxo7uiG3drDycAuKIMP5bhi06ACnqArH1rz4Rqg//lm6SgJGEVbF9xJHISaR6HxqxSnkw6shDnelHKNEfGUXSJRJ1GcsmtJw25xrZMDK9gXSm1/YMkdX4/6NKYOdtk/NQ3/NnDASjTc3fPjIjW/5sVfVObX2oTDWkr1dF9f3kxBsD3/3aQO8hPfRz+e0uEiJqt1161griu7gz8hDDwtpy+F+BWtefnKHZPAxcZoWbnznhJpy0e842j36bcNzGnIEusgGX0a8ZxsnjcSsPDZ09yZ36fCQbriHeQ72JRMILNl6ePPf2HWoVwgWAm1fb3V2sAY0+B6rAXqSwPBgseVmoqsBTSrm91+XasMYYySI8eeRxH3ZvHkMz3BQ5aJ3iUVbYPNM3/7emRtjlsMgv/9VyTsyt/mK+8fgWeT6SoFaclXqn42dAIsvAarF5vNNWHzKSkKQ/8Hfk5ZWK7r9yliOsooyBjRhfkHP4Q2DkWXQi6FG/9r/IwbmkV5T7JSopHKn1pJwm9tb5Ot0oyN1Z2mPpKXHTxx2nlK08fKk1hEYA8WgVVWL5lgx0iTv+KdojJeU23ZDjmiubXOxVXJKKi2Wjuh2HLZOFLiSC7Tls5SMh4f+Pj6xUSrNjFqLGehRNB8lC0QSLNmkJJx/wSG3MnjE9T1CkPwJI0wH2lfzwETIiVqUxg0dfu5q39Gt+hwdcxkhhNvQ4TyrBceof3Mhs/IxFci1HmHr4FMZgXEEczPiGCx0HRwzAqDq2j9AVm1kwN0mRVLWLylgtoPNapF5cY4Y1wJh/e0BBwZj44YgZrDNqvD/9Hv7GFYdUQeDJuQ3EWI4HaKqavU1XjC/n41kT4L79kqGq0kLhdTZvgP3TA3fS0ozVz+5piZsoOtIvBUFoMKbNcmBL6YxxaUAusHB38XrS8dQMnQwJfUUkpRoGr5AUeWicvBTzyK9g77+yCkf5PAysL7r/JjcZgrbvRpMW9iyaxZvKO6ceZN2EwIxKwVFPuvFuiEPGCoagbMo+SpydLrXqBzNCDGFCrO/rkcwa2xhokQZ5CdZ0AsU3JfSqJ6n5I14YA+P/uAgfhPU84Tlw7cEFfp7AEE8ey4sP12PTt4Cods1GRgDOB5xvyiR5m+Bx8O5nBCNctU8BevfV5A08x6RHd5jcwPTMDSZJOedIZ1cGQ704lxbAzqZOP05ZxaOghzSdvFBHYqomATARyAADK4elP8Ly3IrUZKfWh23Xy20uBUmLS4Pfagu9+oyVa2iPgqRP3F2CTUsvJ7+RYnN8fFZbU/HVvxvcFFDKkiTqV5UBZ3Gz54JAKByi9hkKMZJvuGgcSYXFmw08UyoQyVdfTD1/dMkCHXcTGAKeROgArsvmRrQTLUOXioOHGK2QkjHuoYFgXciZoTJd6Fs5q1QX1G+p/e26hYsEf7QZD1nnIyl/SFkNtYYmmBhpBrxl9WbY0YpHWRuw2Ll/tj9mD8P4snVzJl4F9J+1arVeTb9E5r2ILH04qStjxQNwn3m4YNqxmaNbLAqW2TN6LidwuJRqS+NXbtqxoeDXpxeGWmxzSkWxjkyCkX4NQRme6q5SAcC+M7+9ETfA/EwrzQajKakCwYyeunP6ZFlxU2oMEn1Pz31zeStW74G406ZJFCl1wAXIoUKkWotYEpOuXB1uVNxJ63dpJEqfxBeptwIHNrPz8BllZoIcBoXwgfJ+8VAUnVPvRvexnw0Ma/WiGYuJO5y8QTvEYBigFmhUxY5RqzE8OcywN/8m4UYrlaniJO75XQ6KSo9+tWHlu+hMi0UVdiKQp7NelnoZUzNaIyBPVeOwK6GNp+FfHuPOoyhaWuNvTYFkvxscMQWDh+zeFCFkgwbXftiV23ywJ4+uwRqmg9k3KzwIQpzppt8DBBOMbrqwQM5Gb05sEwdKzMiAqOloaA/lr0KA+1pr0/+HiWoiIjHA/wir2nIuS3PeU/ji3O6ZwoxcR1SZ9FhtLC5S0FIzFhbBWcGVP/KpxOPSiUoAdWUpqKH++6Scz507iCcxYI6rdMBICPJZea7OcmeFw5mObJSiqpjg2UoWNIs+cFhyDSt6geV5qgi3FunmwwDoGSMgerFOZGX1m0dMCYo5XOruxO063dwENK9DbnVM9wYFREzh4vyU1WYYJ/LRRp6oxgjqP/X5a8/4Af6p6NWkQferzBmXme0zY/4nwMJm/wd1tIqSwGz+E3xPEAOoZlJit3XddD7/BT1pllzOx+8bmQtANQ/S6fZexc6qi3W+Q2xcmXTUhuS5mpHQRvcxZUN0S5+PL9lXWUAaRZhEH8hTdAcuNMMCuVNKTEGtSUKNi3O6KhSaTzck8csZ2vWRZ+d7mW8c4IKwXIYd25S/zIftPkwPzufjEvOHWVD1m+FjpDVUTV0DGDuHj6QnaEwLu/dEgdLQOg9E1Sro9XHJ8ykLAwtPu+pxqKDuFexqON1sKQm7rwbE1E68UCfA/erovrTCG+DBSNg0l4goDQvZN6uNlbyLpcZAwj2UclycvLpIZMgv4yRlpb3YuMftozorbcGVHt/VeDV3+Fdf1TP0iuaCsPi2G4XeGhsyF1ubVDxkoJhmniQ0/jSg/eYML9KLfnCFgISWkp91eauR3IQvED0nAPXK+6hPCYs+n3+hCZbiskmVMG2da+0EsZPonUeIY8EbfusQXjsK/eFDaosbPjEfQS0RKG7yj5GG69M7MeO1HmiUYocgygJHL6M1qzUDDwUSmr99V7Sdr2F3JjQAJY+F0yH33Iv3+C9M38eML7gTgmNu/r2bUMiPvpYbZ6v1/IaESirBHNa7mPKn4dEmYg7v/+HQgPN1G79jBQ1+soydfDC2r+h2Bl/KIc5KjMK7OH6nb1jLsNf0EHVe2KBiE51ox636uyG6Lho0t3J34L5QY/ilE3mikaF4HKXG1mG1rCevT1Vv6GavltxoQe/bMrpZvRggnBxSEPEeEzkEdOxTnPXHVjUYdw8JYvjB/o7Eegc3Ma+NUxLLnsK0kJlinPmUHzHGtrk5+CAbVzFOBqpyy3QVUnzTDfC/0XD94/okH+OB+i7g9lolhWIjSnfIb+Eq43ZXOWmwvjyV/qqD+t0e+7mTEM74qP/Ozt8nmC7mRpyu63OB4KnUzFc074SqoyPUAgM+/TJGFo6T44EHnQU4X4z6qannVqgw/U7zCpwcmXV1AubIrvOmkKHazJAR55ePjp5tLBsN8vAqs3NAHdcEHOR2xQ0lsNAFzSUuxFQCFYvXLZJdOj9p4fNq6p0HBGUik2YzaI4xySy91KzhQ0+q1hjxvImRwPRf76tChlRkhRCi74NXZ9qUNeIwP+s5p+3m5nwPdNOHgSLD79n7O9m1n1uDHiMntq4nkYwV5OZ1ENbXxFd4PgrlvavZsyUO4MqYlqqn1O8W/I1dEZq5dXhrbETLaZIbC2Kj/Aa/QM+fqUOHdf0tXAQ1huZ3cmWECWSXy/43j35+Mvq9xws7JKseriZ1pEWKc8qlzNrGPUGcVgOa9cPJYIJsGnJTAUsEcDOEVULO5x0rXBijc1lgXEzQQKhROf8zIV82w8eswc78YX11KYLWQRcgHNJElBxfXr72lS2RBSl07qTKorO2uUDZr3sFhYsvnhLZn0A94KRzJ/7DEGIAhW5ZWFpL8gEwu1aLA9MuWZzNwl8Oze9Y+bX+v9gywRVnoB5I/8kXTXU3141yRLYrIOOz6SOnyHNy4SieqzkBXharjfjqq1q6tklaEbA8Qfm2DaIPs7OTq/nvJBjKfO2H9bH2cCMh1+5gspfycu8f/cuuRmtDjyqZ7uCIMyjdV3a+p3fqmXsRx4C8lujezIFHnQiVTXLXuI1XrwN3+siYYj2HHTvESUx8DlOTXpak9qFRK+L3mgJ1WsD7F4cu1aJoFoYQnu+wGDMOjJM3kiBQWHCcvhJ/HRdxodOQp45YZaOTA22Nb4XKCVxqkbwMYFhzYQYIAnCW8FW14uf98jhUG2zrKhQQ0q0CEq0t5nXyvUyvR8DvD69LU+g3i+HFWQMQ8PqZuHD+sNKAV0+M6EJC0szq7rEr7B5bQ8BcNHzvDMc9eqB5ZCQdTf80Obn4uzjwpYU7SISdtV0QGa9D3Wrh2BDQtpBKxaNFV+/Cy2P/Sv+8s7Ud0Fd74X4+o/TNztWgETUapy+majNQ68Lq3ee0ZO48VEbTZYiH1Co4OlfWef82RWeyUXo7woM03PyapGfikTnQinoNq5z5veLpeMV3HCAMTaZmA1oGLAn7XS3XYsz+XK7VMQsc4XKrmDXOLU/pSXVNUq8dIqTba///3x6LiLS6xs1xuCAYSfcQ3+rQgmu7uvf3THKt5Ooo97TqcbRqxx7EASizaQCBQllG/rYxVapMLgtLbZS64w1MDBMXX+PQpBKNwqUKOf2DDRDUXQf9EhOS0Qj4nTmlA8dzSLz/G1d+Ud8MTy/6ghhdiLpeerGY/UlDOfiuqFsMUU5/UYlP+BAmgRLuNpvrUaLlVkrqDievNVEAwF+4CoM1MZTmjxjJMsKJq+u8Zd7tNCUFy6LiyYXRJQ4VyvEQFFaCGKsxIwQkk7EzZ6LTJq2hUuPhvAW+gQnSG6J+MszC+7QCRHcnqDdyNRJ6T9xyS87A6MDutbzKGvGktpbXqtzWtXb9HsfK2cBMomjN9a4y+TaJLnXxAeX/HWzmf4cR4vALt/P4w4qgKY04ml4ZdLOinFYS6cup3G/1ie4+t1eOnpBNlqGqs75ilzkT4+DsZQxNvaSKJ//6zIbbk/M7LOhFmRc/1R+kBtz7JFGdZm/COotIdvQoXpTqP/1uqEUmCb/QWoGLMwO5ANcHzxdY48IGP5+J+zKOTBFZ4Pid+GTM+Wq12MV/H86xEJptBa6T+p3kgpwLedManBHC2GgNrFpoN2xnrMz9WFWX/8/ygSBkavq2Uv7FdCsLEYLu9LLIvAU0bNRDtzYl+/vXmjpIvuJFYjmI0im6QEYqnIeMsNjXG4vIutIGHijeAG/9EDBozKV5cldkHbLxHh25vT+ZEzbhXlqvpzKJwcEgfNwLAKFeo0/pvEE10XDB+EXRTXtSzJozQKFFAJhMxYkVaCW+E9AL7tMeU8acxidHqzb6lX4691UsDpy/LLRmT+epgW56+5Cw8tB4kMUv6s9lh3eRKbyGs+H/4mQMaYzPTf2OOdokEn+zzgvoD3FqNKk8QqGAXVsqcGdXrT62fSPkR2vROFi68A6se86UxRUk4cajfPyCC4G5wDhD+zNq4jodQ4u4n/m37Lr36n4LIAAsVr02dFi9AiwA81MYs2rm4eDlDNmdMRvEKRHfBwW5DdMNp0jPFZMeARqF/wL4XBfd+EMLBfMzpH5GH6NaW+1vrvMdg+VxDzatk3MXgO3ro3P/DpcC6+Mo4MySJhKJhSR01SGGGp5hPWmrrUgrv3lDnP+HhcI3nt3YqBoVAVTBAQT5iuhTg8nvPtd8ZeYj6w1x6RqGUBrSku7+N1+BaasZvjTk64RoIDlL8brpEcJx3OmY7jLoZsswdtmhfC/G21llXhITOwmvRDDeTTPbyASOa16cF5/A1fZAidJpqju3wYAy9avPR1ya6eNp9K8XYrrtuxlqi+bDKwlfrYdR0RRiKRVTLOH85+ZY7XSmzRpfZBJjaTa81VDcJHpZnZnSQLASGYW9l51ZV/h7eVzTi3Hv6hUsgc/51AqJRTkpbFVLXXszoBL8nBX0u/0jBLT8nH+fJePbrwURT58OY+UieRjd1vs04w0VG5VN2U6MoGZkQzKN/ptz0Q366dxoTGmj7i1NQGHi9GgnquXFYdrCfZBmeb7s0T6yrdlZH5cZuwHFyIJ/kAtGsTg0xH5taAAq44BAk1CPk9KVVbqQzrCUiFdF/6gtlPQ8bHHc1G1W92MXGZ5HEHftyLYs8mbD/9xYRUWkHmlM0zC2ilJlnNgV4bfALpQghxOUoZL7VTqtCHIaQSXm+YUMnpkXybnV+A6xlm2CVy8fn0Xlm2XRa0+zzOa21JWWmixfiPMSCZ7qA4rS93VN3pkpF1s5TonQjisHf7iU9ZGvUPOAKZcR1pbeVf/Ul7OhepGCaId9wOtqo7pJ7yLcBZ0pFkOF28y4zEI/kcUNmutBHaQpBdNM8vjCS6HZRokkeo88TBAjGyG7SR+6vUgTcyK9Imalj0kuxz0wmK+byQU11AiJFk/ya5dNduRClcnU64yGu/ieWSeOos1t3ep+RPIWQ2pyTYVbZltTbsb7NiwSi3AV+8KLWk7LxCnfZUetEM8ThnsSoGH38/nyAwFguJp8FjvlHtcWZuU4hPva0rHfr0UhOOJ/F6vS62FW7KzkmRll2HEc7oUq4fyi5T70Vl7YVIfsPHUCdHesf9Lk7WNVWO75JDkYbMI8TOW8JKVtLY9d6UJRITO8oKo0xS+o99Yy04iniGHAaGj88kEWgwv0OrHdY/nr76DOGNS59hXCGXzTKUvDl9iKpLSWYN1lxIeyywdNpTkhay74w2jFT6NS8qkjo5CxA1yfSYwp6AJIZNKIeEK5PJAW7ORgWgwp0VgzYpqovMrWxbu+DGZ6Lhie1RAqpzm8VUzKJOH3mCzWuTOLsN3VT/dv2eeYe9UjbR8YTBsLz7q60VN1sU51k+um1f8JxD5pPhbhSC8rRaB454tmh6YUWrJI3+GWY0qeWioj/tbkYITOkJaeuGt4JrJvHA+l0Gu7kY7XOaa05alMnRWVCXqFgLIwSY4uF59Ue5SU4QKuc/HamDxbr0x6csCetXGoP7Qn1Bk/J9DsynO/UD6iZ1Hyrz+jit0hDCwi/E9OjgKTbB3ZQKQ/0ZOvevfNHG0NK4Aj3Cp7NpRk07RT1i/S0EL93Ag8GRgKI9CfpajKyK6+Jj/PI1KO5/85VAwz2AwzP8FTBb075IxCXv6T9RVvWT2tUaqxDS92zrGUbWzUYk9mSs82pECH+fkqsDt93VW++4YsR/dHCYcQSYTO/KaBMDj9LSD/J/+z20Kq8XvZUAIHtm9hRPP3ItbuAu2Hm5lkPs92pd7kCxgRs0xOVBnZ13ccdA0aunrwv9SdqElJRC3g+oCu+nXyCgmXUs9yMjTMAIHfxZV+aPKcZeUBWt057Xo85Ks1Ir5gzEHCWqZEhrLZMuF11ziGtFQUds/EESajhagzcKsxamcSZxGth4UII+adPhQkUnx2WyN+4YWR+r3f8MnkyGFuR4zjzxJS8WsQYR5PTyRaD9ixa6Mh741nBHbzfjXHskGDq179xaRNrCIB1z1xRfWfjqw2pHc1zk9xlPpL8sQWAIuETZZhbnmL54rceXVNRvUiKrrqIkeogsl0XXb17ylNb0f4GA9Wd44vffEG8FSZGHEL2fbaTGRcSiCeA8PmA/f6Hz8HCS76fXUHwgwkzSwlI71ekZ7Fapmlk/KC+Hs8hUcw3N2LN5LhkVYyizYFl/uPeVP5lsoJHhhfWvvSWruCUW1ZcJOeuTbrDgywJ/qG07gZJplnTvLcYdNaH0KMYOYMGX+rB4NGPFmQsNaIwlWrfCezxre8zXBrsMT+edVLbLqN1BqB76JH4BvZTqUIMfGwPGEn+EnmTV86fPBaYbFL3DFEhjB45CewkXEAtJxk4/Ms2pPXnaRqdky0HOYdcUcE2zcXq4vaIvW2/v0nHFJH2XXe22ueDmq/18XGtELSq85j9X8q0tcNSSKJIX8FTuJF/Pf8j5PhqG2u+osvsLxYrvvfeVJL+4tkcXcr9JV7v0ERmj/X6fM3NC4j6dS1+9Umr2oPavqiAydTZPLMNRGY23LO9zAVDly7jD+70G5TPPLdhRIl4WxcYjLnM+SNcJ26FOrkrISUtPObIz5Zb3AG612krnpy15RMW+1cQjlnWFI6538qky9axd2oJmHIHP08KyP0ubGO+TQNOYuv2uh17yCIvR8VcStw7o1g0NM60sk+8Tq7YfIBJrtp53GkvzXH7OA0p8/n/u1satf/VJhtR1l8Wa6Gmaug7haSpaCaYQax6ta0mkutlb+eAOSG1aobM81D9A4iS1RRlzBBoVX6tU1S6WE2N9ORY6DfeLRC4l9Rvr5h95XDWB2mR1d4WFudpsgVYwiTwT31ljskD8ZyDOlm5DkGh9N/UB/0AI5Xvb8ZBmai2hQ4BWMqFwYnzxwB26YHSOv9WgY3JXnvoN+2R4rqGVh/LLDMtpFP+SpMGJNWvbIl5SOodbCczW2RKleksPoUeGEzrjtKHVdtZA+kfqO+rVx/iclCqwoopepvJpSTDjT+b9GWylGRF8EDbGlw6eUzmJM95Ovoz+kwLX3c2fTjFeYEsE7vUZm3mqdGJuKh2w9/QGSaqRHs99aScGOdDqkFcACoqdbBoQqqjamhH6Q9ng39JCg3lrGJwd50Qk9ovnqBTr8MME7Ps2wiVfygUmPoUBJJfJWX5Nda0nuncbFkA==")),rn=new Set(Xr(en)),nn=new Set(Xr(en)),on=function(t){let e=[];for(;;){let r=t();if(0==r)break;e.push(Qr(r,t))}for(;;){let r=t()-1;if(r<0)break;e.push(tn(r,t))}return function(t){const e={};for(let r=0;r<t.length;r++){const n=t[r];e[n[0]]=n[1]}return e}(Vr(e))}(en),sn=function(t){let e=Xr(t).sort((t,e)=>t-e);return function r(){let n=[];for(;;){let i=Xr(t,e);if(0==i.length)break;n.push({set:new Set(i),node:r()})}n.sort((t,e)=>e.set.size-t.set.size);let i=t(),o=i%3;i=i/3|0;let s=!!(1&i);return i>>=1,{branches:n,valid:o,fe0f:s,save:1==i,check:2==i}}()}(en);function an(t){return Ir(t)}function un(t){return t.filter(t=>65039!=t)}function hn(t){for(let e of t.split(".")){let t=an(e);try{for(let e=t.lastIndexOf(95)-1;e>=0;e--)if(95!==t[e])throw new Error("underscore only allowed at start");if(t.length>=4&&t.every(t=>t<128)&&45===t[2]&&45===t[3])throw new Error("invalid label extension")}catch(t){throw new Error(`Invalid label "${e}": ${t.message}`)}}return t}function cn(t){return hn(function(t,e){let r=an(t).reverse(),n=[];for(;r.length;){let t=fn(r);if(t){n.push(...e(t));continue}let i=r.pop();if(rn.has(i)){n.push(i);continue}if(nn.has(i))continue;let o=on[i];if(!o)throw new Error(`Disallowed codepoint: 0x${i.toString(16).toUpperCase()}`);n.push(...o)}return hn(function(t){return t.normalize("NFC")}(String.fromCodePoint(...n)))}(t,un))}function fn(t,e){var r;let n,i,o=sn,s=[],a=t.length;for(e&&(e.length=0);a;){let u=t[--a];if(o=null===(r=o.branches.find(t=>t.set.has(u)))||void 0===r?void 0:r.node,!o)break;if(o.save)i=u;else if(o.check&&u===i)break;s.push(u),o.fe0f&&(s.push(65039),a>0&&65039==t[a-1]&&a--),o.valid&&(n=s.slice(),2==o.valid&&n.splice(1,1),e&&e.push(...t.slice(a).reverse()),t.length=a)}return n}const ln=new yt(Gr),dn=new Uint8Array(32);function pn(t){if(0===t.length)throw new Error("invalid ENS name; empty component");return t}function mn(t){const e=Rr(cn(t)),r=[];if(0===t.length)return r;let n=0;for(let t=0;t<e.length;t++){46===e[t]&&(r.push(pn(e.slice(n,t))),n=t+1)}if(n>=e.length)throw new Error("invalid ENS name; empty component");return r.push(pn(e.slice(n))),r}function gn(t){"string"!=typeof t&&ln.throwArgumentError("invalid ENS name; not a string","name",t);let e=dn;const r=mn(t);for(;r.length;)e=Er(St([e,Er(r.pop())]));return Bt(e)}function yn(t){return Bt(St(mn(t).map(t=>{if(t.length>63)throw new Error("invalid DNS encoded entry; length exceeds 63 bytes");const e=new Uint8Array(t.length+1);return e.set(t,1),e[0]=e.length-1,e})))+"00"}dn.fill(0);function bn(t){return"string"==typeof t&&(t=Rr(t)),Er(St([Rr("Ethereum Signed Message:\n"),Rr(String(t.length)),t]))}const vn=new yt("rlp/5.8.0");function wn(t){const e=[];for(;t;)e.unshift(255&t),t>>=8;return e}function _n(t,e,r){let n=0;for(let i=0;i<r;i++)n=256*n+t[e+i];return n}function En(t){if(Array.isArray(t)){let e=[];if(t.forEach(function(t){e=e.concat(En(t))}),e.length<=55)return e.unshift(192+e.length),e;const r=wn(e.length);return r.unshift(247+r.length),r.concat(e)}_t(t)||vn.throwArgumentError("RLP object must be BytesLike","object",t);const e=Array.prototype.slice.call(Mt(t));if(1===e.length&&e[0]<=127)return e;if(e.length<=55)return e.unshift(128+e.length),e;const r=wn(e.length);return r.unshift(183+r.length),r.concat(e)}function An(t){return Bt(En(t))}function Mn(t,e,r,n){const i=[];for(;r<e+1+n;){const o=Sn(t,r);i.push(o.result),(r+=o.consumed)>e+1+n&&vn.throwError("child data too short",yt.errors.BUFFER_OVERRUN,{})}return{consumed:1+n,result:i}}function Sn(t,e){if(0===t.length&&vn.throwError("data too short",yt.errors.BUFFER_OVERRUN,{}),t[e]>=248){const r=t[e]-247;e+1+r>t.length&&vn.throwError("data short segment too short",yt.errors.BUFFER_OVERRUN,{});const n=_n(t,e+1,r);return e+1+r+n>t.length&&vn.throwError("data long segment too short",yt.errors.BUFFER_OVERRUN,{}),Mn(t,e,e+1+r,r+n)}if(t[e]>=192){const r=t[e]-192;return e+1+r>t.length&&vn.throwError("data array too short",yt.errors.BUFFER_OVERRUN,{}),Mn(t,e,e+1,r)}if(t[e]>=184){const r=t[e]-183;e+1+r>t.length&&vn.throwError("data array too short",yt.errors.BUFFER_OVERRUN,{});const n=_n(t,e+1,r);e+1+r+n>t.length&&vn.throwError("data array too short",yt.errors.BUFFER_OVERRUN,{});return{consumed:1+r+n,result:Bt(t.slice(e+1+r,e+1+r+n))}}if(t[e]>=128){const r=t[e]-128;e+1+r>t.length&&vn.throwError("data too short",yt.errors.BUFFER_OVERRUN,{});return{consumed:1+r,result:Bt(t.slice(e+1,e+1+r))}}return{consumed:1,result:Bt(t[e])}}function kn(t){const e=Mt(t),r=Sn(e,0);return r.consumed!==e.length&&vn.throwArgumentError("invalid rlp data","data",t),r.result}var xn=Object.freeze({__proto__:null,decode:kn,encode:An});const Tn=new yt("address/5.8.0");function Rn(t){Tt(t,20)||Tn.throwArgumentError("invalid address","address",t);const e=(t=t.toLowerCase()).substring(2).split(""),r=new Uint8Array(40);for(let t=0;t<40;t++)r[t]=e[t].charCodeAt(0);const n=Mt(Er(r));for(let t=0;t<40;t+=2)n[t>>1]>>4>=8&&(e[t]=e[t].toUpperCase()),(15&n[t>>1])>=8&&(e[t+1]=e[t+1].toUpperCase());return"0x"+e.join("")}const Bn={};for(let t=0;t<10;t++)Bn[String(t)]=String(t);for(let t=0;t<26;t++)Bn[String.fromCharCode(65+t)]=String(10+t);const Nn=Math.floor(function(t){return Math.log10?Math.log10(t):Math.log(t)/Math.LN10}(9007199254740991));function Pn(t){let e=(t=(t=t.toUpperCase()).substring(4)+t.substring(0,2)+"00").split("").map(t=>Bn[t]).join("");for(;e.length>=Nn;){let t=e.substring(0,Nn);e=parseInt(t,10)%97+e.substring(t.length)}let r=String(98-parseInt(e,10)%97);for(;r.length<2;)r="0"+r;return r}function In(t){let e=null;if("string"!=typeof t&&Tn.throwArgumentError("invalid address","address",t),t.match(/^(0x)?[0-9a-fA-F]{40}$/))"0x"!==t.substring(0,2)&&(t="0x"+t),e=Rn(t),t.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&e!==t&&Tn.throwArgumentError("bad address checksum","address",t);else if(t.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){for(t.substring(2,4)!==Pn(t)&&Tn.throwArgumentError("bad icap checksum","address",t),r=t.substring(4),e=new Ft(r,36).toString(16);e.length<40;)e="0"+e;e=Rn("0x"+e)}else Tn.throwArgumentError("invalid address","address",t);var r;return e}function On(t){let e=null;try{e=In(t.from)}catch(e){Tn.throwArgumentError("missing from address","transaction",t)}return In(Pt(Er(An([e,kt(Mt(Gt.from(t.nonce).toHexString()))])),12))}var Cn=function(t,e,r,n){return new(r||(r=Promise))(function(i,o){function s(t){try{u(n.next(t))}catch(t){o(t)}}function a(t){try{u(n.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r(function(t){t(e)})).then(s,a)}u((n=n.apply(t,e||[])).next())})};const Ln=new yt(Gr),jn=new Uint8Array(32);jn.fill(0);const Dn=Gt.from(-1),Un=Gt.from(0),Fn=Gt.from(1),zn=Gt.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");const qn=Lt(Fn.toHexString(),32),Hn=Lt(Un.toHexString(),32),Kn={name:"string",version:"string",chainId:"uint256",verifyingContract:"address",salt:"bytes32"},Gn=["name","version","chainId","verifyingContract","salt"];function Vn(t){return function(e){return"string"!=typeof e&&Ln.throwArgumentError(`invalid domain value for ${JSON.stringify(t)}`,`domain.${t}`,e),e}}const Wn={name:Vn("name"),version:Vn("version"),chainId:function(t){try{return Gt.from(t).toString()}catch(t){}return Ln.throwArgumentError('invalid domain value for "chainId"',"domain.chainId",t)},verifyingContract:function(t){try{return In(t).toLowerCase()}catch(t){}return Ln.throwArgumentError('invalid domain value "verifyingContract"',"domain.verifyingContract",t)},salt:function(t){try{const e=Mt(t);if(32!==e.length)throw new Error("bad length");return Bt(e)}catch(t){}return Ln.throwArgumentError('invalid domain value "salt"',"domain.salt",t)}};function Jn(t){{const e=t.match(/^(u?)int(\d*)$/);if(e){const r=""===e[1],n=parseInt(e[2]||"256");(n%8!=0||n>256||e[2]&&e[2]!==String(n))&&Ln.throwArgumentError("invalid numeric width","type",t);const i=zn.mask(r?n-1:n),o=r?i.add(Fn).mul(Dn):Un;return function(e){const r=Gt.from(e);return(r.lt(o)||r.gt(i))&&Ln.throwArgumentError(`value out-of-bounds for ${t}`,"value",e),Lt(r.toTwos(256).toHexString(),32)}}}{const e=t.match(/^bytes(\d+)$/);if(e){const r=parseInt(e[1]);return(0===r||r>32||e[1]!==String(r))&&Ln.throwArgumentError("invalid bytes width","type",t),function(e){return Mt(e).length!==r&&Ln.throwArgumentError(`invalid length for ${t}`,"value",e),function(t){const e=Mt(t),r=e.length%32;return r?It([e,jn.slice(r)]):Bt(e)}(e)}}}switch(t){case"address":return function(t){return Lt(In(t),32)};case"bool":return function(t){return t?qn:Hn};case"bytes":return function(t){return Er(t)};case"string":return function(t){return Kr(t)}}return null}function Zn(t,e){return`${t}(${e.map(({name:t,type:e})=>e+" "+t).join(",")})`}class Yn{constructor(t){fe(this,"types",Object.freeze(ve(t))),fe(this,"_encoderCache",{}),fe(this,"_types",{});const e={},r={},n={};Object.keys(t).forEach(t=>{e[t]={},r[t]=[],n[t]={}});for(const n in t){const i={};t[n].forEach(o=>{i[o.name]&&Ln.throwArgumentError(`duplicate variable name ${JSON.stringify(o.name)} in ${JSON.stringify(n)}`,"types",t),i[o.name]=!0;const s=o.type.match(/^([^\x5b]*)(\x5b|$)/)[1];s===n&&Ln.throwArgumentError(`circular type reference to ${JSON.stringify(s)}`,"types",t);Jn(s)||(r[s]||Ln.throwArgumentError(`unknown type ${JSON.stringify(s)}`,"types",t),r[s].push(n),e[n][s]=!0)})}const i=Object.keys(r).filter(t=>0===r[t].length);0===i.length?Ln.throwArgumentError("missing primary type","types",t):i.length>1&&Ln.throwArgumentError(`ambiguous primary types or unused types: ${i.map(t=>JSON.stringify(t)).join(", ")}`,"types",t),fe(this,"primaryType",i[0]),function i(o,s){s[o]&&Ln.throwArgumentError(`circular type reference to ${JSON.stringify(o)}`,"types",t),s[o]=!0,Object.keys(e[o]).forEach(t=>{r[t]&&(i(t,s),Object.keys(s).forEach(e=>{n[e][t]=!0}))}),delete s[o]}(this.primaryType,{});for(const e in n){const r=Object.keys(n[e]);r.sort(),this._types[e]=Zn(e,t[e])+r.map(e=>Zn(e,t[e])).join("")}}getEncoder(t){let e=this._encoderCache[t];return e||(e=this._encoderCache[t]=this._getEncoder(t)),e}_getEncoder(t){{const e=Jn(t);if(e)return e}const e=t.match(/^(.*)(\x5b(\d*)\x5d)$/);if(e){const t=e[1],r=this.getEncoder(t),n=parseInt(e[3]);return e=>{n>=0&&e.length!==n&&Ln.throwArgumentError("array length mismatch; expected length ${ arrayLength }","value",e);let i=e.map(r);return this._types[t]&&(i=i.map(Er)),Er(It(i))}}const r=this.types[t];if(r){const e=Kr(this._types[t]);return t=>{const n=r.map(({name:e,type:r})=>{const n=this.getEncoder(r)(t[e]);return this._types[r]?Er(n):n});return n.unshift(e),It(n)}}return Ln.throwArgumentError(`unknown type: ${t}`,"type",t)}encodeType(t){const e=this._types[t];return e||Ln.throwArgumentError(`unknown type: ${JSON.stringify(t)}`,"name",t),e}encodeData(t,e){return this.getEncoder(t)(e)}hashStruct(t,e){return Er(this.encodeData(t,e))}encode(t){return this.encodeData(this.primaryType,t)}hash(t){return this.hashStruct(this.primaryType,t)}_visit(t,e,r){if(Jn(t))return r(t,e);const n=t.match(/^(.*)(\x5b(\d*)\x5d)$/);if(n){const t=n[1],i=parseInt(n[3]);return i>=0&&e.length!==i&&Ln.throwArgumentError("array length mismatch; expected length ${ arrayLength }","value",e),e.map(e=>this._visit(t,e,r))}const i=this.types[t];return i?i.reduce((t,{name:n,type:i})=>(t[n]=this._visit(i,e[n],r),t),{}):Ln.throwArgumentError(`unknown type: ${t}`,"type",t)}visit(t,e){return this._visit(this.primaryType,t,e)}static from(t){return new Yn(t)}static getPrimaryType(t){return Yn.from(t).primaryType}static hashStruct(t,e,r){return Yn.from(e).hashStruct(t,r)}static hashDomain(t){const e=[];for(const r in t){const n=Kn[r];n||Ln.throwArgumentError(`invalid typed-data domain key: ${JSON.stringify(r)}`,"domain",t),e.push({name:r,type:n})}return e.sort((t,e)=>Gn.indexOf(t.name)-Gn.indexOf(e.name)),Yn.hashStruct("EIP712Domain",{EIP712Domain:e},t)}static encode(t,e,r){return It(["0x1901",Yn.hashDomain(t),Yn.from(e).hash(r)])}static hash(t,e,r){return Er(Yn.encode(t,e,r))}static resolveNames(t,e,r,n){return Cn(this,void 0,void 0,function*(){t=me(t);const i={};t.verifyingContract&&!Tt(t.verifyingContract,20)&&(i[t.verifyingContract]="0x");const o=Yn.from(e);o.visit(r,(t,e)=>("address"!==t||Tt(e,20)||(i[e]="0x"),e));for(const t in i)i[t]=yield n(t);return t.verifyingContract&&i[t.verifyingContract]&&(t.verifyingContract=i[t.verifyingContract]),r=o.visit(r,(t,e)=>"address"===t&&i[e]?i[e]:e),{domain:t,value:r}})}static getPayload(t,e,r){Yn.hashDomain(t);const n={},i=[];Gn.forEach(e=>{const r=t[e];null!=r&&(n[e]=Wn[e](r),i.push({name:e,type:Kn[e]}))});const o=Yn.from(e),s=me(e);return s.EIP712Domain?Ln.throwArgumentError("types must not contain EIP712Domain type","types.EIP712Domain",e):s.EIP712Domain=i,o.encode(r),{types:s,domain:n,primaryType:o.primaryType,message:o.visit(r,(t,e)=>{if(t.match(/^bytes(\d*)/))return Bt(Mt(e));if(t.match(/^u?int/))return Gt.from(e).toString();switch(t){case"address":return e.toLowerCase();case"bool":return!!e;case"string":return"string"!=typeof e&&Ln.throwArgumentError("invalid string","value",e),e}return Ln.throwArgumentError("unsupported type","type",t)})}}}var Xn={},$n={},Qn=ti;function ti(t,e){if(!t)throw new Error(e||"Assertion failed")}ti.equal=function(t,e,r){if(t!=e)throw new Error(r||"Assertion failed: "+t+" != "+e)};var ei={exports:{}};"function"==typeof Object.create?ei.exports=function(t,e){e&&(t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:ei.exports=function(t,e){if(e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}};var ri=ei.exports,ni=Qn,ii=ri;function oi(t,e){return 55296==(64512&t.charCodeAt(e))&&(!(e<0||e+1>=t.length)&&56320==(64512&t.charCodeAt(e+1)))}function si(t){return(t>>>24|t>>>8&65280|t<<8&16711680|(255&t)<<24)>>>0}function ai(t){return 1===t.length?"0"+t:t}function ui(t){return 7===t.length?"0"+t:6===t.length?"00"+t:5===t.length?"000"+t:4===t.length?"0000"+t:3===t.length?"00000"+t:2===t.length?"000000"+t:1===t.length?"0000000"+t:t}$n.inherits=ii,$n.toArray=function(t,e){if(Array.isArray(t))return t.slice();if(!t)return[];var r=[];if("string"==typeof t)if(e){if("hex"===e)for((t=t.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(t="0"+t),i=0;i<t.length;i+=2)r.push(parseInt(t[i]+t[i+1],16))}else for(var n=0,i=0;i<t.length;i++){var o=t.charCodeAt(i);o<128?r[n++]=o:o<2048?(r[n++]=o>>6|192,r[n++]=63&o|128):oi(t,i)?(o=65536+((1023&o)<<10)+(1023&t.charCodeAt(++i)),r[n++]=o>>18|240,r[n++]=o>>12&63|128,r[n++]=o>>6&63|128,r[n++]=63&o|128):(r[n++]=o>>12|224,r[n++]=o>>6&63|128,r[n++]=63&o|128)}else for(i=0;i<t.length;i++)r[i]=0|t[i];return r},$n.toHex=function(t){for(var e="",r=0;r<t.length;r++)e+=ai(t[r].toString(16));return e},$n.htonl=si,$n.toHex32=function(t,e){for(var r="",n=0;n<t.length;n++){var i=t[n];"little"===e&&(i=si(i)),r+=ui(i.toString(16))}return r},$n.zero2=ai,$n.zero8=ui,$n.join32=function(t,e,r,n){var i=r-e;ni(i%4==0);for(var o=new Array(i/4),s=0,a=e;s<o.length;s++,a+=4){var u;u="big"===n?t[a]<<24|t[a+1]<<16|t[a+2]<<8|t[a+3]:t[a+3]<<24|t[a+2]<<16|t[a+1]<<8|t[a],o[s]=u>>>0}return o},$n.split32=function(t,e){for(var r=new Array(4*t.length),n=0,i=0;n<t.length;n++,i+=4){var o=t[n];"big"===e?(r[i]=o>>>24,r[i+1]=o>>>16&255,r[i+2]=o>>>8&255,r[i+3]=255&o):(r[i+3]=o>>>24,r[i+2]=o>>>16&255,r[i+1]=o>>>8&255,r[i]=255&o)}return r},$n.rotr32=function(t,e){return t>>>e|t<<32-e},$n.rotl32=function(t,e){return t<<e|t>>>32-e},$n.sum32=function(t,e){return t+e>>>0},$n.sum32_3=function(t,e,r){return t+e+r>>>0},$n.sum32_4=function(t,e,r,n){return t+e+r+n>>>0},$n.sum32_5=function(t,e,r,n,i){return t+e+r+n+i>>>0},$n.sum64=function(t,e,r,n){var i=t[e],o=n+t[e+1]>>>0,s=(o<n?1:0)+r+i;t[e]=s>>>0,t[e+1]=o},$n.sum64_hi=function(t,e,r,n){return(e+n>>>0<e?1:0)+t+r>>>0},$n.sum64_lo=function(t,e,r,n){return e+n>>>0},$n.sum64_4_hi=function(t,e,r,n,i,o,s,a){var u=0,h=e;return u+=(h=h+n>>>0)<e?1:0,u+=(h=h+o>>>0)<o?1:0,t+r+i+s+(u+=(h=h+a>>>0)<a?1:0)>>>0},$n.sum64_4_lo=function(t,e,r,n,i,o,s,a){return e+n+o+a>>>0},$n.sum64_5_hi=function(t,e,r,n,i,o,s,a,u,h){var c=0,f=e;return c+=(f=f+n>>>0)<e?1:0,c+=(f=f+o>>>0)<o?1:0,c+=(f=f+a>>>0)<a?1:0,t+r+i+s+u+(c+=(f=f+h>>>0)<h?1:0)>>>0},$n.sum64_5_lo=function(t,e,r,n,i,o,s,a,u,h){return e+n+o+a+h>>>0},$n.rotr64_hi=function(t,e,r){return(e<<32-r|t>>>r)>>>0},$n.rotr64_lo=function(t,e,r){return(t<<32-r|e>>>r)>>>0},$n.shr64_hi=function(t,e,r){return t>>>r},$n.shr64_lo=function(t,e,r){return(t<<32-r|e>>>r)>>>0};var hi={},ci=$n,fi=Qn;function li(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}hi.BlockHash=li,li.prototype.update=function(t,e){if(t=ci.toArray(t,e),this.pending?this.pending=this.pending.concat(t):this.pending=t,this.pendingTotal+=t.length,this.pending.length>=this._delta8){var r=(t=this.pending).length%this._delta8;this.pending=t.slice(t.length-r,t.length),0===this.pending.length&&(this.pending=null),t=ci.join32(t,0,t.length-r,this.endian);for(var n=0;n<t.length;n+=this._delta32)this._update(t,n,n+this._delta32)}return this},li.prototype.digest=function(t){return this.update(this._pad()),fi(null===this.pending),this._digest(t)},li.prototype._pad=function(){var t=this.pendingTotal,e=this._delta8,r=e-(t+this.padLength)%e,n=new Array(r+this.padLength);n[0]=128;for(var i=1;i<r;i++)n[i]=0;if(t<<=3,"big"===this.endian){for(var o=8;o<this.padLength;o++)n[i++]=0;n[i++]=0,n[i++]=0,n[i++]=0,n[i++]=0,n[i++]=t>>>24&255,n[i++]=t>>>16&255,n[i++]=t>>>8&255,n[i++]=255&t}else for(n[i++]=255&t,n[i++]=t>>>8&255,n[i++]=t>>>16&255,n[i++]=t>>>24&255,n[i++]=0,n[i++]=0,n[i++]=0,n[i++]=0,o=8;o<this.padLength;o++)n[i++]=0;return n};var di={},pi={},mi=$n.rotr32;function gi(t,e,r){return t&e^~t&r}function yi(t,e,r){return t&e^t&r^e&r}function bi(t,e,r){return t^e^r}pi.ft_1=function(t,e,r,n){return 0===t?gi(e,r,n):1===t||3===t?bi(e,r,n):2===t?yi(e,r,n):void 0},pi.ch32=gi,pi.maj32=yi,pi.p32=bi,pi.s0_256=function(t){return mi(t,2)^mi(t,13)^mi(t,22)},pi.s1_256=function(t){return mi(t,6)^mi(t,11)^mi(t,25)},pi.g0_256=function(t){return mi(t,7)^mi(t,18)^t>>>3},pi.g1_256=function(t){return mi(t,17)^mi(t,19)^t>>>10};var vi=$n,wi=hi,_i=pi,Ei=vi.rotl32,Ai=vi.sum32,Mi=vi.sum32_5,Si=_i.ft_1,ki=wi.BlockHash,xi=[1518500249,1859775393,2400959708,3395469782];function Ti(){if(!(this instanceof Ti))return new Ti;ki.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}vi.inherits(Ti,ki);var Ri=Ti;Ti.blockSize=512,Ti.outSize=160,Ti.hmacStrength=80,Ti.padLength=64,Ti.prototype._update=function(t,e){for(var r=this.W,n=0;n<16;n++)r[n]=t[e+n];for(;n<r.length;n++)r[n]=Ei(r[n-3]^r[n-8]^r[n-14]^r[n-16],1);var i=this.h[0],o=this.h[1],s=this.h[2],a=this.h[3],u=this.h[4];for(n=0;n<r.length;n++){var h=~~(n/20),c=Mi(Ei(i,5),Si(h,o,s,a),u,r[n],xi[h]);u=a,a=s,s=Ei(o,30),o=i,i=c}this.h[0]=Ai(this.h[0],i),this.h[1]=Ai(this.h[1],o),this.h[2]=Ai(this.h[2],s),this.h[3]=Ai(this.h[3],a),this.h[4]=Ai(this.h[4],u)},Ti.prototype._digest=function(t){return"hex"===t?vi.toHex32(this.h,"big"):vi.split32(this.h,"big")};var Bi=$n,Ni=hi,Pi=pi,Ii=Qn,Oi=Bi.sum32,Ci=Bi.sum32_4,Li=Bi.sum32_5,ji=Pi.ch32,Di=Pi.maj32,Ui=Pi.s0_256,Fi=Pi.s1_256,zi=Pi.g0_256,qi=Pi.g1_256,Hi=Ni.BlockHash,Ki=[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 Gi(){if(!(this instanceof Gi))return new Gi;Hi.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=Ki,this.W=new Array(64)}Bi.inherits(Gi,Hi);var Vi=Gi;Gi.blockSize=512,Gi.outSize=256,Gi.hmacStrength=192,Gi.padLength=64,Gi.prototype._update=function(t,e){for(var r=this.W,n=0;n<16;n++)r[n]=t[e+n];for(;n<r.length;n++)r[n]=Ci(qi(r[n-2]),r[n-7],zi(r[n-15]),r[n-16]);var i=this.h[0],o=this.h[1],s=this.h[2],a=this.h[3],u=this.h[4],h=this.h[5],c=this.h[6],f=this.h[7];for(Ii(this.k.length===r.length),n=0;n<r.length;n++){var l=Li(f,Fi(u),ji(u,h,c),this.k[n],r[n]),d=Oi(Ui(i),Di(i,o,s));f=c,c=h,h=u,u=Oi(a,l),a=s,s=o,o=i,i=Oi(l,d)}this.h[0]=Oi(this.h[0],i),this.h[1]=Oi(this.h[1],o),this.h[2]=Oi(this.h[2],s),this.h[3]=Oi(this.h[3],a),this.h[4]=Oi(this.h[4],u),this.h[5]=Oi(this.h[5],h),this.h[6]=Oi(this.h[6],c),this.h[7]=Oi(this.h[7],f)},Gi.prototype._digest=function(t){return"hex"===t?Bi.toHex32(this.h,"big"):Bi.split32(this.h,"big")};var Wi=$n,Ji=Vi;function Zi(){if(!(this instanceof Zi))return new Zi;Ji.call(this),this.h=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]}Wi.inherits(Zi,Ji);var Yi=Zi;Zi.blockSize=512,Zi.outSize=224,Zi.hmacStrength=192,Zi.padLength=64,Zi.prototype._digest=function(t){return"hex"===t?Wi.toHex32(this.h.slice(0,7),"big"):Wi.split32(this.h.slice(0,7),"big")};var Xi=$n,$i=hi,Qi=Qn,to=Xi.rotr64_hi,eo=Xi.rotr64_lo,ro=Xi.shr64_hi,no=Xi.shr64_lo,io=Xi.sum64,oo=Xi.sum64_hi,so=Xi.sum64_lo,ao=Xi.sum64_4_hi,uo=Xi.sum64_4_lo,ho=Xi.sum64_5_hi,co=Xi.sum64_5_lo,fo=$i.BlockHash,lo=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function po(){if(!(this instanceof po))return new po;fo.call(this),this.h=[1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209],this.k=lo,this.W=new Array(160)}Xi.inherits(po,fo);var mo=po;function go(t,e,r,n,i){var o=t&r^~t&i;return o<0&&(o+=4294967296),o}function yo(t,e,r,n,i,o){var s=e&n^~e&o;return s<0&&(s+=4294967296),s}function bo(t,e,r,n,i){var o=t&r^t&i^r&i;return o<0&&(o+=4294967296),o}function vo(t,e,r,n,i,o){var s=e&n^e&o^n&o;return s<0&&(s+=4294967296),s}function wo(t,e){var r=to(t,e,28)^to(e,t,2)^to(e,t,7);return r<0&&(r+=4294967296),r}function _o(t,e){var r=eo(t,e,28)^eo(e,t,2)^eo(e,t,7);return r<0&&(r+=4294967296),r}function Eo(t,e){var r=to(t,e,14)^to(t,e,18)^to(e,t,9);return r<0&&(r+=4294967296),r}function Ao(t,e){var r=eo(t,e,14)^eo(t,e,18)^eo(e,t,9);return r<0&&(r+=4294967296),r}function Mo(t,e){var r=to(t,e,1)^to(t,e,8)^ro(t,e,7);return r<0&&(r+=4294967296),r}function So(t,e){var r=eo(t,e,1)^eo(t,e,8)^no(t,e,7);return r<0&&(r+=4294967296),r}function ko(t,e){var r=to(t,e,19)^to(e,t,29)^ro(t,e,6);return r<0&&(r+=4294967296),r}function xo(t,e){var r=eo(t,e,19)^eo(e,t,29)^no(t,e,6);return r<0&&(r+=4294967296),r}po.blockSize=1024,po.outSize=512,po.hmacStrength=192,po.padLength=128,po.prototype._prepareBlock=function(t,e){for(var r=this.W,n=0;n<32;n++)r[n]=t[e+n];for(;n<r.length;n+=2){var i=ko(r[n-4],r[n-3]),o=xo(r[n-4],r[n-3]),s=r[n-14],a=r[n-13],u=Mo(r[n-30],r[n-29]),h=So(r[n-30],r[n-29]),c=r[n-32],f=r[n-31];r[n]=ao(i,o,s,a,u,h,c,f),r[n+1]=uo(i,o,s,a,u,h,c,f)}},po.prototype._update=function(t,e){this._prepareBlock(t,e);var r=this.W,n=this.h[0],i=this.h[1],o=this.h[2],s=this.h[3],a=this.h[4],u=this.h[5],h=this.h[6],c=this.h[7],f=this.h[8],l=this.h[9],d=this.h[10],p=this.h[11],m=this.h[12],g=this.h[13],y=this.h[14],b=this.h[15];Qi(this.k.length===r.length);for(var v=0;v<r.length;v+=2){var w=y,_=b,E=Eo(f,l),A=Ao(f,l),M=go(f,l,d,p,m),S=yo(f,l,d,p,m,g),k=this.k[v],x=this.k[v+1],T=r[v],R=r[v+1],B=ho(w,_,E,A,M,S,k,x,T,R),N=co(w,_,E,A,M,S,k,x,T,R);w=wo(n,i),_=_o(n,i),E=bo(n,i,o,s,a),A=vo(n,i,o,s,a,u);var P=oo(w,_,E,A),I=so(w,_,E,A);y=m,b=g,m=d,g=p,d=f,p=l,f=oo(h,c,B,N),l=so(c,c,B,N),h=a,c=u,a=o,u=s,o=n,s=i,n=oo(B,N,P,I),i=so(B,N,P,I)}io(this.h,0,n,i),io(this.h,2,o,s),io(this.h,4,a,u),io(this.h,6,h,c),io(this.h,8,f,l),io(this.h,10,d,p),io(this.h,12,m,g),io(this.h,14,y,b)},po.prototype._digest=function(t){return"hex"===t?Xi.toHex32(this.h,"big"):Xi.split32(this.h,"big")};var To=$n,Ro=mo;function Bo(){if(!(this instanceof Bo))return new Bo;Ro.call(this),this.h=[3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]}To.inherits(Bo,Ro);var No=Bo;Bo.blockSize=1024,Bo.outSize=384,Bo.hmacStrength=192,Bo.padLength=128,Bo.prototype._digest=function(t){return"hex"===t?To.toHex32(this.h.slice(0,12),"big"):To.split32(this.h.slice(0,12),"big")},di.sha1=Ri,di.sha224=Yi,di.sha256=Vi,di.sha384=No,di.sha512=mo;var Po={},Io=$n,Oo=hi,Co=Io.rotl32,Lo=Io.sum32,jo=Io.sum32_3,Do=Io.sum32_4,Uo=Oo.BlockHash;function Fo(){if(!(this instanceof Fo))return new Fo;Uo.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.endian="little"}function zo(t,e,r,n){return t<=15?e^r^n:t<=31?e&r|~e&n:t<=47?(e|~r)^n:t<=63?e&n|r&~n:e^(r|~n)}function qo(t){return t<=15?0:t<=31?1518500249:t<=47?1859775393:t<=63?2400959708:2840853838}function Ho(t){return t<=15?1352829926:t<=31?1548603684:t<=47?1836072691:t<=63?2053994217:0}Io.inherits(Fo,Uo),Po.ripemd160=Fo,Fo.blockSize=512,Fo.outSize=160,Fo.hmacStrength=192,Fo.padLength=64,Fo.prototype._update=function(t,e){for(var r=this.h[0],n=this.h[1],i=this.h[2],o=this.h[3],s=this.h[4],a=r,u=n,h=i,c=o,f=s,l=0;l<80;l++){var d=Lo(Co(Do(r,zo(l,n,i,o),t[Ko[l]+e],qo(l)),Vo[l]),s);r=s,s=o,o=Co(i,10),i=n,n=d,d=Lo(Co(Do(a,zo(79-l,u,h,c),t[Go[l]+e],Ho(l)),Wo[l]),f),a=f,f=c,c=Co(h,10),h=u,u=d}d=jo(this.h[1],i,c),this.h[1]=jo(this.h[2],o,f),this.h[2]=jo(this.h[3],s,a),this.h[3]=jo(this.h[4],r,u),this.h[4]=jo(this.h[0],n,h),this.h[0]=d},Fo.prototype._digest=function(t){return"hex"===t?Io.toHex32(this.h,"little"):Io.split32(this.h,"little")};var Ko=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],Go=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],Vo=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],Wo=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11],Jo=$n,Zo=Qn;function Yo(t,e,r){if(!(this instanceof Yo))return new Yo(t,e,r);this.Hash=t,this.blockSize=t.blockSize/8,this.outSize=t.outSize/8,this.inner=null,this.outer=null,this._init(Jo.toArray(e,r))}var Xo=Yo;Yo.prototype._init=function(t){t.length>this.blockSize&&(t=(new this.Hash).update(t).digest()),Zo(t.length<=this.blockSize);for(var e=t.length;e<this.blockSize;e++)t.push(0);for(e=0;e<t.length;e++)t[e]^=54;for(this.inner=(new this.Hash).update(t),e=0;e<t.length;e++)t[e]^=106;this.outer=(new this.Hash).update(t)},Yo.prototype.update=function(t,e){return this.inner.update(t,e),this},Yo.prototype.digest=function(t){return this.outer.update(this.inner.digest()),this.outer.digest(t)},function(t){var e=t;e.utils=$n,e.common=hi,e.sha=di,e.ripemd=Po,e.hmac=Xo,e.sha1=e.sha.sha1,e.sha256=e.sha.sha256,e.sha224=e.sha.sha224,e.sha384=e.sha.sha384,e.sha512=e.sha.sha512,e.ripemd160=e.ripemd.ripemd160}(Xn);var $o,Qo=r(Xn);!function(t){t.sha256="sha256",t.sha512="sha512"}($o||($o={}));const ts=new yt("sha2/5.8.0");function es(t){return"0x"+Qo.ripemd160().update(Mt(t)).digest("hex")}function rs(t){return"0x"+Qo.sha256().update(Mt(t)).digest("hex")}function ns(t,e,r){return $o[t]||ts.throwError("unsupported algorithm "+t,yt.errors.UNSUPPORTED_OPERATION,{operation:"hmac",algorithm:t}),"0x"+Qo.hmac(Qo[t],Mt(e)).update(Mt(r)).digest("hex")}var is=function(t,e,r,n){return new(r||(r=Promise))(function(i,o){function s(t){try{u(n.next(t))}catch(t){o(t)}}function a(t){try{u(n.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r(function(t){t(e)})).then(s,a)}u((n=n.apply(t,e||[])).next())})};function os(t,e){return is(this,void 0,void 0,function*(){null==e&&(e={});const r={method:e.method||"GET",headers:e.headers||{},body:e.body||void 0};if(!0!==e.skipFetchSetup&&(r.mode="cors",r.cache="no-cache",r.credentials="same-origin",r.redirect="follow",r.referrer="client"),null!=e.fetchOptions){const t=e.fetchOptions;t.mode&&(r.mode=t.mode),t.cache&&(r.cache=t.cache),t.credentials&&(r.credentials=t.credentials),t.redirect&&(r.redirect=t.redirect),t.referrer&&(r.referrer=t.referrer)}const n=yield fetch(t,r),i=yield n.arrayBuffer(),o={};return n.headers.forEach?n.headers.forEach((t,e)=>{o[e.toLowerCase()]=t}):n.headers.keys().forEach(t=>{o[t.toLowerCase()]=n.headers.get(t)}),{headers:o,statusCode:n.status,statusMessage:n.statusText,body:Mt(new Uint8Array(i))}})}var ss=function(t,e,r,n){return new(r||(r=Promise))(function(i,o){function s(t){try{u(n.next(t))}catch(t){o(t)}}function a(t){try{u(n.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r(function(t){t(e)})).then(s,a)}u((n=n.apply(t,e||[])).next())})};const as=new yt("web/5.8.0");function us(t){return new Promise(e=>{setTimeout(e,t)})}function hs(t,e){if(null==t)return null;if("string"==typeof t)return t;if(_t(t)){if(e&&("text"===e.split("/")[0]||"application/json"===e.split(";")[0].trim()))try{return Pr(t)}catch(t){}return Bt(t)}return t}function cs(t,e,r){const n="object"==typeof t&&null!=t.throttleLimit?t.throttleLimit:12;as.assertArgument(n>0&&n%1==0,"invalid connection throttle limit","connection.throttleLimit",n);const i="object"==typeof t?t.throttleCallback:null,o="object"==typeof t&&"number"==typeof t.throttleSlotInterval?t.throttleSlotInterval:100;as.assertArgument(o>0&&o%1==0,"invalid connection throttle slot interval","connection.throttleSlotInterval",o);const s="object"==typeof t&&!!t.errorPassThrough,a={};let u=null;const h={method:"GET"};let c=!1,f=12e4;if("string"==typeof t)u=t;else if("object"==typeof t){if(null!=t&&null!=t.url||as.throwArgumentError("missing URL","connection.url",t),u=t.url,"number"==typeof t.timeout&&t.timeout>0&&(f=t.timeout),t.headers)for(const e in t.headers)a[e.toLowerCase()]={key:e,value:String(t.headers[e])},["if-none-match","if-modified-since"].indexOf(e.toLowerCase())>=0&&(c=!0);if(h.allowGzip=!!t.allowGzip,null!=t.user&&null!=t.password){"https:"!==u.substring(0,6)&&!0!==t.allowInsecureAuthentication&&as.throwError("basic authentication requires a secure https url",yt.errors.INVALID_ARGUMENT,{argument:"url",url:u,user:t.user,password:"[REDACTED]"});const e=t.user+":"+t.password;a.authorization={key:"Authorization",value:"Basic "+Oe(Rr(e))}}null!=t.skipFetchSetup&&(h.skipFetchSetup=!!t.skipFetchSetup),null!=t.fetchOptions&&(h.fetchOptions=me(t.fetchOptions))}const l=new RegExp("^data:([^;:]*)?(;base64)?,(.*)$","i"),d=u?u.match(l):null;if(d)try{const t={statusCode:200,statusMessage:"OK",headers:{"content-type":d[1]||"text/plain"},body:d[2]?Ie(d[3]):(p=d[3],Rr(p.replace(/%([0-9a-f][0-9a-f])/gi,(t,e)=>String.fromCharCode(parseInt(e,16)))))};let e=t.body;return r&&(e=r(t.body,t)),Promise.resolve(e)}catch(t){as.throwError("processing response error",yt.errors.SERVER_ERROR,{body:hs(d[1],d[2]),error:t,requestBody:null,requestMethod:"GET",url:u})}var p;e&&(h.method="POST",h.body=e,null==a["content-type"]&&(a["content-type"]={key:"Content-Type",value:"application/octet-stream"}),null==a["content-length"]&&(a["content-length"]={key:"Content-Length",value:String(e.length)}));const m={};Object.keys(a).forEach(t=>{const e=a[t];m[e.key]=e.value}),h.headers=m;const g=function(){let t=null;return{promise:new Promise(function(e,r){f&&(t=setTimeout(()=>{null!=t&&(t=null,r(as.makeError("timeout",yt.errors.TIMEOUT,{requestBody:hs(h.body,m["content-type"]),requestMethod:h.method,timeout:f,url:u})))},f))}),cancel:function(){null!=t&&(clearTimeout(t),t=null)}}}(),y=function(){return ss(this,void 0,void 0,function*(){for(let t=0;t<n;t++){let e=null;try{if(e=yield os(u,h),t<n)if(301===e.statusCode||302===e.statusCode){const t=e.headers.location||"";if("GET"===h.method&&t.match(/^https:/)){u=e.headers.location;continue}}else if(429===e.statusCode){let r=!0;if(i&&(r=yield i(t,u)),r){let r=0;const n=e.headers["retry-after"];r="string"==typeof n&&n.match(/^[1-9][0-9]*$/)?1e3*parseInt(n):o*parseInt(String(Math.random()*Math.pow(2,t))),yield us(r);continue}}}catch(t){e=t.response,null==e&&(g.cancel(),as.throwError("missing response",yt.errors.SERVER_ERROR,{requestBody:hs(h.body,m["content-type"]),requestMethod:h.method,serverError:t,url:u}))}let a=e.body;if(c&&304===e.statusCode?a=null:!s&&(e.statusCode<200||e.statusCode>=300)&&(g.cancel(),as.throwError("bad response",yt.errors.SERVER_ERROR,{status:e.statusCode,headers:e.headers,body:hs(a,e.headers?e.headers["content-type"]:null),requestBody:hs(h.body,m["content-type"]),requestMethod:h.method,url:u})),r)try{const t=yield r(a,e);return g.cancel(),t}catch(r){if(r.throttleRetry&&t<n){let e=!0;if(i&&(e=yield i(t,u)),e){const e=o*parseInt(String(Math.random()*Math.pow(2,t)));yield us(e);continue}}g.cancel(),as.throwError("processing response error",yt.errors.SERVER_ERROR,{body:hs(a,e.headers?e.headers["content-type"]:null),error:r,requestBody:hs(h.body,m["content-type"]),requestMethod:h.method,url:u})}return g.cancel(),a}return as.throwError("failed response",yt.errors.SERVER_ERROR,{requestBody:hs(h.body,m["content-type"]),requestMethod:h.method,url:u})})}();return Promise.race([g.promise,y])}function fs(t,e,r){let n=null;if(null!=e){n=Rr(e);const r="string"==typeof t?{url:t}:me(t);if(r.headers){0!==Object.keys(r.headers).filter(t=>"content-type"===t.toLowerCase()).length||(r.headers=me(r.headers),r.headers["content-type"]="application/json")}else r.headers={"content-type":"application/json"};t=r}return cs(t,n,(t,e)=>{let n=null;if(null!=t)try{n=JSON.parse(Pr(t))}catch(e){as.throwError("invalid JSON",yt.errors.SERVER_ERROR,{body:t,error:e})}return r&&(n=r(n,e)),n})}function ls(t,e){return e||(e={}),null==(e=me(e)).floor&&(e.floor=0),null==e.ceiling&&(e.ceiling=1e4),null==e.interval&&(e.interval=250),new Promise(function(r,n){let i=null,o=!1;const s=()=>!o&&(o=!0,i&&clearTimeout(i),!0);e.timeout&&(i=setTimeout(()=>{s()&&n(new Error("timeout"))},e.timeout));const a=e.retryLimit;let u=0;!function i(){return t().then(function(t){if(void 0!==t)s()&&r(t);else if(e.oncePoll)e.oncePoll.once("poll",i);else if(e.onceBlock)e.onceBlock.once("block",i);else if(!o){if(u++,u>a)return void(s()&&n(new Error("retry limit reached")));let t=e.interval*parseInt(String(Math.random()*Math.pow(2,u)));t<e.floor&&(t=e.floor),t>e.ceiling&&(t=e.ceiling),setTimeout(i,t)}return null},function(t){s()&&n(t)})}()})}for(var ds="qpzry9x8gf2tvdw0s3jn54khce6mua7l",ps={},ms=0;ms<32;ms++){var gs=ds.charAt(ms);if(void 0!==ps[gs])throw new TypeError(gs+" is ambiguous");ps[gs]=ms}function ys(t){var e=t>>25;return(33554431&t)<<5^996825010&-(1&e)^642813549&-(e>>1&1)^513874426&-(e>>2&1)^1027748829&-(e>>3&1)^705979059&-(e>>4&1)}function bs(t){for(var e=1,r=0;r<t.length;++r){var n=t.charCodeAt(r);if(n<33||n>126)return"Invalid prefix ("+t+")";e=ys(e)^n>>5}for(e=ys(e),r=0;r<t.length;++r){var i=t.charCodeAt(r);e=ys(e)^31&i}return e}function vs(t,e){if(e=e||90,t.length<8)return t+" too short";if(t.length>e)return"Exceeds length limit";var r=t.toLowerCase(),n=t.toUpperCase();if(t!==r&&t!==n)return"Mixed-case string "+t;var i=(t=r).lastIndexOf("1");if(-1===i)return"No separator character for "+t;if(0===i)return"Missing prefix for "+t;var o=t.slice(0,i),s=t.slice(i+1);if(s.length<6)return"Data too short";var a=bs(o);if("string"==typeof a)return a;for(var u=[],h=0;h<s.length;++h){var c=s.charAt(h),f=ps[c];if(void 0===f)return"Unknown character "+c;a=ys(a)^f,h+6>=s.length||u.push(f)}return 1!==a?"Invalid checksum for "+t:{prefix:o,words:u}}function ws(t,e,r,n){for(var i=0,o=0,s=(1<<r)-1,a=[],u=0;u<t.length;++u)for(i=i<<e|t[u],o+=e;o>=r;)o-=r,a.push(i>>o&s);if(n)o>0&&a.push(i<<r-o&s);else{if(o>=e)return"Excess padding";if(i<<r-o&s)return"Non-zero padding"}return a}var _s={decodeUnsafe:function(){var t=vs.apply(null,arguments);if("object"==typeof t)return t},decode:function(t){var e=vs.apply(null,arguments);if("object"==typeof e)return e;throw new Error(e)},encode:function(t,e,r){if(r=r||90,t.length+7+e.length>r)throw new TypeError("Exceeds length limit");var n=bs(t=t.toLowerCase());if("string"==typeof n)throw new Error(n);for(var i=t+"1",o=0;o<e.length;++o){var s=e[o];if(s>>5)throw new Error("Non 5-bit word");n=ys(n)^s,i+=ds.charAt(s)}for(o=0;o<6;++o)n=ys(n);for(n^=1,o=0;o<6;++o){i+=ds.charAt(n>>5*(5-o)&31)}return i},toWordsUnsafe:function(t){var e=ws(t,8,5,!0);if(Array.isArray(e))return e},toWords:function(t){var e=ws(t,8,5,!0);if(Array.isArray(e))return e;throw new Error(e)},fromWordsUnsafe:function(t){var e=ws(t,5,8,!1);if(Array.isArray(e))return e},fromWords:function(t){var e=ws(t,5,8,!1);if(Array.isArray(e))return e;throw new Error(e)}},Es=r(_s);const As="providers/5.8.0";var Ms={exports:{}};!function(t){!function(t,e){function r(t,e){if(!t)throw new Error(e||"Assertion failed")}function n(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function i(t,e,r){if(i.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(r=e,e=10),this._init(t||0,e||10,r||"be"))}var o;"object"==typeof t?t.exports=i:e.BN=i,i.BN=i,i.wordSize=26;try{o="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:st.Buffer}catch(t){}function s(t,e){var n=t.charCodeAt(e);return n>=48&&n<=57?n-48:n>=65&&n<=70?n-55:n>=97&&n<=102?n-87:void r(!1,"Invalid character in "+t)}function a(t,e,r){var n=s(t,r);return r-1>=e&&(n|=s(t,r-1)<<4),n}function u(t,e,n,i){for(var o=0,s=0,a=Math.min(t.length,n),u=e;u<a;u++){var h=t.charCodeAt(u)-48;o*=i,s=h>=49?h-49+10:h>=17?h-17+10:h,r(h>=0&&s<i,"Invalid character"),o+=s}return o}function h(t,e){t.words=e.words,t.length=e.length,t.negative=e.negative,t.red=e.red}if(i.isBN=function(t){return t instanceof i||null!==t&&"object"==typeof t&&t.constructor.wordSize===i.wordSize&&Array.isArray(t.words)},i.max=function(t,e){return t.cmp(e)>0?t:e},i.min=function(t,e){return t.cmp(e)<0?t:e},i.prototype._init=function(t,e,n){if("number"==typeof t)return this._initNumber(t,e,n);if("object"==typeof t)return this._initArray(t,e,n);"hex"===e&&(e=16),r(e===(0|e)&&e>=2&&e<=36);var i=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i<t.length&&(16===e?this._parseHex(t,i,n):(this._parseBase(t,e,i),"le"===n&&this._initArray(this.toArray(),e,n)))},i.prototype._initNumber=function(t,e,n){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(r(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===n&&this._initArray(this.toArray(),e,n)},i.prototype._initArray=function(t,e,n){if(r("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var i=0;i<this.length;i++)this.words[i]=0;var o,s,a=0;if("be"===n)for(i=t.length-1,o=0;i>=0;i-=3)s=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[o]|=s<<a&67108863,this.words[o+1]=s>>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);else if("le"===n)for(i=0,o=0;i<t.length;i+=3)s=t[i]|t[i+1]<<8|t[i+2]<<16,this.words[o]|=s<<a&67108863,this.words[o+1]=s>>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);return this._strip()},i.prototype._parseHex=function(t,e,r){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var n=0;n<this.length;n++)this.words[n]=0;var i,o=0,s=0;if("be"===r)for(n=t.length-1;n>=e;n-=2)i=a(t,e,n)<<o,this.words[s]|=67108863&i,o>=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;else for(n=(t.length-e)%2==0?e+1:e;n<t.length;n+=2)i=a(t,e,n)<<o,this.words[s]|=67108863&i,o>=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;this._strip()},i.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var n=0,i=1;i<=67108863;i*=e)n++;n--,i=i/e|0;for(var o=t.length-r,s=o%n,a=Math.min(o,o-s)+r,h=0,c=r;c<a;c+=n)h=u(t,c,c+n,e),this.imuln(i),this.words[0]+h<67108864?this.words[0]+=h:this._iaddn(h);if(0!==s){var f=1;for(h=u(t,c,t.length,e),c=0;c<s;c++)f*=e;this.imuln(f),this.words[0]+h<67108864?this.words[0]+=h:this._iaddn(h)}this._strip()},i.prototype.copy=function(t){t.words=new Array(this.length);for(var e=0;e<this.length;e++)t.words[e]=this.words[e];t.length=this.length,t.negative=this.negative,t.red=this.red},i.prototype._move=function(t){h(t,this)},i.prototype.clone=function(){var t=new i(null);return this.copy(t),t},i.prototype._expand=function(t){for(;this.length<t;)this.words[this.length++]=0;return this},i.prototype._strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},i.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for)try{i.prototype[Symbol.for("nodejs.util.inspect.custom")]=c}catch(t){i.prototype.inspect=c}else i.prototype.inspect=c;function c(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"}var f=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],l=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],d=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];i.prototype.toString=function(t,e){var n;if(e=0|e||1,16===(t=t||10)||"hex"===t){n="";for(var i=0,o=0,s=0;s<this.length;s++){var a=this.words[s],u=(16777215&(a<<i|o)).toString(16);o=a>>>24-i&16777215,(i+=2)>=26&&(i-=26,s--),n=0!==o||s!==this.length-1?f[6-u.length]+u+n:u+n}for(0!==o&&(n=o.toString(16)+n);n.length%e!==0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}if(t===(0|t)&&t>=2&&t<=36){var h=l[t],c=d[t];n="";var p=this.clone();for(p.negative=0;!p.isZero();){var m=p.modrn(c).toString(t);n=(p=p.idivn(c)).isZero()?m+n:f[h-m.length]+m+n}for(this.isZero()&&(n="0"+n);n.length%e!==0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}r(!1,"Base should be between 2 and 36")},i.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},i.prototype.toJSON=function(){return this.toString(16,2)},o&&(i.prototype.toBuffer=function(t,e){return this.toArrayLike(o,t,e)}),i.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)};function p(t,e,r){r.negative=e.negative^t.negative;var n=t.length+e.length|0;r.length=n,n=n-1|0;var i=0|t.words[0],o=0|e.words[0],s=i*o,a=67108863&s,u=s/67108864|0;r.words[0]=a;for(var h=1;h<n;h++){for(var c=u>>>26,f=67108863&u,l=Math.min(h,e.length-1),d=Math.max(0,h-t.length+1);d<=l;d++){var p=h-d|0;c+=(s=(i=0|t.words[p])*(o=0|e.words[d])+f)/67108864|0,f=67108863&s}r.words[h]=0|f,u=0|c}return 0!==u?r.words[h]=0|u:r.length--,r._strip()}i.prototype.toArrayLike=function(t,e,n){this._strip();var i=this.byteLength(),o=n||Math.max(1,i);r(i<=o,"byte array longer than desired length"),r(o>0,"Requested array length <= 0");var s=function(t,e){return t.allocUnsafe?t.allocUnsafe(e):new t(e)}(t,o);return this["_toArrayLike"+("le"===e?"LE":"BE")](s,i),s},i.prototype._toArrayLikeLE=function(t,e){for(var r=0,n=0,i=0,o=0;i<this.length;i++){var s=this.words[i]<<o|n;t[r++]=255&s,r<t.length&&(t[r++]=s>>8&255),r<t.length&&(t[r++]=s>>16&255),6===o?(r<t.length&&(t[r++]=s>>24&255),n=0,o=0):(n=s>>>24,o+=2)}if(r<t.length)for(t[r++]=n;r<t.length;)t[r++]=0},i.prototype._toArrayLikeBE=function(t,e){for(var r=t.length-1,n=0,i=0,o=0;i<this.length;i++){var s=this.words[i]<<o|n;t[r--]=255&s,r>=0&&(t[r--]=s>>8&255),r>=0&&(t[r--]=s>>16&255),6===o?(r>=0&&(t[r--]=s>>24&255),n=0,o=0):(n=s>>>24,o+=2)}if(r>=0)for(t[r--]=n;r>=0;)t[r--]=0},Math.clz32?i.prototype._countBits=function(t){return 32-Math.clz32(t)}:i.prototype._countBits=function(t){var e=t,r=0;return e>=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},i.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 8191&e||(r+=13,e>>>=13),127&e||(r+=7,e>>>=7),15&e||(r+=4,e>>>=4),3&e||(r+=2,e>>>=2),1&e||r++,r},i.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;e<this.length;e++){var r=this._zeroBits(this.words[e]);if(t+=r,26!==r)break}return t},i.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},i.prototype.toTwos=function(t){return 0!==this.negative?this.abs().inotn(t).iaddn(1):this.clone()},i.prototype.fromTwos=function(t){return this.testn(t-1)?this.notn(t).iaddn(1).ineg():this.clone()},i.prototype.isNeg=function(){return 0!==this.negative},i.prototype.neg=function(){return this.clone().ineg()},i.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},i.prototype.iuor=function(t){for(;this.length<t.length;)this.words[this.length++]=0;for(var e=0;e<t.length;e++)this.words[e]=this.words[e]|t.words[e];return this._strip()},i.prototype.ior=function(t){return r(0===(this.negative|t.negative)),this.iuor(t)},i.prototype.or=function(t){return this.length>t.length?this.clone().ior(t):t.clone().ior(this)},i.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},i.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;r<e.length;r++)this.words[r]=this.words[r]&t.words[r];return this.length=e.length,this._strip()},i.prototype.iand=function(t){return r(0===(this.negative|t.negative)),this.iuand(t)},i.prototype.and=function(t){return this.length>t.length?this.clone().iand(t):t.clone().iand(this)},i.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},i.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var n=0;n<r.length;n++)this.words[n]=e.words[n]^r.words[n];if(this!==e)for(;n<e.length;n++)this.words[n]=e.words[n];return this.length=e.length,this._strip()},i.prototype.ixor=function(t){return r(0===(this.negative|t.negative)),this.iuxor(t)},i.prototype.xor=function(t){return this.length>t.length?this.clone().ixor(t):t.clone().ixor(this)},i.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},i.prototype.inotn=function(t){r("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),n=t%26;this._expand(e),n>0&&e--;for(var i=0;i<e;i++)this.words[i]=67108863&~this.words[i];return n>0&&(this.words[i]=~this.words[i]&67108863>>26-n),this._strip()},i.prototype.notn=function(t){return this.clone().inotn(t)},i.prototype.setn=function(t,e){r("number"==typeof t&&t>=0);var n=t/26|0,i=t%26;return this._expand(n+1),this.words[n]=e?this.words[n]|1<<i:this.words[n]&~(1<<i),this._strip()},i.prototype.iadd=function(t){var e,r,n;if(0!==this.negative&&0===t.negative)return this.negative=0,e=this.isub(t),this.negative^=1,this._normSign();if(0===this.negative&&0!==t.negative)return t.negative=0,e=this.isub(t),t.negative=1,e._normSign();this.length>t.length?(r=this,n=t):(r=t,n=this);for(var i=0,o=0;o<n.length;o++)e=(0|r.words[o])+(0|n.words[o])+i,this.words[o]=67108863&e,i=e>>>26;for(;0!==i&&o<r.length;o++)e=(0|r.words[o])+i,this.words[o]=67108863&e,i=e>>>26;if(this.length=r.length,0!==i)this.words[this.length]=i,this.length++;else if(r!==this)for(;o<r.length;o++)this.words[o]=r.words[o];return this},i.prototype.add=function(t){var e;return 0!==t.negative&&0===this.negative?(t.negative=0,e=this.sub(t),t.negative^=1,e):0===t.negative&&0!==this.negative?(this.negative=0,e=t.sub(this),this.negative=1,e):this.length>t.length?this.clone().iadd(t):t.clone().iadd(this)},i.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,n,i=this.cmp(t);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(r=this,n=t):(r=t,n=this);for(var o=0,s=0;s<n.length;s++)o=(e=(0|r.words[s])-(0|n.words[s])+o)>>26,this.words[s]=67108863&e;for(;0!==o&&s<r.length;s++)o=(e=(0|r.words[s])+o)>>26,this.words[s]=67108863&e;if(0===o&&s<r.length&&r!==this)for(;s<r.length;s++)this.words[s]=r.words[s];return this.length=Math.max(this.length,s),r!==this&&(this.negative=1),this._strip()},i.prototype.sub=function(t){return this.clone().isub(t)};var m=function(t,e,r){var n,i,o,s=t.words,a=e.words,u=r.words,h=0,c=0|s[0],f=8191&c,l=c>>>13,d=0|s[1],p=8191&d,m=d>>>13,g=0|s[2],y=8191&g,b=g>>>13,v=0|s[3],w=8191&v,_=v>>>13,E=0|s[4],A=8191&E,M=E>>>13,S=0|s[5],k=8191&S,x=S>>>13,T=0|s[6],R=8191&T,B=T>>>13,N=0|s[7],P=8191&N,I=N>>>13,O=0|s[8],C=8191&O,L=O>>>13,j=0|s[9],D=8191&j,U=j>>>13,F=0|a[0],z=8191&F,q=F>>>13,H=0|a[1],K=8191&H,G=H>>>13,V=0|a[2],W=8191&V,J=V>>>13,Z=0|a[3],Y=8191&Z,X=Z>>>13,$=0|a[4],Q=8191&$,tt=$>>>13,et=0|a[5],rt=8191&et,nt=et>>>13,it=0|a[6],ot=8191&it,st=it>>>13,at=0|a[7],ut=8191&at,ht=at>>>13,ct=0|a[8],ft=8191&ct,lt=ct>>>13,dt=0|a[9],pt=8191&dt,mt=dt>>>13;r.negative=t.negative^e.negative,r.length=19;var gt=(h+(n=Math.imul(f,z))|0)+((8191&(i=(i=Math.imul(f,q))+Math.imul(l,z)|0))<<13)|0;h=((o=Math.imul(l,q))+(i>>>13)|0)+(gt>>>26)|0,gt&=67108863,n=Math.imul(p,z),i=(i=Math.imul(p,q))+Math.imul(m,z)|0,o=Math.imul(m,q);var yt=(h+(n=n+Math.imul(f,K)|0)|0)+((8191&(i=(i=i+Math.imul(f,G)|0)+Math.imul(l,K)|0))<<13)|0;h=((o=o+Math.imul(l,G)|0)+(i>>>13)|0)+(yt>>>26)|0,yt&=67108863,n=Math.imul(y,z),i=(i=Math.imul(y,q))+Math.imul(b,z)|0,o=Math.imul(b,q),n=n+Math.imul(p,K)|0,i=(i=i+Math.imul(p,G)|0)+Math.imul(m,K)|0,o=o+Math.imul(m,G)|0;var bt=(h+(n=n+Math.imul(f,W)|0)|0)+((8191&(i=(i=i+Math.imul(f,J)|0)+Math.imul(l,W)|0))<<13)|0;h=((o=o+Math.imul(l,J)|0)+(i>>>13)|0)+(bt>>>26)|0,bt&=67108863,n=Math.imul(w,z),i=(i=Math.imul(w,q))+Math.imul(_,z)|0,o=Math.imul(_,q),n=n+Math.imul(y,K)|0,i=(i=i+Math.imul(y,G)|0)+Math.imul(b,K)|0,o=o+Math.imul(b,G)|0,n=n+Math.imul(p,W)|0,i=(i=i+Math.imul(p,J)|0)+Math.imul(m,W)|0,o=o+Math.imul(m,J)|0;var vt=(h+(n=n+Math.imul(f,Y)|0)|0)+((8191&(i=(i=i+Math.imul(f,X)|0)+Math.imul(l,Y)|0))<<13)|0;h=((o=o+Math.imul(l,X)|0)+(i>>>13)|0)+(vt>>>26)|0,vt&=67108863,n=Math.imul(A,z),i=(i=Math.imul(A,q))+Math.imul(M,z)|0,o=Math.imul(M,q),n=n+Math.imul(w,K)|0,i=(i=i+Math.imul(w,G)|0)+Math.imul(_,K)|0,o=o+Math.imul(_,G)|0,n=n+Math.imul(y,W)|0,i=(i=i+Math.imul(y,J)|0)+Math.imul(b,W)|0,o=o+Math.imul(b,J)|0,n=n+Math.imul(p,Y)|0,i=(i=i+Math.imul(p,X)|0)+Math.imul(m,Y)|0,o=o+Math.imul(m,X)|0;var wt=(h+(n=n+Math.imul(f,Q)|0)|0)+((8191&(i=(i=i+Math.imul(f,tt)|0)+Math.imul(l,Q)|0))<<13)|0;h=((o=o+Math.imul(l,tt)|0)+(i>>>13)|0)+(wt>>>26)|0,wt&=67108863,n=Math.imul(k,z),i=(i=Math.imul(k,q))+Math.imul(x,z)|0,o=Math.imul(x,q),n=n+Math.imul(A,K)|0,i=(i=i+Math.imul(A,G)|0)+Math.imul(M,K)|0,o=o+Math.imul(M,G)|0,n=n+Math.imul(w,W)|0,i=(i=i+Math.imul(w,J)|0)+Math.imul(_,W)|0,o=o+Math.imul(_,J)|0,n=n+Math.imul(y,Y)|0,i=(i=i+Math.imul(y,X)|0)+Math.imul(b,Y)|0,o=o+Math.imul(b,X)|0,n=n+Math.imul(p,Q)|0,i=(i=i+Math.imul(p,tt)|0)+Math.imul(m,Q)|0,o=o+Math.imul(m,tt)|0;var _t=(h+(n=n+Math.imul(f,rt)|0)|0)+((8191&(i=(i=i+Math.imul(f,nt)|0)+Math.imul(l,rt)|0))<<13)|0;h=((o=o+Math.imul(l,nt)|0)+(i>>>13)|0)+(_t>>>26)|0,_t&=67108863,n=Math.imul(R,z),i=(i=Math.imul(R,q))+Math.imul(B,z)|0,o=Math.imul(B,q),n=n+Math.imul(k,K)|0,i=(i=i+Math.imul(k,G)|0)+Math.imul(x,K)|0,o=o+Math.imul(x,G)|0,n=n+Math.imul(A,W)|0,i=(i=i+Math.imul(A,J)|0)+Math.imul(M,W)|0,o=o+Math.imul(M,J)|0,n=n+Math.imul(w,Y)|0,i=(i=i+Math.imul(w,X)|0)+Math.imul(_,Y)|0,o=o+Math.imul(_,X)|0,n=n+Math.imul(y,Q)|0,i=(i=i+Math.imul(y,tt)|0)+Math.imul(b,Q)|0,o=o+Math.imul(b,tt)|0,n=n+Math.imul(p,rt)|0,i=(i=i+Math.imul(p,nt)|0)+Math.imul(m,rt)|0,o=o+Math.imul(m,nt)|0;var Et=(h+(n=n+Math.imul(f,ot)|0)|0)+((8191&(i=(i=i+Math.imul(f,st)|0)+Math.imul(l,ot)|0))<<13)|0;h=((o=o+Math.imul(l,st)|0)+(i>>>13)|0)+(Et>>>26)|0,Et&=67108863,n=Math.imul(P,z),i=(i=Math.imul(P,q))+Math.imul(I,z)|0,o=Math.imul(I,q),n=n+Math.imul(R,K)|0,i=(i=i+Math.imul(R,G)|0)+Math.imul(B,K)|0,o=o+Math.imul(B,G)|0,n=n+Math.imul(k,W)|0,i=(i=i+Math.imul(k,J)|0)+Math.imul(x,W)|0,o=o+Math.imul(x,J)|0,n=n+Math.imul(A,Y)|0,i=(i=i+Math.imul(A,X)|0)+Math.imul(M,Y)|0,o=o+Math.imul(M,X)|0,n=n+Math.imul(w,Q)|0,i=(i=i+Math.imul(w,tt)|0)+Math.imul(_,Q)|0,o=o+Math.imul(_,tt)|0,n=n+Math.imul(y,rt)|0,i=(i=i+Math.imul(y,nt)|0)+Math.imul(b,rt)|0,o=o+Math.imul(b,nt)|0,n=n+Math.imul(p,ot)|0,i=(i=i+Math.imul(p,st)|0)+Math.imul(m,ot)|0,o=o+Math.imul(m,st)|0;var At=(h+(n=n+Math.imul(f,ut)|0)|0)+((8191&(i=(i=i+Math.imul(f,ht)|0)+Math.imul(l,ut)|0))<<13)|0;h=((o=o+Math.imul(l,ht)|0)+(i>>>13)|0)+(At>>>26)|0,At&=67108863,n=Math.imul(C,z),i=(i=Math.imul(C,q))+Math.imul(L,z)|0,o=Math.imul(L,q),n=n+Math.imul(P,K)|0,i=(i=i+Math.imul(P,G)|0)+Math.imul(I,K)|0,o=o+Math.imul(I,G)|0,n=n+Math.imul(R,W)|0,i=(i=i+Math.imul(R,J)|0)+Math.imul(B,W)|0,o=o+Math.imul(B,J)|0,n=n+Math.imul(k,Y)|0,i=(i=i+Math.imul(k,X)|0)+Math.imul(x,Y)|0,o=o+Math.imul(x,X)|0,n=n+Math.imul(A,Q)|0,i=(i=i+Math.imul(A,tt)|0)+Math.imul(M,Q)|0,o=o+Math.imul(M,tt)|0,n=n+Math.imul(w,rt)|0,i=(i=i+Math.imul(w,nt)|0)+Math.imul(_,rt)|0,o=o+Math.imul(_,nt)|0,n=n+Math.imul(y,ot)|0,i=(i=i+Math.imul(y,st)|0)+Math.imul(b,ot)|0,o=o+Math.imul(b,st)|0,n=n+Math.imul(p,ut)|0,i=(i=i+Math.imul(p,ht)|0)+Math.imul(m,ut)|0,o=o+Math.imul(m,ht)|0;var Mt=(h+(n=n+Math.imul(f,ft)|0)|0)+((8191&(i=(i=i+Math.imul(f,lt)|0)+Math.imul(l,ft)|0))<<13)|0;h=((o=o+Math.imul(l,lt)|0)+(i>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,n=Math.imul(D,z),i=(i=Math.imul(D,q))+Math.imul(U,z)|0,o=Math.imul(U,q),n=n+Math.imul(C,K)|0,i=(i=i+Math.imul(C,G)|0)+Math.imul(L,K)|0,o=o+Math.imul(L,G)|0,n=n+Math.imul(P,W)|0,i=(i=i+Math.imul(P,J)|0)+Math.imul(I,W)|0,o=o+Math.imul(I,J)|0,n=n+Math.imul(R,Y)|0,i=(i=i+Math.imul(R,X)|0)+Math.imul(B,Y)|0,o=o+Math.imul(B,X)|0,n=n+Math.imul(k,Q)|0,i=(i=i+Math.imul(k,tt)|0)+Math.imul(x,Q)|0,o=o+Math.imul(x,tt)|0,n=n+Math.imul(A,rt)|0,i=(i=i+Math.imul(A,nt)|0)+Math.imul(M,rt)|0,o=o+Math.imul(M,nt)|0,n=n+Math.imul(w,ot)|0,i=(i=i+Math.imul(w,st)|0)+Math.imul(_,ot)|0,o=o+Math.imul(_,st)|0,n=n+Math.imul(y,ut)|0,i=(i=i+Math.imul(y,ht)|0)+Math.imul(b,ut)|0,o=o+Math.imul(b,ht)|0,n=n+Math.imul(p,ft)|0,i=(i=i+Math.imul(p,lt)|0)+Math.imul(m,ft)|0,o=o+Math.imul(m,lt)|0;var St=(h+(n=n+Math.imul(f,pt)|0)|0)+((8191&(i=(i=i+Math.imul(f,mt)|0)+Math.imul(l,pt)|0))<<13)|0;h=((o=o+Math.imul(l,mt)|0)+(i>>>13)|0)+(St>>>26)|0,St&=67108863,n=Math.imul(D,K),i=(i=Math.imul(D,G))+Math.imul(U,K)|0,o=Math.imul(U,G),n=n+Math.imul(C,W)|0,i=(i=i+Math.imul(C,J)|0)+Math.imul(L,W)|0,o=o+Math.imul(L,J)|0,n=n+Math.imul(P,Y)|0,i=(i=i+Math.imul(P,X)|0)+Math.imul(I,Y)|0,o=o+Math.imul(I,X)|0,n=n+Math.imul(R,Q)|0,i=(i=i+Math.imul(R,tt)|0)+Math.imul(B,Q)|0,o=o+Math.imul(B,tt)|0,n=n+Math.imul(k,rt)|0,i=(i=i+Math.imul(k,nt)|0)+Math.imul(x,rt)|0,o=o+Math.imul(x,nt)|0,n=n+Math.imul(A,ot)|0,i=(i=i+Math.imul(A,st)|0)+Math.imul(M,ot)|0,o=o+Math.imul(M,st)|0,n=n+Math.imul(w,ut)|0,i=(i=i+Math.imul(w,ht)|0)+Math.imul(_,ut)|0,o=o+Math.imul(_,ht)|0,n=n+Math.imul(y,ft)|0,i=(i=i+Math.imul(y,lt)|0)+Math.imul(b,ft)|0,o=o+Math.imul(b,lt)|0;var kt=(h+(n=n+Math.imul(p,pt)|0)|0)+((8191&(i=(i=i+Math.imul(p,mt)|0)+Math.imul(m,pt)|0))<<13)|0;h=((o=o+Math.imul(m,mt)|0)+(i>>>13)|0)+(kt>>>26)|0,kt&=67108863,n=Math.imul(D,W),i=(i=Math.imul(D,J))+Math.imul(U,W)|0,o=Math.imul(U,J),n=n+Math.imul(C,Y)|0,i=(i=i+Math.imul(C,X)|0)+Math.imul(L,Y)|0,o=o+Math.imul(L,X)|0,n=n+Math.imul(P,Q)|0,i=(i=i+Math.imul(P,tt)|0)+Math.imul(I,Q)|0,o=o+Math.imul(I,tt)|0,n=n+Math.imul(R,rt)|0,i=(i=i+Math.imul(R,nt)|0)+Math.imul(B,rt)|0,o=o+Math.imul(B,nt)|0,n=n+Math.imul(k,ot)|0,i=(i=i+Math.imul(k,st)|0)+Math.imul(x,ot)|0,o=o+Math.imul(x,st)|0,n=n+Math.imul(A,ut)|0,i=(i=i+Math.imul(A,ht)|0)+Math.imul(M,ut)|0,o=o+Math.imul(M,ht)|0,n=n+Math.imul(w,ft)|0,i=(i=i+Math.imul(w,lt)|0)+Math.imul(_,ft)|0,o=o+Math.imul(_,lt)|0;var xt=(h+(n=n+Math.imul(y,pt)|0)|0)+((8191&(i=(i=i+Math.imul(y,mt)|0)+Math.imul(b,pt)|0))<<13)|0;h=((o=o+Math.imul(b,mt)|0)+(i>>>13)|0)+(xt>>>26)|0,xt&=67108863,n=Math.imul(D,Y),i=(i=Math.imul(D,X))+Math.imul(U,Y)|0,o=Math.imul(U,X),n=n+Math.imul(C,Q)|0,i=(i=i+Math.imul(C,tt)|0)+Math.imul(L,Q)|0,o=o+Math.imul(L,tt)|0,n=n+Math.imul(P,rt)|0,i=(i=i+Math.imul(P,nt)|0)+Math.imul(I,rt)|0,o=o+Math.imul(I,nt)|0,n=n+Math.imul(R,ot)|0,i=(i=i+Math.imul(R,st)|0)+Math.imul(B,ot)|0,o=o+Math.imul(B,st)|0,n=n+Math.imul(k,ut)|0,i=(i=i+Math.imul(k,ht)|0)+Math.imul(x,ut)|0,o=o+Math.imul(x,ht)|0,n=n+Math.imul(A,ft)|0,i=(i=i+Math.imul(A,lt)|0)+Math.imul(M,ft)|0,o=o+Math.imul(M,lt)|0;var Tt=(h+(n=n+Math.imul(w,pt)|0)|0)+((8191&(i=(i=i+Math.imul(w,mt)|0)+Math.imul(_,pt)|0))<<13)|0;h=((o=o+Math.imul(_,mt)|0)+(i>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,n=Math.imul(D,Q),i=(i=Math.imul(D,tt))+Math.imul(U,Q)|0,o=Math.imul(U,tt),n=n+Math.imul(C,rt)|0,i=(i=i+Math.imul(C,nt)|0)+Math.imul(L,rt)|0,o=o+Math.imul(L,nt)|0,n=n+Math.imul(P,ot)|0,i=(i=i+Math.imul(P,st)|0)+Math.imul(I,ot)|0,o=o+Math.imul(I,st)|0,n=n+Math.imul(R,ut)|0,i=(i=i+Math.imul(R,ht)|0)+Math.imul(B,ut)|0,o=o+Math.imul(B,ht)|0,n=n+Math.imul(k,ft)|0,i=(i=i+Math.imul(k,lt)|0)+Math.imul(x,ft)|0,o=o+Math.imul(x,lt)|0;var Rt=(h+(n=n+Math.imul(A,pt)|0)|0)+((8191&(i=(i=i+Math.imul(A,mt)|0)+Math.imul(M,pt)|0))<<13)|0;h=((o=o+Math.imul(M,mt)|0)+(i>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,n=Math.imul(D,rt),i=(i=Math.imul(D,nt))+Math.imul(U,rt)|0,o=Math.imul(U,nt),n=n+Math.imul(C,ot)|0,i=(i=i+Math.imul(C,st)|0)+Math.imul(L,ot)|0,o=o+Math.imul(L,st)|0,n=n+Math.imul(P,ut)|0,i=(i=i+Math.imul(P,ht)|0)+Math.imul(I,ut)|0,o=o+Math.imul(I,ht)|0,n=n+Math.imul(R,ft)|0,i=(i=i+Math.imul(R,lt)|0)+Math.imul(B,ft)|0,o=o+Math.imul(B,lt)|0;var Bt=(h+(n=n+Math.imul(k,pt)|0)|0)+((8191&(i=(i=i+Math.imul(k,mt)|0)+Math.imul(x,pt)|0))<<13)|0;h=((o=o+Math.imul(x,mt)|0)+(i>>>13)|0)+(Bt>>>26)|0,Bt&=67108863,n=Math.imul(D,ot),i=(i=Math.imul(D,st))+Math.imul(U,ot)|0,o=Math.imul(U,st),n=n+Math.imul(C,ut)|0,i=(i=i+Math.imul(C,ht)|0)+Math.imul(L,ut)|0,o=o+Math.imul(L,ht)|0,n=n+Math.imul(P,ft)|0,i=(i=i+Math.imul(P,lt)|0)+Math.imul(I,ft)|0,o=o+Math.imul(I,lt)|0;var Nt=(h+(n=n+Math.imul(R,pt)|0)|0)+((8191&(i=(i=i+Math.imul(R,mt)|0)+Math.imul(B,pt)|0))<<13)|0;h=((o=o+Math.imul(B,mt)|0)+(i>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,n=Math.imul(D,ut),i=(i=Math.imul(D,ht))+Math.imul(U,ut)|0,o=Math.imul(U,ht),n=n+Math.imul(C,ft)|0,i=(i=i+Math.imul(C,lt)|0)+Math.imul(L,ft)|0,o=o+Math.imul(L,lt)|0;var Pt=(h+(n=n+Math.imul(P,pt)|0)|0)+((8191&(i=(i=i+Math.imul(P,mt)|0)+Math.imul(I,pt)|0))<<13)|0;h=((o=o+Math.imul(I,mt)|0)+(i>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,n=Math.imul(D,ft),i=(i=Math.imul(D,lt))+Math.imul(U,ft)|0,o=Math.imul(U,lt);var It=(h+(n=n+Math.imul(C,pt)|0)|0)+((8191&(i=(i=i+Math.imul(C,mt)|0)+Math.imul(L,pt)|0))<<13)|0;h=((o=o+Math.imul(L,mt)|0)+(i>>>13)|0)+(It>>>26)|0,It&=67108863;var Ot=(h+(n=Math.imul(D,pt))|0)+((8191&(i=(i=Math.imul(D,mt))+Math.imul(U,pt)|0))<<13)|0;return h=((o=Math.imul(U,mt))+(i>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,u[0]=gt,u[1]=yt,u[2]=bt,u[3]=vt,u[4]=wt,u[5]=_t,u[6]=Et,u[7]=At,u[8]=Mt,u[9]=St,u[10]=kt,u[11]=xt,u[12]=Tt,u[13]=Rt,u[14]=Bt,u[15]=Nt,u[16]=Pt,u[17]=It,u[18]=Ot,0!==h&&(u[19]=h,r.length++),r};function g(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var n=0,i=0,o=0;o<r.length-1;o++){var s=i;i=0;for(var a=67108863&n,u=Math.min(o,e.length-1),h=Math.max(0,o-t.length+1);h<=u;h++){var c=o-h,f=(0|t.words[c])*(0|e.words[h]),l=67108863&f;a=67108863&(l=l+a|0),i+=(s=(s=s+(f/67108864|0)|0)+(l>>>26)|0)>>>26,s&=67108863}r.words[o]=a,n=s,s=i}return 0!==n?r.words[o]=n:r.length--,r._strip()}function y(t,e,r){return g(t,e,r)}Math.imul||(m=p),i.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?m(this,t,e):r<63?p(this,t,e):r<1024?g(this,t,e):y(this,t,e)},i.prototype.mul=function(t){var e=new i(null);return e.words=new Array(this.length+t.length),this.mulTo(t,e)},i.prototype.mulf=function(t){var e=new i(null);return e.words=new Array(this.length+t.length),y(this,t,e)},i.prototype.imul=function(t){return this.clone().mulTo(t,this)},i.prototype.imuln=function(t){var e=t<0;e&&(t=-t),r("number"==typeof t),r(t<67108864);for(var n=0,i=0;i<this.length;i++){var o=(0|this.words[i])*t,s=(67108863&o)+(67108863&n);n>>=26,n+=o/67108864|0,n+=s>>>26,this.words[i]=67108863&s}return 0!==n&&(this.words[i]=n,this.length++),this.length=0===t?1:this.length,e?this.ineg():this},i.prototype.muln=function(t){return this.clone().imuln(t)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.imul(this.clone())},i.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r<e.length;r++){var n=r/26|0,i=r%26;e[r]=t.words[n]>>>i&1}return e}(t);if(0===e.length)return new i(1);for(var r=this,n=0;n<e.length&&0===e[n];n++,r=r.sqr());if(++n<e.length)for(var o=r.sqr();n<e.length;n++,o=o.sqr())0!==e[n]&&(r=r.mul(o));return r},i.prototype.iushln=function(t){r("number"==typeof t&&t>=0);var e,n=t%26,i=(t-n)/26,o=67108863>>>26-n<<26-n;if(0!==n){var s=0;for(e=0;e<this.length;e++){var a=this.words[e]&o,u=(0|this.words[e])-a<<n;this.words[e]=u|s,s=a>>>26-n}s&&(this.words[e]=s,this.length++)}if(0!==i){for(e=this.length-1;e>=0;e--)this.words[e+i]=this.words[e];for(e=0;e<i;e++)this.words[e]=0;this.length+=i}return this._strip()},i.prototype.ishln=function(t){return r(0===this.negative),this.iushln(t)},i.prototype.iushrn=function(t,e,n){var i;r("number"==typeof t&&t>=0),i=e?(e-e%26)/26:0;var o=t%26,s=Math.min((t-o)/26,this.length),a=67108863^67108863>>>o<<o,u=n;if(i-=s,i=Math.max(0,i),u){for(var h=0;h<s;h++)u.words[h]=this.words[h];u.length=s}if(0===s);else if(this.length>s)for(this.length-=s,h=0;h<this.length;h++)this.words[h]=this.words[h+s];else this.words[0]=0,this.length=1;var c=0;for(h=this.length-1;h>=0&&(0!==c||h>=i);h--){var f=0|this.words[h];this.words[h]=c<<26-o|f>>>o,c=f&a}return u&&0!==c&&(u.words[u.length++]=c),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},i.prototype.ishrn=function(t,e,n){return r(0===this.negative),this.iushrn(t,e,n)},i.prototype.shln=function(t){return this.clone().ishln(t)},i.prototype.ushln=function(t){return this.clone().iushln(t)},i.prototype.shrn=function(t){return this.clone().ishrn(t)},i.prototype.ushrn=function(t){return this.clone().iushrn(t)},i.prototype.testn=function(t){r("number"==typeof t&&t>=0);var e=t%26,n=(t-e)/26,i=1<<e;return!(this.length<=n)&&!!(this.words[n]&i)},i.prototype.imaskn=function(t){r("number"==typeof t&&t>=0);var e=t%26,n=(t-e)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=n)return this;if(0!==e&&n++,this.length=Math.min(n,this.length),0!==e){var i=67108863^67108863>>>e<<e;this.words[this.length-1]&=i}return this._strip()},i.prototype.maskn=function(t){return this.clone().imaskn(t)},i.prototype.iaddn=function(t){return r("number"==typeof t),r(t<67108864),t<0?this.isubn(-t):0!==this.negative?1===this.length&&(0|this.words[0])<=t?(this.words[0]=t-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(t),this.negative=1,this):this._iaddn(t)},i.prototype._iaddn=function(t){this.words[0]+=t;for(var e=0;e<this.length&&this.words[e]>=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},i.prototype.isubn=function(t){if(r("number"==typeof t),r(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e<this.length&&this.words[e]<0;e++)this.words[e]+=67108864,this.words[e+1]-=1;return this._strip()},i.prototype.addn=function(t){return this.clone().iaddn(t)},i.prototype.subn=function(t){return this.clone().isubn(t)},i.prototype.iabs=function(){return this.negative=0,this},i.prototype.abs=function(){return this.clone().iabs()},i.prototype._ishlnsubmul=function(t,e,n){var i,o,s=t.length+n;this._expand(s);var a=0;for(i=0;i<t.length;i++){o=(0|this.words[i+n])+a;var u=(0|t.words[i])*e;a=((o-=67108863&u)>>26)-(u/67108864|0),this.words[i+n]=67108863&o}for(;i<this.length-n;i++)a=(o=(0|this.words[i+n])+a)>>26,this.words[i+n]=67108863&o;if(0===a)return this._strip();for(r(-1===a),a=0,i=0;i<this.length;i++)a=(o=-(0|this.words[i])+a)>>26,this.words[i]=67108863&o;return this.negative=1,this._strip()},i.prototype._wordDiv=function(t,e){var r=(this.length,t.length),n=this.clone(),o=t,s=0|o.words[o.length-1];0!==(r=26-this._countBits(s))&&(o=o.ushln(r),n.iushln(r),s=0|o.words[o.length-1]);var a,u=n.length-o.length;if("mod"!==e){(a=new i(null)).length=u+1,a.words=new Array(a.length);for(var h=0;h<a.length;h++)a.words[h]=0}var c=n.clone()._ishlnsubmul(o,1,u);0===c.negative&&(n=c,a&&(a.words[u]=1));for(var f=u-1;f>=0;f--){var l=67108864*(0|n.words[o.length+f])+(0|n.words[o.length+f-1]);for(l=Math.min(l/s|0,67108863),n._ishlnsubmul(o,l,f);0!==n.negative;)l--,n.negative=0,n._ishlnsubmul(o,1,f),n.isZero()||(n.negative^=1);a&&(a.words[f]=l)}return a&&a._strip(),n._strip(),"div"!==e&&0!==r&&n.iushrn(r),{div:a||null,mod:n}},i.prototype.divmod=function(t,e,n){return r(!t.isZero()),this.isZero()?{div:new i(0),mod:new i(0)}:0!==this.negative&&0===t.negative?(a=this.neg().divmod(t,e),"mod"!==e&&(o=a.div.neg()),"div"!==e&&(s=a.mod.neg(),n&&0!==s.negative&&s.iadd(t)),{div:o,mod:s}):0===this.negative&&0!==t.negative?(a=this.divmod(t.neg(),e),"mod"!==e&&(o=a.div.neg()),{div:o,mod:a.mod}):0!==(this.negative&t.negative)?(a=this.neg().divmod(t.neg(),e),"div"!==e&&(s=a.mod.neg(),n&&0!==s.negative&&s.isub(t)),{div:a.div,mod:s}):t.length>this.length||this.cmp(t)<0?{div:new i(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new i(this.modrn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new i(this.modrn(t.words[0]))}:this._wordDiv(t,e);var o,s,a},i.prototype.div=function(t){return this.divmod(t,"div",!1).div},i.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},i.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},i.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,n=t.ushrn(1),i=t.andln(1),o=r.cmp(n);return o<0||1===i&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},i.prototype.modrn=function(t){var e=t<0;e&&(t=-t),r(t<=67108863);for(var n=(1<<26)%t,i=0,o=this.length-1;o>=0;o--)i=(n*i+(0|this.words[o]))%t;return e?-i:i},i.prototype.modn=function(t){return this.modrn(t)},i.prototype.idivn=function(t){var e=t<0;e&&(t=-t),r(t<=67108863);for(var n=0,i=this.length-1;i>=0;i--){var o=(0|this.words[i])+67108864*n;this.words[i]=o/t|0,n=o%t}return this._strip(),e?this.ineg():this},i.prototype.divn=function(t){return this.clone().idivn(t)},i.prototype.egcd=function(t){r(0===t.negative),r(!t.isZero());var e=this,n=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var o=new i(1),s=new i(0),a=new i(0),u=new i(1),h=0;e.isEven()&&n.isEven();)e.iushrn(1),n.iushrn(1),++h;for(var c=n.clone(),f=e.clone();!e.isZero();){for(var l=0,d=1;0===(e.words[0]&d)&&l<26;++l,d<<=1);if(l>0)for(e.iushrn(l);l-- >0;)(o.isOdd()||s.isOdd())&&(o.iadd(c),s.isub(f)),o.iushrn(1),s.iushrn(1);for(var p=0,m=1;0===(n.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(n.iushrn(p);p-- >0;)(a.isOdd()||u.isOdd())&&(a.iadd(c),u.isub(f)),a.iushrn(1),u.iushrn(1);e.cmp(n)>=0?(e.isub(n),o.isub(a),s.isub(u)):(n.isub(e),a.isub(o),u.isub(s))}return{a:a,b:u,gcd:n.iushln(h)}},i.prototype._invmp=function(t){r(0===t.negative),r(!t.isZero());var e=this,n=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var o,s=new i(1),a=new i(0),u=n.clone();e.cmpn(1)>0&&n.cmpn(1)>0;){for(var h=0,c=1;0===(e.words[0]&c)&&h<26;++h,c<<=1);if(h>0)for(e.iushrn(h);h-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);for(var f=0,l=1;0===(n.words[0]&l)&&f<26;++f,l<<=1);if(f>0)for(n.iushrn(f);f-- >0;)a.isOdd()&&a.iadd(u),a.iushrn(1);e.cmp(n)>=0?(e.isub(n),s.isub(a)):(n.isub(e),a.isub(s))}return(o=0===e.cmpn(1)?s:a).cmpn(0)<0&&o.iadd(t),o},i.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var n=0;e.isEven()&&r.isEven();n++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var i=e.cmp(r);if(i<0){var o=e;e=r,r=o}else if(0===i||0===r.cmpn(1))break;e.isub(r)}return r.iushln(n)},i.prototype.invm=function(t){return this.egcd(t).a.umod(t)},i.prototype.isEven=function(){return!(1&this.words[0])},i.prototype.isOdd=function(){return!(1&~this.words[0])},i.prototype.andln=function(t){return this.words[0]&t},i.prototype.bincn=function(t){r("number"==typeof t);var e=t%26,n=(t-e)/26,i=1<<e;if(this.length<=n)return this._expand(n+1),this.words[n]|=i,this;for(var o=i,s=n;0!==o&&s<this.length;s++){var a=0|this.words[s];o=(a+=o)>>>26,a&=67108863,this.words[s]=a}return 0!==o&&(this.words[s]=o,this.length++),this},i.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},i.prototype.cmpn=function(t){var e,n=t<0;if(0!==this.negative&&!n)return-1;if(0===this.negative&&n)return 1;if(this._strip(),this.length>1)e=1;else{n&&(t=-t),r(t<=67108863,"Number is too big");var i=0|this.words[0];e=i===t?0:i<t?-1:1}return 0!==this.negative?0|-e:e},i.prototype.cmp=function(t){if(0!==this.negative&&0===t.negative)return-1;if(0===this.negative&&0!==t.negative)return 1;var e=this.ucmp(t);return 0!==this.negative?0|-e:e},i.prototype.ucmp=function(t){if(this.length>t.length)return 1;if(this.length<t.length)return-1;for(var e=0,r=this.length-1;r>=0;r--){var n=0|this.words[r],i=0|t.words[r];if(n!==i){n<i?e=-1:n>i&&(e=1);break}}return e},i.prototype.gtn=function(t){return 1===this.cmpn(t)},i.prototype.gt=function(t){return 1===this.cmp(t)},i.prototype.gten=function(t){return this.cmpn(t)>=0},i.prototype.gte=function(t){return this.cmp(t)>=0},i.prototype.ltn=function(t){return-1===this.cmpn(t)},i.prototype.lt=function(t){return-1===this.cmp(t)},i.prototype.lten=function(t){return this.cmpn(t)<=0},i.prototype.lte=function(t){return this.cmp(t)<=0},i.prototype.eqn=function(t){return 0===this.cmpn(t)},i.prototype.eq=function(t){return 0===this.cmp(t)},i.red=function(t){return new M(t)},i.prototype.toRed=function(t){return r(!this.red,"Already a number in reduction context"),r(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},i.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function(t){return this.red=t,this},i.prototype.forceRed=function(t){return r(!this.red,"Already a number in reduction context"),this._forceRed(t)},i.prototype.redAdd=function(t){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},i.prototype.redIAdd=function(t){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},i.prototype.redSub=function(t){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},i.prototype.redISub=function(t){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},i.prototype.redShl=function(t){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},i.prototype.redMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},i.prototype.redIMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},i.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(t){return r(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var b={k256:null,p224:null,p192:null,p25519:null};function v(t,e){this.name=t,this.p=new i(e,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function w(){v.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function _(){v.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function E(){v.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function A(){v.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function M(t){if("string"==typeof t){var e=i._prime(t);this.m=e.p,this.prime=e}else r(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function S(t){M.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new i(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}v.prototype._tmp=function(){var t=new i(null);return t.words=new Array(Math.ceil(this.n/13)),t},v.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(e>this.n);var n=e<this.n?-1:r.ucmp(this.p);return 0===n?(r.words[0]=0,r.length=1):n>0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},v.prototype.split=function(t,e){t.iushrn(this.n,0,e)},v.prototype.imulK=function(t){return t.imul(this.k)},n(w,v),w.prototype.split=function(t,e){for(var r=4194303,n=Math.min(t.length,9),i=0;i<n;i++)e.words[i]=t.words[i];if(e.length=n,t.length<=9)return t.words[0]=0,void(t.length=1);var o=t.words[9];for(e.words[e.length++]=o&r,i=10;i<t.length;i++){var s=0|t.words[i];t.words[i-10]=(s&r)<<4|o>>>22,o=s}o>>>=22,t.words[i-10]=o,0===o&&t.length>10?t.length-=10:t.length-=9},w.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r<t.length;r++){var n=0|t.words[r];e+=977*n,t.words[r]=67108863&e,e=64*n+(e/67108864|0)}return 0===t.words[t.length-1]&&(t.length--,0===t.words[t.length-1]&&t.length--),t},n(_,v),n(E,v),n(A,v),A.prototype.imulK=function(t){for(var e=0,r=0;r<t.length;r++){var n=19*(0|t.words[r])+e,i=67108863&n;n>>>=26,t.words[r]=i,e=n}return 0!==e&&(t.words[t.length++]=e),t},i._prime=function(t){if(b[t])return b[t];var e;if("k256"===t)e=new w;else if("p224"===t)e=new _;else if("p192"===t)e=new E;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new A}return b[t]=e,e},M.prototype._verify1=function(t){r(0===t.negative,"red works only with positives"),r(t.red,"red works only with red numbers")},M.prototype._verify2=function(t,e){r(0===(t.negative|e.negative),"red works only with positives"),r(t.red&&t.red===e.red,"red works only with red numbers")},M.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):(h(t,t.umod(this.m)._forceRed(this)),t)},M.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},M.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},M.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},M.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},M.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},M.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},M.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},M.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},M.prototype.isqr=function(t){return this.imul(t,t.clone())},M.prototype.sqr=function(t){return this.mul(t,t)},M.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(r(e%2==1),3===e){var n=this.m.add(new i(1)).iushrn(2);return this.pow(t,n)}for(var o=this.m.subn(1),s=0;!o.isZero()&&0===o.andln(1);)s++,o.iushrn(1);r(!o.isZero());var a=new i(1).toRed(this),u=a.redNeg(),h=this.m.subn(1).iushrn(1),c=this.m.bitLength();for(c=new i(2*c*c).toRed(this);0!==this.pow(c,h).cmp(u);)c.redIAdd(u);for(var f=this.pow(c,o),l=this.pow(t,o.addn(1).iushrn(1)),d=this.pow(t,o),p=s;0!==d.cmp(a);){for(var m=d,g=0;0!==m.cmp(a);g++)m=m.redSqr();r(g<p);var y=this.pow(f,new i(1).iushln(p-g-1));l=l.redMul(y),f=y.redSqr(),d=d.redMul(f),p=g}return l},M.prototype.invm=function(t){var e=t._invmp(this.m);return 0!==e.negative?(e.negative=0,this.imod(e).redNeg()):this.imod(e)},M.prototype.pow=function(t,e){if(e.isZero())return new i(1).toRed(this);if(0===e.cmpn(1))return t.clone();var r=new Array(16);r[0]=new i(1).toRed(this),r[1]=t;for(var n=2;n<r.length;n++)r[n]=this.mul(r[n-1],t);var o=r[0],s=0,a=0,u=e.bitLength()%26;for(0===u&&(u=26),n=e.length-1;n>=0;n--){for(var h=e.words[n],c=u-1;c>=0;c--){var f=h>>c&1;o!==r[0]&&(o=this.sqr(o)),0!==f||0!==s?(s<<=1,s|=f,(4===++a||0===n&&0===c)&&(o=this.mul(o,r[s]),a=0,s=0)):a=0}u=26}return o},M.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},M.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},i.mont=function(t){return new S(t)},n(S,M),S.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},S.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},S.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},S.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new i(0)._forceRed(this);var r=t.mul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=r.isub(n).iushrn(this.shift),s=o;return o.cmp(this.m)>=0?s=o.isub(this.m):o.cmpn(0)<0&&(s=o.iadd(this.m)),s._forceRed(this)},S.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t,e)}(Ms);var Ss=r(Ms.exports);function ks(t,e,r){return r={path:e,exports:{},require:function(t,e){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==e&&r.path)}},t(r,r.exports),r.exports}var xs=Ts;function Ts(t,e){if(!t)throw new Error(e||"Assertion failed")}Ts.equal=function(t,e,r){if(t!=e)throw new Error(r||"Assertion failed: "+t+" != "+e)};var Rs=ks(function(t,e){var r=e;function n(t){return 1===t.length?"0"+t:t}function i(t){for(var e="",r=0;r<t.length;r++)e+=n(t[r].toString(16));return e}r.toArray=function(t,e){if(Array.isArray(t))return t.slice();if(!t)return[];var r=[];if("string"!=typeof t){for(var n=0;n<t.length;n++)r[n]=0|t[n];return r}if("hex"===e){(t=t.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(t="0"+t);for(n=0;n<t.length;n+=2)r.push(parseInt(t[n]+t[n+1],16))}else for(n=0;n<t.length;n++){var i=t.charCodeAt(n),o=i>>8,s=255&i;o?r.push(o,s):r.push(s)}return r},r.zero2=n,r.toHex=i,r.encode=function(t,e){return"hex"===e?i(t):t}}),Bs=ks(function(t,e){var r=e;r.assert=xs,r.toArray=Rs.toArray,r.zero2=Rs.zero2,r.toHex=Rs.toHex,r.encode=Rs.encode,r.getNAF=function(t,e,r){var n,i=new Array(Math.max(t.bitLength(),r)+1);for(n=0;n<i.length;n+=1)i[n]=0;var o=1<<e+1,s=t.clone();for(n=0;n<i.length;n++){var a,u=s.andln(o-1);s.isOdd()?(a=u>(o>>1)-1?(o>>1)-u:u,s.isubn(a)):a=0,i[n]=a,s.iushrn(1)}return i},r.getJSF=function(t,e){var r=[[],[]];t=t.clone(),e=e.clone();for(var n,i=0,o=0;t.cmpn(-i)>0||e.cmpn(-o)>0;){var s,a,u=t.andln(3)+i&3,h=e.andln(3)+o&3;3===u&&(u=-1),3===h&&(h=-1),s=1&u?3!==(n=t.andln(7)+i&7)&&5!==n||2!==h?u:-u:0,r[0].push(s),a=1&h?3!==(n=e.andln(7)+o&7)&&5!==n||2!==u?h:-h:0,r[1].push(a),2*i===s+1&&(i=1-i),2*o===a+1&&(o=1-o),t.iushrn(1),e.iushrn(1)}return r},r.cachedProperty=function(t,e,r){var n="_"+e;t.prototype[e]=function(){return void 0!==this[n]?this[n]:this[n]=r.call(this)}},r.parseBytes=function(t){return"string"==typeof t?r.toArray(t,"hex"):t},r.intFromLE=function(t){return new Ss(t,"hex","le")}}),Ns=Bs.getNAF,Ps=Bs.getJSF,Is=Bs.assert;function Os(t,e){this.type=t,this.p=new Ss(e.p,16),this.red=e.prime?Ss.red(e.prime):Ss.mont(this.p),this.zero=new Ss(0).toRed(this.red),this.one=new Ss(1).toRed(this.red),this.two=new Ss(2).toRed(this.red),this.n=e.n&&new Ss(e.n,16),this.g=e.g&&this.pointFromJSON(e.g,e.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var r=this.n&&this.p.div(this.n);!r||r.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var Cs=Os;function Ls(t,e){this.curve=t,this.type=e,this.precomputed=null}Os.prototype.point=function(){throw new Error("Not implemented")},Os.prototype.validate=function(){throw new Error("Not implemented")},Os.prototype._fixedNafMul=function(t,e){Is(t.precomputed);var r=t._getDoubles(),n=Ns(e,1,this._bitLength),i=(1<<r.step+1)-(r.step%2==0?2:1);i/=3;var o,s,a=[];for(o=0;o<n.length;o+=r.step){s=0;for(var u=o+r.step-1;u>=o;u--)s=(s<<1)+n[u];a.push(s)}for(var h=this.jpoint(null,null,null),c=this.jpoint(null,null,null),f=i;f>0;f--){for(o=0;o<a.length;o++)(s=a[o])===f?c=c.mixedAdd(r.points[o]):s===-f&&(c=c.mixedAdd(r.points[o].neg()));h=h.add(c)}return h.toP()},Os.prototype._wnafMul=function(t,e){var r=4,n=t._getNAFPoints(r);r=n.wnd;for(var i=n.points,o=Ns(e,r,this._bitLength),s=this.jpoint(null,null,null),a=o.length-1;a>=0;a--){for(var u=0;a>=0&&0===o[a];a--)u++;if(a>=0&&u++,s=s.dblp(u),a<0)break;var h=o[a];Is(0!==h),s="affine"===t.type?h>0?s.mixedAdd(i[h-1>>1]):s.mixedAdd(i[-h-1>>1].neg()):h>0?s.add(i[h-1>>1]):s.add(i[-h-1>>1].neg())}return"affine"===t.type?s.toP():s},Os.prototype._wnafMulAdd=function(t,e,r,n,i){var o,s,a,u=this._wnafT1,h=this._wnafT2,c=this._wnafT3,f=0;for(o=0;o<n;o++){var l=(a=e[o])._getNAFPoints(t);u[o]=l.wnd,h[o]=l.points}for(o=n-1;o>=1;o-=2){var d=o-1,p=o;if(1===u[d]&&1===u[p]){var m=[e[d],null,null,e[p]];0===e[d].y.cmp(e[p].y)?(m[1]=e[d].add(e[p]),m[2]=e[d].toJ().mixedAdd(e[p].neg())):0===e[d].y.cmp(e[p].y.redNeg())?(m[1]=e[d].toJ().mixedAdd(e[p]),m[2]=e[d].add(e[p].neg())):(m[1]=e[d].toJ().mixedAdd(e[p]),m[2]=e[d].toJ().mixedAdd(e[p].neg()));var g=[-3,-1,-5,-7,0,7,5,1,3],y=Ps(r[d],r[p]);for(f=Math.max(y[0].length,f),c[d]=new Array(f),c[p]=new Array(f),s=0;s<f;s++){var b=0|y[0][s],v=0|y[1][s];c[d][s]=g[3*(b+1)+(v+1)],c[p][s]=0,h[d]=m}}else c[d]=Ns(r[d],u[d],this._bitLength),c[p]=Ns(r[p],u[p],this._bitLength),f=Math.max(c[d].length,f),f=Math.max(c[p].length,f)}var w=this.jpoint(null,null,null),_=this._wnafT4;for(o=f;o>=0;o--){for(var E=0;o>=0;){var A=!0;for(s=0;s<n;s++)_[s]=0|c[s][o],0!==_[s]&&(A=!1);if(!A)break;E++,o--}if(o>=0&&E++,w=w.dblp(E),o<0)break;for(s=0;s<n;s++){var M=_[s];0!==M&&(M>0?a=h[s][M-1>>1]:M<0&&(a=h[s][-M-1>>1].neg()),w="affine"===a.type?w.mixedAdd(a):w.add(a))}}for(o=0;o<n;o++)h[o]=null;return i?w:w.toP()},Os.BasePoint=Ls,Ls.prototype.eq=function(){throw new Error("Not implemented")},Ls.prototype.validate=function(){return this.curve.validate(this)},Os.prototype.decodePoint=function(t,e){t=Bs.toArray(t,e);var r=this.p.byteLength();if((4===t[0]||6===t[0]||7===t[0])&&t.length-1==2*r)return 6===t[0]?Is(t[t.length-1]%2==0):7===t[0]&&Is(t[t.length-1]%2==1),this.point(t.slice(1,1+r),t.slice(1+r,1+2*r));if((2===t[0]||3===t[0])&&t.length-1===r)return this.pointFromX(t.slice(1,1+r),3===t[0]);throw new Error("Unknown point format")},Ls.prototype.encodeCompressed=function(t){return this.encode(t,!0)},Ls.prototype._encode=function(t){var e=this.curve.p.byteLength(),r=this.getX().toArray("be",e);return t?[this.getY().isEven()?2:3].concat(r):[4].concat(r,this.getY().toArray("be",e))},Ls.prototype.encode=function(t,e){return Bs.encode(this._encode(e),t)},Ls.prototype.precompute=function(t){if(this.precomputed)return this;var e={doubles:null,naf:null,beta:null};return e.naf=this._getNAFPoints(8),e.doubles=this._getDoubles(4,t),e.beta=this._getBeta(),this.precomputed=e,this},Ls.prototype._hasDoubles=function(t){if(!this.precomputed)return!1;var e=this.precomputed.doubles;return!!e&&e.points.length>=Math.ceil((t.bitLength()+1)/e.step)},Ls.prototype._getDoubles=function(t,e){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var r=[this],n=this,i=0;i<e;i+=t){for(var o=0;o<t;o++)n=n.dbl();r.push(n)}return{step:t,points:r}},Ls.prototype._getNAFPoints=function(t){if(this.precomputed&&this.precomputed.naf)return this.precomputed.naf;for(var e=[this],r=(1<<t)-1,n=1===r?null:this.dbl(),i=1;i<r;i++)e[i]=e[i-1].add(n);return{wnd:t,points:e}},Ls.prototype._getBeta=function(){return null},Ls.prototype.dblp=function(t){for(var e=this,r=0;r<t;r++)e=e.dbl();return e};var js=ks(function(t){"function"==typeof Object.create?t.exports=function(t,e){e&&(t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:t.exports=function(t,e){if(e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}}}),Ds=Bs.assert;function Us(t){Cs.call(this,"short",t),this.a=new Ss(t.a,16).toRed(this.red),this.b=new Ss(t.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=0===this.a.fromRed().cmpn(0),this.threeA=0===this.a.fromRed().sub(this.p).cmpn(-3),this.endo=this._getEndomorphism(t),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}js(Us,Cs);var Fs=Us;function zs(t,e,r,n){Cs.BasePoint.call(this,t,"affine"),null===e&&null===r?(this.x=null,this.y=null,this.inf=!0):(this.x=new Ss(e,16),this.y=new Ss(r,16),n&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.inf=!1)}function qs(t,e,r,n){Cs.BasePoint.call(this,t,"jacobian"),null===e&&null===r&&null===n?(this.x=this.curve.one,this.y=this.curve.one,this.z=new Ss(0)):(this.x=new Ss(e,16),this.y=new Ss(r,16),this.z=new Ss(n,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}Us.prototype._getEndomorphism=function(t){if(this.zeroA&&this.g&&this.n&&1===this.p.modn(3)){var e,r;if(t.beta)e=new Ss(t.beta,16).toRed(this.red);else{var n=this._getEndoRoots(this.p);e=(e=n[0].cmp(n[1])<0?n[0]:n[1]).toRed(this.red)}if(t.lambda)r=new Ss(t.lambda,16);else{var i=this._getEndoRoots(this.n);0===this.g.mul(i[0]).x.cmp(this.g.x.redMul(e))?r=i[0]:(r=i[1],Ds(0===this.g.mul(r).x.cmp(this.g.x.redMul(e))))}return{beta:e,lambda:r,basis:t.basis?t.basis.map(function(t){return{a:new Ss(t.a,16),b:new Ss(t.b,16)}}):this._getEndoBasis(r)}}},Us.prototype._getEndoRoots=function(t){var e=t===this.p?this.red:Ss.mont(t),r=new Ss(2).toRed(e).redInvm(),n=r.redNeg(),i=new Ss(3).toRed(e).redNeg().redSqrt().redMul(r);return[n.redAdd(i).fromRed(),n.redSub(i).fromRed()]},Us.prototype._getEndoBasis=function(t){for(var e,r,n,i,o,s,a,u,h,c=this.n.ushrn(Math.floor(this.n.bitLength()/2)),f=t,l=this.n.clone(),d=new Ss(1),p=new Ss(0),m=new Ss(0),g=new Ss(1),y=0;0!==f.cmpn(0);){var b=l.div(f);u=l.sub(b.mul(f)),h=m.sub(b.mul(d));var v=g.sub(b.mul(p));if(!n&&u.cmp(c)<0)e=a.neg(),r=d,n=u.neg(),i=h;else if(n&&2===++y)break;a=u,l=f,f=u,m=d,d=h,g=p,p=v}o=u.neg(),s=h;var w=n.sqr().add(i.sqr());return o.sqr().add(s.sqr()).cmp(w)>=0&&(o=e,s=r),n.negative&&(n=n.neg(),i=i.neg()),o.negative&&(o=o.neg(),s=s.neg()),[{a:n,b:i},{a:o,b:s}]},Us.prototype._endoSplit=function(t){var e=this.endo.basis,r=e[0],n=e[1],i=n.b.mul(t).divRound(this.n),o=r.b.neg().mul(t).divRound(this.n),s=i.mul(r.a),a=o.mul(n.a),u=i.mul(r.b),h=o.mul(n.b);return{k1:t.sub(s).sub(a),k2:u.add(h).neg()}},Us.prototype.pointFromX=function(t,e){(t=new Ss(t,16)).red||(t=t.toRed(this.red));var r=t.redSqr().redMul(t).redIAdd(t.redMul(this.a)).redIAdd(this.b),n=r.redSqrt();if(0!==n.redSqr().redSub(r).cmp(this.zero))throw new Error("invalid point");var i=n.fromRed().isOdd();return(e&&!i||!e&&i)&&(n=n.redNeg()),this.point(t,n)},Us.prototype.validate=function(t){if(t.inf)return!0;var e=t.x,r=t.y,n=this.a.redMul(e),i=e.redSqr().redMul(e).redIAdd(n).redIAdd(this.b);return 0===r.redSqr().redISub(i).cmpn(0)},Us.prototype._endoWnafMulAdd=function(t,e,r){for(var n=this._endoWnafT1,i=this._endoWnafT2,o=0;o<t.length;o++){var s=this._endoSplit(e[o]),a=t[o],u=a._getBeta();s.k1.negative&&(s.k1.ineg(),a=a.neg(!0)),s.k2.negative&&(s.k2.ineg(),u=u.neg(!0)),n[2*o]=a,n[2*o+1]=u,i[2*o]=s.k1,i[2*o+1]=s.k2}for(var h=this._wnafMulAdd(1,n,i,2*o,r),c=0;c<2*o;c++)n[c]=null,i[c]=null;return h},js(zs,Cs.BasePoint),Us.prototype.point=function(t,e,r){return new zs(this,t,e,r)},Us.prototype.pointFromJSON=function(t,e){return zs.fromJSON(this,t,e)},zs.prototype._getBeta=function(){if(this.curve.endo){var t=this.precomputed;if(t&&t.beta)return t.beta;var e=this.curve.point(this.x.redMul(this.curve.endo.beta),this.y);if(t){var r=this.curve,n=function(t){return r.point(t.x.redMul(r.endo.beta),t.y)};t.beta=e,e.precomputed={beta:null,naf:t.naf&&{wnd:t.naf.wnd,points:t.naf.points.map(n)},doubles:t.doubles&&{step:t.doubles.step,points:t.doubles.points.map(n)}}}return e}},zs.prototype.toJSON=function(){return this.precomputed?[this.x,this.y,this.precomputed&&{doubles:this.precomputed.doubles&&{step:this.precomputed.doubles.step,points:this.precomputed.doubles.points.slice(1)},naf:this.precomputed.naf&&{wnd:this.precomputed.naf.wnd,points:this.precomputed.naf.points.slice(1)}}]:[this.x,this.y]},zs.fromJSON=function(t,e,r){"string"==typeof e&&(e=JSON.parse(e));var n=t.point(e[0],e[1],r);if(!e[2])return n;function i(e){return t.point(e[0],e[1],r)}var o=e[2];return n.precomputed={beta:null,doubles:o.doubles&&{step:o.doubles.step,points:[n].concat(o.doubles.points.map(i))},naf:o.naf&&{wnd:o.naf.wnd,points:[n].concat(o.naf.points.map(i))}},n},zs.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+">"},zs.prototype.isInfinity=function(){return this.inf},zs.prototype.add=function(t){if(this.inf)return t;if(t.inf)return this;if(this.eq(t))return this.dbl();if(this.neg().eq(t))return this.curve.point(null,null);if(0===this.x.cmp(t.x))return this.curve.point(null,null);var e=this.y.redSub(t.y);0!==e.cmpn(0)&&(e=e.redMul(this.x.redSub(t.x).redInvm()));var r=e.redSqr().redISub(this.x).redISub(t.x),n=e.redMul(this.x.redSub(r)).redISub(this.y);return this.curve.point(r,n)},zs.prototype.dbl=function(){if(this.inf)return this;var t=this.y.redAdd(this.y);if(0===t.cmpn(0))return this.curve.point(null,null);var e=this.curve.a,r=this.x.redSqr(),n=t.redInvm(),i=r.redAdd(r).redIAdd(r).redIAdd(e).redMul(n),o=i.redSqr().redISub(this.x.redAdd(this.x)),s=i.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,s)},zs.prototype.getX=function(){return this.x.fromRed()},zs.prototype.getY=function(){return this.y.fromRed()},zs.prototype.mul=function(t){return t=new Ss(t,16),this.isInfinity()?this:this._hasDoubles(t)?this.curve._fixedNafMul(this,t):this.curve.endo?this.curve._endoWnafMulAdd([this],[t]):this.curve._wnafMul(this,t)},zs.prototype.mulAdd=function(t,e,r){var n=[this,e],i=[t,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,i):this.curve._wnafMulAdd(1,n,i,2)},zs.prototype.jmulAdd=function(t,e,r){var n=[this,e],i=[t,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,i,!0):this.curve._wnafMulAdd(1,n,i,2,!0)},zs.prototype.eq=function(t){return this===t||this.inf===t.inf&&(this.inf||0===this.x.cmp(t.x)&&0===this.y.cmp(t.y))},zs.prototype.neg=function(t){if(this.inf)return this;var e=this.curve.point(this.x,this.y.redNeg());if(t&&this.precomputed){var r=this.precomputed,n=function(t){return t.neg()};e.precomputed={naf:r.naf&&{wnd:r.naf.wnd,points:r.naf.points.map(n)},doubles:r.doubles&&{step:r.doubles.step,points:r.doubles.points.map(n)}}}return e},zs.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},js(qs,Cs.BasePoint),Us.prototype.jpoint=function(t,e,r){return new qs(this,t,e,r)},qs.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var t=this.z.redInvm(),e=t.redSqr(),r=this.x.redMul(e),n=this.y.redMul(e).redMul(t);return this.curve.point(r,n)},qs.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},qs.prototype.add=function(t){if(this.isInfinity())return t;if(t.isInfinity())return this;var e=t.z.redSqr(),r=this.z.redSqr(),n=this.x.redMul(e),i=t.x.redMul(r),o=this.y.redMul(e.redMul(t.z)),s=t.y.redMul(r.redMul(this.z)),a=n.redSub(i),u=o.redSub(s);if(0===a.cmpn(0))return 0!==u.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var h=a.redSqr(),c=h.redMul(a),f=n.redMul(h),l=u.redSqr().redIAdd(c).redISub(f).redISub(f),d=u.redMul(f.redISub(l)).redISub(o.redMul(c)),p=this.z.redMul(t.z).redMul(a);return this.curve.jpoint(l,d,p)},qs.prototype.mixedAdd=function(t){if(this.isInfinity())return t.toJ();if(t.isInfinity())return this;var e=this.z.redSqr(),r=this.x,n=t.x.redMul(e),i=this.y,o=t.y.redMul(e).redMul(this.z),s=r.redSub(n),a=i.redSub(o);if(0===s.cmpn(0))return 0!==a.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var u=s.redSqr(),h=u.redMul(s),c=r.redMul(u),f=a.redSqr().redIAdd(h).redISub(c).redISub(c),l=a.redMul(c.redISub(f)).redISub(i.redMul(h)),d=this.z.redMul(s);return this.curve.jpoint(f,l,d)},qs.prototype.dblp=function(t){if(0===t)return this;if(this.isInfinity())return this;if(!t)return this.dbl();var e;if(this.curve.zeroA||this.curve.threeA){var r=this;for(e=0;e<t;e++)r=r.dbl();return r}var n=this.curve.a,i=this.curve.tinv,o=this.x,s=this.y,a=this.z,u=a.redSqr().redSqr(),h=s.redAdd(s);for(e=0;e<t;e++){var c=o.redSqr(),f=h.redSqr(),l=f.redSqr(),d=c.redAdd(c).redIAdd(c).redIAdd(n.redMul(u)),p=o.redMul(f),m=d.redSqr().redISub(p.redAdd(p)),g=p.redISub(m),y=d.redMul(g);y=y.redIAdd(y).redISub(l);var b=h.redMul(a);e+1<t&&(u=u.redMul(l)),o=m,a=b,h=y}return this.curve.jpoint(o,h.redMul(i),a)},qs.prototype.dbl=function(){return this.isInfinity()?this:this.curve.zeroA?this._zeroDbl():this.curve.threeA?this._threeDbl():this._dbl()},qs.prototype._zeroDbl=function(){var t,e,r;if(this.zOne){var n=this.x.redSqr(),i=this.y.redSqr(),o=i.redSqr(),s=this.x.redAdd(i).redSqr().redISub(n).redISub(o);s=s.redIAdd(s);var a=n.redAdd(n).redIAdd(n),u=a.redSqr().redISub(s).redISub(s),h=o.redIAdd(o);h=(h=h.redIAdd(h)).redIAdd(h),t=u,e=a.redMul(s.redISub(u)).redISub(h),r=this.y.redAdd(this.y)}else{var c=this.x.redSqr(),f=this.y.redSqr(),l=f.redSqr(),d=this.x.redAdd(f).redSqr().redISub(c).redISub(l);d=d.redIAdd(d);var p=c.redAdd(c).redIAdd(c),m=p.redSqr(),g=l.redIAdd(l);g=(g=g.redIAdd(g)).redIAdd(g),t=m.redISub(d).redISub(d),e=p.redMul(d.redISub(t)).redISub(g),r=(r=this.y.redMul(this.z)).redIAdd(r)}return this.curve.jpoint(t,e,r)},qs.prototype._threeDbl=function(){var t,e,r;if(this.zOne){var n=this.x.redSqr(),i=this.y.redSqr(),o=i.redSqr(),s=this.x.redAdd(i).redSqr().redISub(n).redISub(o);s=s.redIAdd(s);var a=n.redAdd(n).redIAdd(n).redIAdd(this.curve.a),u=a.redSqr().redISub(s).redISub(s);t=u;var h=o.redIAdd(o);h=(h=h.redIAdd(h)).redIAdd(h),e=a.redMul(s.redISub(u)).redISub(h),r=this.y.redAdd(this.y)}else{var c=this.z.redSqr(),f=this.y.redSqr(),l=this.x.redMul(f),d=this.x.redSub(c).redMul(this.x.redAdd(c));d=d.redAdd(d).redIAdd(d);var p=l.redIAdd(l),m=(p=p.redIAdd(p)).redAdd(p);t=d.redSqr().redISub(m),r=this.y.redAdd(this.z).redSqr().redISub(f).redISub(c);var g=f.redSqr();g=(g=(g=g.redIAdd(g)).redIAdd(g)).redIAdd(g),e=d.redMul(p.redISub(t)).redISub(g)}return this.curve.jpoint(t,e,r)},qs.prototype._dbl=function(){var t=this.curve.a,e=this.x,r=this.y,n=this.z,i=n.redSqr().redSqr(),o=e.redSqr(),s=r.redSqr(),a=o.redAdd(o).redIAdd(o).redIAdd(t.redMul(i)),u=e.redAdd(e),h=(u=u.redIAdd(u)).redMul(s),c=a.redSqr().redISub(h.redAdd(h)),f=h.redISub(c),l=s.redSqr();l=(l=(l=l.redIAdd(l)).redIAdd(l)).redIAdd(l);var d=a.redMul(f).redISub(l),p=r.redAdd(r).redMul(n);return this.curve.jpoint(c,d,p)},qs.prototype.trpl=function(){if(!this.curve.zeroA)return this.dbl().add(this);var t=this.x.redSqr(),e=this.y.redSqr(),r=this.z.redSqr(),n=e.redSqr(),i=t.redAdd(t).redIAdd(t),o=i.redSqr(),s=this.x.redAdd(e).redSqr().redISub(t).redISub(n),a=(s=(s=(s=s.redIAdd(s)).redAdd(s).redIAdd(s)).redISub(o)).redSqr(),u=n.redIAdd(n);u=(u=(u=u.redIAdd(u)).redIAdd(u)).redIAdd(u);var h=i.redIAdd(s).redSqr().redISub(o).redISub(a).redISub(u),c=e.redMul(h);c=(c=c.redIAdd(c)).redIAdd(c);var f=this.x.redMul(a).redISub(c);f=(f=f.redIAdd(f)).redIAdd(f);var l=this.y.redMul(h.redMul(u.redISub(h)).redISub(s.redMul(a)));l=(l=(l=l.redIAdd(l)).redIAdd(l)).redIAdd(l);var d=this.z.redAdd(s).redSqr().redISub(r).redISub(a);return this.curve.jpoint(f,l,d)},qs.prototype.mul=function(t,e){return t=new Ss(t,e),this.curve._wnafMul(this,t)},qs.prototype.eq=function(t){if("affine"===t.type)return this.eq(t.toJ());if(this===t)return!0;var e=this.z.redSqr(),r=t.z.redSqr();if(0!==this.x.redMul(r).redISub(t.x.redMul(e)).cmpn(0))return!1;var n=e.redMul(this.z),i=r.redMul(t.z);return 0===this.y.redMul(i).redISub(t.y.redMul(n)).cmpn(0)},qs.prototype.eqXToP=function(t){var e=this.z.redSqr(),r=t.toRed(this.curve.red).redMul(e);if(0===this.x.cmp(r))return!0;for(var n=t.clone(),i=this.curve.redN.redMul(e);;){if(n.iadd(this.curve.n),n.cmp(this.curve.p)>=0)return!1;if(r.redIAdd(i),0===this.x.cmp(r))return!0}},qs.prototype.inspect=function(){return this.isInfinity()?"<EC JPoint Infinity>":"<EC JPoint x: "+this.x.toString(16,2)+" y: "+this.y.toString(16,2)+" z: "+this.z.toString(16,2)+">"},qs.prototype.isInfinity=function(){return 0===this.z.cmpn(0)};var Hs=ks(function(t,e){var r=e;r.base=Cs,r.short=Fs,r.mont=null,r.edwards=null}),Ks=ks(function(t,e){var r,n=e,i=Bs.assert;function o(t){"short"===t.type?this.curve=new Hs.short(t):"edwards"===t.type?this.curve=new Hs.edwards(t):this.curve=new Hs.mont(t),this.g=this.curve.g,this.n=this.curve.n,this.hash=t.hash,i(this.g.validate(),"Invalid curve"),i(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function s(t,e){Object.defineProperty(n,t,{configurable:!0,enumerable:!0,get:function(){var r=new o(e);return Object.defineProperty(n,t,{configurable:!0,enumerable:!0,value:r}),r}})}n.PresetCurve=o,s("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:Qo.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),s("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:Qo.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),s("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:Qo.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),s("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:Qo.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),s("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:Qo.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),s("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:Qo.sha256,gRed:!1,g:["9"]}),s("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:Qo.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});try{r=null.crash()}catch(t){r=void 0}s("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:Qo.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",r]})});function Gs(t){if(!(this instanceof Gs))return new Gs(t);this.hash=t.hash,this.predResist=!!t.predResist,this.outLen=this.hash.outSize,this.minEntropy=t.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var e=Rs.toArray(t.entropy,t.entropyEnc||"hex"),r=Rs.toArray(t.nonce,t.nonceEnc||"hex"),n=Rs.toArray(t.pers,t.persEnc||"hex");xs(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,r,n)}var Vs=Gs;Gs.prototype._init=function(t,e,r){var n=t.concat(e).concat(r);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var i=0;i<this.V.length;i++)this.K[i]=0,this.V[i]=1;this._update(n),this._reseed=1,this.reseedInterval=281474976710656},Gs.prototype._hmac=function(){return new Qo.hmac(this.hash,this.K)},Gs.prototype._update=function(t){var e=this._hmac().update(this.V).update([0]);t&&(e=e.update(t)),this.K=e.digest(),this.V=this._hmac().update(this.V).digest(),t&&(this.K=this._hmac().update(this.V).update([1]).update(t).digest(),this.V=this._hmac().update(this.V).digest())},Gs.prototype.reseed=function(t,e,r,n){"string"!=typeof e&&(n=r,r=e,e=null),t=Rs.toArray(t,e),r=Rs.toArray(r,n),xs(t.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(t.concat(r||[])),this._reseed=1},Gs.prototype.generate=function(t,e,r,n){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");"string"!=typeof e&&(n=r,r=e,e=null),r&&(r=Rs.toArray(r,n||"hex"),this._update(r));for(var i=[];i.length<t;)this.V=this._hmac().update(this.V).digest(),i=i.concat(this.V);var o=i.slice(0,t);return this._update(r),this._reseed++,Rs.encode(o,e)};var Ws=Bs.assert;function Js(t,e){this.ec=t,this.priv=null,this.pub=null,e.priv&&this._importPrivate(e.priv,e.privEnc),e.pub&&this._importPublic(e.pub,e.pubEnc)}var Zs=Js;Js.fromPublic=function(t,e,r){return e instanceof Js?e:new Js(t,{pub:e,pubEnc:r})},Js.fromPrivate=function(t,e,r){return e instanceof Js?e:new Js(t,{priv:e,privEnc:r})},Js.prototype.validate=function(){var t=this.getPublic();return t.isInfinity()?{result:!1,reason:"Invalid public key"}:t.validate()?t.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}},Js.prototype.getPublic=function(t,e){return"string"==typeof t&&(e=t,t=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),e?this.pub.encode(e,t):this.pub},Js.prototype.getPrivate=function(t){return"hex"===t?this.priv.toString(16,2):this.priv},Js.prototype._importPrivate=function(t,e){this.priv=new Ss(t,e||16),this.priv=this.priv.umod(this.ec.curve.n)},Js.prototype._importPublic=function(t,e){if(t.x||t.y)return"mont"===this.ec.curve.type?Ws(t.x,"Need x coordinate"):"short"!==this.ec.curve.type&&"edwards"!==this.ec.curve.type||Ws(t.x&&t.y,"Need both x and y coordinate"),void(this.pub=this.ec.curve.point(t.x,t.y));this.pub=this.ec.curve.decodePoint(t,e)},Js.prototype.derive=function(t){return t.validate()||Ws(t.validate(),"public point not validated"),t.mul(this.priv).getX()},Js.prototype.sign=function(t,e,r){return this.ec.sign(t,this,e,r)},Js.prototype.verify=function(t,e,r){return this.ec.verify(t,e,this,void 0,r)},Js.prototype.inspect=function(){return"<Key priv: "+(this.priv&&this.priv.toString(16,2))+" pub: "+(this.pub&&this.pub.inspect())+" >"};var Ys=Bs.assert;function Xs(t,e){if(t instanceof Xs)return t;this._importDER(t,e)||(Ys(t.r&&t.s,"Signature without r or s"),this.r=new Ss(t.r,16),this.s=new Ss(t.s,16),void 0===t.recoveryParam?this.recoveryParam=null:this.recoveryParam=t.recoveryParam)}var $s=Xs;function Qs(){this.place=0}function ta(t,e){var r=t[e.place++];if(!(128&r))return r;var n=15&r;if(0===n||n>4)return!1;if(0===t[e.place])return!1;for(var i=0,o=0,s=e.place;o<n;o++,s++)i<<=8,i|=t[s],i>>>=0;return!(i<=127)&&(e.place=s,i)}function ea(t){for(var e=0,r=t.length-1;!t[e]&&!(128&t[e+1])&&e<r;)e++;return 0===e?t:t.slice(e)}function ra(t,e){if(e<128)t.push(e);else{var r=1+(Math.log(e)/Math.LN2>>>3);for(t.push(128|r);--r;)t.push(e>>>(r<<3)&255);t.push(e)}}Xs.prototype._importDER=function(t,e){t=Bs.toArray(t,e);var r=new Qs;if(48!==t[r.place++])return!1;var n=ta(t,r);if(!1===n)return!1;if(n+r.place!==t.length)return!1;if(2!==t[r.place++])return!1;var i=ta(t,r);if(!1===i)return!1;if(128&t[r.place])return!1;var o=t.slice(r.place,i+r.place);if(r.place+=i,2!==t[r.place++])return!1;var s=ta(t,r);if(!1===s)return!1;if(t.length!==s+r.place)return!1;if(128&t[r.place])return!1;var a=t.slice(r.place,s+r.place);if(0===o[0]){if(!(128&o[1]))return!1;o=o.slice(1)}if(0===a[0]){if(!(128&a[1]))return!1;a=a.slice(1)}return this.r=new Ss(o),this.s=new Ss(a),this.recoveryParam=null,!0},Xs.prototype.toDER=function(t){var e=this.r.toArray(),r=this.s.toArray();for(128&e[0]&&(e=[0].concat(e)),128&r[0]&&(r=[0].concat(r)),e=ea(e),r=ea(r);!(r[0]||128&r[1]);)r=r.slice(1);var n=[2];ra(n,e.length),(n=n.concat(e)).push(2),ra(n,r.length);var i=n.concat(r),o=[48];return ra(o,i.length),o=o.concat(i),Bs.encode(o,t)};var na=function(){throw new Error("unsupported")},ia=Bs.assert;function oa(t){if(!(this instanceof oa))return new oa(t);"string"==typeof t&&(ia(Object.prototype.hasOwnProperty.call(Ks,t),"Unknown curve "+t),t=Ks[t]),t instanceof Ks.PresetCurve&&(t={curve:t}),this.curve=t.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=t.curve.g,this.g.precompute(t.curve.n.bitLength()+1),this.hash=t.hash||t.curve.hash}var sa=oa;oa.prototype.keyPair=function(t){return new Zs(this,t)},oa.prototype.keyFromPrivate=function(t,e){return Zs.fromPrivate(this,t,e)},oa.prototype.keyFromPublic=function(t,e){return Zs.fromPublic(this,t,e)},oa.prototype.genKeyPair=function(t){t||(t={});for(var e=new Vs({hash:this.hash,pers:t.pers,persEnc:t.persEnc||"utf8",entropy:t.entropy||na(this.hash.hmacStrength),entropyEnc:t.entropy&&t.entropyEnc||"utf8",nonce:this.n.toArray()}),r=this.n.byteLength(),n=this.n.sub(new Ss(2));;){var i=new Ss(e.generate(r));if(!(i.cmp(n)>0))return i.iaddn(1),this.keyFromPrivate(i)}},oa.prototype._truncateToN=function(t,e,r){var n;if(Ss.isBN(t)||"number"==typeof t)n=(t=new Ss(t,16)).byteLength();else if("object"==typeof t)n=t.length,t=new Ss(t,16);else{var i=t.toString();n=i.length+1>>>1,t=new Ss(i,16)}"number"!=typeof r&&(r=8*n);var o=r-this.n.bitLength();return o>0&&(t=t.ushrn(o)),!e&&t.cmp(this.n)>=0?t.sub(this.n):t},oa.prototype.sign=function(t,e,r,n){if("object"==typeof r&&(n=r,r=null),n||(n={}),"string"!=typeof t&&"number"!=typeof t&&!Ss.isBN(t)){ia("object"==typeof t&&t&&"number"==typeof t.length,"Expected message to be an array-like, a hex string, or a BN instance"),ia(t.length>>>0===t.length);for(var i=0;i<t.length;i++)ia((255&t[i])===t[i])}e=this.keyFromPrivate(e,r),t=this._truncateToN(t,!1,n.msgBitLength),ia(!t.isNeg(),"Can not sign a negative message");var o=this.n.byteLength(),s=e.getPrivate().toArray("be",o),a=t.toArray("be",o);ia(new Ss(a).eq(t),"Can not sign message");for(var u=new Vs({hash:this.hash,entropy:s,nonce:a,pers:n.pers,persEnc:n.persEnc||"utf8"}),h=this.n.sub(new Ss(1)),c=0;;c++){var f=n.k?n.k(c):new Ss(u.generate(this.n.byteLength()));if(!((f=this._truncateToN(f,!0)).cmpn(1)<=0||f.cmp(h)>=0)){var l=this.g.mul(f);if(!l.isInfinity()){var d=l.getX(),p=d.umod(this.n);if(0!==p.cmpn(0)){var m=f.invm(this.n).mul(p.mul(e.getPrivate()).iadd(t));if(0!==(m=m.umod(this.n)).cmpn(0)){var g=(l.getY().isOdd()?1:0)|(0!==d.cmp(p)?2:0);return n.canonical&&m.cmp(this.nh)>0&&(m=this.n.sub(m),g^=1),new $s({r:p,s:m,recoveryParam:g})}}}}}},oa.prototype.verify=function(t,e,r,n,i){i||(i={}),t=this._truncateToN(t,!1,i.msgBitLength),r=this.keyFromPublic(r,n);var o=(e=new $s(e,"hex")).r,s=e.s;if(o.cmpn(1)<0||o.cmp(this.n)>=0)return!1;if(s.cmpn(1)<0||s.cmp(this.n)>=0)return!1;var a,u=s.invm(this.n),h=u.mul(t).umod(this.n),c=u.mul(o).umod(this.n);return this.curve._maxwellTrick?!(a=this.g.jmulAdd(h,r.getPublic(),c)).isInfinity()&&a.eqXToP(o):!(a=this.g.mulAdd(h,r.getPublic(),c)).isInfinity()&&0===a.getX().umod(this.n).cmp(o)},oa.prototype.recoverPubKey=function(t,e,r,n){ia((3&r)===r,"The recovery param is more than two bits"),e=new $s(e,n);var i=this.n,o=new Ss(t),s=e.r,a=e.s,u=1&r,h=r>>1;if(s.cmp(this.curve.p.umod(this.curve.n))>=0&&h)throw new Error("Unable to find sencond key candinate");s=h?this.curve.pointFromX(s.add(this.curve.n),u):this.curve.pointFromX(s,u);var c=e.r.invm(i),f=i.sub(o).mul(c).umod(i),l=a.mul(c).umod(i);return this.g.mulAdd(f,s,l)},oa.prototype.getKeyRecoveryParam=function(t,e,r,n){if(null!==(e=new $s(e,n)).recoveryParam)return e.recoveryParam;for(var i=0;i<4;i++){var o;try{o=this.recoverPubKey(t,e,i)}catch(t){continue}if(o.eq(r))return i}throw new Error("Unable to find valid recovery factor")};var aa=ks(function(t,e){var r=e;r.version="6.6.1",r.utils=Bs,r.rand=function(){throw new Error("unsupported")},r.curve=Hs,r.curves=Ks,r.ec=sa,r.eddsa=null}),ua=aa.ec;const ha=new yt("signing-key/5.8.0");let ca=null;function fa(){return ca||(ca=new ua("secp256k1")),ca}class la{constructor(t){fe(this,"curve","secp256k1"),fe(this,"privateKey",Bt(t)),32!==Nt(this.privateKey)&&ha.throwArgumentError("invalid private key","privateKey","[[ REDACTED ]]");const e=fa().keyFromPrivate(Mt(this.privateKey));fe(this,"publicKey","0x"+e.getPublic(!1,"hex")),fe(this,"compressedPublicKey","0x"+e.getPublic(!0,"hex")),fe(this,"_isSigningKey",!0)}_addPoint(t){const e=fa().keyFromPublic(Mt(this.publicKey)),r=fa().keyFromPublic(Mt(t));return"0x"+e.pub.add(r.pub).encodeCompressed("hex")}signDigest(t){const e=fa().keyFromPrivate(Mt(this.privateKey)),r=Mt(t);32!==r.length&&ha.throwArgumentError("bad digest length","digest",t);const n=e.sign(r,{canonical:!0});return jt({recoveryParam:n.recoveryParam,r:Lt("0x"+n.r.toString(16),32),s:Lt("0x"+n.s.toString(16),32)})}computeSharedSecret(t){const e=fa().keyFromPrivate(Mt(this.privateKey)),r=fa().keyFromPublic(Mt(pa(t)));return Lt("0x"+e.derive(r.getPublic()).toString(16),32)}static isSigningKey(t){return!(!t||!t._isSigningKey)}}function da(t,e){const r=jt(e),n={r:Mt(r.r),s:Mt(r.s)};return"0x"+fa().recoverPubKey(Mt(t),n,r.recoveryParam).encode("hex",!1)}function pa(t,e){const r=Mt(t);if(32===r.length){const t=new la(r);return e?"0x"+fa().keyFromPrivate(r).getPublic(!0,"hex"):t.publicKey}return 33===r.length?e?Bt(r):"0x"+fa().keyFromPublic(r).getPublic(!1,"hex"):65===r.length?e?"0x"+fa().keyFromPublic(r).getPublic(!0,"hex"):Bt(r):ha.throwArgumentError("invalid public or private key","key","[REDACTED]")}const ma=new yt("transactions/5.8.0");var ga;function ya(t){return"0x"===t?null:In(t)}function ba(t){return"0x"===t?Fe:Gt.from(t)}!function(t){t[t.legacy=0]="legacy",t[t.eip2930=1]="eip2930",t[t.eip1559=2]="eip1559"}(ga||(ga={}));const va=[{name:"nonce",maxLength:32,numeric:!0},{name:"gasPrice",maxLength:32,numeric:!0},{name:"gasLimit",maxLength:32,numeric:!0},{name:"to",length:20},{name:"value",maxLength:32,numeric:!0},{name:"data"}],wa={chainId:!0,data:!0,gasLimit:!0,gasPrice:!0,nonce:!0,to:!0,type:!0,value:!0};function _a(t){return In(Pt(Er(Pt(pa(t),1)),12))}function Ea(t,e){return _a(da(Mt(t),e))}function Aa(t,e){const r=kt(Gt.from(t).toHexString());return r.length>32&&ma.throwArgumentError("invalid length for "+e,"transaction:"+e,t),r}function Ma(t,e){return{address:In(t),storageKeys:(e||[]).map((e,r)=>(32!==Nt(e)&&ma.throwArgumentError("invalid access list storageKey",`accessList[${t}:${r}]`,e),e.toLowerCase()))}}function Sa(t){if(Array.isArray(t))return t.map((t,e)=>Array.isArray(t)?(t.length>2&&ma.throwArgumentError("access list expected to be [ address, storageKeys[] ]",`value[${e}]`,t),Ma(t[0],t[1])):Ma(t.address,t.storageKeys));const e=Object.keys(t).map(e=>{const r=t[e].reduce((t,e)=>(t[e]=!0,t),{});return Ma(e,Object.keys(r).sort())});return e.sort((t,e)=>t.address.localeCompare(e.address)),e}function ka(t){return Sa(t).map(t=>[t.address,t.storageKeys])}function xa(t,e){if(null!=t.gasPrice){const e=Gt.from(t.gasPrice),r=Gt.from(t.maxFeePerGas||0);e.eq(r)||ma.throwArgumentError("mismatch EIP-1559 gasPrice != maxFeePerGas","tx",{gasPrice:e,maxFeePerGas:r})}const r=[Aa(t.chainId||0,"chainId"),Aa(t.nonce||0,"nonce"),Aa(t.maxPriorityFeePerGas||0,"maxPriorityFeePerGas"),Aa(t.maxFeePerGas||0,"maxFeePerGas"),Aa(t.gasLimit||0,"gasLimit"),null!=t.to?In(t.to):"0x",Aa(t.value||0,"value"),t.data||"0x",ka(t.accessList||[])];if(e){const t=jt(e);r.push(Aa(t.recoveryParam,"recoveryParam")),r.push(kt(t.r)),r.push(kt(t.s))}return It(["0x02",An(r)])}function Ta(t,e){const r=[Aa(t.chainId||0,"chainId"),Aa(t.nonce||0,"nonce"),Aa(t.gasPrice||0,"gasPrice"),Aa(t.gasLimit||0,"gasLimit"),null!=t.to?In(t.to):"0x",Aa(t.value||0,"value"),t.data||"0x",ka(t.accessList||[])];if(e){const t=jt(e);r.push(Aa(t.recoveryParam,"recoveryParam")),r.push(kt(t.r)),r.push(kt(t.s))}return It(["0x01",An(r)])}function Ra(t,e){if(null==t.type||0===t.type)return null!=t.accessList&&ma.throwArgumentError("untyped transactions do not support accessList; include type: 1","transaction",t),function(t,e){pe(t,wa);const r=[];va.forEach(function(e){let n=t[e.name]||[];const i={};e.numeric&&(i.hexPad="left"),n=Mt(Bt(n,i)),e.length&&n.length!==e.length&&n.length>0&&ma.throwArgumentError("invalid length for "+e.name,"transaction:"+e.name,n),e.maxLength&&(n=kt(n),n.length>e.maxLength&&ma.throwArgumentError("invalid length for "+e.name,"transaction:"+e.name,n)),r.push(Bt(n))});let n=0;if(null!=t.chainId?(n=t.chainId,"number"!=typeof n&&ma.throwArgumentError("invalid transaction.chainId","transaction",t)):e&&!_t(e)&&e.v>28&&(n=Math.floor((e.v-35)/2)),0!==n&&(r.push(Bt(n)),r.push("0x"),r.push("0x")),!e)return An(r);const i=jt(e);let o=27+i.recoveryParam;return 0!==n?(r.pop(),r.pop(),r.pop(),o+=2*n+8,i.v>28&&i.v!==o&&ma.throwArgumentError("transaction.chainId/signature.v mismatch","signature",e)):i.v!==o&&ma.throwArgumentError("transaction.chainId/signature.v mismatch","signature",e),r.push(Bt(o)),r.push(kt(Mt(i.r))),r.push(kt(Mt(i.s))),An(r)}(t,e);switch(t.type){case 1:return Ta(t,e);case 2:return xa(t,e)}return ma.throwError(`unsupported transaction type: ${t.type}`,yt.errors.UNSUPPORTED_OPERATION,{operation:"serializeTransaction",transactionType:t.type})}function Ba(t,e,r){try{const r=ba(e[0]).toNumber();if(0!==r&&1!==r)throw new Error("bad recid");t.v=r}catch(t){ma.throwArgumentError("invalid v for transaction type: 1","v",e[0])}t.r=Lt(e[1],32),t.s=Lt(e[2],32);try{const e=Er(r(t));t.from=Ea(e,{r:t.r,s:t.s,recoveryParam:t.v})}catch(t){}}function Na(t){const e=Mt(t);if(e[0]>127)return function(t){const e=kn(t);9!==e.length&&6!==e.length&&ma.throwArgumentError("invalid raw transaction","rawTransaction",t);const r={nonce:ba(e[0]).toNumber(),gasPrice:ba(e[1]),gasLimit:ba(e[2]),to:ya(e[3]),value:ba(e[4]),data:e[5],chainId:0};if(6===e.length)return r;try{r.v=Gt.from(e[6]).toNumber()}catch(t){return r}if(r.r=Lt(e[7],32),r.s=Lt(e[8],32),Gt.from(r.r).isZero()&&Gt.from(r.s).isZero())r.chainId=r.v,r.v=0;else{r.chainId=Math.floor((r.v-35)/2),r.chainId<0&&(r.chainId=0);let n=r.v-27;const i=e.slice(0,6);0!==r.chainId&&(i.push(Bt(r.chainId)),i.push("0x"),i.push("0x"),n-=2*r.chainId+8);const o=Er(An(i));try{r.from=Ea(o,{r:Bt(r.r),s:Bt(r.s),recoveryParam:n})}catch(t){}r.hash=Er(t)}return r.type=null,r}(e);switch(e[0]){case 1:return function(t){const e=kn(t.slice(1));8!==e.length&&11!==e.length&&ma.throwArgumentError("invalid component count for transaction type: 1","payload",Bt(t));const r={type:1,chainId:ba(e[0]).toNumber(),nonce:ba(e[1]).toNumber(),gasPrice:ba(e[2]),gasLimit:ba(e[3]),to:ya(e[4]),value:ba(e[5]),data:e[6],accessList:Sa(e[7])};return 8===e.length||(r.hash=Er(t),Ba(r,e.slice(8),Ta)),r}(e);case 2:return function(t){const e=kn(t.slice(1));9!==e.length&&12!==e.length&&ma.throwArgumentError("invalid component count for transaction type: 2","payload",Bt(t));const r=ba(e[2]),n=ba(e[3]),i={type:2,chainId:ba(e[0]).toNumber(),nonce:ba(e[1]).toNumber(),maxPriorityFeePerGas:r,maxFeePerGas:n,gasPrice:null,gasLimit:ba(e[4]),to:ya(e[5]),value:ba(e[6]),data:e[7],accessList:Sa(e[8])};return 9===e.length||(i.hash=Er(t),Ba(i,e.slice(9),xa)),i}(e)}return ma.throwError(`unsupported transaction type: ${e[0]}`,yt.errors.UNSUPPORTED_OPERATION,{operation:"parseTransaction",transactionType:e[0]})}const Pa=new yt(As);class Ia{constructor(){this.formats=this.getDefaultFormats()}getDefaultFormats(){const t={},e=this.address.bind(this),r=this.bigNumber.bind(this),n=this.blockTag.bind(this),i=this.data.bind(this),o=this.hash.bind(this),s=this.hex.bind(this),a=this.number.bind(this),u=this.type.bind(this);return t.transaction={hash:o,type:u,accessList:Ia.allowNull(this.accessList.bind(this),null),blockHash:Ia.allowNull(o,null),blockNumber:Ia.allowNull(a,null),transactionIndex:Ia.allowNull(a,null),confirmations:Ia.allowNull(a,null),from:e,gasPrice:Ia.allowNull(r),maxPriorityFeePerGas:Ia.allowNull(r),maxFeePerGas:Ia.allowNull(r),gasLimit:r,to:Ia.allowNull(e,null),value:r,nonce:a,data:i,r:Ia.allowNull(this.uint256),s:Ia.allowNull(this.uint256),v:Ia.allowNull(a),creates:Ia.allowNull(e,null),raw:Ia.allowNull(i)},t.transactionRequest={from:Ia.allowNull(e),nonce:Ia.allowNull(a),gasLimit:Ia.allowNull(r),gasPrice:Ia.allowNull(r),maxPriorityFeePerGas:Ia.allowNull(r),maxFeePerGas:Ia.allowNull(r),to:Ia.allowNull(e),value:Ia.allowNull(r),data:Ia.allowNull(t=>this.data(t,!0)),type:Ia.allowNull(a),accessList:Ia.allowNull(this.accessList.bind(this),null)},t.receiptLog={transactionIndex:a,blockNumber:a,transactionHash:o,address:e,topics:Ia.arrayOf(o),data:i,logIndex:a,blockHash:o},t.receipt={to:Ia.allowNull(this.address,null),from:Ia.allowNull(this.address,null),contractAddress:Ia.allowNull(e,null),transactionIndex:a,root:Ia.allowNull(s),gasUsed:r,logsBloom:Ia.allowNull(i),blockHash:o,transactionHash:o,logs:Ia.arrayOf(this.receiptLog.bind(this)),blockNumber:a,confirmations:Ia.allowNull(a,null),cumulativeGasUsed:r,effectiveGasPrice:Ia.allowNull(r),status:Ia.allowNull(a),type:u},t.block={hash:Ia.allowNull(o),parentHash:o,number:a,timestamp:a,nonce:Ia.allowNull(s),difficulty:this.difficulty.bind(this),gasLimit:r,gasUsed:r,miner:Ia.allowNull(e),extraData:i,transactions:Ia.allowNull(Ia.arrayOf(o)),baseFeePerGas:Ia.allowNull(r)},t.blockWithTransactions=me(t.block),t.blockWithTransactions.transactions=Ia.allowNull(Ia.arrayOf(this.transactionResponse.bind(this))),t.filter={fromBlock:Ia.allowNull(n,void 0),toBlock:Ia.allowNull(n,void 0),blockHash:Ia.allowNull(o,void 0),address:Ia.allowNull(e,void 0),topics:Ia.allowNull(this.topics.bind(this),void 0)},t.filterLog={blockNumber:Ia.allowNull(a),blockHash:Ia.allowNull(o),transactionIndex:a,removed:Ia.allowNull(this.boolean.bind(this)),address:e,data:Ia.allowFalsish(i,"0x"),topics:Ia.arrayOf(o),transactionHash:o,logIndex:a},t}accessList(t){return Sa(t||[])}number(t){return"0x"===t?0:Gt.from(t).toNumber()}type(t){return"0x"===t||null==t?0:Gt.from(t).toNumber()}bigNumber(t){return Gt.from(t)}boolean(t){if("boolean"==typeof t)return t;if("string"==typeof t){if("true"===(t=t.toLowerCase()))return!0;if("false"===t)return!1}throw new Error("invalid boolean - "+t)}hex(t,e){return"string"==typeof t&&(e||"0x"===t.substring(0,2)||(t="0x"+t),Tt(t))?t.toLowerCase():Pa.throwArgumentError("invalid hash","value",t)}data(t,e){const r=this.hex(t,e);if(r.length%2!=0)throw new Error("invalid data; odd-length - "+t);return r}address(t){return In(t)}callAddress(t){if(!Tt(t,32))return null;const e=In(Pt(t,12));return e===De?null:e}contractAddress(t){return On(t)}blockTag(t){if(null==t)return"latest";if("earliest"===t)return"0x0";switch(t){case"earliest":return"0x0";case"latest":case"pending":case"safe":case"finalized":return t}if("number"==typeof t||Tt(t))return Ot(t);throw new Error("invalid blockTag")}hash(t,e){const r=this.hex(t,e);return 32!==Nt(r)?Pa.throwArgumentError("invalid hash","value",t):r}difficulty(t){if(null==t)return null;const e=Gt.from(t);try{return e.toNumber()}catch(t){}return null}uint256(t){if(!Tt(t))throw new Error("invalid uint256");return Lt(t,32)}_block(t,e){null!=t.author&&null==t.miner&&(t.miner=t.author);const r=null!=t._difficulty?t._difficulty:t.difficulty,n=Ia.check(e,t);return n._difficulty=null==r?null:Gt.from(r),n}block(t){return this._block(t,this.formats.block)}blockWithTransactions(t){return this._block(t,this.formats.blockWithTransactions)}transactionRequest(t){return Ia.check(this.formats.transactionRequest,t)}transactionResponse(t){null!=t.gas&&null==t.gasLimit&&(t.gasLimit=t.gas),t.to&&Gt.from(t.to).isZero()&&(t.to="0x0000000000000000000000000000000000000000"),null!=t.input&&null==t.data&&(t.data=t.input),null==t.to&&null==t.creates&&(t.creates=this.contractAddress(t)),1!==t.type&&2!==t.type||null!=t.accessList||(t.accessList=[]);const e=Ia.check(this.formats.transaction,t);if(null!=t.chainId){let r=t.chainId;Tt(r)&&(r=Gt.from(r).toNumber()),e.chainId=r}else{let r=t.networkId;null==r&&null==e.v&&(r=t.chainId),Tt(r)&&(r=Gt.from(r).toNumber()),"number"!=typeof r&&null!=e.v&&(r=(e.v-35)/2,r<0&&(r=0),r=parseInt(r)),"number"!=typeof r&&(r=0),e.chainId=r}return e.blockHash&&"x"===e.blockHash.replace(/0/g,"")&&(e.blockHash=null),e}transaction(t){return Na(t)}receiptLog(t){return Ia.check(this.formats.receiptLog,t)}receipt(t){const e=Ia.check(this.formats.receipt,t);if(null!=e.root)if(e.root.length<=4){const t=Gt.from(e.root).toNumber();0===t||1===t?(null!=e.status&&e.status!==t&&Pa.throwArgumentError("alt-root-status/status mismatch","value",{root:e.root,status:e.status}),e.status=t,delete e.root):Pa.throwArgumentError("invalid alt-root-status","value.root",e.root)}else 66!==e.root.length&&Pa.throwArgumentError("invalid root hash","value.root",e.root);return null!=e.status&&(e.byzantium=!0),e}topics(t){return Array.isArray(t)?t.map(t=>this.topics(t)):null!=t?this.hash(t,!0):null}filter(t){return Ia.check(this.formats.filter,t)}filterLog(t){return Ia.check(this.formats.filterLog,t)}static check(t,e){const r={};for(const n in t)try{const i=t[n](e[n]);void 0!==i&&(r[n]=i)}catch(t){throw t.checkKey=n,t.checkValue=e[n],t}return r}static allowNull(t,e){return function(r){return null==r?e:t(r)}}static allowFalsish(t,e){return function(r){return r?t(r):e}}static arrayOf(t){return function(e){if(!Array.isArray(e))throw new Error("not an array");const r=[];return e.forEach(function(e){r.push(t(e))}),r}}}function Oa(t){return t&&"function"==typeof t.isCommunityResource}function Ca(t){return Oa(t)&&t.isCommunityResource()}let La=!1;function ja(){La||(La=!0)}var Da=function(t,e,r,n){return new(r||(r=Promise))(function(i,o){function s(t){try{u(n.next(t))}catch(t){o(t)}}function a(t){try{u(n.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r(function(t){t(e)})).then(s,a)}u((n=n.apply(t,e||[])).next())})};const Ua=new yt(As);function Fa(t){return null==t?"null":(32!==Nt(t)&&Ua.throwArgumentError("invalid topic","topic",t),t.toLowerCase())}function za(t){for(t=t.slice();t.length>0&&null==t[t.length-1];)t.pop();return t.map(t=>{if(Array.isArray(t)){const e={};t.forEach(t=>{e[Fa(t)]=!0});const r=Object.keys(e);return r.sort(),r.join("|")}return Fa(t)}).join("&")}function qa(t){if("string"==typeof t){if(32===Nt(t=t.toLowerCase()))return"tx:"+t;if(-1===t.indexOf(":"))return t}else{if(Array.isArray(t))return"filter:*:"+za(t);if(Ae.isForkEvent(t))throw Ua.warn("not implemented"),new Error("not implemented");if(t&&"object"==typeof t)return"filter:"+(t.address||"*")+":"+za(t.topics||[])}throw new Error("invalid event - "+t)}function Ha(){return(new Date).getTime()}function Ka(t){return new Promise(e=>{setTimeout(e,t)})}const Ga=["block","network","pending","poll"];class Va{constructor(t,e,r){fe(this,"tag",t),fe(this,"listener",e),fe(this,"once",r),this._lastBlockNumber=-2,this._inflight=!1}get event(){switch(this.type){case"tx":return this.hash;case"filter":return this.filter}return this.tag}get type(){return this.tag.split(":")[0]}get hash(){const t=this.tag.split(":");return"tx"!==t[0]?null:t[1]}get filter(){const t=this.tag.split(":");if("filter"!==t[0])return null;const e=t[1],r=function(t){return""===t?[]:t.split(/&/g).map(t=>{if(""===t)return[];const e=t.split("|").map(t=>"null"===t?null:t);return 1===e.length?e[0]:e})}(t[2]),n={};return r.length>0&&(n.topics=r),e&&"*"!==e&&(n.address=e),n}pollable(){return this.tag.indexOf(":")>=0||Ga.indexOf(this.tag)>=0}}const Wa={0:{symbol:"btc",p2pkh:0,p2sh:5,prefix:"bc"},2:{symbol:"ltc",p2pkh:48,p2sh:50,prefix:"ltc"},3:{symbol:"doge",p2pkh:30,p2sh:22},60:{symbol:"eth",ilk:"eth"},61:{symbol:"etc",ilk:"eth"},700:{symbol:"xdai",ilk:"eth"}};function Ja(t){return Lt(Gt.from(t).toHexString(),32)}function Za(t){return je.encode(St([t,Pt(rs(rs(t)),0,4)]))}const Ya=new RegExp("^(ipfs)://(.*)$","i"),Xa=[new RegExp("^(https)://(.*)$","i"),new RegExp("^(data):(.*)$","i"),Ya,new RegExp("^eip155:[0-9]+/(erc[0-9]+):(.*)$","i")];function $a(t,e){try{return Pr(Qa(t,e))}catch(t){}return null}function Qa(t,e){if("0x"===t)return null;const r=Gt.from(Pt(t,e,e+32)).toNumber(),n=Gt.from(Pt(t,r,r+32)).toNumber();return Pt(t,r+32,r+32+n)}function tu(t){return t.match(/^ipfs:\/\/ipfs\//i)?t=t.substring(12):t.match(/^ipfs:\/\//i)?t=t.substring(7):Ua.throwArgumentError("unsupported IPFS format","link",t),`https://gateway.ipfs.io/ipfs/${t}`}function eu(t){const e=Mt(t);if(e.length>32)throw new Error("internal; should not happen");const r=new Uint8Array(32);return r.set(e,32-e.length),r}function ru(t){if(t.length%32==0)return t;const e=new Uint8Array(32*Math.ceil(t.length/32));return e.set(t),e}function nu(t){const e=[];let r=0;for(let n=0;n<t.length;n++)e.push(null),r+=32;for(let n=0;n<t.length;n++){const i=Mt(t[n]);e[n]=eu(r),e.push(eu(i.length)),e.push(ru(i)),r+=32+32*Math.ceil(i.length/32)}return It(e)}let iu=class{constructor(t,e,r,n){fe(this,"provider",t),fe(this,"name",r),fe(this,"address",t.formatter.address(e)),fe(this,"_resolvedAddress",n)}supportsWildcard(){return this._supportsEip2544||(this._supportsEip2544=this.provider.call({to:this.address,data:"0x01ffc9a79061b92300000000000000000000000000000000000000000000000000000000"}).then(t=>Gt.from(t).eq(1)).catch(t=>{if(t.code===yt.errors.CALL_EXCEPTION)return!1;throw this._supportsEip2544=null,t})),this._supportsEip2544}_fetch(t,e){return Da(this,void 0,void 0,function*(){const r={to:this.address,ccipReadEnabled:!0,data:It([t,gn(this.name),e||"0x"])};let n=!1;(yield this.supportsWildcard())&&(n=!0,r.data=It(["0x9061b923",nu([yn(this.name),r.data])]));try{let t=yield this.provider.call(r);return Mt(t).length%32==4&&Ua.throwError("resolver threw error",yt.errors.CALL_EXCEPTION,{transaction:r,data:t}),n&&(t=Qa(t,0)),t}catch(t){if(t.code===yt.errors.CALL_EXCEPTION)return null;throw t}})}_fetchBytes(t,e){return Da(this,void 0,void 0,function*(){const r=yield this._fetch(t,e);return null!=r?Qa(r,0):null})}_getAddress(t,e){const r=Wa[String(t)];if(null==r&&Ua.throwError(`unsupported coin type: ${t}`,yt.errors.UNSUPPORTED_OPERATION,{operation:`getAddress(${t})`}),"eth"===r.ilk)return this.provider.formatter.address(e);const n=Mt(e);if(null!=r.p2pkh){const t=e.match(/^0x76a9([0-9a-f][0-9a-f])([0-9a-f]*)88ac$/);if(t){const e=parseInt(t[1],16);if(t[2].length===2*e&&e>=1&&e<=75)return Za(St([[r.p2pkh],"0x"+t[2]]))}}if(null!=r.p2sh){const t=e.match(/^0xa9([0-9a-f][0-9a-f])([0-9a-f]*)87$/);if(t){const e=parseInt(t[1],16);if(t[2].length===2*e&&e>=1&&e<=75)return Za(St([[r.p2sh],"0x"+t[2]]))}}if(null!=r.prefix){const t=n[1];let e=n[0];if(0===e?20!==t&&32!==t&&(e=-1):e=-1,e>=0&&n.length===2+t&&t>=1&&t<=75){const t=Es.toWords(n.slice(2));return t.unshift(e),Es.encode(r.prefix,t)}}return null}getAddress(t){return Da(this,void 0,void 0,function*(){if(null==t&&(t=60),60===t)try{const t=yield this._fetch("0x3b3b57de");return"0x"===t||t===We?null:this.provider.formatter.callAddress(t)}catch(t){if(t.code===yt.errors.CALL_EXCEPTION)return null;throw t}const e=yield this._fetchBytes("0xf1cb7e06",Ja(t));if(null==e||"0x"===e)return null;const r=this._getAddress(t,e);return null==r&&Ua.throwError("invalid or unsupported coin data",yt.errors.UNSUPPORTED_OPERATION,{operation:`getAddress(${t})`,coinType:t,data:e}),r})}getAvatar(){return Da(this,void 0,void 0,function*(){const t=[{type:"name",content:this.name}];try{const e=yield this.getText("avatar");if(null==e)return null;for(let r=0;r<Xa.length;r++){const n=e.match(Xa[r]);if(null==n)continue;const i=n[1].toLowerCase();switch(i){case"https":return t.push({type:"url",content:e}),{linkage:t,url:e};case"data":return t.push({type:"data",content:e}),{linkage:t,url:e};case"ipfs":return t.push({type:"ipfs",content:e}),{linkage:t,url:tu(e)};case"erc721":case"erc1155":{const r="erc721"===i?"0xc87b56dd":"0x0e89341c";t.push({type:i,content:e});const o=this._resolvedAddress||(yield this.getAddress()),s=(n[2]||"").split("/");if(2!==s.length)return null;const a=yield this.provider.formatter.address(s[0]),u=Lt(Gt.from(s[1]).toHexString(),32);if("erc721"===i){const e=this.provider.formatter.callAddress(yield this.provider.call({to:a,data:It(["0x6352211e",u])}));if(o!==e)return null;t.push({type:"owner",content:e})}else if("erc1155"===i){const e=Gt.from(yield this.provider.call({to:a,data:It(["0x00fdd58e",Lt(o,32),u])}));if(e.isZero())return null;t.push({type:"balance",content:e.toString()})}const h={to:this.provider.formatter.address(s[0]),data:It([r,u])};let c=$a(yield this.provider.call(h),0);if(null==c)return null;t.push({type:"metadata-url-base",content:c}),"erc1155"===i&&(c=c.replace("{id}",u.substring(2)),t.push({type:"metadata-url-expanded",content:c})),c.match(/^ipfs:/i)&&(c=tu(c)),t.push({type:"metadata-url",content:c});const f=yield fs(c);if(!f)return null;t.push({type:"metadata",content:JSON.stringify(f)});let l=f.image;if("string"!=typeof l)return null;if(l.match(/^(https:\/\/|data:)/i));else{if(null==l.match(Ya))return null;t.push({type:"url-ipfs",content:l}),l=tu(l)}return t.push({type:"url",content:l}),{linkage:t,url:l}}}}}catch(t){}return null})}getContentHash(){return Da(this,void 0,void 0,function*(){const t=yield this._fetchBytes("0xbc1c58d1");if(null==t||"0x"===t)return null;const e=t.match(/^0xe3010170(([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f]*))$/);if(e){const t=parseInt(e[3],16);if(e[4].length===2*t)return"ipfs://"+je.encode("0x"+e[1])}const r=t.match(/^0xe5010172(([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f]*))$/);if(r){const t=parseInt(r[3],16);if(r[4].length===2*t)return"ipns://"+je.encode("0x"+r[1])}const n=t.match(/^0xe40101fa011b20([0-9a-f]*)$/);if(n&&64===n[1].length)return"bzz://"+n[1];const i=t.match(/^0x90b2c605([0-9a-f]*)$/);if(i&&68===i[1].length){const t={"=":"","+":"-","/":"_"};return"sia://"+Oe("0x"+i[1]).replace(/[=+\/]/g,e=>t[e])}return Ua.throwError("invalid or unsupported content hash data",yt.errors.UNSUPPORTED_OPERATION,{operation:"getContentHash()",data:t})})}getText(t){return Da(this,void 0,void 0,function*(){let e=Rr(t);e=St([Ja(64),Ja(e.length),e]),e.length%32!=0&&(e=St([e,Lt("0x",32-t.length%32)]));const r=yield this._fetchBytes("0x59d1d43c",Bt(e));return null==r||"0x"===r?null:Pr(r)})}},ou=null,su=1;class au extends Me{constructor(t){if(super(),this._events=[],this._emitted={block:-2},this.disableCcipRead=!1,this.formatter=new.target.getFormatter(),fe(this,"anyNetwork","any"===t),this.anyNetwork&&(t=this.detectNetwork()),t instanceof Promise)this._networkPromise=t,t.catch(t=>{}),this._ready().catch(t=>{});else{const e=le(new.target,"getNetwork")(t);e?(fe(this,"_network",e),this.emit("network",e,null)):Ua.throwArgumentError("invalid network","network",t)}this._maxInternalBlockNumber=-1024,this._lastBlockNumber=-2,this._maxFilterBlockRange=10,this._pollingInterval=4e3,this._fastQueryDate=0}_ready(){return Da(this,void 0,void 0,function*(){if(null==this._network){let t=null;if(this._networkPromise)try{t=yield this._networkPromise}catch(t){}null==t&&(t=yield this.detectNetwork()),t||Ua.throwError("no network detected",yt.errors.UNKNOWN_ERROR,{}),null==this._network&&(this.anyNetwork?this._network=t:fe(this,"_network",t),this.emit("network",t,null))}return this._network})}get ready(){return ls(()=>this._ready().then(t=>t,t=>{if(t.code!==yt.errors.NETWORK_ERROR||"noNetwork"!==t.event)throw t}))}static getFormatter(){return null==ou&&(ou=new Ia),ou}static getNetwork(t){return Pe(null==t?"homestead":t)}ccipReadFetch(t,e,r){return Da(this,void 0,void 0,function*(){if(this.disableCcipRead||0===r.length)return null;const n=t.to.toLowerCase(),i=e.toLowerCase(),o=[];for(let t=0;t<r.length;t++){const e=r[t],s=e.replace("{sender}",n).replace("{data}",i),a=e.indexOf("{data}")>=0?null:JSON.stringify({data:i,sender:n}),u=yield fs({url:s,errorPassThrough:!0},a,(t,e)=>(t.status=e.statusCode,t));if(u.data)return u.data;const h=u.message||"unknown error";if(u.status>=400&&u.status<500)return Ua.throwError(`response not found during CCIP fetch: ${h}`,yt.errors.SERVER_ERROR,{url:e,errorMessage:h});o.push(h)}return Ua.throwError(`error encountered during CCIP fetch: ${o.map(t=>JSON.stringify(t)).join(", ")}`,yt.errors.SERVER_ERROR,{urls:r,errorMessages:o})})}_getInternalBlockNumber(t){return Da(this,void 0,void 0,function*(){if(yield this._ready(),t>0)for(;this._internalBlockNumber;){const e=this._internalBlockNumber;try{const r=yield e;if(Ha()-r.respTime<=t)return r.blockNumber;break}catch(t){if(this._internalBlockNumber===e)break}}const e=Ha(),r=de({blockNumber:this.perform("getBlockNumber",{}),networkError:this.getNetwork().then(t=>null,t=>t)}).then(({blockNumber:t,networkError:n})=>{if(n)throw this._internalBlockNumber===r&&(this._internalBlockNumber=null),n;const i=Ha();return(t=Gt.from(t).toNumber())<this._maxInternalBlockNumber&&(t=this._maxInternalBlockNumber),this._maxInternalBlockNumber=t,this._setFastBlockNumber(t),{blockNumber:t,reqTime:e,respTime:i}});return this._internalBlockNumber=r,r.catch(t=>{this._internalBlockNumber===r&&(this._internalBlockNumber=null)}),(yield r).blockNumber})}poll(){return Da(this,void 0,void 0,function*(){const t=su++,e=[];let r=null;try{r=yield this._getInternalBlockNumber(100+this.pollingInterval/2)}catch(t){return void this.emit("error",t)}if(this._setFastBlockNumber(r),this.emit("poll",t,r),r!==this._lastBlockNumber){if(-2===this._emitted.block&&(this._emitted.block=r-1),Math.abs(this._emitted.block-r)>1e3)Ua.warn(`network block skew detected; skipping block events (emitted=${this._emitted.block} blockNumber${r})`),this.emit("error",Ua.makeError("network block skew detected",yt.errors.NETWORK_ERROR,{blockNumber:r,event:"blockSkew",previousBlockNumber:this._emitted.block})),this.emit("block",r);else for(let t=this._emitted.block+1;t<=r;t++)this.emit("block",t);this._emitted.block!==r&&(this._emitted.block=r,Object.keys(this._emitted).forEach(t=>{if("block"===t)return;const e=this._emitted[t];"pending"!==e&&r-e>12&&delete this._emitted[t]})),-2===this._lastBlockNumber&&(this._lastBlockNumber=r-1),this._events.forEach(t=>{switch(t.type){case"tx":{const r=t.hash;let n=this.getTransactionReceipt(r).then(t=>t&&null!=t.blockNumber?(this._emitted["t:"+r]=t.blockNumber,this.emit(r,t),null):null).catch(t=>{this.emit("error",t)});e.push(n);break}case"filter":if(!t._inflight){t._inflight=!0,-2===t._lastBlockNumber&&(t._lastBlockNumber=r-1);const n=t.filter;n.fromBlock=t._lastBlockNumber+1,n.toBlock=r;const i=n.toBlock-this._maxFilterBlockRange;i>n.fromBlock&&(n.fromBlock=i),n.fromBlock<0&&(n.fromBlock=0);const o=this.getLogs(n).then(e=>{t._inflight=!1,0!==e.length&&e.forEach(e=>{e.blockNumber>t._lastBlockNumber&&(t._lastBlockNumber=e.blockNumber),this._emitted["b:"+e.blockHash]=e.blockNumber,this._emitted["t:"+e.transactionHash]=e.blockNumber,this.emit(n,e)})}).catch(e=>{this.emit("error",e),t._inflight=!1});e.push(o)}}}),this._lastBlockNumber=r,Promise.all(e).then(()=>{this.emit("didPoll",t)}).catch(t=>{this.emit("error",t)})}else this.emit("didPoll",t)})}resetEventsBlock(t){this._lastBlockNumber=t-1,this.polling&&this.poll()}get network(){return this._network}detectNetwork(){return Da(this,void 0,void 0,function*(){return Ua.throwError("provider does not support network detection",yt.errors.UNSUPPORTED_OPERATION,{operation:"provider.detectNetwork"})})}getNetwork(){return Da(this,void 0,void 0,function*(){const t=yield this._ready(),e=yield this.detectNetwork();if(t.chainId!==e.chainId){if(this.anyNetwork)return this._network=e,this._lastBlockNumber=-2,this._fastBlockNumber=null,this._fastBlockNumberPromise=null,this._fastQueryDate=0,this._emitted.block=-2,this._maxInternalBlockNumber=-1024,this._internalBlockNumber=null,this.emit("network",e,t),yield Ka(0),this._network;const r=Ua.makeError("underlying network changed",yt.errors.NETWORK_ERROR,{event:"changed",network:t,detectedNetwork:e});throw this.emit("error",r),r}return t})}get blockNumber(){return this._getInternalBlockNumber(100+this.pollingInterval/2).then(t=>{this._setFastBlockNumber(t)},t=>{}),null!=this._fastBlockNumber?this._fastBlockNumber:-1}get polling(){return null!=this._poller}set polling(t){t&&!this._poller?(this._poller=setInterval(()=>{this.poll()},this.pollingInterval),this._bootstrapPoll||(this._bootstrapPoll=setTimeout(()=>{this.poll(),this._bootstrapPoll=setTimeout(()=>{this._poller||this.poll(),this._bootstrapPoll=null},this.pollingInterval)},0))):!t&&this._poller&&(clearInterval(this._poller),this._poller=null)}get pollingInterval(){return this._pollingInterval}set pollingInterval(t){if("number"!=typeof t||t<=0||parseInt(String(t))!=t)throw new Error("invalid polling interval");this._pollingInterval=t,this._poller&&(clearInterval(this._poller),this._poller=setInterval(()=>{this.poll()},this._pollingInterval))}_getFastBlockNumber(){const t=Ha();return t-this._fastQueryDate>2*this._pollingInterval&&(this._fastQueryDate=t,this._fastBlockNumberPromise=this.getBlockNumber().then(t=>((null==this._fastBlockNumber||t>this._fastBlockNumber)&&(this._fastBlockNumber=t),this._fastBlockNumber))),this._fastBlockNumberPromise}_setFastBlockNumber(t){null!=this._fastBlockNumber&&t<this._fastBlockNumber||(this._fastQueryDate=Ha(),(null==this._fastBlockNumber||t>this._fastBlockNumber)&&(this._fastBlockNumber=t,this._fastBlockNumberPromise=Promise.resolve(t)))}waitForTransaction(t,e,r){return Da(this,void 0,void 0,function*(){return this._waitForTransaction(t,null==e?1:e,r||0,null)})}_waitForTransaction(t,e,r,n){return Da(this,void 0,void 0,function*(){const i=yield this.getTransactionReceipt(t);return(i?i.confirmations:0)>=e?i:new Promise((i,o)=>{const s=[];let a=!1;const u=function(){return!!a||(a=!0,s.forEach(t=>{t()}),!1)},h=t=>{t.confirmations<e||u()||i(t)};if(this.on(t,h),s.push(()=>{this.removeListener(t,h)}),n){let r=n.startBlock,i=null;const h=s=>Da(this,void 0,void 0,function*(){a||(yield Ka(1e3),this.getTransactionCount(n.from).then(c=>Da(this,void 0,void 0,function*(){if(!a){if(c<=n.nonce)r=s;else{{const e=yield this.getTransaction(t);if(e&&null!=e.blockNumber)return}for(null==i&&(i=r-3,i<n.startBlock&&(i=n.startBlock));i<=s;){if(a)return;const r=yield this.getBlockWithTransactions(i);for(let i=0;i<r.transactions.length;i++){const s=r.transactions[i];if(s.hash===t)return;if(s.from===n.from&&s.nonce===n.nonce){if(a)return;const r=yield this.waitForTransaction(s.hash,e);if(u())return;let i="replaced";return s.data===n.data&&s.to===n.to&&s.value.eq(n.value)?i="repriced":"0x"===s.data&&s.from===s.to&&s.value.isZero()&&(i="cancelled"),void o(Ua.makeError("transaction was replaced",yt.errors.TRANSACTION_REPLACED,{cancelled:"replaced"===i||"cancelled"===i,reason:i,replacement:this._wrapTransaction(s),hash:t,receipt:r}))}}i++}}a||this.once("block",h)}}),t=>{a||this.once("block",h)}))});if(a)return;this.once("block",h),s.push(()=>{this.removeListener("block",h)})}if("number"==typeof r&&r>0){const t=setTimeout(()=>{u()||o(Ua.makeError("timeout exceeded",yt.errors.TIMEOUT,{timeout:r}))},r);t.unref&&t.unref(),s.push(()=>{clearTimeout(t)})}})})}getBlockNumber(){return Da(this,void 0,void 0,function*(){return this._getInternalBlockNumber(0)})}getGasPrice(){return Da(this,void 0,void 0,function*(){yield this.getNetwork();const t=yield this.perform("getGasPrice",{});try{return Gt.from(t)}catch(e){return Ua.throwError("bad result from backend",yt.errors.SERVER_ERROR,{method:"getGasPrice",result:t,error:e})}})}getBalance(t,e){return Da(this,void 0,void 0,function*(){yield this.getNetwork();const r=yield de({address:this._getAddress(t),blockTag:this._getBlockTag(e)}),n=yield this.perform("getBalance",r);try{return Gt.from(n)}catch(t){return Ua.throwError("bad result from backend",yt.errors.SERVER_ERROR,{method:"getBalance",params:r,result:n,error:t})}})}getTransactionCount(t,e){return Da(this,void 0,void 0,function*(){yield this.getNetwork();const r=yield de({address:this._getAddress(t),blockTag:this._getBlockTag(e)}),n=yield this.perform("getTransactionCount",r);try{return Gt.from(n).toNumber()}catch(t){return Ua.throwError("bad result from backend",yt.errors.SERVER_ERROR,{method:"getTransactionCount",params:r,result:n,error:t})}})}getCode(t,e){return Da(this,void 0,void 0,function*(){yield this.getNetwork();const r=yield de({address:this._getAddress(t),blockTag:this._getBlockTag(e)}),n=yield this.perform("getCode",r);try{return Bt(n)}catch(t){return Ua.throwError("bad result from backend",yt.errors.SERVER_ERROR,{method:"getCode",params:r,result:n,error:t})}})}getStorageAt(t,e,r){return Da(this,void 0,void 0,function*(){yield this.getNetwork();const n=yield de({address:this._getAddress(t),blockTag:this._getBlockTag(r),position:Promise.resolve(e).then(t=>Ot(t))}),i=yield this.perform("getStorageAt",n);try{return Bt(i)}catch(t){return Ua.throwError("bad result from backend",yt.errors.SERVER_ERROR,{method:"getStorageAt",params:n,result:i,error:t})}})}_wrapTransaction(t,e,r){if(null!=e&&32!==Nt(e))throw new Error("invalid response - sendTransaction");const n=t;return null!=e&&t.hash!==e&&Ua.throwError("Transaction hash mismatch from Provider.sendTransaction.",yt.errors.UNKNOWN_ERROR,{expectedHash:t.hash,returnedHash:e}),n.wait=(e,n)=>Da(this,void 0,void 0,function*(){let i;null==e&&(e=1),null==n&&(n=0),0!==e&&null!=r&&(i={data:t.data,from:t.from,nonce:t.nonce,to:t.to,value:t.value,startBlock:r});const o=yield this._waitForTransaction(t.hash,e,n,i);return null==o&&0===e?null:(this._emitted["t:"+t.hash]=o.blockNumber,0===o.status&&Ua.throwError("transaction failed",yt.errors.CALL_EXCEPTION,{transactionHash:t.hash,transaction:t,receipt:o}),o)}),n}sendTransaction(t){return Da(this,void 0,void 0,function*(){yield this.getNetwork();const e=yield Promise.resolve(t).then(t=>Bt(t)),r=this.formatter.transaction(t);null==r.confirmations&&(r.confirmations=0);const n=yield this._getInternalBlockNumber(100+2*this.pollingInterval);try{const t=yield this.perform("sendTransaction",{signedTransaction:e});return this._wrapTransaction(r,t,n)}catch(t){throw t.transaction=r,t.transactionHash=r.hash,t}})}_getTransactionRequest(t){return Da(this,void 0,void 0,function*(){const e=yield t,r={};return["from","to"].forEach(t=>{null!=e[t]&&(r[t]=Promise.resolve(e[t]).then(t=>t?this._getAddress(t):null))}),["gasLimit","gasPrice","maxFeePerGas","maxPriorityFeePerGas","value"].forEach(t=>{null!=e[t]&&(r[t]=Promise.resolve(e[t]).then(t=>t?Gt.from(t):null))}),["type"].forEach(t=>{null!=e[t]&&(r[t]=Promise.resolve(e[t]).then(t=>null!=t?t:null))}),e.accessList&&(r.accessList=this.formatter.accessList(e.accessList)),["data"].forEach(t=>{null!=e[t]&&(r[t]=Promise.resolve(e[t]).then(t=>t?Bt(t):null))}),this.formatter.transactionRequest(yield de(r))})}_getFilter(t){return Da(this,void 0,void 0,function*(){t=yield t;const e={};return null!=t.address&&(e.address=this._getAddress(t.address)),["blockHash","topics"].forEach(r=>{null!=t[r]&&(e[r]=t[r])}),["fromBlock","toBlock"].forEach(r=>{null!=t[r]&&(e[r]=this._getBlockTag(t[r]))}),this.formatter.filter(yield de(e))})}_call(t,e,r){return Da(this,void 0,void 0,function*(){r>=10&&Ua.throwError("CCIP read exceeded maximum redirections",yt.errors.SERVER_ERROR,{redirects:r,transaction:t});const n=t.to,i=yield this.perform("call",{transaction:t,blockTag:e});if(r>=0&&"latest"===e&&null!=n&&"0x556f1830"===i.substring(0,10)&&Nt(i)%32==4)try{const o=Pt(i,4),s=Pt(o,0,32);Gt.from(s).eq(n)||Ua.throwError("CCIP Read sender did not match",yt.errors.CALL_EXCEPTION,{name:"OffchainLookup",signature:"OffchainLookup(address,string[],bytes,bytes4,bytes)",transaction:t,data:i});const a=[],u=Gt.from(Pt(o,32,64)).toNumber(),h=Gt.from(Pt(o,u,u+32)).toNumber(),c=Pt(o,u+32);for(let e=0;e<h;e++){const r=$a(c,32*e);null==r&&Ua.throwError("CCIP Read contained corrupt URL string",yt.errors.CALL_EXCEPTION,{name:"OffchainLookup",signature:"OffchainLookup(address,string[],bytes,bytes4,bytes)",transaction:t,data:i}),a.push(r)}const f=Qa(o,64);Gt.from(Pt(o,100,128)).isZero()||Ua.throwError("CCIP Read callback selector included junk",yt.errors.CALL_EXCEPTION,{name:"OffchainLookup",signature:"OffchainLookup(address,string[],bytes,bytes4,bytes)",transaction:t,data:i});const l=Pt(o,96,100),d=Qa(o,128),p=yield this.ccipReadFetch(t,f,a);null==p&&Ua.throwError("CCIP Read disabled or provided no URLs",yt.errors.CALL_EXCEPTION,{name:"OffchainLookup",signature:"OffchainLookup(address,string[],bytes,bytes4,bytes)",transaction:t,data:i});const m={to:n,data:It([l,nu([p,d])])};return this._call(m,e,r+1)}catch(t){if(t.code===yt.errors.SERVER_ERROR)throw t}try{return Bt(i)}catch(r){return Ua.throwError("bad result from backend",yt.errors.SERVER_ERROR,{method:"call",params:{transaction:t,blockTag:e},result:i,error:r})}})}call(t,e){return Da(this,void 0,void 0,function*(){yield this.getNetwork();const r=yield de({transaction:this._getTransactionRequest(t),blockTag:this._getBlockTag(e),ccipReadEnabled:Promise.resolve(t.ccipReadEnabled)});return this._call(r.transaction,r.blockTag,r.ccipReadEnabled?0:-1)})}estimateGas(t){return Da(this,void 0,void 0,function*(){yield this.getNetwork();const e=yield de({transaction:this._getTransactionRequest(t)}),r=yield this.perform("estimateGas",e);try{return Gt.from(r)}catch(t){return Ua.throwError("bad result from backend",yt.errors.SERVER_ERROR,{method:"estimateGas",params:e,result:r,error:t})}})}_getAddress(t){return Da(this,void 0,void 0,function*(){"string"!=typeof(t=yield t)&&Ua.throwArgumentError("invalid address or ENS name","name",t);const e=yield this.resolveName(t);return null==e&&Ua.throwError("ENS name not configured",yt.errors.UNSUPPORTED_OPERATION,{operation:`resolveName(${JSON.stringify(t)})`}),e})}_getBlock(t,e){return Da(this,void 0,void 0,function*(){yield this.getNetwork(),t=yield t;let r=-128;const n={includeTransactions:!!e};if(Tt(t,32))n.blockHash=t;else try{n.blockTag=yield this._getBlockTag(t),Tt(n.blockTag)&&(r=parseInt(n.blockTag.substring(2),16))}catch(e){Ua.throwArgumentError("invalid block hash or block tag","blockHashOrBlockTag",t)}return ls(()=>Da(this,void 0,void 0,function*(){const t=yield this.perform("getBlock",n);if(null==t)return null!=n.blockHash&&null==this._emitted["b:"+n.blockHash]||null!=n.blockTag&&r>this._emitted.block?null:void 0;if(e){let e=null;for(let r=0;r<t.transactions.length;r++){const n=t.transactions[r];if(null==n.blockNumber)n.confirmations=0;else if(null==n.confirmations){null==e&&(e=yield this._getInternalBlockNumber(100+2*this.pollingInterval));let t=e-n.blockNumber+1;t<=0&&(t=1),n.confirmations=t}}const r=this.formatter.blockWithTransactions(t);return r.transactions=r.transactions.map(t=>this._wrapTransaction(t)),r}return this.formatter.block(t)}),{oncePoll:this})})}getBlock(t){return this._getBlock(t,!1)}getBlockWithTransactions(t){return this._getBlock(t,!0)}getTransaction(t){return Da(this,void 0,void 0,function*(){yield this.getNetwork(),t=yield t;const e={transactionHash:this.formatter.hash(t,!0)};return ls(()=>Da(this,void 0,void 0,function*(){const r=yield this.perform("getTransaction",e);if(null==r)return null==this._emitted["t:"+t]?null:void 0;const n=this.formatter.transactionResponse(r);if(null==n.blockNumber)n.confirmations=0;else if(null==n.confirmations){let t=(yield this._getInternalBlockNumber(100+2*this.pollingInterval))-n.blockNumber+1;t<=0&&(t=1),n.confirmations=t}return this._wrapTransaction(n)}),{oncePoll:this})})}getTransactionReceipt(t){return Da(this,void 0,void 0,function*(){yield this.getNetwork(),t=yield t;const e={transactionHash:this.formatter.hash(t,!0)};return ls(()=>Da(this,void 0,void 0,function*(){const r=yield this.perform("getTransactionReceipt",e);if(null==r)return null==this._emitted["t:"+t]?null:void 0;if(null==r.blockHash)return;const n=this.formatter.receipt(r);if(null==n.blockNumber)n.confirmations=0;else if(null==n.confirmations){let t=(yield this._getInternalBlockNumber(100+2*this.pollingInterval))-n.blockNumber+1;t<=0&&(t=1),n.confirmations=t}return n}),{oncePoll:this})})}getLogs(t){return Da(this,void 0,void 0,function*(){yield this.getNetwork();const e=yield de({filter:this._getFilter(t)}),r=yield this.perform("getLogs",e);return r.forEach(t=>{null==t.removed&&(t.removed=!1)}),Ia.arrayOf(this.formatter.filterLog.bind(this.formatter))(r)})}getEtherPrice(){return Da(this,void 0,void 0,function*(){return yield this.getNetwork(),this.perform("getEtherPrice",{})})}_getBlockTag(t){return Da(this,void 0,void 0,function*(){if("number"==typeof(t=yield t)&&t<0){t%1&&Ua.throwArgumentError("invalid BlockTag","blockTag",t);let e=yield this._getInternalBlockNumber(100+2*this.pollingInterval);return e+=t,e<0&&(e=0),this.formatter.blockTag(e)}return this.formatter.blockTag(t)})}getResolver(t){return Da(this,void 0,void 0,function*(){let e=t;for(;;){if(""===e||"."===e)return null;if("eth"!==t&&"eth"===e)return null;const r=yield this._getResolver(e,"getResolver");if(null!=r){const n=new iu(this,r,t);return e===t||(yield n.supportsWildcard())?n:null}e=e.split(".").slice(1).join(".")}})}_getResolver(t,e){return Da(this,void 0,void 0,function*(){null==e&&(e="ENS");const r=yield this.getNetwork();r.ensAddress||Ua.throwError("network does not support ENS",yt.errors.UNSUPPORTED_OPERATION,{operation:e,network:r.name});try{const e=yield this.call({to:r.ensAddress,data:"0x0178b8bf"+gn(t).substring(2)});return this.formatter.callAddress(e)}catch(t){}return null})}resolveName(t){return Da(this,void 0,void 0,function*(){t=yield t;try{return Promise.resolve(this.formatter.address(t))}catch(e){if(Tt(t))throw e}"string"!=typeof t&&Ua.throwArgumentError("invalid ENS name","name",t);const e=yield this.getResolver(t);return e?yield e.getAddress():null})}lookupAddress(t){return Da(this,void 0,void 0,function*(){t=yield t;const e=(t=this.formatter.address(t)).substring(2).toLowerCase()+".addr.reverse",r=yield this._getResolver(e,"lookupAddress");if(null==r)return null;const n=$a(yield this.call({to:r,data:"0x691f3431"+gn(e).substring(2)}),0);return(yield this.resolveName(n))!=t?null:n})}getAvatar(t){return Da(this,void 0,void 0,function*(){let e=null;if(Tt(t)){const r=this.formatter.address(t).substring(2).toLowerCase()+".addr.reverse",n=yield this._getResolver(r,"getAvatar");if(!n)return null;e=new iu(this,n,r);try{const t=yield e.getAvatar();if(t)return t.url}catch(t){if(t.code!==yt.errors.CALL_EXCEPTION)throw t}try{const t=$a(yield this.call({to:n,data:"0x691f3431"+gn(r).substring(2)}),0);e=yield this.getResolver(t)}catch(t){if(t.code!==yt.errors.CALL_EXCEPTION)throw t;return null}}else if(e=yield this.getResolver(t),!e)return null;const r=yield e.getAvatar();return null==r?null:r.url})}perform(t,e){return Ua.throwError(t+" not implemented",yt.errors.NOT_IMPLEMENTED,{operation:t})}_startEvent(t){this.polling=this._events.filter(t=>t.pollable()).length>0}_stopEvent(t){this.polling=this._events.filter(t=>t.pollable()).length>0}_addEventListener(t,e,r){const n=new Va(qa(t),e,r);return this._events.push(n),this._startEvent(n),this}on(t,e){return this._addEventListener(t,e,!1)}once(t,e){return this._addEventListener(t,e,!0)}emit(t,...e){let r=!1,n=[],i=qa(t);return this._events=this._events.filter(t=>t.tag!==i||(setTimeout(()=>{t.listener.apply(this,e)},0),r=!0,!t.once||(n.push(t),!1))),n.forEach(t=>{this._stopEvent(t)}),r}listenerCount(t){if(!t)return this._events.length;let e=qa(t);return this._events.filter(t=>t.tag===e).length}listeners(t){if(null==t)return this._events.map(t=>t.listener);let e=qa(t);return this._events.filter(t=>t.tag===e).map(t=>t.listener)}off(t,e){if(null==e)return this.removeAllListeners(t);const r=[];let n=!1,i=qa(t);return this._events=this._events.filter(t=>t.tag!==i||t.listener!=e||(!!n||(n=!0,r.push(t),!1))),r.forEach(t=>{this._stopEvent(t)}),this}removeAllListeners(t){let e=[];if(null==t)e=this._events,this._events=[];else{const r=qa(t);this._events=this._events.filter(t=>t.tag!==r||(e.push(t),!1))}return e.forEach(t=>{this._stopEvent(t)}),this}}var uu=function(t,e,r,n){return new(r||(r=Promise))(function(i,o){function s(t){try{u(n.next(t))}catch(t){o(t)}}function a(t){try{u(n.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r(function(t){t(e)})).then(s,a)}u((n=n.apply(t,e||[])).next())})};const hu=new yt("abstract-signer/5.8.0"),cu=["accessList","ccipReadEnabled","chainId","customData","data","from","gasLimit","gasPrice","maxFeePerGas","maxPriorityFeePerGas","nonce","to","type","value"],fu=[yt.errors.INSUFFICIENT_FUNDS,yt.errors.NONCE_EXPIRED,yt.errors.REPLACEMENT_UNDERPRICED];let lu=class t{constructor(){hu.checkAbstract(new.target,t),fe(this,"_isSigner",!0)}getBalance(t){return uu(this,void 0,void 0,function*(){return this._checkProvider("getBalance"),yield this.provider.getBalance(this.getAddress(),t)})}getTransactionCount(t){return uu(this,void 0,void 0,function*(){return this._checkProvider("getTransactionCount"),yield this.provider.getTransactionCount(this.getAddress(),t)})}estimateGas(t){return uu(this,void 0,void 0,function*(){this._checkProvider("estimateGas");const e=yield de(this.checkTransaction(t));return yield this.provider.estimateGas(e)})}call(t,e){return uu(this,void 0,void 0,function*(){this._checkProvider("call");const r=yield de(this.checkTransaction(t));return yield this.provider.call(r,e)})}sendTransaction(t){return uu(this,void 0,void 0,function*(){this._checkProvider("sendTransaction");const e=yield this.populateTransaction(t),r=yield this.signTransaction(e);return yield this.provider.sendTransaction(r)})}getChainId(){return uu(this,void 0,void 0,function*(){this._checkProvider("getChainId");return(yield this.provider.getNetwork()).chainId})}getGasPrice(){return uu(this,void 0,void 0,function*(){return this._checkProvider("getGasPrice"),yield this.provider.getGasPrice()})}getFeeData(){return uu(this,void 0,void 0,function*(){return this._checkProvider("getFeeData"),yield this.provider.getFeeData()})}resolveName(t){return uu(this,void 0,void 0,function*(){return this._checkProvider("resolveName"),yield this.provider.resolveName(t)})}checkTransaction(t){for(const e in t)-1===cu.indexOf(e)&&hu.throwArgumentError("invalid transaction key: "+e,"transaction",t);const e=me(t);return null==e.from?e.from=this.getAddress():e.from=Promise.all([Promise.resolve(e.from),this.getAddress()]).then(e=>(e[0].toLowerCase()!==e[1].toLowerCase()&&hu.throwArgumentError("from address mismatch","transaction",t),e[0])),e}populateTransaction(t){return uu(this,void 0,void 0,function*(){const e=yield de(this.checkTransaction(t));null!=e.to&&(e.to=Promise.resolve(e.to).then(t=>uu(this,void 0,void 0,function*(){if(null==t)return null;const e=yield this.resolveName(t);return null==e&&hu.throwArgumentError("provided ENS name resolves to null","tx.to",t),e})),e.to.catch(t=>{}));const r=null!=e.maxFeePerGas||null!=e.maxPriorityFeePerGas;if(null==e.gasPrice||2!==e.type&&!r?0!==e.type&&1!==e.type||!r||hu.throwArgumentError("pre-eip-1559 transaction do not support maxFeePerGas/maxPriorityFeePerGas","transaction",t):hu.throwArgumentError("eip-1559 transaction do not support gasPrice","transaction",t),2!==e.type&&null!=e.type||null==e.maxFeePerGas||null==e.maxPriorityFeePerGas)if(0===e.type||1===e.type)null==e.gasPrice&&(e.gasPrice=this.getGasPrice());else{const t=yield this.getFeeData();if(null==e.type)if(null!=t.maxFeePerGas&&null!=t.maxPriorityFeePerGas)if(e.type=2,null!=e.gasPrice){const t=e.gasPrice;delete e.gasPrice,e.maxFeePerGas=t,e.maxPriorityFeePerGas=t}else null==e.maxFeePerGas&&(e.maxFeePerGas=t.maxFeePerGas),null==e.maxPriorityFeePerGas&&(e.maxPriorityFeePerGas=t.maxPriorityFeePerGas);else null!=t.gasPrice?(r&&hu.throwError("network does not support EIP-1559",yt.errors.UNSUPPORTED_OPERATION,{operation:"populateTransaction"}),null==e.gasPrice&&(e.gasPrice=t.gasPrice),e.type=0):hu.throwError("failed to get consistent fee data",yt.errors.UNSUPPORTED_OPERATION,{operation:"signer.getFeeData"});else 2===e.type&&(null==e.maxFeePerGas&&(e.maxFeePerGas=t.maxFeePerGas),null==e.maxPriorityFeePerGas&&(e.maxPriorityFeePerGas=t.maxPriorityFeePerGas))}else e.type=2;return null==e.nonce&&(e.nonce=this.getTransactionCount("pending")),null==e.gasLimit&&(e.gasLimit=this.estimateGas(e).catch(t=>{if(fu.indexOf(t.code)>=0)throw t;return hu.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",yt.errors.UNPREDICTABLE_GAS_LIMIT,{error:t,tx:e})})),null==e.chainId?e.chainId=this.getChainId():e.chainId=Promise.all([Promise.resolve(e.chainId),this.getChainId()]).then(e=>(0!==e[1]&&e[0]!==e[1]&&hu.throwArgumentError("chainId address mismatch","transaction",t),e[0])),yield de(e)})}_checkProvider(t){this.provider||hu.throwError("missing provider",yt.errors.UNSUPPORTED_OPERATION,{operation:t||"_checkProvider"})}static isSigner(t){return!(!t||!t._isSigner)}};class du extends lu{constructor(t,e){super(),fe(this,"address",t),fe(this,"provider",e||null)}getAddress(){return Promise.resolve(this.address)}_fail(t,e){return Promise.resolve().then(()=>{hu.throwError(t,yt.errors.UNSUPPORTED_OPERATION,{operation:e})})}signMessage(t){return this._fail("VoidSigner cannot sign messages","signMessage")}signTransaction(t){return this._fail("VoidSigner cannot sign transactions","signTransaction")}_signTypedData(t,e,r){return this._fail("VoidSigner cannot sign typed data","signTypedData")}connect(t){return new du(this.address,t)}}var pu=function(t,e,r,n){return new(r||(r=Promise))(function(i,o){function s(t){try{u(n.next(t))}catch(t){o(t)}}function a(t){try{u(n.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r(function(t){t(e)})).then(s,a)}u((n=n.apply(t,e||[])).next())})};const mu=new yt(As),gu=["call","estimateGas"];function yu(t,e){if(null==t)return null;if("string"==typeof t.message&&t.message.match("reverted")){const r=Tt(t.data)?t.data:null;if(!e||r)return{message:t.message,data:r}}if("object"==typeof t){for(const r in t){const n=yu(t[r],e);if(n)return n}return null}if("string"==typeof t)try{return yu(JSON.parse(t),e)}catch(t){}return null}function bu(t,e,r){const n=r.transaction||r.signedTransaction;if("call"===t){const t=yu(e,!0);if(t)return t.data;mu.throwError("missing revert data in call exception; Transaction reverted without a reason string",yt.errors.CALL_EXCEPTION,{data:"0x",transaction:n,error:e})}if("estimateGas"===t){let r=yu(e.body,!1);null==r&&(r=yu(e,!1)),r&&mu.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",yt.errors.UNPREDICTABLE_GAS_LIMIT,{reason:r.message,method:t,transaction:n,error:e})}let i=e.message;throw e.code===yt.errors.SERVER_ERROR&&e.error&&"string"==typeof e.error.message?i=e.error.message:"string"==typeof e.body?i=e.body:"string"==typeof e.responseText&&(i=e.responseText),i=(i||"").toLowerCase(),i.match(/insufficient funds|base fee exceeds gas limit|InsufficientFunds/i)&&mu.throwError("insufficient funds for intrinsic transaction cost",yt.errors.INSUFFICIENT_FUNDS,{error:e,method:t,transaction:n}),i.match(/nonce (is )?too low/i)&&mu.throwError("nonce has already been used",yt.errors.NONCE_EXPIRED,{error:e,method:t,transaction:n}),i.match(/replacement transaction underpriced|transaction gas price.*too low/i)&&mu.throwError("replacement fee too low",yt.errors.REPLACEMENT_UNDERPRICED,{error:e,method:t,transaction:n}),i.match(/only replay-protected/i)&&mu.throwError("legacy pre-eip-155 transactions not supported",yt.errors.UNSUPPORTED_OPERATION,{error:e,method:t,transaction:n}),gu.indexOf(t)>=0&&i.match(/gas required exceeds allowance|always failing transaction|execution reverted|revert/)&&mu.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",yt.errors.UNPREDICTABLE_GAS_LIMIT,{error:e,method:t,transaction:n}),e}function vu(t){return new Promise(function(e){setTimeout(e,t)})}function wu(t){if(t.error){const e=new Error(t.error.message);throw e.code=t.error.code,e.data=t.error.data,e}return t.result}function _u(t){return t?t.toLowerCase():t}const Eu={};class Au extends lu{constructor(t,e,r){if(super(),t!==Eu)throw new Error("do not call the JsonRpcSigner constructor directly; use provider.getSigner");fe(this,"provider",e),null==r&&(r=0),"string"==typeof r?(fe(this,"_address",this.provider.formatter.address(r)),fe(this,"_index",null)):"number"==typeof r?(fe(this,"_index",r),fe(this,"_address",null)):mu.throwArgumentError("invalid address or index","addressOrIndex",r)}connect(t){return mu.throwError("cannot alter JSON-RPC Signer connection",yt.errors.UNSUPPORTED_OPERATION,{operation:"connect"})}connectUnchecked(){return new Mu(Eu,this.provider,this._address||this._index)}getAddress(){return this._address?Promise.resolve(this._address):this.provider.send("eth_accounts",[]).then(t=>(t.length<=this._index&&mu.throwError("unknown account #"+this._index,yt.errors.UNSUPPORTED_OPERATION,{operation:"getAddress"}),this.provider.formatter.address(t[this._index])))}sendUncheckedTransaction(t){t=me(t);const e=this.getAddress().then(t=>(t&&(t=t.toLowerCase()),t));if(null==t.gasLimit){const r=me(t);r.from=e,t.gasLimit=this.provider.estimateGas(r)}return null!=t.to&&(t.to=Promise.resolve(t.to).then(t=>pu(this,void 0,void 0,function*(){if(null==t)return null;const e=yield this.provider.resolveName(t);return null==e&&mu.throwArgumentError("provided ENS name resolves to null","tx.to",t),e}))),de({tx:de(t),sender:e}).then(({tx:e,sender:r})=>{null!=e.from?e.from.toLowerCase()!==r&&mu.throwArgumentError("from address mismatch","transaction",t):e.from=r;const n=this.provider.constructor.hexlifyTransaction(e,{from:!0});return this.provider.send("eth_sendTransaction",[n]).then(t=>t,t=>("string"==typeof t.message&&t.message.match(/user denied/i)&&mu.throwError("user rejected transaction",yt.errors.ACTION_REJECTED,{action:"sendTransaction",transaction:e}),bu("sendTransaction",t,n)))})}signTransaction(t){return mu.throwError("signing transactions is unsupported",yt.errors.UNSUPPORTED_OPERATION,{operation:"signTransaction"})}sendTransaction(t){return pu(this,void 0,void 0,function*(){const e=yield this.provider._getInternalBlockNumber(100+2*this.provider.pollingInterval),r=yield this.sendUncheckedTransaction(t);try{return yield ls(()=>pu(this,void 0,void 0,function*(){const t=yield this.provider.getTransaction(r);if(null!==t)return this.provider._wrapTransaction(t,r,e)}),{oncePoll:this.provider})}catch(t){throw t.transactionHash=r,t}})}signMessage(t){return pu(this,void 0,void 0,function*(){const e="string"==typeof t?Rr(t):t,r=yield this.getAddress();try{return yield this.provider.send("personal_sign",[Bt(e),r.toLowerCase()])}catch(e){throw"string"==typeof e.message&&e.message.match(/user denied/i)&&mu.throwError("user rejected signing",yt.errors.ACTION_REJECTED,{action:"signMessage",from:r,messageData:t}),e}})}_legacySignMessage(t){return pu(this,void 0,void 0,function*(){const e="string"==typeof t?Rr(t):t,r=yield this.getAddress();try{return yield this.provider.send("eth_sign",[r.toLowerCase(),Bt(e)])}catch(e){throw"string"==typeof e.message&&e.message.match(/user denied/i)&&mu.throwError("user rejected signing",yt.errors.ACTION_REJECTED,{action:"_legacySignMessage",from:r,messageData:t}),e}})}_signTypedData(t,e,r){return pu(this,void 0,void 0,function*(){const n=yield Yn.resolveNames(t,e,r,t=>this.provider.resolveName(t)),i=yield this.getAddress();try{return yield this.provider.send("eth_signTypedData_v4",[i.toLowerCase(),JSON.stringify(Yn.getPayload(n.domain,e,n.value))])}catch(t){throw"string"==typeof t.message&&t.message.match(/user denied/i)&&mu.throwError("user rejected signing",yt.errors.ACTION_REJECTED,{action:"_signTypedData",from:i,messageData:{domain:n.domain,types:e,value:n.value}}),t}})}unlock(t){return pu(this,void 0,void 0,function*(){const e=this.provider,r=yield this.getAddress();return e.send("personal_unlockAccount",[r.toLowerCase(),t,null])})}}class Mu extends Au{sendTransaction(t){return this.sendUncheckedTransaction(t).then(t=>({hash:t,nonce:null,gasLimit:null,gasPrice:null,data:null,value:null,chainId:null,confirmations:0,from:null,wait:e=>this.provider.waitForTransaction(t,e)}))}}const Su={chainId:!0,data:!0,gasLimit:!0,gasPrice:!0,nonce:!0,to:!0,value:!0,type:!0,accessList:!0,maxFeePerGas:!0,maxPriorityFeePerGas:!0};class ku extends au{constructor(t,e){let r=e;null==r&&(r=new Promise((t,e)=>{setTimeout(()=>{this.detectNetwork().then(e=>{t(e)},t=>{e(t)})},0)})),super(r),t||(t=le(this.constructor,"defaultUrl")()),fe(this,"connection","string"==typeof t?Object.freeze({url:t}):Object.freeze(me(t))),this._nextId=42}get _cache(){return null==this._eventLoopCache&&(this._eventLoopCache={}),this._eventLoopCache}static defaultUrl(){return"http://localhost:8545"}detectNetwork(){return this._cache.detectNetwork||(this._cache.detectNetwork=this._uncachedDetectNetwork(),setTimeout(()=>{this._cache.detectNetwork=null},0)),this._cache.detectNetwork}_uncachedDetectNetwork(){return pu(this,void 0,void 0,function*(){yield vu(0);let t=null;try{t=yield this.send("eth_chainId",[])}catch(e){try{t=yield this.send("net_version",[])}catch(t){}}if(null!=t){const e=le(this.constructor,"getNetwork");try{return e(Gt.from(t).toNumber())}catch(e){return mu.throwError("could not detect network",yt.errors.NETWORK_ERROR,{chainId:t,event:"invalidNetwork",serverError:e})}}return mu.throwError("could not detect network",yt.errors.NETWORK_ERROR,{event:"noNetwork"})})}getSigner(t){return new Au(Eu,this,t)}getUncheckedSigner(t){return this.getSigner(t).connectUnchecked()}listAccounts(){return this.send("eth_accounts",[]).then(t=>t.map(t=>this.formatter.address(t)))}send(t,e){const r={method:t,params:e,id:this._nextId++,jsonrpc:"2.0"};this.emit("debug",{action:"request",request:ve(r),provider:this});const n=["eth_chainId","eth_blockNumber"].indexOf(t)>=0;if(n&&this._cache[t])return this._cache[t];const i=fs(this.connection,JSON.stringify(r),wu).then(t=>(this.emit("debug",{action:"response",request:r,response:t,provider:this}),t),t=>{throw this.emit("debug",{action:"response",error:t,request:r,provider:this}),t});return n&&(this._cache[t]=i,setTimeout(()=>{this._cache[t]=null},0)),i}prepareRequest(t,e){switch(t){case"getBlockNumber":return["eth_blockNumber",[]];case"getGasPrice":return["eth_gasPrice",[]];case"getBalance":return["eth_getBalance",[_u(e.address),e.blockTag]];case"getTransactionCount":return["eth_getTransactionCount",[_u(e.address),e.blockTag]];case"getCode":return["eth_getCode",[_u(e.address),e.blockTag]];case"getStorageAt":return["eth_getStorageAt",[_u(e.address),Lt(e.position,32),e.blockTag]];case"sendTransaction":return["eth_sendRawTransaction",[e.signedTransaction]];case"getBlock":return e.blockTag?["eth_getBlockByNumber",[e.blockTag,!!e.includeTransactions]]:e.blockHash?["eth_getBlockByHash",[e.blockHash,!!e.includeTransactions]]:null;case"getTransaction":return["eth_getTransactionByHash",[e.transactionHash]];case"getTransactionReceipt":return["eth_getTransactionReceipt",[e.transactionHash]];case"call":return["eth_call",[le(this.constructor,"hexlifyTransaction")(e.transaction,{from:!0}),e.blockTag]];case"estimateGas":return["eth_estimateGas",[le(this.constructor,"hexlifyTransaction")(e.transaction,{from:!0})]];case"getLogs":return e.filter&&null!=e.filter.address&&(e.filter.address=_u(e.filter.address)),["eth_getLogs",[e.filter]]}return null}perform(t,e){return pu(this,void 0,void 0,function*(){if("call"===t||"estimateGas"===t){const t=e.transaction;if(t&&null!=t.type&&Gt.from(t.type).isZero()&&null==t.maxFeePerGas&&null==t.maxPriorityFeePerGas){const r=yield this.getFeeData();null==r.maxFeePerGas&&null==r.maxPriorityFeePerGas&&((e=me(e)).transaction=me(t),delete e.transaction.type)}}const r=this.prepareRequest(t,e);null==r&&mu.throwError(t+" not implemented",yt.errors.NOT_IMPLEMENTED,{operation:t});try{return yield this.send(r[0],r[1])}catch(r){return bu(t,r,e)}})}_startEvent(t){"pending"===t.tag&&this._startPending(),super._startEvent(t)}_startPending(){if(null!=this._pendingFilter)return;const t=this,e=this.send("eth_newPendingTransactionFilter",[]);this._pendingFilter=e,e.then(function(r){return function n(){t.send("eth_getFilterChanges",[r]).then(function(r){if(t._pendingFilter!=e)return null;let n=Promise.resolve();return r.forEach(function(e){t._emitted["t:"+e.toLowerCase()]="pending",n=n.then(function(){return t.getTransaction(e).then(function(e){return t.emit("pending",e),null})})}),n.then(function(){return vu(1e3)})}).then(function(){if(t._pendingFilter==e)return setTimeout(function(){n()},0),null;t.send("eth_uninstallFilter",[r])}).catch(t=>{})}(),r}).catch(t=>{})}_stopEvent(t){"pending"===t.tag&&0===this.listenerCount("pending")&&(this._pendingFilter=null),super._stopEvent(t)}static hexlifyTransaction(t,e){const r=me(Su);if(e)for(const t in e)e[t]&&(r[t]=!0);pe(t,r);const n={};return["chainId","gasLimit","gasPrice","type","maxFeePerGas","maxPriorityFeePerGas","nonce","value"].forEach(function(e){if(null==t[e])return;const r=Ot(Gt.from(t[e]));"gasLimit"===e&&(e="gas"),n[e]=r}),["from","to","data"].forEach(function(e){null!=t[e]&&(n[e]=Bt(t[e]))}),t.accessList&&(n.accessList=Sa(t.accessList)),n}}let xu=null;try{if(xu=WebSocket,null==xu)throw new Error("inject please")}catch(bj){const t=new yt(As);xu=function(){t.throwError("WebSockets not supported in this environment",yt.errors.UNSUPPORTED_OPERATION,{operation:"new WebSocket()"})}}var Tu=function(t,e,r,n){return new(r||(r=Promise))(function(i,o){function s(t){try{u(n.next(t))}catch(t){o(t)}}function a(t){try{u(n.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r(function(t){t(e)})).then(s,a)}u((n=n.apply(t,e||[])).next())})};const Ru=new yt(As);let Bu=1;class Nu extends ku{constructor(t,e){"any"===e&&Ru.throwError("WebSocketProvider does not support 'any' network yet",yt.errors.UNSUPPORTED_OPERATION,{operation:"network:any"}),super("string"==typeof t?t:"_websocket",e),this._pollingInterval=-1,this._wsReady=!1,fe(this,"_websocket","string"==typeof t?new xu(this.connection.url):t),fe(this,"_requests",{}),fe(this,"_subs",{}),fe(this,"_subIds",{}),fe(this,"_detectNetwork",super.detectNetwork()),this.websocket.onopen=()=>{this._wsReady=!0,Object.keys(this._requests).forEach(t=>{this.websocket.send(this._requests[t].payload)})},this.websocket.onmessage=t=>{const e=t.data,r=JSON.parse(e);if(null!=r.id){const t=String(r.id),n=this._requests[t];if(delete this._requests[t],void 0!==r.result)n.callback(null,r.result),this.emit("debug",{action:"response",request:JSON.parse(n.payload),response:r.result,provider:this});else{let t=null;r.error?(t=new Error(r.error.message||"unknown error"),fe(t,"code",r.error.code||null),fe(t,"response",e)):t=new Error("unknown error"),n.callback(t,void 0),this.emit("debug",{action:"response",error:t,request:JSON.parse(n.payload),provider:this})}}else if("eth_subscription"===r.method){const t=this._subs[r.params.subscription];t&&t.processFunc(r.params.result)}};const r=setInterval(()=>{this.emit("poll")},1e3);r.unref&&r.unref()}get websocket(){return this._websocket}detectNetwork(){return this._detectNetwork}get pollingInterval(){return 0}resetEventsBlock(t){Ru.throwError("cannot reset events block on WebSocketProvider",yt.errors.UNSUPPORTED_OPERATION,{operation:"resetEventBlock"})}set pollingInterval(t){Ru.throwError("cannot set polling interval on WebSocketProvider",yt.errors.UNSUPPORTED_OPERATION,{operation:"setPollingInterval"})}poll(){return Tu(this,void 0,void 0,function*(){return null})}set polling(t){t&&Ru.throwError("cannot set polling on WebSocketProvider",yt.errors.UNSUPPORTED_OPERATION,{operation:"setPolling"})}send(t,e){const r=Bu++;return new Promise((n,i)=>{const o=JSON.stringify({method:t,params:e,id:r,jsonrpc:"2.0"});this.emit("debug",{action:"request",request:JSON.parse(o),provider:this}),this._requests[String(r)]={callback:function(t,e){return t?i(t):n(e)},payload:o},this._wsReady&&this.websocket.send(o)})}static defaultUrl(){return"ws://localhost:8546"}_subscribe(t,e,r){return Tu(this,void 0,void 0,function*(){let n=this._subIds[t];null==n&&(n=Promise.all(e).then(t=>this.send("eth_subscribe",t)),this._subIds[t]=n);const i=yield n;this._subs[i]={tag:t,processFunc:r}})}_startEvent(t){switch(t.type){case"block":this._subscribe("block",["newHeads"],t=>{const e=Gt.from(t.number).toNumber();this._emitted.block=e,this.emit("block",e)});break;case"pending":this._subscribe("pending",["newPendingTransactions"],t=>{this.emit("pending",t)});break;case"filter":this._subscribe(t.tag,["logs",this._getFilter(t.filter)],e=>{null==e.removed&&(e.removed=!1),this.emit(t.filter,this.formatter.filterLog(e))});break;case"tx":{const e=t=>{const e=t.hash;this.getTransactionReceipt(e).then(t=>{t&&this.emit(e,t)})};e(t),this._subscribe("tx",["newHeads"],t=>{this._events.filter(t=>"tx"===t.type).forEach(e)});break}}}_stopEvent(t){let e=t.tag;if("tx"===t.type){if(this._events.filter(t=>"tx"===t.type).length)return;e="tx"}else if(this.listenerCount(t.event))return;const r=this._subIds[e];r&&(delete this._subIds[e],r.then(t=>{this._subs[t]&&(delete this._subs[t],this.send("eth_unsubscribe",[t]))}))}destroy(){return Tu(this,void 0,void 0,function*(){this.websocket.readyState===xu.CONNECTING&&(yield new Promise(t=>{this.websocket.onopen=function(){t(!0)},this.websocket.onerror=function(){t(!1)}})),this.websocket.close(1e3)})}}var Pu=function(t,e,r,n){return new(r||(r=Promise))(function(i,o){function s(t){try{u(n.next(t))}catch(t){o(t)}}function a(t){try{u(n.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r(function(t){t(e)})).then(s,a)}u((n=n.apply(t,e||[])).next())})};const Iu=new yt(As);class Ou extends ku{detectNetwork(){const t=Object.create(null,{detectNetwork:{get:()=>super.detectNetwork}});return Pu(this,void 0,void 0,function*(){let e=this.network;return null==e&&(e=yield t.detectNetwork.call(this),e||Iu.throwError("no network detected",yt.errors.UNKNOWN_ERROR,{}),null==this._network&&(fe(this,"_network",e),this.emit("network",e,null))),e})}}class Cu extends Ou{constructor(t,e){Iu.checkAbstract(new.target,Cu),t=le(new.target,"getNetwork")(t),e=le(new.target,"getApiKey")(e);super(le(new.target,"getUrl")(t,e),t),"string"==typeof e?fe(this,"apiKey",e):null!=e&&Object.keys(e).forEach(t=>{fe(this,t,e[t])})}_startPending(){Iu.warn("WARNING: API provider does not support pending filters")}isCommunityResource(){return!1}getSigner(t){return Iu.throwError("API provider does not support signing",yt.errors.UNSUPPORTED_OPERATION,{operation:"getSigner"})}listAccounts(){return Promise.resolve([])}static getApiKey(t){return t}static getUrl(t,e){return Iu.throwError("not implemented; sub-classes must override getUrl",yt.errors.NOT_IMPLEMENTED,{operation:"getUrl"})}}const Lu=new yt(As),ju="_gg7wSSi0KMBsdKnGVfHDueq6xMB9EkC";class Du extends Nu{constructor(t,e){const r=new Uu(t,e);super(r.connection.url.replace(/^http/i,"ws").replace(".alchemyapi.",".ws.alchemyapi."),r.network),fe(this,"apiKey",r.apiKey)}isCommunityResource(){return this.apiKey===ju}}class Uu extends Cu{static getWebSocketProvider(t,e){return new Du(t,e)}static getApiKey(t){return null==t?ju:(t&&"string"!=typeof t&&Lu.throwArgumentError("invalid apiKey","apiKey",t),t)}static getUrl(t,e){let r=null;switch(t.name){case"homestead":r="eth-mainnet.alchemyapi.io/v2/";break;case"goerli":r="eth-goerli.g.alchemy.com/v2/";break;case"sepolia":r="eth-sepolia.g.alchemy.com/v2/";break;case"matic":r="polygon-mainnet.g.alchemy.com/v2/";break;case"maticmum":r="polygon-mumbai.g.alchemy.com/v2/";break;case"arbitrum":r="arb-mainnet.g.alchemy.com/v2/";break;case"arbitrum-goerli":r="arb-goerli.g.alchemy.com/v2/";break;case"arbitrum-sepolia":r="arb-sepolia.g.alchemy.com/v2/";break;case"optimism":r="opt-mainnet.g.alchemy.com/v2/";break;case"optimism-goerli":r="opt-goerli.g.alchemy.com/v2/";break;case"optimism-sepolia":r="opt-sepolia.g.alchemy.com/v2/";break;default:Lu.throwArgumentError("unsupported network","network",arguments[0])}return{allowGzip:!0,url:"https://"+r+e,throttleCallback:(t,r)=>(e===ju&&ja(),Promise.resolve(!0))}}isCommunityResource(){return this.apiKey===ju}}const Fu=new yt(As),zu="9f7d929b018cdffb338517efa06f58359e86ff1ffd350bc889738523659e7972";function qu(t){switch(t){case"homestead":return"rpc.ankr.com/eth/";case"ropsten":return"rpc.ankr.com/eth_ropsten/";case"rinkeby":return"rpc.ankr.com/eth_rinkeby/";case"goerli":return"rpc.ankr.com/eth_goerli/";case"sepolia":return"rpc.ankr.com/eth_sepolia/";case"matic":return"rpc.ankr.com/polygon/";case"maticmum":return"rpc.ankr.com/polygon_mumbai/";case"optimism":return"rpc.ankr.com/optimism/";case"optimism-goerli":return"rpc.ankr.com/optimism_testnet/";case"optimism-sepolia":return"rpc.ankr.com/optimism_sepolia/";case"arbitrum":return"rpc.ankr.com/arbitrum/"}return Fu.throwArgumentError("unsupported network","name",t)}class Hu extends Cu{isCommunityResource(){return this.apiKey===zu}static getApiKey(t){return null==t?zu:t}static getUrl(t,e){null==e&&(e=zu);const r={allowGzip:!0,url:"https://"+qu(t.name)+e,throttleCallback:(t,r)=>(e.apiKey===zu&&ja(),Promise.resolve(!0))};return null!=e.projectSecret&&(r.user="",r.password=e.projectSecret),r}}var Ku=function(t,e,r,n){return new(r||(r=Promise))(function(i,o){function s(t){try{u(n.next(t))}catch(t){o(t)}}function a(t){try{u(n.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r(function(t){t(e)})).then(s,a)}u((n=n.apply(t,e||[])).next())})};const Gu=new yt(As);class Vu extends Cu{static getApiKey(t){return null!=t&&Gu.throwArgumentError("apiKey not supported for cloudflare","apiKey",t),null}static getUrl(t,e){let r=null;if("homestead"===t.name)r="https://cloudflare-eth.com/";else Gu.throwArgumentError("unsupported network","network",arguments[0]);return r}perform(t,e){const r=Object.create(null,{perform:{get:()=>super.perform}});return Ku(this,void 0,void 0,function*(){if("getBlockNumber"===t){return(yield r.perform.call(this,"getBlock",{blockTag:"latest"})).number}return r.perform.call(this,t,e)})}}var Wu=function(t,e,r,n){return new(r||(r=Promise))(function(i,o){function s(t){try{u(n.next(t))}catch(t){o(t)}}function a(t){try{u(n.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r(function(t){t(e)})).then(s,a)}u((n=n.apply(t,e||[])).next())})};const Ju=new yt(As);function Zu(t){const e={};for(let r in t){if(null==t[r])continue;let n=t[r];"type"===r&&0===n||(n={type:!0,gasLimit:!0,gasPrice:!0,maxFeePerGs:!0,maxPriorityFeePerGas:!0,nonce:!0,value:!0}[r]?Ot(Bt(n)):"accessList"===r?"["+Sa(n).map(t=>`{address:"${t.address}",storageKeys:["${t.storageKeys.join('","')}"]}`).join(",")+"]":Bt(n),e[r]=n)}return e}function Yu(t){if(0==t.status&&("No records found"===t.message||"No transactions found"===t.message))return t.result;if(1!=t.status||"string"!=typeof t.message||!t.message.match(/^OK/)){const e=new Error("invalid response");throw e.result=JSON.stringify(t),(t.result||"").toLowerCase().indexOf("rate limit")>=0&&(e.throttleRetry=!0),e}return t.result}function Xu(t){if(t&&0==t.status&&"NOTOK"==t.message&&(t.result||"").toLowerCase().indexOf("rate limit")>=0){const e=new Error("throttled response");throw e.result=JSON.stringify(t),e.throttleRetry=!0,e}if("2.0"!=t.jsonrpc){const e=new Error("invalid response");throw e.result=JSON.stringify(t),e}if(t.error){const e=new Error(t.error.message||"unknown error");throw t.error.code&&(e.code=t.error.code),t.error.data&&(e.data=t.error.data),e}return t.result}function $u(t){if("pending"===t)throw new Error("pending not supported");return"latest"===t?t:parseInt(t.substring(2),16)}function Qu(t,e,r){if("call"===t&&e.code===yt.errors.SERVER_ERROR){const t=e.error;if(t&&(t.message.match(/reverted/i)||t.message.match(/VM execution error/i))){let r=t.data;if(r&&(r="0x"+r.replace(/^.*0x/i,"")),Tt(r))return r;Ju.throwError("missing revert data in call exception",yt.errors.CALL_EXCEPTION,{error:e,data:"0x"})}}let n=e.message;throw e.code===yt.errors.SERVER_ERROR&&(e.error&&"string"==typeof e.error.message?n=e.error.message:"string"==typeof e.body?n=e.body:"string"==typeof e.responseText&&(n=e.responseText)),n=(n||"").toLowerCase(),n.match(/insufficient funds/)&&Ju.throwError("insufficient funds for intrinsic transaction cost",yt.errors.INSUFFICIENT_FUNDS,{error:e,method:t,transaction:r}),n.match(/same hash was already imported|transaction nonce is too low|nonce too low/)&&Ju.throwError("nonce has already been used",yt.errors.NONCE_EXPIRED,{error:e,method:t,transaction:r}),n.match(/another transaction with same nonce/)&&Ju.throwError("replacement fee too low",yt.errors.REPLACEMENT_UNDERPRICED,{error:e,method:t,transaction:r}),n.match(/execution failed due to an exception|execution reverted/)&&Ju.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",yt.errors.UNPREDICTABLE_GAS_LIMIT,{error:e,method:t,transaction:r}),e}class th extends au{constructor(t,e){super(t),fe(this,"baseUrl",this.getBaseUrl()),fe(this,"apiKey",e||null)}getBaseUrl(){switch(this.network?this.network.name:"invalid"){case"homestead":return"https://api.etherscan.io";case"goerli":return"https://api-goerli.etherscan.io";case"sepolia":return"https://api-sepolia.etherscan.io";case"matic":return"https://api.polygonscan.com";case"maticmum":return"https://api-testnet.polygonscan.com";case"arbitrum":return"https://api.arbiscan.io";case"arbitrum-goerli":return"https://api-goerli.arbiscan.io";case"optimism":return"https://api-optimistic.etherscan.io";case"optimism-goerli":return"https://api-goerli-optimistic.etherscan.io"}return Ju.throwArgumentError("unsupported network","network",this.network.name)}getUrl(t,e){const r=Object.keys(e).reduce((t,r)=>{const n=e[r];return null!=n&&(t+=`&${r}=${n}`),t},""),n=this.apiKey?`&apikey=${this.apiKey}`:"";return`${this.baseUrl}/api?module=${t}${r}${n}`}getPostUrl(){return`${this.baseUrl}/api`}getPostData(t,e){return e.module=t,e.apikey=this.apiKey,e}fetch(t,e,r){return Wu(this,void 0,void 0,function*(){const n=r?this.getPostUrl():this.getUrl(t,e),i=r?this.getPostData(t,e):null,o="proxy"===t?Xu:Yu;this.emit("debug",{action:"request",request:n,provider:this});const s={url:n,throttleSlotInterval:1e3,throttleCallback:(t,e)=>(this.isCommunityResource()&&ja(),Promise.resolve(!0))};let a=null;i&&(s.headers={"content-type":"application/x-www-form-urlencoded; charset=UTF-8"},a=Object.keys(i).map(t=>`${t}=${i[t]}`).join("&"));const u=yield fs(s,a,o||Xu);return this.emit("debug",{action:"response",request:n,response:ve(u),provider:this}),u})}detectNetwork(){return Wu(this,void 0,void 0,function*(){return this.network})}perform(t,e){const r=Object.create(null,{perform:{get:()=>super.perform}});return Wu(this,void 0,void 0,function*(){switch(t){case"getBlockNumber":return this.fetch("proxy",{action:"eth_blockNumber"});case"getGasPrice":return this.fetch("proxy",{action:"eth_gasPrice"});case"getBalance":return this.fetch("account",{action:"balance",address:e.address,tag:e.blockTag});case"getTransactionCount":return this.fetch("proxy",{action:"eth_getTransactionCount",address:e.address,tag:e.blockTag});case"getCode":return this.fetch("proxy",{action:"eth_getCode",address:e.address,tag:e.blockTag});case"getStorageAt":return this.fetch("proxy",{action:"eth_getStorageAt",address:e.address,position:e.position,tag:e.blockTag});case"sendTransaction":return this.fetch("proxy",{action:"eth_sendRawTransaction",hex:e.signedTransaction},!0).catch(t=>Qu("sendTransaction",t,e.signedTransaction));case"getBlock":if(e.blockTag)return this.fetch("proxy",{action:"eth_getBlockByNumber",tag:e.blockTag,boolean:e.includeTransactions?"true":"false"});throw new Error("getBlock by blockHash not implemented");case"getTransaction":return this.fetch("proxy",{action:"eth_getTransactionByHash",txhash:e.transactionHash});case"getTransactionReceipt":return this.fetch("proxy",{action:"eth_getTransactionReceipt",txhash:e.transactionHash});case"call":{if("latest"!==e.blockTag)throw new Error("EtherscanProvider does not support blockTag for call");const t=Zu(e.transaction);t.module="proxy",t.action="eth_call";try{return yield this.fetch("proxy",t,!0)}catch(t){return Qu("call",t,e.transaction)}}case"estimateGas":{const t=Zu(e.transaction);t.module="proxy",t.action="eth_estimateGas";try{return yield this.fetch("proxy",t,!0)}catch(t){return Qu("estimateGas",t,e.transaction)}}case"getLogs":{const t={action:"getLogs"};if(e.filter.fromBlock&&(t.fromBlock=$u(e.filter.fromBlock)),e.filter.toBlock&&(t.toBlock=$u(e.filter.toBlock)),e.filter.address&&(t.address=e.filter.address),e.filter.topics&&e.filter.topics.length>0&&(e.filter.topics.length>1&&Ju.throwError("unsupported topic count",yt.errors.UNSUPPORTED_OPERATION,{topics:e.filter.topics}),1===e.filter.topics.length)){const r=e.filter.topics[0];"string"==typeof r&&66===r.length||Ju.throwError("unsupported topic format",yt.errors.UNSUPPORTED_OPERATION,{topic0:r}),t.topic0=r}const r=yield this.fetch("logs",t);let n={};for(let t=0;t<r.length;t++){const e=r[t];if(null==e.blockHash){if(null==n[e.blockNumber]){const t=yield this.getBlock(e.blockNumber);t&&(n[e.blockNumber]=t.hash)}e.blockHash=n[e.blockNumber]}}return r}case"getEtherPrice":return"homestead"!==this.network.name?0:parseFloat((yield this.fetch("stats",{action:"ethprice"})).ethusd)}return r.perform.call(this,t,e)})}getHistory(t,e,r){return Wu(this,void 0,void 0,function*(){const n={action:"txlist",address:yield this.resolveName(t),startblock:null==e?0:e,endblock:null==r?99999999:r,sort:"asc"};return(yield this.fetch("account",n)).map(t=>{["contractAddress","to"].forEach(function(e){""==t[e]&&delete t[e]}),null==t.creates&&null!=t.contractAddress&&(t.creates=t.contractAddress);const e=this.formatter.transactionResponse(t);return t.timeStamp&&(e.timestamp=parseInt(t.timeStamp)),e})})}isCommunityResource(){return null==this.apiKey}}const eh=new yt("random/5.8.0");const rh=function(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if(void 0!==o)return o;throw new Error("unable to locate global object")}();let nh=rh.crypto||rh.msCrypto;function ih(t){(t<=0||t>1024||t%1||t!=t)&&eh.throwArgumentError("invalid length","length",t);const e=new Uint8Array(t);return nh.getRandomValues(e),Mt(e)}function oh(t){for(let e=(t=t.slice()).length-1;e>0;e--){const r=Math.floor(Math.random()*(e+1)),n=t[e];t[e]=t[r],t[r]=n}return t}nh&&nh.getRandomValues||(eh.warn("WARNING: Missing strong random number source"),nh={getRandomValues:function(t){return eh.throwError("no secure random source avaialble",yt.errors.UNSUPPORTED_OPERATION,{operation:"crypto.getRandomValues"})}});var sh=function(t,e,r,n){return new(r||(r=Promise))(function(i,o){function s(t){try{u(n.next(t))}catch(t){o(t)}}function a(t){try{u(n.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r(function(t){t(e)})).then(s,a)}u((n=n.apply(t,e||[])).next())})};const ah=new yt(As);function uh(){return(new Date).getTime()}function hh(t){let e=null;for(let r=0;r<t.length;r++){const n=t[r];if(null==n)return null;e?e.name===n.name&&e.chainId===n.chainId&&(e.ensAddress===n.ensAddress||null==e.ensAddress&&null==n.ensAddress)||ah.throwArgumentError("provider mismatch","networks",t):e=n}return e}function ch(t,e){t=t.slice().sort();const r=Math.floor(t.length/2);if(t.length%2)return t[r];const n=t[r-1],i=t[r];return null!=e&&Math.abs(n-i)>e?null:(n+i)/2}function fh(t){if(null===t)return"null";if("number"==typeof t||"boolean"==typeof t)return JSON.stringify(t);if("string"==typeof t)return t;if(Gt.isBigNumber(t))return t.toString();if(Array.isArray(t))return JSON.stringify(t.map(t=>fh(t)));if("object"==typeof t){const e=Object.keys(t);return e.sort(),"{"+e.map(e=>{let r=t[e];return r="function"==typeof r?"[function]":fh(r),JSON.stringify(e)+":"+r}).join(",")+"}"}throw new Error("unknown value type: "+typeof t)}let lh=1;function dh(t){let e=null,r=null,n=new Promise(n=>{e=function(){r&&(clearTimeout(r),r=null),n()},r=setTimeout(e,t)});return{cancel:e,getPromise:function(){return n},wait:t=>(n=n.then(t),n)}}const ph=[yt.errors.CALL_EXCEPTION,yt.errors.INSUFFICIENT_FUNDS,yt.errors.NONCE_EXPIRED,yt.errors.REPLACEMENT_UNDERPRICED,yt.errors.UNPREDICTABLE_GAS_LIMIT],mh=["address","args","errorArgs","errorSignature","method","transaction"];function gh(t,e){const r={weight:t.weight};return Object.defineProperty(r,"provider",{get:()=>t.provider}),t.start&&(r.start=t.start),e&&(r.duration=e-t.start),t.done&&(t.error?r.error=t.error:r.result=t.result||null),r}function yh(t,e,r){let n=fh;switch(e){case"getBlockNumber":return function(e){const r=e.map(t=>t.result);let n=ch(e.map(t=>t.result),2);if(null!=n)return n=Math.ceil(n),r.indexOf(n+1)>=0&&n++,n>=t._highestBlockNumber&&(t._highestBlockNumber=n),t._highestBlockNumber};case"getGasPrice":return function(t){const e=t.map(t=>t.result);return e.sort(),e[Math.floor(e.length/2)]};case"getEtherPrice":return function(t){return ch(t.map(t=>t.result))};case"getBalance":case"getTransactionCount":case"getCode":case"getStorageAt":case"call":case"estimateGas":case"getLogs":break;case"getTransaction":case"getTransactionReceipt":n=function(t){return null==t?null:((t=me(t)).confirmations=-1,fh(t))};break;case"getBlock":n=r.includeTransactions?function(t){return null==t?null:((t=me(t)).transactions=t.transactions.map(t=>((t=me(t)).confirmations=-1,t)),fh(t))}:function(t){return null==t?null:fh(t)};break;default:throw new Error("unknown method: "+e)}return function(t,e){return function(r){const n={};r.forEach(e=>{const r=t(e.result);n[r]||(n[r]={count:0,result:e.result}),n[r].count++});const i=Object.keys(n);for(let t=0;t<i.length;t++){const r=n[i[t]];if(r.count>=e)return r.result}}}(n,t.quorum)}function bh(t,e){return sh(this,void 0,void 0,function*(){const r=t.provider;return null!=r.blockNumber&&r.blockNumber>=e||-1===e?r:ls(()=>new Promise((n,i)=>{setTimeout(function(){return r.blockNumber>=e?n(r):t.cancelled?n(null):n(void 0)},0)}),{oncePoll:r})})}function vh(t,e,r,n){return sh(this,void 0,void 0,function*(){let i=t.provider;switch(r){case"getBlockNumber":case"getGasPrice":return i[r]();case"getEtherPrice":if(i.getEtherPrice)return i.getEtherPrice();break;case"getBalance":case"getTransactionCount":case"getCode":return n.blockTag&&Tt(n.blockTag)&&(i=yield bh(t,e)),i[r](n.address,n.blockTag||"latest");case"getStorageAt":return n.blockTag&&Tt(n.blockTag)&&(i=yield bh(t,e)),i.getStorageAt(n.address,n.position,n.blockTag||"latest");case"getBlock":return n.blockTag&&Tt(n.blockTag)&&(i=yield bh(t,e)),i[n.includeTransactions?"getBlockWithTransactions":"getBlock"](n.blockTag||n.blockHash);case"call":case"estimateGas":return n.blockTag&&Tt(n.blockTag)&&(i=yield bh(t,e)),"call"===r&&n.blockTag?i[r](n.transaction,n.blockTag):i[r](n.transaction);case"getTransaction":case"getTransactionReceipt":return i[r](n.transactionHash);case"getLogs":{let r=n.filter;return(r.fromBlock&&Tt(r.fromBlock)||r.toBlock&&Tt(r.toBlock))&&(i=yield bh(t,e)),i.getLogs(r)}}return ah.throwError("unknown method error",yt.errors.UNKNOWN_ERROR,{method:r,params:n})})}class wh extends au{constructor(t,e){0===t.length&&ah.throwArgumentError("missing providers","providers",t);const r=t.map((t,e)=>{if(Me.isProvider(t)){const e=Ca(t)?2e3:750,r=1;return Object.freeze({provider:t,weight:1,stallTimeout:e,priority:r})}const r=me(t);null==r.priority&&(r.priority=1),null==r.stallTimeout&&(r.stallTimeout=Ca(t)?2e3:750),null==r.weight&&(r.weight=1);const n=r.weight;return(n%1||n>512||n<1)&&ah.throwArgumentError("invalid weight; must be integer in [1, 512]",`providers[${e}].weight`,n),Object.freeze(r)}),n=r.reduce((t,e)=>t+e.weight,0);null==e?e=n/2:e>n&&ah.throwArgumentError("quorum will always fail; larger than total weight","quorum",e);let i=hh(r.map(t=>t.provider.network));null==i&&(i=new Promise((t,e)=>{setTimeout(()=>{this.detectNetwork().then(t,e)},0)})),super(i),fe(this,"providerConfigs",Object.freeze(r)),fe(this,"quorum",e),this._highestBlockNumber=-1}detectNetwork(){return sh(this,void 0,void 0,function*(){return hh(yield Promise.all(this.providerConfigs.map(t=>t.provider.getNetwork())))})}perform(t,e){return sh(this,void 0,void 0,function*(){if("sendTransaction"===t){const t=yield Promise.all(this.providerConfigs.map(t=>t.provider.sendTransaction(e.signedTransaction).then(t=>t.hash,t=>t)));for(let e=0;e<t.length;e++){const r=t[e];if("string"==typeof r)return r}throw t[0]}-1===this._highestBlockNumber&&"getBlockNumber"!==t&&(yield this.getBlockNumber());const r=yh(this,t,e),n=oh(this.providerConfigs.map(me));n.sort((t,e)=>t.priority-e.priority);const i=this._highestBlockNumber;let o=0,s=!0;for(;;){const a=uh();let u=n.filter(t=>t.runner&&a-t.start<t.stallTimeout).reduce((t,e)=>t+e.weight,0);for(;u<this.quorum&&o<n.length;){const r=n[o++],s=lh++;r.start=uh(),r.staller=dh(r.stallTimeout),r.staller.wait(()=>{r.staller=null}),r.runner=vh(r,i,t,e).then(n=>{r.done=!0,r.result=n,this.listenerCount("debug")&&this.emit("debug",{action:"request",rid:s,backend:gh(r,uh()),request:{method:t,params:ve(e)},provider:this})},n=>{r.done=!0,r.error=n,this.listenerCount("debug")&&this.emit("debug",{action:"request",rid:s,backend:gh(r,uh()),request:{method:t,params:ve(e)},provider:this})}),this.listenerCount("debug")&&this.emit("debug",{action:"request",rid:s,backend:gh(r,null),request:{method:t,params:ve(e)},provider:this}),u+=r.weight}const h=[];n.forEach(t=>{!t.done&&t.runner&&(h.push(t.runner),t.staller&&h.push(t.staller.getPromise()))}),h.length&&(yield Promise.race(h));const c=n.filter(t=>t.done&&null==t.error);if(c.length>=this.quorum){const t=r(c);if(void 0!==t)return n.forEach(t=>{t.staller&&t.staller.cancel(),t.cancelled=!0}),t;s||(yield dh(100).getPromise()),s=!1}const f=n.reduce((t,e)=>{if(!e.done||null==e.error)return t;const r=e.error.code;return ph.indexOf(r)>=0&&(t[r]||(t[r]={error:e.error,weight:0}),t[r].weight+=e.weight),t},{});if(Object.keys(f).forEach(t=>{const e=f[t];if(e.weight<this.quorum)return;n.forEach(t=>{t.staller&&t.staller.cancel(),t.cancelled=!0});const r=e.error,i={};mh.forEach(t=>{null!=r[t]&&(i[t]=r[t])}),ah.throwError(r.reason||r.message,t,i)}),0===n.filter(t=>!t.done).length)break}return n.forEach(t=>{t.staller&&t.staller.cancel(),t.cancelled=!0}),ah.throwError("failed to meet quorum",yt.errors.SERVER_ERROR,{method:t,params:e,results:n.map(t=>gh(t)),provider:this})})}}const _h=new yt(As),Eh="84842078b09946638c03157f83405213";class Ah extends Nu{constructor(t,e){const r=new Mh(t,e),n=r.connection;n.password&&_h.throwError("INFURA WebSocket project secrets unsupported",yt.errors.UNSUPPORTED_OPERATION,{operation:"InfuraProvider.getWebSocketProvider()"});super(n.url.replace(/^http/i,"ws").replace("/v3/","/ws/v3/"),t),fe(this,"apiKey",r.projectId),fe(this,"projectId",r.projectId),fe(this,"projectSecret",r.projectSecret)}isCommunityResource(){return this.projectId===Eh}}class Mh extends Cu{static getWebSocketProvider(t,e){return new Ah(t,e)}static getApiKey(t){const e={apiKey:Eh,projectId:Eh,projectSecret:null};return null==t||("string"==typeof t?e.projectId=t:null!=t.projectSecret?(_h.assertArgument("string"==typeof t.projectId,"projectSecret requires a projectId","projectId",t.projectId),_h.assertArgument("string"==typeof t.projectSecret,"invalid projectSecret","projectSecret","[REDACTED]"),e.projectId=t.projectId,e.projectSecret=t.projectSecret):t.projectId&&(e.projectId=t.projectId),e.apiKey=e.projectId),e}static getUrl(t,e){let r=null;switch(t?t.name:"unknown"){case"homestead":r="mainnet.infura.io";break;case"goerli":r="goerli.infura.io";break;case"sepolia":r="sepolia.infura.io";break;case"matic":r="polygon-mainnet.infura.io";break;case"maticmum":r="polygon-mumbai.infura.io";break;case"optimism":r="optimism-mainnet.infura.io";break;case"optimism-goerli":r="optimism-goerli.infura.io";break;case"optimism-sepolia":r="optimism-sepolia.infura.io";break;case"arbitrum":r="arbitrum-mainnet.infura.io";break;case"arbitrum-goerli":r="arbitrum-goerli.infura.io";break;case"arbitrum-sepolia":r="arbitrum-sepolia.infura.io";break;default:_h.throwError("unsupported network",yt.errors.INVALID_ARGUMENT,{argument:"network",value:t})}const n={allowGzip:!0,url:"https://"+r+"/v3/"+e.projectId,throttleCallback:(t,r)=>(e.projectId===Eh&&ja(),Promise.resolve(!0))};return null!=e.projectSecret&&(n.user="",n.password=e.projectSecret),n}isCommunityResource(){return this.projectId===Eh}}const Sh=new yt(As);class kh extends Cu{static getApiKey(t){return t&&"string"!=typeof t&&Sh.throwArgumentError("invalid apiKey","apiKey",t),t||"ETHERS_JS_SHARED"}static getUrl(t,e){Sh.warn("NodeSmith will be discontinued on 2019-12-20; please migrate to another platform.");let r=null;switch(t.name){case"homestead":r="https://ethereum.api.nodesmith.io/v1/mainnet/jsonrpc";break;case"ropsten":r="https://ethereum.api.nodesmith.io/v1/ropsten/jsonrpc";break;case"rinkeby":r="https://ethereum.api.nodesmith.io/v1/rinkeby/jsonrpc";break;case"goerli":r="https://ethereum.api.nodesmith.io/v1/goerli/jsonrpc";break;case"kovan":r="https://ethereum.api.nodesmith.io/v1/kovan/jsonrpc";break;default:Sh.throwArgumentError("unsupported network","network",arguments[0])}return r+"?apiKey="+e}}const xh=new yt(As),Th="62e1ad51b37b8e00394bda3b";class Rh extends Cu{static getApiKey(t){const e={applicationId:null,loadBalancer:!0,applicationSecretKey:null};return null==t?e.applicationId=Th:"string"==typeof t?e.applicationId=t:null!=t.applicationSecretKey?(e.applicationId=t.applicationId,e.applicationSecretKey=t.applicationSecretKey):t.applicationId?e.applicationId=t.applicationId:xh.throwArgumentError("unsupported PocketProvider apiKey","apiKey",t),e}static getUrl(t,e){let r=null;switch(t?t.name:"unknown"){case"goerli":r="eth-goerli.gateway.pokt.network";break;case"homestead":r="eth-mainnet.gateway.pokt.network";break;case"kovan":r="poa-kovan.gateway.pokt.network";break;case"matic":r="poly-mainnet.gateway.pokt.network";break;case"maticmum":r="polygon-mumbai-rpc.gateway.pokt.network";break;case"rinkeby":r="eth-rinkeby.gateway.pokt.network";break;case"ropsten":r="eth-ropsten.gateway.pokt.network";break;default:xh.throwError("unsupported network",yt.errors.INVALID_ARGUMENT,{argument:"network",value:t})}const n={headers:{},url:`https://${r}/v1/lb/${e.applicationId}`};return null!=e.applicationSecretKey&&(n.user="",n.password=e.applicationSecretKey),n}isCommunityResource(){return this.applicationId===Th}}const Bh=new yt(As);class Nh extends Cu{static getApiKey(t){return t&&"string"!=typeof t&&Bh.throwArgumentError("invalid apiKey","apiKey",t),t||"919b412a057b5e9c9b6dce193c5a60242d6efadb"}static getUrl(t,e){let r=null;switch(t.name){case"homestead":r="ethers.quiknode.pro";break;case"goerli":r="ethers.ethereum-goerli.quiknode.pro";break;case"sepolia":r="ethers.ethereum-sepolia.quiknode.pro";break;case"holesky":r="ethers.ethereum-holesky.quiknode.pro";break;case"arbitrum":r="ethers.arbitrum-mainnet.quiknode.pro";break;case"arbitrum-goerli":r="ethers.arbitrum-goerli.quiknode.pro";break;case"arbitrum-sepolia":r="ethers.arbitrum-sepolia.quiknode.pro";break;case"base":r="ethers.base-mainnet.quiknode.pro";break;case"base-goerli":r="ethers.base-goerli.quiknode.pro";break;case"base-spolia":r="ethers.base-sepolia.quiknode.pro";break;case"bnb":r="ethers.bsc.quiknode.pro";break;case"bnbt":r="ethers.bsc-testnet.quiknode.pro";break;case"matic":r="ethers.matic.quiknode.pro";break;case"maticmum":r="ethers.matic-testnet.quiknode.pro";break;case"optimism":r="ethers.optimism.quiknode.pro";break;case"optimism-goerli":r="ethers.optimism-goerli.quiknode.pro";break;case"optimism-sepolia":r="ethers.optimism-sepolia.quiknode.pro";break;case"xdai":r="ethers.xdai.quiknode.pro";break;default:Bh.throwArgumentError("unsupported network","network",arguments[0])}return"https://"+r+"/"+e}}const Ph=new yt(As);let Ih=1;function Oh(t,e){const r="Web3LegacyFetcher";return function(t,n){const i={method:t,params:n,id:Ih++,jsonrpc:"2.0"};return new Promise((t,n)=>{this.emit("debug",{action:"request",fetcher:r,request:ve(i),provider:this}),e(i,(e,o)=>{if(e)return this.emit("debug",{action:"response",fetcher:r,error:e,request:i,provider:this}),n(e);if(this.emit("debug",{action:"response",fetcher:r,request:i,response:o,provider:this}),o.error){const t=new Error(o.error.message);return t.code=o.error.code,t.data=o.error.data,n(t)}t(o.result)})})}}class Ch extends ku{constructor(t,e){null==t&&Ph.throwArgumentError("missing provider","provider",t);let r=null,n=null,i=null;"function"==typeof t?(r="unknown:",n=t):(r=t.host||t.path||"",!r&&t.isMetaMask&&(r="metamask"),i=t,t.request?(""===r&&(r="eip-1193:"),n=function(t){return function(e,r){null==r&&(r=[]);const n={method:e,params:r};return this.emit("debug",{action:"request",fetcher:"Eip1193Fetcher",request:ve(n),provider:this}),t.request(n).then(t=>(this.emit("debug",{action:"response",fetcher:"Eip1193Fetcher",request:n,response:t,provider:this}),t),t=>{throw this.emit("debug",{action:"response",fetcher:"Eip1193Fetcher",request:n,error:t,provider:this}),t})}}(t)):t.sendAsync?n=Oh(0,t.sendAsync.bind(t)):t.send?n=Oh(0,t.send.bind(t)):Ph.throwArgumentError("unsupported provider","provider",t),r||(r="unknown:")),super(r,e),fe(this,"jsonRpcFetchFunc",n),fe(this,"provider",i)}send(t,e){return this.jsonRpcFetchFunc(t,e)}}const Lh=new yt(As);function jh(t,e){if(null==t&&(t="homestead"),"string"==typeof t){const e=t.match(/^(ws|http)s?:/i);if(e)switch(e[1].toLowerCase()){case"http":case"https":return new ku(t);case"ws":case"wss":return new Nu(t);default:Lh.throwArgumentError("unsupported URL scheme","network",t)}}const r=Pe(t);return r&&r._defaultProvider||Lh.throwError("unsupported getDefaultProvider network",yt.errors.NETWORK_ERROR,{operation:"getDefaultProvider",network:t}),r._defaultProvider({FallbackProvider:wh,AlchemyProvider:Uu,AnkrProvider:Hu,CloudflareProvider:Vu,EtherscanProvider:th,InfuraProvider:Mh,JsonRpcProvider:ku,NodesmithProvider:kh,PocketProvider:Rh,QuickNodeProvider:Nh,Web3Provider:Ch,IpcProvider:null},e)}var Dh,Uh=Object.freeze({__proto__:null,AlchemyProvider:Uu,AlchemyWebSocketProvider:Du,AnkrProvider:Hu,BaseProvider:au,CloudflareProvider:Vu,EtherscanProvider:th,FallbackProvider:wh,Formatter:Ia,InfuraProvider:Mh,InfuraWebSocketProvider:Ah,IpcProvider:null,JsonRpcBatchProvider:class extends ku{send(t,e){const r={method:t,params:e,id:this._nextId++,jsonrpc:"2.0"};null==this._pendingBatch&&(this._pendingBatch=[]);const n={request:r,resolve:null,reject:null},i=new Promise((t,e)=>{n.resolve=t,n.reject=e});return this._pendingBatch.push(n),this._pendingBatchAggregator||(this._pendingBatchAggregator=setTimeout(()=>{const t=this._pendingBatch;this._pendingBatch=null,this._pendingBatchAggregator=null;const e=t.map(t=>t.request);return this.emit("debug",{action:"requestBatch",request:ve(e),provider:this}),fs(this.connection,JSON.stringify(e)).then(r=>{this.emit("debug",{action:"response",request:e,response:r,provider:this}),t.forEach((t,e)=>{const n=r[e];if(n.error){const e=new Error(n.error.message);e.code=n.error.code,e.data=n.error.data,t.reject(e)}else t.resolve(n.result)})},r=>{this.emit("debug",{action:"response",error:r,request:e,provider:this}),t.forEach(t=>{t.reject(r)})})},10)),i}},JsonRpcProvider:ku,JsonRpcSigner:Au,NodesmithProvider:kh,PocketProvider:Rh,Provider:Me,QuickNodeProvider:Nh,Resolver:iu,StaticJsonRpcProvider:Ou,UrlJsonRpcProvider:Cu,Web3Provider:Ch,WebSocketProvider:Nu,getDefaultProvider:jh,getNetwork:Pe,isCommunityResourcable:Oa,isCommunityResource:Ca,showThrottleMessage:ja});t.BaseType=void 0,(Dh=t.BaseType||(t.BaseType={})).TypeModule="Module",Dh.TypeProcess="Process",Dh.TypeMessage="Message",Dh.TypeAssignment="Assignment",Dh.TypeSchedulerLocation="Scheduler-Location",Dh.TypeSchedulerTransfer="Scheduler-Transfer",Dh.TypeCheckpoint="Checkpoint";class Fh{}var zh={exports:{}},qh=function(t,e){return function(){for(var r=new Array(arguments.length),n=0;n<r.length;n++)r[n]=arguments[n];return t.apply(e,r)}},Hh=qh,Kh=Object.prototype.toString;function Gh(t){return"[object Array]"===Kh.call(t)}function Vh(t){return void 0===t}function Wh(t){return null!==t&&"object"==typeof t}function Jh(t){if("[object Object]"!==Kh.call(t))return!1;var e=Object.getPrototypeOf(t);return null===e||e===Object.prototype}function Zh(t){return"[object Function]"===Kh.call(t)}function Yh(t,e){if(null!=t)if("object"!=typeof t&&(t=[t]),Gh(t))for(var r=0,n=t.length;r<n;r++)e.call(null,t[r],r,t);else for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.call(null,t[i],i,t)}var Xh={isArray:Gh,isArrayBuffer:function(t){return"[object ArrayBuffer]"===Kh.call(t)},isBuffer:function(t){return null!==t&&!Vh(t)&&null!==t.constructor&&!Vh(t.constructor)&&"function"==typeof t.constructor.isBuffer&&t.constructor.isBuffer(t)},isFormData:function(t){return"undefined"!=typeof FormData&&t instanceof FormData},isArrayBufferView:function(t){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(t):t&&t.buffer&&t.buffer instanceof ArrayBuffer},isString:function(t){return"string"==typeof t},isNumber:function(t){return"number"==typeof t},isObject:Wh,isPlainObject:Jh,isUndefined:Vh,isDate:function(t){return"[object Date]"===Kh.call(t)},isFile:function(t){return"[object File]"===Kh.call(t)},isBlob:function(t){return"[object Blob]"===Kh.call(t)},isFunction:Zh,isStream:function(t){return Wh(t)&&Zh(t.pipe)},isURLSearchParams:function(t){return"undefined"!=typeof URLSearchParams&&t instanceof URLSearchParams},isStandardBrowserEnv:function(){return("undefined"==typeof navigator||"ReactNative"!==navigator.product&&"NativeScript"!==navigator.product&&"NS"!==navigator.product)&&("undefined"!=typeof window&&"undefined"!=typeof document)},forEach:Yh,merge:function t(){var e={};function r(r,n){Jh(e[n])&&Jh(r)?e[n]=t(e[n],r):Jh(r)?e[n]=t({},r):Gh(r)?e[n]=r.slice():e[n]=r}for(var n=0,i=arguments.length;n<i;n++)Yh(arguments[n],r);return e},extend:function(t,e,r){return Yh(e,function(e,n){t[n]=r&&"function"==typeof e?Hh(e,r):e}),t},trim:function(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")},stripBOM:function(t){return 65279===t.charCodeAt(0)&&(t=t.slice(1)),t}},$h=Xh;function Qh(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}var tc=function(t,e,r){if(!e)return t;var n;if(r)n=r(e);else if($h.isURLSearchParams(e))n=e.toString();else{var i=[];$h.forEach(e,function(t,e){null!=t&&($h.isArray(t)?e+="[]":t=[t],$h.forEach(t,function(t){$h.isDate(t)?t=t.toISOString():$h.isObject(t)&&(t=JSON.stringify(t)),i.push(Qh(e)+"="+Qh(t))}))}),n=i.join("&")}if(n){var o=t.indexOf("#");-1!==o&&(t=t.slice(0,o)),t+=(-1===t.indexOf("?")?"?":"&")+n}return t},ec=Xh;function rc(){this.handlers=[]}rc.prototype.use=function(t,e,r){return this.handlers.push({fulfilled:t,rejected:e,synchronous:!!r&&r.synchronous,runWhen:r?r.runWhen:null}),this.handlers.length-1},rc.prototype.eject=function(t){this.handlers[t]&&(this.handlers[t]=null)},rc.prototype.forEach=function(t){ec.forEach(this.handlers,function(e){null!==e&&t(e)})};var nc,ic,oc,sc,ac,uc,hc,cc,fc,lc,dc,pc,mc,gc,yc,bc,vc,wc,_c=rc,Ec=Xh,Ac=function(t,e,r,n,i){return t.config=e,r&&(t.code=r),t.request=n,t.response=i,t.isAxiosError=!0,t.toJSON=function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code}},t};function Mc(){if(ic)return nc;ic=1;var t=Ac;return nc=function(e,r,n,i,o){var s=new Error(e);return t(s,r,n,i,o)},nc}function Sc(){if(pc)return dc;pc=1;var t=cc?hc:(cc=1,hc=function(t){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(t)}),e=lc?fc:(lc=1,fc=function(t,e){return e?t.replace(/\/+$/,"")+"/"+e.replace(/^\/+/,""):t});return dc=function(r,n){return r&&!t(n)?e(r,n):n}}function kc(){if(wc)return vc;wc=1;var t=Xh,e=function(){if(sc)return oc;sc=1;var t=Mc();return oc=function(e,r,n){var i=n.config.validateStatus;n.status&&i&&!i(n.status)?r(t("Request failed with status code "+n.status,n.config,null,n.request,n)):e(n)},oc}(),r=function(){if(uc)return ac;uc=1;var t=Xh;return ac=t.isStandardBrowserEnv()?{write:function(e,r,n,i,o,s){var a=[];a.push(e+"="+encodeURIComponent(r)),t.isNumber(n)&&a.push("expires="+new Date(n).toGMTString()),t.isString(i)&&a.push("path="+i),t.isString(o)&&a.push("domain="+o),!0===s&&a.push("secure"),document.cookie=a.join("; ")},read:function(t){var e=document.cookie.match(new RegExp("(^|;\\s*)("+t+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove:function(t){this.write(t,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}},ac}(),n=tc,i=Sc(),o=function(){if(gc)return mc;gc=1;var t=Xh,e=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"];return mc=function(r){var n,i,o,s={};return r?(t.forEach(r.split("\n"),function(r){if(o=r.indexOf(":"),n=t.trim(r.substr(0,o)).toLowerCase(),i=t.trim(r.substr(o+1)),n){if(s[n]&&e.indexOf(n)>=0)return;s[n]="set-cookie"===n?(s[n]?s[n]:[]).concat([i]):s[n]?s[n]+", "+i:i}}),s):s},mc}(),s=function(){if(bc)return yc;bc=1;var t=Xh;return yc=t.isStandardBrowserEnv()?function(){var e,r=/(msie|trident)/i.test(navigator.userAgent),n=document.createElement("a");function i(t){var e=t;return r&&(n.setAttribute("href",e),e=n.href),n.setAttribute("href",e),{href:n.href,protocol:n.protocol?n.protocol.replace(/:$/,""):"",host:n.host,search:n.search?n.search.replace(/^\?/,""):"",hash:n.hash?n.hash.replace(/^#/,""):"",hostname:n.hostname,port:n.port,pathname:"/"===n.pathname.charAt(0)?n.pathname:"/"+n.pathname}}return e=i(window.location.href),function(r){var n=t.isString(r)?i(r):r;return n.protocol===e.protocol&&n.host===e.host}}():function(){return!0}}(),a=Mc();return vc=function(u){return new Promise(function(h,c){var f=u.data,l=u.headers,d=u.responseType;t.isFormData(f)&&delete l["Content-Type"];var p=new XMLHttpRequest;if(u.auth){var m=u.auth.username||"",g=u.auth.password?unescape(encodeURIComponent(u.auth.password)):"";l.Authorization="Basic "+btoa(m+":"+g)}var y=i(u.baseURL,u.url);function b(){if(p){var t="getAllResponseHeaders"in p?o(p.getAllResponseHeaders()):null,r={data:d&&"text"!==d&&"json"!==d?p.response:p.responseText,status:p.status,statusText:p.statusText,headers:t,config:u,request:p};e(h,c,r),p=null}}if(p.open(u.method.toUpperCase(),n(y,u.params,u.paramsSerializer),!0),p.timeout=u.timeout,"onloadend"in p?p.onloadend=b:p.onreadystatechange=function(){p&&4===p.readyState&&(0!==p.status||p.responseURL&&0===p.responseURL.indexOf("file:"))&&setTimeout(b)},p.onabort=function(){p&&(c(a("Request aborted",u,"ECONNABORTED",p)),p=null)},p.onerror=function(){c(a("Network Error",u,null,p)),p=null},p.ontimeout=function(){var t="timeout of "+u.timeout+"ms exceeded";u.timeoutErrorMessage&&(t=u.timeoutErrorMessage),c(a(t,u,u.transitional&&u.transitional.clarifyTimeoutError?"ETIMEDOUT":"ECONNABORTED",p)),p=null},t.isStandardBrowserEnv()){var v=(u.withCredentials||s(y))&&u.xsrfCookieName?r.read(u.xsrfCookieName):void 0;v&&(l[u.xsrfHeaderName]=v)}"setRequestHeader"in p&&t.forEach(l,function(t,e){void 0===f&&"content-type"===e.toLowerCase()?delete l[e]:p.setRequestHeader(e,t)}),t.isUndefined(u.withCredentials)||(p.withCredentials=!!u.withCredentials),d&&"json"!==d&&(p.responseType=u.responseType),"function"==typeof u.onDownloadProgress&&p.addEventListener("progress",u.onDownloadProgress),"function"==typeof u.onUploadProgress&&p.upload&&p.upload.addEventListener("progress",u.onUploadProgress),u.cancelToken&&u.cancelToken.promise.then(function(t){p&&(p.abort(),c(t),p=null)}),f||(f=null),p.send(f)})},vc}var xc=Xh,Tc=function(t,e){Ec.forEach(t,function(r,n){n!==e&&n.toUpperCase()===e.toUpperCase()&&(t[e]=r,delete t[n])})},Rc=Ac,Bc={"Content-Type":"application/x-www-form-urlencoded"};function Nc(t,e){!xc.isUndefined(t)&&xc.isUndefined(t["Content-Type"])&&(t["Content-Type"]=e)}var Pc,Ic={transitional:{silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},adapter:(("undefined"!=typeof XMLHttpRequest||void 0!==vr&&"[object process]"===Object.prototype.toString.call(vr))&&(Pc=kc()),Pc),transformRequest:[function(t,e){return Tc(e,"Accept"),Tc(e,"Content-Type"),xc.isFormData(t)||xc.isArrayBuffer(t)||xc.isBuffer(t)||xc.isStream(t)||xc.isFile(t)||xc.isBlob(t)?t:xc.isArrayBufferView(t)?t.buffer:xc.isURLSearchParams(t)?(Nc(e,"application/x-www-form-urlencoded;charset=utf-8"),t.toString()):xc.isObject(t)||e&&"application/json"===e["Content-Type"]?(Nc(e,"application/json"),function(t,e,r){if(xc.isString(t))try{return(e||JSON.parse)(t),xc.trim(t)}catch(t){if("SyntaxError"!==t.name)throw t}return(r||JSON.stringify)(t)}(t)):t}],transformResponse:[function(t){var e=this.transitional,r=e&&e.silentJSONParsing,n=e&&e.forcedJSONParsing,i=!r&&"json"===this.responseType;if(i||n&&xc.isString(t)&&t.length)try{return JSON.parse(t)}catch(t){if(i){if("SyntaxError"===t.name)throw Rc(t,this,"E_JSON_PARSE");throw t}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,validateStatus:function(t){return t>=200&&t<300}};Ic.headers={common:{Accept:"application/json, text/plain, */*"}},xc.forEach(["delete","get","head"],function(t){Ic.headers[t]={}}),xc.forEach(["post","put","patch"],function(t){Ic.headers[t]=xc.merge(Bc)});var Oc,Cc,Lc=Ic,jc=Xh,Dc=Lc;function Uc(){return Cc?Oc:(Cc=1,Oc=function(t){return!(!t||!t.__CANCEL__)})}var Fc=Xh,zc=function(t,e,r){var n=this||Dc;return jc.forEach(r,function(r){t=r.call(n,t,e)}),t},qc=Uc(),Hc=Lc;function Kc(t){t.cancelToken&&t.cancelToken.throwIfRequested()}var Gc=Xh,Vc=function(t,e){e=e||{};var r={},n=["url","method","data"],i=["headers","auth","proxy","params"],o=["baseURL","transformRequest","transformResponse","paramsSerializer","timeout","timeoutMessage","withCredentials","adapter","responseType","xsrfCookieName","xsrfHeaderName","onUploadProgress","onDownloadProgress","decompress","maxContentLength","maxBodyLength","maxRedirects","transport","httpAgent","httpsAgent","cancelToken","socketPath","responseEncoding"],s=["validateStatus"];function a(t,e){return Gc.isPlainObject(t)&&Gc.isPlainObject(e)?Gc.merge(t,e):Gc.isPlainObject(e)?Gc.merge({},e):Gc.isArray(e)?e.slice():e}function u(n){Gc.isUndefined(e[n])?Gc.isUndefined(t[n])||(r[n]=a(void 0,t[n])):r[n]=a(t[n],e[n])}Gc.forEach(n,function(t){Gc.isUndefined(e[t])||(r[t]=a(void 0,e[t]))}),Gc.forEach(i,u),Gc.forEach(o,function(n){Gc.isUndefined(e[n])?Gc.isUndefined(t[n])||(r[n]=a(void 0,t[n])):r[n]=a(void 0,e[n])}),Gc.forEach(s,function(n){n in e?r[n]=a(t[n],e[n]):n in t&&(r[n]=a(void 0,t[n]))});var h=n.concat(i).concat(o).concat(s),c=Object.keys(t).concat(Object.keys(e)).filter(function(t){return-1===h.indexOf(t)});return Gc.forEach(c,u),r},Wc={name:"axios",version:"0.21.4",description:"Promise based HTTP client for the browser and node.js",main:"index.js",scripts:{test:"grunt test",start:"node ./sandbox/server.js",build:"NODE_ENV=production grunt build",preversion:"npm test",version:"npm run build && grunt version && git add -A dist && git add CHANGELOG.md bower.json package.json",postversion:"git push && git push --tags",examples:"node ./examples/server.js",coveralls:"cat coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js",fix:"eslint --fix lib/**/*.js"},repository:{type:"git",url:"https://github.com/axios/axios.git"},keywords:["xhr","http","ajax","promise","node"],author:"Matt Zabriskie",license:"MIT",bugs:{url:"https://github.com/axios/axios/issues"},homepage:"https://axios-http.com",devDependencies:{coveralls:"^3.0.0","es6-promise":"^4.2.4",grunt:"^1.3.0","grunt-banner":"^0.6.0","grunt-cli":"^1.2.0","grunt-contrib-clean":"^1.1.0","grunt-contrib-watch":"^1.0.0","grunt-eslint":"^23.0.0","grunt-karma":"^4.0.0","grunt-mocha-test":"^0.13.3","grunt-ts":"^6.0.0-beta.19","grunt-webpack":"^4.0.2","istanbul-instrumenter-loader":"^1.0.0","jasmine-core":"^2.4.1",karma:"^6.3.2","karma-chrome-launcher":"^3.1.0","karma-firefox-launcher":"^2.1.0","karma-jasmine":"^1.1.1","karma-jasmine-ajax":"^0.1.13","karma-safari-launcher":"^1.0.0","karma-sauce-launcher":"^4.3.6","karma-sinon":"^1.0.5","karma-sourcemap-loader":"^0.3.8","karma-webpack":"^4.0.2","load-grunt-tasks":"^3.5.2",minimist:"^1.2.0",mocha:"^8.2.1",sinon:"^4.5.0","terser-webpack-plugin":"^4.2.3",typescript:"^4.0.5","url-search-params":"^0.10.0",webpack:"^4.44.2","webpack-dev-server":"^3.11.0"},browser:{"./lib/adapters/http.js":"./lib/adapters/xhr.js"},jsdelivr:"dist/axios.min.js",unpkg:"dist/axios.min.js",typings:"./index.d.ts",dependencies:{"follow-redirects":"^1.14.0"},bundlesize:[{path:"./dist/axios.min.js",threshold:"5kB"}]},Jc={};["object","boolean","number","function","string","symbol"].forEach(function(t,e){Jc[t]=function(r){return typeof r===t||"a"+(e<1?"n ":" ")+t}});var Zc={},Yc=Wc.version.split(".");function Xc(t,e){for(var r=e?e.split("."):Yc,n=t.split("."),i=0;i<3;i++){if(r[i]>n[i])return!0;if(r[i]<n[i])return!1}return!1}Jc.transitional=function(t,e,r){var n=e&&Xc(e);return function(i,o,s){if(!1===t)throw new Error(function(t,e){return"[Axios v"+Wc.version+"] Transitional option '"+t+"'"+e+(r?". "+r:"")}(o," has been removed in "+e));return n&&!Zc[o]&&(Zc[o]=!0),!t||t(i,o,s)}};var $c,Qc,tf,ef,rf,nf,of,sf,af={isOlderVersion:Xc,assertOptions:function(t,e,r){if("object"!=typeof t)throw new TypeError("options must be an object");for(var n=Object.keys(t),i=n.length;i-- >0;){var o=n[i],s=e[o];if(s){var a=t[o],u=void 0===a||s(a,o,t);if(!0!==u)throw new TypeError("option "+o+" must be "+u)}else if(!0!==r)throw Error("Unknown option "+o)}},validators:Jc},uf=Xh,hf=tc,cf=_c,ff=function(t){return Kc(t),t.headers=t.headers||{},t.data=zc.call(t,t.data,t.headers,t.transformRequest),t.headers=Fc.merge(t.headers.common||{},t.headers[t.method]||{},t.headers),Fc.forEach(["delete","get","head","post","put","patch","common"],function(e){delete t.headers[e]}),(t.adapter||Hc.adapter)(t).then(function(e){return Kc(t),e.data=zc.call(t,e.data,e.headers,t.transformResponse),e},function(e){return qc(e)||(Kc(t),e&&e.response&&(e.response.data=zc.call(t,e.response.data,e.response.headers,t.transformResponse))),Promise.reject(e)})},lf=Vc,df=af,pf=df.validators;function mf(t){this.defaults=t,this.interceptors={request:new cf,response:new cf}}function gf(){if(Qc)return $c;function t(t){this.message=t}return Qc=1,t.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},t.prototype.__CANCEL__=!0,$c=t}mf.prototype.request=function(t){"string"==typeof t?(t=arguments[1]||{}).url=arguments[0]:t=t||{},(t=lf(this.defaults,t)).method?t.method=t.method.toLowerCase():this.defaults.method?t.method=this.defaults.method.toLowerCase():t.method="get";var e=t.transitional;void 0!==e&&df.assertOptions(e,{silentJSONParsing:pf.transitional(pf.boolean,"1.0.0"),forcedJSONParsing:pf.transitional(pf.boolean,"1.0.0"),clarifyTimeoutError:pf.transitional(pf.boolean,"1.0.0")},!1);var r=[],n=!0;this.interceptors.request.forEach(function(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(n=n&&e.synchronous,r.unshift(e.fulfilled,e.rejected))});var i,o=[];if(this.interceptors.response.forEach(function(t){o.push(t.fulfilled,t.rejected)}),!n){var s=[ff,void 0];for(Array.prototype.unshift.apply(s,r),s=s.concat(o),i=Promise.resolve(t);s.length;)i=i.then(s.shift(),s.shift());return i}for(var a=t;r.length;){var u=r.shift(),h=r.shift();try{a=u(a)}catch(t){h(t);break}}try{i=ff(a)}catch(t){return Promise.reject(t)}for(;o.length;)i=i.then(o.shift(),o.shift());return i},mf.prototype.getUri=function(t){return t=lf(this.defaults,t),hf(t.url,t.params,t.paramsSerializer).replace(/^\?/,"")},uf.forEach(["delete","get","head","options"],function(t){mf.prototype[t]=function(e,r){return this.request(lf(r||{},{method:t,url:e,data:(r||{}).data}))}}),uf.forEach(["post","put","patch"],function(t){mf.prototype[t]=function(e,r,n){return this.request(lf(n||{},{method:t,url:e,data:r}))}});var yf=Xh,bf=qh,vf=mf,wf=Vc;function _f(t){var e=new vf(t),r=bf(vf.prototype.request,e);return yf.extend(r,vf.prototype,e),yf.extend(r,e),r}var Ef=_f(Lc);Ef.Axios=vf,Ef.create=function(t){return _f(wf(Ef.defaults,t))},Ef.Cancel=gf(),Ef.CancelToken=function(){if(ef)return tf;ef=1;var t=gf();function e(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");var r;this.promise=new Promise(function(t){r=t});var n=this;e(function(e){n.reason||(n.reason=new t(e),r(n.reason))})}return e.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},e.source=function(){var t;return{token:new e(function(e){t=e}),cancel:t}},tf=e}(),Ef.isCancel=Uc(),Ef.all=function(t){return Promise.all(t)},Ef.spread=nf?rf:(nf=1,rf=function(t){return function(e){return t.apply(null,e)}}),Ef.isAxiosError=sf?of:(sf=1,of=function(t){return"object"==typeof t&&!0===t.isAxiosError}),zh.exports=Ef,zh.exports.default=Ef;var Af=zh.exports,Mf=r(Af);var Sf=function(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)},kf=r(Sf),xf="object"==typeof e&&e&&e.Object===Object&&e,Tf="object"==typeof self&&self&&self.Object===Object&&self,Rf=(xf||Tf||Function("return this")()).Symbol,Bf=Rf,Nf=Object.prototype,Pf=Nf.hasOwnProperty,If=Nf.toString,Of=Bf?Bf.toStringTag:void 0;var Cf=function(t){var e=Pf.call(t,Of),r=t[Of];try{t[Of]=void 0;var n=!0}catch(t){}var i=If.call(t);return n&&(e?t[Of]=r:delete t[Of]),i},Lf=Object.prototype.toString;var jf=Cf,Df=function(t){return Lf.call(t)},Uf=Rf?Rf.toStringTag:void 0;var Ff=function(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":Uf&&Uf in Object(t)?jf(t):Df(t)},zf=Array.isArray;var qf=Ff,Hf=zf,Kf=function(t){return null!=t&&"object"==typeof t};var Gf=r(function(t){return"string"==typeof t||!Hf(t)&&Kf(t)&&"[object String]"==qf(t)}),Vf={},Wf=t=>encodeURIComponent(t).replace(/[!'()*]/g,t=>`%${t.charCodeAt(0).toString(16).toUpperCase()}`),Jf="%[a-f0-9]{2}",Zf=new RegExp("("+Jf+")|([^%]+?)","gi"),Yf=new RegExp("("+Jf+")+","gi");function Xf(t,e){try{return[decodeURIComponent(t.join(""))]}catch(t){}if(1===t.length)return t;e=e||1;var r=t.slice(0,e),n=t.slice(e);return Array.prototype.concat.call([],Xf(r),Xf(n))}function $f(t){try{return decodeURIComponent(t)}catch(n){for(var e=t.match(Zf)||[],r=1;r<e.length;r++)e=(t=Xf(e,r).join("")).match(Zf)||[];return t}}var Qf=function(t){if("string"!=typeof t)throw new TypeError("Expected `encodedURI` to be of type `string`, got `"+typeof t+"`");try{return t=t.replace(/\+/g," "),decodeURIComponent(t)}catch(e){return function(t){for(var e={"%FE%FF":"��","%FF%FE":"��"},r=Yf.exec(t);r;){try{e[r[0]]=decodeURIComponent(r[0])}catch(t){var n=$f(r[0]);n!==r[0]&&(e[r[0]]=n)}r=Yf.exec(t)}e["%C2"]="�";for(var i=Object.keys(e),o=0;o<i.length;o++){var s=i[o];t=t.replace(new RegExp(s,"g"),e[s])}return t}(t)}},tl=(t,e)=>{if("string"!=typeof t||"string"!=typeof e)throw new TypeError("Expected the arguments to be of type `string`");if(""===e)return[t];const r=t.indexOf(e);return-1===r?[t]:[t.slice(0,r),t.slice(r+e.length)]},el=function(t,e){for(var r={},n=Object.keys(t),i=Array.isArray(e),o=0;o<n.length;o++){var s=n[o],a=t[s];(i?-1!==e.indexOf(s):e(s,a,t))&&(r[s]=a)}return r};!function(t){const e=Wf,r=Qf,n=tl,i=el,o=Symbol("encodeFragmentIdentifier");function s(t){if("string"!=typeof t||1!==t.length)throw new TypeError("arrayFormatSeparator must be single character string")}function a(t,r){return r.encode?r.strict?e(t):encodeURIComponent(t):t}function u(t,e){return e.decode?r(t):t}function h(t){return Array.isArray(t)?t.sort():"object"==typeof t?h(Object.keys(t)).sort((t,e)=>Number(t)-Number(e)).map(e=>t[e]):t}function c(t){const e=t.indexOf("#");return-1!==e&&(t=t.slice(0,e)),t}function f(t){const e=(t=c(t)).indexOf("?");return-1===e?"":t.slice(e+1)}function l(t,e){return e.parseNumbers&&!Number.isNaN(Number(t))&&"string"==typeof t&&""!==t.trim()?t=Number(t):!e.parseBooleans||null===t||"true"!==t.toLowerCase()&&"false"!==t.toLowerCase()||(t="true"===t.toLowerCase()),t}function d(t,e){s((e=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},e)).arrayFormatSeparator);const r=function(t){let e;switch(t.arrayFormat){case"index":return(t,r,n)=>{e=/\[(\d*)\]$/.exec(t),t=t.replace(/\[\d*\]$/,""),e?(void 0===n[t]&&(n[t]={}),n[t][e[1]]=r):n[t]=r};case"bracket":return(t,r,n)=>{e=/(\[\])$/.exec(t),t=t.replace(/\[\]$/,""),e?void 0!==n[t]?n[t]=[].concat(n[t],r):n[t]=[r]:n[t]=r};case"colon-list-separator":return(t,r,n)=>{e=/(:list)$/.exec(t),t=t.replace(/:list$/,""),e?void 0!==n[t]?n[t]=[].concat(n[t],r):n[t]=[r]:n[t]=r};case"comma":case"separator":return(e,r,n)=>{const i="string"==typeof r&&r.includes(t.arrayFormatSeparator),o="string"==typeof r&&!i&&u(r,t).includes(t.arrayFormatSeparator);r=o?u(r,t):r;const s=i||o?r.split(t.arrayFormatSeparator).map(e=>u(e,t)):null===r?r:u(r,t);n[e]=s};case"bracket-separator":return(e,r,n)=>{const i=/(\[\])$/.test(e);if(e=e.replace(/\[\]$/,""),!i)return void(n[e]=r?u(r,t):r);const o=null===r?[]:r.split(t.arrayFormatSeparator).map(e=>u(e,t));void 0!==n[e]?n[e]=[].concat(n[e],o):n[e]=o};default:return(t,e,r)=>{void 0!==r[t]?r[t]=[].concat(r[t],e):r[t]=e}}}(e),i=Object.create(null);if("string"!=typeof t)return i;if(!(t=t.trim().replace(/^[?#&]/,"")))return i;for(const o of t.split("&")){if(""===o)continue;let[t,s]=n(e.decode?o.replace(/\+/g," "):o,"=");s=void 0===s?null:["comma","separator","bracket-separator"].includes(e.arrayFormat)?s:u(s,e),r(u(t,e),s,i)}for(const t of Object.keys(i)){const r=i[t];if("object"==typeof r&&null!==r)for(const t of Object.keys(r))r[t]=l(r[t],e);else i[t]=l(r,e)}return!1===e.sort?i:(!0===e.sort?Object.keys(i).sort():Object.keys(i).sort(e.sort)).reduce((t,e)=>{const r=i[e];return Boolean(r)&&"object"==typeof r&&!Array.isArray(r)?t[e]=h(r):t[e]=r,t},Object.create(null))}t.extract=f,t.parse=d,t.stringify=(t,e)=>{if(!t)return"";s((e=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},e)).arrayFormatSeparator);const r=r=>e.skipNull&&null==t[r]||e.skipEmptyString&&""===t[r],n=function(t){switch(t.arrayFormat){case"index":return e=>(r,n)=>{const i=r.length;return void 0===n||t.skipNull&&null===n||t.skipEmptyString&&""===n?r:null===n?[...r,[a(e,t),"[",i,"]"].join("")]:[...r,[a(e,t),"[",a(i,t),"]=",a(n,t)].join("")]};case"bracket":return e=>(r,n)=>void 0===n||t.skipNull&&null===n||t.skipEmptyString&&""===n?r:null===n?[...r,[a(e,t),"[]"].join("")]:[...r,[a(e,t),"[]=",a(n,t)].join("")];case"colon-list-separator":return e=>(r,n)=>void 0===n||t.skipNull&&null===n||t.skipEmptyString&&""===n?r:null===n?[...r,[a(e,t),":list="].join("")]:[...r,[a(e,t),":list=",a(n,t)].join("")];case"comma":case"separator":case"bracket-separator":{const e="bracket-separator"===t.arrayFormat?"[]=":"=";return r=>(n,i)=>void 0===i||t.skipNull&&null===i||t.skipEmptyString&&""===i?n:(i=null===i?"":i,0===n.length?[[a(r,t),e,a(i,t)].join("")]:[[n,a(i,t)].join(t.arrayFormatSeparator)])}default:return e=>(r,n)=>void 0===n||t.skipNull&&null===n||t.skipEmptyString&&""===n?r:null===n?[...r,a(e,t)]:[...r,[a(e,t),"=",a(n,t)].join("")]}}(e),i={};for(const e of Object.keys(t))r(e)||(i[e]=t[e]);const o=Object.keys(i);return!1!==e.sort&&o.sort(e.sort),o.map(r=>{const i=t[r];return void 0===i?"":null===i?a(r,e):Array.isArray(i)?0===i.length&&"bracket-separator"===e.arrayFormat?a(r,e)+"[]":i.reduce(n(r),[]).join("&"):a(r,e)+"="+a(i,e)}).filter(t=>t.length>0).join("&")},t.parseUrl=(t,e)=>{e=Object.assign({decode:!0},e);const[r,i]=n(t,"#");return Object.assign({url:r.split("?")[0]||"",query:d(f(t),e)},e&&e.parseFragmentIdentifier&&i?{fragmentIdentifier:u(i,e)}:{})},t.stringifyUrl=(e,r)=>{r=Object.assign({encode:!0,strict:!0,[o]:!0},r);const n=c(e.url).split("?")[0]||"",i=t.extract(e.url),s=t.parse(i,{sort:!1}),u=Object.assign(s,e.query);let h=t.stringify(u,r);h&&(h=`?${h}`);let f=function(t){let e="";const r=t.indexOf("#");return-1!==r&&(e=t.slice(r)),e}(e.url);return e.fragmentIdentifier&&(f=`#${r[o]?a(e.fragmentIdentifier,r):e.fragmentIdentifier}`),`${n}${h}${f}`},t.pick=(e,r,n)=>{n=Object.assign({parseFragmentIdentifier:!0,[o]:!1},n);const{url:s,query:a,fragmentIdentifier:u}=t.parseUrl(e,n);return t.stringifyUrl({url:s,query:i(a,r),fragmentIdentifier:u},n)},t.exclude=(e,r,n)=>{const i=Array.isArray(r)?t=>!r.includes(t):(t,e)=>!r(t,e);return t.pick(e,i,n)}}(Vf);var rl=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,nl=Math.ceil,il=Math.floor,ol="[BigNumber Error] ",sl=ol+"Number primitive has more than 15 significant digits: ",al=1e14,ul=14,hl=9007199254740991,cl=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],fl=1e7,ll=1e9;function dl(t){var e=0|t;return t>0||t===e?e:e-1}function pl(t){for(var e,r,n=1,i=t.length,o=t[0]+"";n<i;){for(e=t[n++]+"",r=ul-e.length;r--;e="0"+e);o+=e}for(i=o.length;48===o.charCodeAt(--i););return o.slice(0,i+1||1)}function ml(t,e){var r,n,i=t.c,o=e.c,s=t.s,a=e.s,u=t.e,h=e.e;if(!s||!a)return null;if(r=i&&!i[0],n=o&&!o[0],r||n)return r?n?0:-a:s;if(s!=a)return s;if(r=s<0,n=u==h,!i||!o)return n?0:!i^r?1:-1;if(!n)return u>h^r?1:-1;for(a=(u=i.length)<(h=o.length)?u:h,s=0;s<a;s++)if(i[s]!=o[s])return i[s]>o[s]^r?1:-1;return u==h?0:u>h^r?1:-1}function gl(t,e,r,n){if(t<e||t>r||t!==il(t))throw Error(ol+(n||"Argument")+("number"==typeof t?t<e||t>r?" out of range: ":" not an integer: ":" not a primitive number: ")+String(t))}function yl(t){var e=t.c.length-1;return dl(t.e/ul)==e&&t.c[e]%2!=0}function bl(t,e){return(t.length>1?t.charAt(0)+"."+t.slice(1):t)+(e<0?"e":"e+")+e}function vl(t,e,r){var n,i;if(e<0){for(i=r+".";++e;i+=r);t=i+t}else if(++e>(n=t.length)){for(i=r,e-=n;--e;i+=r);t+=i}else e<n&&(t=t.slice(0,e)+"."+t.slice(e));return t}var wl=function t(e){var r,n,i,o,s,a,u,h,c,f,l=k.prototype={constructor:k,toString:null,valueOf:null},d=new k(1),p=20,m=4,g=-7,y=21,b=-1e7,v=1e7,w=!1,_=1,E=0,A={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},M="0123456789abcdefghijklmnopqrstuvwxyz",S=!0;function k(t,e){var r,o,s,a,u,h,c,f,l=this;if(!(l instanceof k))return new k(t,e);if(null==e){if(t&&!0===t._isBigNumber)return l.s=t.s,void(!t.c||t.e>v?l.c=l.e=null:t.e<b?l.c=[l.e=0]:(l.e=t.e,l.c=t.c.slice()));if((h="number"==typeof t)&&0*t==0){if(l.s=1/t<0?(t=-t,-1):1,t===~~t){for(a=0,u=t;u>=10;u/=10,a++);return void(a>v?l.c=l.e=null:(l.e=a,l.c=[t]))}f=String(t)}else{if(!rl.test(f=String(t)))return i(l,f,h);l.s=45==f.charCodeAt(0)?(f=f.slice(1),-1):1}(a=f.indexOf("."))>-1&&(f=f.replace(".","")),(u=f.search(/e/i))>0?(a<0&&(a=u),a+=+f.slice(u+1),f=f.substring(0,u)):a<0&&(a=f.length)}else{if(gl(e,2,M.length,"Base"),10==e&&S)return B(l=new k(t),p+l.e+1,m);if(f=String(t),h="number"==typeof t){if(0*t!=0)return i(l,f,h,e);if(l.s=1/t<0?(f=f.slice(1),-1):1,k.DEBUG&&f.replace(/^0\.0*|\./,"").length>15)throw Error(sl+t)}else l.s=45===f.charCodeAt(0)?(f=f.slice(1),-1):1;for(r=M.slice(0,e),a=u=0,c=f.length;u<c;u++)if(r.indexOf(o=f.charAt(u))<0){if("."==o){if(u>a){a=c;continue}}else if(!s&&(f==f.toUpperCase()&&(f=f.toLowerCase())||f==f.toLowerCase()&&(f=f.toUpperCase()))){s=!0,u=-1,a=0;continue}return i(l,String(t),h,e)}h=!1,(a=(f=n(f,e,10,l.s)).indexOf("."))>-1?f=f.replace(".",""):a=f.length}for(u=0;48===f.charCodeAt(u);u++);for(c=f.length;48===f.charCodeAt(--c););if(f=f.slice(u,++c)){if(c-=u,h&&k.DEBUG&&c>15&&(t>hl||t!==il(t)))throw Error(sl+l.s*t);if((a=a-u-1)>v)l.c=l.e=null;else if(a<b)l.c=[l.e=0];else{if(l.e=a,l.c=[],u=(a+1)%ul,a<0&&(u+=ul),u<c){for(u&&l.c.push(+f.slice(0,u)),c-=ul;u<c;)l.c.push(+f.slice(u,u+=ul));u=ul-(f=f.slice(u)).length}else u-=c;for(;u--;f+="0");l.c.push(+f)}}else l.c=[l.e=0]}function x(t,e,r,n){var i,o,s,a,u;if(null==r?r=m:gl(r,0,8),!t.c)return t.toString();if(i=t.c[0],s=t.e,null==e)u=pl(t.c),u=1==n||2==n&&(s<=g||s>=y)?bl(u,s):vl(u,s,"0");else if(o=(t=B(new k(t),e,r)).e,a=(u=pl(t.c)).length,1==n||2==n&&(e<=o||o<=g)){for(;a<e;u+="0",a++);u=bl(u,o)}else if(e-=s+(2===n&&o>s),u=vl(u,o,"0"),o+1>a){if(--e>0)for(u+=".";e--;u+="0");}else if((e+=o-a)>0)for(o+1==a&&(u+=".");e--;u+="0");return t.s<0&&i?"-"+u:u}function T(t,e){for(var r,n,i=1,o=new k(t[0]);i<t.length;i++)(!(n=new k(t[i])).s||(r=ml(o,n))===e||0===r&&o.s===e)&&(o=n);return o}function R(t,e,r){for(var n=1,i=e.length;!e[--i];e.pop());for(i=e[0];i>=10;i/=10,n++);return(r=n+r*ul-1)>v?t.c=t.e=null:r<b?t.c=[t.e=0]:(t.e=r,t.c=e),t}function B(t,e,r,n){var i,o,s,a,u,h,c,f=t.c,l=cl;if(f){t:{for(i=1,a=f[0];a>=10;a/=10,i++);if((o=e-i)<0)o+=ul,s=e,u=f[h=0],c=il(u/l[i-s-1]%10);else if((h=nl((o+1)/ul))>=f.length){if(!n)break t;for(;f.length<=h;f.push(0));u=c=0,i=1,s=(o%=ul)-ul+1}else{for(u=a=f[h],i=1;a>=10;a/=10,i++);c=(s=(o%=ul)-ul+i)<0?0:il(u/l[i-s-1]%10)}if(n=n||e<0||null!=f[h+1]||(s<0?u:u%l[i-s-1]),n=r<4?(c||n)&&(0==r||r==(t.s<0?3:2)):c>5||5==c&&(4==r||n||6==r&&(o>0?s>0?u/l[i-s]:0:f[h-1])%10&1||r==(t.s<0?8:7)),e<1||!f[0])return f.length=0,n?(e-=t.e+1,f[0]=l[(ul-e%ul)%ul],t.e=-e||0):f[0]=t.e=0,t;if(0==o?(f.length=h,a=1,h--):(f.length=h+1,a=l[ul-o],f[h]=s>0?il(u/l[i-s]%l[s])*a:0),n)for(;;){if(0==h){for(o=1,s=f[0];s>=10;s/=10,o++);for(s=f[0]+=a,a=1;s>=10;s/=10,a++);o!=a&&(t.e++,f[0]==al&&(f[0]=1));break}if(f[h]+=a,f[h]!=al)break;f[h--]=0,a=1}for(o=f.length;0===f[--o];f.pop());}t.e>v?t.c=t.e=null:t.e<b&&(t.c=[t.e=0])}return t}function N(t){var e,r=t.e;return null===r?t.toString():(e=pl(t.c),e=r<=g||r>=y?bl(e,r):vl(e,r,"0"),t.s<0?"-"+e:e)}return k.clone=t,k.ROUND_UP=0,k.ROUND_DOWN=1,k.ROUND_CEIL=2,k.ROUND_FLOOR=3,k.ROUND_HALF_UP=4,k.ROUND_HALF_DOWN=5,k.ROUND_HALF_EVEN=6,k.ROUND_HALF_CEIL=7,k.ROUND_HALF_FLOOR=8,k.EUCLID=9,k.config=k.set=function(t){var e,r;if(null!=t){if("object"!=typeof t)throw Error(ol+"Object expected: "+t);if(t.hasOwnProperty(e="DECIMAL_PLACES")&&(gl(r=t[e],0,ll,e),p=r),t.hasOwnProperty(e="ROUNDING_MODE")&&(gl(r=t[e],0,8,e),m=r),t.hasOwnProperty(e="EXPONENTIAL_AT")&&((r=t[e])&&r.pop?(gl(r[0],-ll,0,e),gl(r[1],0,ll,e),g=r[0],y=r[1]):(gl(r,-ll,ll,e),g=-(y=r<0?-r:r))),t.hasOwnProperty(e="RANGE"))if((r=t[e])&&r.pop)gl(r[0],-ll,-1,e),gl(r[1],1,ll,e),b=r[0],v=r[1];else{if(gl(r,-ll,ll,e),!r)throw Error(ol+e+" cannot be zero: "+r);b=-(v=r<0?-r:r)}if(t.hasOwnProperty(e="CRYPTO")){if((r=t[e])!==!!r)throw Error(ol+e+" not true or false: "+r);if(r){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw w=!r,Error(ol+"crypto unavailable");w=r}else w=r}if(t.hasOwnProperty(e="MODULO_MODE")&&(gl(r=t[e],0,9,e),_=r),t.hasOwnProperty(e="POW_PRECISION")&&(gl(r=t[e],0,ll,e),E=r),t.hasOwnProperty(e="FORMAT")){if("object"!=typeof(r=t[e]))throw Error(ol+e+" not an object: "+r);A=r}if(t.hasOwnProperty(e="ALPHABET")){if("string"!=typeof(r=t[e])||/^.?$|[+\-.\s]|(.).*\1/.test(r))throw Error(ol+e+" invalid: "+r);S="0123456789"==r.slice(0,10),M=r}}return{DECIMAL_PLACES:p,ROUNDING_MODE:m,EXPONENTIAL_AT:[g,y],RANGE:[b,v],CRYPTO:w,MODULO_MODE:_,POW_PRECISION:E,FORMAT:A,ALPHABET:M}},k.isBigNumber=function(t){if(!t||!0!==t._isBigNumber)return!1;if(!k.DEBUG)return!0;var e,r,n=t.c,i=t.e,o=t.s;t:if("[object Array]"=={}.toString.call(n)){if((1===o||-1===o)&&i>=-ll&&i<=ll&&i===il(i)){if(0===n[0]){if(0===i&&1===n.length)return!0;break t}if((e=(i+1)%ul)<1&&(e+=ul),String(n[0]).length==e){for(e=0;e<n.length;e++)if((r=n[e])<0||r>=al||r!==il(r))break t;if(0!==r)return!0}}}else if(null===n&&null===i&&(null===o||1===o||-1===o))return!0;throw Error(ol+"Invalid BigNumber: "+t)},k.maximum=k.max=function(){return T(arguments,-1)},k.minimum=k.min=function(){return T(arguments,1)},k.random=(o=9007199254740992,s=Math.random()*o&2097151?function(){return il(Math.random()*o)}:function(){return 8388608*(1073741824*Math.random()|0)+(8388608*Math.random()|0)},function(t){var e,r,n,i,o,a=0,u=[],h=new k(d);if(null==t?t=p:gl(t,0,ll),i=nl(t/ul),w)if(crypto.getRandomValues){for(e=crypto.getRandomValues(new Uint32Array(i*=2));a<i;)(o=131072*e[a]+(e[a+1]>>>11))>=9e15?(r=crypto.getRandomValues(new Uint32Array(2)),e[a]=r[0],e[a+1]=r[1]):(u.push(o%1e14),a+=2);a=i/2}else{if(!crypto.randomBytes)throw w=!1,Error(ol+"crypto unavailable");for(e=crypto.randomBytes(i*=7);a<i;)(o=281474976710656*(31&e[a])+1099511627776*e[a+1]+4294967296*e[a+2]+16777216*e[a+3]+(e[a+4]<<16)+(e[a+5]<<8)+e[a+6])>=9e15?crypto.randomBytes(7).copy(e,a):(u.push(o%1e14),a+=7);a=i/7}if(!w)for(;a<i;)(o=s())<9e15&&(u[a++]=o%1e14);for(i=u[--a],t%=ul,i&&t&&(o=cl[ul-t],u[a]=il(i/o)*o);0===u[a];u.pop(),a--);if(a<0)u=[n=0];else{for(n=-1;0===u[0];u.splice(0,1),n-=ul);for(a=1,o=u[0];o>=10;o/=10,a++);a<ul&&(n-=ul-a)}return h.e=n,h.c=u,h}),k.sum=function(){for(var t=1,e=arguments,r=new k(e[0]);t<e.length;)r=r.plus(e[t++]);return r},n=function(){var t="0123456789";function e(t,e,r,n){for(var i,o,s=[0],a=0,u=t.length;a<u;){for(o=s.length;o--;s[o]*=e);for(s[0]+=n.indexOf(t.charAt(a++)),i=0;i<s.length;i++)s[i]>r-1&&(null==s[i+1]&&(s[i+1]=0),s[i+1]+=s[i]/r|0,s[i]%=r)}return s.reverse()}return function(n,i,o,s,a){var u,h,c,f,l,d,g,y,b=n.indexOf("."),v=p,w=m;for(b>=0&&(f=E,E=0,n=n.replace(".",""),d=(y=new k(i)).pow(n.length-b),E=f,y.c=e(vl(pl(d.c),d.e,"0"),10,o,t),y.e=y.c.length),c=f=(g=e(n,i,o,a?(u=M,t):(u=t,M))).length;0==g[--f];g.pop());if(!g[0])return u.charAt(0);if(b<0?--c:(d.c=g,d.e=c,d.s=s,g=(d=r(d,y,v,w,o)).c,l=d.r,c=d.e),b=g[h=c+v+1],f=o/2,l=l||h<0||null!=g[h+1],l=w<4?(null!=b||l)&&(0==w||w==(d.s<0?3:2)):b>f||b==f&&(4==w||l||6==w&&1&g[h-1]||w==(d.s<0?8:7)),h<1||!g[0])n=l?vl(u.charAt(1),-v,u.charAt(0)):u.charAt(0);else{if(g.length=h,l)for(--o;++g[--h]>o;)g[h]=0,h||(++c,g=[1].concat(g));for(f=g.length;!g[--f];);for(b=0,n="";b<=f;n+=u.charAt(g[b++]));n=vl(n,c,u.charAt(0))}return n}}(),r=function(){function t(t,e,r){var n,i,o,s,a=0,u=t.length,h=e%fl,c=e/fl|0;for(t=t.slice();u--;)a=((i=h*(o=t[u]%fl)+(n=c*o+(s=t[u]/fl|0)*h)%fl*fl+a)/r|0)+(n/fl|0)+c*s,t[u]=i%r;return a&&(t=[a].concat(t)),t}function e(t,e,r,n){var i,o;if(r!=n)o=r>n?1:-1;else for(i=o=0;i<r;i++)if(t[i]!=e[i]){o=t[i]>e[i]?1:-1;break}return o}function r(t,e,r,n){for(var i=0;r--;)t[r]-=i,i=t[r]<e[r]?1:0,t[r]=i*n+t[r]-e[r];for(;!t[0]&&t.length>1;t.splice(0,1));}return function(n,i,o,s,a){var u,h,c,f,l,d,p,m,g,y,b,v,w,_,E,A,M,S=n.s==i.s?1:-1,x=n.c,T=i.c;if(!(x&&x[0]&&T&&T[0]))return new k(n.s&&i.s&&(x?!T||x[0]!=T[0]:T)?x&&0==x[0]||!T?0*S:S/0:NaN);for(g=(m=new k(S)).c=[],S=o+(h=n.e-i.e)+1,a||(a=al,h=dl(n.e/ul)-dl(i.e/ul),S=S/ul|0),c=0;T[c]==(x[c]||0);c++);if(T[c]>(x[c]||0)&&h--,S<0)g.push(1),f=!0;else{for(_=x.length,A=T.length,c=0,S+=2,(l=il(a/(T[0]+1)))>1&&(T=t(T,l,a),x=t(x,l,a),A=T.length,_=x.length),w=A,b=(y=x.slice(0,A)).length;b<A;y[b++]=0);M=T.slice(),M=[0].concat(M),E=T[0],T[1]>=a/2&&E++;do{if(l=0,(u=e(T,y,A,b))<0){if(v=y[0],A!=b&&(v=v*a+(y[1]||0)),(l=il(v/E))>1)for(l>=a&&(l=a-1),p=(d=t(T,l,a)).length,b=y.length;1==e(d,y,p,b);)l--,r(d,A<p?M:T,p,a),p=d.length,u=1;else 0==l&&(u=l=1),p=(d=T.slice()).length;if(p<b&&(d=[0].concat(d)),r(y,d,b,a),b=y.length,-1==u)for(;e(T,y,A,b)<1;)l++,r(y,A<b?M:T,b,a),b=y.length}else 0===u&&(l++,y=[0]);g[c++]=l,y[0]?y[b++]=x[w]||0:(y=[x[w]],b=1)}while((w++<_||null!=y[0])&&S--);f=null!=y[0],g[0]||g.splice(0,1)}if(a==al){for(c=1,S=g[0];S>=10;S/=10,c++);B(m,o+(m.e=c+h*ul-1)+1,s,f)}else m.e=h,m.r=+f;return m}}(),a=/^(-?)0([xbo])(?=\w[\w.]*$)/i,u=/^([^.]+)\.$/,h=/^\.([^.]+)$/,c=/^-?(Infinity|NaN)$/,f=/^\s*\+(?=[\w.])|^\s+|\s+$/g,i=function(t,e,r,n){var i,o=r?e:e.replace(f,"");if(c.test(o))t.s=isNaN(o)?null:o<0?-1:1;else{if(!r&&(o=o.replace(a,function(t,e,r){return i="x"==(r=r.toLowerCase())?16:"b"==r?2:8,n&&n!=i?t:e}),n&&(i=n,o=o.replace(u,"$1").replace(h,"0.$1")),e!=o))return new k(o,i);if(k.DEBUG)throw Error(ol+"Not a"+(n?" base "+n:"")+" number: "+e);t.s=null}t.c=t.e=null},l.absoluteValue=l.abs=function(){var t=new k(this);return t.s<0&&(t.s=1),t},l.comparedTo=function(t,e){return ml(this,new k(t,e))},l.decimalPlaces=l.dp=function(t,e){var r,n,i,o=this;if(null!=t)return gl(t,0,ll),null==e?e=m:gl(e,0,8),B(new k(o),t+o.e+1,e);if(!(r=o.c))return null;if(n=((i=r.length-1)-dl(this.e/ul))*ul,i=r[i])for(;i%10==0;i/=10,n--);return n<0&&(n=0),n},l.dividedBy=l.div=function(t,e){return r(this,new k(t,e),p,m)},l.dividedToIntegerBy=l.idiv=function(t,e){return r(this,new k(t,e),0,1)},l.exponentiatedBy=l.pow=function(t,e){var r,n,i,o,s,a,u,h,c=this;if((t=new k(t)).c&&!t.isInteger())throw Error(ol+"Exponent not an integer: "+N(t));if(null!=e&&(e=new k(e)),s=t.e>14,!c.c||!c.c[0]||1==c.c[0]&&!c.e&&1==c.c.length||!t.c||!t.c[0])return h=new k(Math.pow(+N(c),s?t.s*(2-yl(t)):+N(t))),e?h.mod(e):h;if(a=t.s<0,e){if(e.c?!e.c[0]:!e.s)return new k(NaN);(n=!a&&c.isInteger()&&e.isInteger())&&(c=c.mod(e))}else{if(t.e>9&&(c.e>0||c.e<-1||(0==c.e?c.c[0]>1||s&&c.c[1]>=24e7:c.c[0]<8e13||s&&c.c[0]<=9999975e7)))return o=c.s<0&&yl(t)?-0:0,c.e>-1&&(o=1/o),new k(a?1/o:o);E&&(o=nl(E/ul+2))}for(s?(r=new k(.5),a&&(t.s=1),u=yl(t)):u=(i=Math.abs(+N(t)))%2,h=new k(d);;){if(u){if(!(h=h.times(c)).c)break;o?h.c.length>o&&(h.c.length=o):n&&(h=h.mod(e))}if(i){if(0===(i=il(i/2)))break;u=i%2}else if(B(t=t.times(r),t.e+1,1),t.e>14)u=yl(t);else{if(0===(i=+N(t)))break;u=i%2}c=c.times(c),o?c.c&&c.c.length>o&&(c.c.length=o):n&&(c=c.mod(e))}return n?h:(a&&(h=d.div(h)),e?h.mod(e):o?B(h,E,m,undefined):h)},l.integerValue=function(t){var e=new k(this);return null==t?t=m:gl(t,0,8),B(e,e.e+1,t)},l.isEqualTo=l.eq=function(t,e){return 0===ml(this,new k(t,e))},l.isFinite=function(){return!!this.c},l.isGreaterThan=l.gt=function(t,e){return ml(this,new k(t,e))>0},l.isGreaterThanOrEqualTo=l.gte=function(t,e){return 1===(e=ml(this,new k(t,e)))||0===e},l.isInteger=function(){return!!this.c&&dl(this.e/ul)>this.c.length-2},l.isLessThan=l.lt=function(t,e){return ml(this,new k(t,e))<0},l.isLessThanOrEqualTo=l.lte=function(t,e){return-1===(e=ml(this,new k(t,e)))||0===e},l.isNaN=function(){return!this.s},l.isNegative=function(){return this.s<0},l.isPositive=function(){return this.s>0},l.isZero=function(){return!!this.c&&0==this.c[0]},l.minus=function(t,e){var r,n,i,o,s=this,a=s.s;if(e=(t=new k(t,e)).s,!a||!e)return new k(NaN);if(a!=e)return t.s=-e,s.plus(t);var u=s.e/ul,h=t.e/ul,c=s.c,f=t.c;if(!u||!h){if(!c||!f)return c?(t.s=-e,t):new k(f?s:NaN);if(!c[0]||!f[0])return f[0]?(t.s=-e,t):new k(c[0]?s:3==m?-0:0)}if(u=dl(u),h=dl(h),c=c.slice(),a=u-h){for((o=a<0)?(a=-a,i=c):(h=u,i=f),i.reverse(),e=a;e--;i.push(0));i.reverse()}else for(n=(o=(a=c.length)<(e=f.length))?a:e,a=e=0;e<n;e++)if(c[e]!=f[e]){o=c[e]<f[e];break}if(o&&(i=c,c=f,f=i,t.s=-t.s),(e=(n=f.length)-(r=c.length))>0)for(;e--;c[r++]=0);for(e=al-1;n>a;){if(c[--n]<f[n]){for(r=n;r&&!c[--r];c[r]=e);--c[r],c[n]+=al}c[n]-=f[n]}for(;0==c[0];c.splice(0,1),--h);return c[0]?R(t,c,h):(t.s=3==m?-1:1,t.c=[t.e=0],t)},l.modulo=l.mod=function(t,e){var n,i,o=this;return t=new k(t,e),!o.c||!t.s||t.c&&!t.c[0]?new k(NaN):!t.c||o.c&&!o.c[0]?new k(o):(9==_?(i=t.s,t.s=1,n=r(o,t,0,3),t.s=i,n.s*=i):n=r(o,t,0,_),(t=o.minus(n.times(t))).c[0]||1!=_||(t.s=o.s),t)},l.multipliedBy=l.times=function(t,e){var r,n,i,o,s,a,u,h,c,f,l,d,p,m,g,y=this,b=y.c,v=(t=new k(t,e)).c;if(!(b&&v&&b[0]&&v[0]))return!y.s||!t.s||b&&!b[0]&&!v||v&&!v[0]&&!b?t.c=t.e=t.s=null:(t.s*=y.s,b&&v?(t.c=[0],t.e=0):t.c=t.e=null),t;for(n=dl(y.e/ul)+dl(t.e/ul),t.s*=y.s,(u=b.length)<(f=v.length)&&(p=b,b=v,v=p,i=u,u=f,f=i),i=u+f,p=[];i--;p.push(0));for(m=al,g=fl,i=f;--i>=0;){for(r=0,l=v[i]%g,d=v[i]/g|0,o=i+(s=u);o>i;)r=((h=l*(h=b[--s]%g)+(a=d*h+(c=b[s]/g|0)*l)%g*g+p[o]+r)/m|0)+(a/g|0)+d*c,p[o--]=h%m;p[o]=r}return r?++n:p.splice(0,1),R(t,p,n)},l.negated=function(){var t=new k(this);return t.s=-t.s||null,t},l.plus=function(t,e){var r,n=this,i=n.s;if(e=(t=new k(t,e)).s,!i||!e)return new k(NaN);if(i!=e)return t.s=-e,n.minus(t);var o=n.e/ul,s=t.e/ul,a=n.c,u=t.c;if(!o||!s){if(!a||!u)return new k(i/0);if(!a[0]||!u[0])return u[0]?t:new k(a[0]?n:0*i)}if(o=dl(o),s=dl(s),a=a.slice(),i=o-s){for(i>0?(s=o,r=u):(i=-i,r=a),r.reverse();i--;r.push(0));r.reverse()}for((i=a.length)-(e=u.length)<0&&(r=u,u=a,a=r,e=i),i=0;e;)i=(a[--e]=a[e]+u[e]+i)/al|0,a[e]=al===a[e]?0:a[e]%al;return i&&(a=[i].concat(a),++s),R(t,a,s)},l.precision=l.sd=function(t,e){var r,n,i,o=this;if(null!=t&&t!==!!t)return gl(t,1,ll),null==e?e=m:gl(e,0,8),B(new k(o),t,e);if(!(r=o.c))return null;if(n=(i=r.length-1)*ul+1,i=r[i]){for(;i%10==0;i/=10,n--);for(i=r[0];i>=10;i/=10,n++);}return t&&o.e+1>n&&(n=o.e+1),n},l.shiftedBy=function(t){return gl(t,-9007199254740991,hl),this.times("1e"+t)},l.squareRoot=l.sqrt=function(){var t,e,n,i,o,s=this,a=s.c,u=s.s,h=s.e,c=p+4,f=new k("0.5");if(1!==u||!a||!a[0])return new k(!u||u<0&&(!a||a[0])?NaN:a?s:1/0);if(0==(u=Math.sqrt(+N(s)))||u==1/0?(((e=pl(a)).length+h)%2==0&&(e+="0"),u=Math.sqrt(+e),h=dl((h+1)/2)-(h<0||h%2),n=new k(e=u==1/0?"5e"+h:(e=u.toExponential()).slice(0,e.indexOf("e")+1)+h)):n=new k(u+""),n.c[0])for((u=(h=n.e)+c)<3&&(u=0);;)if(o=n,n=f.times(o.plus(r(s,o,c,1))),pl(o.c).slice(0,u)===(e=pl(n.c)).slice(0,u)){if(n.e<h&&--u,"9999"!=(e=e.slice(u-3,u+1))&&(i||"4999"!=e)){+e&&(+e.slice(1)||"5"!=e.charAt(0))||(B(n,n.e+p+2,1),t=!n.times(n).eq(s));break}if(!i&&(B(o,o.e+p+2,0),o.times(o).eq(s))){n=o;break}c+=4,u+=4,i=1}return B(n,n.e+p+1,m,t)},l.toExponential=function(t,e){return null!=t&&(gl(t,0,ll),t++),x(this,t,e,1)},l.toFixed=function(t,e){return null!=t&&(gl(t,0,ll),t=t+this.e+1),x(this,t,e)},l.toFormat=function(t,e,r){var n,i=this;if(null==r)null!=t&&e&&"object"==typeof e?(r=e,e=null):t&&"object"==typeof t?(r=t,t=e=null):r=A;else if("object"!=typeof r)throw Error(ol+"Argument not an object: "+r);if(n=i.toFixed(t,e),i.c){var o,s=n.split("."),a=+r.groupSize,u=+r.secondaryGroupSize,h=r.groupSeparator||"",c=s[0],f=s[1],l=i.s<0,d=l?c.slice(1):c,p=d.length;if(u&&(o=a,a=u,u=o,p-=o),a>0&&p>0){for(o=p%a||a,c=d.substr(0,o);o<p;o+=a)c+=h+d.substr(o,a);u>0&&(c+=h+d.slice(o)),l&&(c="-"+c)}n=f?c+(r.decimalSeparator||"")+((u=+r.fractionGroupSize)?f.replace(new RegExp("\\d{"+u+"}\\B","g"),"$&"+(r.fractionGroupSeparator||"")):f):c}return(r.prefix||"")+n+(r.suffix||"")},l.toFraction=function(t){var e,n,i,o,s,a,u,h,c,f,l,p,g=this,y=g.c;if(null!=t&&(!(u=new k(t)).isInteger()&&(u.c||1!==u.s)||u.lt(d)))throw Error(ol+"Argument "+(u.isInteger()?"out of range: ":"not an integer: ")+N(u));if(!y)return new k(g);for(e=new k(d),c=n=new k(d),i=h=new k(d),p=pl(y),s=e.e=p.length-g.e-1,e.c[0]=cl[(a=s%ul)<0?ul+a:a],t=!t||u.comparedTo(e)>0?s>0?e:c:u,a=v,v=1/0,u=new k(p),h.c[0]=0;f=r(u,e,0,1),1!=(o=n.plus(f.times(i))).comparedTo(t);)n=i,i=o,c=h.plus(f.times(o=c)),h=o,e=u.minus(f.times(o=e)),u=o;return o=r(t.minus(n),i,0,1),h=h.plus(o.times(c)),n=n.plus(o.times(i)),h.s=c.s=g.s,l=r(c,i,s*=2,m).minus(g).abs().comparedTo(r(h,n,s,m).minus(g).abs())<1?[c,i]:[h,n],v=a,l},l.toNumber=function(){return+N(this)},l.toPrecision=function(t,e){return null!=t&&gl(t,1,ll),x(this,t,e,2)},l.toString=function(t){var e,r=this,i=r.s,o=r.e;return null===o?i?(e="Infinity",i<0&&(e="-"+e)):e="NaN":(null==t?e=o<=g||o>=y?bl(pl(r.c),o):vl(pl(r.c),o,"0"):10===t&&S?e=vl(pl((r=B(new k(r),p+o+1,m)).c),r.e,"0"):(gl(t,2,M.length,"Base"),e=n(vl(pl(r.c),o,"0"),10,t,i,!0)),i<0&&r.c[0]&&(e="-"+e)),e},l.valueOf=l.toJSON=function(){return N(this)},l._isBigNumber=!0,l[Symbol.toStringTag]="BigNumber",l[Symbol.for("nodejs.util.inspect.custom")]=l.valueOf,null!=e&&k.set(e),k}();wl.config({EXPONENTIAL_AT:1e3});const _l=t=>isNaN(Number(t))?new wl(0):t instanceof wl?t:"string"!=typeof t||0!==t.indexOf("0x")&&0!==t.indexOf("-0x")?new wl(t):new wl(t.replace("0x",""),16),El=(t,e)=>{const r=new Map;for(const e of t)r.set(e.name,e.value);for(const n of e)r.has(n.name)||(r.set(n.name,n.value),t.push(n));return t},Al={timeout:15e3,validateStatus:function(t){return t>=200&&t<300},headers:{"Content-Type":"application/json"}},Ml=async t=>await new Promise((e,r)=>{Mf({...Al,...t}).then(n=>{var i;void 0!==n.data?e(n):r(new Error(`${null!==(i=t.url)&&void 0!==i?i:""}: null response`))}).catch(t=>{Gf(t)?r(new Error(t)):kf(t.response)&&kf(t.response.data)?r(new Error(t.response.data.error)):r(new Error(t))})});var Sl={},kl={};Object.defineProperty(kl,"__esModule",{value:!0}),kl.Signer=void 0;kl.Signer=class{static verify(t){throw new Error("You must implement verify method on child")}};var xl={},Tl={},Rl={exports:{}},Bl={},Nl={};Object.defineProperty(Nl,"__esModule",{value:!0}),Nl.default=function(t){var e=t.length,r=e%4;if(!r)return t;var n=e,i=4-r,o=e+i,s=_.alloc(o);for(s.write(t);i--;)s.write("=",n++);return s.toString()},Object.defineProperty(Bl,"__esModule",{value:!0});var Pl=Nl;function Il(t,e){return void 0===e&&(e="utf8"),_.isBuffer(t)?Cl(t.toString("base64")):Cl(_.from(t,e).toString("base64"))}function Ol(t){return t=t.toString(),Pl.default(t).replace(/\-/g,"+").replace(/_/g,"/")}function Cl(t){return t.replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}var Ll=Il;Ll.encode=Il,Ll.decode=function(t,e){return void 0===e&&(e="utf8"),_.from(Ol(t),"base64").toString(e)},Ll.toBase64=Ol,Ll.fromBase64=Cl,Ll.toBuffer=function(t){return _.from(Ol(t),"base64")},Bl.default=Ll,function(t){t.exports=Bl.default,t.exports.default=t.exports}(Rl);var jl=Rl.exports,Dl={},Ul=n(Object.freeze({__proto__:null,default:{}}));!function(t){
/*! noble-ed25519 - MIT License (c) 2019 Paul Miller (paulmillr.com) */
Object.defineProperty(t,"__esModule",{value:!0}),t.utils=t.curve25519=t.getSharedSecret=t.sync=t.verify=t.sign=t.getPublicKey=t.hexToBytes=t.bytesToHex=t.Signature=t.RistrettoPoint=t.Point=t.ExtendedPoint=t.CURVE=void 0;const e=Ul,r=BigInt(0),n=BigInt(1),i=BigInt(2),o=BigInt(8),s=BigInt("7237005577332262213973186563042994240857116359379907606001950938285454250989"),a=Object.freeze({a:BigInt(-1),d:BigInt("37095705934669439343138083508754565189542113879843219016388785533085940283555"),P:BigInt("57896044618658097711785492504343953926634992332820282019728792003956564819949"),l:s,n:s,h:BigInt(8),Gx:BigInt("15112221349535400772501151409588531511454012693041857206046113283949847762202"),Gy:BigInt("46316835694926478169428394003475163141307993866256225615783033603165251855960")});t.CURVE=a;const u=BigInt("0x10000000000000000000000000000000000000000000000000000000000000000"),h=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752");BigInt("6853475219497561581579357271197624642482790079785650197046958215289687604742");const c=BigInt("25063068953384623474111414158702152701244531502492656460079210482610430750235"),f=BigInt("54469307008909316920995813868745141605393597292927456921205312896311721017578"),l=BigInt("1159843021668779879193775521855586647937357759715417654439879720876111806838"),d=BigInt("40440834346308536858101042469323190826248399146238708352240133220865137265952");class p{constructor(t,e,r,n){this.x=t,this.y=e,this.z=r,this.t=n}static fromAffine(t){if(!(t instanceof _))throw new TypeError("ExtendedPoint#fromAffine: expected Point");return t.equals(_.ZERO)?p.ZERO:new p(t.x,t.y,n,j(t.x*t.y))}static toAffineBatch(t){const e=function(t,e=a.P){const i=new Array(t.length),o=t.reduce((t,n,o)=>n===r?t:(i[o]=t,j(t*n,e)),n),s=D(o,e);return t.reduceRight((t,n,o)=>n===r?t:(i[o]=j(t*i[o],e),j(t*n,e)),s),i}(t.map(t=>t.z));return t.map((t,r)=>t.toAffine(e[r]))}static normalizeZ(t){return this.toAffineBatch(t).map(this.fromAffine)}equals(t){g(t);const{x:e,y:r,z:n}=this,{x:i,y:o,z:s}=t,a=j(e*s),u=j(i*n),h=j(r*s),c=j(o*n);return a===u&&h===c}negate(){return new p(j(-this.x),this.y,this.z,j(-this.t))}double(){const{x:t,y:e,z:r}=this,{a:n}=a,o=j,s=o(t*t),u=o(e*e),h=o(i*o(r*r)),c=o(n*s),f=t+e,l=o(o(f*f)-s-u),d=c+u,m=d-h,g=c-u,y=o(l*m),b=o(d*g),v=o(l*g),w=o(m*d);return new p(y,b,w,v)}add(t){const{x:e,y:r,z:n,t:i}=this;g(t);const{x:o,y:s,z:u,t:h}=t,{a:c,d:f}=a,l=j,d=l(e*o),m=l(r*s),y=l(i*f*h),b=l(n*u),v=l((e+r)*(o+s)-d-m),w=l(b-y),_=l(b+y),E=l(m-c*d),A=l(v*w),M=l(_*E),S=l(v*E),k=l(w*_);return new p(A,M,k,S)}subtract(t){return this.add(t.negate())}precomputeWindow(t){const e=1+256/t,r=[];let n=this,i=n;for(let o=0;o<e;o++){i=n,r.push(i);for(let e=1;e<2**(t-1);e++)i=i.add(n),r.push(i);n=i.double()}return r}wNAF(t,e){!e&&this.equals(p.BASE)&&(e=_.BASE);const r=e&&e._WINDOW_SIZE||1;if(256%r)throw new Error("Point#wNAF: Invalid precomputation window, must be power of 2");let i=e&&w.get(e);i||(i=this.precomputeWindow(r),e&&1!==r&&(i=p.normalizeZ(i),w.set(e,i)));let o=p.ZERO,s=p.BASE;const a=1+256/r,u=2**(r-1),h=BigInt(2**r-1),c=2**r,f=BigInt(r);for(let e=0;e<a;e++){const r=e*u;let a=Number(t&h);t>>=f,a>u&&(a-=c,t+=n);const l=r,d=r+Math.abs(a)-1,p=e%2!=0,g=a<0;0===a?s=s.add(m(p,i[l])):o=o.add(m(g,i[d]))}return p.normalizeZ([o,s])[0]}multiply(t,e){return this.wNAF(G(t,a.l),e)}multiplyUnsafe(t){let e=G(t,a.l,!1);const i=p.BASE,o=p.ZERO;if(e===r)return o;if(this.equals(o)||e===n)return this;if(this.equals(i))return this.wNAF(e);let s=o,u=this;for(;e>r;)e&n&&(s=s.add(u)),u=u.double(),e>>=n;return s}isSmallOrder(){return this.multiplyUnsafe(a.h).equals(p.ZERO)}isTorsionFree(){let t=this.multiplyUnsafe(a.l/i).double();return a.l%i&&(t=t.add(this)),t.equals(p.ZERO)}toAffine(t){const{x:e,y:r,z:i}=this,s=this.equals(p.ZERO);null==t&&(t=s?o:D(i));const a=j(e*t),u=j(r*t),h=j(i*t);if(s)return _.ZERO;if(h!==n)throw new Error("invZ was invalid");return new _(a,u)}fromRistrettoBytes(){b()}toRistrettoBytes(){b()}fromRistrettoHash(){b()}}function m(t,e){const r=e.negate();return t?r:e}function g(t){if(!(t instanceof p))throw new TypeError("ExtendedPoint expected")}function y(t){if(!(t instanceof v))throw new TypeError("RistrettoPoint expected")}function b(){throw new Error("Legacy method: switch to RistrettoPoint")}t.ExtendedPoint=p,p.BASE=new p(a.Gx,a.Gy,n,j(a.Gx*a.Gy)),p.ZERO=new p(r,n,n,r);class v{constructor(t){this.ep=t}static calcElligatorRistrettoMap(t){const{d:e}=a,r=j(h*t*t),i=j((r+n)*l);let o=BigInt(-1);const s=j((o-e*r)*j(r+e));let{isValid:u,value:f}=z(i,s),m=j(f*t);I(m)||(m=j(-m)),u||(f=m),u||(o=r);const g=j(o*(r-n)*d-s),y=f*f,b=j((f+f)*s),v=j(g*c),w=j(n-y),_=j(n+y);return new p(j(b*_),j(w*v),j(v*_),j(b*w))}static hashToCurve(t){const e=L((t=K(t,64)).slice(0,32)),r=this.calcElligatorRistrettoMap(e),n=L(t.slice(32,64)),i=this.calcElligatorRistrettoMap(n);return new v(r.add(i))}static fromHex(t){t=K(t,32);const{a:e,d:i}=a,o="RistrettoPoint.fromHex: the hex is not valid encoding of RistrettoPoint",s=L(t);if(!function(t,e){if(t.length!==e.length)return!1;for(let r=0;r<t.length;r++)if(t[r]!==e[r])return!1;return!0}(P(s),t)||I(s))throw new Error(o);const u=j(s*s),h=j(n+e*u),c=j(n-e*u),f=j(h*h),l=j(c*c),d=j(e*i*f-l),{isValid:m,value:g}=q(j(d*l)),y=j(g*c),b=j(g*y*d);let w=j((s+s)*y);I(w)&&(w=j(-w));const _=j(h*b),E=j(w*_);if(!m||I(E)||_===r)throw new Error(o);return new v(new p(w,_,n,E))}toRawBytes(){let{x:t,y:e,z:r,t:n}=this.ep;const i=j(j(r+e)*j(r-e)),o=j(t*e),s=j(o*o),{value:a}=q(j(i*s)),u=j(a*i),c=j(a*o),l=j(u*c*n);let d;if(I(n*l)){let r=j(e*h),n=j(t*h);t=r,e=n,d=j(u*f)}else d=c;I(t*l)&&(e=j(-e));let p=j((r-e)*d);return I(p)&&(p=j(-p)),P(p)}toHex(){return x(this.toRawBytes())}toString(){return this.toHex()}equals(t){y(t);const e=this.ep,r=t.ep,n=j(e.x*r.y)===j(e.y*r.x),i=j(e.y*r.y)===j(e.x*r.x);return n||i}add(t){return y(t),new v(this.ep.add(t.ep))}subtract(t){return y(t),new v(this.ep.subtract(t.ep))}multiply(t){return new v(this.ep.multiply(t))}multiplyUnsafe(t){return new v(this.ep.multiplyUnsafe(t))}}t.RistrettoPoint=v,v.BASE=new v(p.BASE),v.ZERO=new v(p.ZERO);const w=new WeakMap;class _{constructor(t,e){this.x=t,this.y=e}_setWindowSize(t){this._WINDOW_SIZE=t,w.delete(this)}static fromHex(t,e=!0){const{d:r,P:i}=a,o=(t=K(t,32)).slice();o[31]=-129&t[31];const s=O(o);if(e&&s>=i)throw new Error("Expected 0 < hex < P");if(!e&&s>=u)throw new Error("Expected 0 < hex < 2**256");const h=j(s*s),c=j(h-n),f=j(r*h+n);let{isValid:l,value:d}=z(c,f);if(!l)throw new Error("Point.fromHex: invalid y coordinate");const p=(d&n)===n;return!!(128&t[31])!==p&&(d=j(-d)),new _(d,s)}static async fromPrivateKey(t){return(await X(t)).point}toRawBytes(){const t=P(this.y);return t[31]|=this.x&n?128:0,t}toHex(){return x(this.toRawBytes())}toX25519(){const{y:t}=this;return P(j((n+t)*D(n-t)))}isTorsionFree(){return p.fromAffine(this).isTorsionFree()}equals(t){return this.x===t.x&&this.y===t.y}negate(){return new _(j(-this.x),this.y)}add(t){return p.fromAffine(this).add(p.fromAffine(t)).toAffine()}subtract(t){return this.add(t.negate())}multiply(t){return p.fromAffine(this).multiply(t,this).toAffine()}}t.Point=_,_.BASE=new _(a.Gx,a.Gy),_.ZERO=new _(r,n);class E{constructor(t,e){this.r=t,this.s=e,this.assertValidity()}static fromHex(t){const e=K(t,64),r=_.fromHex(e.slice(0,32),!1),n=O(e.slice(32,64));return new E(r,n)}assertValidity(){const{r:t,s:e}=this;if(!(t instanceof _))throw new Error("Expected Point instance");return G(e,a.l,!1),this}toRawBytes(){const t=new Uint8Array(64);return t.set(this.r.toRawBytes()),t.set(P(this.s),32),t}toHex(){return x(this.toRawBytes())}}function A(t){return t instanceof Uint8Array||ArrayBuffer.isView(t)&&"Uint8Array"===t.constructor.name}function M(t){if(!A(t))throw new Error("Uint8Array expected")}function S(...t){if(t.every(M),1===t.length)return t[0];const e=t.reduce((t,e)=>t+e.length,0),r=new Uint8Array(e);for(let e=0,n=0;e<t.length;e++){const i=t[e];r.set(i,n),n+=i.length}return r}t.Signature=E;const k=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function x(t){M(t);let e="";for(let r=0;r<t.length;r++)e+=k[t[r]];return e}t.bytesToHex=x;const T={_0:48,_9:57,A:65,F:70,a:97,f:102};function R(t){return t>=T._0&&t<=T._9?t-T._0:t>=T.A&&t<=T.F?t-(T.A-10):t>=T.a&&t<=T.f?t-(T.a-10):void 0}function B(t){if("string"!=typeof t)throw new Error("hex string expected, got "+typeof t);const e=t.length,r=e/2;if(e%2)throw new Error("hex string expected, got unpadded hex of length "+e);const n=new Uint8Array(r);for(let e=0,i=0;e<r;e++,i+=2){const r=R(t.charCodeAt(i)),o=R(t.charCodeAt(i+1));if(void 0===r||void 0===o){const e=t[i]+t[i+1];throw new Error('hex string expected, got non-hex character "'+e+'" at index '+i)}n[e]=16*r+o}return n}function N(t){return B(t.toString(16).padStart(64,"0"))}function P(t){return N(t).reverse()}function I(t){return(j(t)&n)===n}function O(t){return M(t),BigInt("0x"+x(Uint8Array.from(t).reverse()))}t.hexToBytes=B;const C=BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");function L(t){return j(O(t)&C)}function j(t,e=a.P){const n=t%e;return n>=r?n:e+n}function D(t,e=a.P){if(t===r||e<=r)throw new Error(`invert: expected positive integers, got n=${t} mod=${e}`);let i=j(t,e),o=e,s=r,u=n;for(;i!==r;){const t=o%i,e=s-u*(o/i);o=i,i=t,s=u,u=e}if(o!==n)throw new Error("invert: does not exist");return j(s,e)}function U(t,e){const{P:n}=a;let i=t;for(;e-- >r;)i*=i,i%=n;return i}function F(t){const{P:e}=a,r=BigInt(5),o=BigInt(10),s=BigInt(20),u=BigInt(40),h=BigInt(80),c=t*t%e*t%e,f=U(c,i)*c%e,l=U(f,n)*t%e,d=U(l,r)*l%e,p=U(d,o)*d%e,m=U(p,s)*p%e,g=U(m,u)*m%e,y=U(g,h)*g%e,b=U(y,h)*g%e,v=U(b,o)*d%e;return{pow_p_5_8:U(v,i)*t%e,b2:c}}function z(t,e){const r=j(e*e*e),n=j(r*r*e);let i=j(t*r*F(t*n).pow_p_5_8);const o=j(e*i*i),s=i,a=j(i*h),u=o===t,c=o===j(-t),f=o===j(-t*h);return u&&(i=s),(c||f)&&(i=a),I(i)&&(i=j(-i)),{isValid:u||c,value:i}}function q(t){return z(n,t)}function H(t){return j(O(t),a.l)}function K(t,e){const r=A(t)?Uint8Array.from(t):B(t);if("number"==typeof e&&r.length!==e)throw new Error(`Expected ${e} bytes`);return r}function G(t,e,n=!0){if(!e)throw new TypeError("Specify max value");if("number"==typeof t&&Number.isSafeInteger(t)&&(t=BigInt(t)),"bigint"==typeof t&&t<e)if(n){if(r<t)return t}else if(r<=t)return t;throw new TypeError("Expected valid scalar: 0 < scalar < max")}function V(t){return t[0]&=248,t[31]&=127,t[31]|=64,t}function W(t){if(32!==(t="bigint"==typeof t||"number"==typeof t?N(G(t,u)):K(t)).length)throw new Error("Expected 32 bytes");return t}function J(t){const e=V(t.slice(0,32)),r=t.slice(32,64),n=H(e),i=_.BASE.multiply(n),o=i.toRawBytes();return{head:e,prefix:r,scalar:n,point:i,pointBytes:o}}let Z;function Y(...t){if("function"!=typeof Z)throw new Error("utils.sha512Sync must be set to use sync methods");return Z(...t)}async function X(e){return J(await t.utils.sha512(W(e)))}function $(t){return J(Y(W(t)))}function Q(t,e,r){e=K(e),r instanceof _||(r=_.fromHex(r,!1));const{r:n,s:i}=t instanceof E?t.assertValidity():E.fromHex(t);return{r:n,s:i,SB:p.BASE.multiplyUnsafe(i),pub:r,msg:e}}function tt(t,e,r,n){const i=H(n),o=p.fromAffine(t).multiplyUnsafe(i);return p.fromAffine(e).add(o).subtract(r).multiplyUnsafe(a.h).equals(p.ZERO)}function et(t,e,r){const n=j(t*(e-r));return[e=j(e-n),r=j(r+n)]}t.getPublicKey=async function(t){return(await X(t)).pointBytes},t.sign=async function(e,r){e=K(e);const{prefix:n,scalar:i,pointBytes:o}=await X(r),s=H(await t.utils.sha512(n,e)),u=_.BASE.multiply(s),h=j(s+H(await t.utils.sha512(u.toRawBytes(),o,e))*i,a.l);return new E(u,h).toRawBytes()},t.verify=async function(e,r,n){const{r:i,SB:o,msg:s,pub:a}=Q(e,r,n),u=await t.utils.sha512(i.toRawBytes(),a.toRawBytes(),s);return tt(a,i,o,u)},t.sync={getExtendedPublicKey:$,getPublicKey:function(t){return $(t).pointBytes},sign:function(t,e){t=K(t);const{prefix:r,scalar:n,pointBytes:i}=$(e),o=H(Y(r,t)),s=_.BASE.multiply(o),u=j(o+H(Y(s.toRawBytes(),i,t))*n,a.l);return new E(s,u).toRawBytes()},verify:function(t,e,r){const{r:n,SB:i,msg:o,pub:s}=Q(t,e,r),a=Y(n.toRawBytes(),s.toRawBytes(),o);return tt(s,n,i,a)}},t.getSharedSecret=async function(e,r){const{head:n}=await X(e),i=_.fromHex(r).toX25519();return t.curve25519.scalarMult(n,i)},_.BASE._setWindowSize(8),t.curve25519={BASE_POINT_U:"0900000000000000000000000000000000000000000000000000000000000000",scalarMult(t,e){const i=function(t,e){const{P:i}=a,o=G(t,i),s=G(e,i),u=BigInt(121665),h=o;let c,f=n,l=r,d=o,p=n,m=r;for(let t=BigInt(254);t>=r;t--){const e=s>>t&n;m^=e,c=et(m,f,d),f=c[0],d=c[1],c=et(m,l,p),l=c[0],p=c[1],m=e;const r=f+l,i=j(r*r),o=f-l,a=j(o*o),g=i-a,y=d+p,b=j((d-p)*r),v=j(y*o),w=b+v,_=b-v;d=j(w*w),p=j(h*j(_*_)),f=j(i*a),l=j(g*(i+j(u*g)))}c=et(m,f,d),f=c[0],d=c[1],c=et(m,l,p),l=c[0],p=c[1];const{pow_p_5_8:g,b2:y}=F(l),b=j(U(g,BigInt(3))*y);return j(f*b)}(function(t){const e=K(t,32);return e[31]&=127,O(e)}(e),O(V(K(t,32))));if(i===r)throw new Error("Invalid private or public key received");return function(t){return P(j(t,a.P))}(i)},scalarMultBase:e=>t.curve25519.scalarMult(e,t.curve25519.BASE_POINT_U)};const rt={node:e,web:"object"==typeof self&&"crypto"in self?self.crypto:void 0};t.utils={bytesToHex:x,hexToBytes:B,concatBytes:S,getExtendedPublicKey:X,mod:j,invert:D,TORSION_SUBGROUP:["0100000000000000000000000000000000000000000000000000000000000000","c7176a703d4dd84fba3c0b760d10670f2a2053fa2c39ccc64ec7fd7792ac037a","0000000000000000000000000000000000000000000000000000000000000080","26e8958fc2b227b045c3f489f2ef98f0d5dfac05d3c63339b13802886d53fc05","ecffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7f","26e8958fc2b227b045c3f489f2ef98f0d5dfac05d3c63339b13802886d53fc85","0000000000000000000000000000000000000000000000000000000000000000","c7176a703d4dd84fba3c0b760d10670f2a2053fa2c39ccc64ec7fd7792ac03fa"],hashToPrivateScalar:t=>{if((t=K(t)).length<40||t.length>1024)throw new Error("Expected 40-1024 bytes of private key as per FIPS 186");return j(O(t),a.l-n)+n},randomBytes:(t=32)=>{if(rt.web)return rt.web.getRandomValues(new Uint8Array(t));if(rt.node){const{randomBytes:e}=rt.node;return new Uint8Array(e(t).buffer)}throw new Error("The environment doesn't have randomBytes function")},randomPrivateKey:()=>t.utils.randomBytes(32),sha512:async(...t)=>{const e=S(...t);if(rt.web){const t=await rt.web.subtle.digest("SHA-512",e.buffer);return new Uint8Array(t)}if(rt.node)return Uint8Array.from(rt.node.createHash("sha512").update(e).digest());throw new Error("The environment doesn't have sha512 function")},precompute(t=8,e=_.BASE){const r=e.equals(_.BASE)?e:new _(e.x,e.y);return r._setWindowSize(t),r.multiply(i),r},sha512Sync:void 0},Object.defineProperties(t.utils,{sha512Sync:{configurable:!1,get:()=>Z,set(t){Z||(Z=t)}}})}(Dl);var Fl={};!function(t){var e;Object.defineProperty(t,"__esModule",{value:!0}),t.SIG_CONFIG=t.SignatureConfig=void 0,function(t){t[t.ARWEAVE=1]="ARWEAVE",t[t.ED25519=2]="ED25519",t[t.ETHEREUM=3]="ETHEREUM",t[t.SOLANA=4]="SOLANA"}(e=t.SignatureConfig||(t.SignatureConfig={})),t.SIG_CONFIG={[e.ARWEAVE]:{sigLength:512,pubLength:512,sigName:"arweave"},[e.ED25519]:{sigLength:64,pubLength:32,sigName:"ed25519"},[e.ETHEREUM]:{sigLength:65,pubLength:65,sigName:"ethereum"},[e.SOLANA]:{sigLength:64,pubLength:32,sigName:"solana"}}}(Fl);var zl=e&&e.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Tl,"__esModule",{value:!0});const ql=zl(jl),Hl=Dl,Kl=Fl;Tl.default=class{constructor(t,e){this._key=t,this.pk=e,this.ownerLength=Kl.SIG_CONFIG[2].pubLength,this.signatureLength=Kl.SIG_CONFIG[2].sigLength,this.signatureType=2}get publicKey(){return this._publicKey}get key(){return new Uint8Array(0)}sign(t){return Hl.sign(_.from(t),_.from(this.key))}static async verify(t,e,r){let n=t;return"string"==typeof t&&(n=ql.default.toBuffer(t)),Hl.verify(_.from(r),_.from(e),_.from(n))}};var Gl={},Vl={};const Wl="Impossible case. Please create issue.",Jl="The tweak was out of range or the resulted private key is invalid",Zl="The tweak was out of range or equal to zero",Yl="Unknow error on context randomization",Xl="Private Key is invalid",$l="Public Key could not be parsed",Ql="Public Key serialization error",td="The sum of the public keys is not valid",ed="Signature could not be parsed",rd="The nonce generation function failed, or the private key was invalid",nd="Public key could not be recover",id="Scalar was invalid (zero or overflow)";function od(t,e){if(!t)throw new Error(e)}function sd(t,e,r){if(od(e instanceof Uint8Array,`Expected ${t} to be an Uint8Array`),void 0!==r)if(Array.isArray(r)){const n=`Expected ${t} to be an Uint8Array with length [${r.join(", ")}]`;od(r.includes(e.length),n)}else{const n=`Expected ${t} to be an Uint8Array with length ${r}`;od(e.length===r,n)}}function ad(t){od("Boolean"===hd(t),"Expected compressed to be a Boolean")}function ud(t=t=>new Uint8Array(t),e){return"function"==typeof t&&(t=t(e)),sd("output",t,e),t}function hd(t){return Object.prototype.toString.call(t).slice(8,-1)}var cd={},fd="6.6.1",ld={},dd={exports:{}};!function(t){!function(t,e){function r(t,e){if(!t)throw new Error(e||"Assertion failed")}function n(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function i(t,e,r){if(i.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(r=e,e=10),this._init(t||0,e||10,r||"be"))}var o;"object"==typeof t?t.exports=i:e.BN=i,i.BN=i,i.wordSize=26;try{o="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:st.Buffer}catch(t){}function s(t,e){var r=t.charCodeAt(e);return r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:r-48&15}function a(t,e,r){var n=s(t,r);return r-1>=e&&(n|=s(t,r-1)<<4),n}function u(t,e,r,n){for(var i=0,o=Math.min(t.length,r),s=e;s<o;s++){var a=t.charCodeAt(s)-48;i*=n,i+=a>=49?a-49+10:a>=17?a-17+10:a}return i}i.isBN=function(t){return t instanceof i||null!==t&&"object"==typeof t&&t.constructor.wordSize===i.wordSize&&Array.isArray(t.words)},i.max=function(t,e){return t.cmp(e)>0?t:e},i.min=function(t,e){return t.cmp(e)<0?t:e},i.prototype._init=function(t,e,n){if("number"==typeof t)return this._initNumber(t,e,n);if("object"==typeof t)return this._initArray(t,e,n);"hex"===e&&(e=16),r(e===(0|e)&&e>=2&&e<=36);var i=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i<t.length&&(16===e?this._parseHex(t,i,n):(this._parseBase(t,e,i),"le"===n&&this._initArray(this.toArray(),e,n)))},i.prototype._initNumber=function(t,e,n){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(r(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===n&&this._initArray(this.toArray(),e,n)},i.prototype._initArray=function(t,e,n){if(r("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var i=0;i<this.length;i++)this.words[i]=0;var o,s,a=0;if("be"===n)for(i=t.length-1,o=0;i>=0;i-=3)s=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[o]|=s<<a&67108863,this.words[o+1]=s>>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);else if("le"===n)for(i=0,o=0;i<t.length;i+=3)s=t[i]|t[i+1]<<8|t[i+2]<<16,this.words[o]|=s<<a&67108863,this.words[o+1]=s>>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);return this.strip()},i.prototype._parseHex=function(t,e,r){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var n=0;n<this.length;n++)this.words[n]=0;var i,o=0,s=0;if("be"===r)for(n=t.length-1;n>=e;n-=2)i=a(t,e,n)<<o,this.words[s]|=67108863&i,o>=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;else for(n=(t.length-e)%2==0?e+1:e;n<t.length;n+=2)i=a(t,e,n)<<o,this.words[s]|=67108863&i,o>=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;this.strip()},i.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var n=0,i=1;i<=67108863;i*=e)n++;n--,i=i/e|0;for(var o=t.length-r,s=o%n,a=Math.min(o,o-s)+r,h=0,c=r;c<a;c+=n)h=u(t,c,c+n,e),this.imuln(i),this.words[0]+h<67108864?this.words[0]+=h:this._iaddn(h);if(0!==s){var f=1;for(h=u(t,c,t.length,e),c=0;c<s;c++)f*=e;this.imuln(f),this.words[0]+h<67108864?this.words[0]+=h:this._iaddn(h)}this.strip()},i.prototype.copy=function(t){t.words=new Array(this.length);for(var e=0;e<this.length;e++)t.words[e]=this.words[e];t.length=this.length,t.negative=this.negative,t.red=this.red},i.prototype.clone=function(){var t=new i(null);return this.copy(t),t},i.prototype._expand=function(t){for(;this.length<t;)this.words[this.length++]=0;return this},i.prototype.strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},i.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},i.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var h=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],c=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],f=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function l(t,e,r){r.negative=e.negative^t.negative;var n=t.length+e.length|0;r.length=n,n=n-1|0;var i=0|t.words[0],o=0|e.words[0],s=i*o,a=67108863&s,u=s/67108864|0;r.words[0]=a;for(var h=1;h<n;h++){for(var c=u>>>26,f=67108863&u,l=Math.min(h,e.length-1),d=Math.max(0,h-t.length+1);d<=l;d++){var p=h-d|0;c+=(s=(i=0|t.words[p])*(o=0|e.words[d])+f)/67108864|0,f=67108863&s}r.words[h]=0|f,u=0|c}return 0!==u?r.words[h]=0|u:r.length--,r.strip()}i.prototype.toString=function(t,e){var n;if(e=0|e||1,16===(t=t||10)||"hex"===t){n="";for(var i=0,o=0,s=0;s<this.length;s++){var a=this.words[s],u=(16777215&(a<<i|o)).toString(16);o=a>>>24-i&16777215,(i+=2)>=26&&(i-=26,s--),n=0!==o||s!==this.length-1?h[6-u.length]+u+n:u+n}for(0!==o&&(n=o.toString(16)+n);n.length%e!==0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}if(t===(0|t)&&t>=2&&t<=36){var l=c[t],d=f[t];n="";var p=this.clone();for(p.negative=0;!p.isZero();){var m=p.modn(d).toString(t);n=(p=p.idivn(d)).isZero()?m+n:h[l-m.length]+m+n}for(this.isZero()&&(n="0"+n);n.length%e!==0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}r(!1,"Base should be between 2 and 36")},i.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},i.prototype.toJSON=function(){return this.toString(16)},i.prototype.toBuffer=function(t,e){return r(void 0!==o),this.toArrayLike(o,t,e)},i.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},i.prototype.toArrayLike=function(t,e,n){var i=this.byteLength(),o=n||Math.max(1,i);r(i<=o,"byte array longer than desired length"),r(o>0,"Requested array length <= 0"),this.strip();var s,a,u="le"===e,h=new t(o),c=this.clone();if(u){for(a=0;!c.isZero();a++)s=c.andln(255),c.iushrn(8),h[a]=s;for(;a<o;a++)h[a]=0}else{for(a=0;a<o-i;a++)h[a]=0;for(a=0;!c.isZero();a++)s=c.andln(255),c.iushrn(8),h[o-a-1]=s}return h},Math.clz32?i.prototype._countBits=function(t){return 32-Math.clz32(t)}:i.prototype._countBits=function(t){var e=t,r=0;return e>=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},i.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 8191&e||(r+=13,e>>>=13),127&e||(r+=7,e>>>=7),15&e||(r+=4,e>>>=4),3&e||(r+=2,e>>>=2),1&e||r++,r},i.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;e<this.length;e++){var r=this._zeroBits(this.words[e]);if(t+=r,26!==r)break}return t},i.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},i.prototype.toTwos=function(t){return 0!==this.negative?this.abs().inotn(t).iaddn(1):this.clone()},i.prototype.fromTwos=function(t){return this.testn(t-1)?this.notn(t).iaddn(1).ineg():this.clone()},i.prototype.isNeg=function(){return 0!==this.negative},i.prototype.neg=function(){return this.clone().ineg()},i.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},i.prototype.iuor=function(t){for(;this.length<t.length;)this.words[this.length++]=0;for(var e=0;e<t.length;e++)this.words[e]=this.words[e]|t.words[e];return this.strip()},i.prototype.ior=function(t){return r(0===(this.negative|t.negative)),this.iuor(t)},i.prototype.or=function(t){return this.length>t.length?this.clone().ior(t):t.clone().ior(this)},i.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},i.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;r<e.length;r++)this.words[r]=this.words[r]&t.words[r];return this.length=e.length,this.strip()},i.prototype.iand=function(t){return r(0===(this.negative|t.negative)),this.iuand(t)},i.prototype.and=function(t){return this.length>t.length?this.clone().iand(t):t.clone().iand(this)},i.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},i.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var n=0;n<r.length;n++)this.words[n]=e.words[n]^r.words[n];if(this!==e)for(;n<e.length;n++)this.words[n]=e.words[n];return this.length=e.length,this.strip()},i.prototype.ixor=function(t){return r(0===(this.negative|t.negative)),this.iuxor(t)},i.prototype.xor=function(t){return this.length>t.length?this.clone().ixor(t):t.clone().ixor(this)},i.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},i.prototype.inotn=function(t){r("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),n=t%26;this._expand(e),n>0&&e--;for(var i=0;i<e;i++)this.words[i]=67108863&~this.words[i];return n>0&&(this.words[i]=~this.words[i]&67108863>>26-n),this.strip()},i.prototype.notn=function(t){return this.clone().inotn(t)},i.prototype.setn=function(t,e){r("number"==typeof t&&t>=0);var n=t/26|0,i=t%26;return this._expand(n+1),this.words[n]=e?this.words[n]|1<<i:this.words[n]&~(1<<i),this.strip()},i.prototype.iadd=function(t){var e,r,n;if(0!==this.negative&&0===t.negative)return this.negative=0,e=this.isub(t),this.negative^=1,this._normSign();if(0===this.negative&&0!==t.negative)return t.negative=0,e=this.isub(t),t.negative=1,e._normSign();this.length>t.length?(r=this,n=t):(r=t,n=this);for(var i=0,o=0;o<n.length;o++)e=(0|r.words[o])+(0|n.words[o])+i,this.words[o]=67108863&e,i=e>>>26;for(;0!==i&&o<r.length;o++)e=(0|r.words[o])+i,this.words[o]=67108863&e,i=e>>>26;if(this.length=r.length,0!==i)this.words[this.length]=i,this.length++;else if(r!==this)for(;o<r.length;o++)this.words[o]=r.words[o];return this},i.prototype.add=function(t){var e;return 0!==t.negative&&0===this.negative?(t.negative=0,e=this.sub(t),t.negative^=1,e):0===t.negative&&0!==this.negative?(this.negative=0,e=t.sub(this),this.negative=1,e):this.length>t.length?this.clone().iadd(t):t.clone().iadd(this)},i.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,n,i=this.cmp(t);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(r=this,n=t):(r=t,n=this);for(var o=0,s=0;s<n.length;s++)o=(e=(0|r.words[s])-(0|n.words[s])+o)>>26,this.words[s]=67108863&e;for(;0!==o&&s<r.length;s++)o=(e=(0|r.words[s])+o)>>26,this.words[s]=67108863&e;if(0===o&&s<r.length&&r!==this)for(;s<r.length;s++)this.words[s]=r.words[s];return this.length=Math.max(this.length,s),r!==this&&(this.negative=1),this.strip()},i.prototype.sub=function(t){return this.clone().isub(t)};var d=function(t,e,r){var n,i,o,s=t.words,a=e.words,u=r.words,h=0,c=0|s[0],f=8191&c,l=c>>>13,d=0|s[1],p=8191&d,m=d>>>13,g=0|s[2],y=8191&g,b=g>>>13,v=0|s[3],w=8191&v,_=v>>>13,E=0|s[4],A=8191&E,M=E>>>13,S=0|s[5],k=8191&S,x=S>>>13,T=0|s[6],R=8191&T,B=T>>>13,N=0|s[7],P=8191&N,I=N>>>13,O=0|s[8],C=8191&O,L=O>>>13,j=0|s[9],D=8191&j,U=j>>>13,F=0|a[0],z=8191&F,q=F>>>13,H=0|a[1],K=8191&H,G=H>>>13,V=0|a[2],W=8191&V,J=V>>>13,Z=0|a[3],Y=8191&Z,X=Z>>>13,$=0|a[4],Q=8191&$,tt=$>>>13,et=0|a[5],rt=8191&et,nt=et>>>13,it=0|a[6],ot=8191&it,st=it>>>13,at=0|a[7],ut=8191&at,ht=at>>>13,ct=0|a[8],ft=8191&ct,lt=ct>>>13,dt=0|a[9],pt=8191&dt,mt=dt>>>13;r.negative=t.negative^e.negative,r.length=19;var gt=(h+(n=Math.imul(f,z))|0)+((8191&(i=(i=Math.imul(f,q))+Math.imul(l,z)|0))<<13)|0;h=((o=Math.imul(l,q))+(i>>>13)|0)+(gt>>>26)|0,gt&=67108863,n=Math.imul(p,z),i=(i=Math.imul(p,q))+Math.imul(m,z)|0,o=Math.imul(m,q);var yt=(h+(n=n+Math.imul(f,K)|0)|0)+((8191&(i=(i=i+Math.imul(f,G)|0)+Math.imul(l,K)|0))<<13)|0;h=((o=o+Math.imul(l,G)|0)+(i>>>13)|0)+(yt>>>26)|0,yt&=67108863,n=Math.imul(y,z),i=(i=Math.imul(y,q))+Math.imul(b,z)|0,o=Math.imul(b,q),n=n+Math.imul(p,K)|0,i=(i=i+Math.imul(p,G)|0)+Math.imul(m,K)|0,o=o+Math.imul(m,G)|0;var bt=(h+(n=n+Math.imul(f,W)|0)|0)+((8191&(i=(i=i+Math.imul(f,J)|0)+Math.imul(l,W)|0))<<13)|0;h=((o=o+Math.imul(l,J)|0)+(i>>>13)|0)+(bt>>>26)|0,bt&=67108863,n=Math.imul(w,z),i=(i=Math.imul(w,q))+Math.imul(_,z)|0,o=Math.imul(_,q),n=n+Math.imul(y,K)|0,i=(i=i+Math.imul(y,G)|0)+Math.imul(b,K)|0,o=o+Math.imul(b,G)|0,n=n+Math.imul(p,W)|0,i=(i=i+Math.imul(p,J)|0)+Math.imul(m,W)|0,o=o+Math.imul(m,J)|0;var vt=(h+(n=n+Math.imul(f,Y)|0)|0)+((8191&(i=(i=i+Math.imul(f,X)|0)+Math.imul(l,Y)|0))<<13)|0;h=((o=o+Math.imul(l,X)|0)+(i>>>13)|0)+(vt>>>26)|0,vt&=67108863,n=Math.imul(A,z),i=(i=Math.imul(A,q))+Math.imul(M,z)|0,o=Math.imul(M,q),n=n+Math.imul(w,K)|0,i=(i=i+Math.imul(w,G)|0)+Math.imul(_,K)|0,o=o+Math.imul(_,G)|0,n=n+Math.imul(y,W)|0,i=(i=i+Math.imul(y,J)|0)+Math.imul(b,W)|0,o=o+Math.imul(b,J)|0,n=n+Math.imul(p,Y)|0,i=(i=i+Math.imul(p,X)|0)+Math.imul(m,Y)|0,o=o+Math.imul(m,X)|0;var wt=(h+(n=n+Math.imul(f,Q)|0)|0)+((8191&(i=(i=i+Math.imul(f,tt)|0)+Math.imul(l,Q)|0))<<13)|0;h=((o=o+Math.imul(l,tt)|0)+(i>>>13)|0)+(wt>>>26)|0,wt&=67108863,n=Math.imul(k,z),i=(i=Math.imul(k,q))+Math.imul(x,z)|0,o=Math.imul(x,q),n=n+Math.imul(A,K)|0,i=(i=i+Math.imul(A,G)|0)+Math.imul(M,K)|0,o=o+Math.imul(M,G)|0,n=n+Math.imul(w,W)|0,i=(i=i+Math.imul(w,J)|0)+Math.imul(_,W)|0,o=o+Math.imul(_,J)|0,n=n+Math.imul(y,Y)|0,i=(i=i+Math.imul(y,X)|0)+Math.imul(b,Y)|0,o=o+Math.imul(b,X)|0,n=n+Math.imul(p,Q)|0,i=(i=i+Math.imul(p,tt)|0)+Math.imul(m,Q)|0,o=o+Math.imul(m,tt)|0;var _t=(h+(n=n+Math.imul(f,rt)|0)|0)+((8191&(i=(i=i+Math.imul(f,nt)|0)+Math.imul(l,rt)|0))<<13)|0;h=((o=o+Math.imul(l,nt)|0)+(i>>>13)|0)+(_t>>>26)|0,_t&=67108863,n=Math.imul(R,z),i=(i=Math.imul(R,q))+Math.imul(B,z)|0,o=Math.imul(B,q),n=n+Math.imul(k,K)|0,i=(i=i+Math.imul(k,G)|0)+Math.imul(x,K)|0,o=o+Math.imul(x,G)|0,n=n+Math.imul(A,W)|0,i=(i=i+Math.imul(A,J)|0)+Math.imul(M,W)|0,o=o+Math.imul(M,J)|0,n=n+Math.imul(w,Y)|0,i=(i=i+Math.imul(w,X)|0)+Math.imul(_,Y)|0,o=o+Math.imul(_,X)|0,n=n+Math.imul(y,Q)|0,i=(i=i+Math.imul(y,tt)|0)+Math.imul(b,Q)|0,o=o+Math.imul(b,tt)|0,n=n+Math.imul(p,rt)|0,i=(i=i+Math.imul(p,nt)|0)+Math.imul(m,rt)|0,o=o+Math.imul(m,nt)|0;var Et=(h+(n=n+Math.imul(f,ot)|0)|0)+((8191&(i=(i=i+Math.imul(f,st)|0)+Math.imul(l,ot)|0))<<13)|0;h=((o=o+Math.imul(l,st)|0)+(i>>>13)|0)+(Et>>>26)|0,Et&=67108863,n=Math.imul(P,z),i=(i=Math.imul(P,q))+Math.imul(I,z)|0,o=Math.imul(I,q),n=n+Math.imul(R,K)|0,i=(i=i+Math.imul(R,G)|0)+Math.imul(B,K)|0,o=o+Math.imul(B,G)|0,n=n+Math.imul(k,W)|0,i=(i=i+Math.imul(k,J)|0)+Math.imul(x,W)|0,o=o+Math.imul(x,J)|0,n=n+Math.imul(A,Y)|0,i=(i=i+Math.imul(A,X)|0)+Math.imul(M,Y)|0,o=o+Math.imul(M,X)|0,n=n+Math.imul(w,Q)|0,i=(i=i+Math.imul(w,tt)|0)+Math.imul(_,Q)|0,o=o+Math.imul(_,tt)|0,n=n+Math.imul(y,rt)|0,i=(i=i+Math.imul(y,nt)|0)+Math.imul(b,rt)|0,o=o+Math.imul(b,nt)|0,n=n+Math.imul(p,ot)|0,i=(i=i+Math.imul(p,st)|0)+Math.imul(m,ot)|0,o=o+Math.imul(m,st)|0;var At=(h+(n=n+Math.imul(f,ut)|0)|0)+((8191&(i=(i=i+Math.imul(f,ht)|0)+Math.imul(l,ut)|0))<<13)|0;h=((o=o+Math.imul(l,ht)|0)+(i>>>13)|0)+(At>>>26)|0,At&=67108863,n=Math.imul(C,z),i=(i=Math.imul(C,q))+Math.imul(L,z)|0,o=Math.imul(L,q),n=n+Math.imul(P,K)|0,i=(i=i+Math.imul(P,G)|0)+Math.imul(I,K)|0,o=o+Math.imul(I,G)|0,n=n+Math.imul(R,W)|0,i=(i=i+Math.imul(R,J)|0)+Math.imul(B,W)|0,o=o+Math.imul(B,J)|0,n=n+Math.imul(k,Y)|0,i=(i=i+Math.imul(k,X)|0)+Math.imul(x,Y)|0,o=o+Math.imul(x,X)|0,n=n+Math.imul(A,Q)|0,i=(i=i+Math.imul(A,tt)|0)+Math.imul(M,Q)|0,o=o+Math.imul(M,tt)|0,n=n+Math.imul(w,rt)|0,i=(i=i+Math.imul(w,nt)|0)+Math.imul(_,rt)|0,o=o+Math.imul(_,nt)|0,n=n+Math.imul(y,ot)|0,i=(i=i+Math.imul(y,st)|0)+Math.imul(b,ot)|0,o=o+Math.imul(b,st)|0,n=n+Math.imul(p,ut)|0,i=(i=i+Math.imul(p,ht)|0)+Math.imul(m,ut)|0,o=o+Math.imul(m,ht)|0;var Mt=(h+(n=n+Math.imul(f,ft)|0)|0)+((8191&(i=(i=i+Math.imul(f,lt)|0)+Math.imul(l,ft)|0))<<13)|0;h=((o=o+Math.imul(l,lt)|0)+(i>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,n=Math.imul(D,z),i=(i=Math.imul(D,q))+Math.imul(U,z)|0,o=Math.imul(U,q),n=n+Math.imul(C,K)|0,i=(i=i+Math.imul(C,G)|0)+Math.imul(L,K)|0,o=o+Math.imul(L,G)|0,n=n+Math.imul(P,W)|0,i=(i=i+Math.imul(P,J)|0)+Math.imul(I,W)|0,o=o+Math.imul(I,J)|0,n=n+Math.imul(R,Y)|0,i=(i=i+Math.imul(R,X)|0)+Math.imul(B,Y)|0,o=o+Math.imul(B,X)|0,n=n+Math.imul(k,Q)|0,i=(i=i+Math.imul(k,tt)|0)+Math.imul(x,Q)|0,o=o+Math.imul(x,tt)|0,n=n+Math.imul(A,rt)|0,i=(i=i+Math.imul(A,nt)|0)+Math.imul(M,rt)|0,o=o+Math.imul(M,nt)|0,n=n+Math.imul(w,ot)|0,i=(i=i+Math.imul(w,st)|0)+Math.imul(_,ot)|0,o=o+Math.imul(_,st)|0,n=n+Math.imul(y,ut)|0,i=(i=i+Math.imul(y,ht)|0)+Math.imul(b,ut)|0,o=o+Math.imul(b,ht)|0,n=n+Math.imul(p,ft)|0,i=(i=i+Math.imul(p,lt)|0)+Math.imul(m,ft)|0,o=o+Math.imul(m,lt)|0;var St=(h+(n=n+Math.imul(f,pt)|0)|0)+((8191&(i=(i=i+Math.imul(f,mt)|0)+Math.imul(l,pt)|0))<<13)|0;h=((o=o+Math.imul(l,mt)|0)+(i>>>13)|0)+(St>>>26)|0,St&=67108863,n=Math.imul(D,K),i=(i=Math.imul(D,G))+Math.imul(U,K)|0,o=Math.imul(U,G),n=n+Math.imul(C,W)|0,i=(i=i+Math.imul(C,J)|0)+Math.imul(L,W)|0,o=o+Math.imul(L,J)|0,n=n+Math.imul(P,Y)|0,i=(i=i+Math.imul(P,X)|0)+Math.imul(I,Y)|0,o=o+Math.imul(I,X)|0,n=n+Math.imul(R,Q)|0,i=(i=i+Math.imul(R,tt)|0)+Math.imul(B,Q)|0,o=o+Math.imul(B,tt)|0,n=n+Math.imul(k,rt)|0,i=(i=i+Math.imul(k,nt)|0)+Math.imul(x,rt)|0,o=o+Math.imul(x,nt)|0,n=n+Math.imul(A,ot)|0,i=(i=i+Math.imul(A,st)|0)+Math.imul(M,ot)|0,o=o+Math.imul(M,st)|0,n=n+Math.imul(w,ut)|0,i=(i=i+Math.imul(w,ht)|0)+Math.imul(_,ut)|0,o=o+Math.imul(_,ht)|0,n=n+Math.imul(y,ft)|0,i=(i=i+Math.imul(y,lt)|0)+Math.imul(b,ft)|0,o=o+Math.imul(b,lt)|0;var kt=(h+(n=n+Math.imul(p,pt)|0)|0)+((8191&(i=(i=i+Math.imul(p,mt)|0)+Math.imul(m,pt)|0))<<13)|0;h=((o=o+Math.imul(m,mt)|0)+(i>>>13)|0)+(kt>>>26)|0,kt&=67108863,n=Math.imul(D,W),i=(i=Math.imul(D,J))+Math.imul(U,W)|0,o=Math.imul(U,J),n=n+Math.imul(C,Y)|0,i=(i=i+Math.imul(C,X)|0)+Math.imul(L,Y)|0,o=o+Math.imul(L,X)|0,n=n+Math.imul(P,Q)|0,i=(i=i+Math.imul(P,tt)|0)+Math.imul(I,Q)|0,o=o+Math.imul(I,tt)|0,n=n+Math.imul(R,rt)|0,i=(i=i+Math.imul(R,nt)|0)+Math.imul(B,rt)|0,o=o+Math.imul(B,nt)|0,n=n+Math.imul(k,ot)|0,i=(i=i+Math.imul(k,st)|0)+Math.imul(x,ot)|0,o=o+Math.imul(x,st)|0,n=n+Math.imul(A,ut)|0,i=(i=i+Math.imul(A,ht)|0)+Math.imul(M,ut)|0,o=o+Math.imul(M,ht)|0,n=n+Math.imul(w,ft)|0,i=(i=i+Math.imul(w,lt)|0)+Math.imul(_,ft)|0,o=o+Math.imul(_,lt)|0;var xt=(h+(n=n+Math.imul(y,pt)|0)|0)+((8191&(i=(i=i+Math.imul(y,mt)|0)+Math.imul(b,pt)|0))<<13)|0;h=((o=o+Math.imul(b,mt)|0)+(i>>>13)|0)+(xt>>>26)|0,xt&=67108863,n=Math.imul(D,Y),i=(i=Math.imul(D,X))+Math.imul(U,Y)|0,o=Math.imul(U,X),n=n+Math.imul(C,Q)|0,i=(i=i+Math.imul(C,tt)|0)+Math.imul(L,Q)|0,o=o+Math.imul(L,tt)|0,n=n+Math.imul(P,rt)|0,i=(i=i+Math.imul(P,nt)|0)+Math.imul(I,rt)|0,o=o+Math.imul(I,nt)|0,n=n+Math.imul(R,ot)|0,i=(i=i+Math.imul(R,st)|0)+Math.imul(B,ot)|0,o=o+Math.imul(B,st)|0,n=n+Math.imul(k,ut)|0,i=(i=i+Math.imul(k,ht)|0)+Math.imul(x,ut)|0,o=o+Math.imul(x,ht)|0,n=n+Math.imul(A,ft)|0,i=(i=i+Math.imul(A,lt)|0)+Math.imul(M,ft)|0,o=o+Math.imul(M,lt)|0;var Tt=(h+(n=n+Math.imul(w,pt)|0)|0)+((8191&(i=(i=i+Math.imul(w,mt)|0)+Math.imul(_,pt)|0))<<13)|0;h=((o=o+Math.imul(_,mt)|0)+(i>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,n=Math.imul(D,Q),i=(i=Math.imul(D,tt))+Math.imul(U,Q)|0,o=Math.imul(U,tt),n=n+Math.imul(C,rt)|0,i=(i=i+Math.imul(C,nt)|0)+Math.imul(L,rt)|0,o=o+Math.imul(L,nt)|0,n=n+Math.imul(P,ot)|0,i=(i=i+Math.imul(P,st)|0)+Math.imul(I,ot)|0,o=o+Math.imul(I,st)|0,n=n+Math.imul(R,ut)|0,i=(i=i+Math.imul(R,ht)|0)+Math.imul(B,ut)|0,o=o+Math.imul(B,ht)|0,n=n+Math.imul(k,ft)|0,i=(i=i+Math.imul(k,lt)|0)+Math.imul(x,ft)|0,o=o+Math.imul(x,lt)|0;var Rt=(h+(n=n+Math.imul(A,pt)|0)|0)+((8191&(i=(i=i+Math.imul(A,mt)|0)+Math.imul(M,pt)|0))<<13)|0;h=((o=o+Math.imul(M,mt)|0)+(i>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,n=Math.imul(D,rt),i=(i=Math.imul(D,nt))+Math.imul(U,rt)|0,o=Math.imul(U,nt),n=n+Math.imul(C,ot)|0,i=(i=i+Math.imul(C,st)|0)+Math.imul(L,ot)|0,o=o+Math.imul(L,st)|0,n=n+Math.imul(P,ut)|0,i=(i=i+Math.imul(P,ht)|0)+Math.imul(I,ut)|0,o=o+Math.imul(I,ht)|0,n=n+Math.imul(R,ft)|0,i=(i=i+Math.imul(R,lt)|0)+Math.imul(B,ft)|0,o=o+Math.imul(B,lt)|0;var Bt=(h+(n=n+Math.imul(k,pt)|0)|0)+((8191&(i=(i=i+Math.imul(k,mt)|0)+Math.imul(x,pt)|0))<<13)|0;h=((o=o+Math.imul(x,mt)|0)+(i>>>13)|0)+(Bt>>>26)|0,Bt&=67108863,n=Math.imul(D,ot),i=(i=Math.imul(D,st))+Math.imul(U,ot)|0,o=Math.imul(U,st),n=n+Math.imul(C,ut)|0,i=(i=i+Math.imul(C,ht)|0)+Math.imul(L,ut)|0,o=o+Math.imul(L,ht)|0,n=n+Math.imul(P,ft)|0,i=(i=i+Math.imul(P,lt)|0)+Math.imul(I,ft)|0,o=o+Math.imul(I,lt)|0;var Nt=(h+(n=n+Math.imul(R,pt)|0)|0)+((8191&(i=(i=i+Math.imul(R,mt)|0)+Math.imul(B,pt)|0))<<13)|0;h=((o=o+Math.imul(B,mt)|0)+(i>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,n=Math.imul(D,ut),i=(i=Math.imul(D,ht))+Math.imul(U,ut)|0,o=Math.imul(U,ht),n=n+Math.imul(C,ft)|0,i=(i=i+Math.imul(C,lt)|0)+Math.imul(L,ft)|0,o=o+Math.imul(L,lt)|0;var Pt=(h+(n=n+Math.imul(P,pt)|0)|0)+((8191&(i=(i=i+Math.imul(P,mt)|0)+Math.imul(I,pt)|0))<<13)|0;h=((o=o+Math.imul(I,mt)|0)+(i>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,n=Math.imul(D,ft),i=(i=Math.imul(D,lt))+Math.imul(U,ft)|0,o=Math.imul(U,lt);var It=(h+(n=n+Math.imul(C,pt)|0)|0)+((8191&(i=(i=i+Math.imul(C,mt)|0)+Math.imul(L,pt)|0))<<13)|0;h=((o=o+Math.imul(L,mt)|0)+(i>>>13)|0)+(It>>>26)|0,It&=67108863;var Ot=(h+(n=Math.imul(D,pt))|0)+((8191&(i=(i=Math.imul(D,mt))+Math.imul(U,pt)|0))<<13)|0;return h=((o=Math.imul(U,mt))+(i>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,u[0]=gt,u[1]=yt,u[2]=bt,u[3]=vt,u[4]=wt,u[5]=_t,u[6]=Et,u[7]=At,u[8]=Mt,u[9]=St,u[10]=kt,u[11]=xt,u[12]=Tt,u[13]=Rt,u[14]=Bt,u[15]=Nt,u[16]=Pt,u[17]=It,u[18]=Ot,0!==h&&(u[19]=h,r.length++),r};function p(t,e,r){return(new m).mulp(t,e,r)}function m(t,e){this.x=t,this.y=e}Math.imul||(d=l),i.prototype.mulTo=function(t,e){var r,n=this.length+t.length;return r=10===this.length&&10===t.length?d(this,t,e):n<63?l(this,t,e):n<1024?function(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var n=0,i=0,o=0;o<r.length-1;o++){var s=i;i=0;for(var a=67108863&n,u=Math.min(o,e.length-1),h=Math.max(0,o-t.length+1);h<=u;h++){var c=o-h,f=(0|t.words[c])*(0|e.words[h]),l=67108863&f;a=67108863&(l=l+a|0),i+=(s=(s=s+(f/67108864|0)|0)+(l>>>26)|0)>>>26,s&=67108863}r.words[o]=a,n=s,s=i}return 0!==n?r.words[o]=n:r.length--,r.strip()}(this,t,e):p(this,t,e),r},m.prototype.makeRBT=function(t){for(var e=new Array(t),r=i.prototype._countBits(t)-1,n=0;n<t;n++)e[n]=this.revBin(n,r,t);return e},m.prototype.revBin=function(t,e,r){if(0===t||t===r-1)return t;for(var n=0,i=0;i<e;i++)n|=(1&t)<<e-i-1,t>>=1;return n},m.prototype.permute=function(t,e,r,n,i,o){for(var s=0;s<o;s++)n[s]=e[t[s]],i[s]=r[t[s]]},m.prototype.transform=function(t,e,r,n,i,o){this.permute(o,t,e,r,n,i);for(var s=1;s<i;s<<=1)for(var a=s<<1,u=Math.cos(2*Math.PI/a),h=Math.sin(2*Math.PI/a),c=0;c<i;c+=a)for(var f=u,l=h,d=0;d<s;d++){var p=r[c+d],m=n[c+d],g=r[c+d+s],y=n[c+d+s],b=f*g-l*y;y=f*y+l*g,g=b,r[c+d]=p+g,n[c+d]=m+y,r[c+d+s]=p-g,n[c+d+s]=m-y,d!==a&&(b=u*f-h*l,l=u*l+h*f,f=b)}},m.prototype.guessLen13b=function(t,e){var r=1|Math.max(e,t),n=1&r,i=0;for(r=r/2|0;r;r>>>=1)i++;return 1<<i+1+n},m.prototype.conjugate=function(t,e,r){if(!(r<=1))for(var n=0;n<r/2;n++){var i=t[n];t[n]=t[r-n-1],t[r-n-1]=i,i=e[n],e[n]=-e[r-n-1],e[r-n-1]=-i}},m.prototype.normalize13b=function(t,e){for(var r=0,n=0;n<e/2;n++){var i=8192*Math.round(t[2*n+1]/e)+Math.round(t[2*n]/e)+r;t[n]=67108863&i,r=i<67108864?0:i/67108864|0}return t},m.prototype.convert13b=function(t,e,n,i){for(var o=0,s=0;s<e;s++)o+=0|t[s],n[2*s]=8191&o,o>>>=13,n[2*s+1]=8191&o,o>>>=13;for(s=2*e;s<i;++s)n[s]=0;r(0===o),r(!(-8192&o))},m.prototype.stub=function(t){for(var e=new Array(t),r=0;r<t;r++)e[r]=0;return e},m.prototype.mulp=function(t,e,r){var n=2*this.guessLen13b(t.length,e.length),i=this.makeRBT(n),o=this.stub(n),s=new Array(n),a=new Array(n),u=new Array(n),h=new Array(n),c=new Array(n),f=new Array(n),l=r.words;l.length=n,this.convert13b(t.words,t.length,s,n),this.convert13b(e.words,e.length,h,n),this.transform(s,o,a,u,n,i),this.transform(h,o,c,f,n,i);for(var d=0;d<n;d++){var p=a[d]*c[d]-u[d]*f[d];u[d]=a[d]*f[d]+u[d]*c[d],a[d]=p}return this.conjugate(a,u,n),this.transform(a,u,l,o,n,i),this.conjugate(l,o,n),this.normalize13b(l,n),r.negative=t.negative^e.negative,r.length=t.length+e.length,r.strip()},i.prototype.mul=function(t){var e=new i(null);return e.words=new Array(this.length+t.length),this.mulTo(t,e)},i.prototype.mulf=function(t){var e=new i(null);return e.words=new Array(this.length+t.length),p(this,t,e)},i.prototype.imul=function(t){return this.clone().mulTo(t,this)},i.prototype.imuln=function(t){r("number"==typeof t),r(t<67108864);for(var e=0,n=0;n<this.length;n++){var i=(0|this.words[n])*t,o=(67108863&i)+(67108863&e);e>>=26,e+=i/67108864|0,e+=o>>>26,this.words[n]=67108863&o}return 0!==e&&(this.words[n]=e,this.length++),this.length=0===t?1:this.length,this},i.prototype.muln=function(t){return this.clone().imuln(t)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.imul(this.clone())},i.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r<e.length;r++){var n=r/26|0,i=r%26;e[r]=(t.words[n]&1<<i)>>>i}return e}(t);if(0===e.length)return new i(1);for(var r=this,n=0;n<e.length&&0===e[n];n++,r=r.sqr());if(++n<e.length)for(var o=r.sqr();n<e.length;n++,o=o.sqr())0!==e[n]&&(r=r.mul(o));return r},i.prototype.iushln=function(t){r("number"==typeof t&&t>=0);var e,n=t%26,i=(t-n)/26,o=67108863>>>26-n<<26-n;if(0!==n){var s=0;for(e=0;e<this.length;e++){var a=this.words[e]&o,u=(0|this.words[e])-a<<n;this.words[e]=u|s,s=a>>>26-n}s&&(this.words[e]=s,this.length++)}if(0!==i){for(e=this.length-1;e>=0;e--)this.words[e+i]=this.words[e];for(e=0;e<i;e++)this.words[e]=0;this.length+=i}return this.strip()},i.prototype.ishln=function(t){return r(0===this.negative),this.iushln(t)},i.prototype.iushrn=function(t,e,n){var i;r("number"==typeof t&&t>=0),i=e?(e-e%26)/26:0;var o=t%26,s=Math.min((t-o)/26,this.length),a=67108863^67108863>>>o<<o,u=n;if(i-=s,i=Math.max(0,i),u){for(var h=0;h<s;h++)u.words[h]=this.words[h];u.length=s}if(0===s);else if(this.length>s)for(this.length-=s,h=0;h<this.length;h++)this.words[h]=this.words[h+s];else this.words[0]=0,this.length=1;var c=0;for(h=this.length-1;h>=0&&(0!==c||h>=i);h--){var f=0|this.words[h];this.words[h]=c<<26-o|f>>>o,c=f&a}return u&&0!==c&&(u.words[u.length++]=c),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},i.prototype.ishrn=function(t,e,n){return r(0===this.negative),this.iushrn(t,e,n)},i.prototype.shln=function(t){return this.clone().ishln(t)},i.prototype.ushln=function(t){return this.clone().iushln(t)},i.prototype.shrn=function(t){return this.clone().ishrn(t)},i.prototype.ushrn=function(t){return this.clone().iushrn(t)},i.prototype.testn=function(t){r("number"==typeof t&&t>=0);var e=t%26,n=(t-e)/26,i=1<<e;return!(this.length<=n)&&!!(this.words[n]&i)},i.prototype.imaskn=function(t){r("number"==typeof t&&t>=0);var e=t%26,n=(t-e)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=n)return this;if(0!==e&&n++,this.length=Math.min(n,this.length),0!==e){var i=67108863^67108863>>>e<<e;this.words[this.length-1]&=i}return this.strip()},i.prototype.maskn=function(t){return this.clone().imaskn(t)},i.prototype.iaddn=function(t){return r("number"==typeof t),r(t<67108864),t<0?this.isubn(-t):0!==this.negative?1===this.length&&(0|this.words[0])<t?(this.words[0]=t-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(t),this.negative=1,this):this._iaddn(t)},i.prototype._iaddn=function(t){this.words[0]+=t;for(var e=0;e<this.length&&this.words[e]>=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},i.prototype.isubn=function(t){if(r("number"==typeof t),r(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e<this.length&&this.words[e]<0;e++)this.words[e]+=67108864,this.words[e+1]-=1;return this.strip()},i.prototype.addn=function(t){return this.clone().iaddn(t)},i.prototype.subn=function(t){return this.clone().isubn(t)},i.prototype.iabs=function(){return this.negative=0,this},i.prototype.abs=function(){return this.clone().iabs()},i.prototype._ishlnsubmul=function(t,e,n){var i,o,s=t.length+n;this._expand(s);var a=0;for(i=0;i<t.length;i++){o=(0|this.words[i+n])+a;var u=(0|t.words[i])*e;a=((o-=67108863&u)>>26)-(u/67108864|0),this.words[i+n]=67108863&o}for(;i<this.length-n;i++)a=(o=(0|this.words[i+n])+a)>>26,this.words[i+n]=67108863&o;if(0===a)return this.strip();for(r(-1===a),a=0,i=0;i<this.length;i++)a=(o=-(0|this.words[i])+a)>>26,this.words[i]=67108863&o;return this.negative=1,this.strip()},i.prototype._wordDiv=function(t,e){var r=(this.length,t.length),n=this.clone(),o=t,s=0|o.words[o.length-1];0!==(r=26-this._countBits(s))&&(o=o.ushln(r),n.iushln(r),s=0|o.words[o.length-1]);var a,u=n.length-o.length;if("mod"!==e){(a=new i(null)).length=u+1,a.words=new Array(a.length);for(var h=0;h<a.length;h++)a.words[h]=0}var c=n.clone()._ishlnsubmul(o,1,u);0===c.negative&&(n=c,a&&(a.words[u]=1));for(var f=u-1;f>=0;f--){var l=67108864*(0|n.words[o.length+f])+(0|n.words[o.length+f-1]);for(l=Math.min(l/s|0,67108863),n._ishlnsubmul(o,l,f);0!==n.negative;)l--,n.negative=0,n._ishlnsubmul(o,1,f),n.isZero()||(n.negative^=1);a&&(a.words[f]=l)}return a&&a.strip(),n.strip(),"div"!==e&&0!==r&&n.iushrn(r),{div:a||null,mod:n}},i.prototype.divmod=function(t,e,n){return r(!t.isZero()),this.isZero()?{div:new i(0),mod:new i(0)}:0!==this.negative&&0===t.negative?(a=this.neg().divmod(t,e),"mod"!==e&&(o=a.div.neg()),"div"!==e&&(s=a.mod.neg(),n&&0!==s.negative&&s.iadd(t)),{div:o,mod:s}):0===this.negative&&0!==t.negative?(a=this.divmod(t.neg(),e),"mod"!==e&&(o=a.div.neg()),{div:o,mod:a.mod}):0!==(this.negative&t.negative)?(a=this.neg().divmod(t.neg(),e),"div"!==e&&(s=a.mod.neg(),n&&0!==s.negative&&s.isub(t)),{div:a.div,mod:s}):t.length>this.length||this.cmp(t)<0?{div:new i(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new i(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new i(this.modn(t.words[0]))}:this._wordDiv(t,e);var o,s,a},i.prototype.div=function(t){return this.divmod(t,"div",!1).div},i.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},i.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},i.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,n=t.ushrn(1),i=t.andln(1),o=r.cmp(n);return o<0||1===i&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},i.prototype.modn=function(t){r(t<=67108863);for(var e=(1<<26)%t,n=0,i=this.length-1;i>=0;i--)n=(e*n+(0|this.words[i]))%t;return n},i.prototype.idivn=function(t){r(t<=67108863);for(var e=0,n=this.length-1;n>=0;n--){var i=(0|this.words[n])+67108864*e;this.words[n]=i/t|0,e=i%t}return this.strip()},i.prototype.divn=function(t){return this.clone().idivn(t)},i.prototype.egcd=function(t){r(0===t.negative),r(!t.isZero());var e=this,n=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var o=new i(1),s=new i(0),a=new i(0),u=new i(1),h=0;e.isEven()&&n.isEven();)e.iushrn(1),n.iushrn(1),++h;for(var c=n.clone(),f=e.clone();!e.isZero();){for(var l=0,d=1;0===(e.words[0]&d)&&l<26;++l,d<<=1);if(l>0)for(e.iushrn(l);l-- >0;)(o.isOdd()||s.isOdd())&&(o.iadd(c),s.isub(f)),o.iushrn(1),s.iushrn(1);for(var p=0,m=1;0===(n.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(n.iushrn(p);p-- >0;)(a.isOdd()||u.isOdd())&&(a.iadd(c),u.isub(f)),a.iushrn(1),u.iushrn(1);e.cmp(n)>=0?(e.isub(n),o.isub(a),s.isub(u)):(n.isub(e),a.isub(o),u.isub(s))}return{a:a,b:u,gcd:n.iushln(h)}},i.prototype._invmp=function(t){r(0===t.negative),r(!t.isZero());var e=this,n=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var o,s=new i(1),a=new i(0),u=n.clone();e.cmpn(1)>0&&n.cmpn(1)>0;){for(var h=0,c=1;0===(e.words[0]&c)&&h<26;++h,c<<=1);if(h>0)for(e.iushrn(h);h-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);for(var f=0,l=1;0===(n.words[0]&l)&&f<26;++f,l<<=1);if(f>0)for(n.iushrn(f);f-- >0;)a.isOdd()&&a.iadd(u),a.iushrn(1);e.cmp(n)>=0?(e.isub(n),s.isub(a)):(n.isub(e),a.isub(s))}return(o=0===e.cmpn(1)?s:a).cmpn(0)<0&&o.iadd(t),o},i.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var n=0;e.isEven()&&r.isEven();n++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var i=e.cmp(r);if(i<0){var o=e;e=r,r=o}else if(0===i||0===r.cmpn(1))break;e.isub(r)}return r.iushln(n)},i.prototype.invm=function(t){return this.egcd(t).a.umod(t)},i.prototype.isEven=function(){return!(1&this.words[0])},i.prototype.isOdd=function(){return!(1&~this.words[0])},i.prototype.andln=function(t){return this.words[0]&t},i.prototype.bincn=function(t){r("number"==typeof t);var e=t%26,n=(t-e)/26,i=1<<e;if(this.length<=n)return this._expand(n+1),this.words[n]|=i,this;for(var o=i,s=n;0!==o&&s<this.length;s++){var a=0|this.words[s];o=(a+=o)>>>26,a&=67108863,this.words[s]=a}return 0!==o&&(this.words[s]=o,this.length++),this},i.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},i.prototype.cmpn=function(t){var e,n=t<0;if(0!==this.negative&&!n)return-1;if(0===this.negative&&n)return 1;if(this.strip(),this.length>1)e=1;else{n&&(t=-t),r(t<=67108863,"Number is too big");var i=0|this.words[0];e=i===t?0:i<t?-1:1}return 0!==this.negative?0|-e:e},i.prototype.cmp=function(t){if(0!==this.negative&&0===t.negative)return-1;if(0===this.negative&&0!==t.negative)return 1;var e=this.ucmp(t);return 0!==this.negative?0|-e:e},i.prototype.ucmp=function(t){if(this.length>t.length)return 1;if(this.length<t.length)return-1;for(var e=0,r=this.length-1;r>=0;r--){var n=0|this.words[r],i=0|t.words[r];if(n!==i){n<i?e=-1:n>i&&(e=1);break}}return e},i.prototype.gtn=function(t){return 1===this.cmpn(t)},i.prototype.gt=function(t){return 1===this.cmp(t)},i.prototype.gten=function(t){return this.cmpn(t)>=0},i.prototype.gte=function(t){return this.cmp(t)>=0},i.prototype.ltn=function(t){return-1===this.cmpn(t)},i.prototype.lt=function(t){return-1===this.cmp(t)},i.prototype.lten=function(t){return this.cmpn(t)<=0},i.prototype.lte=function(t){return this.cmp(t)<=0},i.prototype.eqn=function(t){return 0===this.cmpn(t)},i.prototype.eq=function(t){return 0===this.cmp(t)},i.red=function(t){return new E(t)},i.prototype.toRed=function(t){return r(!this.red,"Already a number in reduction context"),r(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},i.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function(t){return this.red=t,this},i.prototype.forceRed=function(t){return r(!this.red,"Already a number in reduction context"),this._forceRed(t)},i.prototype.redAdd=function(t){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},i.prototype.redIAdd=function(t){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},i.prototype.redSub=function(t){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},i.prototype.redISub=function(t){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},i.prototype.redShl=function(t){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},i.prototype.redMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},i.prototype.redIMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},i.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(t){return r(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var g={k256:null,p224:null,p192:null,p25519:null};function y(t,e){this.name=t,this.p=new i(e,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function b(){y.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function v(){y.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function w(){y.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function _(){y.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function E(t){if("string"==typeof t){var e=i._prime(t);this.m=e.p,this.prime=e}else r(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function A(t){E.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new i(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}y.prototype._tmp=function(){var t=new i(null);return t.words=new Array(Math.ceil(this.n/13)),t},y.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(e>this.n);var n=e<this.n?-1:r.ucmp(this.p);return 0===n?(r.words[0]=0,r.length=1):n>0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},y.prototype.split=function(t,e){t.iushrn(this.n,0,e)},y.prototype.imulK=function(t){return t.imul(this.k)},n(b,y),b.prototype.split=function(t,e){for(var r=4194303,n=Math.min(t.length,9),i=0;i<n;i++)e.words[i]=t.words[i];if(e.length=n,t.length<=9)return t.words[0]=0,void(t.length=1);var o=t.words[9];for(e.words[e.length++]=o&r,i=10;i<t.length;i++){var s=0|t.words[i];t.words[i-10]=(s&r)<<4|o>>>22,o=s}o>>>=22,t.words[i-10]=o,0===o&&t.length>10?t.length-=10:t.length-=9},b.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r<t.length;r++){var n=0|t.words[r];e+=977*n,t.words[r]=67108863&e,e=64*n+(e/67108864|0)}return 0===t.words[t.length-1]&&(t.length--,0===t.words[t.length-1]&&t.length--),t},n(v,y),n(w,y),n(_,y),_.prototype.imulK=function(t){for(var e=0,r=0;r<t.length;r++){var n=19*(0|t.words[r])+e,i=67108863&n;n>>>=26,t.words[r]=i,e=n}return 0!==e&&(t.words[t.length++]=e),t},i._prime=function(t){if(g[t])return g[t];var e;if("k256"===t)e=new b;else if("p224"===t)e=new v;else if("p192"===t)e=new w;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new _}return g[t]=e,e},E.prototype._verify1=function(t){r(0===t.negative,"red works only with positives"),r(t.red,"red works only with red numbers")},E.prototype._verify2=function(t,e){r(0===(t.negative|e.negative),"red works only with positives"),r(t.red&&t.red===e.red,"red works only with red numbers")},E.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},E.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},E.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},E.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},E.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},E.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},E.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},E.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},E.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},E.prototype.isqr=function(t){return this.imul(t,t.clone())},E.prototype.sqr=function(t){return this.mul(t,t)},E.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(r(e%2==1),3===e){var n=this.m.add(new i(1)).iushrn(2);return this.pow(t,n)}for(var o=this.m.subn(1),s=0;!o.isZero()&&0===o.andln(1);)s++,o.iushrn(1);r(!o.isZero());var a=new i(1).toRed(this),u=a.redNeg(),h=this.m.subn(1).iushrn(1),c=this.m.bitLength();for(c=new i(2*c*c).toRed(this);0!==this.pow(c,h).cmp(u);)c.redIAdd(u);for(var f=this.pow(c,o),l=this.pow(t,o.addn(1).iushrn(1)),d=this.pow(t,o),p=s;0!==d.cmp(a);){for(var m=d,g=0;0!==m.cmp(a);g++)m=m.redSqr();r(g<p);var y=this.pow(f,new i(1).iushln(p-g-1));l=l.redMul(y),f=y.redSqr(),d=d.redMul(f),p=g}return l},E.prototype.invm=function(t){var e=t._invmp(this.m);return 0!==e.negative?(e.negative=0,this.imod(e).redNeg()):this.imod(e)},E.prototype.pow=function(t,e){if(e.isZero())return new i(1).toRed(this);if(0===e.cmpn(1))return t.clone();var r=new Array(16);r[0]=new i(1).toRed(this),r[1]=t;for(var n=2;n<r.length;n++)r[n]=this.mul(r[n-1],t);var o=r[0],s=0,a=0,u=e.bitLength()%26;for(0===u&&(u=26),n=e.length-1;n>=0;n--){for(var h=e.words[n],c=u-1;c>=0;c--){var f=h>>c&1;o!==r[0]&&(o=this.sqr(o)),0!==f||0!==s?(s<<=1,s|=f,(4===++a||0===n&&0===c)&&(o=this.mul(o,r[s]),a=0,s=0)):a=0}u=26}return o},E.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},E.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},i.mont=function(t){return new A(t)},n(A,E),A.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},A.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},A.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},A.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new i(0)._forceRed(this);var r=t.mul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=r.isub(n).iushrn(this.shift),s=o;return o.cmp(this.m)>=0?s=o.isub(this.m):o.cmpn(0)<0&&(s=o.iadd(this.m)),s._forceRed(this)},A.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t,e)}(dd);var pd=dd.exports,md={};!function(t){var e=t;function r(t){return 1===t.length?"0"+t:t}function n(t){for(var e="",n=0;n<t.length;n++)e+=r(t[n].toString(16));return e}e.toArray=function(t,e){if(Array.isArray(t))return t.slice();if(!t)return[];var r=[];if("string"!=typeof t){for(var n=0;n<t.length;n++)r[n]=0|t[n];return r}if("hex"===e){(t=t.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(t="0"+t);for(n=0;n<t.length;n+=2)r.push(parseInt(t[n]+t[n+1],16))}else for(n=0;n<t.length;n++){var i=t.charCodeAt(n),o=i>>8,s=255&i;o?r.push(o,s):r.push(s)}return r},e.zero2=r,e.toHex=n,e.encode=function(t,e){return"hex"===e?n(t):t}}(md),function(t){var e=t,r=pd,n=Qn,i=md;e.assert=n,e.toArray=i.toArray,e.zero2=i.zero2,e.toHex=i.toHex,e.encode=i.encode,e.getNAF=function(t,e,r){var n,i=new Array(Math.max(t.bitLength(),r)+1);for(n=0;n<i.length;n+=1)i[n]=0;var o=1<<e+1,s=t.clone();for(n=0;n<i.length;n++){var a,u=s.andln(o-1);s.isOdd()?(a=u>(o>>1)-1?(o>>1)-u:u,s.isubn(a)):a=0,i[n]=a,s.iushrn(1)}return i},e.getJSF=function(t,e){var r=[[],[]];t=t.clone(),e=e.clone();for(var n,i=0,o=0;t.cmpn(-i)>0||e.cmpn(-o)>0;){var s,a,u=t.andln(3)+i&3,h=e.andln(3)+o&3;3===u&&(u=-1),3===h&&(h=-1),s=1&u?3!==(n=t.andln(7)+i&7)&&5!==n||2!==h?u:-u:0,r[0].push(s),a=1&h?3!==(n=e.andln(7)+o&7)&&5!==n||2!==u?h:-h:0,r[1].push(a),2*i===s+1&&(i=1-i),2*o===a+1&&(o=1-o),t.iushrn(1),e.iushrn(1)}return r},e.cachedProperty=function(t,e,r){var n="_"+e;t.prototype[e]=function(){return void 0!==this[n]?this[n]:this[n]=r.call(this)}},e.parseBytes=function(t){return"string"==typeof t?e.toArray(t,"hex"):t},e.intFromLE=function(t){return new r(t,"hex","le")}}(ld);var gd,yd={exports:{}};function bd(t){this.rand=t}if(yd.exports=function(t){return gd||(gd=new bd(null)),gd.generate(t)},yd.exports.Rand=bd,bd.prototype.generate=function(t){return this._rand(t)},bd.prototype._rand=function(t){if(this.rand.getBytes)return this.rand.getBytes(t);for(var e=new Uint8Array(t),r=0;r<e.length;r++)e[r]=this.rand.getByte();return e},"object"==typeof self)self.crypto&&self.crypto.getRandomValues?bd.prototype._rand=function(t){var e=new Uint8Array(t);return self.crypto.getRandomValues(e),e}:self.msCrypto&&self.msCrypto.getRandomValues?bd.prototype._rand=function(t){var e=new Uint8Array(t);return self.msCrypto.getRandomValues(e),e}:"object"==typeof window&&(bd.prototype._rand=function(){throw new Error("Not implemented yet")});else try{var vd=Ul;if("function"!=typeof vd.randomBytes)throw new Error("Not supported");bd.prototype._rand=function(t){return vd.randomBytes(t)}}catch(t){}var wd=yd.exports,_d={},Ed=pd,Ad=ld,Md=Ad.getNAF,Sd=Ad.getJSF,kd=Ad.assert;function xd(t,e){this.type=t,this.p=new Ed(e.p,16),this.red=e.prime?Ed.red(e.prime):Ed.mont(this.p),this.zero=new Ed(0).toRed(this.red),this.one=new Ed(1).toRed(this.red),this.two=new Ed(2).toRed(this.red),this.n=e.n&&new Ed(e.n,16),this.g=e.g&&this.pointFromJSON(e.g,e.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var r=this.n&&this.p.div(this.n);!r||r.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var Td=xd;function Rd(t,e){this.curve=t,this.type=e,this.precomputed=null}xd.prototype.point=function(){throw new Error("Not implemented")},xd.prototype.validate=function(){throw new Error("Not implemented")},xd.prototype._fixedNafMul=function(t,e){kd(t.precomputed);var r=t._getDoubles(),n=Md(e,1,this._bitLength),i=(1<<r.step+1)-(r.step%2==0?2:1);i/=3;var o,s,a=[];for(o=0;o<n.length;o+=r.step){s=0;for(var u=o+r.step-1;u>=o;u--)s=(s<<1)+n[u];a.push(s)}for(var h=this.jpoint(null,null,null),c=this.jpoint(null,null,null),f=i;f>0;f--){for(o=0;o<a.length;o++)(s=a[o])===f?c=c.mixedAdd(r.points[o]):s===-f&&(c=c.mixedAdd(r.points[o].neg()));h=h.add(c)}return h.toP()},xd.prototype._wnafMul=function(t,e){var r=4,n=t._getNAFPoints(r);r=n.wnd;for(var i=n.points,o=Md(e,r,this._bitLength),s=this.jpoint(null,null,null),a=o.length-1;a>=0;a--){for(var u=0;a>=0&&0===o[a];a--)u++;if(a>=0&&u++,s=s.dblp(u),a<0)break;var h=o[a];kd(0!==h),s="affine"===t.type?h>0?s.mixedAdd(i[h-1>>1]):s.mixedAdd(i[-h-1>>1].neg()):h>0?s.add(i[h-1>>1]):s.add(i[-h-1>>1].neg())}return"affine"===t.type?s.toP():s},xd.prototype._wnafMulAdd=function(t,e,r,n,i){var o,s,a,u=this._wnafT1,h=this._wnafT2,c=this._wnafT3,f=0;for(o=0;o<n;o++){var l=(a=e[o])._getNAFPoints(t);u[o]=l.wnd,h[o]=l.points}for(o=n-1;o>=1;o-=2){var d=o-1,p=o;if(1===u[d]&&1===u[p]){var m=[e[d],null,null,e[p]];0===e[d].y.cmp(e[p].y)?(m[1]=e[d].add(e[p]),m[2]=e[d].toJ().mixedAdd(e[p].neg())):0===e[d].y.cmp(e[p].y.redNeg())?(m[1]=e[d].toJ().mixedAdd(e[p]),m[2]=e[d].add(e[p].neg())):(m[1]=e[d].toJ().mixedAdd(e[p]),m[2]=e[d].toJ().mixedAdd(e[p].neg()));var g=[-3,-1,-5,-7,0,7,5,1,3],y=Sd(r[d],r[p]);for(f=Math.max(y[0].length,f),c[d]=new Array(f),c[p]=new Array(f),s=0;s<f;s++){var b=0|y[0][s],v=0|y[1][s];c[d][s]=g[3*(b+1)+(v+1)],c[p][s]=0,h[d]=m}}else c[d]=Md(r[d],u[d],this._bitLength),c[p]=Md(r[p],u[p],this._bitLength),f=Math.max(c[d].length,f),f=Math.max(c[p].length,f)}var w=this.jpoint(null,null,null),_=this._wnafT4;for(o=f;o>=0;o--){for(var E=0;o>=0;){var A=!0;for(s=0;s<n;s++)_[s]=0|c[s][o],0!==_[s]&&(A=!1);if(!A)break;E++,o--}if(o>=0&&E++,w=w.dblp(E),o<0)break;for(s=0;s<n;s++){var M=_[s];0!==M&&(M>0?a=h[s][M-1>>1]:M<0&&(a=h[s][-M-1>>1].neg()),w="affine"===a.type?w.mixedAdd(a):w.add(a))}}for(o=0;o<n;o++)h[o]=null;return i?w:w.toP()},xd.BasePoint=Rd,Rd.prototype.eq=function(){throw new Error("Not implemented")},Rd.prototype.validate=function(){return this.curve.validate(this)},xd.prototype.decodePoint=function(t,e){t=Ad.toArray(t,e);var r=this.p.byteLength();if((4===t[0]||6===t[0]||7===t[0])&&t.length-1==2*r)return 6===t[0]?kd(t[t.length-1]%2==0):7===t[0]&&kd(t[t.length-1]%2==1),this.point(t.slice(1,1+r),t.slice(1+r,1+2*r));if((2===t[0]||3===t[0])&&t.length-1===r)return this.pointFromX(t.slice(1,1+r),3===t[0]);throw new Error("Unknown point format")},Rd.prototype.encodeCompressed=function(t){return this.encode(t,!0)},Rd.prototype._encode=function(t){var e=this.curve.p.byteLength(),r=this.getX().toArray("be",e);return t?[this.getY().isEven()?2:3].concat(r):[4].concat(r,this.getY().toArray("be",e))},Rd.prototype.encode=function(t,e){return Ad.encode(this._encode(e),t)},Rd.prototype.precompute=function(t){if(this.precomputed)return this;var e={doubles:null,naf:null,beta:null};return e.naf=this._getNAFPoints(8),e.doubles=this._getDoubles(4,t),e.beta=this._getBeta(),this.precomputed=e,this},Rd.prototype._hasDoubles=function(t){if(!this.precomputed)return!1;var e=this.precomputed.doubles;return!!e&&e.points.length>=Math.ceil((t.bitLength()+1)/e.step)},Rd.prototype._getDoubles=function(t,e){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var r=[this],n=this,i=0;i<e;i+=t){for(var o=0;o<t;o++)n=n.dbl();r.push(n)}return{step:t,points:r}},Rd.prototype._getNAFPoints=function(t){if(this.precomputed&&this.precomputed.naf)return this.precomputed.naf;for(var e=[this],r=(1<<t)-1,n=1===r?null:this.dbl(),i=1;i<r;i++)e[i]=e[i-1].add(n);return{wnd:t,points:e}},Rd.prototype._getBeta=function(){return null},Rd.prototype.dblp=function(t){for(var e=this,r=0;r<t;r++)e=e.dbl();return e};var Bd=pd,Nd=ri,Pd=Td,Id=ld.assert;function Od(t){Pd.call(this,"short",t),this.a=new Bd(t.a,16).toRed(this.red),this.b=new Bd(t.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=0===this.a.fromRed().cmpn(0),this.threeA=0===this.a.fromRed().sub(this.p).cmpn(-3),this.endo=this._getEndomorphism(t),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}Nd(Od,Pd);var Cd=Od;function Ld(t,e,r,n){Pd.BasePoint.call(this,t,"affine"),null===e&&null===r?(this.x=null,this.y=null,this.inf=!0):(this.x=new Bd(e,16),this.y=new Bd(r,16),n&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.inf=!1)}function jd(t,e,r,n){Pd.BasePoint.call(this,t,"jacobian"),null===e&&null===r&&null===n?(this.x=this.curve.one,this.y=this.curve.one,this.z=new Bd(0)):(this.x=new Bd(e,16),this.y=new Bd(r,16),this.z=new Bd(n,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}Od.prototype._getEndomorphism=function(t){if(this.zeroA&&this.g&&this.n&&1===this.p.modn(3)){var e,r;if(t.beta)e=new Bd(t.beta,16).toRed(this.red);else{var n=this._getEndoRoots(this.p);e=(e=n[0].cmp(n[1])<0?n[0]:n[1]).toRed(this.red)}if(t.lambda)r=new Bd(t.lambda,16);else{var i=this._getEndoRoots(this.n);0===this.g.mul(i[0]).x.cmp(this.g.x.redMul(e))?r=i[0]:(r=i[1],Id(0===this.g.mul(r).x.cmp(this.g.x.redMul(e))))}return{beta:e,lambda:r,basis:t.basis?t.basis.map(function(t){return{a:new Bd(t.a,16),b:new Bd(t.b,16)}}):this._getEndoBasis(r)}}},Od.prototype._getEndoRoots=function(t){var e=t===this.p?this.red:Bd.mont(t),r=new Bd(2).toRed(e).redInvm(),n=r.redNeg(),i=new Bd(3).toRed(e).redNeg().redSqrt().redMul(r);return[n.redAdd(i).fromRed(),n.redSub(i).fromRed()]},Od.prototype._getEndoBasis=function(t){for(var e,r,n,i,o,s,a,u,h,c=this.n.ushrn(Math.floor(this.n.bitLength()/2)),f=t,l=this.n.clone(),d=new Bd(1),p=new Bd(0),m=new Bd(0),g=new Bd(1),y=0;0!==f.cmpn(0);){var b=l.div(f);u=l.sub(b.mul(f)),h=m.sub(b.mul(d));var v=g.sub(b.mul(p));if(!n&&u.cmp(c)<0)e=a.neg(),r=d,n=u.neg(),i=h;else if(n&&2===++y)break;a=u,l=f,f=u,m=d,d=h,g=p,p=v}o=u.neg(),s=h;var w=n.sqr().add(i.sqr());return o.sqr().add(s.sqr()).cmp(w)>=0&&(o=e,s=r),n.negative&&(n=n.neg(),i=i.neg()),o.negative&&(o=o.neg(),s=s.neg()),[{a:n,b:i},{a:o,b:s}]},Od.prototype._endoSplit=function(t){var e=this.endo.basis,r=e[0],n=e[1],i=n.b.mul(t).divRound(this.n),o=r.b.neg().mul(t).divRound(this.n),s=i.mul(r.a),a=o.mul(n.a),u=i.mul(r.b),h=o.mul(n.b);return{k1:t.sub(s).sub(a),k2:u.add(h).neg()}},Od.prototype.pointFromX=function(t,e){(t=new Bd(t,16)).red||(t=t.toRed(this.red));var r=t.redSqr().redMul(t).redIAdd(t.redMul(this.a)).redIAdd(this.b),n=r.redSqrt();if(0!==n.redSqr().redSub(r).cmp(this.zero))throw new Error("invalid point");var i=n.fromRed().isOdd();return(e&&!i||!e&&i)&&(n=n.redNeg()),this.point(t,n)},Od.prototype.validate=function(t){if(t.inf)return!0;var e=t.x,r=t.y,n=this.a.redMul(e),i=e.redSqr().redMul(e).redIAdd(n).redIAdd(this.b);return 0===r.redSqr().redISub(i).cmpn(0)},Od.prototype._endoWnafMulAdd=function(t,e,r){for(var n=this._endoWnafT1,i=this._endoWnafT2,o=0;o<t.length;o++){var s=this._endoSplit(e[o]),a=t[o],u=a._getBeta();s.k1.negative&&(s.k1.ineg(),a=a.neg(!0)),s.k2.negative&&(s.k2.ineg(),u=u.neg(!0)),n[2*o]=a,n[2*o+1]=u,i[2*o]=s.k1,i[2*o+1]=s.k2}for(var h=this._wnafMulAdd(1,n,i,2*o,r),c=0;c<2*o;c++)n[c]=null,i[c]=null;return h},Nd(Ld,Pd.BasePoint),Od.prototype.point=function(t,e,r){return new Ld(this,t,e,r)},Od.prototype.pointFromJSON=function(t,e){return Ld.fromJSON(this,t,e)},Ld.prototype._getBeta=function(){if(this.curve.endo){var t=this.precomputed;if(t&&t.beta)return t.beta;var e=this.curve.point(this.x.redMul(this.curve.endo.beta),this.y);if(t){var r=this.curve,n=function(t){return r.point(t.x.redMul(r.endo.beta),t.y)};t.beta=e,e.precomputed={beta:null,naf:t.naf&&{wnd:t.naf.wnd,points:t.naf.points.map(n)},doubles:t.doubles&&{step:t.doubles.step,points:t.doubles.points.map(n)}}}return e}},Ld.prototype.toJSON=function(){return this.precomputed?[this.x,this.y,this.precomputed&&{doubles:this.precomputed.doubles&&{step:this.precomputed.doubles.step,points:this.precomputed.doubles.points.slice(1)},naf:this.precomputed.naf&&{wnd:this.precomputed.naf.wnd,points:this.precomputed.naf.points.slice(1)}}]:[this.x,this.y]},Ld.fromJSON=function(t,e,r){"string"==typeof e&&(e=JSON.parse(e));var n=t.point(e[0],e[1],r);if(!e[2])return n;function i(e){return t.point(e[0],e[1],r)}var o=e[2];return n.precomputed={beta:null,doubles:o.doubles&&{step:o.doubles.step,points:[n].concat(o.doubles.points.map(i))},naf:o.naf&&{wnd:o.naf.wnd,points:[n].concat(o.naf.points.map(i))}},n},Ld.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+">"},Ld.prototype.isInfinity=function(){return this.inf},Ld.prototype.add=function(t){if(this.inf)return t;if(t.inf)return this;if(this.eq(t))return this.dbl();if(this.neg().eq(t))return this.curve.point(null,null);if(0===this.x.cmp(t.x))return this.curve.point(null,null);var e=this.y.redSub(t.y);0!==e.cmpn(0)&&(e=e.redMul(this.x.redSub(t.x).redInvm()));var r=e.redSqr().redISub(this.x).redISub(t.x),n=e.redMul(this.x.redSub(r)).redISub(this.y);return this.curve.point(r,n)},Ld.prototype.dbl=function(){if(this.inf)return this;var t=this.y.redAdd(this.y);if(0===t.cmpn(0))return this.curve.point(null,null);var e=this.curve.a,r=this.x.redSqr(),n=t.redInvm(),i=r.redAdd(r).redIAdd(r).redIAdd(e).redMul(n),o=i.redSqr().redISub(this.x.redAdd(this.x)),s=i.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,s)},Ld.prototype.getX=function(){return this.x.fromRed()},Ld.prototype.getY=function(){return this.y.fromRed()},Ld.prototype.mul=function(t){return t=new Bd(t,16),this.isInfinity()?this:this._hasDoubles(t)?this.curve._fixedNafMul(this,t):this.curve.endo?this.curve._endoWnafMulAdd([this],[t]):this.curve._wnafMul(this,t)},Ld.prototype.mulAdd=function(t,e,r){var n=[this,e],i=[t,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,i):this.curve._wnafMulAdd(1,n,i,2)},Ld.prototype.jmulAdd=function(t,e,r){var n=[this,e],i=[t,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,i,!0):this.curve._wnafMulAdd(1,n,i,2,!0)},Ld.prototype.eq=function(t){return this===t||this.inf===t.inf&&(this.inf||0===this.x.cmp(t.x)&&0===this.y.cmp(t.y))},Ld.prototype.neg=function(t){if(this.inf)return this;var e=this.curve.point(this.x,this.y.redNeg());if(t&&this.precomputed){var r=this.precomputed,n=function(t){return t.neg()};e.precomputed={naf:r.naf&&{wnd:r.naf.wnd,points:r.naf.points.map(n)},doubles:r.doubles&&{step:r.doubles.step,points:r.doubles.points.map(n)}}}return e},Ld.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},Nd(jd,Pd.BasePoint),Od.prototype.jpoint=function(t,e,r){return new jd(this,t,e,r)},jd.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var t=this.z.redInvm(),e=t.redSqr(),r=this.x.redMul(e),n=this.y.redMul(e).redMul(t);return this.curve.point(r,n)},jd.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},jd.prototype.add=function(t){if(this.isInfinity())return t;if(t.isInfinity())return this;var e=t.z.redSqr(),r=this.z.redSqr(),n=this.x.redMul(e),i=t.x.redMul(r),o=this.y.redMul(e.redMul(t.z)),s=t.y.redMul(r.redMul(this.z)),a=n.redSub(i),u=o.redSub(s);if(0===a.cmpn(0))return 0!==u.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var h=a.redSqr(),c=h.redMul(a),f=n.redMul(h),l=u.redSqr().redIAdd(c).redISub(f).redISub(f),d=u.redMul(f.redISub(l)).redISub(o.redMul(c)),p=this.z.redMul(t.z).redMul(a);return this.curve.jpoint(l,d,p)},jd.prototype.mixedAdd=function(t){if(this.isInfinity())return t.toJ();if(t.isInfinity())return this;var e=this.z.redSqr(),r=this.x,n=t.x.redMul(e),i=this.y,o=t.y.redMul(e).redMul(this.z),s=r.redSub(n),a=i.redSub(o);if(0===s.cmpn(0))return 0!==a.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var u=s.redSqr(),h=u.redMul(s),c=r.redMul(u),f=a.redSqr().redIAdd(h).redISub(c).redISub(c),l=a.redMul(c.redISub(f)).redISub(i.redMul(h)),d=this.z.redMul(s);return this.curve.jpoint(f,l,d)},jd.prototype.dblp=function(t){if(0===t)return this;if(this.isInfinity())return this;if(!t)return this.dbl();var e;if(this.curve.zeroA||this.curve.threeA){var r=this;for(e=0;e<t;e++)r=r.dbl();return r}var n=this.curve.a,i=this.curve.tinv,o=this.x,s=this.y,a=this.z,u=a.redSqr().redSqr(),h=s.redAdd(s);for(e=0;e<t;e++){var c=o.redSqr(),f=h.redSqr(),l=f.redSqr(),d=c.redAdd(c).redIAdd(c).redIAdd(n.redMul(u)),p=o.redMul(f),m=d.redSqr().redISub(p.redAdd(p)),g=p.redISub(m),y=d.redMul(g);y=y.redIAdd(y).redISub(l);var b=h.redMul(a);e+1<t&&(u=u.redMul(l)),o=m,a=b,h=y}return this.curve.jpoint(o,h.redMul(i),a)},jd.prototype.dbl=function(){return this.isInfinity()?this:this.curve.zeroA?this._zeroDbl():this.curve.threeA?this._threeDbl():this._dbl()},jd.prototype._zeroDbl=function(){var t,e,r;if(this.zOne){var n=this.x.redSqr(),i=this.y.redSqr(),o=i.redSqr(),s=this.x.redAdd(i).redSqr().redISub(n).redISub(o);s=s.redIAdd(s);var a=n.redAdd(n).redIAdd(n),u=a.redSqr().redISub(s).redISub(s),h=o.redIAdd(o);h=(h=h.redIAdd(h)).redIAdd(h),t=u,e=a.redMul(s.redISub(u)).redISub(h),r=this.y.redAdd(this.y)}else{var c=this.x.redSqr(),f=this.y.redSqr(),l=f.redSqr(),d=this.x.redAdd(f).redSqr().redISub(c).redISub(l);d=d.redIAdd(d);var p=c.redAdd(c).redIAdd(c),m=p.redSqr(),g=l.redIAdd(l);g=(g=g.redIAdd(g)).redIAdd(g),t=m.redISub(d).redISub(d),e=p.redMul(d.redISub(t)).redISub(g),r=(r=this.y.redMul(this.z)).redIAdd(r)}return this.curve.jpoint(t,e,r)},jd.prototype._threeDbl=function(){var t,e,r;if(this.zOne){var n=this.x.redSqr(),i=this.y.redSqr(),o=i.redSqr(),s=this.x.redAdd(i).redSqr().redISub(n).redISub(o);s=s.redIAdd(s);var a=n.redAdd(n).redIAdd(n).redIAdd(this.curve.a),u=a.redSqr().redISub(s).redISub(s);t=u;var h=o.redIAdd(o);h=(h=h.redIAdd(h)).redIAdd(h),e=a.redMul(s.redISub(u)).redISub(h),r=this.y.redAdd(this.y)}else{var c=this.z.redSqr(),f=this.y.redSqr(),l=this.x.redMul(f),d=this.x.redSub(c).redMul(this.x.redAdd(c));d=d.redAdd(d).redIAdd(d);var p=l.redIAdd(l),m=(p=p.redIAdd(p)).redAdd(p);t=d.redSqr().redISub(m),r=this.y.redAdd(this.z).redSqr().redISub(f).redISub(c);var g=f.redSqr();g=(g=(g=g.redIAdd(g)).redIAdd(g)).redIAdd(g),e=d.redMul(p.redISub(t)).redISub(g)}return this.curve.jpoint(t,e,r)},jd.prototype._dbl=function(){var t=this.curve.a,e=this.x,r=this.y,n=this.z,i=n.redSqr().redSqr(),o=e.redSqr(),s=r.redSqr(),a=o.redAdd(o).redIAdd(o).redIAdd(t.redMul(i)),u=e.redAdd(e),h=(u=u.redIAdd(u)).redMul(s),c=a.redSqr().redISub(h.redAdd(h)),f=h.redISub(c),l=s.redSqr();l=(l=(l=l.redIAdd(l)).redIAdd(l)).redIAdd(l);var d=a.redMul(f).redISub(l),p=r.redAdd(r).redMul(n);return this.curve.jpoint(c,d,p)},jd.prototype.trpl=function(){if(!this.curve.zeroA)return this.dbl().add(this);var t=this.x.redSqr(),e=this.y.redSqr(),r=this.z.redSqr(),n=e.redSqr(),i=t.redAdd(t).redIAdd(t),o=i.redSqr(),s=this.x.redAdd(e).redSqr().redISub(t).redISub(n),a=(s=(s=(s=s.redIAdd(s)).redAdd(s).redIAdd(s)).redISub(o)).redSqr(),u=n.redIAdd(n);u=(u=(u=u.redIAdd(u)).redIAdd(u)).redIAdd(u);var h=i.redIAdd(s).redSqr().redISub(o).redISub(a).redISub(u),c=e.redMul(h);c=(c=c.redIAdd(c)).redIAdd(c);var f=this.x.redMul(a).redISub(c);f=(f=f.redIAdd(f)).redIAdd(f);var l=this.y.redMul(h.redMul(u.redISub(h)).redISub(s.redMul(a)));l=(l=(l=l.redIAdd(l)).redIAdd(l)).redIAdd(l);var d=this.z.redAdd(s).redSqr().redISub(r).redISub(a);return this.curve.jpoint(f,l,d)},jd.prototype.mul=function(t,e){return t=new Bd(t,e),this.curve._wnafMul(this,t)},jd.prototype.eq=function(t){if("affine"===t.type)return this.eq(t.toJ());if(this===t)return!0;var e=this.z.redSqr(),r=t.z.redSqr();if(0!==this.x.redMul(r).redISub(t.x.redMul(e)).cmpn(0))return!1;var n=e.redMul(this.z),i=r.redMul(t.z);return 0===this.y.redMul(i).redISub(t.y.redMul(n)).cmpn(0)},jd.prototype.eqXToP=function(t){var e=this.z.redSqr(),r=t.toRed(this.curve.red).redMul(e);if(0===this.x.cmp(r))return!0;for(var n=t.clone(),i=this.curve.redN.redMul(e);;){if(n.iadd(this.curve.n),n.cmp(this.curve.p)>=0)return!1;if(r.redIAdd(i),0===this.x.cmp(r))return!0}},jd.prototype.inspect=function(){return this.isInfinity()?"<EC JPoint Infinity>":"<EC JPoint x: "+this.x.toString(16,2)+" y: "+this.y.toString(16,2)+" z: "+this.z.toString(16,2)+">"},jd.prototype.isInfinity=function(){return 0===this.z.cmpn(0)};var Dd=pd,Ud=ri,Fd=Td,zd=ld;function qd(t){Fd.call(this,"mont",t),this.a=new Dd(t.a,16).toRed(this.red),this.b=new Dd(t.b,16).toRed(this.red),this.i4=new Dd(4).toRed(this.red).redInvm(),this.two=new Dd(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}Ud(qd,Fd);var Hd=qd;function Kd(t,e,r){Fd.BasePoint.call(this,t,"projective"),null===e&&null===r?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new Dd(e,16),this.z=new Dd(r,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}qd.prototype.validate=function(t){var e=t.normalize().x,r=e.redSqr(),n=r.redMul(e).redAdd(r.redMul(this.a)).redAdd(e);return 0===n.redSqrt().redSqr().cmp(n)},Ud(Kd,Fd.BasePoint),qd.prototype.decodePoint=function(t,e){return this.point(zd.toArray(t,e),1)},qd.prototype.point=function(t,e){return new Kd(this,t,e)},qd.prototype.pointFromJSON=function(t){return Kd.fromJSON(this,t)},Kd.prototype.precompute=function(){},Kd.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())},Kd.fromJSON=function(t,e){return new Kd(t,e[0],e[1]||t.one)},Kd.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" z: "+this.z.fromRed().toString(16,2)+">"},Kd.prototype.isInfinity=function(){return 0===this.z.cmpn(0)},Kd.prototype.dbl=function(){var t=this.x.redAdd(this.z).redSqr(),e=this.x.redSub(this.z).redSqr(),r=t.redSub(e),n=t.redMul(e),i=r.redMul(e.redAdd(this.curve.a24.redMul(r)));return this.curve.point(n,i)},Kd.prototype.add=function(){throw new Error("Not supported on Montgomery curve")},Kd.prototype.diffAdd=function(t,e){var r=this.x.redAdd(this.z),n=this.x.redSub(this.z),i=t.x.redAdd(t.z),o=t.x.redSub(t.z).redMul(r),s=i.redMul(n),a=e.z.redMul(o.redAdd(s).redSqr()),u=e.x.redMul(o.redISub(s).redSqr());return this.curve.point(a,u)},Kd.prototype.mul=function(t){for(var e=t.clone(),r=this,n=this.curve.point(null,null),i=[];0!==e.cmpn(0);e.iushrn(1))i.push(e.andln(1));for(var o=i.length-1;o>=0;o--)0===i[o]?(r=r.diffAdd(n,this),n=n.dbl()):(n=r.diffAdd(n,this),r=r.dbl());return n},Kd.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")},Kd.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")},Kd.prototype.eq=function(t){return 0===this.getX().cmp(t.getX())},Kd.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},Kd.prototype.getX=function(){return this.normalize(),this.x.fromRed()};var Gd=pd,Vd=ri,Wd=Td,Jd=ld.assert;function Zd(t){this.twisted=1!=(0|t.a),this.mOneA=this.twisted&&-1==(0|t.a),this.extended=this.mOneA,Wd.call(this,"edwards",t),this.a=new Gd(t.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new Gd(t.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new Gd(t.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),Jd(!this.twisted||0===this.c.fromRed().cmpn(1)),this.oneC=1==(0|t.c)}Vd(Zd,Wd);var Yd=Zd;function Xd(t,e,r,n,i){Wd.BasePoint.call(this,t,"projective"),null===e&&null===r&&null===n?(this.x=this.curve.zero,this.y=this.curve.one,this.z=this.curve.one,this.t=this.curve.zero,this.zOne=!0):(this.x=new Gd(e,16),this.y=new Gd(r,16),this.z=n?new Gd(n,16):this.curve.one,this.t=i&&new Gd(i,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.t&&!this.t.red&&(this.t=this.t.toRed(this.curve.red)),this.zOne=this.z===this.curve.one,this.curve.extended&&!this.t&&(this.t=this.x.redMul(this.y),this.zOne||(this.t=this.t.redMul(this.z.redInvm()))))}Zd.prototype._mulA=function(t){return this.mOneA?t.redNeg():this.a.redMul(t)},Zd.prototype._mulC=function(t){return this.oneC?t:this.c.redMul(t)},Zd.prototype.jpoint=function(t,e,r,n){return this.point(t,e,r,n)},Zd.prototype.pointFromX=function(t,e){(t=new Gd(t,16)).red||(t=t.toRed(this.red));var r=t.redSqr(),n=this.c2.redSub(this.a.redMul(r)),i=this.one.redSub(this.c2.redMul(this.d).redMul(r)),o=n.redMul(i.redInvm()),s=o.redSqrt();if(0!==s.redSqr().redSub(o).cmp(this.zero))throw new Error("invalid point");var a=s.fromRed().isOdd();return(e&&!a||!e&&a)&&(s=s.redNeg()),this.point(t,s)},Zd.prototype.pointFromY=function(t,e){(t=new Gd(t,16)).red||(t=t.toRed(this.red));var r=t.redSqr(),n=r.redSub(this.c2),i=r.redMul(this.d).redMul(this.c2).redSub(this.a),o=n.redMul(i.redInvm());if(0===o.cmp(this.zero)){if(e)throw new Error("invalid point");return this.point(this.zero,t)}var s=o.redSqrt();if(0!==s.redSqr().redSub(o).cmp(this.zero))throw new Error("invalid point");return s.fromRed().isOdd()!==e&&(s=s.redNeg()),this.point(s,t)},Zd.prototype.validate=function(t){if(t.isInfinity())return!0;t.normalize();var e=t.x.redSqr(),r=t.y.redSqr(),n=e.redMul(this.a).redAdd(r),i=this.c2.redMul(this.one.redAdd(this.d.redMul(e).redMul(r)));return 0===n.cmp(i)},Vd(Xd,Wd.BasePoint),Zd.prototype.pointFromJSON=function(t){return Xd.fromJSON(this,t)},Zd.prototype.point=function(t,e,r,n){return new Xd(this,t,e,r,n)},Xd.fromJSON=function(t,e){return new Xd(t,e[0],e[1],e[2])},Xd.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+" z: "+this.z.fromRed().toString(16,2)+">"},Xd.prototype.isInfinity=function(){return 0===this.x.cmpn(0)&&(0===this.y.cmp(this.z)||this.zOne&&0===this.y.cmp(this.curve.c))},Xd.prototype._extDbl=function(){var t=this.x.redSqr(),e=this.y.redSqr(),r=this.z.redSqr();r=r.redIAdd(r);var n=this.curve._mulA(t),i=this.x.redAdd(this.y).redSqr().redISub(t).redISub(e),o=n.redAdd(e),s=o.redSub(r),a=n.redSub(e),u=i.redMul(s),h=o.redMul(a),c=i.redMul(a),f=s.redMul(o);return this.curve.point(u,h,f,c)},Xd.prototype._projDbl=function(){var t,e,r,n,i,o,s=this.x.redAdd(this.y).redSqr(),a=this.x.redSqr(),u=this.y.redSqr();if(this.curve.twisted){var h=(n=this.curve._mulA(a)).redAdd(u);this.zOne?(t=s.redSub(a).redSub(u).redMul(h.redSub(this.curve.two)),e=h.redMul(n.redSub(u)),r=h.redSqr().redSub(h).redSub(h)):(i=this.z.redSqr(),o=h.redSub(i).redISub(i),t=s.redSub(a).redISub(u).redMul(o),e=h.redMul(n.redSub(u)),r=h.redMul(o))}else n=a.redAdd(u),i=this.curve._mulC(this.z).redSqr(),o=n.redSub(i).redSub(i),t=this.curve._mulC(s.redISub(n)).redMul(o),e=this.curve._mulC(n).redMul(a.redISub(u)),r=n.redMul(o);return this.curve.point(t,e,r)},Xd.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},Xd.prototype._extAdd=function(t){var e=this.y.redSub(this.x).redMul(t.y.redSub(t.x)),r=this.y.redAdd(this.x).redMul(t.y.redAdd(t.x)),n=this.t.redMul(this.curve.dd).redMul(t.t),i=this.z.redMul(t.z.redAdd(t.z)),o=r.redSub(e),s=i.redSub(n),a=i.redAdd(n),u=r.redAdd(e),h=o.redMul(s),c=a.redMul(u),f=o.redMul(u),l=s.redMul(a);return this.curve.point(h,c,l,f)},Xd.prototype._projAdd=function(t){var e,r,n=this.z.redMul(t.z),i=n.redSqr(),o=this.x.redMul(t.x),s=this.y.redMul(t.y),a=this.curve.d.redMul(o).redMul(s),u=i.redSub(a),h=i.redAdd(a),c=this.x.redAdd(this.y).redMul(t.x.redAdd(t.y)).redISub(o).redISub(s),f=n.redMul(u).redMul(c);return this.curve.twisted?(e=n.redMul(h).redMul(s.redSub(this.curve._mulA(o))),r=u.redMul(h)):(e=n.redMul(h).redMul(s.redSub(o)),r=this.curve._mulC(u).redMul(h)),this.curve.point(f,e,r)},Xd.prototype.add=function(t){return this.isInfinity()?t:t.isInfinity()?this:this.curve.extended?this._extAdd(t):this._projAdd(t)},Xd.prototype.mul=function(t){return this._hasDoubles(t)?this.curve._fixedNafMul(this,t):this.curve._wnafMul(this,t)},Xd.prototype.mulAdd=function(t,e,r){return this.curve._wnafMulAdd(1,[this,e],[t,r],2,!1)},Xd.prototype.jmulAdd=function(t,e,r){return this.curve._wnafMulAdd(1,[this,e],[t,r],2,!0)},Xd.prototype.normalize=function(){if(this.zOne)return this;var t=this.z.redInvm();return this.x=this.x.redMul(t),this.y=this.y.redMul(t),this.t&&(this.t=this.t.redMul(t)),this.z=this.curve.one,this.zOne=!0,this},Xd.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},Xd.prototype.getX=function(){return this.normalize(),this.x.fromRed()},Xd.prototype.getY=function(){return this.normalize(),this.y.fromRed()},Xd.prototype.eq=function(t){return this===t||0===this.getX().cmp(t.getX())&&0===this.getY().cmp(t.getY())},Xd.prototype.eqXToP=function(t){var e=t.toRed(this.curve.red).redMul(this.z);if(0===this.x.cmp(e))return!0;for(var r=t.clone(),n=this.curve.redN.redMul(this.z);;){if(r.iadd(this.curve.n),r.cmp(this.curve.p)>=0)return!1;if(e.redIAdd(n),0===this.x.cmp(e))return!0}},Xd.prototype.toP=Xd.prototype.normalize,Xd.prototype.mixedAdd=Xd.prototype.add,function(t){var e=t;e.base=Td,e.short=Cd,e.mont=Hd,e.edwards=Yd}(_d);var $d,Qd,tp={};!function(t){var e,r=t,n=Xn,i=_d,o=ld.assert;function s(t){"short"===t.type?this.curve=new i.short(t):"edwards"===t.type?this.curve=new i.edwards(t):this.curve=new i.mont(t),this.g=this.curve.g,this.n=this.curve.n,this.hash=t.hash,o(this.g.validate(),"Invalid curve"),o(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function a(t,e){Object.defineProperty(r,t,{configurable:!0,enumerable:!0,get:function(){var n=new s(e);return Object.defineProperty(r,t,{configurable:!0,enumerable:!0,value:n}),n}})}r.PresetCurve=s,a("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:n.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),a("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:n.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),a("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:n.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),a("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:n.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),a("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:n.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),a("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:n.sha256,gRed:!1,g:["9"]}),a("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:n.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});try{e=Qd?$d:(Qd=1,$d={doubles:{step:4,points:[["e60fce93b59e9ec53011aabc21c23e97b2a31369b87a5ae9c44ee89e2a6dec0a","f7e3507399e595929db99f34f57937101296891e44d23f0be1f32cce69616821"],["8282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508","11f8a8098557dfe45e8256e830b60ace62d613ac2f7b17bed31b6eaff6e26caf"],["175e159f728b865a72f99cc6c6fc846de0b93833fd2222ed73fce5b551e5b739","d3506e0d9e3c79eba4ef97a51ff71f5eacb5955add24345c6efa6ffee9fed695"],["363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640","4e273adfc732221953b445397f3363145b9a89008199ecb62003c7f3bee9de9"],["8b4b5f165df3c2be8c6244b5b745638843e4a781a15bcd1b69f79a55dffdf80c","4aad0a6f68d308b4b3fbd7813ab0da04f9e336546162ee56b3eff0c65fd4fd36"],["723cbaa6e5db996d6bf771c00bd548c7b700dbffa6c0e77bcb6115925232fcda","96e867b5595cc498a921137488824d6e2660a0653779494801dc069d9eb39f5f"],["eebfa4d493bebf98ba5feec812c2d3b50947961237a919839a533eca0e7dd7fa","5d9a8ca3970ef0f269ee7edaf178089d9ae4cdc3a711f712ddfd4fdae1de8999"],["100f44da696e71672791d0a09b7bde459f1215a29b3c03bfefd7835b39a48db0","cdd9e13192a00b772ec8f3300c090666b7ff4a18ff5195ac0fbd5cd62bc65a09"],["e1031be262c7ed1b1dc9227a4a04c017a77f8d4464f3b3852c8acde6e534fd2d","9d7061928940405e6bb6a4176597535af292dd419e1ced79a44f18f29456a00d"],["feea6cae46d55b530ac2839f143bd7ec5cf8b266a41d6af52d5e688d9094696d","e57c6b6c97dce1bab06e4e12bf3ecd5c981c8957cc41442d3155debf18090088"],["da67a91d91049cdcb367be4be6ffca3cfeed657d808583de33fa978bc1ec6cb1","9bacaa35481642bc41f463f7ec9780e5dec7adc508f740a17e9ea8e27a68be1d"],["53904faa0b334cdda6e000935ef22151ec08d0f7bb11069f57545ccc1a37b7c0","5bc087d0bc80106d88c9eccac20d3c1c13999981e14434699dcb096b022771c8"],["8e7bcd0bd35983a7719cca7764ca906779b53a043a9b8bcaeff959f43ad86047","10b7770b2a3da4b3940310420ca9514579e88e2e47fd68b3ea10047e8460372a"],["385eed34c1cdff21e6d0818689b81bde71a7f4f18397e6690a841e1599c43862","283bebc3e8ea23f56701de19e9ebf4576b304eec2086dc8cc0458fe5542e5453"],["6f9d9b803ecf191637c73a4413dfa180fddf84a5947fbc9c606ed86c3fac3a7","7c80c68e603059ba69b8e2a30e45c4d47ea4dd2f5c281002d86890603a842160"],["3322d401243c4e2582a2147c104d6ecbf774d163db0f5e5313b7e0e742d0e6bd","56e70797e9664ef5bfb019bc4ddaf9b72805f63ea2873af624f3a2e96c28b2a0"],["85672c7d2de0b7da2bd1770d89665868741b3f9af7643397721d74d28134ab83","7c481b9b5b43b2eb6374049bfa62c2e5e77f17fcc5298f44c8e3094f790313a6"],["948bf809b1988a46b06c9f1919413b10f9226c60f668832ffd959af60c82a0a","53a562856dcb6646dc6b74c5d1c3418c6d4dff08c97cd2bed4cb7f88d8c8e589"],["6260ce7f461801c34f067ce0f02873a8f1b0e44dfc69752accecd819f38fd8e8","bc2da82b6fa5b571a7f09049776a1ef7ecd292238051c198c1a84e95b2b4ae17"],["e5037de0afc1d8d43d8348414bbf4103043ec8f575bfdc432953cc8d2037fa2d","4571534baa94d3b5f9f98d09fb990bddbd5f5b03ec481f10e0e5dc841d755bda"],["e06372b0f4a207adf5ea905e8f1771b4e7e8dbd1c6a6c5b725866a0ae4fce725","7a908974bce18cfe12a27bb2ad5a488cd7484a7787104870b27034f94eee31dd"],["213c7a715cd5d45358d0bbf9dc0ce02204b10bdde2a3f58540ad6908d0559754","4b6dad0b5ae462507013ad06245ba190bb4850f5f36a7eeddff2c27534b458f2"],["4e7c272a7af4b34e8dbb9352a5419a87e2838c70adc62cddf0cc3a3b08fbd53c","17749c766c9d0b18e16fd09f6def681b530b9614bff7dd33e0b3941817dcaae6"],["fea74e3dbe778b1b10f238ad61686aa5c76e3db2be43057632427e2840fb27b6","6e0568db9b0b13297cf674deccb6af93126b596b973f7b77701d3db7f23cb96f"],["76e64113f677cf0e10a2570d599968d31544e179b760432952c02a4417bdde39","c90ddf8dee4e95cf577066d70681f0d35e2a33d2b56d2032b4b1752d1901ac01"],["c738c56b03b2abe1e8281baa743f8f9a8f7cc643df26cbee3ab150242bcbb891","893fb578951ad2537f718f2eacbfbbbb82314eef7880cfe917e735d9699a84c3"],["d895626548b65b81e264c7637c972877d1d72e5f3a925014372e9f6588f6c14b","febfaa38f2bc7eae728ec60818c340eb03428d632bb067e179363ed75d7d991f"],["b8da94032a957518eb0f6433571e8761ceffc73693e84edd49150a564f676e03","2804dfa44805a1e4d7c99cc9762808b092cc584d95ff3b511488e4e74efdf6e7"],["e80fea14441fb33a7d8adab9475d7fab2019effb5156a792f1a11778e3c0df5d","eed1de7f638e00771e89768ca3ca94472d155e80af322ea9fcb4291b6ac9ec78"],["a301697bdfcd704313ba48e51d567543f2a182031efd6915ddc07bbcc4e16070","7370f91cfb67e4f5081809fa25d40f9b1735dbf7c0a11a130c0d1a041e177ea1"],["90ad85b389d6b936463f9d0512678de208cc330b11307fffab7ac63e3fb04ed4","e507a3620a38261affdcbd9427222b839aefabe1582894d991d4d48cb6ef150"],["8f68b9d2f63b5f339239c1ad981f162ee88c5678723ea3351b7b444c9ec4c0da","662a9f2dba063986de1d90c2b6be215dbbea2cfe95510bfdf23cbf79501fff82"],["e4f3fb0176af85d65ff99ff9198c36091f48e86503681e3e6686fd5053231e11","1e63633ad0ef4f1c1661a6d0ea02b7286cc7e74ec951d1c9822c38576feb73bc"],["8c00fa9b18ebf331eb961537a45a4266c7034f2f0d4e1d0716fb6eae20eae29e","efa47267fea521a1a9dc343a3736c974c2fadafa81e36c54e7d2a4c66702414b"],["e7a26ce69dd4829f3e10cec0a9e98ed3143d084f308b92c0997fddfc60cb3e41","2a758e300fa7984b471b006a1aafbb18d0a6b2c0420e83e20e8a9421cf2cfd51"],["b6459e0ee3662ec8d23540c223bcbdc571cbcb967d79424f3cf29eb3de6b80ef","67c876d06f3e06de1dadf16e5661db3c4b3ae6d48e35b2ff30bf0b61a71ba45"],["d68a80c8280bb840793234aa118f06231d6f1fc67e73c5a5deda0f5b496943e8","db8ba9fff4b586d00c4b1f9177b0e28b5b0e7b8f7845295a294c84266b133120"],["324aed7df65c804252dc0270907a30b09612aeb973449cea4095980fc28d3d5d","648a365774b61f2ff130c0c35aec1f4f19213b0c7e332843967224af96ab7c84"],["4df9c14919cde61f6d51dfdbe5fee5dceec4143ba8d1ca888e8bd373fd054c96","35ec51092d8728050974c23a1d85d4b5d506cdc288490192ebac06cad10d5d"],["9c3919a84a474870faed8a9c1cc66021523489054d7f0308cbfc99c8ac1f98cd","ddb84f0f4a4ddd57584f044bf260e641905326f76c64c8e6be7e5e03d4fc599d"],["6057170b1dd12fdf8de05f281d8e06bb91e1493a8b91d4cc5a21382120a959e5","9a1af0b26a6a4807add9a2daf71df262465152bc3ee24c65e899be932385a2a8"],["a576df8e23a08411421439a4518da31880cef0fba7d4df12b1a6973eecb94266","40a6bf20e76640b2c92b97afe58cd82c432e10a7f514d9f3ee8be11ae1b28ec8"],["7778a78c28dec3e30a05fe9629de8c38bb30d1f5cf9a3a208f763889be58ad71","34626d9ab5a5b22ff7098e12f2ff580087b38411ff24ac563b513fc1fd9f43ac"],["928955ee637a84463729fd30e7afd2ed5f96274e5ad7e5cb09eda9c06d903ac","c25621003d3f42a827b78a13093a95eeac3d26efa8a8d83fc5180e935bcd091f"],["85d0fef3ec6db109399064f3a0e3b2855645b4a907ad354527aae75163d82751","1f03648413a38c0be29d496e582cf5663e8751e96877331582c237a24eb1f962"],["ff2b0dce97eece97c1c9b6041798b85dfdfb6d8882da20308f5404824526087e","493d13fef524ba188af4c4dc54d07936c7b7ed6fb90e2ceb2c951e01f0c29907"],["827fbbe4b1e880ea9ed2b2e6301b212b57f1ee148cd6dd28780e5e2cf856e241","c60f9c923c727b0b71bef2c67d1d12687ff7a63186903166d605b68baec293ec"],["eaa649f21f51bdbae7be4ae34ce6e5217a58fdce7f47f9aa7f3b58fa2120e2b3","be3279ed5bbbb03ac69a80f89879aa5a01a6b965f13f7e59d47a5305ba5ad93d"],["e4a42d43c5cf169d9391df6decf42ee541b6d8f0c9a137401e23632dda34d24f","4d9f92e716d1c73526fc99ccfb8ad34ce886eedfa8d8e4f13a7f7131deba9414"],["1ec80fef360cbdd954160fadab352b6b92b53576a88fea4947173b9d4300bf19","aeefe93756b5340d2f3a4958a7abbf5e0146e77f6295a07b671cdc1cc107cefd"],["146a778c04670c2f91b00af4680dfa8bce3490717d58ba889ddb5928366642be","b318e0ec3354028add669827f9d4b2870aaa971d2f7e5ed1d0b297483d83efd0"],["fa50c0f61d22e5f07e3acebb1aa07b128d0012209a28b9776d76a8793180eef9","6b84c6922397eba9b72cd2872281a68a5e683293a57a213b38cd8d7d3f4f2811"],["da1d61d0ca721a11b1a5bf6b7d88e8421a288ab5d5bba5220e53d32b5f067ec2","8157f55a7c99306c79c0766161c91e2966a73899d279b48a655fba0f1ad836f1"],["a8e282ff0c9706907215ff98e8fd416615311de0446f1e062a73b0610d064e13","7f97355b8db81c09abfb7f3c5b2515888b679a3e50dd6bd6cef7c73111f4cc0c"],["174a53b9c9a285872d39e56e6913cab15d59b1fa512508c022f382de8319497c","ccc9dc37abfc9c1657b4155f2c47f9e6646b3a1d8cb9854383da13ac079afa73"],["959396981943785c3d3e57edf5018cdbe039e730e4918b3d884fdff09475b7ba","2e7e552888c331dd8ba0386a4b9cd6849c653f64c8709385e9b8abf87524f2fd"],["d2a63a50ae401e56d645a1153b109a8fcca0a43d561fba2dbb51340c9d82b151","e82d86fb6443fcb7565aee58b2948220a70f750af484ca52d4142174dcf89405"],["64587e2335471eb890ee7896d7cfdc866bacbdbd3839317b3436f9b45617e073","d99fcdd5bf6902e2ae96dd6447c299a185b90a39133aeab358299e5e9faf6589"],["8481bde0e4e4d885b3a546d3e549de042f0aa6cea250e7fd358d6c86dd45e458","38ee7b8cba5404dd84a25bf39cecb2ca900a79c42b262e556d64b1b59779057e"],["13464a57a78102aa62b6979ae817f4637ffcfed3c4b1ce30bcd6303f6caf666b","69be159004614580ef7e433453ccb0ca48f300a81d0942e13f495a907f6ecc27"],["bc4a9df5b713fe2e9aef430bcc1dc97a0cd9ccede2f28588cada3a0d2d83f366","d3a81ca6e785c06383937adf4b798caa6e8a9fbfa547b16d758d666581f33c1"],["8c28a97bf8298bc0d23d8c749452a32e694b65e30a9472a3954ab30fe5324caa","40a30463a3305193378fedf31f7cc0eb7ae784f0451cb9459e71dc73cbef9482"],["8ea9666139527a8c1dd94ce4f071fd23c8b350c5a4bb33748c4ba111faccae0","620efabbc8ee2782e24e7c0cfb95c5d735b783be9cf0f8e955af34a30e62b945"],["dd3625faef5ba06074669716bbd3788d89bdde815959968092f76cc4eb9a9787","7a188fa3520e30d461da2501045731ca941461982883395937f68d00c644a573"],["f710d79d9eb962297e4f6232b40e8f7feb2bc63814614d692c12de752408221e","ea98e67232d3b3295d3b535532115ccac8612c721851617526ae47a9c77bfc82"]]},naf:{wnd:7,points:[["f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9","388f7b0f632de8140fe337e62a37f3566500a99934c2231b6cb9fd7584b8e672"],["2f8bde4d1a07209355b4a7250a5c5128e88b84bddc619ab7cba8d569b240efe4","d8ac222636e5e3d6d4dba9dda6c9c426f788271bab0d6840dca87d3aa6ac62d6"],["5cbdf0646e5db4eaa398f365f2ea7a0e3d419b7e0330e39ce92bddedcac4f9bc","6aebca40ba255960a3178d6d861a54dba813d0b813fde7b5a5082628087264da"],["acd484e2f0c7f65309ad178a9f559abde09796974c57e714c35f110dfc27ccbe","cc338921b0a7d9fd64380971763b61e9add888a4375f8e0f05cc262ac64f9c37"],["774ae7f858a9411e5ef4246b70c65aac5649980be5c17891bbec17895da008cb","d984a032eb6b5e190243dd56d7b7b365372db1e2dff9d6a8301d74c9c953c61b"],["f28773c2d975288bc7d1d205c3748651b075fbc6610e58cddeeddf8f19405aa8","ab0902e8d880a89758212eb65cdaf473a1a06da521fa91f29b5cb52db03ed81"],["d7924d4f7d43ea965a465ae3095ff41131e5946f3c85f79e44adbcf8e27e080e","581e2872a86c72a683842ec228cc6defea40af2bd896d3a5c504dc9ff6a26b58"],["defdea4cdb677750a420fee807eacf21eb9898ae79b9768766e4faa04a2d4a34","4211ab0694635168e997b0ead2a93daeced1f4a04a95c0f6cfb199f69e56eb77"],["2b4ea0a797a443d293ef5cff444f4979f06acfebd7e86d277475656138385b6c","85e89bc037945d93b343083b5a1c86131a01f60c50269763b570c854e5c09b7a"],["352bbf4a4cdd12564f93fa332ce333301d9ad40271f8107181340aef25be59d5","321eb4075348f534d59c18259dda3e1f4a1b3b2e71b1039c67bd3d8bcf81998c"],["2fa2104d6b38d11b0230010559879124e42ab8dfeff5ff29dc9cdadd4ecacc3f","2de1068295dd865b64569335bd5dd80181d70ecfc882648423ba76b532b7d67"],["9248279b09b4d68dab21a9b066edda83263c3d84e09572e269ca0cd7f5453714","73016f7bf234aade5d1aa71bdea2b1ff3fc0de2a887912ffe54a32ce97cb3402"],["daed4f2be3a8bf278e70132fb0beb7522f570e144bf615c07e996d443dee8729","a69dce4a7d6c98e8d4a1aca87ef8d7003f83c230f3afa726ab40e52290be1c55"],["c44d12c7065d812e8acf28d7cbb19f9011ecd9e9fdf281b0e6a3b5e87d22e7db","2119a460ce326cdc76c45926c982fdac0e106e861edf61c5a039063f0e0e6482"],["6a245bf6dc698504c89a20cfded60853152b695336c28063b61c65cbd269e6b4","e022cf42c2bd4a708b3f5126f16a24ad8b33ba48d0423b6efd5e6348100d8a82"],["1697ffa6fd9de627c077e3d2fe541084ce13300b0bec1146f95ae57f0d0bd6a5","b9c398f186806f5d27561506e4557433a2cf15009e498ae7adee9d63d01b2396"],["605bdb019981718b986d0f07e834cb0d9deb8360ffb7f61df982345ef27a7479","2972d2de4f8d20681a78d93ec96fe23c26bfae84fb14db43b01e1e9056b8c49"],["62d14dab4150bf497402fdc45a215e10dcb01c354959b10cfe31c7e9d87ff33d","80fc06bd8cc5b01098088a1950eed0db01aa132967ab472235f5642483b25eaf"],["80c60ad0040f27dade5b4b06c408e56b2c50e9f56b9b8b425e555c2f86308b6f","1c38303f1cc5c30f26e66bad7fe72f70a65eed4cbe7024eb1aa01f56430bd57a"],["7a9375ad6167ad54aa74c6348cc54d344cc5dc9487d847049d5eabb0fa03c8fb","d0e3fa9eca8726909559e0d79269046bdc59ea10c70ce2b02d499ec224dc7f7"],["d528ecd9b696b54c907a9ed045447a79bb408ec39b68df504bb51f459bc3ffc9","eecf41253136e5f99966f21881fd656ebc4345405c520dbc063465b521409933"],["49370a4b5f43412ea25f514e8ecdad05266115e4a7ecb1387231808f8b45963","758f3f41afd6ed428b3081b0512fd62a54c3f3afbb5b6764b653052a12949c9a"],["77f230936ee88cbbd73df930d64702ef881d811e0e1498e2f1c13eb1fc345d74","958ef42a7886b6400a08266e9ba1b37896c95330d97077cbbe8eb3c7671c60d6"],["f2dac991cc4ce4b9ea44887e5c7c0bce58c80074ab9d4dbaeb28531b7739f530","e0dedc9b3b2f8dad4da1f32dec2531df9eb5fbeb0598e4fd1a117dba703a3c37"],["463b3d9f662621fb1b4be8fbbe2520125a216cdfc9dae3debcba4850c690d45b","5ed430d78c296c3543114306dd8622d7c622e27c970a1de31cb377b01af7307e"],["f16f804244e46e2a09232d4aff3b59976b98fac14328a2d1a32496b49998f247","cedabd9b82203f7e13d206fcdf4e33d92a6c53c26e5cce26d6579962c4e31df6"],["caf754272dc84563b0352b7a14311af55d245315ace27c65369e15f7151d41d1","cb474660ef35f5f2a41b643fa5e460575f4fa9b7962232a5c32f908318a04476"],["2600ca4b282cb986f85d0f1709979d8b44a09c07cb86d7c124497bc86f082120","4119b88753c15bd6a693b03fcddbb45d5ac6be74ab5f0ef44b0be9475a7e4b40"],["7635ca72d7e8432c338ec53cd12220bc01c48685e24f7dc8c602a7746998e435","91b649609489d613d1d5e590f78e6d74ecfc061d57048bad9e76f302c5b9c61"],["754e3239f325570cdbbf4a87deee8a66b7f2b33479d468fbc1a50743bf56cc18","673fb86e5bda30fb3cd0ed304ea49a023ee33d0197a695d0c5d98093c536683"],["e3e6bd1071a1e96aff57859c82d570f0330800661d1c952f9fe2694691d9b9e8","59c9e0bba394e76f40c0aa58379a3cb6a5a2283993e90c4167002af4920e37f5"],["186b483d056a033826ae73d88f732985c4ccb1f32ba35f4b4cc47fdcf04aa6eb","3b952d32c67cf77e2e17446e204180ab21fb8090895138b4a4a797f86e80888b"],["df9d70a6b9876ce544c98561f4be4f725442e6d2b737d9c91a8321724ce0963f","55eb2dafd84d6ccd5f862b785dc39d4ab157222720ef9da217b8c45cf2ba2417"],["5edd5cc23c51e87a497ca815d5dce0f8ab52554f849ed8995de64c5f34ce7143","efae9c8dbc14130661e8cec030c89ad0c13c66c0d17a2905cdc706ab7399a868"],["290798c2b6476830da12fe02287e9e777aa3fba1c355b17a722d362f84614fba","e38da76dcd440621988d00bcf79af25d5b29c094db2a23146d003afd41943e7a"],["af3c423a95d9f5b3054754efa150ac39cd29552fe360257362dfdecef4053b45","f98a3fd831eb2b749a93b0e6f35cfb40c8cd5aa667a15581bc2feded498fd9c6"],["766dbb24d134e745cccaa28c99bf274906bb66b26dcf98df8d2fed50d884249a","744b1152eacbe5e38dcc887980da38b897584a65fa06cedd2c924f97cbac5996"],["59dbf46f8c94759ba21277c33784f41645f7b44f6c596a58ce92e666191abe3e","c534ad44175fbc300f4ea6ce648309a042ce739a7919798cd85e216c4a307f6e"],["f13ada95103c4537305e691e74e9a4a8dd647e711a95e73cb62dc6018cfd87b8","e13817b44ee14de663bf4bc808341f326949e21a6a75c2570778419bdaf5733d"],["7754b4fa0e8aced06d4167a2c59cca4cda1869c06ebadfb6488550015a88522c","30e93e864e669d82224b967c3020b8fa8d1e4e350b6cbcc537a48b57841163a2"],["948dcadf5990e048aa3874d46abef9d701858f95de8041d2a6828c99e2262519","e491a42537f6e597d5d28a3224b1bc25df9154efbd2ef1d2cbba2cae5347d57e"],["7962414450c76c1689c7b48f8202ec37fb224cf5ac0bfa1570328a8a3d7c77ab","100b610ec4ffb4760d5c1fc133ef6f6b12507a051f04ac5760afa5b29db83437"],["3514087834964b54b15b160644d915485a16977225b8847bb0dd085137ec47ca","ef0afbb2056205448e1652c48e8127fc6039e77c15c2378b7e7d15a0de293311"],["d3cc30ad6b483e4bc79ce2c9dd8bc54993e947eb8df787b442943d3f7b527eaf","8b378a22d827278d89c5e9be8f9508ae3c2ad46290358630afb34db04eede0a4"],["1624d84780732860ce1c78fcbfefe08b2b29823db913f6493975ba0ff4847610","68651cf9b6da903e0914448c6cd9d4ca896878f5282be4c8cc06e2a404078575"],["733ce80da955a8a26902c95633e62a985192474b5af207da6df7b4fd5fc61cd4","f5435a2bd2badf7d485a4d8b8db9fcce3e1ef8e0201e4578c54673bc1dc5ea1d"],["15d9441254945064cf1a1c33bbd3b49f8966c5092171e699ef258dfab81c045c","d56eb30b69463e7234f5137b73b84177434800bacebfc685fc37bbe9efe4070d"],["a1d0fcf2ec9de675b612136e5ce70d271c21417c9d2b8aaaac138599d0717940","edd77f50bcb5a3cab2e90737309667f2641462a54070f3d519212d39c197a629"],["e22fbe15c0af8ccc5780c0735f84dbe9a790badee8245c06c7ca37331cb36980","a855babad5cd60c88b430a69f53a1a7a38289154964799be43d06d77d31da06"],["311091dd9860e8e20ee13473c1155f5f69635e394704eaa74009452246cfa9b3","66db656f87d1f04fffd1f04788c06830871ec5a64feee685bd80f0b1286d8374"],["34c1fd04d301be89b31c0442d3e6ac24883928b45a9340781867d4232ec2dbdf","9414685e97b1b5954bd46f730174136d57f1ceeb487443dc5321857ba73abee"],["f219ea5d6b54701c1c14de5b557eb42a8d13f3abbcd08affcc2a5e6b049b8d63","4cb95957e83d40b0f73af4544cccf6b1f4b08d3c07b27fb8d8c2962a400766d1"],["d7b8740f74a8fbaab1f683db8f45de26543a5490bca627087236912469a0b448","fa77968128d9c92ee1010f337ad4717eff15db5ed3c049b3411e0315eaa4593b"],["32d31c222f8f6f0ef86f7c98d3a3335ead5bcd32abdd94289fe4d3091aa824bf","5f3032f5892156e39ccd3d7915b9e1da2e6dac9e6f26e961118d14b8462e1661"],["7461f371914ab32671045a155d9831ea8793d77cd59592c4340f86cbc18347b5","8ec0ba238b96bec0cbdddcae0aa442542eee1ff50c986ea6b39847b3cc092ff6"],["ee079adb1df1860074356a25aa38206a6d716b2c3e67453d287698bad7b2b2d6","8dc2412aafe3be5c4c5f37e0ecc5f9f6a446989af04c4e25ebaac479ec1c8c1e"],["16ec93e447ec83f0467b18302ee620f7e65de331874c9dc72bfd8616ba9da6b5","5e4631150e62fb40d0e8c2a7ca5804a39d58186a50e497139626778e25b0674d"],["eaa5f980c245f6f038978290afa70b6bd8855897f98b6aa485b96065d537bd99","f65f5d3e292c2e0819a528391c994624d784869d7e6ea67fb18041024edc07dc"],["78c9407544ac132692ee1910a02439958ae04877151342ea96c4b6b35a49f51","f3e0319169eb9b85d5404795539a5e68fa1fbd583c064d2462b675f194a3ddb4"],["494f4be219a1a77016dcd838431aea0001cdc8ae7a6fc688726578d9702857a5","42242a969283a5f339ba7f075e36ba2af925ce30d767ed6e55f4b031880d562c"],["a598a8030da6d86c6bc7f2f5144ea549d28211ea58faa70ebf4c1e665c1fe9b5","204b5d6f84822c307e4b4a7140737aec23fc63b65b35f86a10026dbd2d864e6b"],["c41916365abb2b5d09192f5f2dbeafec208f020f12570a184dbadc3e58595997","4f14351d0087efa49d245b328984989d5caf9450f34bfc0ed16e96b58fa9913"],["841d6063a586fa475a724604da03bc5b92a2e0d2e0a36acfe4c73a5514742881","73867f59c0659e81904f9a1c7543698e62562d6744c169ce7a36de01a8d6154"],["5e95bb399a6971d376026947f89bde2f282b33810928be4ded112ac4d70e20d5","39f23f366809085beebfc71181313775a99c9aed7d8ba38b161384c746012865"],["36e4641a53948fd476c39f8a99fd974e5ec07564b5315d8bf99471bca0ef2f66","d2424b1b1abe4eb8164227b085c9aa9456ea13493fd563e06fd51cf5694c78fc"],["336581ea7bfbbb290c191a2f507a41cf5643842170e914faeab27c2c579f726","ead12168595fe1be99252129b6e56b3391f7ab1410cd1e0ef3dcdcabd2fda224"],["8ab89816dadfd6b6a1f2634fcf00ec8403781025ed6890c4849742706bd43ede","6fdcef09f2f6d0a044e654aef624136f503d459c3e89845858a47a9129cdd24e"],["1e33f1a746c9c5778133344d9299fcaa20b0938e8acff2544bb40284b8c5fb94","60660257dd11b3aa9c8ed618d24edff2306d320f1d03010e33a7d2057f3b3b6"],["85b7c1dcb3cec1b7ee7f30ded79dd20a0ed1f4cc18cbcfcfa410361fd8f08f31","3d98a9cdd026dd43f39048f25a8847f4fcafad1895d7a633c6fed3c35e999511"],["29df9fbd8d9e46509275f4b125d6d45d7fbe9a3b878a7af872a2800661ac5f51","b4c4fe99c775a606e2d8862179139ffda61dc861c019e55cd2876eb2a27d84b"],["a0b1cae06b0a847a3fea6e671aaf8adfdfe58ca2f768105c8082b2e449fce252","ae434102edde0958ec4b19d917a6a28e6b72da1834aff0e650f049503a296cf2"],["4e8ceafb9b3e9a136dc7ff67e840295b499dfb3b2133e4ba113f2e4c0e121e5","cf2174118c8b6d7a4b48f6d534ce5c79422c086a63460502b827ce62a326683c"],["d24a44e047e19b6f5afb81c7ca2f69080a5076689a010919f42725c2b789a33b","6fb8d5591b466f8fc63db50f1c0f1c69013f996887b8244d2cdec417afea8fa3"],["ea01606a7a6c9cdd249fdfcfacb99584001edd28abbab77b5104e98e8e3b35d4","322af4908c7312b0cfbfe369f7a7b3cdb7d4494bc2823700cfd652188a3ea98d"],["af8addbf2b661c8a6c6328655eb96651252007d8c5ea31be4ad196de8ce2131f","6749e67c029b85f52a034eafd096836b2520818680e26ac8f3dfbcdb71749700"],["e3ae1974566ca06cc516d47e0fb165a674a3dabcfca15e722f0e3450f45889","2aeabe7e4531510116217f07bf4d07300de97e4874f81f533420a72eeb0bd6a4"],["591ee355313d99721cf6993ffed1e3e301993ff3ed258802075ea8ced397e246","b0ea558a113c30bea60fc4775460c7901ff0b053d25ca2bdeee98f1a4be5d196"],["11396d55fda54c49f19aa97318d8da61fa8584e47b084945077cf03255b52984","998c74a8cd45ac01289d5833a7beb4744ff536b01b257be4c5767bea93ea57a4"],["3c5d2a1ba39c5a1790000738c9e0c40b8dcdfd5468754b6405540157e017aa7a","b2284279995a34e2f9d4de7396fc18b80f9b8b9fdd270f6661f79ca4c81bd257"],["cc8704b8a60a0defa3a99a7299f2e9c3fbc395afb04ac078425ef8a1793cc030","bdd46039feed17881d1e0862db347f8cf395b74fc4bcdc4e940b74e3ac1f1b13"],["c533e4f7ea8555aacd9777ac5cad29b97dd4defccc53ee7ea204119b2889b197","6f0a256bc5efdf429a2fb6242f1a43a2d9b925bb4a4b3a26bb8e0f45eb596096"],["c14f8f2ccb27d6f109f6d08d03cc96a69ba8c34eec07bbcf566d48e33da6593","c359d6923bb398f7fd4473e16fe1c28475b740dd098075e6c0e8649113dc3a38"],["a6cbc3046bc6a450bac24789fa17115a4c9739ed75f8f21ce441f72e0b90e6ef","21ae7f4680e889bb130619e2c0f95a360ceb573c70603139862afd617fa9b9f"],["347d6d9a02c48927ebfb86c1359b1caf130a3c0267d11ce6344b39f99d43cc38","60ea7f61a353524d1c987f6ecec92f086d565ab687870cb12689ff1e31c74448"],["da6545d2181db8d983f7dcb375ef5866d47c67b1bf31c8cf855ef7437b72656a","49b96715ab6878a79e78f07ce5680c5d6673051b4935bd897fea824b77dc208a"],["c40747cc9d012cb1a13b8148309c6de7ec25d6945d657146b9d5994b8feb1111","5ca560753be2a12fc6de6caf2cb489565db936156b9514e1bb5e83037e0fa2d4"],["4e42c8ec82c99798ccf3a610be870e78338c7f713348bd34c8203ef4037f3502","7571d74ee5e0fb92a7a8b33a07783341a5492144cc54bcc40a94473693606437"],["3775ab7089bc6af823aba2e1af70b236d251cadb0c86743287522a1b3b0dedea","be52d107bcfa09d8bcb9736a828cfa7fac8db17bf7a76a2c42ad961409018cf7"],["cee31cbf7e34ec379d94fb814d3d775ad954595d1314ba8846959e3e82f74e26","8fd64a14c06b589c26b947ae2bcf6bfa0149ef0be14ed4d80f448a01c43b1c6d"],["b4f9eaea09b6917619f6ea6a4eb5464efddb58fd45b1ebefcdc1a01d08b47986","39e5c9925b5a54b07433a4f18c61726f8bb131c012ca542eb24a8ac07200682a"],["d4263dfc3d2df923a0179a48966d30ce84e2515afc3dccc1b77907792ebcc60e","62dfaf07a0f78feb30e30d6295853ce189e127760ad6cf7fae164e122a208d54"],["48457524820fa65a4f8d35eb6930857c0032acc0a4a2de422233eeda897612c4","25a748ab367979d98733c38a1fa1c2e7dc6cc07db2d60a9ae7a76aaa49bd0f77"],["dfeeef1881101f2cb11644f3a2afdfc2045e19919152923f367a1767c11cceda","ecfb7056cf1de042f9420bab396793c0c390bde74b4bbdff16a83ae09a9a7517"],["6d7ef6b17543f8373c573f44e1f389835d89bcbc6062ced36c82df83b8fae859","cd450ec335438986dfefa10c57fea9bcc521a0959b2d80bbf74b190dca712d10"],["e75605d59102a5a2684500d3b991f2e3f3c88b93225547035af25af66e04541f","f5c54754a8f71ee540b9b48728473e314f729ac5308b06938360990e2bfad125"],["eb98660f4c4dfaa06a2be453d5020bc99a0c2e60abe388457dd43fefb1ed620c","6cb9a8876d9cb8520609af3add26cd20a0a7cd8a9411131ce85f44100099223e"],["13e87b027d8514d35939f2e6892b19922154596941888336dc3563e3b8dba942","fef5a3c68059a6dec5d624114bf1e91aac2b9da568d6abeb2570d55646b8adf1"],["ee163026e9fd6fe017c38f06a5be6fc125424b371ce2708e7bf4491691e5764a","1acb250f255dd61c43d94ccc670d0f58f49ae3fa15b96623e5430da0ad6c62b2"],["b268f5ef9ad51e4d78de3a750c2dc89b1e626d43505867999932e5db33af3d80","5f310d4b3c99b9ebb19f77d41c1dee018cf0d34fd4191614003e945a1216e423"],["ff07f3118a9df035e9fad85eb6c7bfe42b02f01ca99ceea3bf7ffdba93c4750d","438136d603e858a3a5c440c38eccbaddc1d2942114e2eddd4740d098ced1f0d8"],["8d8b9855c7c052a34146fd20ffb658bea4b9f69e0d825ebec16e8c3ce2b526a1","cdb559eedc2d79f926baf44fb84ea4d44bcf50fee51d7ceb30e2e7f463036758"],["52db0b5384dfbf05bfa9d472d7ae26dfe4b851ceca91b1eba54263180da32b63","c3b997d050ee5d423ebaf66a6db9f57b3180c902875679de924b69d84a7b375"],["e62f9490d3d51da6395efd24e80919cc7d0f29c3f3fa48c6fff543becbd43352","6d89ad7ba4876b0b22c2ca280c682862f342c8591f1daf5170e07bfd9ccafa7d"],["7f30ea2476b399b4957509c88f77d0191afa2ff5cb7b14fd6d8e7d65aaab1193","ca5ef7d4b231c94c3b15389a5f6311e9daff7bb67b103e9880ef4bff637acaec"],["5098ff1e1d9f14fb46a210fada6c903fef0fb7b4a1dd1d9ac60a0361800b7a00","9731141d81fc8f8084d37c6e7542006b3ee1b40d60dfe5362a5b132fd17ddc0"],["32b78c7de9ee512a72895be6b9cbefa6e2f3c4ccce445c96b9f2c81e2778ad58","ee1849f513df71e32efc3896ee28260c73bb80547ae2275ba497237794c8753c"],["e2cb74fddc8e9fbcd076eef2a7c72b0ce37d50f08269dfc074b581550547a4f7","d3aa2ed71c9dd2247a62df062736eb0baddea9e36122d2be8641abcb005cc4a4"],["8438447566d4d7bedadc299496ab357426009a35f235cb141be0d99cd10ae3a8","c4e1020916980a4da5d01ac5e6ad330734ef0d7906631c4f2390426b2edd791f"],["4162d488b89402039b584c6fc6c308870587d9c46f660b878ab65c82c711d67e","67163e903236289f776f22c25fb8a3afc1732f2b84b4e95dbda47ae5a0852649"],["3fad3fa84caf0f34f0f89bfd2dcf54fc175d767aec3e50684f3ba4a4bf5f683d","cd1bc7cb6cc407bb2f0ca647c718a730cf71872e7d0d2a53fa20efcdfe61826"],["674f2600a3007a00568c1a7ce05d0816c1fb84bf1370798f1c69532faeb1a86b","299d21f9413f33b3edf43b257004580b70db57da0b182259e09eecc69e0d38a5"],["d32f4da54ade74abb81b815ad1fb3b263d82d6c692714bcff87d29bd5ee9f08f","f9429e738b8e53b968e99016c059707782e14f4535359d582fc416910b3eea87"],["30e4e670435385556e593657135845d36fbb6931f72b08cb1ed954f1e3ce3ff6","462f9bce619898638499350113bbc9b10a878d35da70740dc695a559eb88db7b"],["be2062003c51cc3004682904330e4dee7f3dcd10b01e580bf1971b04d4cad297","62188bc49d61e5428573d48a74e1c655b1c61090905682a0d5558ed72dccb9bc"],["93144423ace3451ed29e0fb9ac2af211cb6e84a601df5993c419859fff5df04a","7c10dfb164c3425f5c71a3f9d7992038f1065224f72bb9d1d902a6d13037b47c"],["b015f8044f5fcbdcf21ca26d6c34fb8197829205c7b7d2a7cb66418c157b112c","ab8c1e086d04e813744a655b2df8d5f83b3cdc6faa3088c1d3aea1454e3a1d5f"],["d5e9e1da649d97d89e4868117a465a3a4f8a18de57a140d36b3f2af341a21b52","4cb04437f391ed73111a13cc1d4dd0db1693465c2240480d8955e8592f27447a"],["d3ae41047dd7ca065dbf8ed77b992439983005cd72e16d6f996a5316d36966bb","bd1aeb21ad22ebb22a10f0303417c6d964f8cdd7df0aca614b10dc14d125ac46"],["463e2763d885f958fc66cdd22800f0a487197d0a82e377b49f80af87c897b065","bfefacdb0e5d0fd7df3a311a94de062b26b80c61fbc97508b79992671ef7ca7f"],["7985fdfd127c0567c6f53ec1bb63ec3158e597c40bfe747c83cddfc910641917","603c12daf3d9862ef2b25fe1de289aed24ed291e0ec6708703a5bd567f32ed03"],["74a1ad6b5f76e39db2dd249410eac7f99e74c59cb83d2d0ed5ff1543da7703e9","cc6157ef18c9c63cd6193d83631bbea0093e0968942e8c33d5737fd790e0db08"],["30682a50703375f602d416664ba19b7fc9bab42c72747463a71d0896b22f6da3","553e04f6b018b4fa6c8f39e7f311d3176290d0e0f19ca73f17714d9977a22ff8"],["9e2158f0d7c0d5f26c3791efefa79597654e7a2b2464f52b1ee6c1347769ef57","712fcdd1b9053f09003a3481fa7762e9ffd7c8ef35a38509e2fbf2629008373"],["176e26989a43c9cfeba4029c202538c28172e566e3c4fce7322857f3be327d66","ed8cc9d04b29eb877d270b4878dc43c19aefd31f4eee09ee7b47834c1fa4b1c3"],["75d46efea3771e6e68abb89a13ad747ecf1892393dfc4f1b7004788c50374da8","9852390a99507679fd0b86fd2b39a868d7efc22151346e1a3ca4726586a6bed8"],["809a20c67d64900ffb698c4c825f6d5f2310fb0451c869345b7319f645605721","9e994980d9917e22b76b061927fa04143d096ccc54963e6a5ebfa5f3f8e286c1"],["1b38903a43f7f114ed4500b4eac7083fdefece1cf29c63528d563446f972c180","4036edc931a60ae889353f77fd53de4a2708b26b6f5da72ad3394119daf408f9"]]}})}catch(t){e=void 0}a("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:n.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",e]})}(tp);var ep=Xn,rp=md,np=Qn;function ip(t){if(!(this instanceof ip))return new ip(t);this.hash=t.hash,this.predResist=!!t.predResist,this.outLen=this.hash.outSize,this.minEntropy=t.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var e=rp.toArray(t.entropy,t.entropyEnc||"hex"),r=rp.toArray(t.nonce,t.nonceEnc||"hex"),n=rp.toArray(t.pers,t.persEnc||"hex");np(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,r,n)}var op=ip;ip.prototype._init=function(t,e,r){var n=t.concat(e).concat(r);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var i=0;i<this.V.length;i++)this.K[i]=0,this.V[i]=1;this._update(n),this._reseed=1,this.reseedInterval=281474976710656},ip.prototype._hmac=function(){return new ep.hmac(this.hash,this.K)},ip.prototype._update=function(t){var e=this._hmac().update(this.V).update([0]);t&&(e=e.update(t)),this.K=e.digest(),this.V=this._hmac().update(this.V).digest(),t&&(this.K=this._hmac().update(this.V).update([1]).update(t).digest(),this.V=this._hmac().update(this.V).digest())},ip.prototype.reseed=function(t,e,r,n){"string"!=typeof e&&(n=r,r=e,e=null),t=rp.toArray(t,e),r=rp.toArray(r,n),np(t.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(t.concat(r||[])),this._reseed=1},ip.prototype.generate=function(t,e,r,n){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");"string"!=typeof e&&(n=r,r=e,e=null),r&&(r=rp.toArray(r,n||"hex"),this._update(r));for(var i=[];i.length<t;)this.V=this._hmac().update(this.V).digest(),i=i.concat(this.V);var o=i.slice(0,t);return this._update(r),this._reseed++,rp.encode(o,e)};var sp=pd,ap=ld.assert;function up(t,e){this.ec=t,this.priv=null,this.pub=null,e.priv&&this._importPrivate(e.priv,e.privEnc),e.pub&&this._importPublic(e.pub,e.pubEnc)}var hp=up;up.fromPublic=function(t,e,r){return e instanceof up?e:new up(t,{pub:e,pubEnc:r})},up.fromPrivate=function(t,e,r){return e instanceof up?e:new up(t,{priv:e,privEnc:r})},up.prototype.validate=function(){var t=this.getPublic();return t.isInfinity()?{result:!1,reason:"Invalid public key"}:t.validate()?t.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}},up.prototype.getPublic=function(t,e){return"string"==typeof t&&(e=t,t=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),e?this.pub.encode(e,t):this.pub},up.prototype.getPrivate=function(t){return"hex"===t?this.priv.toString(16,2):this.priv},up.prototype._importPrivate=function(t,e){this.priv=new sp(t,e||16),this.priv=this.priv.umod(this.ec.curve.n)},up.prototype._importPublic=function(t,e){if(t.x||t.y)return"mont"===this.ec.curve.type?ap(t.x,"Need x coordinate"):"short"!==this.ec.curve.type&&"edwards"!==this.ec.curve.type||ap(t.x&&t.y,"Need both x and y coordinate"),void(this.pub=this.ec.curve.point(t.x,t.y));this.pub=this.ec.curve.decodePoint(t,e)},up.prototype.derive=function(t){return t.validate()||ap(t.validate(),"public point not validated"),t.mul(this.priv).getX()},up.prototype.sign=function(t,e,r){return this.ec.sign(t,this,e,r)},up.prototype.verify=function(t,e,r){return this.ec.verify(t,e,this,void 0,r)},up.prototype.inspect=function(){return"<Key priv: "+(this.priv&&this.priv.toString(16,2))+" pub: "+(this.pub&&this.pub.inspect())+" >"};var cp=pd,fp=ld,lp=fp.assert;function dp(t,e){if(t instanceof dp)return t;this._importDER(t,e)||(lp(t.r&&t.s,"Signature without r or s"),this.r=new cp(t.r,16),this.s=new cp(t.s,16),void 0===t.recoveryParam?this.recoveryParam=null:this.recoveryParam=t.recoveryParam)}var pp=dp;function mp(){this.place=0}function gp(t,e){var r=t[e.place++];if(!(128&r))return r;var n=15&r;if(0===n||n>4)return!1;if(0===t[e.place])return!1;for(var i=0,o=0,s=e.place;o<n;o++,s++)i<<=8,i|=t[s],i>>>=0;return!(i<=127)&&(e.place=s,i)}function yp(t){for(var e=0,r=t.length-1;!t[e]&&!(128&t[e+1])&&e<r;)e++;return 0===e?t:t.slice(e)}function bp(t,e){if(e<128)t.push(e);else{var r=1+(Math.log(e)/Math.LN2>>>3);for(t.push(128|r);--r;)t.push(e>>>(r<<3)&255);t.push(e)}}dp.prototype._importDER=function(t,e){t=fp.toArray(t,e);var r=new mp;if(48!==t[r.place++])return!1;var n=gp(t,r);if(!1===n)return!1;if(n+r.place!==t.length)return!1;if(2!==t[r.place++])return!1;var i=gp(t,r);if(!1===i)return!1;if(128&t[r.place])return!1;var o=t.slice(r.place,i+r.place);if(r.place+=i,2!==t[r.place++])return!1;var s=gp(t,r);if(!1===s)return!1;if(t.length!==s+r.place)return!1;if(128&t[r.place])return!1;var a=t.slice(r.place,s+r.place);if(0===o[0]){if(!(128&o[1]))return!1;o=o.slice(1)}if(0===a[0]){if(!(128&a[1]))return!1;a=a.slice(1)}return this.r=new cp(o),this.s=new cp(a),this.recoveryParam=null,!0},dp.prototype.toDER=function(t){var e=this.r.toArray(),r=this.s.toArray();for(128&e[0]&&(e=[0].concat(e)),128&r[0]&&(r=[0].concat(r)),e=yp(e),r=yp(r);!(r[0]||128&r[1]);)r=r.slice(1);var n=[2];bp(n,e.length),(n=n.concat(e)).push(2),bp(n,r.length);var i=n.concat(r),o=[48];return bp(o,i.length),o=o.concat(i),fp.encode(o,t)};var vp=pd,wp=op,_p=tp,Ep=wd,Ap=ld.assert,Mp=hp,Sp=pp;function kp(t){if(!(this instanceof kp))return new kp(t);"string"==typeof t&&(Ap(Object.prototype.hasOwnProperty.call(_p,t),"Unknown curve "+t),t=_p[t]),t instanceof _p.PresetCurve&&(t={curve:t}),this.curve=t.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=t.curve.g,this.g.precompute(t.curve.n.bitLength()+1),this.hash=t.hash||t.curve.hash}var xp=kp;kp.prototype.keyPair=function(t){return new Mp(this,t)},kp.prototype.keyFromPrivate=function(t,e){return Mp.fromPrivate(this,t,e)},kp.prototype.keyFromPublic=function(t,e){return Mp.fromPublic(this,t,e)},kp.prototype.genKeyPair=function(t){t||(t={});for(var e=new wp({hash:this.hash,pers:t.pers,persEnc:t.persEnc||"utf8",entropy:t.entropy||Ep(this.hash.hmacStrength),entropyEnc:t.entropy&&t.entropyEnc||"utf8",nonce:this.n.toArray()}),r=this.n.byteLength(),n=this.n.sub(new vp(2));;){var i=new vp(e.generate(r));if(!(i.cmp(n)>0))return i.iaddn(1),this.keyFromPrivate(i)}},kp.prototype._truncateToN=function(t,e,r){var n;if(vp.isBN(t)||"number"==typeof t)n=(t=new vp(t,16)).byteLength();else if("object"==typeof t)n=t.length,t=new vp(t,16);else{var i=t.toString();n=i.length+1>>>1,t=new vp(i,16)}"number"!=typeof r&&(r=8*n);var o=r-this.n.bitLength();return o>0&&(t=t.ushrn(o)),!e&&t.cmp(this.n)>=0?t.sub(this.n):t},kp.prototype.sign=function(t,e,r,n){if("object"==typeof r&&(n=r,r=null),n||(n={}),"string"!=typeof t&&"number"!=typeof t&&!vp.isBN(t)){Ap("object"==typeof t&&t&&"number"==typeof t.length,"Expected message to be an array-like, a hex string, or a BN instance"),Ap(t.length>>>0===t.length);for(var i=0;i<t.length;i++)Ap((255&t[i])===t[i])}e=this.keyFromPrivate(e,r),t=this._truncateToN(t,!1,n.msgBitLength),Ap(!t.isNeg(),"Can not sign a negative message");var o=this.n.byteLength(),s=e.getPrivate().toArray("be",o),a=t.toArray("be",o);Ap(new vp(a).eq(t),"Can not sign message");for(var u=new wp({hash:this.hash,entropy:s,nonce:a,pers:n.pers,persEnc:n.persEnc||"utf8"}),h=this.n.sub(new vp(1)),c=0;;c++){var f=n.k?n.k(c):new vp(u.generate(this.n.byteLength()));if(!((f=this._truncateToN(f,!0)).cmpn(1)<=0||f.cmp(h)>=0)){var l=this.g.mul(f);if(!l.isInfinity()){var d=l.getX(),p=d.umod(this.n);if(0!==p.cmpn(0)){var m=f.invm(this.n).mul(p.mul(e.getPrivate()).iadd(t));if(0!==(m=m.umod(this.n)).cmpn(0)){var g=(l.getY().isOdd()?1:0)|(0!==d.cmp(p)?2:0);return n.canonical&&m.cmp(this.nh)>0&&(m=this.n.sub(m),g^=1),new Sp({r:p,s:m,recoveryParam:g})}}}}}},kp.prototype.verify=function(t,e,r,n,i){i||(i={}),t=this._truncateToN(t,!1,i.msgBitLength),r=this.keyFromPublic(r,n);var o=(e=new Sp(e,"hex")).r,s=e.s;if(o.cmpn(1)<0||o.cmp(this.n)>=0)return!1;if(s.cmpn(1)<0||s.cmp(this.n)>=0)return!1;var a,u=s.invm(this.n),h=u.mul(t).umod(this.n),c=u.mul(o).umod(this.n);return this.curve._maxwellTrick?!(a=this.g.jmulAdd(h,r.getPublic(),c)).isInfinity()&&a.eqXToP(o):!(a=this.g.mulAdd(h,r.getPublic(),c)).isInfinity()&&0===a.getX().umod(this.n).cmp(o)},kp.prototype.recoverPubKey=function(t,e,r,n){Ap((3&r)===r,"The recovery param is more than two bits"),e=new Sp(e,n);var i=this.n,o=new vp(t),s=e.r,a=e.s,u=1&r,h=r>>1;if(s.cmp(this.curve.p.umod(this.curve.n))>=0&&h)throw new Error("Unable to find sencond key candinate");s=h?this.curve.pointFromX(s.add(this.curve.n),u):this.curve.pointFromX(s,u);var c=e.r.invm(i),f=i.sub(o).mul(c).umod(i),l=a.mul(c).umod(i);return this.g.mulAdd(f,s,l)},kp.prototype.getKeyRecoveryParam=function(t,e,r,n){if(null!==(e=new Sp(e,n)).recoveryParam)return e.recoveryParam;for(var i=0;i<4;i++){var o;try{o=this.recoverPubKey(t,e,i)}catch(t){continue}if(o.eq(r))return i}throw new Error("Unable to find valid recovery factor")};var Tp=ld,Rp=Tp.assert,Bp=Tp.parseBytes,Np=Tp.cachedProperty;function Pp(t,e){this.eddsa=t,this._secret=Bp(e.secret),t.isPoint(e.pub)?this._pub=e.pub:this._pubBytes=Bp(e.pub)}Pp.fromPublic=function(t,e){return e instanceof Pp?e:new Pp(t,{pub:e})},Pp.fromSecret=function(t,e){return e instanceof Pp?e:new Pp(t,{secret:e})},Pp.prototype.secret=function(){return this._secret},Np(Pp,"pubBytes",function(){return this.eddsa.encodePoint(this.pub())}),Np(Pp,"pub",function(){return this._pubBytes?this.eddsa.decodePoint(this._pubBytes):this.eddsa.g.mul(this.priv())}),Np(Pp,"privBytes",function(){var t=this.eddsa,e=this.hash(),r=t.encodingLength-1,n=e.slice(0,t.encodingLength);return n[0]&=248,n[r]&=127,n[r]|=64,n}),Np(Pp,"priv",function(){return this.eddsa.decodeInt(this.privBytes())}),Np(Pp,"hash",function(){return this.eddsa.hash().update(this.secret()).digest()}),Np(Pp,"messagePrefix",function(){return this.hash().slice(this.eddsa.encodingLength)}),Pp.prototype.sign=function(t){return Rp(this._secret,"KeyPair can only verify"),this.eddsa.sign(t,this)},Pp.prototype.verify=function(t,e){return this.eddsa.verify(t,e,this)},Pp.prototype.getSecret=function(t){return Rp(this._secret,"KeyPair is public only"),Tp.encode(this.secret(),t)},Pp.prototype.getPublic=function(t){return Tp.encode(this.pubBytes(),t)};var Ip=Pp,Op=pd,Cp=ld,Lp=Cp.assert,jp=Cp.cachedProperty,Dp=Cp.parseBytes;function Up(t,e){this.eddsa=t,"object"!=typeof e&&(e=Dp(e)),Array.isArray(e)&&(Lp(e.length===2*t.encodingLength,"Signature has invalid size"),e={R:e.slice(0,t.encodingLength),S:e.slice(t.encodingLength)}),Lp(e.R&&e.S,"Signature without R or S"),t.isPoint(e.R)&&(this._R=e.R),e.S instanceof Op&&(this._S=e.S),this._Rencoded=Array.isArray(e.R)?e.R:e.Rencoded,this._Sencoded=Array.isArray(e.S)?e.S:e.Sencoded}jp(Up,"S",function(){return this.eddsa.decodeInt(this.Sencoded())}),jp(Up,"R",function(){return this.eddsa.decodePoint(this.Rencoded())}),jp(Up,"Rencoded",function(){return this.eddsa.encodePoint(this.R())}),jp(Up,"Sencoded",function(){return this.eddsa.encodeInt(this.S())}),Up.prototype.toBytes=function(){return this.Rencoded().concat(this.Sencoded())},Up.prototype.toHex=function(){return Cp.encode(this.toBytes(),"hex").toUpperCase()};var Fp=Up,zp=Xn,qp=tp,Hp=ld,Kp=Hp.assert,Gp=Hp.parseBytes,Vp=Ip,Wp=Fp;function Jp(t){if(Kp("ed25519"===t,"only tested with ed25519 so far"),!(this instanceof Jp))return new Jp(t);t=qp[t].curve,this.curve=t,this.g=t.g,this.g.precompute(t.n.bitLength()+1),this.pointClass=t.point().constructor,this.encodingLength=Math.ceil(t.n.bitLength()/8),this.hash=zp.sha512}var Zp=Jp;Jp.prototype.sign=function(t,e){t=Gp(t);var r=this.keyFromSecret(e),n=this.hashInt(r.messagePrefix(),t),i=this.g.mul(n),o=this.encodePoint(i),s=this.hashInt(o,r.pubBytes(),t).mul(r.priv()),a=n.add(s).umod(this.curve.n);return this.makeSignature({R:i,S:a,Rencoded:o})},Jp.prototype.verify=function(t,e,r){if(t=Gp(t),(e=this.makeSignature(e)).S().gte(e.eddsa.curve.n)||e.S().isNeg())return!1;var n=this.keyFromPublic(r),i=this.hashInt(e.Rencoded(),n.pubBytes(),t),o=this.g.mul(e.S());return e.R().add(n.pub().mul(i)).eq(o)},Jp.prototype.hashInt=function(){for(var t=this.hash(),e=0;e<arguments.length;e++)t.update(arguments[e]);return Hp.intFromLE(t.digest()).umod(this.curve.n)},Jp.prototype.keyFromPublic=function(t){return Vp.fromPublic(this,t)},Jp.prototype.keyFromSecret=function(t){return Vp.fromSecret(this,t)},Jp.prototype.makeSignature=function(t){return t instanceof Wp?t:new Wp(this,t)},Jp.prototype.encodePoint=function(t){var e=t.getY().toArray("le",this.encodingLength);return e[this.encodingLength-1]|=t.getX().isOdd()?128:0,e},Jp.prototype.decodePoint=function(t){var e=(t=Hp.parseBytes(t)).length-1,r=t.slice(0,e).concat(-129&t[e]),n=!!(128&t[e]),i=Hp.intFromLE(r);return this.curve.pointFromY(i,n)},Jp.prototype.encodeInt=function(t){return t.toArray("le",this.encodingLength)},Jp.prototype.decodeInt=function(t){return Hp.intFromLE(t)},Jp.prototype.isPoint=function(t){return t instanceof this.pointClass},function(t){var e=t;e.version=fd,e.utils=ld,e.rand=wd,e.curve=_d,e.curves=tp,e.ec=xp,e.eddsa=Zp}(cd);const Yp=new(0,cd.ec)("secp256k1"),Xp=Yp.curve,$p=Xp.n.constructor;function Qp(t){const e=t[0];switch(e){case 2:case 3:return 33!==t.length?null:function(t,e){let r=new $p(e);if(r.cmp(Xp.p)>=0)return null;r=r.toRed(Xp.red);let n=r.redSqr().redIMul(r).redIAdd(Xp.b).redSqrt();3===t!==n.isOdd()&&(n=n.redNeg());const i=r.redSqr().redIMul(r);return n.redSqr().redISub(i.redIAdd(Xp.b)).isZero()?Yp.keyPair({pub:{x:r,y:n}}):null}(e,t.subarray(1,33));case 4:case 6:case 7:return 65!==t.length?null:function(t,e,r){let n=new $p(e),i=new $p(r);if(n.cmp(Xp.p)>=0||i.cmp(Xp.p)>=0)return null;if(n=n.toRed(Xp.red),i=i.toRed(Xp.red),(6===t||7===t)&&i.isOdd()!==(7===t))return null;const o=n.redSqr().redIMul(n);return i.redSqr().redISub(o.redIAdd(Xp.b)).isZero()?Yp.keyPair({pub:{x:n,y:i}}):null}(e,t.subarray(1,33),t.subarray(33,65));default:return null}}function tm(t,e){const r=e.encode(null,33===t.length);for(let e=0;e<t.length;++e)t[e]=r[e]}var em={contextRandomize:()=>0,privateKeyVerify(t){const e=new $p(t);return e.cmp(Xp.n)<0&&!e.isZero()?0:1},privateKeyNegate(t){const e=new $p(t),r=Xp.n.sub(e).umod(Xp.n).toArrayLike(Uint8Array,"be",32);return t.set(r),0},privateKeyTweakAdd(t,e){const r=new $p(e);if(r.cmp(Xp.n)>=0)return 1;if(r.iadd(new $p(t)),r.cmp(Xp.n)>=0&&r.isub(Xp.n),r.isZero())return 1;const n=r.toArrayLike(Uint8Array,"be",32);return t.set(n),0},privateKeyTweakMul(t,e){let r=new $p(e);if(r.cmp(Xp.n)>=0||r.isZero())return 1;r.imul(new $p(t)),r.cmp(Xp.n)>=0&&(r=r.umod(Xp.n));const n=r.toArrayLike(Uint8Array,"be",32);return t.set(n),0},publicKeyVerify:t=>null===Qp(t)?1:0,publicKeyCreate(t,e){const r=new $p(e);if(r.cmp(Xp.n)>=0||r.isZero())return 1;return tm(t,Yp.keyFromPrivate(e).getPublic()),0},publicKeyConvert(t,e){const r=Qp(e);if(null===r)return 1;return tm(t,r.getPublic()),0},publicKeyNegate(t,e){const r=Qp(e);if(null===r)return 1;const n=r.getPublic();return n.y=n.y.redNeg(),tm(t,n),0},publicKeyCombine(t,e){const r=new Array(e.length);for(let t=0;t<e.length;++t)if(r[t]=Qp(e[t]),null===r[t])return 1;let n=r[0].getPublic();for(let t=1;t<r.length;++t)n=n.add(r[t].pub);return n.isInfinity()?2:(tm(t,n),0)},publicKeyTweakAdd(t,e,r){const n=Qp(e);if(null===n)return 1;if((r=new $p(r)).cmp(Xp.n)>=0)return 2;const i=n.getPublic().add(Xp.g.mul(r));return i.isInfinity()?2:(tm(t,i),0)},publicKeyTweakMul(t,e,r){const n=Qp(e);if(null===n)return 1;if((r=new $p(r)).cmp(Xp.n)>=0||r.isZero())return 2;return tm(t,n.getPublic().mul(r)),0},signatureNormalize(t){const e=new $p(t.subarray(0,32)),r=new $p(t.subarray(32,64));return e.cmp(Xp.n)>=0||r.cmp(Xp.n)>=0?1:(1===r.cmp(Yp.nh)&&t.set(Xp.n.sub(r).toArrayLike(Uint8Array,"be",32),32),0)},signatureExport(t,e){const r=e.subarray(0,32),n=e.subarray(32,64);if(new $p(r).cmp(Xp.n)>=0)return 1;if(new $p(n).cmp(Xp.n)>=0)return 1;const{output:i}=t;let o=i.subarray(4,37);o[0]=0,o.set(r,1);let s=33,a=0;for(;s>1&&0===o[a]&&!(128&o[a+1]);--s,++a);if(o=o.subarray(a),128&o[0])return 1;if(s>1&&0===o[0]&&!(128&o[1]))return 1;let u=i.subarray(39,72);u[0]=0,u.set(n,1);let h=33,c=0;for(;h>1&&0===u[c]&&!(128&u[c+1]);--h,++c);return u=u.subarray(c),128&u[0]||h>1&&0===u[0]&&!(128&u[1])?1:(t.outputlen=6+s+h,i[0]=48,i[1]=t.outputlen-2,i[2]=2,i[3]=o.length,i.set(o,4),i[4+s]=2,i[5+s]=u.length,i.set(u,6+s),0)},signatureImport(t,e){if(e.length<8)return 1;if(e.length>72)return 1;if(48!==e[0])return 1;if(e[1]!==e.length-2)return 1;if(2!==e[2])return 1;const r=e[3];if(0===r)return 1;if(5+r>=e.length)return 1;if(2!==e[4+r])return 1;const n=e[5+r];if(0===n)return 1;if(6+r+n!==e.length)return 1;if(128&e[4])return 1;if(r>1&&0===e[4]&&!(128&e[5]))return 1;if(128&e[r+6])return 1;if(n>1&&0===e[r+6]&&!(128&e[r+7]))return 1;let i=e.subarray(4,4+r);if(33===i.length&&0===i[0]&&(i=i.subarray(1)),i.length>32)return 1;let o=e.subarray(6+r);if(33===o.length&&0===o[0]&&(o=o.slice(1)),o.length>32)throw new Error("S length is too long");let s=new $p(i);s.cmp(Xp.n)>=0&&(s=new $p(0));let a=new $p(e.subarray(6+r));return a.cmp(Xp.n)>=0&&(a=new $p(0)),t.set(s.toArrayLike(Uint8Array,"be",32),0),t.set(a.toArrayLike(Uint8Array,"be",32),32),0},ecdsaSign(t,e,r,n,i){if(i){const t=i;i=i=>{const o=t(e,r,null,n,i);if(!(o instanceof Uint8Array&&32===o.length))throw new Error("This is the way");return new $p(o)}}const o=new $p(r);if(o.cmp(Xp.n)>=0||o.isZero())return 1;let s;try{s=Yp.sign(e,r,{canonical:!0,k:i,pers:n})}catch(t){return 1}return t.signature.set(s.r.toArrayLike(Uint8Array,"be",32),0),t.signature.set(s.s.toArrayLike(Uint8Array,"be",32),32),t.recid=s.recoveryParam,0},ecdsaVerify(t,e,r){const n={r:t.subarray(0,32),s:t.subarray(32,64)},i=new $p(n.r),o=new $p(n.s);if(i.cmp(Xp.n)>=0||o.cmp(Xp.n)>=0)return 1;if(1===o.cmp(Yp.nh)||i.isZero()||o.isZero())return 3;const s=Qp(r);if(null===s)return 2;const a=s.getPublic();return Yp.verify(e,n,a)?0:3},ecdsaRecover(t,e,r,n){const i={r:e.slice(0,32),s:e.slice(32,64)},o=new $p(i.r),s=new $p(i.s);if(o.cmp(Xp.n)>=0||s.cmp(Xp.n)>=0)return 1;if(o.isZero()||s.isZero())return 2;let a;try{a=Yp.recoverPubKey(n,i,r)}catch(t){return 2}return tm(t,a),0},ecdh(t,e,r,n,i,o,s){const a=Qp(e);if(null===a)return 1;const u=new $p(r);if(u.cmp(Xp.n)>=0||u.isZero())return 2;const h=a.getPublic().mul(u);if(void 0===i){const e=h.encode(null,!0),r=Yp.hash().update(e).digest();for(let e=0;e<32;++e)t[e]=r[e]}else{o||(o=new Uint8Array(32));const e=h.getX().toArray("be",32);for(let t=0;t<32;++t)o[t]=e[t];s||(s=new Uint8Array(32));const r=h.getY().toArray("be",32);for(let t=0;t<32;++t)s[t]=r[t];const a=i(o,s,n);if(!(a instanceof Uint8Array&&a.length===t.length))return 2;t.set(a)}return 0}},rm=(t=>({contextRandomize(e){if(od(null===e||e instanceof Uint8Array,"Expected seed to be an Uint8Array or null"),null!==e&&sd("seed",e,32),1===t.contextRandomize(e))throw new Error(Yl)},privateKeyVerify:e=>(sd("private key",e,32),0===t.privateKeyVerify(e)),privateKeyNegate(e){switch(sd("private key",e,32),t.privateKeyNegate(e)){case 0:return e;case 1:throw new Error(Wl)}},privateKeyTweakAdd(e,r){switch(sd("private key",e,32),sd("tweak",r,32),t.privateKeyTweakAdd(e,r)){case 0:return e;case 1:throw new Error(Jl)}},privateKeyTweakMul(e,r){switch(sd("private key",e,32),sd("tweak",r,32),t.privateKeyTweakMul(e,r)){case 0:return e;case 1:throw new Error(Zl)}},publicKeyVerify:e=>(sd("public key",e,[33,65]),0===t.publicKeyVerify(e)),publicKeyCreate(e,r=!0,n){switch(sd("private key",e,32),ad(r),n=ud(n,r?33:65),t.publicKeyCreate(n,e)){case 0:return n;case 1:throw new Error(Xl);case 2:throw new Error(Ql)}},publicKeyConvert(e,r=!0,n){switch(sd("public key",e,[33,65]),ad(r),n=ud(n,r?33:65),t.publicKeyConvert(n,e)){case 0:return n;case 1:throw new Error($l);case 2:throw new Error(Ql)}},publicKeyNegate(e,r=!0,n){switch(sd("public key",e,[33,65]),ad(r),n=ud(n,r?33:65),t.publicKeyNegate(n,e)){case 0:return n;case 1:throw new Error($l);case 2:throw new Error(Wl);case 3:throw new Error(Ql)}},publicKeyCombine(e,r=!0,n){od(Array.isArray(e),"Expected public keys to be an Array"),od(e.length>0,"Expected public keys array will have more than zero items");for(const t of e)sd("public key",t,[33,65]);switch(ad(r),n=ud(n,r?33:65),t.publicKeyCombine(n,e)){case 0:return n;case 1:throw new Error($l);case 2:throw new Error(td);case 3:throw new Error(Ql)}},publicKeyTweakAdd(e,r,n=!0,i){switch(sd("public key",e,[33,65]),sd("tweak",r,32),ad(n),i=ud(i,n?33:65),t.publicKeyTweakAdd(i,e,r)){case 0:return i;case 1:throw new Error($l);case 2:throw new Error(Jl)}},publicKeyTweakMul(e,r,n=!0,i){switch(sd("public key",e,[33,65]),sd("tweak",r,32),ad(n),i=ud(i,n?33:65),t.publicKeyTweakMul(i,e,r)){case 0:return i;case 1:throw new Error($l);case 2:throw new Error(Zl)}},signatureNormalize(e){switch(sd("signature",e,64),t.signatureNormalize(e)){case 0:return e;case 1:throw new Error(ed)}},signatureExport(e,r){sd("signature",e,64);const n={output:r=ud(r,72),outputlen:72};switch(t.signatureExport(n,e)){case 0:return r.slice(0,n.outputlen);case 1:throw new Error(ed);case 2:throw new Error(Wl)}},signatureImport(e,r){switch(sd("signature",e),r=ud(r,64),t.signatureImport(r,e)){case 0:return r;case 1:throw new Error(ed);case 2:throw new Error(Wl)}},ecdsaSign(e,r,n={},i){sd("message",e,32),sd("private key",r,32),od("Object"===hd(n),"Expected options to be an Object"),void 0!==n.data&&sd("options.data",n.data),void 0!==n.noncefn&&od("Function"===hd(n.noncefn),"Expected options.noncefn to be a Function");const o={signature:i=ud(i,64),recid:null};switch(t.ecdsaSign(o,e,r,n.data,n.noncefn)){case 0:return o;case 1:throw new Error(rd);case 2:throw new Error(Wl)}},ecdsaVerify(e,r,n){switch(sd("signature",e,64),sd("message",r,32),sd("public key",n,[33,65]),t.ecdsaVerify(e,r,n)){case 0:return!0;case 3:return!1;case 1:throw new Error(ed);case 2:throw new Error($l)}},ecdsaRecover(e,r,n,i=!0,o){switch(sd("signature",e,64),od("Number"===hd(r)&&r>=0&&r<=3,"Expected recovery id to be a Number within interval [0, 3]"),sd("message",n,32),ad(i),o=ud(o,i?33:65),t.ecdsaRecover(o,e,r,n)){case 0:return o;case 1:throw new Error(ed);case 2:throw new Error(nd);case 3:throw new Error(Wl)}},ecdh(e,r,n={},i){switch(sd("public key",e,[33,65]),sd("private key",r,32),od("Object"===hd(n),"Expected options to be an Object"),void 0!==n.data&&sd("options.data",n.data),void 0!==n.hashfn?(od("Function"===hd(n.hashfn),"Expected options.hashfn to be a Function"),void 0!==n.xbuf&&sd("options.xbuf",n.xbuf,32),void 0!==n.ybuf&&sd("options.ybuf",n.ybuf,32),sd("output",i)):i=ud(i,32),t.ecdh(i,e,r,n.data,n.hashfn,n.xbuf,n.ybuf)){case 0:return i;case 1:throw new Error($l);case 2:throw new Error(id)}}}))(em),nm={exports:{}};function im(){}function om(){om.init.call(this)}function sm(t){return void 0===t._maxListeners?om.defaultMaxListeners:t._maxListeners}function am(t,e,r,n){var i,o,s;if("function"!=typeof r)throw new TypeError('"listener" argument must be a function');if((o=t._events)?(o.newListener&&(t.emit("newListener",e,r.listener?r.listener:r),o=t._events),s=o[e]):(o=t._events=new im,t._eventsCount=0),s){if("function"==typeof s?s=o[e]=n?[r,s]:[s,r]:n?s.unshift(r):s.push(r),!s.warned&&(i=sm(t))&&i>0&&s.length>i){s.warned=!0;var a=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+e+" listeners added. Use emitter.setMaxListeners() to increase limit");a.name="MaxListenersExceededWarning",a.emitter=t,a.type=e,a.count=s.length}}else s=o[e]=r,++t._eventsCount;return t}function um(t,e,r){var n=!1;function i(){t.removeListener(e,i),n||(n=!0,r.apply(t,arguments))}return i.listener=r,i}function hm(t){var e=this._events;if(e){var r=e[t];if("function"==typeof r)return 1;if(r)return r.length}return 0}function cm(t,e){for(var r=new Array(e);e--;)r[e]=t[e];return r}im.prototype=Object.create(null),om.EventEmitter=om,om.usingDomains=!1,om.prototype.domain=void 0,om.prototype._events=void 0,om.prototype._maxListeners=void 0,om.defaultMaxListeners=10,om.init=function(){this.domain=null,om.usingDomains&&undefined.active,this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=new im,this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},om.prototype.setMaxListeners=function(t){if("number"!=typeof t||t<0||isNaN(t))throw new TypeError('"n" argument must be a positive number');return this._maxListeners=t,this},om.prototype.getMaxListeners=function(){return sm(this)},om.prototype.emit=function(t){var e,r,n,i,o,s,a,u="error"===t;if(s=this._events)u=u&&null==s.error;else if(!u)return!1;if(a=this.domain,u){if(e=arguments[1],!a){if(e instanceof Error)throw e;var h=new Error('Uncaught, unspecified "error" event. ('+e+")");throw h.context=e,h}return e||(e=new Error('Uncaught, unspecified "error" event')),e.domainEmitter=this,e.domain=a,e.domainThrown=!1,a.emit("error",e),!1}if(!(r=s[t]))return!1;var c="function"==typeof r;switch(n=arguments.length){case 1:!function(t,e,r){if(e)t.call(r);else for(var n=t.length,i=cm(t,n),o=0;o<n;++o)i[o].call(r)}(r,c,this);break;case 2:!function(t,e,r,n){if(e)t.call(r,n);else for(var i=t.length,o=cm(t,i),s=0;s<i;++s)o[s].call(r,n)}(r,c,this,arguments[1]);break;case 3:!function(t,e,r,n,i){if(e)t.call(r,n,i);else for(var o=t.length,s=cm(t,o),a=0;a<o;++a)s[a].call(r,n,i)}(r,c,this,arguments[1],arguments[2]);break;case 4:!function(t,e,r,n,i,o){if(e)t.call(r,n,i,o);else for(var s=t.length,a=cm(t,s),u=0;u<s;++u)a[u].call(r,n,i,o)}(r,c,this,arguments[1],arguments[2],arguments[3]);break;default:for(i=new Array(n-1),o=1;o<n;o++)i[o-1]=arguments[o];!function(t,e,r,n){if(e)t.apply(r,n);else for(var i=t.length,o=cm(t,i),s=0;s<i;++s)o[s].apply(r,n)}(r,c,this,i)}return!0},om.prototype.addListener=function(t,e){return am(this,t,e,!1)},om.prototype.on=om.prototype.addListener,om.prototype.prependListener=function(t,e){return am(this,t,e,!0)},om.prototype.once=function(t,e){if("function"!=typeof e)throw new TypeError('"listener" argument must be a function');return this.on(t,um(this,t,e)),this},om.prototype.prependOnceListener=function(t,e){if("function"!=typeof e)throw new TypeError('"listener" argument must be a function');return this.prependListener(t,um(this,t,e)),this},om.prototype.removeListener=function(t,e){var r,n,i,o,s;if("function"!=typeof e)throw new TypeError('"listener" argument must be a function');if(!(n=this._events))return this;if(!(r=n[t]))return this;if(r===e||r.listener&&r.listener===e)0===--this._eventsCount?this._events=new im:(delete n[t],n.removeListener&&this.emit("removeListener",t,r.listener||e));else if("function"!=typeof r){for(i=-1,o=r.length;o-- >0;)if(r[o]===e||r[o].listener&&r[o].listener===e){s=r[o].listener,i=o;break}if(i<0)return this;if(1===r.length){if(r[0]=void 0,0===--this._eventsCount)return this._events=new im,this;delete n[t]}else!function(t,e){for(var r=e,n=r+1,i=t.length;n<i;r+=1,n+=1)t[r]=t[n];t.pop()}(r,i);n.removeListener&&this.emit("removeListener",t,s||e)}return this},om.prototype.removeAllListeners=function(t){var e,r;if(!(r=this._events))return this;if(!r.removeListener)return 0===arguments.length?(this._events=new im,this._eventsCount=0):r[t]&&(0===--this._eventsCount?this._events=new im:delete r[t]),this;if(0===arguments.length){for(var n,i=Object.keys(r),o=0;o<i.length;++o)"removeListener"!==(n=i[o])&&this.removeAllListeners(n);return this.removeAllListeners("removeListener"),this._events=new im,this._eventsCount=0,this}if("function"==typeof(e=r[t]))this.removeListener(t,e);else if(e)do{this.removeListener(t,e[e.length-1])}while(e[0]);return this},om.prototype.listeners=function(t){var e,r,n=this._events;return r=n&&(e=n[t])?"function"==typeof e?[e.listener||e]:function(t){for(var e=new Array(t.length),r=0;r<e.length;++r)e[r]=t[r].listener||t[r];return e}(e):[],r},om.listenerCount=function(t,e){return"function"==typeof t.listenerCount?t.listenerCount(e):hm.call(t,e)},om.prototype.listenerCount=hm,om.prototype.eventNames=function(){return this._eventsCount>0?Reflect.ownKeys(this._events):[]};var fm=n(Object.freeze({__proto__:null,EventEmitter:om,default:om})),lm=fm.EventEmitter,dm="function"==typeof Object.create?function(t,e){t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})}:function(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t},pm=/%[sdj%]/g;function mm(t){if(!Nm(t)){for(var e=[],r=0;r<arguments.length;r++)e.push(wm(arguments[r]));return e.join(" ")}r=1;for(var n=arguments,i=n.length,o=String(t).replace(pm,function(t){if("%%"===t)return"%";if(r>=i)return t;switch(t){case"%s":return String(n[r++]);case"%d":return Number(n[r++]);case"%j":try{return JSON.stringify(n[r++])}catch(t){return"[Circular]"}default:return t}}),s=n[r];r<i;s=n[++r])Tm(s)||!Cm(s)?o+=" "+s:o+=" "+wm(s);return o}function gm(t,e){if(Im(o.process))return function(){return gm(t,e).apply(this,arguments)};if(!0===vr.noDeprecation)return t;var r=!1;return function(){if(!r){if(vr.throwDeprecation)throw new Error(e);vr.traceDeprecation,r=!0}return t.apply(this,arguments)}}var ym,bm={};function vm(t){return Im(ym)&&(ym=vr.env.NODE_DEBUG||""),t=t.toUpperCase(),bm[t]||(new RegExp("\\b"+t+"\\b","i").test(ym)?bm[t]=function(){mm.apply(null,arguments)}:bm[t]=function(){}),bm[t]}function wm(t,e){var r={seen:[],stylize:Em};return arguments.length>=3&&(r.depth=arguments[2]),arguments.length>=4&&(r.colors=arguments[3]),xm(e)?r.showHidden=e:e&&Hm(r,e),Im(r.showHidden)&&(r.showHidden=!1),Im(r.depth)&&(r.depth=2),Im(r.colors)&&(r.colors=!1),Im(r.customInspect)&&(r.customInspect=!0),r.colors&&(r.stylize=_m),Am(r,t,r.depth)}function _m(t,e){var r=wm.styles[e];return r?"["+wm.colors[r][0]+"m"+t+"["+wm.colors[r][1]+"m":t}function Em(t,e){return t}function Am(t,e,r){if(t.customInspect&&e&&Dm(e.inspect)&&e.inspect!==wm&&(!e.constructor||e.constructor.prototype!==e)){var n=e.inspect(r,t);return Nm(n)||(n=Am(t,n,r)),n}var i=function(t,e){if(Im(e))return t.stylize("undefined","undefined");if(Nm(e)){var r="'"+JSON.stringify(e).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return t.stylize(r,"string")}if(Bm(e))return t.stylize(""+e,"number");if(xm(e))return t.stylize(""+e,"boolean");if(Tm(e))return t.stylize("null","null")}(t,e);if(i)return i;var o=Object.keys(e),s=function(t){var e={};return t.forEach(function(t,r){e[t]=!0}),e}(o);if(t.showHidden&&(o=Object.getOwnPropertyNames(e)),jm(e)&&(o.indexOf("message")>=0||o.indexOf("description")>=0))return Mm(e);if(0===o.length){if(Dm(e)){var a=e.name?": "+e.name:"";return t.stylize("[Function"+a+"]","special")}if(Om(e))return t.stylize(RegExp.prototype.toString.call(e),"regexp");if(Lm(e))return t.stylize(Date.prototype.toString.call(e),"date");if(jm(e))return Mm(e)}var u,h="",c=!1,f=["{","}"];(km(e)&&(c=!0,f=["[","]"]),Dm(e))&&(h=" [Function"+(e.name?": "+e.name:"")+"]");return Om(e)&&(h=" "+RegExp.prototype.toString.call(e)),Lm(e)&&(h=" "+Date.prototype.toUTCString.call(e)),jm(e)&&(h=" "+Mm(e)),0!==o.length||c&&0!=e.length?r<0?Om(e)?t.stylize(RegExp.prototype.toString.call(e),"regexp"):t.stylize("[Object]","special"):(t.seen.push(e),u=c?function(t,e,r,n,i){for(var o=[],s=0,a=e.length;s<a;++s)Km(e,String(s))?o.push(Sm(t,e,r,n,String(s),!0)):o.push("");return i.forEach(function(i){i.match(/^\d+$/)||o.push(Sm(t,e,r,n,i,!0))}),o}(t,e,r,s,o):o.map(function(n){return Sm(t,e,r,s,n,c)}),t.seen.pop(),function(t,e,r){var n=t.reduce(function(t,e){return e.indexOf("\n"),t+e.replace(/\u001b\[\d\d?m/g,"").length+1},0);if(n>60)return r[0]+(""===e?"":e+"\n ")+" "+t.join(",\n  ")+" "+r[1];return r[0]+e+" "+t.join(", ")+" "+r[1]}(u,h,f)):f[0]+h+f[1]}function Mm(t){return"["+Error.prototype.toString.call(t)+"]"}function Sm(t,e,r,n,i,o){var s,a,u;if((u=Object.getOwnPropertyDescriptor(e,i)||{value:e[i]}).get?a=u.set?t.stylize("[Getter/Setter]","special"):t.stylize("[Getter]","special"):u.set&&(a=t.stylize("[Setter]","special")),Km(n,i)||(s="["+i+"]"),a||(t.seen.indexOf(u.value)<0?(a=Tm(r)?Am(t,u.value,null):Am(t,u.value,r-1)).indexOf("\n")>-1&&(a=o?a.split("\n").map(function(t){return"  "+t}).join("\n").substr(2):"\n"+a.split("\n").map(function(t){return"   "+t}).join("\n")):a=t.stylize("[Circular]","special")),Im(s)){if(o&&i.match(/^\d+$/))return a;(s=JSON.stringify(""+i)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(s=s.substr(1,s.length-2),s=t.stylize(s,"name")):(s=s.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),s=t.stylize(s,"string"))}return s+": "+a}function km(t){return Array.isArray(t)}function xm(t){return"boolean"==typeof t}function Tm(t){return null===t}function Rm(t){return null==t}function Bm(t){return"number"==typeof t}function Nm(t){return"string"==typeof t}function Pm(t){return"symbol"==typeof t}function Im(t){return void 0===t}function Om(t){return Cm(t)&&"[object RegExp]"===zm(t)}function Cm(t){return"object"==typeof t&&null!==t}function Lm(t){return Cm(t)&&"[object Date]"===zm(t)}function jm(t){return Cm(t)&&("[object Error]"===zm(t)||t instanceof Error)}function Dm(t){return"function"==typeof t}function Um(t){return null===t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||"symbol"==typeof t||void 0===t}function Fm(t){return _.isBuffer(t)}function zm(t){return Object.prototype.toString.call(t)}function qm(){}function Hm(t,e){if(!e||!Cm(e))return t;for(var r=Object.keys(e),n=r.length;n--;)t[r[n]]=e[r[n]];return t}function Km(t,e){return Object.prototype.hasOwnProperty.call(t,e)}wm.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},wm.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"};var Gm,Vm,Wm={inherits:dm,_extend:Hm,log:qm,isBuffer:Fm,isPrimitive:Um,isFunction:Dm,isError:jm,isDate:Lm,isObject:Cm,isRegExp:Om,isUndefined:Im,isSymbol:Pm,isString:Nm,isNumber:Bm,isNullOrUndefined:Rm,isNull:Tm,isBoolean:xm,isArray:km,inspect:wm,deprecate:gm,format:mm,debuglog:vm},Jm=n(Object.freeze({__proto__:null,_extend:Hm,debuglog:vm,default:Wm,deprecate:gm,format:mm,inherits:dm,inspect:wm,isArray:km,isBoolean:xm,isBuffer:Fm,isDate:Lm,isError:jm,isFunction:Dm,isNull:Tm,isNullOrUndefined:Rm,isNumber:Bm,isObject:Cm,isPrimitive:Um,isRegExp:Om,isString:Nm,isSymbol:Pm,isUndefined:Im,log:qm}));function Zm(){if(Vm)return Gm;function t(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}function e(e){for(var n=1;n<arguments.length;n++){var i=null!=arguments[n]?arguments[n]:{};n%2?t(Object(i),!0).forEach(function(t){r(e,t,i[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):t(Object(i)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))})}return e}function r(t,e,r){return(e=i(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function n(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,i(n.key),n)}}function i(t){var e=function(t,e){if("object"!=typeof t||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,e||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==typeof e?e:String(e)}Vm=1;var o=st.Buffer,s=Jm.inspect,a=s&&s.custom||"inspect";function u(t,e,r){o.prototype.copy.call(t,e,r)}return Gm=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.head=null,this.tail=null,this.length=0}var r,i,h;return r=t,i=[{key:"push",value:function(t){var e={data:t,next:null};this.length>0?this.tail.next=e:this.head=e,this.tail=e,++this.length}},{key:"unshift",value:function(t){var e={data:t,next:this.head};0===this.length&&(this.tail=e),this.head=e,++this.length}},{key:"shift",value:function(){if(0!==this.length){var t=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,t}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(t){if(0===this.length)return"";for(var e=this.head,r=""+e.data;e=e.next;)r+=t+e.data;return r}},{key:"concat",value:function(t){if(0===this.length)return o.alloc(0);for(var e=o.allocUnsafe(t>>>0),r=this.head,n=0;r;)u(r.data,e,n),n+=r.data.length,r=r.next;return e}},{key:"consume",value:function(t,e){var r;return t<this.head.data.length?(r=this.head.data.slice(0,t),this.head.data=this.head.data.slice(t)):r=t===this.head.data.length?this.shift():e?this._getString(t):this._getBuffer(t),r}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(t){var e=this.head,r=1,n=e.data;for(t-=n.length;e=e.next;){var i=e.data,o=t>i.length?i.length:t;if(o===i.length?n+=i:n+=i.slice(0,t),0===(t-=o)){o===i.length?(++r,e.next?this.head=e.next:this.head=this.tail=null):(this.head=e,e.data=i.slice(o));break}++r}return this.length-=r,n}},{key:"_getBuffer",value:function(t){var e=o.allocUnsafe(t),r=this.head,n=1;for(r.data.copy(e),t-=r.data.length;r=r.next;){var i=r.data,s=t>i.length?i.length:t;if(i.copy(e,e.length-t,0,s),0===(t-=s)){s===i.length?(++n,r.next?this.head=r.next:this.head=this.tail=null):(this.head=r,r.data=i.slice(s));break}++n}return this.length-=n,e}},{key:a,value:function(t,r){return s(this,e(e({},r),{},{depth:0,customInspect:!1}))}}],i&&n(r.prototype,i),h&&n(r,h),Object.defineProperty(r,"prototype",{writable:!1}),t}(),Gm}function Ym(t,e){$m(t,e),Xm(t)}function Xm(t){t._writableState&&!t._writableState.emitClose||t._readableState&&!t._readableState.emitClose||t.emit("close")}function $m(t,e){t.emit("error",e)}var Qm={destroy:function(t,e){var r=this,n=this._readableState&&this._readableState.destroyed,i=this._writableState&&this._writableState.destroyed;return n||i?(e?e(t):t&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,vr.nextTick($m,this,t)):vr.nextTick($m,this,t)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(t||null,function(t){!e&&t?r._writableState?r._writableState.errorEmitted?vr.nextTick(Xm,r):(r._writableState.errorEmitted=!0,vr.nextTick(Ym,r,t)):vr.nextTick(Ym,r,t):e?(vr.nextTick(Xm,r),e(t)):vr.nextTick(Xm,r)}),this)},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)},errorOrDestroy:function(t,e){var r=t._readableState,n=t._writableState;r&&r.autoDestroy||n&&n.autoDestroy?t.destroy(e):t.emit("error",e)}},tg={};var eg={};function rg(t,e,r){r||(r=Error);var n=function(t){var r,n;function i(r,n,i){return t.call(this,function(t,r,n){return"string"==typeof e?e:e(t,r,n)}(r,n,i))||this}return n=t,(r=i).prototype=Object.create(n.prototype),r.prototype.constructor=r,r.__proto__=n,i}(r);n.prototype.name=r.name,n.prototype.code=t,eg[t]=n}function ng(t,e){if(Array.isArray(t)){var r=t.length;return t=t.map(function(t){return String(t)}),r>2?"one of ".concat(e," ").concat(t.slice(0,r-1).join(", "),", or ")+t[r-1]:2===r?"one of ".concat(e," ").concat(t[0]," or ").concat(t[1]):"of ".concat(e," ").concat(t[0])}return"of ".concat(e," ").concat(String(t))}rg("ERR_INVALID_OPT_VALUE",function(t,e){return'The value "'+e+'" is invalid for option "'+t+'"'},TypeError),rg("ERR_INVALID_ARG_TYPE",function(t,e,r){var n,i,o,s;if("string"==typeof e&&(i="not ",e.substr(!o||o<0?0:+o,i.length)===i)?(n="must not be",e=e.replace(/^not /,"")):n="must be",function(t,e,r){return(void 0===r||r>t.length)&&(r=t.length),t.substring(r-e.length,r)===e}(t," argument"))s="The ".concat(t," ").concat(n," ").concat(ng(e,"type"));else{var a=function(t,e,r){return"number"!=typeof r&&(r=0),!(r+e.length>t.length)&&-1!==t.indexOf(e,r)}(t,".")?"property":"argument";s='The "'.concat(t,'" ').concat(a," ").concat(n," ").concat(ng(e,"type"))}return s+=". Received type ".concat(typeof r)},TypeError),rg("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),rg("ERR_METHOD_NOT_IMPLEMENTED",function(t){return"The "+t+" method is not implemented"}),rg("ERR_STREAM_PREMATURE_CLOSE","Premature close"),rg("ERR_STREAM_DESTROYED",function(t){return"Cannot call "+t+" after a stream was destroyed"}),rg("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),rg("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),rg("ERR_STREAM_WRITE_AFTER_END","write after end"),rg("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),rg("ERR_UNKNOWN_ENCODING",function(t){return"Unknown encoding: "+t},TypeError),rg("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),tg.codes=eg;var ig=tg.codes.ERR_INVALID_OPT_VALUE;var og,sg,ag,ug,hg={getHighWaterMark:function(t,e,r,n){var i=function(t,e,r){return null!=t.highWaterMark?t.highWaterMark:e?t[r]:null}(e,n,r);if(null!=i){if(!isFinite(i)||Math.floor(i)!==i||i<0)throw new ig(n?r:"highWaterMark",i);return Math.floor(i)}return t.objectMode?16:16384}},cg=function(t,e){if(fg("noDeprecation"))return t;var r=!1;return function(){if(!r){if(fg("throwDeprecation"))throw new Error(e);fg("traceDeprecation"),r=!0}return t.apply(this,arguments)}};function fg(t){try{if(!e.localStorage)return!1}catch(t){return!1}var r=e.localStorage[t];return null!=r&&"true"===String(r).toLowerCase()}function lg(){if(sg)return og;function t(t){var e=this;this.next=null,this.entry=null,this.finish=function(){!function(t,e,r){var n=t.entry;t.entry=null;for(;n;){var i=n.callback;e.pendingcb--,i(r),n=n.next}e.corkedRequestsFree.next=t}(e,t)}}var r;sg=1,og=E,E.WritableState=_;var n={deprecate:cg},i=lm,o=st.Buffer,s=(void 0!==e?e:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{}).Uint8Array||function(){};var a,u=Qm,h=hg.getHighWaterMark,c=tg.codes,f=c.ERR_INVALID_ARG_TYPE,l=c.ERR_METHOD_NOT_IMPLEMENTED,d=c.ERR_MULTIPLE_CALLBACK,p=c.ERR_STREAM_CANNOT_PIPE,m=c.ERR_STREAM_DESTROYED,g=c.ERR_STREAM_NULL_VALUES,y=c.ERR_STREAM_WRITE_AFTER_END,b=c.ERR_UNKNOWN_ENCODING,v=u.errorOrDestroy;function w(){}function _(e,n,i){r=r||dg(),e=e||{},"boolean"!=typeof i&&(i=n instanceof r),this.objectMode=!!e.objectMode,i&&(this.objectMode=this.objectMode||!!e.writableObjectMode),this.highWaterMark=h(this,e,"writableHighWaterMark",i),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var o=!1===e.decodeStrings;this.decodeStrings=!o,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(t){!function(t,e){var r=t._writableState,n=r.sync,i=r.writecb;if("function"!=typeof i)throw new d;if(function(t){t.writing=!1,t.writecb=null,t.length-=t.writelen,t.writelen=0}(r),e)!function(t,e,r,n,i){--e.pendingcb,r?(vr.nextTick(i,n),vr.nextTick(T,t,e),t._writableState.errorEmitted=!0,v(t,n)):(i(n),t._writableState.errorEmitted=!0,v(t,n),T(t,e))}(t,r,n,e,i);else{var o=k(r)||t.destroyed;o||r.corked||r.bufferProcessing||!r.bufferedRequest||S(t,r),n?vr.nextTick(M,t,r,o,i):M(t,r,o,i)}}(n,t)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!1!==e.emitClose,this.autoDestroy=!!e.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new t(this)}function E(t){var e=this instanceof(r=r||dg());if(!e&&!a.call(E,this))return new E(t);this._writableState=new _(t,this,e),this.writable=!0,t&&("function"==typeof t.write&&(this._write=t.write),"function"==typeof t.writev&&(this._writev=t.writev),"function"==typeof t.destroy&&(this._destroy=t.destroy),"function"==typeof t.final&&(this._final=t.final)),i.call(this)}function A(t,e,r,n,i,o,s){e.writelen=n,e.writecb=s,e.writing=!0,e.sync=!0,e.destroyed?e.onwrite(new m("write")):r?t._writev(i,e.onwrite):t._write(i,o,e.onwrite),e.sync=!1}function M(t,e,r,n){r||function(t,e){0===e.length&&e.needDrain&&(e.needDrain=!1,t.emit("drain"))}(t,e),e.pendingcb--,n(),T(t,e)}function S(e,r){r.bufferProcessing=!0;var n=r.bufferedRequest;if(e._writev&&n&&n.next){var i=r.bufferedRequestCount,o=new Array(i),s=r.corkedRequestsFree;s.entry=n;for(var a=0,u=!0;n;)o[a]=n,n.isBuf||(u=!1),n=n.next,a+=1;o.allBuffers=u,A(e,r,!0,r.length,o,"",s.finish),r.pendingcb++,r.lastBufferedRequest=null,s.next?(r.corkedRequestsFree=s.next,s.next=null):r.corkedRequestsFree=new t(r),r.bufferedRequestCount=0}else{for(;n;){var h=n.chunk,c=n.encoding,f=n.callback;if(A(e,r,!1,r.objectMode?1:h.length,h,c,f),n=n.next,r.bufferedRequestCount--,r.writing)break}null===n&&(r.lastBufferedRequest=null)}r.bufferedRequest=n,r.bufferProcessing=!1}function k(t){return t.ending&&0===t.length&&null===t.bufferedRequest&&!t.finished&&!t.writing}function x(t,e){t._final(function(r){e.pendingcb--,r&&v(t,r),e.prefinished=!0,t.emit("prefinish"),T(t,e)})}function T(t,e){var r=k(e);if(r&&(function(t,e){e.prefinished||e.finalCalled||("function"!=typeof t._final||e.destroyed?(e.prefinished=!0,t.emit("prefinish")):(e.pendingcb++,e.finalCalled=!0,vr.nextTick(x,t,e)))}(t,e),0===e.pendingcb&&(e.finished=!0,t.emit("finish"),e.autoDestroy))){var n=t._readableState;(!n||n.autoDestroy&&n.endEmitted)&&t.destroy()}return r}return ri(E,i),_.prototype.getBuffer=function(){for(var t=this.bufferedRequest,e=[];t;)e.push(t),t=t.next;return e},function(){try{Object.defineProperty(_.prototype,"buffer",{get:n.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(t){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(a=Function.prototype[Symbol.hasInstance],Object.defineProperty(E,Symbol.hasInstance,{value:function(t){return!!a.call(this,t)||this===E&&(t&&t._writableState instanceof _)}})):a=function(t){return t instanceof this},E.prototype.pipe=function(){v(this,new p)},E.prototype.write=function(t,e,r){var n,i=this._writableState,a=!1,u=!i.objectMode&&(n=t,o.isBuffer(n)||n instanceof s);return u&&!o.isBuffer(t)&&(t=function(t){return o.from(t)}(t)),"function"==typeof e&&(r=e,e=null),u?e="buffer":e||(e=i.defaultEncoding),"function"!=typeof r&&(r=w),i.ending?function(t,e){var r=new y;v(t,r),vr.nextTick(e,r)}(this,r):(u||function(t,e,r,n){var i;return null===r?i=new g:"string"==typeof r||e.objectMode||(i=new f("chunk",["string","Buffer"],r)),!i||(v(t,i),vr.nextTick(n,i),!1)}(this,i,t,r))&&(i.pendingcb++,a=function(t,e,r,n,i,s){if(!r){var a=function(t,e,r){t.objectMode||!1===t.decodeStrings||"string"!=typeof e||(e=o.from(e,r));return e}(e,n,i);n!==a&&(r=!0,i="buffer",n=a)}var u=e.objectMode?1:n.length;e.length+=u;var h=e.length<e.highWaterMark;h||(e.needDrain=!0);if(e.writing||e.corked){var c=e.lastBufferedRequest;e.lastBufferedRequest={chunk:n,encoding:i,isBuf:r,callback:s,next:null},c?c.next=e.lastBufferedRequest:e.bufferedRequest=e.lastBufferedRequest,e.bufferedRequestCount+=1}else A(t,e,!1,u,n,i,s);return h}(this,i,u,t,e,r)),a},E.prototype.cork=function(){this._writableState.corked++},E.prototype.uncork=function(){var t=this._writableState;t.corked&&(t.corked--,t.writing||t.corked||t.bufferProcessing||!t.bufferedRequest||S(this,t))},E.prototype.setDefaultEncoding=function(t){if("string"==typeof t&&(t=t.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((t+"").toLowerCase())>-1))throw new b(t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(E.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(E.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),E.prototype._write=function(t,e,r){r(new l("_write()"))},E.prototype._writev=null,E.prototype.end=function(t,e,r){var n=this._writableState;return"function"==typeof t?(r=t,t=null,e=null):"function"==typeof e&&(r=e,e=null),null!=t&&this.write(t,e),n.corked&&(n.corked=1,this.uncork()),n.ending||function(t,e,r){e.ending=!0,T(t,e),r&&(e.finished?vr.nextTick(r):t.once("finish",r));e.ended=!0,t.writable=!1}(this,n,r),this},Object.defineProperty(E.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(E.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(t){this._writableState&&(this._writableState.destroyed=t)}}),E.prototype.destroy=u.destroy,E.prototype._undestroy=u.undestroy,E.prototype._destroy=function(t,e){e(t)},og}function dg(){if(ug)return ag;ug=1;var t=Object.keys||function(t){var e=[];for(var r in t)e.push(r);return e};ag=s;var e=Rg(),r=lg();ri(s,e);for(var n=t(r.prototype),i=0;i<n.length;i++){var o=n[i];s.prototype[o]||(s.prototype[o]=r.prototype[o])}function s(t){if(!(this instanceof s))return new s(t);e.call(this,t),r.call(this,t),this.allowHalfOpen=!0,t&&(!1===t.readable&&(this.readable=!1),!1===t.writable&&(this.writable=!1),!1===t.allowHalfOpen&&(this.allowHalfOpen=!1,this.once("end",a)))}function a(){this._writableState.ended||vr.nextTick(u,this)}function u(t){t.end()}return Object.defineProperty(s.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(s.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(s.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(s.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed&&this._writableState.destroyed)},set:function(t){void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed=t,this._writableState.destroyed=t)}}),ag}var pg={},mg={exports:{}};
/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
!function(t,e){var r=st,n=r.Buffer;function i(t,e){for(var r in t)e[r]=t[r]}function o(t,e,r){return n(t,e,r)}n.from&&n.alloc&&n.allocUnsafe&&n.allocUnsafeSlow?t.exports=r:(i(r,e),e.Buffer=o),o.prototype=Object.create(n.prototype),i(n,o),o.from=function(t,e,r){if("number"==typeof t)throw new TypeError("Argument must not be a number");return n(t,e,r)},o.alloc=function(t,e,r){if("number"!=typeof t)throw new TypeError("Argument must be a number");var i=n(t);return void 0!==e?"string"==typeof r?i.fill(e,r):i.fill(e):i.fill(0),i},o.allocUnsafe=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return n(t)},o.allocUnsafeSlow=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return r.SlowBuffer(t)}}(mg,mg.exports);var gg,yg=mg.exports;function bg(){if(gg)return pg;gg=1;var t=yg.Buffer,e=t.isEncoding||function(t){switch((t=""+t)&&t.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function r(r){var n;switch(this.encoding=function(r){var n=function(t){if(!t)return"utf8";for(var e;;)switch(t){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return t;default:if(e)return;t=(""+t).toLowerCase(),e=!0}}(r);if("string"!=typeof n&&(t.isEncoding===e||!e(r)))throw new Error("Unknown encoding: "+r);return n||r}(r),this.encoding){case"utf16le":this.text=o,this.end=s,n=4;break;case"utf8":this.fillLast=i,n=4;break;case"base64":this.text=a,this.end=u,n=3;break;default:return this.write=h,void(this.end=c)}this.lastNeed=0,this.lastTotal=0,this.lastChar=t.allocUnsafe(n)}function n(t){return t<=127?0:t>>5==6?2:t>>4==14?3:t>>3==30?4:t>>6==2?-1:-2}function i(t){var e=this.lastTotal-this.lastNeed,r=function(t,e){if(128!=(192&e[0]))return t.lastNeed=0,"�";if(t.lastNeed>1&&e.length>1){if(128!=(192&e[1]))return t.lastNeed=1,"�";if(t.lastNeed>2&&e.length>2&&128!=(192&e[2]))return t.lastNeed=2,"�"}}(this,t);return void 0!==r?r:this.lastNeed<=t.length?(t.copy(this.lastChar,e,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(t.copy(this.lastChar,e,0,t.length),void(this.lastNeed-=t.length))}function o(t,e){if((t.length-e)%2==0){var r=t.toString("utf16le",e);if(r){var n=r.charCodeAt(r.length-1);if(n>=55296&&n<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=t[t.length-1],t.toString("utf16le",e,t.length-1)}function s(t){var e=t&&t.length?this.write(t):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return e+this.lastChar.toString("utf16le",0,r)}return e}function a(t,e){var r=(t.length-e)%3;return 0===r?t.toString("base64",e):(this.lastNeed=3-r,this.lastTotal=3,1===r?this.lastChar[0]=t[t.length-1]:(this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1]),t.toString("base64",e,t.length-r))}function u(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function h(t){return t.toString(this.encoding)}function c(t){return t&&t.length?this.write(t):""}return pg.StringDecoder=r,r.prototype.write=function(t){if(0===t.length)return"";var e,r;if(this.lastNeed){if(void 0===(e=this.fillLast(t)))return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r<t.length?e?e+this.text(t,r):this.text(t,r):e||""},r.prototype.end=function(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+"�":e},r.prototype.text=function(t,e){var r=function(t,e,r){var i=e.length-1;if(i<r)return 0;var o=n(e[i]);if(o>=0)return o>0&&(t.lastNeed=o-1),o;if(--i<r||-2===o)return 0;if(o=n(e[i]),o>=0)return o>0&&(t.lastNeed=o-2),o;if(--i<r||-2===o)return 0;if(o=n(e[i]),o>=0)return o>0&&(2===o?o=0:t.lastNeed=o-3),o;return 0}(this,t,e);if(!this.lastNeed)return t.toString("utf8",e);this.lastTotal=r;var i=t.length-(r-this.lastNeed);return t.copy(this.lastChar,0,i),t.toString("utf8",e,i)},r.prototype.fillLast=function(t){if(this.lastNeed<=t.length)return t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,t.length),this.lastNeed-=t.length},pg}var vg=tg.codes.ERR_STREAM_PREMATURE_CLOSE;function wg(){}var _g,Eg,Ag,Mg,Sg,kg,xg=function t(e,r,n){if("function"==typeof r)return t(e,null,r);r||(r={}),n=function(t){var e=!1;return function(){if(!e){e=!0;for(var r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];t.apply(this,n)}}}(n||wg);var i=r.readable||!1!==r.readable&&e.readable,o=r.writable||!1!==r.writable&&e.writable,s=function(){e.writable||u()},a=e._writableState&&e._writableState.finished,u=function(){o=!1,a=!0,i||n.call(e)},h=e._readableState&&e._readableState.endEmitted,c=function(){i=!1,h=!0,o||n.call(e)},f=function(t){n.call(e,t)},l=function(){var t;return i&&!h?(e._readableState&&e._readableState.ended||(t=new vg),n.call(e,t)):o&&!a?(e._writableState&&e._writableState.ended||(t=new vg),n.call(e,t)):void 0},d=function(){e.req.on("finish",u)};return!function(t){return t.setHeader&&"function"==typeof t.abort}(e)?o&&!e._writableState&&(e.on("end",s),e.on("close",s)):(e.on("complete",u),e.on("abort",l),e.req?d():e.on("request",d)),e.on("end",c),e.on("finish",u),!1!==r.error&&e.on("error",f),e.on("close",l),function(){e.removeListener("complete",u),e.removeListener("abort",l),e.removeListener("request",d),e.req&&e.req.removeListener("finish",u),e.removeListener("end",s),e.removeListener("close",s),e.removeListener("finish",u),e.removeListener("end",c),e.removeListener("error",f),e.removeListener("close",l)}};function Tg(){if(Eg)return _g;var t;function e(t,e,r){return(e=function(t){var e=function(t,e){if("object"!=typeof t||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,e||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==typeof e?e:String(e)}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}Eg=1;var r=xg,n=Symbol("lastResolve"),i=Symbol("lastReject"),o=Symbol("error"),s=Symbol("ended"),a=Symbol("lastPromise"),u=Symbol("handlePromise"),h=Symbol("stream");function c(t,e){return{value:t,done:e}}function f(t){var e=t[n];if(null!==e){var r=t[h].read();null!==r&&(t[a]=null,t[n]=null,t[i]=null,e(c(r,!1)))}}function l(t){vr.nextTick(f,t)}var d=Object.getPrototypeOf(function(){}),p=Object.setPrototypeOf((t={get stream(){return this[h]},next:function(){var t=this,e=this[o];if(null!==e)return Promise.reject(e);if(this[s])return Promise.resolve(c(void 0,!0));if(this[h].destroyed)return new Promise(function(e,r){vr.nextTick(function(){t[o]?r(t[o]):e(c(void 0,!0))})});var r,n=this[a];if(n)r=new Promise(function(t,e){return function(r,n){t.then(function(){e[s]?r(c(void 0,!0)):e[u](r,n)},n)}}(n,this));else{var i=this[h].read();if(null!==i)return Promise.resolve(c(i,!1));r=new Promise(this[u])}return this[a]=r,r}},e(t,Symbol.asyncIterator,function(){return this}),e(t,"return",function(){var t=this;return new Promise(function(e,r){t[h].destroy(null,function(t){t?r(t):e(c(void 0,!0))})})}),t),d);return _g=function(t){var f,d=Object.create(p,(e(f={},h,{value:t,writable:!0}),e(f,n,{value:null,writable:!0}),e(f,i,{value:null,writable:!0}),e(f,o,{value:null,writable:!0}),e(f,s,{value:t._readableState.endEmitted,writable:!0}),e(f,u,{value:function(t,e){var r=d[h].read();r?(d[a]=null,d[n]=null,d[i]=null,t(c(r,!1))):(d[n]=t,d[i]=e)},writable:!0}),f));return d[a]=null,r(t,function(t){if(t&&"ERR_STREAM_PREMATURE_CLOSE"!==t.code){var e=d[i];return null!==e&&(d[a]=null,d[n]=null,d[i]=null,e(t)),void(d[o]=t)}var r=d[n];null!==r&&(d[a]=null,d[n]=null,d[i]=null,r(c(void 0,!0))),d[s]=!0}),t.on("readable",l.bind(null,d)),d},_g}function Rg(){if(kg)return Sg;var t;kg=1,Sg=E,E.ReadableState=_,fm.EventEmitter;var r=function(t,e){return t.listeners(e).length},n=lm,i=st.Buffer,o=(void 0!==e?e:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{}).Uint8Array||function(){};var s,a=Jm;s=a&&a.debuglog?a.debuglog("stream"):function(){};var u,h,c,f=Zm(),l=Qm,d=hg.getHighWaterMark,p=tg.codes,m=p.ERR_INVALID_ARG_TYPE,g=p.ERR_STREAM_PUSH_AFTER_EOF,y=p.ERR_METHOD_NOT_IMPLEMENTED,b=p.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;ri(E,n);var v=l.errorOrDestroy,w=["error","close","destroy","pause","resume"];function _(e,r,n){t=t||dg(),e=e||{},"boolean"!=typeof n&&(n=r instanceof t),this.objectMode=!!e.objectMode,n&&(this.objectMode=this.objectMode||!!e.readableObjectMode),this.highWaterMark=d(this,e,"readableHighWaterMark",n),this.buffer=new f,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=!1!==e.emitClose,this.autoDestroy=!!e.autoDestroy,this.destroyed=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(u||(u=bg().StringDecoder),this.decoder=new u(e.encoding),this.encoding=e.encoding)}function E(e){if(t=t||dg(),!(this instanceof E))return new E(e);var r=this instanceof t;this._readableState=new _(e,this,r),this.readable=!0,e&&("function"==typeof e.read&&(this._read=e.read),"function"==typeof e.destroy&&(this._destroy=e.destroy)),n.call(this)}function A(t,e,r,n,a){s("readableAddChunk",e);var u,h=t._readableState;if(null===e)h.reading=!1,function(t,e){if(s("onEofChunk"),e.ended)return;if(e.decoder){var r=e.decoder.end();r&&r.length&&(e.buffer.push(r),e.length+=e.objectMode?1:r.length)}e.ended=!0,e.sync?x(t):(e.needReadable=!1,e.emittedReadable||(e.emittedReadable=!0,T(t)))}(t,h);else if(a||(u=function(t,e){var r;n=e,i.isBuffer(n)||n instanceof o||"string"==typeof e||void 0===e||t.objectMode||(r=new m("chunk",["string","Buffer","Uint8Array"],e));var n;return r}(h,e)),u)v(t,u);else if(h.objectMode||e&&e.length>0)if("string"==typeof e||h.objectMode||Object.getPrototypeOf(e)===i.prototype||(e=function(t){return i.from(t)}(e)),n)h.endEmitted?v(t,new b):M(t,h,e,!0);else if(h.ended)v(t,new g);else{if(h.destroyed)return!1;h.reading=!1,h.decoder&&!r?(e=h.decoder.write(e),h.objectMode||0!==e.length?M(t,h,e,!1):R(t,h)):M(t,h,e,!1)}else n||(h.reading=!1,R(t,h));return!h.ended&&(h.length<h.highWaterMark||0===h.length)}function M(t,e,r,n){e.flowing&&0===e.length&&!e.sync?(e.awaitDrain=0,t.emit("data",r)):(e.length+=e.objectMode?1:r.length,n?e.buffer.unshift(r):e.buffer.push(r),e.needReadable&&x(t)),R(t,e)}Object.defineProperty(E.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&this._readableState.destroyed},set:function(t){this._readableState&&(this._readableState.destroyed=t)}}),E.prototype.destroy=l.destroy,E.prototype._undestroy=l.undestroy,E.prototype._destroy=function(t,e){e(t)},E.prototype.push=function(t,e){var r,n=this._readableState;return n.objectMode?r=!0:"string"==typeof t&&((e=e||n.defaultEncoding)!==n.encoding&&(t=i.from(t,e),e=""),r=!0),A(this,t,e,!1,r)},E.prototype.unshift=function(t){return A(this,t,null,!0,!1)},E.prototype.isPaused=function(){return!1===this._readableState.flowing},E.prototype.setEncoding=function(t){u||(u=bg().StringDecoder);var e=new u(t);this._readableState.decoder=e,this._readableState.encoding=this._readableState.decoder.encoding;for(var r=this._readableState.buffer.head,n="";null!==r;)n+=e.write(r.data),r=r.next;return this._readableState.buffer.clear(),""!==n&&this._readableState.buffer.push(n),this._readableState.length=n.length,this};var S=1073741824;function k(t,e){return t<=0||0===e.length&&e.ended?0:e.objectMode?1:t!=t?e.flowing&&e.length?e.buffer.head.data.length:e.length:(t>e.highWaterMark&&(e.highWaterMark=function(t){return t>=S?t=S:(t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++),t}(t)),t<=e.length?t:e.ended?e.length:(e.needReadable=!0,0))}function x(t){var e=t._readableState;s("emitReadable",e.needReadable,e.emittedReadable),e.needReadable=!1,e.emittedReadable||(s("emitReadable",e.flowing),e.emittedReadable=!0,vr.nextTick(T,t))}function T(t){var e=t._readableState;s("emitReadable_",e.destroyed,e.length,e.ended),e.destroyed||!e.length&&!e.ended||(t.emit("readable"),e.emittedReadable=!1),e.needReadable=!e.flowing&&!e.ended&&e.length<=e.highWaterMark,O(t)}function R(t,e){e.readingMore||(e.readingMore=!0,vr.nextTick(B,t,e))}function B(t,e){for(;!e.reading&&!e.ended&&(e.length<e.highWaterMark||e.flowing&&0===e.length);){var r=e.length;if(s("maybeReadMore read 0"),t.read(0),r===e.length)break}e.readingMore=!1}function N(t){var e=t._readableState;e.readableListening=t.listenerCount("readable")>0,e.resumeScheduled&&!e.paused?e.flowing=!0:t.listenerCount("data")>0&&t.resume()}function P(t){s("readable nexttick read 0"),t.read(0)}function I(t,e){s("resume",e.reading),e.reading||t.read(0),e.resumeScheduled=!1,t.emit("resume"),O(t),e.flowing&&!e.reading&&t.read(0)}function O(t){var e=t._readableState;for(s("flow",e.flowing);e.flowing&&null!==t.read(););}function C(t,e){return 0===e.length?null:(e.objectMode?r=e.buffer.shift():!t||t>=e.length?(r=e.decoder?e.buffer.join(""):1===e.buffer.length?e.buffer.first():e.buffer.concat(e.length),e.buffer.clear()):r=e.buffer.consume(t,e.decoder),r);var r}function L(t){var e=t._readableState;s("endReadable",e.endEmitted),e.endEmitted||(e.ended=!0,vr.nextTick(j,e,t))}function j(t,e){if(s("endReadableNT",t.endEmitted,t.length),!t.endEmitted&&0===t.length&&(t.endEmitted=!0,e.readable=!1,e.emit("end"),t.autoDestroy)){var r=e._writableState;(!r||r.autoDestroy&&r.finished)&&e.destroy()}}function D(t,e){for(var r=0,n=t.length;r<n;r++)if(t[r]===e)return r;return-1}return E.prototype.read=function(t){s("read",t),t=parseInt(t,10);var e=this._readableState,r=t;if(0!==t&&(e.emittedReadable=!1),0===t&&e.needReadable&&((0!==e.highWaterMark?e.length>=e.highWaterMark:e.length>0)||e.ended))return s("read: emitReadable",e.length,e.ended),0===e.length&&e.ended?L(this):x(this),null;if(0===(t=k(t,e))&&e.ended)return 0===e.length&&L(this),null;var n,i=e.needReadable;return s("need readable",i),(0===e.length||e.length-t<e.highWaterMark)&&s("length less than watermark",i=!0),e.ended||e.reading?s("reading or ended",i=!1):i&&(s("do read"),e.reading=!0,e.sync=!0,0===e.length&&(e.needReadable=!0),this._read(e.highWaterMark),e.sync=!1,e.reading||(t=k(r,e))),null===(n=t>0?C(t,e):null)?(e.needReadable=e.length<=e.highWaterMark,t=0):(e.length-=t,e.awaitDrain=0),0===e.length&&(e.ended||(e.needReadable=!0),r!==t&&e.ended&&L(this)),null!==n&&this.emit("data",n),n},E.prototype._read=function(t){v(this,new y("_read()"))},E.prototype.pipe=function(t,e){var n=this,i=this._readableState;switch(i.pipesCount){case 0:i.pipes=t;break;case 1:i.pipes=[i.pipes,t];break;default:i.pipes.push(t)}i.pipesCount+=1,s("pipe count=%d opts=%j",i.pipesCount,e);var o=(!e||!1!==e.end)&&t!==vr.stdout&&t!==vr.stderr?u:m;function a(e,r){s("onunpipe"),e===n&&r&&!1===r.hasUnpiped&&(r.hasUnpiped=!0,s("cleanup"),t.removeListener("close",d),t.removeListener("finish",p),t.removeListener("drain",h),t.removeListener("error",l),t.removeListener("unpipe",a),n.removeListener("end",u),n.removeListener("end",m),n.removeListener("data",f),c=!0,!i.awaitDrain||t._writableState&&!t._writableState.needDrain||h())}function u(){s("onend"),t.end()}i.endEmitted?vr.nextTick(o):n.once("end",o),t.on("unpipe",a);var h=function(t){return function(){var e=t._readableState;s("pipeOnDrain",e.awaitDrain),e.awaitDrain&&e.awaitDrain--,0===e.awaitDrain&&r(t,"data")&&(e.flowing=!0,O(t))}}(n);t.on("drain",h);var c=!1;function f(e){s("ondata");var r=t.write(e);s("dest.write",r),!1===r&&((1===i.pipesCount&&i.pipes===t||i.pipesCount>1&&-1!==D(i.pipes,t))&&!c&&(s("false write response, pause",i.awaitDrain),i.awaitDrain++),n.pause())}function l(e){s("onerror",e),m(),t.removeListener("error",l),0===r(t,"error")&&v(t,e)}function d(){t.removeListener("finish",p),m()}function p(){s("onfinish"),t.removeListener("close",d),m()}function m(){s("unpipe"),n.unpipe(t)}return n.on("data",f),function(t,e,r){if("function"==typeof t.prependListener)return t.prependListener(e,r);t._events&&t._events[e]?Array.isArray(t._events[e])?t._events[e].unshift(r):t._events[e]=[r,t._events[e]]:t.on(e,r)}(t,"error",l),t.once("close",d),t.once("finish",p),t.emit("pipe",n),i.flowing||(s("pipe resume"),n.resume()),t},E.prototype.unpipe=function(t){var e=this._readableState,r={hasUnpiped:!1};if(0===e.pipesCount)return this;if(1===e.pipesCount)return t&&t!==e.pipes||(t||(t=e.pipes),e.pipes=null,e.pipesCount=0,e.flowing=!1,t&&t.emit("unpipe",this,r)),this;if(!t){var n=e.pipes,i=e.pipesCount;e.pipes=null,e.pipesCount=0,e.flowing=!1;for(var o=0;o<i;o++)n[o].emit("unpipe",this,{hasUnpiped:!1});return this}var s=D(e.pipes,t);return-1===s||(e.pipes.splice(s,1),e.pipesCount-=1,1===e.pipesCount&&(e.pipes=e.pipes[0]),t.emit("unpipe",this,r)),this},E.prototype.on=function(t,e){var r=n.prototype.on.call(this,t,e),i=this._readableState;return"data"===t?(i.readableListening=this.listenerCount("readable")>0,!1!==i.flowing&&this.resume()):"readable"===t&&(i.endEmitted||i.readableListening||(i.readableListening=i.needReadable=!0,i.flowing=!1,i.emittedReadable=!1,s("on readable",i.length,i.reading),i.length?x(this):i.reading||vr.nextTick(P,this))),r},E.prototype.addListener=E.prototype.on,E.prototype.removeListener=function(t,e){var r=n.prototype.removeListener.call(this,t,e);return"readable"===t&&vr.nextTick(N,this),r},E.prototype.removeAllListeners=function(t){var e=n.prototype.removeAllListeners.apply(this,arguments);return"readable"!==t&&void 0!==t||vr.nextTick(N,this),e},E.prototype.resume=function(){var t=this._readableState;return t.flowing||(s("resume"),t.flowing=!t.readableListening,function(t,e){e.resumeScheduled||(e.resumeScheduled=!0,vr.nextTick(I,t,e))}(this,t)),t.paused=!1,this},E.prototype.pause=function(){return s("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(s("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},E.prototype.wrap=function(t){var e=this,r=this._readableState,n=!1;for(var i in t.on("end",function(){if(s("wrapped end"),r.decoder&&!r.ended){var t=r.decoder.end();t&&t.length&&e.push(t)}e.push(null)}),t.on("data",function(i){(s("wrapped data"),r.decoder&&(i=r.decoder.write(i)),r.objectMode&&null==i)||(r.objectMode||i&&i.length)&&(e.push(i)||(n=!0,t.pause()))}),t)void 0===this[i]&&"function"==typeof t[i]&&(this[i]=function(e){return function(){return t[e].apply(t,arguments)}}(i));for(var o=0;o<w.length;o++)t.on(w[o],this.emit.bind(this,w[o]));return this._read=function(e){s("wrapped _read",e),n&&(n=!1,t.resume())},this},"function"==typeof Symbol&&(E.prototype[Symbol.asyncIterator]=function(){return void 0===h&&(h=Tg()),h(this)}),Object.defineProperty(E.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(E.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(E.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(t){this._readableState&&(this._readableState.flowing=t)}}),E._fromList=C,Object.defineProperty(E.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}}),"function"==typeof Symbol&&(E.from=function(t,e){return void 0===c&&(c=Mg?Ag:(Mg=1,Ag=function(){throw new Error("Readable.from is not available in the browser")})),c(E,t,e)}),Sg}var Bg=Dg,Ng=tg.codes,Pg=Ng.ERR_METHOD_NOT_IMPLEMENTED,Ig=Ng.ERR_MULTIPLE_CALLBACK,Og=Ng.ERR_TRANSFORM_ALREADY_TRANSFORMING,Cg=Ng.ERR_TRANSFORM_WITH_LENGTH_0,Lg=dg();function jg(t,e){var r=this._transformState;r.transforming=!1;var n=r.writecb;if(null===n)return this.emit("error",new Ig);r.writechunk=null,r.writecb=null,null!=e&&this.push(e),n(t);var i=this._readableState;i.reading=!1,(i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}function Dg(t){if(!(this instanceof Dg))return new Dg(t);Lg.call(this,t),this._transformState={afterTransform:jg.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,t&&("function"==typeof t.transform&&(this._transform=t.transform),"function"==typeof t.flush&&(this._flush=t.flush)),this.on("prefinish",Ug)}function Ug(){var t=this;"function"!=typeof this._flush||this._readableState.destroyed?Fg(this,null,null):this._flush(function(e,r){Fg(t,e,r)})}function Fg(t,e,r){if(e)return t.emit("error",e);if(null!=r&&t.push(r),t._writableState.length)throw new Cg;if(t._transformState.transforming)throw new Og;return t.push(null)}ri(Dg,Lg),Dg.prototype.push=function(t,e){return this._transformState.needTransform=!1,Lg.prototype.push.call(this,t,e)},Dg.prototype._transform=function(t,e,r){r(new Pg("_transform()"))},Dg.prototype._write=function(t,e,r){var n=this._transformState;if(n.writecb=r,n.writechunk=t,n.writeencoding=e,!n.transforming){var i=this._readableState;(n.needTransform||i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}},Dg.prototype._read=function(t){var e=this._transformState;null===e.writechunk||e.transforming?e.needTransform=!0:(e.transforming=!0,this._transform(e.writechunk,e.writeencoding,e.afterTransform))},Dg.prototype._destroy=function(t,e){Lg.prototype._destroy.call(this,t,function(t){e(t)})};var zg,qg=Kg,Hg=Bg;function Kg(t){if(!(this instanceof Kg))return new Kg(t);Hg.call(this,t)}ri(Kg,Hg),Kg.prototype._transform=function(t,e,r){r(null,t)};var Gg=tg.codes,Vg=Gg.ERR_MISSING_ARGS,Wg=Gg.ERR_STREAM_DESTROYED;function Jg(t){if(t)throw t}function Zg(t){t()}function Yg(t,e){return t.pipe(e)}var Xg=function(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];var n,i=function(t){return t.length?"function"!=typeof t[t.length-1]?Jg:t.pop():Jg}(e);if(Array.isArray(e[0])&&(e=e[0]),e.length<2)throw new Vg("streams");var o=e.map(function(t,r){var s=r<e.length-1;return function(t,e,r,n){n=function(t){var e=!1;return function(){e||(e=!0,t.apply(void 0,arguments))}}(n);var i=!1;t.on("close",function(){i=!0}),void 0===zg&&(zg=xg),zg(t,{readable:e,writable:r},function(t){if(t)return n(t);i=!0,n()});var o=!1;return function(e){if(!i&&!o)return o=!0,function(t){return t.setHeader&&"function"==typeof t.abort}(t)?t.abort():"function"==typeof t.destroy?t.destroy():void n(e||new Wg("pipe"))}}(t,s,r>0,function(t){n||(n=t),t&&o.forEach(Zg),s||(o.forEach(Zg),i(n))})});return e.reduce(Yg)};!function(t,e){(e=t.exports=Rg()).Stream=e,e.Readable=e,e.Writable=lg(),e.Duplex=dg(),e.Transform=Bg,e.PassThrough=qg,e.finished=xg,e.pipeline=Xg}(nm,nm.exports);var $g=nm.exports;const{Transform:Qg}=$g;const{Transform:ty}=$g;const ey=t=>class e extends Qg{constructor(e,r,n,i,o){super(o),this._rate=e,this._capacity=r,this._delimitedSuffix=n,this._hashBitLength=i,this._options=o,this._state=new t,this._state.initialize(e,r),this._finalized=!1}_transform(t,e,r){let n=null;try{this.update(t,e)}catch(t){n=t}r(n)}_flush(t){let e=null;try{this.push(this.digest())}catch(t){e=t}t(e)}update(t,e){if(!_.isBuffer(t)&&"string"!=typeof t)throw new TypeError("Data must be a string or a buffer");if(this._finalized)throw new Error("Digest already called");return _.isBuffer(t)||(t=_.from(t,e)),this._state.absorb(t),this}digest(t){if(this._finalized)throw new Error("Digest already called");this._finalized=!0,this._delimitedSuffix&&this._state.absorbLastFewBits(this._delimitedSuffix);let e=this._state.squeeze(this._hashBitLength/8);return void 0!==t&&(e=e.toString(t)),this._resetState(),e}_resetState(){return this._state.initialize(this._rate,this._capacity),this}_clone(){const t=new e(this._rate,this._capacity,this._delimitedSuffix,this._hashBitLength,this._options);return this._state.copy(t._state),t._finalized=this._finalized,t}},ry=t=>class e extends ty{constructor(e,r,n,i){super(i),this._rate=e,this._capacity=r,this._delimitedSuffix=n,this._options=i,this._state=new t,this._state.initialize(e,r),this._finalized=!1}_transform(t,e,r){let n=null;try{this.update(t,e)}catch(t){n=t}r(n)}_flush(){}_read(t){this.push(this.squeeze(t))}update(t,e){if(!_.isBuffer(t)&&"string"!=typeof t)throw new TypeError("Data must be a string or a buffer");if(this._finalized)throw new Error("Squeeze already called");return _.isBuffer(t)||(t=_.from(t,e)),this._state.absorb(t),this}squeeze(t,e){this._finalized||(this._finalized=!0,this._state.absorbLastFewBits(this._delimitedSuffix));let r=this._state.squeeze(t);return void 0!==e&&(r=r.toString(e)),r}_resetState(){return this._state.initialize(this._rate,this._capacity),this}_clone(){const t=new e(this._rate,this._capacity,this._delimitedSuffix,this._options);return this._state.copy(t._state),t._finalized=this._finalized,t}};var ny={};const iy=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648];ny.p1600=function(t){for(let e=0;e<24;++e){const r=t[0]^t[10]^t[20]^t[30]^t[40],n=t[1]^t[11]^t[21]^t[31]^t[41],i=t[2]^t[12]^t[22]^t[32]^t[42],o=t[3]^t[13]^t[23]^t[33]^t[43],s=t[4]^t[14]^t[24]^t[34]^t[44],a=t[5]^t[15]^t[25]^t[35]^t[45],u=t[6]^t[16]^t[26]^t[36]^t[46],h=t[7]^t[17]^t[27]^t[37]^t[47],c=t[8]^t[18]^t[28]^t[38]^t[48],f=t[9]^t[19]^t[29]^t[39]^t[49];let l=c^(i<<1|o>>>31),d=f^(o<<1|i>>>31);const p=t[0]^l,m=t[1]^d,g=t[10]^l,y=t[11]^d,b=t[20]^l,v=t[21]^d,w=t[30]^l,_=t[31]^d,E=t[40]^l,A=t[41]^d;l=r^(s<<1|a>>>31),d=n^(a<<1|s>>>31);const M=t[2]^l,S=t[3]^d,k=t[12]^l,x=t[13]^d,T=t[22]^l,R=t[23]^d,B=t[32]^l,N=t[33]^d,P=t[42]^l,I=t[43]^d;l=i^(u<<1|h>>>31),d=o^(h<<1|u>>>31);const O=t[4]^l,C=t[5]^d,L=t[14]^l,j=t[15]^d,D=t[24]^l,U=t[25]^d,F=t[34]^l,z=t[35]^d,q=t[44]^l,H=t[45]^d;l=s^(c<<1|f>>>31),d=a^(f<<1|c>>>31);const K=t[6]^l,G=t[7]^d,V=t[16]^l,W=t[17]^d,J=t[26]^l,Z=t[27]^d,Y=t[36]^l,X=t[37]^d,$=t[46]^l,Q=t[47]^d;l=u^(r<<1|n>>>31),d=h^(n<<1|r>>>31);const tt=t[8]^l,et=t[9]^d,rt=t[18]^l,nt=t[19]^d,it=t[28]^l,ot=t[29]^d,st=t[38]^l,at=t[39]^d,ut=t[48]^l,ht=t[49]^d,ct=p,ft=m,lt=y<<4|g>>>28,dt=g<<4|y>>>28,pt=b<<3|v>>>29,mt=v<<3|b>>>29,gt=_<<9|w>>>23,yt=w<<9|_>>>23,bt=E<<18|A>>>14,vt=A<<18|E>>>14,wt=M<<1|S>>>31,_t=S<<1|M>>>31,Et=x<<12|k>>>20,At=k<<12|x>>>20,Mt=T<<10|R>>>22,St=R<<10|T>>>22,kt=N<<13|B>>>19,xt=B<<13|N>>>19,Tt=P<<2|I>>>30,Rt=I<<2|P>>>30,Bt=C<<30|O>>>2,Nt=O<<30|C>>>2,Pt=L<<6|j>>>26,It=j<<6|L>>>26,Ot=U<<11|D>>>21,Ct=D<<11|U>>>21,Lt=F<<15|z>>>17,jt=z<<15|F>>>17,Dt=H<<29|q>>>3,Ut=q<<29|H>>>3,Ft=K<<28|G>>>4,zt=G<<28|K>>>4,qt=W<<23|V>>>9,Ht=V<<23|W>>>9,Kt=J<<25|Z>>>7,Gt=Z<<25|J>>>7,Vt=Y<<21|X>>>11,Wt=X<<21|Y>>>11,Jt=Q<<24|$>>>8,Zt=$<<24|Q>>>8,Yt=tt<<27|et>>>5,Xt=et<<27|tt>>>5,$t=rt<<20|nt>>>12,Qt=nt<<20|rt>>>12,te=ot<<7|it>>>25,ee=it<<7|ot>>>25,re=st<<8|at>>>24,ne=at<<8|st>>>24,ie=ut<<14|ht>>>18,oe=ht<<14|ut>>>18;t[0]=ct^~Et&Ot,t[1]=ft^~At&Ct,t[10]=Ft^~$t&pt,t[11]=zt^~Qt&mt,t[20]=wt^~Pt&Kt,t[21]=_t^~It&Gt,t[30]=Yt^~lt&Mt,t[31]=Xt^~dt&St,t[40]=Bt^~qt&te,t[41]=Nt^~Ht&ee,t[2]=Et^~Ot&Vt,t[3]=At^~Ct&Wt,t[12]=$t^~pt&kt,t[13]=Qt^~mt&xt,t[22]=Pt^~Kt&re,t[23]=It^~Gt&ne,t[32]=lt^~Mt&Lt,t[33]=dt^~St&jt,t[42]=qt^~te&gt,t[43]=Ht^~ee&yt,t[4]=Ot^~Vt&ie,t[5]=Ct^~Wt&oe,t[14]=pt^~kt&Dt,t[15]=mt^~xt&Ut,t[24]=Kt^~re&bt,t[25]=Gt^~ne&vt,t[34]=Mt^~Lt&Jt,t[35]=St^~jt&Zt,t[44]=te^~gt&Tt,t[45]=ee^~yt&Rt,t[6]=Vt^~ie&ct,t[7]=Wt^~oe&ft,t[16]=kt^~Dt&Ft,t[17]=xt^~Ut&zt,t[26]=re^~bt&wt,t[27]=ne^~vt&_t,t[36]=Lt^~Jt&Yt,t[37]=jt^~Zt&Xt,t[46]=gt^~Tt&Bt,t[47]=yt^~Rt&Nt,t[8]=ie^~ct&Et,t[9]=oe^~ft&At,t[18]=Dt^~Ft&$t,t[19]=Ut^~zt&Qt,t[28]=bt^~wt&Pt,t[29]=vt^~_t&It,t[38]=Jt^~Yt&lt,t[39]=Zt^~Xt&dt,t[48]=Tt^~Bt&qt,t[49]=Rt^~Nt&Ht,t[0]^=iy[2*e],t[1]^=iy[2*e+1]}};const oy=ny;function sy(){this.state=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],this.blockSize=null,this.count=0,this.squeezing=!1}sy.prototype.initialize=function(t,e){for(let t=0;t<50;++t)this.state[t]=0;this.blockSize=t/8,this.count=0,this.squeezing=!1},sy.prototype.absorb=function(t){for(let e=0;e<t.length;++e)this.state[~~(this.count/4)]^=t[e]<<this.count%4*8,this.count+=1,this.count===this.blockSize&&(oy.p1600(this.state),this.count=0)},sy.prototype.absorbLastFewBits=function(t){this.state[~~(this.count/4)]^=t<<this.count%4*8,128&t&&this.count===this.blockSize-1&&oy.p1600(this.state),this.state[~~((this.blockSize-1)/4)]^=128<<(this.blockSize-1)%4*8,oy.p1600(this.state),this.count=0,this.squeezing=!0},sy.prototype.squeeze=function(t){this.squeezing||this.absorbLastFewBits(1);const e=_.alloc(t);for(let r=0;r<t;++r)e[r]=this.state[~~(this.count/4)]>>>this.count%4*8&255,this.count+=1,this.count===this.blockSize&&(oy.p1600(this.state),this.count=0);return e},sy.prototype.copy=function(t){for(let e=0;e<50;++e)t.state[e]=this.state[e];t.blockSize=this.blockSize,t.count=this.count,t.squeezing=this.squeezing};var ay=function(t){const e=ey(t),r=ry(t);return function(t,n){switch("string"==typeof t?t.toLowerCase():t){case"keccak224":return new e(1152,448,null,224,n);case"keccak256":return new e(1088,512,null,256,n);case"keccak384":return new e(832,768,null,384,n);case"keccak512":return new e(576,1024,null,512,n);case"sha3-224":return new e(1152,448,6,224,n);case"sha3-256":return new e(1088,512,6,256,n);case"sha3-384":return new e(832,768,6,384,n);case"sha3-512":return new e(576,1024,6,512,n);case"shake128":return new r(1344,256,31,n);case"shake256":return new r(1088,512,31,n);default:throw new Error("Invald algorithm: "+t)}}}(sy),uy=e&&e.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};const hy=uy(pd),cy=st,fy=uy(ay);function ly(t){return t=function(t){if(!cy.Buffer.isBuffer(t))if(Array.isArray(t))t=cy.Buffer.from(t);else if("string"==typeof t)t=function(t,e){if("string"!=typeof t||!t.match(/^0x[0-9A-Fa-f]*$/))return!1;if(e&&t.length!==2+2*e)return!1;return!0}(t)?cy.Buffer.from(dy(function(t){if("string"!=typeof t)return t;return function(t){if("string"!=typeof t)throw new Error("value must be type 'string', is currently type "+typeof t+", while checking isHexPrefixed.");return"0x"===t.slice(0,2)}(t)?t.slice(2):t}(t)),"hex"):cy.Buffer.from(t);else if("number"==typeof t)t=function(t){const e=function(t){const e=t.toString(16);return`0x${e}`}(t);return cy.Buffer.from(dy(e.slice(2)),"hex")}(t);else if(null==t)t=cy.Buffer.allocUnsafe(0);else if(hy.default.isBN(t))t=t.toArrayLike(cy.Buffer);else{if(!t.toArray)throw new Error("invalid type");t=cy.Buffer.from(t.toArray())}return t}(t),fy.default("keccak256").update(t).digest()}function dy(t){if("string"!=typeof t)throw new Error(`while padding to even, value must be string, is currently ${typeof t}, while padToEven.`);return t.length%2&&(t=`0${t}`),t}"undefined"!=typeof window&&(window.keccak256=ly);var py=ly,my=e&&e.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Vl,"__esModule",{value:!0});const gy=my(jl),yy=my(rm),by=Fl,vy=my(py);Vl.default=class{constructor(t,e){this._key=t,this.ownerLength=by.SIG_CONFIG[by.SignatureConfig.ETHEREUM].pubLength,this.signatureLength=by.SIG_CONFIG[by.SignatureConfig.ETHEREUM].sigLength,this.signatureType=by.SignatureConfig.ETHEREUM,this.pk=e.toString("hex")}get publicKey(){return _.alloc(0)}get key(){return _.from(this._key,"hex")}static async verify(t,e,r){let n=t;"string"==typeof t&&(n=gy.default.toBuffer(t));let i=!1;try{i=yy.default.ecdsaVerify(r,vy.default(_.from(e)),n)}catch(t){}return i}sign(t){return yy.default.ecdsaSign(vy.default(_.from(t)),_.from(this.key)).signature}};const wy="abi/5.8.0",_y=new yt(wy),Ey={};let Ay={calldata:!0,memory:!0,storage:!0},My={calldata:!0,memory:!0};function Sy(t,e){if("bytes"===t||"string"===t){if(Ay[e])return!0}else if("address"===t){if("payable"===e)return!0}else if((t.indexOf("[")>=0||"tuple"===t)&&My[e])return!0;return(Ay[e]||"payable"===e)&&_y.throwArgumentError("invalid modifier","name",e),!1}function ky(t,e){for(let r in e)fe(t,r,e[r])}const xy=Object.freeze({sighash:"sighash",minimal:"minimal",full:"full",json:"json"}),Ty=new RegExp(/^(.*)\[([0-9]*)\]$/);class Ry{constructor(t,e){t!==Ey&&_y.throwError("use fromString",yt.errors.UNSUPPORTED_OPERATION,{operation:"new ParamType()"}),ky(this,e);let r=this.type.match(Ty);ky(this,r?{arrayLength:parseInt(r[2]||"-1"),arrayChildren:Ry.fromObject({type:r[1],components:this.components}),baseType:"array"}:{arrayLength:null,arrayChildren:null,baseType:null!=this.components?"tuple":this.type}),this._isParamType=!0,Object.freeze(this)}format(t){if(t||(t=xy.sighash),xy[t]||_y.throwArgumentError("invalid format type","format",t),t===xy.json){let e={type:"tuple"===this.baseType?"tuple":this.type,name:this.name||void 0};return"boolean"==typeof this.indexed&&(e.indexed=this.indexed),this.components&&(e.components=this.components.map(e=>JSON.parse(e.format(t)))),JSON.stringify(e)}let e="";return"array"===this.baseType?(e+=this.arrayChildren.format(t),e+="["+(this.arrayLength<0?"":String(this.arrayLength))+"]"):"tuple"===this.baseType?(t!==xy.sighash&&(e+=this.type),e+="("+this.components.map(e=>e.format(t)).join(t===xy.full?", ":",")+")"):e+=this.type,t!==xy.sighash&&(!0===this.indexed&&(e+=" indexed"),t===xy.full&&this.name&&(e+=" "+this.name)),e}static from(t,e){return"string"==typeof t?Ry.fromString(t,e):Ry.fromObject(t)}static fromObject(t){return Ry.isParamType(t)?t:new Ry(Ey,{name:t.name||null,type:Fy(t.type),indexed:null==t.indexed?null:!!t.indexed,components:t.components?t.components.map(Ry.fromObject):null})}static fromString(t,e){return function(t){return Ry.fromObject({name:t.name,type:t.type,indexed:t.indexed,components:t.components})}(function(t,e){let r=t;function n(e){_y.throwArgumentError(`unexpected character at position ${e}`,"param",t)}function i(t){let r={type:"",name:"",parent:t,state:{allowType:!0}};return e&&(r.indexed=!1),r}t=t.replace(/\s/g," ");let o={type:"",name:"",state:{allowType:!0}},s=o;for(let r=0;r<t.length;r++){let o=t[r];switch(o){case"(":s.state.allowType&&""===s.type?s.type="tuple":s.state.allowParams||n(r),s.state.allowType=!1,s.type=Fy(s.type),s.components=[i(s)],s=s.components[0];break;case")":delete s.state,"indexed"===s.name&&(e||n(r),s.indexed=!0,s.name=""),Sy(s.type,s.name)&&(s.name=""),s.type=Fy(s.type);let t=s;s=s.parent,s||n(r),delete t.parent,s.state.allowParams=!1,s.state.allowName=!0,s.state.allowArray=!0;break;case",":delete s.state,"indexed"===s.name&&(e||n(r),s.indexed=!0,s.name=""),Sy(s.type,s.name)&&(s.name=""),s.type=Fy(s.type);let a=i(s.parent);s.parent.components.push(a),delete s.parent,s=a;break;case" ":s.state.allowType&&""!==s.type&&(s.type=Fy(s.type),delete s.state.allowType,s.state.allowName=!0,s.state.allowParams=!0),s.state.allowName&&""!==s.name&&("indexed"===s.name?(e||n(r),s.indexed&&n(r),s.indexed=!0,s.name=""):Sy(s.type,s.name)?s.name="":s.state.allowName=!1);break;case"[":s.state.allowArray||n(r),s.type+=o,s.state.allowArray=!1,s.state.allowName=!1,s.state.readArray=!0;break;case"]":s.state.readArray||n(r),s.type+=o,s.state.readArray=!1,s.state.allowArray=!0,s.state.allowName=!0;break;default:s.state.allowType?(s.type+=o,s.state.allowParams=!0,s.state.allowArray=!0):s.state.allowName?(s.name+=o,delete s.state.allowArray):s.state.readArray?s.type+=o:n(r)}}return s.parent&&_y.throwArgumentError("unexpected eof","param",t),delete o.state,"indexed"===s.name?(e||n(r.length-7),s.indexed&&n(r.length-7),s.indexed=!0,s.name=""):Sy(s.type,s.name)&&(s.name=""),o.type=Fy(o.type),o}(t,!!e))}static isParamType(t){return!(null==t||!t._isParamType)}}function By(t,e){return function(t){t=t.trim();let e=[],r="",n=0;for(let i=0;i<t.length;i++){let o=t[i];","===o&&0===n?(e.push(r),r=""):(r+=o,"("===o?n++:")"===o&&(n--,-1===n&&_y.throwArgumentError("unbalanced parenthesis","value",t)))}r&&e.push(r);return e}(t).map(t=>Ry.fromString(t,e))}class Ny{constructor(t,e){t!==Ey&&_y.throwError("use a static from method",yt.errors.UNSUPPORTED_OPERATION,{operation:"new Fragment()"}),ky(this,e),this._isFragment=!0,Object.freeze(this)}static from(t){return Ny.isFragment(t)?t:"string"==typeof t?Ny.fromString(t):Ny.fromObject(t)}static fromObject(t){if(Ny.isFragment(t))return t;switch(t.type){case"function":return jy.fromObject(t);case"event":return Py.fromObject(t);case"constructor":return Ly.fromObject(t);case"error":return Uy.fromObject(t);case"fallback":case"receive":return null}return _y.throwArgumentError("invalid fragment object","value",t)}static fromString(t){return"event"===(t=(t=(t=t.replace(/\s/g," ")).replace(/\(/g," (").replace(/\)/g,") ").replace(/\s+/g," ")).trim()).split(" ")[0]?Py.fromString(t.substring(5).trim()):"function"===t.split(" ")[0]?jy.fromString(t.substring(8).trim()):"constructor"===t.split("(")[0].trim()?Ly.fromString(t.trim()):"error"===t.split(" ")[0]?Uy.fromString(t.substring(5).trim()):_y.throwArgumentError("unsupported fragment","value",t)}static isFragment(t){return!(!t||!t._isFragment)}}class Py extends Ny{format(t){if(t||(t=xy.sighash),xy[t]||_y.throwArgumentError("invalid format type","format",t),t===xy.json)return JSON.stringify({type:"event",anonymous:this.anonymous,name:this.name,inputs:this.inputs.map(e=>JSON.parse(e.format(t)))});let e="";return t!==xy.sighash&&(e+="event "),e+=this.name+"("+this.inputs.map(e=>e.format(t)).join(t===xy.full?", ":",")+") ",t!==xy.sighash&&this.anonymous&&(e+="anonymous "),e.trim()}static from(t){return"string"==typeof t?Py.fromString(t):Py.fromObject(t)}static fromObject(t){if(Py.isEventFragment(t))return t;"event"!==t.type&&_y.throwArgumentError("invalid event object","value",t);const e={name:qy(t.name),anonymous:t.anonymous,inputs:t.inputs?t.inputs.map(Ry.fromObject):[],type:"event"};return new Py(Ey,e)}static fromString(t){let e=t.match(Hy);e||_y.throwArgumentError("invalid event string","value",t);let r=!1;return e[3].split(" ").forEach(t=>{switch(t.trim()){case"anonymous":r=!0;break;case"":break;default:_y.warn("unknown modifier: "+t)}}),Py.fromObject({name:e[1].trim(),anonymous:r,inputs:By(e[2],!0),type:"event"})}static isEventFragment(t){return t&&t._isFragment&&"event"===t.type}}function Iy(t,e){e.gas=null;let r=t.split("@");return 1!==r.length?(r.length>2&&_y.throwArgumentError("invalid human-readable ABI signature","value",t),r[1].match(/^[0-9]+$/)||_y.throwArgumentError("invalid human-readable ABI signature gas","value",t),e.gas=Gt.from(r[1]),r[0]):t}function Oy(t,e){e.constant=!1,e.payable=!1,e.stateMutability="nonpayable",t.split(" ").forEach(t=>{switch(t.trim()){case"constant":e.constant=!0;break;case"payable":e.payable=!0,e.stateMutability="payable";break;case"nonpayable":e.payable=!1,e.stateMutability="nonpayable";break;case"pure":e.constant=!0,e.stateMutability="pure";break;case"view":e.constant=!0,e.stateMutability="view"}})}function Cy(t){let e={constant:!1,payable:!0,stateMutability:"payable"};return null!=t.stateMutability?(e.stateMutability=t.stateMutability,e.constant="view"===e.stateMutability||"pure"===e.stateMutability,null!=t.constant&&!!t.constant!==e.constant&&_y.throwArgumentError("cannot have constant function with mutability "+e.stateMutability,"value",t),e.payable="payable"===e.stateMutability,null!=t.payable&&!!t.payable!==e.payable&&_y.throwArgumentError("cannot have payable function with mutability "+e.stateMutability,"value",t)):null!=t.payable?(e.payable=!!t.payable,null!=t.constant||e.payable||"constructor"===t.type||_y.throwArgumentError("unable to determine stateMutability","value",t),e.constant=!!t.constant,e.constant?e.stateMutability="view":e.stateMutability=e.payable?"payable":"nonpayable",e.payable&&e.constant&&_y.throwArgumentError("cannot have constant payable function","value",t)):null!=t.constant?(e.constant=!!t.constant,e.payable=!e.constant,e.stateMutability=e.constant?"view":"payable"):"constructor"!==t.type&&_y.throwArgumentError("unable to determine stateMutability","value",t),e}class Ly extends Ny{format(t){if(t||(t=xy.sighash),xy[t]||_y.throwArgumentError("invalid format type","format",t),t===xy.json)return JSON.stringify({type:"constructor",stateMutability:"nonpayable"!==this.stateMutability?this.stateMutability:void 0,payable:this.payable,gas:this.gas?this.gas.toNumber():void 0,inputs:this.inputs.map(e=>JSON.parse(e.format(t)))});t===xy.sighash&&_y.throwError("cannot format a constructor for sighash",yt.errors.UNSUPPORTED_OPERATION,{operation:"format(sighash)"});let e="constructor("+this.inputs.map(e=>e.format(t)).join(t===xy.full?", ":",")+") ";return this.stateMutability&&"nonpayable"!==this.stateMutability&&(e+=this.stateMutability+" "),e.trim()}static from(t){return"string"==typeof t?Ly.fromString(t):Ly.fromObject(t)}static fromObject(t){if(Ly.isConstructorFragment(t))return t;"constructor"!==t.type&&_y.throwArgumentError("invalid constructor object","value",t);let e=Cy(t);e.constant&&_y.throwArgumentError("constructor cannot be constant","value",t);const r={name:null,type:t.type,inputs:t.inputs?t.inputs.map(Ry.fromObject):[],payable:e.payable,stateMutability:e.stateMutability,gas:t.gas?Gt.from(t.gas):null};return new Ly(Ey,r)}static fromString(t){let e={type:"constructor"},r=(t=Iy(t,e)).match(Hy);return r&&"constructor"===r[1].trim()||_y.throwArgumentError("invalid constructor string","value",t),e.inputs=By(r[2].trim(),!1),Oy(r[3].trim(),e),Ly.fromObject(e)}static isConstructorFragment(t){return t&&t._isFragment&&"constructor"===t.type}}class jy extends Ly{format(t){if(t||(t=xy.sighash),xy[t]||_y.throwArgumentError("invalid format type","format",t),t===xy.json)return JSON.stringify({type:"function",name:this.name,constant:this.constant,stateMutability:"nonpayable"!==this.stateMutability?this.stateMutability:void 0,payable:this.payable,gas:this.gas?this.gas.toNumber():void 0,inputs:this.inputs.map(e=>JSON.parse(e.format(t))),outputs:this.outputs.map(e=>JSON.parse(e.format(t)))});let e="";return t!==xy.sighash&&(e+="function "),e+=this.name+"("+this.inputs.map(e=>e.format(t)).join(t===xy.full?", ":",")+") ",t!==xy.sighash&&(this.stateMutability?"nonpayable"!==this.stateMutability&&(e+=this.stateMutability+" "):this.constant&&(e+="view "),this.outputs&&this.outputs.length&&(e+="returns ("+this.outputs.map(e=>e.format(t)).join(", ")+") "),null!=this.gas&&(e+="@"+this.gas.toString()+" ")),e.trim()}static from(t){return"string"==typeof t?jy.fromString(t):jy.fromObject(t)}static fromObject(t){if(jy.isFunctionFragment(t))return t;"function"!==t.type&&_y.throwArgumentError("invalid function object","value",t);let e=Cy(t);const r={type:t.type,name:qy(t.name),constant:e.constant,inputs:t.inputs?t.inputs.map(Ry.fromObject):[],outputs:t.outputs?t.outputs.map(Ry.fromObject):[],payable:e.payable,stateMutability:e.stateMutability,gas:t.gas?Gt.from(t.gas):null};return new jy(Ey,r)}static fromString(t){let e={type:"function"},r=(t=Iy(t,e)).split(" returns ");r.length>2&&_y.throwArgumentError("invalid function string","value",t);let n=r[0].match(Hy);if(n||_y.throwArgumentError("invalid function signature","value",t),e.name=n[1].trim(),e.name&&qy(e.name),e.inputs=By(n[2],!1),Oy(n[3].trim(),e),r.length>1){let n=r[1].match(Hy);""==n[1].trim()&&""==n[3].trim()||_y.throwArgumentError("unexpected tokens","value",t),e.outputs=By(n[2],!1)}else e.outputs=[];return jy.fromObject(e)}static isFunctionFragment(t){return t&&t._isFragment&&"function"===t.type}}function Dy(t){const e=t.format();return"Error(string)"!==e&&"Panic(uint256)"!==e||_y.throwArgumentError(`cannot specify user defined ${e} error`,"fragment",t),t}class Uy extends Ny{format(t){if(t||(t=xy.sighash),xy[t]||_y.throwArgumentError("invalid format type","format",t),t===xy.json)return JSON.stringify({type:"error",name:this.name,inputs:this.inputs.map(e=>JSON.parse(e.format(t)))});let e="";return t!==xy.sighash&&(e+="error "),e+=this.name+"("+this.inputs.map(e=>e.format(t)).join(t===xy.full?", ":",")+") ",e.trim()}static from(t){return"string"==typeof t?Uy.fromString(t):Uy.fromObject(t)}static fromObject(t){if(Uy.isErrorFragment(t))return t;"error"!==t.type&&_y.throwArgumentError("invalid error object","value",t);const e={type:t.type,name:qy(t.name),inputs:t.inputs?t.inputs.map(Ry.fromObject):[]};return Dy(new Uy(Ey,e))}static fromString(t){let e={type:"error"},r=t.match(Hy);return r||_y.throwArgumentError("invalid error signature","value",t),e.name=r[1].trim(),e.name&&qy(e.name),e.inputs=By(r[2],!1),Dy(Uy.fromObject(e))}static isErrorFragment(t){return t&&t._isFragment&&"error"===t.type}}function Fy(t){return t.match(/^uint($|[^1-9])/)?t="uint256"+t.substring(4):t.match(/^int($|[^1-9])/)&&(t="int256"+t.substring(3)),t}const zy=new RegExp("^[a-zA-Z$_][a-zA-Z0-9$_]*$");function qy(t){return t&&t.match(zy)||_y.throwArgumentError(`invalid identifier "${t}"`,"value",t),t}const Hy=new RegExp("^([^)(]*)\\((.*)\\)([^)(]*)$");const Ky=new yt(wy);function Gy(t){const e=[],r=function(t,n){if(Array.isArray(n))for(let i in n){const o=t.slice();o.push(i);try{r(o,n[i])}catch(t){e.push({path:o,error:t})}}};return r([],t),e}class Vy{constructor(t,e,r,n){this.name=t,this.type=e,this.localName=r,this.dynamic=n}_throwError(t,e){Ky.throwArgumentError(t,this.localName,e)}}class Wy{constructor(t){fe(this,"wordSize",t||32),this._data=[],this._dataLength=0,this._padding=new Uint8Array(t)}get data(){return It(this._data)}get length(){return this._dataLength}_writeData(t){return this._data.push(t),this._dataLength+=t.length,t.length}appendWriter(t){return this._writeData(St(t._data))}writeBytes(t){let e=Mt(t);const r=e.length%this.wordSize;return r&&(e=St([e,this._padding.slice(r)])),this._writeData(e)}_getValue(t){let e=Mt(Gt.from(t));return e.length>this.wordSize&&Ky.throwError("value out-of-bounds",yt.errors.BUFFER_OVERRUN,{length:this.wordSize,offset:e.length}),e.length%this.wordSize&&(e=St([this._padding.slice(e.length%this.wordSize),e])),e}writeValue(t){return this._writeData(this._getValue(t))}writeUpdatableValue(){const t=this._data.length;return this._data.push(this._padding),this._dataLength+=this.wordSize,e=>{this._data[t]=this._getValue(e)}}}let Jy=class t{constructor(t,e,r,n){fe(this,"_data",Mt(t)),fe(this,"wordSize",e||32),fe(this,"_coerceFunc",r),fe(this,"allowLoose",n),this._offset=0}get data(){return Bt(this._data)}get consumed(){return this._offset}static coerce(t,e){let r=t.match("^u?int([0-9]+)$");return r&&parseInt(r[1])<=48&&(e=e.toNumber()),e}coerce(e,r){return this._coerceFunc?this._coerceFunc(e,r):t.coerce(e,r)}_peekBytes(t,e,r){let n=Math.ceil(e/this.wordSize)*this.wordSize;return this._offset+n>this._data.length&&(this.allowLoose&&r&&this._offset+e<=this._data.length?n=e:Ky.throwError("data out-of-bounds",yt.errors.BUFFER_OVERRUN,{length:this._data.length,offset:this._offset+n})),this._data.slice(this._offset,this._offset+n)}subReader(e){return new t(this._data.slice(this._offset+e),this.wordSize,this._coerceFunc,this.allowLoose)}readBytes(t,e){let r=this._peekBytes(0,t,!!e);return this._offset+=r.length,r.slice(0,t)}readValue(){return Gt.from(this.readBytes(this.wordSize))}};class Zy extends Vy{constructor(t){super("address","address",t,!1)}defaultValue(){return"0x0000000000000000000000000000000000000000"}encode(t,e){try{e=In(e)}catch(t){this._throwError(t.message,e)}return t.writeValue(e)}decode(t){return In(Lt(t.readValue().toHexString(),20))}}class Yy extends Vy{constructor(t){super(t.name,t.type,void 0,t.dynamic),this.coder=t}defaultValue(){return this.coder.defaultValue()}encode(t,e){return this.coder.encode(t,e)}decode(t){return this.coder.decode(t)}}const Xy=new yt(wy);function $y(t,e,r){let n=null;if(Array.isArray(r))n=r;else if(r&&"object"==typeof r){let t={};n=e.map(e=>{const n=e.localName;return n||Xy.throwError("cannot encode object for signature with missing names",yt.errors.INVALID_ARGUMENT,{argument:"values",coder:e,value:r}),t[n]&&Xy.throwError("cannot encode object for signature with duplicate names",yt.errors.INVALID_ARGUMENT,{argument:"values",coder:e,value:r}),t[n]=!0,r[n]})}else Xy.throwArgumentError("invalid tuple value","tuple",r);e.length!==n.length&&Xy.throwArgumentError("types/value length mismatch","tuple",r);let i=new Wy(t.wordSize),o=new Wy(t.wordSize),s=[];e.forEach((t,e)=>{let r=n[e];if(t.dynamic){let e=o.length;t.encode(o,r);let n=i.writeUpdatableValue();s.push(t=>{n(t+e)})}else t.encode(i,r)}),s.forEach(t=>{t(i.length)});let a=t.appendWriter(i);return a+=t.appendWriter(o),a}function Qy(t,e){let r=[],n=t.subReader(0);e.forEach(e=>{let i=null;if(e.dynamic){let r=t.readValue(),o=n.subReader(r.toNumber());try{i=e.decode(o)}catch(t){if(t.code===yt.errors.BUFFER_OVERRUN)throw t;i=t,i.baseType=e.name,i.name=e.localName,i.type=e.type}}else try{i=e.decode(t)}catch(t){if(t.code===yt.errors.BUFFER_OVERRUN)throw t;i=t,i.baseType=e.name,i.name=e.localName,i.type=e.type}null!=i&&r.push(i)});const i=e.reduce((t,e)=>{const r=e.localName;return r&&(t[r]||(t[r]=0),t[r]++),t},{});e.forEach((t,e)=>{let n=t.localName;if(!n||1!==i[n])return;if("length"===n&&(n="_length"),null!=r[n])return;const o=r[e];o instanceof Error?Object.defineProperty(r,n,{enumerable:!0,get:()=>{throw o}}):r[n]=o});for(let t=0;t<r.length;t++){const e=r[t];e instanceof Error&&Object.defineProperty(r,t,{enumerable:!0,get:()=>{throw e}})}return Object.freeze(r)}class tb extends Vy{constructor(t,e,r){super("array",t.type+"["+(e>=0?e:"")+"]",r,-1===e||t.dynamic),this.coder=t,this.length=e}defaultValue(){const t=this.coder.defaultValue(),e=[];for(let r=0;r<this.length;r++)e.push(t);return e}encode(t,e){Array.isArray(e)||this._throwError("expected array value",e);let r=this.length;-1===r&&(r=e.length,t.writeValue(e.length)),Xy.checkArgumentCount(e.length,r,"coder array"+(this.localName?" "+this.localName:""));let n=[];for(let t=0;t<e.length;t++)n.push(this.coder);return $y(t,n,e)}decode(t){let e=this.length;-1===e&&(e=t.readValue().toNumber(),32*e>t._data.length&&Xy.throwError("insufficient data length",yt.errors.BUFFER_OVERRUN,{length:t._data.length,count:e}));let r=[];for(let t=0;t<e;t++)r.push(new Yy(this.coder));return t.coerce(this.name,Qy(t,r))}}class eb extends Vy{constructor(t){super("bool","bool",t,!1)}defaultValue(){return!1}encode(t,e){return t.writeValue(e?1:0)}decode(t){return t.coerce(this.type,!t.readValue().isZero())}}class rb extends Vy{constructor(t,e){super(t,t,e,!0)}defaultValue(){return"0x"}encode(t,e){e=Mt(e);let r=t.writeValue(e.length);return r+=t.writeBytes(e),r}decode(t){return t.readBytes(t.readValue().toNumber(),!0)}}class nb extends rb{constructor(t){super("bytes",t)}decode(t){return t.coerce(this.name,Bt(super.decode(t)))}}class ib extends Vy{constructor(t,e){let r="bytes"+String(t);super(r,r,e,!1),this.size=t}defaultValue(){return"0x0000000000000000000000000000000000000000000000000000000000000000".substring(0,2+2*this.size)}encode(t,e){let r=Mt(e);return r.length!==this.size&&this._throwError("incorrect data length",e),t.writeBytes(r)}decode(t){return t.coerce(this.name,Bt(t.readBytes(this.size)))}}class ob extends Vy{constructor(t){super("null","",t,!1)}defaultValue(){return null}encode(t,e){return null!=e&&this._throwError("not null",e),t.writeBytes([])}decode(t){return t.readBytes(0),t.coerce(this.name,null)}}class sb extends Vy{constructor(t,e,r){const n=(e?"int":"uint")+8*t;super(n,n,r,!1),this.size=t,this.signed=e}defaultValue(){return 0}encode(t,e){let r=Gt.from(e),n=Ke.mask(8*t.wordSize);if(this.signed){let t=n.mask(8*this.size-1);(r.gt(t)||r.lt(t.add(ze).mul(Ue)))&&this._throwError("value out-of-bounds",e)}else(r.lt(Fe)||r.gt(n.mask(8*this.size)))&&this._throwError("value out-of-bounds",e);return r=r.toTwos(8*this.size).mask(8*this.size),this.signed&&(r=r.fromTwos(8*this.size).toTwos(8*t.wordSize)),t.writeValue(r)}decode(t){let e=t.readValue().mask(8*this.size);return this.signed&&(e=e.fromTwos(8*this.size)),t.coerce(this.name,e)}}class ab extends rb{constructor(t){super("string",t)}defaultValue(){return""}encode(t,e){return super.encode(t,Rr(e))}decode(t){return Pr(super.decode(t))}}class ub extends Vy{constructor(t,e){let r=!1;const n=[];t.forEach(t=>{t.dynamic&&(r=!0),n.push(t.type)});super("tuple","tuple("+n.join(",")+")",e,r),this.coders=t}defaultValue(){const t=[];this.coders.forEach(e=>{t.push(e.defaultValue())});const e=this.coders.reduce((t,e)=>{const r=e.localName;return r&&(t[r]||(t[r]=0),t[r]++),t},{});return this.coders.forEach((r,n)=>{let i=r.localName;i&&1===e[i]&&("length"===i&&(i="_length"),null==t[i]&&(t[i]=t[n]))}),Object.freeze(t)}encode(t,e){return $y(t,this.coders,e)}decode(t){return t.coerce(this.name,Qy(t,this.coders))}}const hb=new yt(wy),cb=new RegExp(/^bytes([0-9]*)$/),fb=new RegExp(/^(u?int)([0-9]*)$/);class lb{constructor(t){fe(this,"coerceFunc",t||null)}_getCoder(t){switch(t.baseType){case"address":return new Zy(t.name);case"bool":return new eb(t.name);case"string":return new ab(t.name);case"bytes":return new nb(t.name);case"array":return new tb(this._getCoder(t.arrayChildren),t.arrayLength,t.name);case"tuple":return new ub((t.components||[]).map(t=>this._getCoder(t)),t.name);case"":return new ob(t.name)}let e=t.type.match(fb);if(e){let r=parseInt(e[2]||"256");return(0===r||r>256||r%8!=0)&&hb.throwArgumentError("invalid "+e[1]+" bit length","param",t),new sb(r/8,"int"===e[1],t.name)}if(e=t.type.match(cb),e){let r=parseInt(e[1]);return(0===r||r>32)&&hb.throwArgumentError("invalid bytes length","param",t),new ib(r,t.name)}return hb.throwArgumentError("invalid type","type",t.type)}_getWordSize(){return 32}_getReader(t,e){return new Jy(t,this._getWordSize(),this.coerceFunc,e)}_getWriter(){return new Wy(this._getWordSize())}getDefaultValue(t){const e=t.map(t=>this._getCoder(Ry.from(t)));return new ub(e,"_").defaultValue()}encode(t,e){t.length!==e.length&&hb.throwError("types/values length mismatch",yt.errors.INVALID_ARGUMENT,{count:{types:t.length,values:e.length},value:{types:t,values:e}});const r=t.map(t=>this._getCoder(Ry.from(t))),n=new ub(r,"_"),i=this._getWriter();return n.encode(i,e),i.data}decode(t,e,r){const n=t.map(t=>this._getCoder(Ry.from(t)));return new ub(n,"_").decode(this._getReader(Mt(e),r))}}const db=new lb,pb=new yt(wy);class mb extends we{}class gb extends we{}class yb extends we{}class bb extends we{static isIndexed(t){return!(!t||!t._isIndexed)}}const vb={"0x08c379a0":{signature:"Error(string)",name:"Error",inputs:["string"],reason:!0},"0x4e487b71":{signature:"Panic(uint256)",name:"Panic",inputs:["uint256"]}};function wb(t,e){const r=new Error(`deferred error during ABI decoding triggered accessing ${t}`);return r.error=e,r}class _b{constructor(t){let e=[];e="string"==typeof t?JSON.parse(t):t,fe(this,"fragments",e.map(t=>Ny.from(t)).filter(t=>null!=t)),fe(this,"_abiCoder",le(new.target,"getAbiCoder")()),fe(this,"functions",{}),fe(this,"errors",{}),fe(this,"events",{}),fe(this,"structs",{}),this.fragments.forEach(t=>{let e=null;switch(t.type){case"constructor":return this.deploy?void pb.warn("duplicate definition - constructor"):void fe(this,"deploy",t);case"function":e=this.functions;break;case"event":e=this.events;break;case"error":e=this.errors;break;default:return}let r=t.format();e[r]?pb.warn("duplicate definition - "+r):e[r]=t}),this.deploy||fe(this,"deploy",Ly.from({payable:!1,type:"constructor"})),fe(this,"_isInterface",!0)}format(t){t||(t=xy.full),t===xy.sighash&&pb.throwArgumentError("interface does not support formatting sighash","format",t);const e=this.fragments.map(e=>e.format(t));return t===xy.json?JSON.stringify(e.map(t=>JSON.parse(t))):e}static getAbiCoder(){return db}static getAddress(t){return In(t)}static getSighash(t){return Pt(Kr(t.format()),0,4)}static getEventTopic(t){return Kr(t.format())}getFunction(t){if(Tt(t)){for(const e in this.functions)if(t===this.getSighash(e))return this.functions[e];pb.throwArgumentError("no matching function","sighash",t)}if(-1===t.indexOf("(")){const e=t.trim(),r=Object.keys(this.functions).filter(t=>t.split("(")[0]===e);return 0===r.length?pb.throwArgumentError("no matching function","name",e):r.length>1&&pb.throwArgumentError("multiple matching functions","name",e),this.functions[r[0]]}const e=this.functions[jy.fromString(t).format()];return e||pb.throwArgumentError("no matching function","signature",t),e}getEvent(t){if(Tt(t)){const e=t.toLowerCase();for(const t in this.events)if(e===this.getEventTopic(t))return this.events[t];pb.throwArgumentError("no matching event","topichash",e)}if(-1===t.indexOf("(")){const e=t.trim(),r=Object.keys(this.events).filter(t=>t.split("(")[0]===e);return 0===r.length?pb.throwArgumentError("no matching event","name",e):r.length>1&&pb.throwArgumentError("multiple matching events","name",e),this.events[r[0]]}const e=this.events[Py.fromString(t).format()];return e||pb.throwArgumentError("no matching event","signature",t),e}getError(t){if(Tt(t)){const e=le(this.constructor,"getSighash");for(const r in this.errors){if(t===e(this.errors[r]))return this.errors[r]}pb.throwArgumentError("no matching error","sighash",t)}if(-1===t.indexOf("(")){const e=t.trim(),r=Object.keys(this.errors).filter(t=>t.split("(")[0]===e);return 0===r.length?pb.throwArgumentError("no matching error","name",e):r.length>1&&pb.throwArgumentError("multiple matching errors","name",e),this.errors[r[0]]}const e=this.errors[jy.fromString(t).format()];return e||pb.throwArgumentError("no matching error","signature",t),e}getSighash(t){if("string"==typeof t)try{t=this.getFunction(t)}catch(e){try{t=this.getError(t)}catch(t){throw e}}return le(this.constructor,"getSighash")(t)}getEventTopic(t){return"string"==typeof t&&(t=this.getEvent(t)),le(this.constructor,"getEventTopic")(t)}_decodeParams(t,e){return this._abiCoder.decode(t,e)}_encodeParams(t,e){return this._abiCoder.encode(t,e)}encodeDeploy(t){return this._encodeParams(this.deploy.inputs,t||[])}decodeErrorResult(t,e){"string"==typeof t&&(t=this.getError(t));const r=Mt(e);return Bt(r.slice(0,4))!==this.getSighash(t)&&pb.throwArgumentError(`data signature does not match error ${t.name}.`,"data",Bt(r)),this._decodeParams(t.inputs,r.slice(4))}encodeErrorResult(t,e){return"string"==typeof t&&(t=this.getError(t)),Bt(St([this.getSighash(t),this._encodeParams(t.inputs,e||[])]))}decodeFunctionData(t,e){"string"==typeof t&&(t=this.getFunction(t));const r=Mt(e);return Bt(r.slice(0,4))!==this.getSighash(t)&&pb.throwArgumentError(`data signature does not match function ${t.name}.`,"data",Bt(r)),this._decodeParams(t.inputs,r.slice(4))}encodeFunctionData(t,e){return"string"==typeof t&&(t=this.getFunction(t)),Bt(St([this.getSighash(t),this._encodeParams(t.inputs,e||[])]))}decodeFunctionResult(t,e){"string"==typeof t&&(t=this.getFunction(t));let r=Mt(e),n=null,i="",o=null,s=null,a=null;switch(r.length%this._abiCoder._getWordSize()){case 0:try{return this._abiCoder.decode(t.outputs,r)}catch(t){}break;case 4:{const t=Bt(r.slice(0,4)),e=vb[t];if(e)o=this._abiCoder.decode(e.inputs,r.slice(4)),s=e.name,a=e.signature,e.reason&&(n=o[0]),"Error"===s?i=`; VM Exception while processing transaction: reverted with reason string ${JSON.stringify(o[0])}`:"Panic"===s&&(i=`; VM Exception while processing transaction: reverted with panic code ${o[0]}`);else try{const e=this.getError(t);o=this._abiCoder.decode(e.inputs,r.slice(4)),s=e.name,a=e.format()}catch(t){}break}}return pb.throwError("call revert exception"+i,yt.errors.CALL_EXCEPTION,{method:t.format(),data:Bt(e),errorArgs:o,errorName:s,errorSignature:a,reason:n})}encodeFunctionResult(t,e){return"string"==typeof t&&(t=this.getFunction(t)),Bt(this._abiCoder.encode(t.outputs,e||[]))}encodeFilterTopics(t,e){"string"==typeof t&&(t=this.getEvent(t)),e.length>t.inputs.length&&pb.throwError("too many arguments for "+t.format(),yt.errors.UNEXPECTED_ARGUMENT,{argument:"values",value:e});let r=[];t.anonymous||r.push(this.getEventTopic(t));const n=(t,e)=>"string"===t.type?Kr(e):"bytes"===t.type?Er(Bt(e)):("bool"===t.type&&"boolean"==typeof e&&(e=e?"0x01":"0x00"),t.type.match(/^u?int/)&&(e=Gt.from(e).toHexString()),"address"===t.type&&this._abiCoder.encode(["address"],[e]),Lt(Bt(e),32));for(e.forEach((e,i)=>{let o=t.inputs[i];o.indexed?null==e?r.push(null):"array"===o.baseType||"tuple"===o.baseType?pb.throwArgumentError("filtering with tuples or arrays not supported","contract."+o.name,e):Array.isArray(e)?r.push(e.map(t=>n(o,t))):r.push(n(o,e)):null!=e&&pb.throwArgumentError("cannot filter non-indexed parameters; must be null","contract."+o.name,e)});r.length&&null===r[r.length-1];)r.pop();return r}encodeEventLog(t,e){"string"==typeof t&&(t=this.getEvent(t));const r=[],n=[],i=[];return t.anonymous||r.push(this.getEventTopic(t)),e.length!==t.inputs.length&&pb.throwArgumentError("event arguments/values mismatch","values",e),t.inputs.forEach((t,o)=>{const s=e[o];if(t.indexed)if("string"===t.type)r.push(Kr(s));else if("bytes"===t.type)r.push(Er(s));else{if("tuple"===t.baseType||"array"===t.baseType)throw new Error("not implemented");r.push(this._abiCoder.encode([t.type],[s]))}else n.push(t),i.push(s)}),{data:this._abiCoder.encode(n,i),topics:r}}decodeEventLog(t,e,r){if("string"==typeof t&&(t=this.getEvent(t)),null!=r&&!t.anonymous){let e=this.getEventTopic(t);Tt(r[0],32)&&r[0].toLowerCase()===e||pb.throwError("fragment/topic mismatch",yt.errors.INVALID_ARGUMENT,{argument:"topics[0]",expected:e,value:r[0]}),r=r.slice(1)}let n=[],i=[],o=[];t.inputs.forEach((t,e)=>{t.indexed?"string"===t.type||"bytes"===t.type||"tuple"===t.baseType||"array"===t.baseType?(n.push(Ry.fromObject({type:"bytes32",name:t.name})),o.push(!0)):(n.push(t),o.push(!1)):(i.push(t),o.push(!1))});let s=null!=r?this._abiCoder.decode(n,St(r)):null,a=this._abiCoder.decode(i,e,!0),u=[],h=0,c=0;t.inputs.forEach((t,e)=>{if(t.indexed)if(null==s)u[e]=new bb({_isIndexed:!0,hash:null});else if(o[e])u[e]=new bb({_isIndexed:!0,hash:s[c++]});else try{u[e]=s[c++]}catch(t){u[e]=t}else try{u[e]=a[h++]}catch(t){u[e]=t}if(t.name&&null==u[t.name]){const r=u[e];r instanceof Error?Object.defineProperty(u,t.name,{enumerable:!0,get:()=>{throw wb(`property ${JSON.stringify(t.name)}`,r)}}):u[t.name]=r}});for(let t=0;t<u.length;t++){const e=u[t];e instanceof Error&&Object.defineProperty(u,t,{enumerable:!0,get:()=>{throw wb(`index ${t}`,e)}})}return Object.freeze(u)}parseTransaction(t){let e=this.getFunction(t.data.substring(0,10).toLowerCase());return e?new gb({args:this._abiCoder.decode(e.inputs,"0x"+t.data.substring(10)),functionFragment:e,name:e.name,signature:e.format(),sighash:this.getSighash(e),value:Gt.from(t.value||"0")}):null}parseLog(t){let e=this.getEvent(t.topics[0]);return!e||e.anonymous?null:new mb({eventFragment:e,name:e.name,signature:e.format(),topic:this.getEventTopic(e),args:this.decodeEventLog(e,t.data,t.topics)})}parseError(t){const e=Bt(t);let r=this.getError(e.substring(0,10).toLowerCase());return r?new yb({args:this._abiCoder.decode(r.inputs,"0x"+e.substring(10)),errorFragment:r,name:r.name,signature:r.format(),sighash:this.getSighash(r)}):null}static isInterface(t){return!(!t||!t._isInterface)}}var Eb=function(t,e,r,n){return new(r||(r=Promise))(function(i,o){function s(t){try{u(n.next(t))}catch(t){o(t)}}function a(t){try{u(n.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r(function(t){t(e)})).then(s,a)}u((n=n.apply(t,e||[])).next())})};const Ab=new yt("contracts/5.8.0"),Mb={chainId:!0,data:!0,from:!0,gasLimit:!0,gasPrice:!0,nonce:!0,to:!0,value:!0,type:!0,accessList:!0,maxFeePerGas:!0,maxPriorityFeePerGas:!0,customData:!0,ccipReadEnabled:!0};function Sb(t,e){return Eb(this,void 0,void 0,function*(){const r=yield e;"string"!=typeof r&&Ab.throwArgumentError("invalid address or ENS name","name",r);try{return In(r)}catch(t){}t||Ab.throwError("a provider or signer is needed to resolve ENS names",yt.errors.UNSUPPORTED_OPERATION,{operation:"resolveName"});const n=yield t.resolveName(r);return null==n&&Ab.throwArgumentError("resolver or addr is not configured for ENS name","name",r),n})}function kb(t,e,r){return Eb(this,void 0,void 0,function*(){return Array.isArray(r)?yield Promise.all(r.map((r,n)=>kb(t,Array.isArray(e)?e[n]:e[r.name],r))):"address"===r.type?yield Sb(t,e):"tuple"===r.type?yield kb(t,e,r.components):"array"===r.baseType?Array.isArray(e)?yield Promise.all(e.map(e=>kb(t,e,r.arrayChildren))):Promise.reject(Ab.makeError("invalid value for array",yt.errors.INVALID_ARGUMENT,{argument:"value",value:e})):e})}function xb(t,e,r){return Eb(this,void 0,void 0,function*(){let n={};r.length===e.inputs.length+1&&"object"==typeof r[r.length-1]&&(n=me(r.pop())),Ab.checkArgumentCount(r.length,e.inputs.length,"passed to contract"),t.signer?n.from?n.from=de({override:Sb(t.signer,n.from),signer:t.signer.getAddress()}).then(t=>Eb(this,void 0,void 0,function*(){return In(t.signer)!==t.override&&Ab.throwError("Contract with a Signer cannot override from",yt.errors.UNSUPPORTED_OPERATION,{operation:"overrides.from"}),t.override})):n.from=t.signer.getAddress():n.from&&(n.from=Sb(t.provider,n.from));const i=yield de({args:kb(t.signer||t.provider,r,e.inputs),address:t.resolvedAddress,overrides:de(n)||{}}),o=t.interface.encodeFunctionData(e,i.args),s={data:o,to:i.address},a=i.overrides;if(null!=a.nonce&&(s.nonce=Gt.from(a.nonce).toNumber()),null!=a.gasLimit&&(s.gasLimit=Gt.from(a.gasLimit)),null!=a.gasPrice&&(s.gasPrice=Gt.from(a.gasPrice)),null!=a.maxFeePerGas&&(s.maxFeePerGas=Gt.from(a.maxFeePerGas)),null!=a.maxPriorityFeePerGas&&(s.maxPriorityFeePerGas=Gt.from(a.maxPriorityFeePerGas)),null!=a.from&&(s.from=a.from),null!=a.type&&(s.type=a.type),null!=a.accessList&&(s.accessList=Sa(a.accessList)),null==s.gasLimit&&null!=e.gas){let t=21e3;const r=Mt(o);for(let e=0;e<r.length;e++)t+=4,r[e]&&(t+=64);s.gasLimit=Gt.from(e.gas).add(t)}if(a.value){const t=Gt.from(a.value);t.isZero()||e.payable||Ab.throwError("non-payable method cannot override value",yt.errors.UNSUPPORTED_OPERATION,{operation:"overrides.value",value:n.value}),s.value=t}a.customData&&(s.customData=me(a.customData)),a.ccipReadEnabled&&(s.ccipReadEnabled=!!a.ccipReadEnabled),delete n.nonce,delete n.gasLimit,delete n.gasPrice,delete n.from,delete n.value,delete n.type,delete n.accessList,delete n.maxFeePerGas,delete n.maxPriorityFeePerGas,delete n.customData,delete n.ccipReadEnabled;const u=Object.keys(n).filter(t=>null!=n[t]);return u.length&&Ab.throwError(`cannot override ${u.map(t=>JSON.stringify(t)).join(",")}`,yt.errors.UNSUPPORTED_OPERATION,{operation:"overrides",overrides:u}),s})}function Tb(t,e){const r=e.wait.bind(e);e.wait=e=>r(e).then(e=>(e.events=e.logs.map(r=>{let n=ve(r),i=null;try{i=t.interface.parseLog(r)}catch(t){}return i&&(n.args=i.args,n.decode=(e,r)=>t.interface.decodeEventLog(i.eventFragment,e,r),n.event=i.name,n.eventSignature=i.signature),n.removeListener=()=>t.provider,n.getBlock=()=>t.provider.getBlock(e.blockHash),n.getTransaction=()=>t.provider.getTransaction(e.transactionHash),n.getTransactionReceipt=()=>Promise.resolve(e),n}),e))}function Rb(t,e,r){const n=t.signer||t.provider;return function(...i){return Eb(this,void 0,void 0,function*(){let o;if(i.length===e.inputs.length+1&&"object"==typeof i[i.length-1]){const t=me(i.pop());null!=t.blockTag&&(o=yield t.blockTag),delete t.blockTag,i.push(t)}null!=t.deployTransaction&&(yield t._deployed(o));const s=yield xb(t,e,i),a=yield n.call(s,o);try{let n=t.interface.decodeFunctionResult(e,a);return r&&1===e.outputs.length&&(n=n[0]),n}catch(e){throw e.code===yt.errors.CALL_EXCEPTION&&(e.address=t.address,e.args=i,e.transaction=s),e}})}}function Bb(t,e,r){return e.constant?Rb(t,e,r):function(t,e){return function(...r){return Eb(this,void 0,void 0,function*(){t.signer||Ab.throwError("sending a transaction requires a signer",yt.errors.UNSUPPORTED_OPERATION,{operation:"sendTransaction"}),null!=t.deployTransaction&&(yield t._deployed());const n=yield xb(t,e,r),i=yield t.signer.sendTransaction(n);return Tb(t,i),i})}}(t,e)}function Nb(t){return!t.address||null!=t.topics&&0!==t.topics.length?(t.address||"*")+"@"+(t.topics?t.topics.map(t=>Array.isArray(t)?t.join("|"):t).join(":"):""):"*"}class Pb{constructor(t,e){fe(this,"tag",t),fe(this,"filter",e),this._listeners=[]}addListener(t,e){this._listeners.push({listener:t,once:e})}removeListener(t){let e=!1;this._listeners=this._listeners.filter(r=>!(!e&&r.listener===t)||(e=!0,!1))}removeAllListeners(){this._listeners=[]}listeners(){return this._listeners.map(t=>t.listener)}listenerCount(){return this._listeners.length}run(t){const e=this.listenerCount();return this._listeners=this._listeners.filter(e=>{const r=t.slice();return setTimeout(()=>{e.listener.apply(this,r)},0),!e.once}),e}prepareEvent(t){}getEmit(t){return[t]}}class Ib extends Pb{constructor(){super("error",null)}}class Ob extends Pb{constructor(t,e,r,n){const i={address:t};let o=e.getEventTopic(r);n?(o!==n[0]&&Ab.throwArgumentError("topic mismatch","topics",n),i.topics=n.slice()):i.topics=[o],super(Nb(i),i),fe(this,"address",t),fe(this,"interface",e),fe(this,"fragment",r)}prepareEvent(t){super.prepareEvent(t),t.event=this.fragment.name,t.eventSignature=this.fragment.format(),t.decode=(t,e)=>this.interface.decodeEventLog(this.fragment,t,e);try{t.args=this.interface.decodeEventLog(this.fragment,t.data,t.topics)}catch(e){t.args=null,t.decodeError=e}}getEmit(t){const e=Gy(t.args);if(e.length)throw e[0].error;const r=(t.args||[]).slice();return r.push(t),r}}class Cb extends Pb{constructor(t,e){super("*",{address:t}),fe(this,"address",t),fe(this,"interface",e)}prepareEvent(t){super.prepareEvent(t);try{const e=this.interface.parseLog(t);t.event=e.name,t.eventSignature=e.signature,t.decode=(t,r)=>this.interface.decodeEventLog(e.eventFragment,t,r),t.args=e.args}catch(t){}}}class Lb{constructor(t,e,r){fe(this,"interface",le(new.target,"getInterface")(e)),null==r?(fe(this,"provider",null),fe(this,"signer",null)):lu.isSigner(r)?(fe(this,"provider",r.provider||null),fe(this,"signer",r)):Me.isProvider(r)?(fe(this,"provider",r),fe(this,"signer",null)):Ab.throwArgumentError("invalid signer or provider","signerOrProvider",r),fe(this,"callStatic",{}),fe(this,"estimateGas",{}),fe(this,"functions",{}),fe(this,"populateTransaction",{}),fe(this,"filters",{});{const t={};Object.keys(this.interface.events).forEach(e=>{const r=this.interface.events[e];fe(this.filters,e,(...t)=>({address:this.address,topics:this.interface.encodeFilterTopics(r,t)})),t[r.name]||(t[r.name]=[]),t[r.name].push(e)}),Object.keys(t).forEach(e=>{const r=t[e];1===r.length?fe(this.filters,e,this.filters[r[0]]):Ab.warn(`Duplicate definition of ${e} (${r.join(", ")})`)})}if(fe(this,"_runningEvents",{}),fe(this,"_wrappedEmits",{}),null==t&&Ab.throwArgumentError("invalid contract address or ENS name","addressOrName",t),fe(this,"address",t),this.provider)fe(this,"resolvedAddress",Sb(this.provider,t));else try{fe(this,"resolvedAddress",Promise.resolve(In(t)))}catch(t){Ab.throwError("provider is required to use ENS name as contract address",yt.errors.UNSUPPORTED_OPERATION,{operation:"new Contract"})}this.resolvedAddress.catch(t=>{});const n={},i={};Object.keys(this.interface.functions).forEach(t=>{const e=this.interface.functions[t];if(i[t])Ab.warn(`Duplicate ABI entry for ${JSON.stringify(t)}`);else{i[t]=!0;{const r=e.name;n[`%${r}`]||(n[`%${r}`]=[]),n[`%${r}`].push(t)}null==this[t]&&fe(this,t,Bb(this,e,!0)),null==this.functions[t]&&fe(this.functions,t,Bb(this,e,!1)),null==this.callStatic[t]&&fe(this.callStatic,t,Rb(this,e,!0)),null==this.populateTransaction[t]&&fe(this.populateTransaction,t,function(t,e){return function(...r){return xb(t,e,r)}}(this,e)),null==this.estimateGas[t]&&fe(this.estimateGas,t,function(t,e){const r=t.signer||t.provider;return function(...n){return Eb(this,void 0,void 0,function*(){r||Ab.throwError("estimate require a provider or signer",yt.errors.UNSUPPORTED_OPERATION,{operation:"estimateGas"});const i=yield xb(t,e,n);return yield r.estimateGas(i)})}}(this,e))}}),Object.keys(n).forEach(t=>{const e=n[t];if(e.length>1)return;t=t.substring(1);const r=e[0];try{null==this[t]&&fe(this,t,this[r])}catch(t){}null==this.functions[t]&&fe(this.functions,t,this.functions[r]),null==this.callStatic[t]&&fe(this.callStatic,t,this.callStatic[r]),null==this.populateTransaction[t]&&fe(this.populateTransaction,t,this.populateTransaction[r]),null==this.estimateGas[t]&&fe(this.estimateGas,t,this.estimateGas[r])})}static getContractAddress(t){return On(t)}static getInterface(t){return _b.isInterface(t)?t:new _b(t)}deployed(){return this._deployed()}_deployed(t){return this._deployedPromise||(this.deployTransaction?this._deployedPromise=this.deployTransaction.wait().then(()=>this):this._deployedPromise=this.provider.getCode(this.address,t).then(t=>("0x"===t&&Ab.throwError("contract not deployed",yt.errors.UNSUPPORTED_OPERATION,{contractAddress:this.address,operation:"getDeployed"}),this))),this._deployedPromise}fallback(t){this.signer||Ab.throwError("sending a transactions require a signer",yt.errors.UNSUPPORTED_OPERATION,{operation:"sendTransaction(fallback)"});const e=me(t||{});return["from","to"].forEach(function(t){null!=e[t]&&Ab.throwError("cannot override "+t,yt.errors.UNSUPPORTED_OPERATION,{operation:t})}),e.to=this.resolvedAddress,this.deployed().then(()=>this.signer.sendTransaction(e))}connect(t){"string"==typeof t&&(t=new du(t,this.provider));const e=new this.constructor(this.address,this.interface,t);return this.deployTransaction&&fe(e,"deployTransaction",this.deployTransaction),e}attach(t){return new this.constructor(t,this.interface,this.signer||this.provider)}static isIndexed(t){return bb.isIndexed(t)}_normalizeRunningEvent(t){return this._runningEvents[t.tag]?this._runningEvents[t.tag]:t}_getRunningEvent(t){if("string"==typeof t){if("error"===t)return this._normalizeRunningEvent(new Ib);if("event"===t)return this._normalizeRunningEvent(new Pb("event",null));if("*"===t)return this._normalizeRunningEvent(new Cb(this.address,this.interface));const e=this.interface.getEvent(t);return this._normalizeRunningEvent(new Ob(this.address,this.interface,e))}if(t.topics&&t.topics.length>0){try{const e=t.topics[0];if("string"!=typeof e)throw new Error("invalid topic");const r=this.interface.getEvent(e);return this._normalizeRunningEvent(new Ob(this.address,this.interface,r,t.topics))}catch(t){}const e={address:this.address,topics:t.topics};return this._normalizeRunningEvent(new Pb(Nb(e),e))}return this._normalizeRunningEvent(new Cb(this.address,this.interface))}_checkRunningEvents(t){if(0===t.listenerCount()){delete this._runningEvents[t.tag];const e=this._wrappedEmits[t.tag];e&&t.filter&&(this.provider.off(t.filter,e),delete this._wrappedEmits[t.tag])}}_wrapEvent(t,e,r){const n=ve(e);return n.removeListener=()=>{r&&(t.removeListener(r),this._checkRunningEvents(t))},n.getBlock=()=>this.provider.getBlock(e.blockHash),n.getTransaction=()=>this.provider.getTransaction(e.transactionHash),n.getTransactionReceipt=()=>this.provider.getTransactionReceipt(e.transactionHash),t.prepareEvent(n),n}_addEventListener(t,e,r){if(this.provider||Ab.throwError("events require a provider or a signer with a provider",yt.errors.UNSUPPORTED_OPERATION,{operation:"once"}),t.addListener(e,r),this._runningEvents[t.tag]=t,!this._wrappedEmits[t.tag]){const r=r=>{let n=this._wrapEvent(t,r,e);if(null==n.decodeError)try{const e=t.getEmit(n);this.emit(t.filter,...e)}catch(t){n.decodeError=t.error}null!=t.filter&&this.emit("event",n),null!=n.decodeError&&this.emit("error",n.decodeError,n)};this._wrappedEmits[t.tag]=r,null!=t.filter&&this.provider.on(t.filter,r)}}queryFilter(t,e,r){const n=this._getRunningEvent(t),i=me(n.filter);return"string"==typeof e&&Tt(e,32)?(null!=r&&Ab.throwArgumentError("cannot specify toBlock with blockhash","toBlock",r),i.blockHash=e):(i.fromBlock=null!=e?e:0,i.toBlock=null!=r?r:"latest"),this.provider.getLogs(i).then(t=>t.map(t=>this._wrapEvent(n,t,null)))}on(t,e){return this._addEventListener(this._getRunningEvent(t),e,!1),this}once(t,e){return this._addEventListener(this._getRunningEvent(t),e,!0),this}emit(t,...e){if(!this.provider)return!1;const r=this._getRunningEvent(t),n=r.run(e)>0;return this._checkRunningEvents(r),n}listenerCount(t){return this.provider?null==t?Object.keys(this._runningEvents).reduce((t,e)=>t+this._runningEvents[e].listenerCount(),0):this._getRunningEvent(t).listenerCount():0}listeners(t){if(!this.provider)return[];if(null==t){const t=[];for(let e in this._runningEvents)this._runningEvents[e].listeners().forEach(e=>{t.push(e)});return t}return this._getRunningEvent(t).listeners()}removeAllListeners(t){if(!this.provider)return this;if(null==t){for(const t in this._runningEvents){const e=this._runningEvents[t];e.removeAllListeners(),this._checkRunningEvents(e)}return this}const e=this._getRunningEvent(t);return e.removeAllListeners(),this._checkRunningEvents(e),this}off(t,e){if(!this.provider)return this;const r=this._getRunningEvent(t);return r.removeListener(e),this._checkRunningEvents(r),this}removeListener(t,e){return this.off(t,e)}}class jb extends Lb{}class Db{constructor(t,e,r){let n=null;n="string"==typeof e?e:At(e)?Bt(e):e&&"string"==typeof e.object?e.object:"!","0x"!==n.substring(0,2)&&(n="0x"+n),(!Tt(n)||n.length%2)&&Ab.throwArgumentError("invalid bytecode","bytecode",e),r&&!lu.isSigner(r)&&Ab.throwArgumentError("invalid signer","signer",r),fe(this,"bytecode",n),fe(this,"interface",le(new.target,"getInterface")(t)),fe(this,"signer",r||null)}getDeployTransaction(...t){let e={};if(t.length===this.interface.deploy.inputs.length+1&&"object"==typeof t[t.length-1]){e=me(t.pop());for(const t in e)if(!Mb[t])throw new Error("unknown transaction override "+t)}if(["data","from","to"].forEach(t=>{null!=e[t]&&Ab.throwError("cannot override "+t,yt.errors.UNSUPPORTED_OPERATION,{operation:t})}),e.value){Gt.from(e.value).isZero()||this.interface.deploy.payable||Ab.throwError("non-payable constructor cannot override value",yt.errors.UNSUPPORTED_OPERATION,{operation:"overrides.value",value:e.value})}return Ab.checkArgumentCount(t.length,this.interface.deploy.inputs.length," in Contract constructor"),e.data=Bt(St([this.bytecode,this.interface.encodeDeploy(t)])),e}deploy(...t){return Eb(this,void 0,void 0,function*(){let e={};t.length===this.interface.deploy.inputs.length+1&&(e=t.pop()),Ab.checkArgumentCount(t.length,this.interface.deploy.inputs.length," in Contract constructor");const r=yield kb(this.signer,t,this.interface.deploy.inputs);r.push(e);const n=this.getDeployTransaction(...r),i=yield this.signer.sendTransaction(n),o=le(this.constructor,"getContractAddress")(i),s=le(this.constructor,"getContract")(o,this.interface,this.signer);return Tb(s,i),fe(s,"deployTransaction",i),s})}attach(t){return this.constructor.getContract(t,this.interface,this.signer)}connect(t){return new this.constructor(this.interface,this.bytecode,t)}static fromSolidity(t,e){null==t&&Ab.throwError("missing compiler output",yt.errors.MISSING_ARGUMENT,{argument:"compilerOutput"}),"string"==typeof t&&(t=JSON.parse(t));const r=t.abi;let n=null;return t.bytecode?n=t.bytecode:t.evm&&t.evm.bytecode&&(n=t.evm.bytecode),new this(r,n,e)}static getInterface(t){return jb.getInterface(t)}static getContractAddress(t){return On(t)}static getContract(t,e,r){return new jb(t,e,r)}}function Ub(t,e,r,n,i){let o;t=Mt(t),e=Mt(e);let s=1;const a=new Uint8Array(n),u=new Uint8Array(e.length+4);let h,c;u.set(e);for(let f=1;f<=s;f++){u[e.length]=f>>24&255,u[e.length+1]=f>>16&255,u[e.length+2]=f>>8&255,u[e.length+3]=255&f;let l=Mt(ns(i,t,u));o||(o=l.length,c=new Uint8Array(o),s=Math.ceil(n/o),h=n-(s-1)*o),c.set(l);for(let e=1;e<r;e++){l=Mt(ns(i,t,l));for(let t=0;t<o;t++)c[t]^=l[t]}const d=(f-1)*o,p=f===s?h:o;a.set(Mt(c).slice(0,p),d)}return Bt(a)}const Fb=new yt("wordlists/5.8.0");class zb{constructor(t){Fb.checkAbstract(new.target,zb),fe(this,"locale",t)}split(t){return t.toLowerCase().split(/ +/g)}join(t){return t.join(" ")}static check(t){const e=[];for(let r=0;r<2048;r++){const n=t.getWord(r);if(r!==t.getWordIndex(n))return"0x";e.push(n)}return Kr(e.join("\n")+"\n")}static register(t,e){e||(e=t.locale)}}let qb=null;function Hb(t){if(null==qb&&(qb="AbandonAbilityAbleAboutAboveAbsentAbsorbAbstractAbsurdAbuseAccessAccidentAccountAccuseAchieveAcidAcousticAcquireAcrossActActionActorActressActualAdaptAddAddictAddressAdjustAdmitAdultAdvanceAdviceAerobicAffairAffordAfraidAgainAgeAgentAgreeAheadAimAirAirportAisleAlarmAlbumAlcoholAlertAlienAllAlleyAllowAlmostAloneAlphaAlreadyAlsoAlterAlwaysAmateurAmazingAmongAmountAmusedAnalystAnchorAncientAngerAngleAngryAnimalAnkleAnnounceAnnualAnotherAnswerAntennaAntiqueAnxietyAnyApartApologyAppearAppleApproveAprilArchArcticAreaArenaArgueArmArmedArmorArmyAroundArrangeArrestArriveArrowArtArtefactArtistArtworkAskAspectAssaultAssetAssistAssumeAsthmaAthleteAtomAttackAttendAttitudeAttractAuctionAuditAugustAuntAuthorAutoAutumnAverageAvocadoAvoidAwakeAwareAwayAwesomeAwfulAwkwardAxisBabyBachelorBaconBadgeBagBalanceBalconyBallBambooBananaBannerBarBarelyBargainBarrelBaseBasicBasketBattleBeachBeanBeautyBecauseBecomeBeefBeforeBeginBehaveBehindBelieveBelowBeltBenchBenefitBestBetrayBetterBetweenBeyondBicycleBidBikeBindBiologyBirdBirthBitterBlackBladeBlameBlanketBlastBleakBlessBlindBloodBlossomBlouseBlueBlurBlushBoardBoatBodyBoilBombBoneBonusBookBoostBorderBoringBorrowBossBottomBounceBoxBoyBracketBrainBrandBrassBraveBreadBreezeBrickBridgeBriefBrightBringBriskBroccoliBrokenBronzeBroomBrotherBrownBrushBubbleBuddyBudgetBuffaloBuildBulbBulkBulletBundleBunkerBurdenBurgerBurstBusBusinessBusyButterBuyerBuzzCabbageCabinCableCactusCageCakeCallCalmCameraCampCanCanalCancelCandyCannonCanoeCanvasCanyonCapableCapitalCaptainCarCarbonCardCargoCarpetCarryCartCaseCashCasinoCastleCasualCatCatalogCatchCategoryCattleCaughtCauseCautionCaveCeilingCeleryCementCensusCenturyCerealCertainChairChalkChampionChangeChaosChapterChargeChaseChatCheapCheckCheeseChefCherryChestChickenChiefChildChimneyChoiceChooseChronicChuckleChunkChurnCigarCinnamonCircleCitizenCityCivilClaimClapClarifyClawClayCleanClerkCleverClickClientCliffClimbClinicClipClockClogCloseClothCloudClownClubClumpClusterClutchCoachCoastCoconutCodeCoffeeCoilCoinCollectColorColumnCombineComeComfortComicCommonCompanyConcertConductConfirmCongressConnectConsiderControlConvinceCookCoolCopperCopyCoralCoreCornCorrectCostCottonCouchCountryCoupleCourseCousinCoverCoyoteCrackCradleCraftCramCraneCrashCraterCrawlCrazyCreamCreditCreekCrewCricketCrimeCrispCriticCropCrossCrouchCrowdCrucialCruelCruiseCrumbleCrunchCrushCryCrystalCubeCultureCupCupboardCuriousCurrentCurtainCurveCushionCustomCuteCycleDadDamageDampDanceDangerDaringDashDaughterDawnDayDealDebateDebrisDecadeDecemberDecideDeclineDecorateDecreaseDeerDefenseDefineDefyDegreeDelayDeliverDemandDemiseDenialDentistDenyDepartDependDepositDepthDeputyDeriveDescribeDesertDesignDeskDespairDestroyDetailDetectDevelopDeviceDevoteDiagramDialDiamondDiaryDiceDieselDietDifferDigitalDignityDilemmaDinnerDinosaurDirectDirtDisagreeDiscoverDiseaseDishDismissDisorderDisplayDistanceDivertDivideDivorceDizzyDoctorDocumentDogDollDolphinDomainDonateDonkeyDonorDoorDoseDoubleDoveDraftDragonDramaDrasticDrawDreamDressDriftDrillDrinkDripDriveDropDrumDryDuckDumbDuneDuringDustDutchDutyDwarfDynamicEagerEagleEarlyEarnEarthEasilyEastEasyEchoEcologyEconomyEdgeEditEducateEffortEggEightEitherElbowElderElectricElegantElementElephantElevatorEliteElseEmbarkEmbodyEmbraceEmergeEmotionEmployEmpowerEmptyEnableEnactEndEndlessEndorseEnemyEnergyEnforceEngageEngineEnhanceEnjoyEnlistEnoughEnrichEnrollEnsureEnterEntireEntryEnvelopeEpisodeEqualEquipEraEraseErodeErosionErrorEruptEscapeEssayEssenceEstateEternalEthicsEvidenceEvilEvokeEvolveExactExampleExcessExchangeExciteExcludeExcuseExecuteExerciseExhaustExhibitExileExistExitExoticExpandExpectExpireExplainExposeExpressExtendExtraEyeEyebrowFabricFaceFacultyFadeFaintFaithFallFalseFameFamilyFamousFanFancyFantasyFarmFashionFatFatalFatherFatigueFaultFavoriteFeatureFebruaryFederalFeeFeedFeelFemaleFenceFestivalFetchFeverFewFiberFictionFieldFigureFileFilmFilterFinalFindFineFingerFinishFireFirmFirstFiscalFishFitFitnessFixFlagFlameFlashFlatFlavorFleeFlightFlipFloatFlockFloorFlowerFluidFlushFlyFoamFocusFogFoilFoldFollowFoodFootForceForestForgetForkFortuneForumForwardFossilFosterFoundFoxFragileFrameFrequentFreshFriendFringeFrogFrontFrostFrownFrozenFruitFuelFunFunnyFurnaceFuryFutureGadgetGainGalaxyGalleryGameGapGarageGarbageGardenGarlicGarmentGasGaspGateGatherGaugeGazeGeneralGeniusGenreGentleGenuineGestureGhostGiantGiftGiggleGingerGiraffeGirlGiveGladGlanceGlareGlassGlideGlimpseGlobeGloomGloryGloveGlowGlueGoatGoddessGoldGoodGooseGorillaGospelGossipGovernGownGrabGraceGrainGrantGrapeGrassGravityGreatGreenGridGriefGritGroceryGroupGrowGruntGuardGuessGuideGuiltGuitarGunGymHabitHairHalfHammerHamsterHandHappyHarborHardHarshHarvestHatHaveHawkHazardHeadHealthHeartHeavyHedgehogHeightHelloHelmetHelpHenHeroHiddenHighHillHintHipHireHistoryHobbyHockeyHoldHoleHolidayHollowHomeHoneyHoodHopeHornHorrorHorseHospitalHostHotelHourHoverHubHugeHumanHumbleHumorHundredHungryHuntHurdleHurryHurtHusbandHybridIceIconIdeaIdentifyIdleIgnoreIllIllegalIllnessImageImitateImmenseImmuneImpactImposeImproveImpulseInchIncludeIncomeIncreaseIndexIndicateIndoorIndustryInfantInflictInformInhaleInheritInitialInjectInjuryInmateInnerInnocentInputInquiryInsaneInsectInsideInspireInstallIntactInterestIntoInvestInviteInvolveIronIslandIsolateIssueItemIvoryJacketJaguarJarJazzJealousJeansJellyJewelJobJoinJokeJourneyJoyJudgeJuiceJumpJungleJuniorJunkJustKangarooKeenKeepKetchupKeyKickKidKidneyKindKingdomKissKitKitchenKiteKittenKiwiKneeKnifeKnockKnowLabLabelLaborLadderLadyLakeLampLanguageLaptopLargeLaterLatinLaughLaundryLavaLawLawnLawsuitLayerLazyLeaderLeafLearnLeaveLectureLeftLegLegalLegendLeisureLemonLendLengthLensLeopardLessonLetterLevelLiarLibertyLibraryLicenseLifeLiftLightLikeLimbLimitLinkLionLiquidListLittleLiveLizardLoadLoanLobsterLocalLockLogicLonelyLongLoopLotteryLoudLoungeLoveLoyalLuckyLuggageLumberLunarLunchLuxuryLyricsMachineMadMagicMagnetMaidMailMainMajorMakeMammalManManageMandateMangoMansionManualMapleMarbleMarchMarginMarineMarketMarriageMaskMassMasterMatchMaterialMathMatrixMatterMaximumMazeMeadowMeanMeasureMeatMechanicMedalMediaMelodyMeltMemberMemoryMentionMenuMercyMergeMeritMerryMeshMessageMetalMethodMiddleMidnightMilkMillionMimicMindMinimumMinorMinuteMiracleMirrorMiseryMissMistakeMixMixedMixtureMobileModelModifyMomMomentMonitorMonkeyMonsterMonthMoonMoralMoreMorningMosquitoMotherMotionMotorMountainMouseMoveMovieMuchMuffinMuleMultiplyMuscleMuseumMushroomMusicMustMutualMyselfMysteryMythNaiveNameNapkinNarrowNastyNationNatureNearNeckNeedNegativeNeglectNeitherNephewNerveNestNetNetworkNeutralNeverNewsNextNiceNightNobleNoiseNomineeNoodleNormalNorthNoseNotableNoteNothingNoticeNovelNowNuclearNumberNurseNutOakObeyObjectObligeObscureObserveObtainObviousOccurOceanOctoberOdorOffOfferOfficeOftenOilOkayOldOliveOlympicOmitOnceOneOnionOnlineOnlyOpenOperaOpinionOpposeOptionOrangeOrbitOrchardOrderOrdinaryOrganOrientOriginalOrphanOstrichOtherOutdoorOuterOutputOutsideOvalOvenOverOwnOwnerOxygenOysterOzonePactPaddlePagePairPalacePalmPandaPanelPanicPantherPaperParadeParentParkParrotPartyPassPatchPathPatientPatrolPatternPausePavePaymentPeacePeanutPearPeasantPelicanPenPenaltyPencilPeoplePepperPerfectPermitPersonPetPhonePhotoPhrasePhysicalPianoPicnicPicturePiecePigPigeonPillPilotPinkPioneerPipePistolPitchPizzaPlacePlanetPlasticPlatePlayPleasePledgePluckPlugPlungePoemPoetPointPolarPolePolicePondPonyPoolPopularPortionPositionPossiblePostPotatoPotteryPovertyPowderPowerPracticePraisePredictPreferPreparePresentPrettyPreventPricePridePrimaryPrintPriorityPrisonPrivatePrizeProblemProcessProduceProfitProgramProjectPromoteProofPropertyProsperProtectProudProvidePublicPuddingPullPulpPulsePumpkinPunchPupilPuppyPurchasePurityPurposePursePushPutPuzzlePyramidQualityQuantumQuarterQuestionQuickQuitQuizQuoteRabbitRaccoonRaceRackRadarRadioRailRainRaiseRallyRampRanchRandomRangeRapidRareRateRatherRavenRawRazorReadyRealReasonRebelRebuildRecallReceiveRecipeRecordRecycleReduceReflectReformRefuseRegionRegretRegularRejectRelaxReleaseReliefRelyRemainRememberRemindRemoveRenderRenewRentReopenRepairRepeatReplaceReportRequireRescueResembleResistResourceResponseResultRetireRetreatReturnReunionRevealReviewRewardRhythmRibRibbonRiceRichRideRidgeRifleRightRigidRingRiotRippleRiskRitualRivalRiverRoadRoastRobotRobustRocketRomanceRoofRookieRoomRoseRotateRoughRoundRouteRoyalRubberRudeRugRuleRunRunwayRuralSadSaddleSadnessSafeSailSaladSalmonSalonSaltSaluteSameSampleSandSatisfySatoshiSauceSausageSaveSayScaleScanScareScatterSceneSchemeSchoolScienceScissorsScorpionScoutScrapScreenScriptScrubSeaSearchSeasonSeatSecondSecretSectionSecuritySeedSeekSegmentSelectSellSeminarSeniorSenseSentenceSeriesServiceSessionSettleSetupSevenShadowShaftShallowShareShedShellSheriffShieldShiftShineShipShiverShockShoeShootShopShortShoulderShoveShrimpShrugShuffleShySiblingSickSideSiegeSightSignSilentSilkSillySilverSimilarSimpleSinceSingSirenSisterSituateSixSizeSkateSketchSkiSkillSkinSkirtSkullSlabSlamSleepSlenderSliceSlideSlightSlimSloganSlotSlowSlushSmallSmartSmileSmokeSmoothSnackSnakeSnapSniffSnowSoapSoccerSocialSockSodaSoftSolarSoldierSolidSolutionSolveSomeoneSongSoonSorrySortSoulSoundSoupSourceSouthSpaceSpareSpatialSpawnSpeakSpecialSpeedSpellSpendSphereSpiceSpiderSpikeSpinSpiritSplitSpoilSponsorSpoonSportSpotSpraySpreadSpringSpySquareSqueezeSquirrelStableStadiumStaffStageStairsStampStandStartStateStaySteakSteelStemStepStereoStickStillStingStockStomachStoneStoolStoryStoveStrategyStreetStrikeStrongStruggleStudentStuffStumbleStyleSubjectSubmitSubwaySuccessSuchSuddenSufferSugarSuggestSuitSummerSunSunnySunsetSuperSupplySupremeSureSurfaceSurgeSurpriseSurroundSurveySuspectSustainSwallowSwampSwapSwarmSwearSweetSwiftSwimSwingSwitchSwordSymbolSymptomSyrupSystemTableTackleTagTailTalentTalkTankTapeTargetTaskTasteTattooTaxiTeachTeamTellTenTenantTennisTentTermTestTextThankThatThemeThenTheoryThereTheyThingThisThoughtThreeThriveThrowThumbThunderTicketTideTigerTiltTimberTimeTinyTipTiredTissueTitleToastTobaccoTodayToddlerToeTogetherToiletTokenTomatoTomorrowToneTongueTonightToolToothTopTopicToppleTorchTornadoTortoiseTossTotalTouristTowardTowerTownToyTrackTradeTrafficTragicTrainTransferTrapTrashTravelTrayTreatTreeTrendTrialTribeTrickTriggerTrimTripTrophyTroubleTruckTrueTrulyTrumpetTrustTruthTryTubeTuitionTumbleTunaTunnelTurkeyTurnTurtleTwelveTwentyTwiceTwinTwistTwoTypeTypicalUglyUmbrellaUnableUnawareUncleUncoverUnderUndoUnfairUnfoldUnhappyUniformUniqueUnitUniverseUnknownUnlockUntilUnusualUnveilUpdateUpgradeUpholdUponUpperUpsetUrbanUrgeUsageUseUsedUsefulUselessUsualUtilityVacantVacuumVagueValidValleyValveVanVanishVaporVariousVastVaultVehicleVelvetVendorVentureVenueVerbVerifyVersionVeryVesselVeteranViableVibrantViciousVictoryVideoViewVillageVintageViolinVirtualVirusVisaVisitVisualVitalVividVocalVoiceVoidVolcanoVolumeVoteVoyageWageWagonWaitWalkWallWalnutWantWarfareWarmWarriorWashWaspWasteWaterWaveWayWealthWeaponWearWeaselWeatherWebWeddingWeekendWeirdWelcomeWestWetWhaleWhatWheatWheelWhenWhereWhipWhisperWideWidthWifeWildWillWinWindowWineWingWinkWinnerWinterWireWisdomWiseWishWitnessWolfWomanWonderWoodWoolWordWorkWorldWorryWorthWrapWreckWrestleWristWriteWrongYardYearYellowYouYoungYouthZebraZeroZoneZoo".replace(/([A-Z])/g," $1").toLowerCase().substring(1).split(" "),"0x3c8acc1e7b08d8e76f9fda015ef48dc8c710a73cb7e0f77b2c18a9b5a7adde60"!==zb.check(t)))throw qb=null,new Error("BIP39 Wordlist for en (English) FAILED")}const Kb=new class extends zb{constructor(){super("en")}getWord(t){return Hb(this),qb[t]}getWordIndex(t){return Hb(this),qb.indexOf(t)}};zb.register(Kb);const Gb={en:Kb},Vb=new yt("hdnode/5.8.0"),Wb=Gt.from("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),Jb=Rr("Bitcoin seed"),Zb=2147483648;function Yb(t){return(1<<t)-1<<8-t}function Xb(t){return(1<<t)-1}function $b(t){return Lt(Bt(t),32)}function Qb(t){return je.encode(St([t,Pt(rs(rs(t)),0,4)]))}function tv(t){if(null==t)return Gb.en;if("string"==typeof t){const e=Gb[t];return null==e&&Vb.throwArgumentError("unknown locale","wordlist",t),e}return t}const ev={},rv="m/44'/60'/0'/0/0";class nv{constructor(t,e,r,n,i,o,s,a){if(t!==ev)throw new Error("HDNode constructor cannot be called directly");if(e){const t=new la(e);fe(this,"privateKey",t.privateKey),fe(this,"publicKey",t.compressedPublicKey)}else fe(this,"privateKey",null),fe(this,"publicKey",Bt(r));fe(this,"parentFingerprint",n),fe(this,"fingerprint",Pt(es(rs(this.publicKey)),0,4)),fe(this,"address",_a(this.publicKey)),fe(this,"chainCode",i),fe(this,"index",o),fe(this,"depth",s),null==a?(fe(this,"mnemonic",null),fe(this,"path",null)):"string"==typeof a?(fe(this,"mnemonic",null),fe(this,"path",a)):(fe(this,"mnemonic",a),fe(this,"path",a.path))}get extendedKey(){if(this.depth>=256)throw new Error("Depth too large!");return Qb(St([null!=this.privateKey?"0x0488ADE4":"0x0488B21E",Bt(this.depth),this.parentFingerprint,Lt(Bt(this.index),4),this.chainCode,null!=this.privateKey?St(["0x00",this.privateKey]):this.publicKey]))}neuter(){return new nv(ev,null,this.publicKey,this.parentFingerprint,this.chainCode,this.index,this.depth,this.path)}_derive(t){if(t>4294967295)throw new Error("invalid index - "+String(t));let e=this.path;e&&(e+="/"+(2147483647&t));const r=new Uint8Array(37);if(t&Zb){if(!this.privateKey)throw new Error("cannot derive child of neutered node");r.set(Mt(this.privateKey),1),e&&(e+="'")}else r.set(Mt(this.publicKey));for(let e=24;e>=0;e-=8)r[33+(e>>3)]=t>>24-e&255;const n=Mt(ns($o.sha512,this.chainCode,r)),i=n.slice(0,32),o=n.slice(32);let s=null,a=null;if(this.privateKey)s=$b(Gt.from(i).add(this.privateKey).mod(Wb));else{a=new la(Bt(i))._addPoint(this.publicKey)}let u=e;const h=this.mnemonic;return h&&(u=Object.freeze({phrase:h.phrase,path:e,locale:h.locale||"en"})),new nv(ev,s,a,this.fingerprint,$b(o),t,this.depth+1,u)}derivePath(t){const e=t.split("/");if(0===e.length||"m"===e[0]&&0!==this.depth)throw new Error("invalid path - "+t);"m"===e[0]&&e.shift();let r=this;for(let t=0;t<e.length;t++){const n=e[t];if(n.match(/^[0-9]+'$/)){const t=parseInt(n.substring(0,n.length-1));if(t>=Zb)throw new Error("invalid path index - "+n);r=r._derive(Zb+t)}else{if(!n.match(/^[0-9]+$/))throw new Error("invalid path component - "+n);{const t=parseInt(n);if(t>=Zb)throw new Error("invalid path index - "+n);r=r._derive(t)}}}return r}static _fromSeed(t,e){const r=Mt(t);if(r.length<16||r.length>64)throw new Error("invalid seed");const n=Mt(ns($o.sha512,Jb,r));return new nv(ev,$b(n.slice(0,32)),null,"0x00000000",$b(n.slice(32)),0,0,e)}static fromMnemonic(t,e,r){return t=sv(ov(t,r=tv(r)),r),nv._fromSeed(iv(t,e),{phrase:t,path:"m",locale:r.locale})}static fromSeed(t){return nv._fromSeed(t,null)}static fromExtendedKey(t){const e=je.decode(t);82===e.length&&Qb(e.slice(0,78))===t||Vb.throwArgumentError("invalid extended key","extendedKey","[REDACTED]");const r=e[4],n=Bt(e.slice(5,9)),i=parseInt(Bt(e.slice(9,13)).substring(2),16),o=Bt(e.slice(13,45)),s=e.slice(45,78);switch(Bt(e.slice(0,4))){case"0x0488b21e":case"0x043587cf":return new nv(ev,null,Bt(s),n,o,i,r,null);case"0x0488ade4":case"0x04358394 ":if(0!==s[0])break;return new nv(ev,Bt(s.slice(1)),null,n,o,i,r,null)}return Vb.throwArgumentError("invalid extended key","extendedKey","[REDACTED]")}}function iv(t,e){e||(e="");const r=Rr("mnemonic"+e,Mr.NFKD);return Ub(Rr(t,Mr.NFKD),r,2048,64,"sha512")}function ov(t,e){e=tv(e),Vb.checkNormalize();const r=e.split(t);if(r.length%3!=0)throw new Error("invalid mnemonic");const n=Mt(new Uint8Array(Math.ceil(11*r.length/8)));let i=0;for(let t=0;t<r.length;t++){let o=e.getWordIndex(r[t].normalize("NFKD"));if(-1===o)throw new Error("invalid mnemonic");for(let t=0;t<11;t++)o&1<<10-t&&(n[i>>3]|=1<<7-i%8),i++}const o=32*r.length/3,s=Yb(r.length/3);if((Mt(rs(n.slice(0,o/8)))[0]&s)!==(n[n.length-1]&s))throw new Error("invalid checksum");return Bt(n.slice(0,o/8))}function sv(t,e){if(e=tv(e),(t=Mt(t)).length%4!=0||t.length<16||t.length>32)throw new Error("invalid entropy");const r=[0];let n=11;for(let e=0;e<t.length;e++)n>8?(r[r.length-1]<<=8,r[r.length-1]|=t[e],n-=8):(r[r.length-1]<<=n,r[r.length-1]|=t[e]>>8-n,r.push(t[e]&Xb(8-n)),n+=3);const i=t.length/4,o=Mt(rs(t))[0]&Yb(i);return r[r.length-1]<<=i,r[r.length-1]|=o>>8-i,e.join(r.map(t=>e.getWord(t)))}var av={exports:{}};!function(t){!function(){function e(t){return parseInt(t)===t}function r(t){if(!e(t.length))return!1;for(var r=0;r<t.length;r++)if(!e(t[r])||t[r]<0||t[r]>255)return!1;return!0}function n(t,n){if(t.buffer&&ArrayBuffer.isView(t)&&"Uint8Array"===t.name)return n&&(t=t.slice?t.slice():Array.prototype.slice.call(t)),t;if(Array.isArray(t)){if(!r(t))throw new Error("Array contains invalid value: "+t);return new Uint8Array(t)}if(e(t.length)&&r(t))return new Uint8Array(t);throw new Error("unsupported array-like object")}function i(t){return new Uint8Array(t)}function o(t,e,r,n,i){null==n&&null==i||(t=t.slice?t.slice(n,i):Array.prototype.slice.call(t,n,i)),e.set(t,r)}var s,a={toBytes:function(t){var e=[],r=0;for(t=encodeURI(t);r<t.length;){var i=t.charCodeAt(r++);37===i?(e.push(parseInt(t.substr(r,2),16)),r+=2):e.push(i)}return n(e)},fromBytes:function(t){for(var e=[],r=0;r<t.length;){var n=t[r];n<128?(e.push(String.fromCharCode(n)),r++):n>191&&n<224?(e.push(String.fromCharCode((31&n)<<6|63&t[r+1])),r+=2):(e.push(String.fromCharCode((15&n)<<12|(63&t[r+1])<<6|63&t[r+2])),r+=3)}return e.join("")}},u=(s="0123456789abcdef",{toBytes:function(t){for(var e=[],r=0;r<t.length;r+=2)e.push(parseInt(t.substr(r,2),16));return e},fromBytes:function(t){for(var e=[],r=0;r<t.length;r++){var n=t[r];e.push(s[(240&n)>>4]+s[15&n])}return e.join("")}}),h={16:10,24:12,32:14},c=[1,2,4,8,16,32,64,128,27,54,108,216,171,77,154,47,94,188,99,198,151,53,106,212,179,125,250,239,197,145],f=[99,124,119,123,242,107,111,197,48,1,103,43,254,215,171,118,202,130,201,125,250,89,71,240,173,212,162,175,156,164,114,192,183,253,147,38,54,63,247,204,52,165,229,241,113,216,49,21,4,199,35,195,24,150,5,154,7,18,128,226,235,39,178,117,9,131,44,26,27,110,90,160,82,59,214,179,41,227,47,132,83,209,0,237,32,252,177,91,106,203,190,57,74,76,88,207,208,239,170,251,67,77,51,133,69,249,2,127,80,60,159,168,81,163,64,143,146,157,56,245,188,182,218,33,16,255,243,210,205,12,19,236,95,151,68,23,196,167,126,61,100,93,25,115,96,129,79,220,34,42,144,136,70,238,184,20,222,94,11,219,224,50,58,10,73,6,36,92,194,211,172,98,145,149,228,121,231,200,55,109,141,213,78,169,108,86,244,234,101,122,174,8,186,120,37,46,28,166,180,198,232,221,116,31,75,189,139,138,112,62,181,102,72,3,246,14,97,53,87,185,134,193,29,158,225,248,152,17,105,217,142,148,155,30,135,233,206,85,40,223,140,161,137,13,191,230,66,104,65,153,45,15,176,84,187,22],l=[82,9,106,213,48,54,165,56,191,64,163,158,129,243,215,251,124,227,57,130,155,47,255,135,52,142,67,68,196,222,233,203,84,123,148,50,166,194,35,61,238,76,149,11,66,250,195,78,8,46,161,102,40,217,36,178,118,91,162,73,109,139,209,37,114,248,246,100,134,104,152,22,212,164,92,204,93,101,182,146,108,112,72,80,253,237,185,218,94,21,70,87,167,141,157,132,144,216,171,0,140,188,211,10,247,228,88,5,184,179,69,6,208,44,30,143,202,63,15,2,193,175,189,3,1,19,138,107,58,145,17,65,79,103,220,234,151,242,207,206,240,180,230,115,150,172,116,34,231,173,53,133,226,249,55,232,28,117,223,110,71,241,26,113,29,41,197,137,111,183,98,14,170,24,190,27,252,86,62,75,198,210,121,32,154,219,192,254,120,205,90,244,31,221,168,51,136,7,199,49,177,18,16,89,39,128,236,95,96,81,127,169,25,181,74,13,45,229,122,159,147,201,156,239,160,224,59,77,174,42,245,176,200,235,187,60,131,83,153,97,23,43,4,126,186,119,214,38,225,105,20,99,85,33,12,125],d=[3328402341,4168907908,4000806809,4135287693,4294111757,3597364157,3731845041,2445657428,1613770832,33620227,3462883241,1445669757,3892248089,3050821474,1303096294,3967186586,2412431941,528646813,2311702848,4202528135,4026202645,2992200171,2387036105,4226871307,1101901292,3017069671,1604494077,1169141738,597466303,1403299063,3832705686,2613100635,1974974402,3791519004,1033081774,1277568618,1815492186,2118074177,4126668546,2211236943,1748251740,1369810420,3521504564,4193382664,3799085459,2883115123,1647391059,706024767,134480908,2512897874,1176707941,2646852446,806885416,932615841,168101135,798661301,235341577,605164086,461406363,3756188221,3454790438,1311188841,2142417613,3933566367,302582043,495158174,1479289972,874125870,907746093,3698224818,3025820398,1537253627,2756858614,1983593293,3084310113,2108928974,1378429307,3722699582,1580150641,327451799,2790478837,3117535592,0,3253595436,1075847264,3825007647,2041688520,3059440621,3563743934,2378943302,1740553945,1916352843,2487896798,2555137236,2958579944,2244988746,3151024235,3320835882,1336584933,3992714006,2252555205,2588757463,1714631509,293963156,2319795663,3925473552,67240454,4269768577,2689618160,2017213508,631218106,1269344483,2723238387,1571005438,2151694528,93294474,1066570413,563977660,1882732616,4059428100,1673313503,2008463041,2950355573,1109467491,537923632,3858759450,4260623118,3218264685,2177748300,403442708,638784309,3287084079,3193921505,899127202,2286175436,773265209,2479146071,1437050866,4236148354,2050833735,3362022572,3126681063,840505643,3866325909,3227541664,427917720,2655997905,2749160575,1143087718,1412049534,999329963,193497219,2353415882,3354324521,1807268051,672404540,2816401017,3160301282,369822493,2916866934,3688947771,1681011286,1949973070,336202270,2454276571,201721354,1210328172,3093060836,2680341085,3184776046,1135389935,3294782118,965841320,831886756,3554993207,4068047243,3588745010,2345191491,1849112409,3664604599,26054028,2983581028,2622377682,1235855840,3630984372,2891339514,4092916743,3488279077,3395642799,4101667470,1202630377,268961816,1874508501,4034427016,1243948399,1546530418,941366308,1470539505,1941222599,2546386513,3421038627,2715671932,3899946140,1042226977,2521517021,1639824860,227249030,260737669,3765465232,2084453954,1907733956,3429263018,2420656344,100860677,4160157185,470683154,3261161891,1781871967,2924959737,1773779408,394692241,2579611992,974986535,664706745,3655459128,3958962195,731420851,571543859,3530123707,2849626480,126783113,865375399,765172662,1008606754,361203602,3387549984,2278477385,2857719295,1344809080,2782912378,59542671,1503764984,160008576,437062935,1707065306,3622233649,2218934982,3496503480,2185314755,697932208,1512910199,504303377,2075177163,2824099068,1841019862,739644986],p=[2781242211,2230877308,2582542199,2381740923,234877682,3184946027,2984144751,1418839493,1348481072,50462977,2848876391,2102799147,434634494,1656084439,3863849899,2599188086,1167051466,2636087938,1082771913,2281340285,368048890,3954334041,3381544775,201060592,3963727277,1739838676,4250903202,3930435503,3206782108,4149453988,2531553906,1536934080,3262494647,484572669,2923271059,1783375398,1517041206,1098792767,49674231,1334037708,1550332980,4098991525,886171109,150598129,2481090929,1940642008,1398944049,1059722517,201851908,1385547719,1699095331,1587397571,674240536,2704774806,252314885,3039795866,151914247,908333586,2602270848,1038082786,651029483,1766729511,3447698098,2682942837,454166793,2652734339,1951935532,775166490,758520603,3000790638,4004797018,4217086112,4137964114,1299594043,1639438038,3464344499,2068982057,1054729187,1901997871,2534638724,4121318227,1757008337,0,750906861,1614815264,535035132,3363418545,3988151131,3201591914,1183697867,3647454910,1265776953,3734260298,3566750796,3903871064,1250283471,1807470800,717615087,3847203498,384695291,3313910595,3617213773,1432761139,2484176261,3481945413,283769337,100925954,2180939647,4037038160,1148730428,3123027871,3813386408,4087501137,4267549603,3229630528,2315620239,2906624658,3156319645,1215313976,82966005,3747855548,3245848246,1974459098,1665278241,807407632,451280895,251524083,1841287890,1283575245,337120268,891687699,801369324,3787349855,2721421207,3431482436,959321879,1469301956,4065699751,2197585534,1199193405,2898814052,3887750493,724703513,2514908019,2696962144,2551808385,3516813135,2141445340,1715741218,2119445034,2872807568,2198571144,3398190662,700968686,3547052216,1009259540,2041044702,3803995742,487983883,1991105499,1004265696,1449407026,1316239930,504629770,3683797321,168560134,1816667172,3837287516,1570751170,1857934291,4014189740,2797888098,2822345105,2754712981,936633572,2347923833,852879335,1133234376,1500395319,3084545389,2348912013,1689376213,3533459022,3762923945,3034082412,4205598294,133428468,634383082,2949277029,2398386810,3913789102,403703816,3580869306,2297460856,1867130149,1918643758,607656988,4049053350,3346248884,1368901318,600565992,2090982877,2632479860,557719327,3717614411,3697393085,2249034635,2232388234,2430627952,1115438654,3295786421,2865522278,3633334344,84280067,33027830,303828494,2747425121,1600795957,4188952407,3496589753,2434238086,1486471617,658119965,3106381470,953803233,334231800,3005978776,857870609,3151128937,1890179545,2298973838,2805175444,3056442267,574365214,2450884487,550103529,1233637070,4289353045,2018519080,2057691103,2399374476,4166623649,2148108681,387583245,3664101311,836232934,3330556482,3100665960,3280093505,2955516313,2002398509,287182607,3413881008,4238890068,3597515707,975967766],m=[1671808611,2089089148,2006576759,2072901243,4061003762,1807603307,1873927791,3310653893,810573872,16974337,1739181671,729634347,4263110654,3613570519,2883997099,1989864566,3393556426,2191335298,3376449993,2106063485,4195741690,1508618841,1204391495,4027317232,2917941677,3563566036,2734514082,2951366063,2629772188,2767672228,1922491506,3227229120,3082974647,4246528509,2477669779,644500518,911895606,1061256767,4144166391,3427763148,878471220,2784252325,3845444069,4043897329,1905517169,3631459288,827548209,356461077,67897348,3344078279,593839651,3277757891,405286936,2527147926,84871685,2595565466,118033927,305538066,2157648768,3795705826,3945188843,661212711,2999812018,1973414517,152769033,2208177539,745822252,439235610,455947803,1857215598,1525593178,2700827552,1391895634,994932283,3596728278,3016654259,695947817,3812548067,795958831,2224493444,1408607827,3513301457,0,3979133421,543178784,4229948412,2982705585,1542305371,1790891114,3410398667,3201918910,961245753,1256100938,1289001036,1491644504,3477767631,3496721360,4012557807,2867154858,4212583931,1137018435,1305975373,861234739,2241073541,1171229253,4178635257,33948674,2139225727,1357946960,1011120188,2679776671,2833468328,1374921297,2751356323,1086357568,2408187279,2460827538,2646352285,944271416,4110742005,3168756668,3066132406,3665145818,560153121,271589392,4279952895,4077846003,3530407890,3444343245,202643468,322250259,3962553324,1608629855,2543990167,1154254916,389623319,3294073796,2817676711,2122513534,1028094525,1689045092,1575467613,422261273,1939203699,1621147744,2174228865,1339137615,3699352540,577127458,712922154,2427141008,2290289544,1187679302,3995715566,3100863416,339486740,3732514782,1591917662,186455563,3681988059,3762019296,844522546,978220090,169743370,1239126601,101321734,611076132,1558493276,3260915650,3547250131,2901361580,1655096418,2443721105,2510565781,3828863972,2039214713,3878868455,3359869896,928607799,1840765549,2374762893,3580146133,1322425422,2850048425,1823791212,1459268694,4094161908,3928346602,1706019429,2056189050,2934523822,135794696,3134549946,2022240376,628050469,779246638,472135708,2800834470,3032970164,3327236038,3894660072,3715932637,1956440180,522272287,1272813131,3185336765,2340818315,2323976074,1888542832,1044544574,3049550261,1722469478,1222152264,50660867,4127324150,236067854,1638122081,895445557,1475980887,3117443513,2257655686,3243809217,489110045,2662934430,3778599393,4162055160,2561878936,288563729,1773916777,3648039385,2391345038,2493985684,2612407707,505560094,2274497927,3911240169,3460925390,1442818645,678973480,3749357023,2358182796,2717407649,2306869641,219617805,3218761151,3862026214,1120306242,1756942440,1103331905,2578459033,762796589,252780047,2966125488,1425844308,3151392187,372911126],g=[1667474886,2088535288,2004326894,2071694838,4075949567,1802223062,1869591006,3318043793,808472672,16843522,1734846926,724270422,4278065639,3621216949,2880169549,1987484396,3402253711,2189597983,3385409673,2105378810,4210693615,1499065266,1195886990,4042263547,2913856577,3570689971,2728590687,2947541573,2627518243,2762274643,1920112356,3233831835,3082273397,4261223649,2475929149,640051788,909531756,1061110142,4160160501,3435941763,875846760,2779116625,3857003729,4059105529,1903268834,3638064043,825316194,353713962,67374088,3351728789,589522246,3284360861,404236336,2526454071,84217610,2593830191,117901582,303183396,2155911963,3806477791,3958056653,656894286,2998062463,1970642922,151591698,2206440989,741110872,437923380,454765878,1852748508,1515908788,2694904667,1381168804,993742198,3604373943,3014905469,690584402,3823320797,791638366,2223281939,1398011302,3520161977,0,3991743681,538992704,4244381667,2981218425,1532751286,1785380564,3419096717,3200178535,960056178,1246420628,1280103576,1482221744,3486468741,3503319995,4025428677,2863326543,4227536621,1128514950,1296947098,859002214,2240123921,1162203018,4193849577,33687044,2139062782,1347481760,1010582648,2678045221,2829640523,1364325282,2745433693,1077985408,2408548869,2459086143,2644360225,943212656,4126475505,3166494563,3065430391,3671750063,555836226,269496352,4294908645,4092792573,3537006015,3452783745,202118168,320025894,3974901699,1600119230,2543297077,1145359496,387397934,3301201811,2812801621,2122220284,1027426170,1684319432,1566435258,421079858,1936954854,1616945344,2172753945,1330631070,3705438115,572679748,707427924,2425400123,2290647819,1179044492,4008585671,3099120491,336870440,3739122087,1583276732,185277718,3688593069,3772791771,842159716,976899700,168435220,1229577106,101059084,606366792,1549591736,3267517855,3553849021,2897014595,1650632388,2442242105,2509612081,3840161747,2038008818,3890688725,3368567691,926374254,1835907034,2374863873,3587531953,1313788572,2846482505,1819063512,1448540844,4109633523,3941213647,1701162954,2054852340,2930698567,134748176,3132806511,2021165296,623210314,774795868,471606328,2795958615,3031746419,3334885783,3907527627,3722280097,1953799400,522133822,1263263126,3183336545,2341176845,2324333839,1886425312,1044267644,3048588401,1718004428,1212733584,50529542,4143317495,235803164,1633788866,892690282,1465383342,3115962473,2256965911,3250673817,488449850,2661202215,3789633753,4177007595,2560144171,286339874,1768537042,3654906025,2391705863,2492770099,2610673197,505291324,2273808917,3924369609,3469625735,1431699370,673740880,3755965093,2358021891,2711746649,2307489801,218961690,3217021541,3873845719,1111672452,1751693520,1094828930,2576986153,757954394,252645662,2964376443,1414855848,3149649517,370555436],y=[1374988112,2118214995,437757123,975658646,1001089995,530400753,2902087851,1273168787,540080725,2910219766,2295101073,4110568485,1340463100,3307916247,641025152,3043140495,3736164937,632953703,1172967064,1576976609,3274667266,2169303058,2370213795,1809054150,59727847,361929877,3211623147,2505202138,3569255213,1484005843,1239443753,2395588676,1975683434,4102977912,2572697195,666464733,3202437046,4035489047,3374361702,2110667444,1675577880,3843699074,2538681184,1649639237,2976151520,3144396420,4269907996,4178062228,1883793496,2403728665,2497604743,1383856311,2876494627,1917518562,3810496343,1716890410,3001755655,800440835,2261089178,3543599269,807962610,599762354,33778362,3977675356,2328828971,2809771154,4077384432,1315562145,1708848333,101039829,3509871135,3299278474,875451293,2733856160,92987698,2767645557,193195065,1080094634,1584504582,3178106961,1042385657,2531067453,3711829422,1306967366,2438237621,1908694277,67556463,1615861247,429456164,3602770327,2302690252,1742315127,2968011453,126454664,3877198648,2043211483,2709260871,2084704233,4169408201,0,159417987,841739592,504459436,1817866830,4245618683,260388950,1034867998,908933415,168810852,1750902305,2606453969,607530554,202008497,2472011535,3035535058,463180190,2160117071,1641816226,1517767529,470948374,3801332234,3231722213,1008918595,303765277,235474187,4069246893,766945465,337553864,1475418501,2943682380,4003061179,2743034109,4144047775,1551037884,1147550661,1543208500,2336434550,3408119516,3069049960,3102011747,3610369226,1113818384,328671808,2227573024,2236228733,3535486456,2935566865,3341394285,496906059,3702665459,226906860,2009195472,733156972,2842737049,294930682,1206477858,2835123396,2700099354,1451044056,573804783,2269728455,3644379585,2362090238,2564033334,2801107407,2776292904,3669462566,1068351396,742039012,1350078989,1784663195,1417561698,4136440770,2430122216,775550814,2193862645,2673705150,1775276924,1876241833,3475313331,3366754619,270040487,3902563182,3678124923,3441850377,1851332852,3969562369,2203032232,3868552805,2868897406,566021896,4011190502,3135740889,1248802510,3936291284,699432150,832877231,708780849,3332740144,899835584,1951317047,4236429990,3767586992,866637845,4043610186,1106041591,2144161806,395441711,1984812685,1139781709,3433712980,3835036895,2664543715,1282050075,3240894392,1181045119,2640243204,25965917,4203181171,4211818798,3009879386,2463879762,3910161971,1842759443,2597806476,933301370,1509430414,3943906441,3467192302,3076639029,3776767469,2051518780,2631065433,1441952575,404016761,1942435775,1408749034,1610459739,3745345300,2017778566,3400528769,3110650942,941896748,3265478751,371049330,3168937228,675039627,4279080257,967311729,135050206,3635733660,1683407248,2076935265,3576870512,1215061108,3501741890],b=[1347548327,1400783205,3273267108,2520393566,3409685355,4045380933,2880240216,2471224067,1428173050,4138563181,2441661558,636813900,4233094615,3620022987,2149987652,2411029155,1239331162,1730525723,2554718734,3781033664,46346101,310463728,2743944855,3328955385,3875770207,2501218972,3955191162,3667219033,768917123,3545789473,692707433,1150208456,1786102409,2029293177,1805211710,3710368113,3065962831,401639597,1724457132,3028143674,409198410,2196052529,1620529459,1164071807,3769721975,2226875310,486441376,2499348523,1483753576,428819965,2274680428,3075636216,598438867,3799141122,1474502543,711349675,129166120,53458370,2592523643,2782082824,4063242375,2988687269,3120694122,1559041666,730517276,2460449204,4042459122,2706270690,3446004468,3573941694,533804130,2328143614,2637442643,2695033685,839224033,1973745387,957055980,2856345839,106852767,1371368976,4181598602,1033297158,2933734917,1179510461,3046200461,91341917,1862534868,4284502037,605657339,2547432937,3431546947,2003294622,3182487618,2282195339,954669403,3682191598,1201765386,3917234703,3388507166,0,2198438022,1211247597,2887651696,1315723890,4227665663,1443857720,507358933,657861945,1678381017,560487590,3516619604,975451694,2970356327,261314535,3535072918,2652609425,1333838021,2724322336,1767536459,370938394,182621114,3854606378,1128014560,487725847,185469197,2918353863,3106780840,3356761769,2237133081,1286567175,3152976349,4255350624,2683765030,3160175349,3309594171,878443390,1988838185,3704300486,1756818940,1673061617,3403100636,272786309,1075025698,545572369,2105887268,4174560061,296679730,1841768865,1260232239,4091327024,3960309330,3497509347,1814803222,2578018489,4195456072,575138148,3299409036,446754879,3629546796,4011996048,3347532110,3252238545,4270639778,915985419,3483825537,681933534,651868046,2755636671,3828103837,223377554,2607439820,1649704518,3270937875,3901806776,1580087799,4118987695,3198115200,2087309459,2842678573,3016697106,1003007129,2802849917,1860738147,2077965243,164439672,4100872472,32283319,2827177882,1709610350,2125135846,136428751,3874428392,3652904859,3460984630,3572145929,3593056380,2939266226,824852259,818324884,3224740454,930369212,2801566410,2967507152,355706840,1257309336,4148292826,243256656,790073846,2373340630,1296297904,1422699085,3756299780,3818836405,457992840,3099667487,2135319889,77422314,1560382517,1945798516,788204353,1521706781,1385356242,870912086,325965383,2358957921,2050466060,2388260884,2313884476,4006521127,901210569,3990953189,1014646705,1503449823,1062597235,2031621326,3212035895,3931371469,1533017514,350174575,2256028891,2177544179,1052338372,741876788,1606591296,1914052035,213705253,2334669897,1107234197,1899603969,3725069491,2631447780,2422494913,1635502980,1893020342,1950903388,1120974935],v=[2807058932,1699970625,2764249623,1586903591,1808481195,1173430173,1487645946,59984867,4199882800,1844882806,1989249228,1277555970,3623636965,3419915562,1149249077,2744104290,1514790577,459744698,244860394,3235995134,1963115311,4027744588,2544078150,4190530515,1608975247,2627016082,2062270317,1507497298,2200818878,567498868,1764313568,3359936201,2305455554,2037970062,1047239e3,1910319033,1337376481,2904027272,2892417312,984907214,1243112415,830661914,861968209,2135253587,2011214180,2927934315,2686254721,731183368,1750626376,4246310725,1820824798,4172763771,3542330227,48394827,2404901663,2871682645,671593195,3254988725,2073724613,145085239,2280796200,2779915199,1790575107,2187128086,472615631,3029510009,4075877127,3802222185,4107101658,3201631749,1646252340,4270507174,1402811438,1436590835,3778151818,3950355702,3963161475,4020912224,2667994737,273792366,2331590177,104699613,95345982,3175501286,2377486676,1560637892,3564045318,369057872,4213447064,3919042237,1137477952,2658625497,1119727848,2340947849,1530455833,4007360968,172466556,266959938,516552836,0,2256734592,3980931627,1890328081,1917742170,4294704398,945164165,3575528878,958871085,3647212047,2787207260,1423022939,775562294,1739656202,3876557655,2530391278,2443058075,3310321856,547512796,1265195639,437656594,3121275539,719700128,3762502690,387781147,218828297,3350065803,2830708150,2848461854,428169201,122466165,3720081049,1627235199,648017665,4122762354,1002783846,2117360635,695634755,3336358691,4234721005,4049844452,3704280881,2232435299,574624663,287343814,612205898,1039717051,840019705,2708326185,793451934,821288114,1391201670,3822090177,376187827,3113855344,1224348052,1679968233,2361698556,1058709744,752375421,2431590963,1321699145,3519142200,2734591178,188127444,2177869557,3727205754,2384911031,3215212461,2648976442,2450346104,3432737375,1180849278,331544205,3102249176,4150144569,2952102595,2159976285,2474404304,766078933,313773861,2570832044,2108100632,1668212892,3145456443,2013908262,418672217,3070356634,2594734927,1852171925,3867060991,3473416636,3907448597,2614737639,919489135,164948639,2094410160,2997825956,590424639,2486224549,1723872674,3157750862,3399941250,3501252752,3625268135,2555048196,3673637356,1343127501,4130281361,3599595085,2957853679,1297403050,81781910,3051593425,2283490410,532201772,1367295589,3926170974,895287692,1953757831,1093597963,492483431,3528626907,1446242576,1192455638,1636604631,209336225,344873464,1015671571,669961897,3375740769,3857572124,2973530695,3747192018,1933530610,3464042516,935293895,3454686199,2858115069,1863638845,3683022916,4085369519,3292445032,875313188,1080017571,3279033885,621591778,1233856572,2504130317,24197544,3017672716,3835484340,3247465558,2220981195,3060847922,1551124588,1463996600],w=[4104605777,1097159550,396673818,660510266,2875968315,2638606623,4200115116,3808662347,821712160,1986918061,3430322568,38544885,3856137295,718002117,893681702,1654886325,2975484382,3122358053,3926825029,4274053469,796197571,1290801793,1184342925,3556361835,2405426947,2459735317,1836772287,1381620373,3196267988,1948373848,3764988233,3385345166,3263785589,2390325492,1480485785,3111247143,3780097726,2293045232,548169417,3459953789,3746175075,439452389,1362321559,1400849762,1685577905,1806599355,2174754046,137073913,1214797936,1174215055,3731654548,2079897426,1943217067,1258480242,529487843,1437280870,3945269170,3049390895,3313212038,923313619,679998e3,3215307299,57326082,377642221,3474729866,2041877159,133361907,1776460110,3673476453,96392454,878845905,2801699524,777231668,4082475170,2330014213,4142626212,2213296395,1626319424,1906247262,1846563261,562755902,3708173718,1040559837,3871163981,1418573201,3294430577,114585348,1343618912,2566595609,3186202582,1078185097,3651041127,3896688048,2307622919,425408743,3371096953,2081048481,1108339068,2216610296,0,2156299017,736970802,292596766,1517440620,251657213,2235061775,2933202493,758720310,265905162,1554391400,1532285339,908999204,174567692,1474760595,4002861748,2610011675,3234156416,3693126241,2001430874,303699484,2478443234,2687165888,585122620,454499602,151849742,2345119218,3064510765,514443284,4044981591,1963412655,2581445614,2137062819,19308535,1928707164,1715193156,4219352155,1126790795,600235211,3992742070,3841024952,836553431,1669664834,2535604243,3323011204,1243905413,3141400786,4180808110,698445255,2653899549,2989552604,2253581325,3252932727,3004591147,1891211689,2487810577,3915653703,4237083816,4030667424,2100090966,865136418,1229899655,953270745,3399679628,3557504664,4118925222,2061379749,3079546586,2915017791,983426092,2022837584,1607244650,2118541908,2366882550,3635996816,972512814,3283088770,1568718495,3499326569,3576539503,621982671,2895723464,410887952,2623762152,1002142683,645401037,1494807662,2595684844,1335535747,2507040230,4293295786,3167684641,367585007,3885750714,1865862730,2668221674,2960971305,2763173681,1059270954,2777952454,2724642869,1320957812,2194319100,2429595872,2815956275,77089521,3973773121,3444575871,2448830231,1305906550,4021308739,2857194700,2516901860,3518358430,1787304780,740276417,1699839814,1592394909,2352307457,2272556026,188821243,1729977011,3687994002,274084841,3594982253,3613494426,2701949495,4162096729,322734571,2837966542,1640576439,484830689,1202797690,3537852828,4067639125,349075736,3342319475,4157467219,4255800159,1030690015,1155237496,2951971274,1757691577,607398968,2738905026,499347990,3794078908,1011452712,227885567,2818666809,213114376,3034881240,1455525988,3414450555,850817237,1817998408,3092726480],_=[0,235474187,470948374,303765277,941896748,908933415,607530554,708780849,1883793496,2118214995,1817866830,1649639237,1215061108,1181045119,1417561698,1517767529,3767586992,4003061179,4236429990,4069246893,3635733660,3602770327,3299278474,3400528769,2430122216,2664543715,2362090238,2193862645,2835123396,2801107407,3035535058,3135740889,3678124923,3576870512,3341394285,3374361702,3810496343,3977675356,4279080257,4043610186,2876494627,2776292904,3076639029,3110650942,2472011535,2640243204,2403728665,2169303058,1001089995,899835584,666464733,699432150,59727847,226906860,530400753,294930682,1273168787,1172967064,1475418501,1509430414,1942435775,2110667444,1876241833,1641816226,2910219766,2743034109,2976151520,3211623147,2505202138,2606453969,2302690252,2269728455,3711829422,3543599269,3240894392,3475313331,3843699074,3943906441,4178062228,4144047775,1306967366,1139781709,1374988112,1610459739,1975683434,2076935265,1775276924,1742315127,1034867998,866637845,566021896,800440835,92987698,193195065,429456164,395441711,1984812685,2017778566,1784663195,1683407248,1315562145,1080094634,1383856311,1551037884,101039829,135050206,437757123,337553864,1042385657,807962610,573804783,742039012,2531067453,2564033334,2328828971,2227573024,2935566865,2700099354,3001755655,3168937228,3868552805,3902563182,4203181171,4102977912,3736164937,3501741890,3265478751,3433712980,1106041591,1340463100,1576976609,1408749034,2043211483,2009195472,1708848333,1809054150,832877231,1068351396,766945465,599762354,159417987,126454664,361929877,463180190,2709260871,2943682380,3178106961,3009879386,2572697195,2538681184,2236228733,2336434550,3509871135,3745345300,3441850377,3274667266,3910161971,3877198648,4110568485,4211818798,2597806476,2497604743,2261089178,2295101073,2733856160,2902087851,3202437046,2968011453,3936291284,3835036895,4136440770,4169408201,3535486456,3702665459,3467192302,3231722213,2051518780,1951317047,1716890410,1750902305,1113818384,1282050075,1584504582,1350078989,168810852,67556463,371049330,404016761,841739592,1008918595,775550814,540080725,3969562369,3801332234,4035489047,4269907996,3569255213,3669462566,3366754619,3332740144,2631065433,2463879762,2160117071,2395588676,2767645557,2868897406,3102011747,3069049960,202008497,33778362,270040487,504459436,875451293,975658646,675039627,641025152,2084704233,1917518562,1615861247,1851332852,1147550661,1248802510,1484005843,1451044056,933301370,967311729,733156972,632953703,260388950,25965917,328671808,496906059,1206477858,1239443753,1543208500,1441952575,2144161806,1908694277,1675577880,1842759443,3610369226,3644379585,3408119516,3307916247,4011190502,3776767469,4077384432,4245618683,2809771154,2842737049,3144396420,3043140495,2673705150,2438237621,2203032232,2370213795],E=[0,185469197,370938394,487725847,741876788,657861945,975451694,824852259,1483753576,1400783205,1315723890,1164071807,1950903388,2135319889,1649704518,1767536459,2967507152,3152976349,2801566410,2918353863,2631447780,2547432937,2328143614,2177544179,3901806776,3818836405,4270639778,4118987695,3299409036,3483825537,3535072918,3652904859,2077965243,1893020342,1841768865,1724457132,1474502543,1559041666,1107234197,1257309336,598438867,681933534,901210569,1052338372,261314535,77422314,428819965,310463728,3409685355,3224740454,3710368113,3593056380,3875770207,3960309330,4045380933,4195456072,2471224067,2554718734,2237133081,2388260884,3212035895,3028143674,2842678573,2724322336,4138563181,4255350624,3769721975,3955191162,3667219033,3516619604,3431546947,3347532110,2933734917,2782082824,3099667487,3016697106,2196052529,2313884476,2499348523,2683765030,1179510461,1296297904,1347548327,1533017514,1786102409,1635502980,2087309459,2003294622,507358933,355706840,136428751,53458370,839224033,957055980,605657339,790073846,2373340630,2256028891,2607439820,2422494913,2706270690,2856345839,3075636216,3160175349,3573941694,3725069491,3273267108,3356761769,4181598602,4063242375,4011996048,3828103837,1033297158,915985419,730517276,545572369,296679730,446754879,129166120,213705253,1709610350,1860738147,1945798516,2029293177,1239331162,1120974935,1606591296,1422699085,4148292826,4233094615,3781033664,3931371469,3682191598,3497509347,3446004468,3328955385,2939266226,2755636671,3106780840,2988687269,2198438022,2282195339,2501218972,2652609425,1201765386,1286567175,1371368976,1521706781,1805211710,1620529459,2105887268,1988838185,533804130,350174575,164439672,46346101,870912086,954669403,636813900,788204353,2358957921,2274680428,2592523643,2441661558,2695033685,2880240216,3065962831,3182487618,3572145929,3756299780,3270937875,3388507166,4174560061,4091327024,4006521127,3854606378,1014646705,930369212,711349675,560487590,272786309,457992840,106852767,223377554,1678381017,1862534868,1914052035,2031621326,1211247597,1128014560,1580087799,1428173050,32283319,182621114,401639597,486441376,768917123,651868046,1003007129,818324884,1503449823,1385356242,1333838021,1150208456,1973745387,2125135846,1673061617,1756818940,2970356327,3120694122,2802849917,2887651696,2637442643,2520393566,2334669897,2149987652,3917234703,3799141122,4284502037,4100872472,3309594171,3460984630,3545789473,3629546796,2050466060,1899603969,1814803222,1730525723,1443857720,1560382517,1075025698,1260232239,575138148,692707433,878443390,1062597235,243256656,91341917,409198410,325965383,3403100636,3252238545,3704300486,3620022987,3874428392,3990953189,4042459122,4227665663,2460449204,2578018489,2226875310,2411029155,3198115200,3046200461,2827177882,2743944855],A=[0,218828297,437656594,387781147,875313188,958871085,775562294,590424639,1750626376,1699970625,1917742170,2135253587,1551124588,1367295589,1180849278,1265195639,3501252752,3720081049,3399941250,3350065803,3835484340,3919042237,4270507174,4085369519,3102249176,3051593425,2734591178,2952102595,2361698556,2177869557,2530391278,2614737639,3145456443,3060847922,2708326185,2892417312,2404901663,2187128086,2504130317,2555048196,3542330227,3727205754,3375740769,3292445032,3876557655,3926170974,4246310725,4027744588,1808481195,1723872674,1910319033,2094410160,1608975247,1391201670,1173430173,1224348052,59984867,244860394,428169201,344873464,935293895,984907214,766078933,547512796,1844882806,1627235199,2011214180,2062270317,1507497298,1423022939,1137477952,1321699145,95345982,145085239,532201772,313773861,830661914,1015671571,731183368,648017665,3175501286,2957853679,2807058932,2858115069,2305455554,2220981195,2474404304,2658625497,3575528878,3625268135,3473416636,3254988725,3778151818,3963161475,4213447064,4130281361,3599595085,3683022916,3432737375,3247465558,3802222185,4020912224,4172763771,4122762354,3201631749,3017672716,2764249623,2848461854,2331590177,2280796200,2431590963,2648976442,104699613,188127444,472615631,287343814,840019705,1058709744,671593195,621591778,1852171925,1668212892,1953757831,2037970062,1514790577,1463996600,1080017571,1297403050,3673637356,3623636965,3235995134,3454686199,4007360968,3822090177,4107101658,4190530515,2997825956,3215212461,2830708150,2779915199,2256734592,2340947849,2627016082,2443058075,172466556,122466165,273792366,492483431,1047239e3,861968209,612205898,695634755,1646252340,1863638845,2013908262,1963115311,1446242576,1530455833,1277555970,1093597963,1636604631,1820824798,2073724613,1989249228,1436590835,1487645946,1337376481,1119727848,164948639,81781910,331544205,516552836,1039717051,821288114,669961897,719700128,2973530695,3157750862,2871682645,2787207260,2232435299,2283490410,2667994737,2450346104,3647212047,3564045318,3279033885,3464042516,3980931627,3762502690,4150144569,4199882800,3070356634,3121275539,2904027272,2686254721,2200818878,2384911031,2570832044,2486224549,3747192018,3528626907,3310321856,3359936201,3950355702,3867060991,4049844452,4234721005,1739656202,1790575107,2108100632,1890328081,1402811438,1586903591,1233856572,1149249077,266959938,48394827,369057872,418672217,1002783846,919489135,567498868,752375421,209336225,24197544,376187827,459744698,945164165,895287692,574624663,793451934,1679968233,1764313568,2117360635,1933530610,1343127501,1560637892,1243112415,1192455638,3704280881,3519142200,3336358691,3419915562,3907448597,3857572124,4075877127,4294704398,3029510009,3113855344,2927934315,2744104290,2159976285,2377486676,2594734927,2544078150],M=[0,151849742,303699484,454499602,607398968,758720310,908999204,1059270954,1214797936,1097159550,1517440620,1400849762,1817998408,1699839814,2118541908,2001430874,2429595872,2581445614,2194319100,2345119218,3034881240,3186202582,2801699524,2951971274,3635996816,3518358430,3399679628,3283088770,4237083816,4118925222,4002861748,3885750714,1002142683,850817237,698445255,548169417,529487843,377642221,227885567,77089521,1943217067,2061379749,1640576439,1757691577,1474760595,1592394909,1174215055,1290801793,2875968315,2724642869,3111247143,2960971305,2405426947,2253581325,2638606623,2487810577,3808662347,3926825029,4044981591,4162096729,3342319475,3459953789,3576539503,3693126241,1986918061,2137062819,1685577905,1836772287,1381620373,1532285339,1078185097,1229899655,1040559837,923313619,740276417,621982671,439452389,322734571,137073913,19308535,3871163981,4021308739,4104605777,4255800159,3263785589,3414450555,3499326569,3651041127,2933202493,2815956275,3167684641,3049390895,2330014213,2213296395,2566595609,2448830231,1305906550,1155237496,1607244650,1455525988,1776460110,1626319424,2079897426,1928707164,96392454,213114376,396673818,514443284,562755902,679998e3,865136418,983426092,3708173718,3557504664,3474729866,3323011204,4180808110,4030667424,3945269170,3794078908,2507040230,2623762152,2272556026,2390325492,2975484382,3092726480,2738905026,2857194700,3973773121,3856137295,4274053469,4157467219,3371096953,3252932727,3673476453,3556361835,2763173681,2915017791,3064510765,3215307299,2156299017,2307622919,2459735317,2610011675,2081048481,1963412655,1846563261,1729977011,1480485785,1362321559,1243905413,1126790795,878845905,1030690015,645401037,796197571,274084841,425408743,38544885,188821243,3613494426,3731654548,3313212038,3430322568,4082475170,4200115116,3780097726,3896688048,2668221674,2516901860,2366882550,2216610296,3141400786,2989552604,2837966542,2687165888,1202797690,1320957812,1437280870,1554391400,1669664834,1787304780,1906247262,2022837584,265905162,114585348,499347990,349075736,736970802,585122620,972512814,821712160,2595684844,2478443234,2293045232,2174754046,3196267988,3079546586,2895723464,2777952454,3537852828,3687994002,3234156416,3385345166,4142626212,4293295786,3841024952,3992742070,174567692,57326082,410887952,292596766,777231668,660510266,1011452712,893681702,1108339068,1258480242,1343618912,1494807662,1715193156,1865862730,1948373848,2100090966,2701949495,2818666809,3004591147,3122358053,2235061775,2352307457,2535604243,2653899549,3915653703,3764988233,4219352155,4067639125,3444575871,3294430577,3746175075,3594982253,836553431,953270745,600235211,718002117,367585007,484830689,133361907,251657213,2041877159,1891211689,1806599355,1654886325,1568718495,1418573201,1335535747,1184342925];function S(t){for(var e=[],r=0;r<t.length;r+=4)e.push(t[r]<<24|t[r+1]<<16|t[r+2]<<8|t[r+3]);return e}var k=function(t){if(!(this instanceof k))throw Error("AES must be instanitated with `new`");Object.defineProperty(this,"key",{value:n(t,!0)}),this._prepare()};k.prototype._prepare=function(){var t=h[this.key.length];if(null==t)throw new Error("invalid key size (must be 16, 24 or 32 bytes)");this._Ke=[],this._Kd=[];for(var e=0;e<=t;e++)this._Ke.push([0,0,0,0]),this._Kd.push([0,0,0,0]);var r,n=4*(t+1),i=this.key.length/4,o=S(this.key);for(e=0;e<i;e++)r=e>>2,this._Ke[r][e%4]=o[e],this._Kd[t-r][e%4]=o[e];for(var s,a=0,u=i;u<n;){if(s=o[i-1],o[0]^=f[s>>16&255]<<24^f[s>>8&255]<<16^f[255&s]<<8^f[s>>24&255]^c[a]<<24,a+=1,8!=i)for(e=1;e<i;e++)o[e]^=o[e-1];else{for(e=1;e<i/2;e++)o[e]^=o[e-1];s=o[i/2-1],o[i/2]^=f[255&s]^f[s>>8&255]<<8^f[s>>16&255]<<16^f[s>>24&255]<<24;for(e=i/2+1;e<i;e++)o[e]^=o[e-1]}for(e=0;e<i&&u<n;)l=u>>2,d=u%4,this._Ke[l][d]=o[e],this._Kd[t-l][d]=o[e++],u++}for(var l=1;l<t;l++)for(var d=0;d<4;d++)s=this._Kd[l][d],this._Kd[l][d]=_[s>>24&255]^E[s>>16&255]^A[s>>8&255]^M[255&s]},k.prototype.encrypt=function(t){if(16!=t.length)throw new Error("invalid plaintext size (must be 16 bytes)");for(var e=this._Ke.length-1,r=[0,0,0,0],n=S(t),o=0;o<4;o++)n[o]^=this._Ke[0][o];for(var s=1;s<e;s++){for(o=0;o<4;o++)r[o]=d[n[o]>>24&255]^p[n[(o+1)%4]>>16&255]^m[n[(o+2)%4]>>8&255]^g[255&n[(o+3)%4]]^this._Ke[s][o];n=r.slice()}var a,u=i(16);for(o=0;o<4;o++)a=this._Ke[e][o],u[4*o]=255&(f[n[o]>>24&255]^a>>24),u[4*o+1]=255&(f[n[(o+1)%4]>>16&255]^a>>16),u[4*o+2]=255&(f[n[(o+2)%4]>>8&255]^a>>8),u[4*o+3]=255&(f[255&n[(o+3)%4]]^a);return u},k.prototype.decrypt=function(t){if(16!=t.length)throw new Error("invalid ciphertext size (must be 16 bytes)");for(var e=this._Kd.length-1,r=[0,0,0,0],n=S(t),o=0;o<4;o++)n[o]^=this._Kd[0][o];for(var s=1;s<e;s++){for(o=0;o<4;o++)r[o]=y[n[o]>>24&255]^b[n[(o+3)%4]>>16&255]^v[n[(o+2)%4]>>8&255]^w[255&n[(o+1)%4]]^this._Kd[s][o];n=r.slice()}var a,u=i(16);for(o=0;o<4;o++)a=this._Kd[e][o],u[4*o]=255&(l[n[o]>>24&255]^a>>24),u[4*o+1]=255&(l[n[(o+3)%4]>>16&255]^a>>16),u[4*o+2]=255&(l[n[(o+2)%4]>>8&255]^a>>8),u[4*o+3]=255&(l[255&n[(o+1)%4]]^a);return u};var x=function(t){if(!(this instanceof x))throw Error("AES must be instanitated with `new`");this.description="Electronic Code Block",this.name="ecb",this._aes=new k(t)};x.prototype.encrypt=function(t){if((t=n(t)).length%16!=0)throw new Error("invalid plaintext size (must be multiple of 16 bytes)");for(var e=i(t.length),r=i(16),s=0;s<t.length;s+=16)o(t,r,0,s,s+16),o(r=this._aes.encrypt(r),e,s);return e},x.prototype.decrypt=function(t){if((t=n(t)).length%16!=0)throw new Error("invalid ciphertext size (must be multiple of 16 bytes)");for(var e=i(t.length),r=i(16),s=0;s<t.length;s+=16)o(t,r,0,s,s+16),o(r=this._aes.decrypt(r),e,s);return e};var T=function(t,e){if(!(this instanceof T))throw Error("AES must be instanitated with `new`");if(this.description="Cipher Block Chaining",this.name="cbc",e){if(16!=e.length)throw new Error("invalid initialation vector size (must be 16 bytes)")}else e=i(16);this._lastCipherblock=n(e,!0),this._aes=new k(t)};T.prototype.encrypt=function(t){if((t=n(t)).length%16!=0)throw new Error("invalid plaintext size (must be multiple of 16 bytes)");for(var e=i(t.length),r=i(16),s=0;s<t.length;s+=16){o(t,r,0,s,s+16);for(var a=0;a<16;a++)r[a]^=this._lastCipherblock[a];this._lastCipherblock=this._aes.encrypt(r),o(this._lastCipherblock,e,s)}return e},T.prototype.decrypt=function(t){if((t=n(t)).length%16!=0)throw new Error("invalid ciphertext size (must be multiple of 16 bytes)");for(var e=i(t.length),r=i(16),s=0;s<t.length;s+=16){o(t,r,0,s,s+16),r=this._aes.decrypt(r);for(var a=0;a<16;a++)e[s+a]=r[a]^this._lastCipherblock[a];o(t,this._lastCipherblock,0,s,s+16)}return e};var R=function(t,e,r){if(!(this instanceof R))throw Error("AES must be instanitated with `new`");if(this.description="Cipher Feedback",this.name="cfb",e){if(16!=e.length)throw new Error("invalid initialation vector size (must be 16 size)")}else e=i(16);r||(r=1),this.segmentSize=r,this._shiftRegister=n(e,!0),this._aes=new k(t)};R.prototype.encrypt=function(t){if(t.length%this.segmentSize!=0)throw new Error("invalid plaintext size (must be segmentSize bytes)");for(var e,r=n(t,!0),i=0;i<r.length;i+=this.segmentSize){e=this._aes.encrypt(this._shiftRegister);for(var s=0;s<this.segmentSize;s++)r[i+s]^=e[s];o(this._shiftRegister,this._shiftRegister,0,this.segmentSize),o(r,this._shiftRegister,16-this.segmentSize,i,i+this.segmentSize)}return r},R.prototype.decrypt=function(t){if(t.length%this.segmentSize!=0)throw new Error("invalid ciphertext size (must be segmentSize bytes)");for(var e,r=n(t,!0),i=0;i<r.length;i+=this.segmentSize){e=this._aes.encrypt(this._shiftRegister);for(var s=0;s<this.segmentSize;s++)r[i+s]^=e[s];o(this._shiftRegister,this._shiftRegister,0,this.segmentSize),o(t,this._shiftRegister,16-this.segmentSize,i,i+this.segmentSize)}return r};var B=function(t,e){if(!(this instanceof B))throw Error("AES must be instanitated with `new`");if(this.description="Output Feedback",this.name="ofb",e){if(16!=e.length)throw new Error("invalid initialation vector size (must be 16 bytes)")}else e=i(16);this._lastPrecipher=n(e,!0),this._lastPrecipherIndex=16,this._aes=new k(t)};B.prototype.encrypt=function(t){for(var e=n(t,!0),r=0;r<e.length;r++)16===this._lastPrecipherIndex&&(this._lastPrecipher=this._aes.encrypt(this._lastPrecipher),this._lastPrecipherIndex=0),e[r]^=this._lastPrecipher[this._lastPrecipherIndex++];return e},B.prototype.decrypt=B.prototype.encrypt;var N=function(t){if(!(this instanceof N))throw Error("Counter must be instanitated with `new`");0===t||t||(t=1),"number"==typeof t?(this._counter=i(16),this.setValue(t)):this.setBytes(t)};N.prototype.setValue=function(t){if("number"!=typeof t||parseInt(t)!=t)throw new Error("invalid counter value (must be an integer)");for(var e=15;e>=0;--e)this._counter[e]=t%256,t>>=8},N.prototype.setBytes=function(t){if(16!=(t=n(t,!0)).length)throw new Error("invalid counter bytes size (must be 16 bytes)");this._counter=t},N.prototype.increment=function(){for(var t=15;t>=0;t--){if(255!==this._counter[t]){this._counter[t]++;break}this._counter[t]=0}};var P=function(t,e){if(!(this instanceof P))throw Error("AES must be instanitated with `new`");this.description="Counter",this.name="ctr",e instanceof N||(e=new N(e)),this._counter=e,this._remainingCounter=null,this._remainingCounterIndex=16,this._aes=new k(t)};P.prototype.encrypt=function(t){for(var e=n(t,!0),r=0;r<e.length;r++)16===this._remainingCounterIndex&&(this._remainingCounter=this._aes.encrypt(this._counter._counter),this._remainingCounterIndex=0,this._counter.increment()),e[r]^=this._remainingCounter[this._remainingCounterIndex++];return e},P.prototype.decrypt=P.prototype.encrypt;var I={AES:k,Counter:N,ModeOfOperation:{ecb:x,cbc:T,cfb:R,ofb:B,ctr:P},utils:{hex:u,utf8:a},padding:{pkcs7:{pad:function(t){var e=16-(t=n(t,!0)).length%16,r=i(t.length+e);o(t,r);for(var s=t.length;s<r.length;s++)r[s]=e;return r},strip:function(t){if((t=n(t,!0)).length<16)throw new Error("PKCS#7 invalid length");var e=t[t.length-1];if(e>16)throw new Error("PKCS#7 padding byte out of range");for(var r=t.length-e,s=0;s<e;s++)if(t[r+s]!==e)throw new Error("PKCS#7 invalid padding byte");var a=i(r);return o(t,a,0,0,r),a}}},_arrayTest:{coerceArray:n,createArray:i,copyArray:o}};t.exports=I}()}(av);var uv=r(av.exports);const hv="json-wallets/5.8.0";function cv(t){return"string"==typeof t&&"0x"!==t.substring(0,2)&&(t="0x"+t),Mt(t)}function fv(t,e){for(t=String(t);t.length<e;)t="0"+t;return t}function lv(t){return"string"==typeof t?Rr(t,Mr.NFKC):Mt(t)}function dv(t,e){let r=t;const n=e.toLowerCase().split("/");for(let t=0;t<n.length;t++){let e=null;for(const i in r)if(i.toLowerCase()===n[t]){e=r[i];break}if(null===e)return null;r=e}return r}function pv(t){const e=Mt(t);e[6]=15&e[6]|64,e[8]=63&e[8]|128;const r=Bt(e);return[r.substring(2,10),r.substring(10,14),r.substring(14,18),r.substring(18,22),r.substring(22,34)].join("-")}const mv=new yt(hv);class gv extends we{isCrowdsaleAccount(t){return!(!t||!t._isCrowdsaleAccount)}}function yv(t,e){const r=JSON.parse(t);e=lv(e);const n=In(dv(r,"ethaddr")),i=cv(dv(r,"encseed"));i&&i.length%16==0||mv.throwArgumentError("invalid encseed","json",t);const o=Mt(Ub(e,e,2e3,32,"sha256")).slice(0,16),s=i.slice(0,16),a=i.slice(16),u=new uv.ModeOfOperation.cbc(o,s),h=uv.padding.pkcs7.strip(Mt(u.decrypt(a)));let c="";for(let t=0;t<h.length;t++)c+=String.fromCharCode(h[t]);const f=Er(Rr(c));return new gv({_isCrowdsaleAccount:!0,address:n,privateKey:f})}function bv(t){let e=null;try{e=JSON.parse(t)}catch(t){return!1}return e.encseed&&e.ethaddr}function vv(t){let e=null;try{e=JSON.parse(t)}catch(t){return!1}return!(!e.version||parseInt(e.version)!==e.version||3!==parseInt(e.version))}var wv={exports:{}};!function(t){!function(){const e=2147483647;function r(t){const e=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]);let r=1779033703,n=3144134277,i=1013904242,o=2773480762,s=1359893119,a=2600822924,u=528734635,h=1541459225;const c=new Uint32Array(64);function f(t){let f=0,l=t.length;for(;l>=64;){let d,p,m,g,y,b=r,v=n,w=i,_=o,E=s,A=a,M=u,S=h;for(p=0;p<16;p++)m=f+4*p,c[p]=(255&t[m])<<24|(255&t[m+1])<<16|(255&t[m+2])<<8|255&t[m+3];for(p=16;p<64;p++)d=c[p-2],g=(d>>>17|d<<15)^(d>>>19|d<<13)^d>>>10,d=c[p-15],y=(d>>>7|d<<25)^(d>>>18|d<<14)^d>>>3,c[p]=(g+c[p-7]|0)+(y+c[p-16]|0)|0;for(p=0;p<64;p++)g=(((E>>>6|E<<26)^(E>>>11|E<<21)^(E>>>25|E<<7))+(E&A^~E&M)|0)+(S+(e[p]+c[p]|0)|0)|0,y=((b>>>2|b<<30)^(b>>>13|b<<19)^(b>>>22|b<<10))+(b&v^b&w^v&w)|0,S=M,M=A,A=E,E=_+g|0,_=w,w=v,v=b,b=g+y|0;r=r+b|0,n=n+v|0,i=i+w|0,o=o+_|0,s=s+E|0,a=a+A|0,u=u+M|0,h=h+S|0,f+=64,l-=64}}f(t);let l,d=t.length%64,p=t.length/536870912|0,m=t.length<<3,g=d<56?56:120,y=t.slice(t.length-d,t.length);for(y.push(128),l=d+1;l<g;l++)y.push(0);return y.push(p>>>24&255),y.push(p>>>16&255),y.push(p>>>8&255),y.push(p>>>0&255),y.push(m>>>24&255),y.push(m>>>16&255),y.push(m>>>8&255),y.push(m>>>0&255),f(y),[r>>>24&255,r>>>16&255,r>>>8&255,r>>>0&255,n>>>24&255,n>>>16&255,n>>>8&255,n>>>0&255,i>>>24&255,i>>>16&255,i>>>8&255,i>>>0&255,o>>>24&255,o>>>16&255,o>>>8&255,o>>>0&255,s>>>24&255,s>>>16&255,s>>>8&255,s>>>0&255,a>>>24&255,a>>>16&255,a>>>8&255,a>>>0&255,u>>>24&255,u>>>16&255,u>>>8&255,u>>>0&255,h>>>24&255,h>>>16&255,h>>>8&255,h>>>0&255]}function n(t,e,n){t=t.length<=64?t:r(t);const i=64+e.length+4,o=new Array(i),s=new Array(64);let a,u=[];for(a=0;a<64;a++)o[a]=54;for(a=0;a<t.length;a++)o[a]^=t[a];for(a=0;a<e.length;a++)o[64+a]=e[a];for(a=i-4;a<i;a++)o[a]=0;for(a=0;a<64;a++)s[a]=92;for(a=0;a<t.length;a++)s[a]^=t[a];function h(){for(let t=i-1;t>=i-4;t--){if(o[t]++,o[t]<=255)return;o[t]=0}}for(;n>=32;)h(),u=u.concat(r(s.concat(r(o)))),n-=32;return n>0&&(h(),u=u.concat(r(s.concat(r(o))).slice(0,n))),u}function i(t,e,r,n,i){let o;for(u(t,16*(2*r-1),i,0,16),o=0;o<2*r;o++)a(t,16*o,i,16),s(i,n),u(i,0,t,e+16*o,16);for(o=0;o<r;o++)u(t,e+2*o*16,t,16*o,16);for(o=0;o<r;o++)u(t,e+16*(2*o+1),t,16*(o+r),16)}function o(t,e){return t<<e|t>>>32-e}function s(t,e){u(t,0,e,0,16);for(let t=8;t>0;t-=2)e[4]^=o(e[0]+e[12],7),e[8]^=o(e[4]+e[0],9),e[12]^=o(e[8]+e[4],13),e[0]^=o(e[12]+e[8],18),e[9]^=o(e[5]+e[1],7),e[13]^=o(e[9]+e[5],9),e[1]^=o(e[13]+e[9],13),e[5]^=o(e[1]+e[13],18),e[14]^=o(e[10]+e[6],7),e[2]^=o(e[14]+e[10],9),e[6]^=o(e[2]+e[14],13),e[10]^=o(e[6]+e[2],18),e[3]^=o(e[15]+e[11],7),e[7]^=o(e[3]+e[15],9),e[11]^=o(e[7]+e[3],13),e[15]^=o(e[11]+e[7],18),e[1]^=o(e[0]+e[3],7),e[2]^=o(e[1]+e[0],9),e[3]^=o(e[2]+e[1],13),e[0]^=o(e[3]+e[2],18),e[6]^=o(e[5]+e[4],7),e[7]^=o(e[6]+e[5],9),e[4]^=o(e[7]+e[6],13),e[5]^=o(e[4]+e[7],18),e[11]^=o(e[10]+e[9],7),e[8]^=o(e[11]+e[10],9),e[9]^=o(e[8]+e[11],13),e[10]^=o(e[9]+e[8],18),e[12]^=o(e[15]+e[14],7),e[13]^=o(e[12]+e[15],9),e[14]^=o(e[13]+e[12],13),e[15]^=o(e[14]+e[13],18);for(let r=0;r<16;++r)t[r]+=e[r]}function a(t,e,r,n){for(let i=0;i<n;i++)r[i]^=t[e+i]}function u(t,e,r,n,i){for(;i--;)r[n++]=t[e++]}function h(t){if(!t||"number"!=typeof t.length)return!1;for(let e=0;e<t.length;e++){const r=t[e];if("number"!=typeof r||r%1||r<0||r>=256)return!1}return!0}function c(t,e){if("number"!=typeof t||t%1)throw new Error("invalid "+e);return t}function f(t,r,o,s,f,l,d){if(o=c(o,"N"),s=c(s,"r"),f=c(f,"p"),l=c(l,"dkLen"),0===o||o&o-1)throw new Error("N must be power of 2");if(o>e/128/s)throw new Error("N too large");if(s>e/128/f)throw new Error("r too large");if(!h(t))throw new Error("password must be an array or buffer");if(t=Array.prototype.slice.call(t),!h(r))throw new Error("salt must be an array or buffer");r=Array.prototype.slice.call(r);let p=n(t,r,128*f*s);const m=new Uint32Array(32*f*s);for(let t=0;t<m.length;t++){const e=4*t;m[t]=(255&p[e+3])<<24|(255&p[e+2])<<16|(255&p[e+1])<<8|255&p[e+0]}const g=new Uint32Array(64*s),y=new Uint32Array(32*s*o),b=32*s,v=new Uint32Array(16),w=new Uint32Array(16),_=f*o*2;let E,A,M=0,S=null,k=!1,x=0,T=0;const R=d?parseInt(1e3/s):4294967295,B="undefined"!=typeof setImmediate?setImmediate:setTimeout,N=function(){if(k)return d(new Error("cancelled"),M/_);let e;switch(x){case 0:A=32*T*s,u(m,A,g,0,b),x=1,E=0;case 1:e=o-E,e>R&&(e=R);for(let t=0;t<e;t++)u(g,0,y,(E+t)*b,b),i(g,b,s,v,w);if(E+=e,M+=e,d){const t=parseInt(1e3*M/_);if(t!==S){if(k=d(null,M/_),k)break;S=t}}if(E<o)break;E=0,x=2;case 2:e=o-E,e>R&&(e=R);for(let t=0;t<e;t++){const t=g[16*(2*s-1)]&o-1;a(y,t*b,g,b),i(g,b,s,v,w)}if(E+=e,M+=e,d){const t=parseInt(1e3*M/_);if(t!==S){if(k=d(null,M/_),k)break;S=t}}if(E<o)break;if(u(g,0,m,A,b),T++,T<f){x=0;break}p=[];for(let t=0;t<m.length;t++)p.push(255&m[t]),p.push(m[t]>>8&255),p.push(m[t]>>16&255),p.push(m[t]>>24&255);const r=n(t,p,l);return d&&d(null,1,r),r}d&&B(N)};if(!d)for(;;){const t=N();if(null!=t)return t}N()}const l={scrypt:function(t,e,r,n,i,o,s){return new Promise(function(a,u){let h=0;s&&s(0),f(t,e,r,n,i,o,function(t,e,r){if(t)u(t);else if(r)s&&1!==h&&s(1),a(new Uint8Array(r));else if(s&&e!==h)return h=e,s(e)})})},syncScrypt:function(t,e,r,n,i,o){return new Uint8Array(f(t,e,r,n,i,o))}};t.exports=l}()}(wv);var _v=r(wv.exports),Ev=function(t,e,r,n){return new(r||(r=Promise))(function(i,o){function s(t){try{u(n.next(t))}catch(t){o(t)}}function a(t){try{u(n.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r(function(t){t(e)})).then(s,a)}u((n=n.apply(t,e||[])).next())})};const Av=new yt(hv);function Mv(t){return null!=t&&t.mnemonic&&t.mnemonic.phrase}class Sv extends we{isKeystoreAccount(t){return!(!t||!t._isKeystoreAccount)}}function kv(t,e){const r=cv(dv(t,"crypto/ciphertext"));if(Bt(Er(St([e.slice(16,32),r]))).substring(2)!==dv(t,"crypto/mac").toLowerCase())throw new Error("invalid password");const n=function(t,e,r){if("aes-128-ctr"===dv(t,"crypto/cipher")){const n=cv(dv(t,"crypto/cipherparams/iv")),i=new uv.Counter(n);return Mt(new uv.ModeOfOperation.ctr(e,i).decrypt(r))}return null}(t,e.slice(0,16),r);n||Av.throwError("unsupported cipher",yt.errors.UNSUPPORTED_OPERATION,{operation:"decrypt"});const i=e.slice(32,64),o=_a(n);if(t.address){let e=t.address.toLowerCase();if("0x"!==e.substring(0,2)&&(e="0x"+e),In(e)!==o)throw new Error("address mismatch")}const s={_isKeystoreAccount:!0,address:o,privateKey:Bt(n)};if("0.1"===dv(t,"x-ethers/version")){const e=cv(dv(t,"x-ethers/mnemonicCiphertext")),r=cv(dv(t,"x-ethers/mnemonicCounter")),n=new uv.Counter(r),o=new uv.ModeOfOperation.ctr(i,n),a=dv(t,"x-ethers/path")||rv,u=dv(t,"x-ethers/locale")||"en",h=Mt(o.decrypt(e));try{const t=sv(h,u),e=nv.fromMnemonic(t,null,u).derivePath(a);if(e.privateKey!=s.privateKey)throw new Error("mnemonic mismatch");s.mnemonic=e.mnemonic}catch(t){if(t.code!==yt.errors.INVALID_ARGUMENT||"wordlist"!==t.argument)throw t}}return new Sv(s)}function xv(t,e,r,n,i){return Mt(Ub(t,e,r,n,i))}function Tv(t,e,r,n,i){return Promise.resolve(xv(t,e,r,n,i))}function Rv(t,e,r,n,i){const o=lv(e),s=dv(t,"crypto/kdf");if(s&&"string"==typeof s){const e=function(t,e){return Av.throwArgumentError("invalid key-derivation function parameters",t,e)};if("scrypt"===s.toLowerCase()){const r=cv(dv(t,"crypto/kdfparams/salt")),a=parseInt(dv(t,"crypto/kdfparams/n")),u=parseInt(dv(t,"crypto/kdfparams/r")),h=parseInt(dv(t,"crypto/kdfparams/p"));a&&u&&h||e("kdf",s),a&a-1&&e("N",a);const c=parseInt(dv(t,"crypto/kdfparams/dklen"));return 32!==c&&e("dklen",c),n(o,r,a,u,h,64,i)}if("pbkdf2"===s.toLowerCase()){const n=cv(dv(t,"crypto/kdfparams/salt"));let i=null;const s=dv(t,"crypto/kdfparams/prf");"hmac-sha256"===s?i="sha256":"hmac-sha512"===s?i="sha512":e("prf",s);const a=parseInt(dv(t,"crypto/kdfparams/c")),u=parseInt(dv(t,"crypto/kdfparams/dklen"));return 32!==u&&e("dklen",u),r(o,n,a,u,i)}}return Av.throwArgumentError("unsupported key-derivation function","kdf",s)}function Bv(t,e,r){if(bv(t)){r&&r(0);const n=yv(t,e);return r&&r(1),Promise.resolve(n)}return vv(t)?function(t,e,r){return Ev(this,void 0,void 0,function*(){const n=JSON.parse(t);return kv(n,yield Rv(n,e,Tv,_v.scrypt,r))})}(t,e,r):Promise.reject(new Error("invalid JSON wallet"))}function Nv(t,e){if(bv(t))return yv(t,e);if(vv(t))return function(t,e){const r=JSON.parse(t);return kv(r,Rv(r,e,xv,_v.syncScrypt))}(t,e);throw new Error("invalid JSON wallet")}var Pv=function(t,e,r,n){return new(r||(r=Promise))(function(i,o){function s(t){try{u(n.next(t))}catch(t){o(t)}}function a(t){try{u(n.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r(function(t){t(e)})).then(s,a)}u((n=n.apply(t,e||[])).next())})};const Iv=new yt("wallet/5.8.0");class Ov extends lu{constructor(t,e){if(super(),null!=(r=t)&&Tt(r.privateKey,32)&&null!=r.address){const e=new la(t.privateKey);if(fe(this,"_signingKey",()=>e),fe(this,"address",_a(this.publicKey)),this.address!==In(t.address)&&Iv.throwArgumentError("privateKey/address mismatch","privateKey","[REDACTED]"),function(t){const e=t.mnemonic;return e&&e.phrase}(t)){const e=t.mnemonic;fe(this,"_mnemonic",()=>({phrase:e.phrase,path:e.path||rv,locale:e.locale||"en"}));const r=this.mnemonic;_a(nv.fromMnemonic(r.phrase,null,r.locale).derivePath(r.path).privateKey)!==this.address&&Iv.throwArgumentError("mnemonic/address mismatch","privateKey","[REDACTED]")}else fe(this,"_mnemonic",()=>null)}else{if(la.isSigningKey(t))"secp256k1"!==t.curve&&Iv.throwArgumentError("unsupported curve; must be secp256k1","privateKey","[REDACTED]"),fe(this,"_signingKey",()=>t);else{"string"==typeof t&&t.match(/^[0-9a-f]*$/i)&&64===t.length&&(t="0x"+t);const e=new la(t);fe(this,"_signingKey",()=>e)}fe(this,"_mnemonic",()=>null),fe(this,"address",_a(this.publicKey))}var r;e&&!Me.isProvider(e)&&Iv.throwArgumentError("invalid provider","provider",e),fe(this,"provider",e||null)}get mnemonic(){return this._mnemonic()}get privateKey(){return this._signingKey().privateKey}get publicKey(){return this._signingKey().publicKey}getAddress(){return Promise.resolve(this.address)}connect(t){return new Ov(this,t)}signTransaction(t){return de(t).then(e=>{null!=e.from&&(In(e.from)!==this.address&&Iv.throwArgumentError("transaction from address mismatch","transaction.from",t.from),delete e.from);const r=this._signingKey().signDigest(Er(Ra(e)));return Ra(e,r)})}signMessage(t){return Pv(this,void 0,void 0,function*(){return Dt(this._signingKey().signDigest(bn(t)))})}_signTypedData(t,e,r){return Pv(this,void 0,void 0,function*(){const n=yield Yn.resolveNames(t,e,r,t=>(null==this.provider&&Iv.throwError("cannot resolve ENS names without a provider",yt.errors.UNSUPPORTED_OPERATION,{operation:"resolveName",value:t}),this.provider.resolveName(t)));return Dt(this._signingKey().signDigest(Yn.hash(n.domain,e,n.value)))})}encrypt(t,e,r){if("function"!=typeof e||r||(r=e,e={}),r&&"function"!=typeof r)throw new Error("invalid callback");return e||(e={}),function(t,e,r,n){try{if(In(t.address)!==_a(t.privateKey))throw new Error("address/privateKey mismatch");if(Mv(t)){const e=t.mnemonic;if(nv.fromMnemonic(e.phrase,null,e.locale).derivePath(e.path||rv).privateKey!=t.privateKey)throw new Error("mnemonic mismatch")}}catch(t){return Promise.reject(t)}"function"!=typeof r||n||(n=r,r={}),r||(r={});const i=Mt(t.privateKey),o=lv(e);let s=null,a=null,u=null;if(Mv(t)){const e=t.mnemonic;s=Mt(ov(e.phrase,e.locale||"en")),a=e.path||rv,u=e.locale||"en"}let h=r.client;h||(h="ethers.js");let c=null;c=r.salt?Mt(r.salt):ih(32);let f=null;if(r.iv){if(f=Mt(r.iv),16!==f.length)throw new Error("invalid iv")}else f=ih(16);let l=null;if(r.uuid){if(l=Mt(r.uuid),16!==l.length)throw new Error("invalid uuid")}else l=ih(16);let d=1<<17,p=8,m=1;return r.scrypt&&(r.scrypt.N&&(d=r.scrypt.N),r.scrypt.r&&(p=r.scrypt.r),r.scrypt.p&&(m=r.scrypt.p)),_v.scrypt(o,c,d,p,m,64,n).then(e=>{const r=(e=Mt(e)).slice(0,16),n=e.slice(16,32),o=e.slice(32,64),g=new uv.Counter(f),y=Mt(new uv.ModeOfOperation.ctr(r,g).encrypt(i)),b=Er(St([n,y])),v={address:t.address.substring(2).toLowerCase(),id:pv(l),version:3,crypto:{cipher:"aes-128-ctr",cipherparams:{iv:Bt(f).substring(2)},ciphertext:Bt(y).substring(2),kdf:"scrypt",kdfparams:{salt:Bt(c).substring(2),n:d,dklen:32,p:m,r:p},mac:b.substring(2)}};if(s){const t=ih(16),e=new uv.Counter(t),r=Mt(new uv.ModeOfOperation.ctr(o,e).encrypt(s)),n=new Date,i=n.getUTCFullYear()+"-"+fv(n.getUTCMonth()+1,2)+"-"+fv(n.getUTCDate(),2)+"T"+fv(n.getUTCHours(),2)+"-"+fv(n.getUTCMinutes(),2)+"-"+fv(n.getUTCSeconds(),2)+".0Z";v["x-ethers"]={client:h,gethFilename:"UTC--"+i+"--"+v.address,mnemonicCounter:Bt(t).substring(2),mnemonicCiphertext:Bt(r).substring(2),path:a,locale:u,version:"0.1"}}return JSON.stringify(v)})}(this,t,e,r)}static createRandom(t){let e=ih(16);t||(t={}),t.extraEntropy&&(e=Mt(Pt(Er(St([e,t.extraEntropy])),0,16)));const r=sv(e,t.locale);return Ov.fromMnemonic(r,t.path,t.locale)}static fromEncryptedJson(t,e,r){return Bv(t,e,r).then(t=>new Ov(t))}static fromEncryptedJsonSync(t,e){return new Ov(Nv(t,e))}static fromMnemonic(t,e,r){return e||(e=rv),new Ov(nv.fromMnemonic(t,null,r).derivePath(e))}}const Cv=new RegExp("^bytes([0-9]+)$"),Lv=new RegExp("^(u?int)([0-9]*)$"),jv=new RegExp("^(.*)\\[([0-9]*)\\]$"),Dv=new yt("solidity/5.8.0");function Uv(t,e,r){switch(t){case"address":return r?xt(e,32):Mt(e);case"string":return Rr(e);case"bytes":return Mt(e);case"bool":return e=e?"0x01":"0x00",r?xt(e,32):Mt(e)}let n=t.match(Lv);if(n){let i=parseInt(n[2]||"256");return(n[2]&&String(i)!==n[2]||i%8!=0||0===i||i>256)&&Dv.throwArgumentError("invalid number type","type",t),r&&(i=256),xt(e=Gt.from(e).toTwos(i),i/8)}if(n=t.match(Cv),n){const i=parseInt(n[1]);return(String(i)!==n[1]||0===i||i>32)&&Dv.throwArgumentError("invalid bytes type","type",t),Mt(e).byteLength!==i&&Dv.throwArgumentError(`invalid value for ${t}`,"value",e),r?Mt((e+"0000000000000000000000000000000000000000000000000000000000000000").substring(0,66)):e}if(n=t.match(jv),n&&Array.isArray(e)){const r=n[1];parseInt(n[2]||String(e.length))!=e.length&&Dv.throwArgumentError(`invalid array length for ${t}`,"value",e);const i=[];return e.forEach(function(t){i.push(Uv(r,t,!0))}),St(i)}return Dv.throwArgumentError("invalid type","type",t)}function Fv(t,e){t.length!=e.length&&Dv.throwArgumentError("wrong number of values; expected ${ types.length }","values",e);const r=[];return t.forEach(function(t,n){r.push(Uv(t,e[n]))}),Bt(St(r))}const zv=new yt("units/5.8.0"),qv=["wei","kwei","mwei","gwei","szabo","finney","ether"];function Hv(t,e){if("string"==typeof e){const t=qv.indexOf(e);-1!==t&&(e=3*t)}return ne(t,null!=e?e:18)}function Kv(t,e){if("string"!=typeof t&&zv.throwArgumentError("value must be a string","value",t),"string"==typeof e){const t=qv.indexOf(e);-1!==t&&(e=3*t)}return ie(t,null!=e?e:18)}var Gv=Object.freeze({__proto__:null,AbiCoder:lb,ConstructorFragment:Ly,ErrorFragment:Uy,EventFragment:Py,FormatTypes:xy,Fragment:Ny,FunctionFragment:jy,HDNode:nv,Indexed:bb,Interface:_b,LogDescription:mb,Logger:yt,ParamType:Ry,RLP:xn,SigningKey:la,get SupportedAlgorithm(){return $o},TransactionDescription:gb,get TransactionTypes(){return ga},get UnicodeNormalizationForm(){return Mr},Utf8ErrorFuncs:xr,get Utf8ErrorReason(){return Sr},_TypedDataEncoder:Yn,_fetchData:cs,_toEscapedUtf8String:function(t,e){return'"'+Tr(t,e).map(t=>{if(t<256){switch(t){case 8:return"\\b";case 9:return"\\t";case 10:return"\\n";case 13:return"\\r";case 34:return'\\"';case 92:return"\\\\"}if(t>=32&&t<127)return String.fromCharCode(t)}return t<=65535?Br(t):Br(55296+((t-=65536)>>10&1023))+Br(56320+(1023&t))}).join("")+'"'},accessListify:Sa,arrayify:Mt,base58:je,base64:Ce,checkProperties:pe,checkResultErrors:Gy,commify:function(t){const e=String(t).split(".");(e.length>2||!e[0].match(/^-?[0-9]*$/)||e[1]&&!e[1].match(/^[0-9]*$/)||"."===t||"-."===t)&&zv.throwArgumentError("invalid value","value",t);let r=e[0],n="";for("-"===r.substring(0,1)&&(n="-",r=r.substring(1));"0"===r.substring(0,1);)r=r.substring(1);""===r&&(r="0");let i="";for(2===e.length&&(i="."+(e[1]||"0"));i.length>2&&"0"===i[i.length-1];)i=i.substring(0,i.length-1);const o=[];for(;r.length;){if(r.length<=3){o.unshift(r);break}{const t=r.length-3;o.unshift(r.substring(t)),r=r.substring(0,t)}}return n+o.join(",")+i},computeAddress:_a,computeHmac:ns,computePublicKey:pa,concat:St,deepCopy:ve,defaultAbiCoder:db,defaultPath:rv,defineReadOnly:fe,dnsEncode:yn,entropyToMnemonic:sv,fetchJson:fs,formatBytes32String:function(t){const e=Rr(t);if(e.length>31)throw new Error("bytes32 string must be less than 32 bytes");return Bt(St([e,We]).slice(0,32))},formatEther:function(t){return Hv(t,18)},formatUnits:Hv,getAccountPath:function(t){return("number"!=typeof t||t<0||t>=Zb||t%1)&&Vb.throwArgumentError("invalid account index","index",t),`m/44'/60'/${t}'/0/0`},getAddress:In,getContractAddress:On,getCreate2Address:function(t,e,r){return 32!==Nt(e)&&Tn.throwArgumentError("salt must be 32 bytes","salt",e),32!==Nt(r)&&Tn.throwArgumentError("initCodeHash must be 32 bytes","initCodeHash",r),In(Pt(Er(St(["0xff",In(t),e,r])),12))},getIcapAddress:function(t){let e=(r=In(t).substring(2),new Ft(r,16).toString(36)).toUpperCase();for(var r;e.length<30;)e="0"+e;return"XE"+Pn("XE00"+e)+e},getJsonWalletAddress:function(t){if(bv(t))try{return In(JSON.parse(t).ethaddr)}catch(t){return null}if(vv(t))try{return In(JSON.parse(t).address)}catch(t){return null}return null},getStatic:le,hashMessage:bn,hexConcat:It,hexDataLength:Nt,hexDataSlice:Pt,hexStripZeros:Ct,hexValue:Ot,hexZeroPad:Lt,hexlify:Bt,id:Kr,isAddress:function(t){try{return In(t),!0}catch(t){}return!1},isBytes:At,isBytesLike:_t,isHexString:Tt,isValidMnemonic:function(t,e){try{return ov(t,e),!0}catch(t){}return!1},isValidName:function(t){try{return 0!==mn(t).length}catch(t){}return!1},joinSignature:Dt,keccak256:Er,mnemonicToEntropy:ov,mnemonicToSeed:iv,namehash:gn,nameprep:function(t){if(t.match(/^[a-z0-9-]*$/i)&&t.length<=59)return t.toLowerCase();let e=Ir(t);var r;r=e.map(t=>{if(Dr.indexOf(t)>=0)return[];if(t>=65024&&t<=65039)return[];let e=function(t){let e=Lr(t,Ur);if(e)return[t+e.s];let r=Fr[t];if(r)return r;let n=zr[t];return n?[t+n[0]]:qr[t]||null}(t);return e||[t]}),e=r.reduce((t,e)=>(e.forEach(e=>{t.push(e)}),t),[]),e=Ir(Nr(e),Mr.NFKC),e.forEach(t=>{if(Lr(t,Hr))throw new Error("STRINGPREP_CONTAINS_PROHIBITED")}),e.forEach(t=>{if(Lr(t,jr))throw new Error("STRINGPREP_CONTAINS_UNASSIGNED")});let n=Nr(e);if("-"===n.substring(0,1)||"--"===n.substring(2,4)||"-"===n.substring(n.length-1))throw new Error("invalid hyphen");return n},parseBytes32String:function(t){const e=Mt(t);if(32!==e.length)throw new Error("invalid bytes32 - not 32 bytes long");if(0!==e[31])throw new Error("invalid bytes32 string - no null terminator");let r=31;for(;0===e[r-1];)r--;return Pr(e.slice(0,r))},parseEther:function(t){return Kv(t,18)},parseTransaction:Na,parseUnits:Kv,poll:ls,randomBytes:ih,recoverAddress:Ea,recoverPublicKey:da,resolveProperties:de,ripemd160:es,serializeTransaction:Ra,sha256:rs,sha512:function(t){return"0x"+Qo.sha512().update(Mt(t)).digest("hex")},shallowCopy:me,shuffled:oh,solidityKeccak256:function(t,e){return Er(Fv(t,e))},solidityPack:Fv,soliditySha256:function(t,e){return rs(Fv(t,e))},splitSignature:jt,stripZeros:kt,toUtf8Bytes:Rr,toUtf8CodePoints:Ir,toUtf8String:Pr,verifyMessage:function(t,e){return Ea(bn(t),e)},verifyTypedData:function(t,e,r,n){return Ea(Yn.hash(t,e,r),n)},zeroPad:xt});const Vv="ethers/5.8.0",Wv=new yt(Vv);var Jv=Object.freeze({__proto__:null,BaseContract:Lb,BigNumber:Gt,Contract:jb,ContractFactory:Db,FixedNumber:se,Signer:lu,VoidSigner:du,Wallet:Ov,Wordlist:zb,constants:Je,get errors(){return mt},getDefaultProvider:jh,logger:Wv,providers:Uh,utils:Gv,version:Vv,wordlists:Gb});try{const t=window;null==t._ethers&&(t._ethers=Jv)}catch(bj){}var Zv=n(Object.freeze({__proto__:null,BaseContract:Lb,BigNumber:Gt,Contract:jb,ContractFactory:Db,FixedNumber:se,Signer:lu,VoidSigner:du,Wallet:Ov,Wordlist:zb,constants:Je,get errors(){return mt},ethers:Jv,getDefaultProvider:jh,logger:Wv,providers:Uh,utils:Gv,version:Vv,wordlists:Gb})),Yv=e&&e.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Gl,"__esModule",{value:!0});const Xv=Yv(Vl),$v=Yv(rm),Qv=Zv;class tw extends Xv.default{get publicKey(){return _.from(this.pk,"hex")}constructor(t){const e=_.from(t,"hex"),r=$v.default.publicKeyCreate(e,!1);super(t,_.from(r))}sign(t){return new Qv.ethers.Wallet(this._key).signMessage(t).then(t=>_.from(t.slice(2),"hex"))}static async verify(t,e,r){const n=Qv.ethers.utils.computeAddress(t);return Qv.ethers.utils.verifyMessage(e,r)===n}}var ew=Gl.default=tw,rw={},nw={},iw={},ow={},sw={exports:{}},aw=65536,uw=4294967295;var hw=yg.Buffer,cw=e.crypto||e.msCrypto;cw&&cw.getRandomValues?sw.exports=function(t,e){if(t>uw)throw new RangeError("requested too many random bytes");var r=hw.allocUnsafe(t);if(t>0)if(t>aw)for(var n=0;n<t;n+=aw)cw.getRandomValues(r.slice(n,n+aw));else cw.getRandomValues(r);if("function"==typeof e)return vr.nextTick(function(){e(null,r)});return r}:sw.exports=function(){throw new Error("Secure random number generation is not supported by this browser.\nUse Chrome, Firefox or Internet Explorer 11")};var fw=sw.exports,lw=yg.Buffer,dw=$g.Transform;function pw(t){dw.call(this),this._block=lw.allocUnsafe(t),this._blockSize=t,this._blockOffset=0,this._length=[0,0,0,0],this._finalized=!1}ri(pw,dw),pw.prototype._transform=function(t,e,r){var n=null;try{this.update(t,e)}catch(t){n=t}r(n)},pw.prototype._flush=function(t){var e=null;try{this.push(this.digest())}catch(t){e=t}t(e)},pw.prototype.update=function(t,e){if(function(t,e){if(!lw.isBuffer(t)&&"string"!=typeof t)throw new TypeError(e+" must be a string or a buffer")}(t,"Data"),this._finalized)throw new Error("Digest already called");lw.isBuffer(t)||(t=lw.from(t,e));for(var r=this._block,n=0;this._blockOffset+t.length-n>=this._blockSize;){for(var i=this._blockOffset;i<this._blockSize;)r[i++]=t[n++];this._update(),this._blockOffset=0}for(;n<t.length;)r[this._blockOffset++]=t[n++];for(var o=0,s=8*t.length;s>0;++o)this._length[o]+=s,(s=this._length[o]/4294967296|0)>0&&(this._length[o]-=4294967296*s);return this},pw.prototype._update=function(){throw new Error("_update is not implemented")},pw.prototype.digest=function(t){if(this._finalized)throw new Error("Digest already called");this._finalized=!0;var e=this._digest();void 0!==t&&(e=e.toString(t)),this._block.fill(0),this._blockOffset=0;for(var r=0;r<4;++r)this._length[r]=0;return e},pw.prototype._digest=function(){throw new Error("_digest is not implemented")};var mw=ri,gw=pw,yw=yg.Buffer,bw=new Array(16);function vw(){gw.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878}function ww(t,e){return t<<e|t>>>32-e}function _w(t,e,r,n,i,o,s){return ww(t+(e&r|~e&n)+i+o|0,s)+e|0}function Ew(t,e,r,n,i,o,s){return ww(t+(e&n|r&~n)+i+o|0,s)+e|0}function Aw(t,e,r,n,i,o,s){return ww(t+(e^r^n)+i+o|0,s)+e|0}function Mw(t,e,r,n,i,o,s){return ww(t+(r^(e|~n))+i+o|0,s)+e|0}mw(vw,gw),vw.prototype._update=function(){for(var t=bw,e=0;e<16;++e)t[e]=this._block.readInt32LE(4*e);var r=this._a,n=this._b,i=this._c,o=this._d;r=_w(r,n,i,o,t[0],3614090360,7),o=_w(o,r,n,i,t[1],3905402710,12),i=_w(i,o,r,n,t[2],606105819,17),n=_w(n,i,o,r,t[3],3250441966,22),r=_w(r,n,i,o,t[4],4118548399,7),o=_w(o,r,n,i,t[5],1200080426,12),i=_w(i,o,r,n,t[6],2821735955,17),n=_w(n,i,o,r,t[7],4249261313,22),r=_w(r,n,i,o,t[8],1770035416,7),o=_w(o,r,n,i,t[9],2336552879,12),i=_w(i,o,r,n,t[10],4294925233,17),n=_w(n,i,o,r,t[11],2304563134,22),r=_w(r,n,i,o,t[12],1804603682,7),o=_w(o,r,n,i,t[13],4254626195,12),i=_w(i,o,r,n,t[14],2792965006,17),r=Ew(r,n=_w(n,i,o,r,t[15],1236535329,22),i,o,t[1],4129170786,5),o=Ew(o,r,n,i,t[6],3225465664,9),i=Ew(i,o,r,n,t[11],643717713,14),n=Ew(n,i,o,r,t[0],3921069994,20),r=Ew(r,n,i,o,t[5],3593408605,5),o=Ew(o,r,n,i,t[10],38016083,9),i=Ew(i,o,r,n,t[15],3634488961,14),n=Ew(n,i,o,r,t[4],3889429448,20),r=Ew(r,n,i,o,t[9],568446438,5),o=Ew(o,r,n,i,t[14],3275163606,9),i=Ew(i,o,r,n,t[3],4107603335,14),n=Ew(n,i,o,r,t[8],1163531501,20),r=Ew(r,n,i,o,t[13],2850285829,5),o=Ew(o,r,n,i,t[2],4243563512,9),i=Ew(i,o,r,n,t[7],1735328473,14),r=Aw(r,n=Ew(n,i,o,r,t[12],2368359562,20),i,o,t[5],4294588738,4),o=Aw(o,r,n,i,t[8],2272392833,11),i=Aw(i,o,r,n,t[11],1839030562,16),n=Aw(n,i,o,r,t[14],4259657740,23),r=Aw(r,n,i,o,t[1],2763975236,4),o=Aw(o,r,n,i,t[4],1272893353,11),i=Aw(i,o,r,n,t[7],4139469664,16),n=Aw(n,i,o,r,t[10],3200236656,23),r=Aw(r,n,i,o,t[13],681279174,4),o=Aw(o,r,n,i,t[0],3936430074,11),i=Aw(i,o,r,n,t[3],3572445317,16),n=Aw(n,i,o,r,t[6],76029189,23),r=Aw(r,n,i,o,t[9],3654602809,4),o=Aw(o,r,n,i,t[12],3873151461,11),i=Aw(i,o,r,n,t[15],530742520,16),r=Mw(r,n=Aw(n,i,o,r,t[2],3299628645,23),i,o,t[0],4096336452,6),o=Mw(o,r,n,i,t[7],1126891415,10),i=Mw(i,o,r,n,t[14],2878612391,15),n=Mw(n,i,o,r,t[5],4237533241,21),r=Mw(r,n,i,o,t[12],1700485571,6),o=Mw(o,r,n,i,t[3],2399980690,10),i=Mw(i,o,r,n,t[10],4293915773,15),n=Mw(n,i,o,r,t[1],2240044497,21),r=Mw(r,n,i,o,t[8],1873313359,6),o=Mw(o,r,n,i,t[15],4264355552,10),i=Mw(i,o,r,n,t[6],2734768916,15),n=Mw(n,i,o,r,t[13],1309151649,21),r=Mw(r,n,i,o,t[4],4149444226,6),o=Mw(o,r,n,i,t[11],3174756917,10),i=Mw(i,o,r,n,t[2],718787259,15),n=Mw(n,i,o,r,t[9],3951481745,21),this._a=this._a+r|0,this._b=this._b+n|0,this._c=this._c+i|0,this._d=this._d+o|0},vw.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var t=yw.allocUnsafe(16);return t.writeInt32LE(this._a,0),t.writeInt32LE(this._b,4),t.writeInt32LE(this._c,8),t.writeInt32LE(this._d,12),t};var Sw=vw,kw=yg.Buffer,xw=$g.Transform;function Tw(t){xw.call(this),this._block=kw.allocUnsafe(t),this._blockSize=t,this._blockOffset=0,this._length=[0,0,0,0],this._finalized=!1}ri(Tw,xw),Tw.prototype._transform=function(t,e,r){var n=null;try{this.update(t,e)}catch(t){n=t}r(n)},Tw.prototype._flush=function(t){var e=null;try{this.push(this.digest())}catch(t){e=t}t(e)},Tw.prototype.update=function(t,e){if(function(t,e){if(!kw.isBuffer(t)&&"string"!=typeof t)throw new TypeError(e+" must be a string or a buffer")}(t,"Data"),this._finalized)throw new Error("Digest already called");kw.isBuffer(t)||(t=kw.from(t,e));for(var r=this._block,n=0;this._blockOffset+t.length-n>=this._blockSize;){for(var i=this._blockOffset;i<this._blockSize;)r[i++]=t[n++];this._update(),this._blockOffset=0}for(;n<t.length;)r[this._blockOffset++]=t[n++];for(var o=0,s=8*t.length;s>0;++o)this._length[o]+=s,(s=this._length[o]/4294967296|0)>0&&(this._length[o]-=4294967296*s);return this},Tw.prototype._update=function(){throw new Error("_update is not implemented")},Tw.prototype.digest=function(t){if(this._finalized)throw new Error("Digest already called");this._finalized=!0;var e=this._digest();void 0!==t&&(e=e.toString(t)),this._block.fill(0),this._blockOffset=0;for(var r=0;r<4;++r)this._length[r]=0;return e},Tw.prototype._digest=function(){throw new Error("_digest is not implemented")};var Rw=Tw,Bw=st.Buffer,Nw=ri,Pw=Rw,Iw=new Array(16),Ow=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],Cw=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],Lw=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],jw=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11],Dw=[0,1518500249,1859775393,2400959708,2840853838],Uw=[1352829926,1548603684,1836072691,2053994217,0];function Fw(){Pw.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520}function zw(t,e){return t<<e|t>>>32-e}function qw(t,e,r,n,i,o,s,a){return zw(t+(e^r^n)+o+s|0,a)+i|0}function Hw(t,e,r,n,i,o,s,a){return zw(t+(e&r|~e&n)+o+s|0,a)+i|0}function Kw(t,e,r,n,i,o,s,a){return zw(t+((e|~r)^n)+o+s|0,a)+i|0}function Gw(t,e,r,n,i,o,s,a){return zw(t+(e&n|r&~n)+o+s|0,a)+i|0}function Vw(t,e,r,n,i,o,s,a){return zw(t+(e^(r|~n))+o+s|0,a)+i|0}Nw(Fw,Pw),Fw.prototype._update=function(){for(var t=Iw,e=0;e<16;++e)t[e]=this._block.readInt32LE(4*e);for(var r=0|this._a,n=0|this._b,i=0|this._c,o=0|this._d,s=0|this._e,a=0|this._a,u=0|this._b,h=0|this._c,c=0|this._d,f=0|this._e,l=0;l<80;l+=1){var d,p;l<16?(d=qw(r,n,i,o,s,t[Ow[l]],Dw[0],Lw[l]),p=Vw(a,u,h,c,f,t[Cw[l]],Uw[0],jw[l])):l<32?(d=Hw(r,n,i,o,s,t[Ow[l]],Dw[1],Lw[l]),p=Gw(a,u,h,c,f,t[Cw[l]],Uw[1],jw[l])):l<48?(d=Kw(r,n,i,o,s,t[Ow[l]],Dw[2],Lw[l]),p=Kw(a,u,h,c,f,t[Cw[l]],Uw[2],jw[l])):l<64?(d=Gw(r,n,i,o,s,t[Ow[l]],Dw[3],Lw[l]),p=Hw(a,u,h,c,f,t[Cw[l]],Uw[3],jw[l])):(d=Vw(r,n,i,o,s,t[Ow[l]],Dw[4],Lw[l]),p=qw(a,u,h,c,f,t[Cw[l]],Uw[4],jw[l])),r=s,s=o,o=zw(i,10),i=n,n=d,a=f,f=c,c=zw(h,10),h=u,u=p}var m=this._b+i+c|0;this._b=this._c+o+f|0,this._c=this._d+s+a|0,this._d=this._e+r+u|0,this._e=this._a+n+h|0,this._a=m},Fw.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var t=Bw.alloc?Bw.alloc(20):new Bw(20);return t.writeInt32LE(this._a,0),t.writeInt32LE(this._b,4),t.writeInt32LE(this._c,8),t.writeInt32LE(this._d,12),t.writeInt32LE(this._e,16),t};var Ww=Fw,Jw={exports:{}},Zw={}.toString,Yw=Array.isArray||function(t){return"[object Array]"==Zw.call(t)},Xw=TypeError,$w=Object,Qw=Error,t_=EvalError,e_=RangeError,r_=ReferenceError,n_=SyntaxError,i_=URIError,o_=Math.abs,s_=Math.floor,a_=Math.max,u_=Math.min,h_=Math.pow,c_=Math.round,f_=Number.isNaN||function(t){return t!=t},l_=Object.getOwnPropertyDescriptor;if(l_)try{l_([],"length")}catch(t){l_=null}var d_=l_,p_=Object.defineProperty||!1;if(p_)try{p_({},"a",{value:1})}catch(t){p_=!1}var m_,g_,y_,b_,v_,w_,__,E_,A_=p_;function M_(){return g_?m_:(g_=1,m_=function(){if("function"!=typeof Symbol||"function"!=typeof Object.getOwnPropertySymbols)return!1;if("symbol"==typeof Symbol.iterator)return!0;var t={},e=Symbol("test"),r=Object(e);if("string"==typeof e)return!1;if("[object Symbol]"!==Object.prototype.toString.call(e))return!1;if("[object Symbol]"!==Object.prototype.toString.call(r))return!1;for(var n in t[e]=42,t)return!1;if("function"==typeof Object.keys&&0!==Object.keys(t).length)return!1;if("function"==typeof Object.getOwnPropertyNames&&0!==Object.getOwnPropertyNames(t).length)return!1;var i=Object.getOwnPropertySymbols(t);if(1!==i.length||i[0]!==e)return!1;if(!Object.prototype.propertyIsEnumerable.call(t,e))return!1;if("function"==typeof Object.getOwnPropertyDescriptor){var o=Object.getOwnPropertyDescriptor(t,e);if(42!==o.value||!0!==o.enumerable)return!1}return!0})}function S_(){return w_?v_:(w_=1,v_="undefined"!=typeof Reflect&&Reflect.getPrototypeOf||null)}function k_(){return E_?__:(E_=1,__=$w.getPrototypeOf||null)}var x_,T_,R_=Object.prototype.toString,B_=Math.max,N_=function(t,e){for(var r=[],n=0;n<t.length;n+=1)r[n]=t[n];for(var i=0;i<e.length;i+=1)r[i+t.length]=e[i];return r},P_=function(t){var e=this;if("function"!=typeof e||"[object Function]"!==R_.apply(e))throw new TypeError("Function.prototype.bind called on incompatible "+e);for(var r,n=function(t,e){for(var r=[],n=e||0,i=0;n<t.length;n+=1,i+=1)r[i]=t[n];return r}(arguments,1),i=B_(0,e.length-n.length),o=[],s=0;s<i;s++)o[s]="$"+s;if(r=Function("binder","return function ("+function(t,e){for(var r="",n=0;n<t.length;n+=1)r+=t[n],n+1<t.length&&(r+=e);return r}(o,",")+"){ return binder.apply(this,arguments); }")(function(){if(this instanceof r){var i=e.apply(this,N_(n,arguments));return Object(i)===i?i:this}return e.apply(t,N_(n,arguments))}),e.prototype){var a=function(){};a.prototype=e.prototype,r.prototype=new a,a.prototype=null}return r},I_=Function.prototype.bind||P_,O_=Function.prototype.call;function C_(){return T_?x_:(T_=1,x_=Function.prototype.apply)}var L_,j_,D_,U_,F_,z_,q_,H_="undefined"!=typeof Reflect&&Reflect&&Reflect.apply,K_=I_,G_=C_(),V_=O_,W_=H_||K_.call(V_,G_),J_=I_,Z_=Xw,Y_=O_,X_=W_,$_=function(t){if(t.length<1||"function"!=typeof t[0])throw new Z_("a function is required");return X_(J_,Y_,t)};function Q_(){if(U_)return D_;U_=1;var t=S_(),e=k_(),r=function(){if(j_)return L_;j_=1;var t,e=$_,r=d_;try{t=[].__proto__===Array.prototype}catch(t){if(!t||"object"!=typeof t||!("code"in t)||"ERR_PROTO_ACCESS"!==t.code)throw t}var n=!!t&&r&&r(Object.prototype,"__proto__"),i=Object,o=i.getPrototypeOf;return L_=n&&"function"==typeof n.get?e([n.get]):"function"==typeof o&&function(t){return o(null==t?t:i(t))}}();return D_=t?function(e){return t(e)}:e?function(t){if(!t||"object"!=typeof t&&"function"!=typeof t)throw new TypeError("getProto: not an object");return e(t)}:r?function(t){return r(t)}:null}var tE=$w,eE=Qw,rE=t_,nE=e_,iE=r_,oE=n_,sE=Xw,aE=i_,uE=o_,hE=s_,cE=a_,fE=u_,lE=h_,dE=c_,pE=function(t){return f_(t)||0===t?t:t<0?-1:1},mE=Function,gE=function(t){try{return mE('"use strict"; return ('+t+").constructor;")()}catch(t){}},yE=d_,bE=A_,vE=function(){throw new sE},wE=yE?function(){try{return vE}catch(t){try{return yE(arguments,"callee").get}catch(t){return vE}}}():vE,_E=function(){if(b_)return y_;b_=1;var t="undefined"!=typeof Symbol&&Symbol,e=M_();return y_=function(){return"function"==typeof t&&("function"==typeof Symbol&&("symbol"==typeof t("foo")&&("symbol"==typeof Symbol("bar")&&e())))}}()(),EE=Q_(),AE=k_(),ME=S_(),SE=C_(),kE=O_,xE={},TE="undefined"!=typeof Uint8Array&&EE?EE(Uint8Array):q_,RE={__proto__:null,"%AggregateError%":"undefined"==typeof AggregateError?q_:AggregateError,"%Array%":Array,"%ArrayBuffer%":"undefined"==typeof ArrayBuffer?q_:ArrayBuffer,"%ArrayIteratorPrototype%":_E&&EE?EE([][Symbol.iterator]()):q_,"%AsyncFromSyncIteratorPrototype%":q_,"%AsyncFunction%":xE,"%AsyncGenerator%":xE,"%AsyncGeneratorFunction%":xE,"%AsyncIteratorPrototype%":xE,"%Atomics%":"undefined"==typeof Atomics?q_:Atomics,"%BigInt%":"undefined"==typeof BigInt?q_:BigInt,"%BigInt64Array%":"undefined"==typeof BigInt64Array?q_:BigInt64Array,"%BigUint64Array%":"undefined"==typeof BigUint64Array?q_:BigUint64Array,"%Boolean%":Boolean,"%DataView%":"undefined"==typeof DataView?q_:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":eE,"%eval%":eval,"%EvalError%":rE,"%Float16Array%":"undefined"==typeof Float16Array?q_:Float16Array,"%Float32Array%":"undefined"==typeof Float32Array?q_:Float32Array,"%Float64Array%":"undefined"==typeof Float64Array?q_:Float64Array,"%FinalizationRegistry%":"undefined"==typeof FinalizationRegistry?q_:FinalizationRegistry,"%Function%":mE,"%GeneratorFunction%":xE,"%Int8Array%":"undefined"==typeof Int8Array?q_:Int8Array,"%Int16Array%":"undefined"==typeof Int16Array?q_:Int16Array,"%Int32Array%":"undefined"==typeof Int32Array?q_:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":_E&&EE?EE(EE([][Symbol.iterator]())):q_,"%JSON%":"object"==typeof JSON?JSON:q_,"%Map%":"undefined"==typeof Map?q_:Map,"%MapIteratorPrototype%":"undefined"!=typeof Map&&_E&&EE?EE((new Map)[Symbol.iterator]()):q_,"%Math%":Math,"%Number%":Number,"%Object%":tE,"%Object.getOwnPropertyDescriptor%":yE,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":"undefined"==typeof Promise?q_:Promise,"%Proxy%":"undefined"==typeof Proxy?q_:Proxy,"%RangeError%":nE,"%ReferenceError%":iE,"%Reflect%":"undefined"==typeof Reflect?q_:Reflect,"%RegExp%":RegExp,"%Set%":"undefined"==typeof Set?q_:Set,"%SetIteratorPrototype%":"undefined"!=typeof Set&&_E&&EE?EE((new Set)[Symbol.iterator]()):q_,"%SharedArrayBuffer%":"undefined"==typeof SharedArrayBuffer?q_:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":_E&&EE?EE(""[Symbol.iterator]()):q_,"%Symbol%":_E?Symbol:q_,"%SyntaxError%":oE,"%ThrowTypeError%":wE,"%TypedArray%":TE,"%TypeError%":sE,"%Uint8Array%":"undefined"==typeof Uint8Array?q_:Uint8Array,"%Uint8ClampedArray%":"undefined"==typeof Uint8ClampedArray?q_:Uint8ClampedArray,"%Uint16Array%":"undefined"==typeof Uint16Array?q_:Uint16Array,"%Uint32Array%":"undefined"==typeof Uint32Array?q_:Uint32Array,"%URIError%":aE,"%WeakMap%":"undefined"==typeof WeakMap?q_:WeakMap,"%WeakRef%":"undefined"==typeof WeakRef?q_:WeakRef,"%WeakSet%":"undefined"==typeof WeakSet?q_:WeakSet,"%Function.prototype.call%":kE,"%Function.prototype.apply%":SE,"%Object.defineProperty%":bE,"%Object.getPrototypeOf%":AE,"%Math.abs%":uE,"%Math.floor%":hE,"%Math.max%":cE,"%Math.min%":fE,"%Math.pow%":lE,"%Math.round%":dE,"%Math.sign%":pE,"%Reflect.getPrototypeOf%":ME};if(EE)try{null.error}catch(t){var BE=EE(EE(t));RE["%Error.prototype%"]=BE}var NE,PE,IE,OE,CE,LE,jE,DE,UE=function t(e){var r;if("%AsyncFunction%"===e)r=gE("async function () {}");else if("%GeneratorFunction%"===e)r=gE("function* () {}");else if("%AsyncGeneratorFunction%"===e)r=gE("async function* () {}");else if("%AsyncGenerator%"===e){var n=t("%AsyncGeneratorFunction%");n&&(r=n.prototype)}else if("%AsyncIteratorPrototype%"===e){var i=t("%AsyncGenerator%");i&&EE&&(r=EE(i.prototype))}return RE[e]=r,r},FE={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},zE=I_,qE=function(){if(z_)return F_;z_=1;var t=Function.prototype.call,e=Object.prototype.hasOwnProperty;return F_=I_.call(t,e)}(),HE=zE.call(kE,Array.prototype.concat),KE=zE.call(SE,Array.prototype.splice),GE=zE.call(kE,String.prototype.replace),VE=zE.call(kE,String.prototype.slice),WE=zE.call(kE,RegExp.prototype.exec),JE=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,ZE=/\\(\\)?/g,YE=function(t,e){var r,n=t;if(qE(FE,n)&&(n="%"+(r=FE[n])[0]+"%"),qE(RE,n)){var i=RE[n];if(i===xE&&(i=UE(n)),void 0===i&&!e)throw new sE("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:r,name:n,value:i}}throw new oE("intrinsic "+t+" does not exist!")},XE=function(t,e){if("string"!=typeof t||0===t.length)throw new sE("intrinsic name must be a non-empty string");if(arguments.length>1&&"boolean"!=typeof e)throw new sE('"allowMissing" argument must be a boolean');if(null===WE(/^%?[^%]*%?$/,t))throw new oE("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var r=function(t){var e=VE(t,0,1),r=VE(t,-1);if("%"===e&&"%"!==r)throw new oE("invalid intrinsic syntax, expected closing `%`");if("%"===r&&"%"!==e)throw new oE("invalid intrinsic syntax, expected opening `%`");var n=[];return GE(t,JE,function(t,e,r,i){n[n.length]=r?GE(i,ZE,"$1"):e||t}),n}(t),n=r.length>0?r[0]:"",i=YE("%"+n+"%",e),o=i.name,s=i.value,a=!1,u=i.alias;u&&(n=u[0],KE(r,HE([0,1],u)));for(var h=1,c=!0;h<r.length;h+=1){var f=r[h],l=VE(f,0,1),d=VE(f,-1);if(('"'===l||"'"===l||"`"===l||'"'===d||"'"===d||"`"===d)&&l!==d)throw new oE("property names with quotes must have matching quotes");if("constructor"!==f&&c||(a=!0),qE(RE,o="%"+(n+="."+f)+"%"))s=RE[o];else if(null!=s){if(!(f in s)){if(!e)throw new sE("base intrinsic for "+t+" exists, but the property is not available.");return}if(yE&&h+1>=r.length){var p=yE(s,f);s=(c=!!p)&&"get"in p&&!("originalValue"in p.get)?p.get:s[f]}else c=qE(s,f),s=s[f];c&&!a&&(RE[o]=s)}}return s},$E=XE,QE=$_,tA=QE([$E("%String.prototype.indexOf%")]),eA=function(t,e){var r=$E(t,!!e);return"function"==typeof r&&tA(t,".prototype.")>-1?QE([r]):r};function rA(){if(PE)return NE;PE=1;var t,e,r=Function.prototype.toString,n="object"==typeof Reflect&&null!==Reflect&&Reflect.apply;if("function"==typeof n&&"function"==typeof Object.defineProperty)try{t=Object.defineProperty({},"length",{get:function(){throw e}}),e={},n(function(){throw 42},null,t)}catch(t){t!==e&&(n=null)}else n=null;var i=/^\s*class\b/,o=function(t){try{var e=r.call(t);return i.test(e)}catch(t){return!1}},s=function(t){try{return!o(t)&&(r.call(t),!0)}catch(t){return!1}},a=Object.prototype.toString,u="function"==typeof Symbol&&!!Symbol.toStringTag,h=!(0 in[,]),c=function(){return!1};if("object"==typeof document){var f=document.all;a.call(f)===a.call(document.all)&&(c=function(t){if((h||!t)&&(void 0===t||"object"==typeof t))try{var e=a.call(t);return("[object HTMLAllCollection]"===e||"[object HTML document.all class]"===e||"[object HTMLCollection]"===e||"[object Object]"===e)&&null==t("")}catch(t){}return!1})}return NE=n?function(r){if(c(r))return!0;if(!r)return!1;if("function"!=typeof r&&"object"!=typeof r)return!1;try{n(r,null,t)}catch(t){if(t!==e)return!1}return!o(r)&&s(r)}:function(t){if(c(t))return!0;if(!t)return!1;if("function"!=typeof t&&"object"!=typeof t)return!1;if(u)return s(t);if(o(t))return!1;var e=a.call(t);return!("[object Function]"!==e&&"[object GeneratorFunction]"!==e&&!/^\[object HTML/.test(e))&&s(t)}}function nA(){if(OE)return IE;OE=1;var t=rA(),e=Object.prototype.toString,r=Object.prototype.hasOwnProperty;return IE=function(n,i,o){if(!t(i))throw new TypeError("iterator must be a function");var s;arguments.length>=3&&(s=o),function(t){return"[object Array]"===e.call(t)}(n)?function(t,e,n){for(var i=0,o=t.length;i<o;i++)r.call(t,i)&&(null==n?e(t[i],i,t):e.call(n,t[i],i,t))}(n,i,s):"string"==typeof n?function(t,e,r){for(var n=0,i=t.length;n<i;n++)null==r?e(t.charAt(n),n,t):e.call(r,t.charAt(n),n,t)}(n,i,s):function(t,e,n){for(var i in t)r.call(t,i)&&(null==n?e(t[i],i,t):e.call(n,t[i],i,t))}(n,i,s)},IE}function iA(){if(DE)return jE;DE=1;var t=LE?CE:(LE=1,CE=["Float16Array","Float32Array","Float64Array","Int8Array","Int16Array","Int32Array","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array"]),r="undefined"==typeof globalThis?e:globalThis;return jE=function(){for(var e=[],n=0;n<t.length;n++)"function"==typeof r[t[n]]&&(e[e.length]=t[n]);return e},jE}var oA,sA,aA,uA,hA,cA,fA,lA,dA,pA,mA,gA,yA,bA,vA,wA={exports:{}};function _A(){if(cA)return hA;cA=1;var t=XE,e=function(){if(sA)return oA;sA=1;var t=A_,e=n_,r=Xw,n=d_;return oA=function(i,o,s){if(!i||"object"!=typeof i&&"function"!=typeof i)throw new r("`obj` must be an object or a function`");if("string"!=typeof o&&"symbol"!=typeof o)throw new r("`property` must be a string or a symbol`");if(arguments.length>3&&"boolean"!=typeof arguments[3]&&null!==arguments[3])throw new r("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&"boolean"!=typeof arguments[4]&&null!==arguments[4])throw new r("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&"boolean"!=typeof arguments[5]&&null!==arguments[5])throw new r("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&"boolean"!=typeof arguments[6])throw new r("`loose`, if provided, must be a boolean");var a=arguments.length>3?arguments[3]:null,u=arguments.length>4?arguments[4]:null,h=arguments.length>5?arguments[5]:null,c=arguments.length>6&&arguments[6],f=!!n&&n(i,o);if(t)t(i,o,{configurable:null===h&&f?f.configurable:!h,enumerable:null===a&&f?f.enumerable:!a,value:s,writable:null===u&&f?f.writable:!u});else{if(!c&&(a||u||h))throw new e("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.");i[o]=s}},oA}(),r=function(){if(uA)return aA;uA=1;var t=A_,e=function(){return!!t};return e.hasArrayLengthDefineBug=function(){if(!t)return null;try{return 1!==t([],"length",{value:1}).length}catch(t){return!0}},aA=e}()(),n=d_,i=Xw,o=t("%Math.floor%");return hA=function(t,s){if("function"!=typeof t)throw new i("`fn` is not a function");if("number"!=typeof s||s<0||s>4294967295||o(s)!==s)throw new i("`length` must be a positive 32-bit integer");var a=arguments.length>2&&!!arguments[2],u=!0,h=!0;if("length"in t&&n){var c=n(t,"length");c&&!c.configurable&&(u=!1),c&&!c.writable&&(h=!1)}return(u||h||!a)&&(r?e(t,"length",s,!0,!0):e(t,"length",s)),t},hA}function EA(){if(lA)return fA;lA=1;var t=I_,e=C_(),r=W_;return fA=function(){return r(t,e,arguments)},fA}function AA(){return dA||(dA=1,function(t){var e=_A(),r=A_,n=$_,i=EA();t.exports=function(t){var r=n(arguments),i=t.length-(arguments.length-1);return e(r,1+(i>0?i:0),!0)},r?r(t.exports,"apply",{value:i}):t.exports.apply=i}(wA)),wA.exports}function MA(){if(yA)return gA;yA=1;var t=nA(),r=iA(),n=AA(),i=eA,o=d_,s=Q_(),a=i("Object.prototype.toString"),u=function(){if(mA)return pA;mA=1;var t=M_();return pA=function(){return t()&&!!Symbol.toStringTag}}()(),h="undefined"==typeof globalThis?e:globalThis,c=r(),f=i("String.prototype.slice"),l=i("Array.prototype.indexOf",!0)||function(t,e){for(var r=0;r<t.length;r+=1)if(t[r]===e)return r;return-1},d={__proto__:null};t(c,u&&o&&s?function(t){var e=new h[t];if(Symbol.toStringTag in e&&s){var r=s(e),i=o(r,Symbol.toStringTag);if(!i&&r){var a=s(r);i=o(a,Symbol.toStringTag)}d["$"+t]=n(i.get)}}:function(t){var e=new h[t],r=e.slice||e.set;r&&(d["$"+t]=n(r))});return gA=function(e){if(!e||"object"!=typeof e)return!1;if(!u){var r=f(a(e),8,-1);return l(c,r)>-1?r:"Object"===r&&function(e){var r=!1;return t(d,function(t,n){if(!r)try{t(e),r=f(n,1)}catch(t){}}),r}(e)}return o?function(e){var r=!1;return t(d,function(t,n){if(!r)try{"$"+t(e)===n&&(r=f(n,1))}catch(t){}}),r}(e):null},gA}var SA=Xw,kA=eA("TypedArray.prototype.buffer",!0),xA=function(){if(vA)return bA;vA=1;var t=MA();return bA=function(e){return!!t(e)}}(),TA=kA||function(t){if(!xA(t))throw new SA("Not a Typed Array");return t.buffer},RA=yg.Buffer,BA=Yw,NA=TA,PA=ArrayBuffer.isView||function(t){try{return NA(t),!0}catch(t){return!1}},IA="undefined"!=typeof Uint8Array,OA="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof Uint8Array,CA=OA&&(RA.prototype instanceof Uint8Array||RA.TYPED_ARRAY_SUPPORT),LA=function(t,e){if(t instanceof RA)return t;if("string"==typeof t)return RA.from(t,e);if(OA&&PA(t)){if(0===t.byteLength)return RA.alloc(0);if(CA){var r=RA.from(t.buffer,t.byteOffset,t.byteLength);if(r.byteLength===t.byteLength)return r}var n=t instanceof Uint8Array?t:new Uint8Array(t.buffer,t.byteOffset,t.byteLength),i=RA.from(n);if(i.length===t.byteLength)return i}if(IA&&t instanceof Uint8Array)return RA.from(t);var o=BA(t);if(o)for(var s=0;s<t.length;s+=1){var a=t[s];if("number"!=typeof a||a<0||a>255||~~a!==a)throw new RangeError("Array items must be numbers in the range 0-255.")}if(o||RA.isBuffer(t)&&t.constructor&&"function"==typeof t.constructor.isBuffer&&t.constructor.isBuffer(t))return RA.from(t);throw new TypeError('The "data" argument must be a string, an Array, a Buffer, a Uint8Array, or a DataView.')},jA=yg.Buffer,DA=LA;function UA(t,e){this._block=jA.alloc(t),this._finalSize=e,this._blockSize=t,this._len=0}UA.prototype.update=function(t,e){t=DA(t,e||"utf8");for(var r=this._block,n=this._blockSize,i=t.length,o=this._len,s=0;s<i;){for(var a=o%n,u=Math.min(i-s,n-a),h=0;h<u;h++)r[a+h]=t[s+h];s+=u,(o+=u)%n===0&&this._update(r)}return this._len+=i,this},UA.prototype.digest=function(t){var e=this._len%this._blockSize;this._block[e]=128,this._block.fill(0,e+1),e>=this._finalSize&&(this._update(this._block),this._block.fill(0));var r=8*this._len;if(r<=4294967295)this._block.writeUInt32BE(r,this._blockSize-4);else{var n=(4294967295&r)>>>0,i=(r-n)/4294967296;this._block.writeUInt32BE(i,this._blockSize-8),this._block.writeUInt32BE(n,this._blockSize-4)}this._update(this._block);var o=this._hash();return t?o.toString(t):o},UA.prototype._update=function(){throw new Error("_update must be implemented by subclass")};var FA=UA,zA=ri,qA=FA,HA=yg.Buffer,KA=[1518500249,1859775393,-1894007588,-899497514],GA=new Array(80);function VA(){this.init(),this._w=GA,qA.call(this,64,56)}function WA(t){return t<<5|t>>>27}function JA(t){return t<<30|t>>>2}function ZA(t,e,r,n){return 0===t?e&r|~e&n:2===t?e&r|e&n|r&n:e^r^n}zA(VA,qA),VA.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},VA.prototype._update=function(t){for(var e=this._w,r=0|this._a,n=0|this._b,i=0|this._c,o=0|this._d,s=0|this._e,a=0;a<16;++a)e[a]=t.readInt32BE(4*a);for(;a<80;++a)e[a]=e[a-3]^e[a-8]^e[a-14]^e[a-16];for(var u=0;u<80;++u){var h=~~(u/20),c=WA(r)+ZA(h,n,i,o)+s+e[u]+KA[h]|0;s=o,o=i,i=JA(n),n=r,r=c}this._a=r+this._a|0,this._b=n+this._b|0,this._c=i+this._c|0,this._d=o+this._d|0,this._e=s+this._e|0},VA.prototype._hash=function(){var t=HA.allocUnsafe(20);return t.writeInt32BE(0|this._a,0),t.writeInt32BE(0|this._b,4),t.writeInt32BE(0|this._c,8),t.writeInt32BE(0|this._d,12),t.writeInt32BE(0|this._e,16),t};var YA=VA,XA=ri,$A=FA,QA=yg.Buffer,tM=[1518500249,1859775393,-1894007588,-899497514],eM=new Array(80);function rM(){this.init(),this._w=eM,$A.call(this,64,56)}function nM(t){return t<<1|t>>>31}function iM(t){return t<<5|t>>>27}function oM(t){return t<<30|t>>>2}function sM(t,e,r,n){return 0===t?e&r|~e&n:2===t?e&r|e&n|r&n:e^r^n}XA(rM,$A),rM.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},rM.prototype._update=function(t){for(var e=this._w,r=0|this._a,n=0|this._b,i=0|this._c,o=0|this._d,s=0|this._e,a=0;a<16;++a)e[a]=t.readInt32BE(4*a);for(;a<80;++a)e[a]=nM(e[a-3]^e[a-8]^e[a-14]^e[a-16]);for(var u=0;u<80;++u){var h=~~(u/20),c=iM(r)+sM(h,n,i,o)+s+e[u]+tM[h]|0;s=o,o=i,i=oM(n),n=r,r=c}this._a=r+this._a|0,this._b=n+this._b|0,this._c=i+this._c|0,this._d=o+this._d|0,this._e=s+this._e|0},rM.prototype._hash=function(){var t=QA.allocUnsafe(20);return t.writeInt32BE(0|this._a,0),t.writeInt32BE(0|this._b,4),t.writeInt32BE(0|this._c,8),t.writeInt32BE(0|this._d,12),t.writeInt32BE(0|this._e,16),t};var aM=rM,uM=ri,hM=FA,cM=yg.Buffer,fM=[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],lM=new Array(64);function dM(){this.init(),this._w=lM,hM.call(this,64,56)}function pM(t,e,r){return r^t&(e^r)}function mM(t,e,r){return t&e|r&(t|e)}function gM(t){return(t>>>2|t<<30)^(t>>>13|t<<19)^(t>>>22|t<<10)}function yM(t){return(t>>>6|t<<26)^(t>>>11|t<<21)^(t>>>25|t<<7)}function bM(t){return(t>>>7|t<<25)^(t>>>18|t<<14)^t>>>3}function vM(t){return(t>>>17|t<<15)^(t>>>19|t<<13)^t>>>10}uM(dM,hM),dM.prototype.init=function(){return this._a=1779033703,this._b=3144134277,this._c=1013904242,this._d=2773480762,this._e=1359893119,this._f=2600822924,this._g=528734635,this._h=1541459225,this},dM.prototype._update=function(t){for(var e=this._w,r=0|this._a,n=0|this._b,i=0|this._c,o=0|this._d,s=0|this._e,a=0|this._f,u=0|this._g,h=0|this._h,c=0;c<16;++c)e[c]=t.readInt32BE(4*c);for(;c<64;++c)e[c]=vM(e[c-2])+e[c-7]+bM(e[c-15])+e[c-16]|0;for(var f=0;f<64;++f){var l=h+yM(s)+pM(s,a,u)+fM[f]+e[f]|0,d=gM(r)+mM(r,n,i)|0;h=u,u=a,a=s,s=o+l|0,o=i,i=n,n=r,r=l+d|0}this._a=r+this._a|0,this._b=n+this._b|0,this._c=i+this._c|0,this._d=o+this._d|0,this._e=s+this._e|0,this._f=a+this._f|0,this._g=u+this._g|0,this._h=h+this._h|0},dM.prototype._hash=function(){var t=cM.allocUnsafe(32);return t.writeInt32BE(this._a,0),t.writeInt32BE(this._b,4),t.writeInt32BE(this._c,8),t.writeInt32BE(this._d,12),t.writeInt32BE(this._e,16),t.writeInt32BE(this._f,20),t.writeInt32BE(this._g,24),t.writeInt32BE(this._h,28),t};var wM=dM,_M=ri,EM=wM,AM=FA,MM=yg.Buffer,SM=new Array(64);function kM(){this.init(),this._w=SM,AM.call(this,64,56)}_M(kM,EM),kM.prototype.init=function(){return this._a=3238371032,this._b=914150663,this._c=812702999,this._d=4144912697,this._e=4290775857,this._f=1750603025,this._g=1694076839,this._h=3204075428,this},kM.prototype._hash=function(){var t=MM.allocUnsafe(28);return t.writeInt32BE(this._a,0),t.writeInt32BE(this._b,4),t.writeInt32BE(this._c,8),t.writeInt32BE(this._d,12),t.writeInt32BE(this._e,16),t.writeInt32BE(this._f,20),t.writeInt32BE(this._g,24),t};var xM=kM,TM=ri,RM=FA,BM=yg.Buffer,NM=[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],PM=new Array(160);function IM(){this.init(),this._w=PM,RM.call(this,128,112)}function OM(t,e,r){return r^t&(e^r)}function CM(t,e,r){return t&e|r&(t|e)}function LM(t,e){return(t>>>28|e<<4)^(e>>>2|t<<30)^(e>>>7|t<<25)}function jM(t,e){return(t>>>14|e<<18)^(t>>>18|e<<14)^(e>>>9|t<<23)}function DM(t,e){return(t>>>1|e<<31)^(t>>>8|e<<24)^t>>>7}function UM(t,e){return(t>>>1|e<<31)^(t>>>8|e<<24)^(t>>>7|e<<25)}function FM(t,e){return(t>>>19|e<<13)^(e>>>29|t<<3)^t>>>6}function zM(t,e){return(t>>>19|e<<13)^(e>>>29|t<<3)^(t>>>6|e<<26)}function qM(t,e){return t>>>0<e>>>0?1:0}TM(IM,RM),IM.prototype.init=function(){return this._ah=1779033703,this._bh=3144134277,this._ch=1013904242,this._dh=2773480762,this._eh=1359893119,this._fh=2600822924,this._gh=528734635,this._hh=1541459225,this._al=4089235720,this._bl=2227873595,this._cl=4271175723,this._dl=1595750129,this._el=2917565137,this._fl=725511199,this._gl=4215389547,this._hl=327033209,this},IM.prototype._update=function(t){for(var e=this._w,r=0|this._ah,n=0|this._bh,i=0|this._ch,o=0|this._dh,s=0|this._eh,a=0|this._fh,u=0|this._gh,h=0|this._hh,c=0|this._al,f=0|this._bl,l=0|this._cl,d=0|this._dl,p=0|this._el,m=0|this._fl,g=0|this._gl,y=0|this._hl,b=0;b<32;b+=2)e[b]=t.readInt32BE(4*b),e[b+1]=t.readInt32BE(4*b+4);for(;b<160;b+=2){var v=e[b-30],w=e[b-30+1],_=DM(v,w),E=UM(w,v),A=FM(v=e[b-4],w=e[b-4+1]),M=zM(w,v),S=e[b-14],k=e[b-14+1],x=e[b-32],T=e[b-32+1],R=E+k|0,B=_+S+qM(R,E)|0;B=(B=B+A+qM(R=R+M|0,M)|0)+x+qM(R=R+T|0,T)|0,e[b]=B,e[b+1]=R}for(var N=0;N<160;N+=2){B=e[N],R=e[N+1];var P=CM(r,n,i),I=CM(c,f,l),O=LM(r,c),C=LM(c,r),L=jM(s,p),j=jM(p,s),D=NM[N],U=NM[N+1],F=OM(s,a,u),z=OM(p,m,g),q=y+j|0,H=h+L+qM(q,y)|0;H=(H=(H=H+F+qM(q=q+z|0,z)|0)+D+qM(q=q+U|0,U)|0)+B+qM(q=q+R|0,R)|0;var K=C+I|0,G=O+P+qM(K,C)|0;h=u,y=g,u=a,g=m,a=s,m=p,s=o+H+qM(p=d+q|0,d)|0,o=i,d=l,i=n,l=f,n=r,f=c,r=H+G+qM(c=q+K|0,q)|0}this._al=this._al+c|0,this._bl=this._bl+f|0,this._cl=this._cl+l|0,this._dl=this._dl+d|0,this._el=this._el+p|0,this._fl=this._fl+m|0,this._gl=this._gl+g|0,this._hl=this._hl+y|0,this._ah=this._ah+r+qM(this._al,c)|0,this._bh=this._bh+n+qM(this._bl,f)|0,this._ch=this._ch+i+qM(this._cl,l)|0,this._dh=this._dh+o+qM(this._dl,d)|0,this._eh=this._eh+s+qM(this._el,p)|0,this._fh=this._fh+a+qM(this._fl,m)|0,this._gh=this._gh+u+qM(this._gl,g)|0,this._hh=this._hh+h+qM(this._hl,y)|0},IM.prototype._hash=function(){var t=BM.allocUnsafe(64);function e(e,r,n){t.writeInt32BE(e,n),t.writeInt32BE(r,n+4)}return e(this._ah,this._al,0),e(this._bh,this._bl,8),e(this._ch,this._cl,16),e(this._dh,this._dl,24),e(this._eh,this._el,32),e(this._fh,this._fl,40),e(this._gh,this._gl,48),e(this._hh,this._hl,56),t};var HM=IM,KM=ri,GM=HM,VM=FA,WM=yg.Buffer,JM=new Array(160);function ZM(){this.init(),this._w=JM,VM.call(this,128,112)}KM(ZM,GM),ZM.prototype.init=function(){return this._ah=3418070365,this._bh=1654270250,this._ch=2438529370,this._dh=355462360,this._eh=1731405415,this._fh=2394180231,this._gh=3675008525,this._hh=1203062813,this._al=3238371032,this._bl=914150663,this._cl=812702999,this._dl=4144912697,this._el=4290775857,this._fl=1750603025,this._gl=1694076839,this._hl=3204075428,this},ZM.prototype._hash=function(){var t=WM.allocUnsafe(48);function e(e,r,n){t.writeInt32BE(e,n),t.writeInt32BE(r,n+4)}return e(this._ah,this._al,0),e(this._bh,this._bl,8),e(this._ch,this._cl,16),e(this._dh,this._dl,24),e(this._eh,this._el,32),e(this._fh,this._fl,40),t};var YM=ZM;!function(t){t.exports=function(e){var r=e.toLowerCase(),n=t.exports[r];if(!n)throw new Error(r+" is not supported (we accept pull requests)");return new n},t.exports.sha=YA,t.exports.sha1=aM,t.exports.sha224=xM,t.exports.sha256=wM,t.exports.sha384=YM,t.exports.sha512=HM}(Jw);var XM=Jw.exports;function $M(){this.head=null,this.tail=null,this.length=0}$M.prototype.push=function(t){var e={data:t,next:null};this.length>0?this.tail.next=e:this.head=e,this.tail=e,++this.length},$M.prototype.unshift=function(t){var e={data:t,next:this.head};0===this.length&&(this.tail=e),this.head=e,++this.length},$M.prototype.shift=function(){if(0!==this.length){var t=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,t}},$M.prototype.clear=function(){this.head=this.tail=null,this.length=0},$M.prototype.join=function(t){if(0===this.length)return"";for(var e=this.head,r=""+e.data;e=e.next;)r+=t+e.data;return r},$M.prototype.concat=function(t){if(0===this.length)return _.alloc(0);if(1===this.length)return this.head.data;for(var e=_.allocUnsafe(t>>>0),r=this.head,n=0;r;)r.data.copy(e,n),n+=r.data.length,r=r.next;return e};var QM=_.isEncoding||function(t){switch(t&&t.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function tS(t){switch(this.encoding=(t||"utf8").toLowerCase().replace(/[-_]/,""),function(t){if(t&&!QM(t))throw new Error("Unknown encoding: "+t)}(t),this.encoding){case"utf8":this.surrogateSize=3;break;case"ucs2":case"utf16le":this.surrogateSize=2,this.detectIncompleteChar=rS;break;case"base64":this.surrogateSize=3,this.detectIncompleteChar=nS;break;default:return void(this.write=eS)}this.charBuffer=new _(6),this.charReceived=0,this.charLength=0}function eS(t){return t.toString(this.encoding)}function rS(t){this.charReceived=t.length%2,this.charLength=this.charReceived?2:0}function nS(t){this.charReceived=t.length%3,this.charLength=this.charReceived?3:0}tS.prototype.write=function(t){for(var e="";this.charLength;){var r=t.length>=this.charLength-this.charReceived?this.charLength-this.charReceived:t.length;if(t.copy(this.charBuffer,this.charReceived,0,r),this.charReceived+=r,this.charReceived<this.charLength)return"";if(t=t.slice(r,t.length),!((i=(e=this.charBuffer.slice(0,this.charLength).toString(this.encoding)).charCodeAt(e.length-1))>=55296&&i<=56319)){if(this.charReceived=this.charLength=0,0===t.length)return e;break}this.charLength+=this.surrogateSize,e=""}this.detectIncompleteChar(t);var n=t.length;this.charLength&&(t.copy(this.charBuffer,0,t.length-this.charReceived,n),n-=this.charReceived);var i;n=(e+=t.toString(this.encoding,0,n)).length-1;if((i=e.charCodeAt(n))>=55296&&i<=56319){var o=this.surrogateSize;return this.charLength+=o,this.charReceived+=o,this.charBuffer.copy(this.charBuffer,o,0,o),t.copy(this.charBuffer,0,0,o),e.substring(0,n)}return e},tS.prototype.detectIncompleteChar=function(t){for(var e=t.length>=3?3:t.length;e>0;e--){var r=t[t.length-e];if(1==e&&r>>5==6){this.charLength=2;break}if(e<=2&&r>>4==14){this.charLength=3;break}if(e<=3&&r>>3==30){this.charLength=4;break}}this.charReceived=e},tS.prototype.end=function(t){var e="";if(t&&t.length&&(e=this.write(t)),this.charReceived){var r=this.charReceived,n=this.charBuffer,i=this.encoding;e+=n.slice(0,r).toString(i)}return e};var iS=Object.freeze({__proto__:null,StringDecoder:tS});aS.ReadableState=sS;var oS=vm("stream");function sS(t,e){t=t||{},this.objectMode=!!t.objectMode,e instanceof CS&&(this.objectMode=this.objectMode||!!t.readableObjectMode);var r=t.highWaterMark,n=this.objectMode?16:16384;this.highWaterMark=r||0===r?r:n,this.highWaterMark=~~this.highWaterMark,this.buffer=new $M,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.defaultEncoding=t.defaultEncoding||"utf8",this.ranOut=!1,this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,t.encoding&&(this.decoder=new tS(t.encoding),this.encoding=t.encoding)}function aS(t){if(!(this instanceof aS))return new aS(t);this._readableState=new sS(t,this),this.readable=!0,t&&"function"==typeof t.read&&(this._read=t.read),om.call(this)}function uS(t,e,r,n,i){var o=function(t,e){var r=null;_.isBuffer(e)||"string"==typeof e||null==e||t.objectMode||(r=new TypeError("Invalid non-string/buffer chunk"));return r}(e,r);if(o)t.emit("error",o);else if(null===r)e.reading=!1,function(t,e){if(e.ended)return;if(e.decoder){var r=e.decoder.end();r&&r.length&&(e.buffer.push(r),e.length+=e.objectMode?1:r.length)}e.ended=!0,fS(t)}(t,e);else if(e.objectMode||r&&r.length>0)if(e.ended&&!i){var s=new Error("stream.push() after EOF");t.emit("error",s)}else if(e.endEmitted&&i){var a=new Error("stream.unshift() after end event");t.emit("error",a)}else{var u;!e.decoder||i||n||(r=e.decoder.write(r),u=!e.objectMode&&0===r.length),i||(e.reading=!1),u||(e.flowing&&0===e.length&&!e.sync?(t.emit("data",r),t.read(0)):(e.length+=e.objectMode?1:r.length,i?e.buffer.unshift(r):e.buffer.push(r),e.needReadable&&fS(t))),function(t,e){e.readingMore||(e.readingMore=!0,sr(dS,t,e))}(t,e)}else i||(e.reading=!1);return function(t){return!t.ended&&(t.needReadable||t.length<t.highWaterMark||0===t.length)}(e)}dm(aS,om),aS.prototype.push=function(t,e){var r=this._readableState;return r.objectMode||"string"!=typeof t||(e=e||r.defaultEncoding)!==r.encoding&&(t=_.from(t,e),e=""),uS(this,r,t,e,!1)},aS.prototype.unshift=function(t){return uS(this,this._readableState,t,"",!0)},aS.prototype.isPaused=function(){return!1===this._readableState.flowing},aS.prototype.setEncoding=function(t){return this._readableState.decoder=new tS(t),this._readableState.encoding=t,this};var hS=8388608;function cS(t,e){return t<=0||0===e.length&&e.ended?0:e.objectMode?1:t!=t?e.flowing&&e.length?e.buffer.head.data.length:e.length:(t>e.highWaterMark&&(e.highWaterMark=function(t){return t>=hS?t=hS:(t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++),t}(t)),t<=e.length?t:e.ended?e.length:(e.needReadable=!0,0))}function fS(t){var e=t._readableState;e.needReadable=!1,e.emittedReadable||(oS("emitReadable",e.flowing),e.emittedReadable=!0,e.sync?sr(lS,t):lS(t))}function lS(t){oS("emit readable"),t.emit("readable"),gS(t)}function dS(t,e){for(var r=e.length;!e.reading&&!e.flowing&&!e.ended&&e.length<e.highWaterMark&&(oS("maybeReadMore read 0"),t.read(0),r!==e.length);)r=e.length;e.readingMore=!1}function pS(t){oS("readable nexttick read 0"),t.read(0)}function mS(t,e){e.reading||(oS("resume read 0"),t.read(0)),e.resumeScheduled=!1,e.awaitDrain=0,t.emit("resume"),gS(t),e.flowing&&!e.reading&&t.read(0)}function gS(t){var e=t._readableState;for(oS("flow",e.flowing);e.flowing&&null!==t.read(););}function yS(t,e){return 0===e.length?null:(e.objectMode?r=e.buffer.shift():!t||t>=e.length?(r=e.decoder?e.buffer.join(""):1===e.buffer.length?e.buffer.head.data:e.buffer.concat(e.length),e.buffer.clear()):r=function(t,e,r){var n;t<e.head.data.length?(n=e.head.data.slice(0,t),e.head.data=e.head.data.slice(t)):n=t===e.head.data.length?e.shift():r?function(t,e){var r=e.head,n=1,i=r.data;t-=i.length;for(;r=r.next;){var o=r.data,s=t>o.length?o.length:t;if(s===o.length?i+=o:i+=o.slice(0,t),0===(t-=s)){s===o.length?(++n,r.next?e.head=r.next:e.head=e.tail=null):(e.head=r,r.data=o.slice(s));break}++n}return e.length-=n,i}(t,e):function(t,e){var r=_.allocUnsafe(t),n=e.head,i=1;n.data.copy(r),t-=n.data.length;for(;n=n.next;){var o=n.data,s=t>o.length?o.length:t;if(o.copy(r,r.length-t,0,s),0===(t-=s)){s===o.length?(++i,n.next?e.head=n.next:e.head=e.tail=null):(e.head=n,n.data=o.slice(s));break}++i}return e.length-=i,r}(t,e);return n}(t,e.buffer,e.decoder),r);var r}function bS(t){var e=t._readableState;if(e.length>0)throw new Error('"endReadable()" called on non-empty stream');e.endEmitted||(e.ended=!0,sr(vS,e,t))}function vS(t,e){t.endEmitted||0!==t.length||(t.endEmitted=!0,e.readable=!1,e.emit("end"))}function wS(t,e){for(var r=0,n=t.length;r<n;r++)if(t[r]===e)return r;return-1}function _S(){}function ES(t,e,r){this.chunk=t,this.encoding=e,this.callback=r,this.next=null}function AS(t,e){Object.defineProperty(this,"buffer",{get:gm(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.")}),t=t||{},this.objectMode=!!t.objectMode,e instanceof CS&&(this.objectMode=this.objectMode||!!t.writableObjectMode);var r=t.highWaterMark,n=this.objectMode?16:16384;this.highWaterMark=r||0===r?r:n,this.highWaterMark=~~this.highWaterMark,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1;var i=!1===t.decodeStrings;this.decodeStrings=!i,this.defaultEncoding=t.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(t){!function(t,e){var r=t._writableState,n=r.sync,i=r.writecb;if(function(t){t.writing=!1,t.writecb=null,t.length-=t.writelen,t.writelen=0}(r),e)!function(t,e,r,n,i){--e.pendingcb,r?sr(i,n):i(n);t._writableState.errorEmitted=!0,t.emit("error",n)}(t,r,n,e,i);else{var o=TS(r);o||r.corked||r.bufferProcessing||!r.bufferedRequest||xS(t,r),n?sr(kS,t,r,o,i):kS(t,r,o,i)}}(e,t)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new NS(this)}function MS(t){if(!(this instanceof MS||this instanceof CS))return new MS(t);this._writableState=new AS(t,this),this.writable=!0,t&&("function"==typeof t.write&&(this._write=t.write),"function"==typeof t.writev&&(this._writev=t.writev)),om.call(this)}function SS(t,e,r,n,i,o,s){e.writelen=n,e.writecb=s,e.writing=!0,e.sync=!0,r?t._writev(i,e.onwrite):t._write(i,o,e.onwrite),e.sync=!1}function kS(t,e,r,n){r||function(t,e){0===e.length&&e.needDrain&&(e.needDrain=!1,t.emit("drain"))}(t,e),e.pendingcb--,n(),BS(t,e)}function xS(t,e){e.bufferProcessing=!0;var r=e.bufferedRequest;if(t._writev&&r&&r.next){var n=e.bufferedRequestCount,i=new Array(n),o=e.corkedRequestsFree;o.entry=r;for(var s=0;r;)i[s]=r,r=r.next,s+=1;SS(t,e,!0,e.length,i,"",o.finish),e.pendingcb++,e.lastBufferedRequest=null,o.next?(e.corkedRequestsFree=o.next,o.next=null):e.corkedRequestsFree=new NS(e)}else{for(;r;){var a=r.chunk,u=r.encoding,h=r.callback;if(SS(t,e,!1,e.objectMode?1:a.length,a,u,h),r=r.next,e.writing)break}null===r&&(e.lastBufferedRequest=null)}e.bufferedRequestCount=0,e.bufferedRequest=r,e.bufferProcessing=!1}function TS(t){return t.ending&&0===t.length&&null===t.bufferedRequest&&!t.finished&&!t.writing}function RS(t,e){e.prefinished||(e.prefinished=!0,t.emit("prefinish"))}function BS(t,e){var r=TS(e);return r&&(0===e.pendingcb?(RS(t,e),e.finished=!0,t.emit("finish")):RS(t,e)),r}function NS(t){var e=this;this.next=null,this.entry=null,this.finish=function(r){var n=e.entry;for(e.entry=null;n;){var i=n.callback;t.pendingcb--,i(r),n=n.next}t.corkedRequestsFree?t.corkedRequestsFree.next=e:t.corkedRequestsFree=e}}aS.prototype.read=function(t){oS("read",t),t=parseInt(t,10);var e=this._readableState,r=t;if(0!==t&&(e.emittedReadable=!1),0===t&&e.needReadable&&(e.length>=e.highWaterMark||e.ended))return oS("read: emitReadable",e.length,e.ended),0===e.length&&e.ended?bS(this):fS(this),null;if(0===(t=cS(t,e))&&e.ended)return 0===e.length&&bS(this),null;var n,i=e.needReadable;return oS("need readable",i),(0===e.length||e.length-t<e.highWaterMark)&&oS("length less than watermark",i=!0),e.ended||e.reading?oS("reading or ended",i=!1):i&&(oS("do read"),e.reading=!0,e.sync=!0,0===e.length&&(e.needReadable=!0),this._read(e.highWaterMark),e.sync=!1,e.reading||(t=cS(r,e))),null===(n=t>0?yS(t,e):null)?(e.needReadable=!0,t=0):e.length-=t,0===e.length&&(e.ended||(e.needReadable=!0),r!==t&&e.ended&&bS(this)),null!==n&&this.emit("data",n),n},aS.prototype._read=function(t){this.emit("error",new Error("not implemented"))},aS.prototype.pipe=function(t,e){var r=this,n=this._readableState;switch(n.pipesCount){case 0:n.pipes=t;break;case 1:n.pipes=[n.pipes,t];break;default:n.pipes.push(t)}n.pipesCount+=1,oS("pipe count=%d opts=%j",n.pipesCount,e);var i=!e||!1!==e.end?s:h;function o(t){oS("onunpipe"),t===r&&h()}function s(){oS("onend"),t.end()}n.endEmitted?sr(i):r.once("end",i),t.on("unpipe",o);var a=function(t){return function(){var e=t._readableState;oS("pipeOnDrain",e.awaitDrain),e.awaitDrain&&e.awaitDrain--,0===e.awaitDrain&&t.listeners("data").length&&(e.flowing=!0,gS(t))}}(r);t.on("drain",a);var u=!1;function h(){oS("cleanup"),t.removeListener("close",d),t.removeListener("finish",p),t.removeListener("drain",a),t.removeListener("error",l),t.removeListener("unpipe",o),r.removeListener("end",s),r.removeListener("end",h),r.removeListener("data",f),u=!0,!n.awaitDrain||t._writableState&&!t._writableState.needDrain||a()}var c=!1;function f(e){oS("ondata"),c=!1,!1!==t.write(e)||c||((1===n.pipesCount&&n.pipes===t||n.pipesCount>1&&-1!==wS(n.pipes,t))&&!u&&(oS("false write response, pause",r._readableState.awaitDrain),r._readableState.awaitDrain++,c=!0),r.pause())}function l(e){oS("onerror",e),m(),t.removeListener("error",l),0===function(t,e){return t.listeners(e).length}(t,"error")&&t.emit("error",e)}function d(){t.removeListener("finish",p),m()}function p(){oS("onfinish"),t.removeListener("close",d),m()}function m(){oS("unpipe"),r.unpipe(t)}return r.on("data",f),function(t,e,r){if("function"==typeof t.prependListener)return t.prependListener(e,r);t._events&&t._events[e]?Array.isArray(t._events[e])?t._events[e].unshift(r):t._events[e]=[r,t._events[e]]:t.on(e,r)}(t,"error",l),t.once("close",d),t.once("finish",p),t.emit("pipe",r),n.flowing||(oS("pipe resume"),r.resume()),t},aS.prototype.unpipe=function(t){var e=this._readableState;if(0===e.pipesCount)return this;if(1===e.pipesCount)return t&&t!==e.pipes||(t||(t=e.pipes),e.pipes=null,e.pipesCount=0,e.flowing=!1,t&&t.emit("unpipe",this)),this;if(!t){var r=e.pipes,n=e.pipesCount;e.pipes=null,e.pipesCount=0,e.flowing=!1;for(var i=0;i<n;i++)r[i].emit("unpipe",this);return this}var o=wS(e.pipes,t);return-1===o||(e.pipes.splice(o,1),e.pipesCount-=1,1===e.pipesCount&&(e.pipes=e.pipes[0]),t.emit("unpipe",this)),this},aS.prototype.on=function(t,e){var r=om.prototype.on.call(this,t,e);if("data"===t)!1!==this._readableState.flowing&&this.resume();else if("readable"===t){var n=this._readableState;n.endEmitted||n.readableListening||(n.readableListening=n.needReadable=!0,n.emittedReadable=!1,n.reading?n.length&&fS(this):sr(pS,this))}return r},aS.prototype.addListener=aS.prototype.on,aS.prototype.resume=function(){var t=this._readableState;return t.flowing||(oS("resume"),t.flowing=!0,function(t,e){e.resumeScheduled||(e.resumeScheduled=!0,sr(mS,t,e))}(this,t)),this},aS.prototype.pause=function(){return oS("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(oS("pause"),this._readableState.flowing=!1,this.emit("pause")),this},aS.prototype.wrap=function(t){var e=this._readableState,r=!1,n=this;for(var i in t.on("end",function(){if(oS("wrapped end"),e.decoder&&!e.ended){var t=e.decoder.end();t&&t.length&&n.push(t)}n.push(null)}),t.on("data",function(i){(oS("wrapped data"),e.decoder&&(i=e.decoder.write(i)),e.objectMode&&null==i)||(e.objectMode||i&&i.length)&&(n.push(i)||(r=!0,t.pause()))}),t)void 0===this[i]&&"function"==typeof t[i]&&(this[i]=function(e){return function(){return t[e].apply(t,arguments)}}(i));return function(t,e){for(var r=0,n=t.length;r<n;r++)e(t[r],r)}(["error","close","destroy","pause","resume"],function(e){t.on(e,n.emit.bind(n,e))}),n._read=function(e){oS("wrapped _read",e),r&&(r=!1,t.resume())},n},aS._fromList=yS,MS.WritableState=AS,dm(MS,om),AS.prototype.getBuffer=function(){for(var t=this.bufferedRequest,e=[];t;)e.push(t),t=t.next;return e},MS.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},MS.prototype.write=function(t,e,r){var n=this._writableState,i=!1;return"function"==typeof e&&(r=e,e=null),_.isBuffer(t)?e="buffer":e||(e=n.defaultEncoding),"function"!=typeof r&&(r=_S),n.ended?function(t,e){var r=new Error("write after end");t.emit("error",r),sr(e,r)}(this,r):function(t,e,r,n){var i=!0,o=!1;return null===r?o=new TypeError("May not write null values to stream"):_.isBuffer(r)||"string"==typeof r||void 0===r||e.objectMode||(o=new TypeError("Invalid non-string/buffer chunk")),o&&(t.emit("error",o),sr(n,o),i=!1),i}(this,n,t,r)&&(n.pendingcb++,i=function(t,e,r,n,i){r=function(t,e,r){t.objectMode||!1===t.decodeStrings||"string"!=typeof e||(e=_.from(e,r));return e}(e,r,n),_.isBuffer(r)&&(n="buffer");var o=e.objectMode?1:r.length;e.length+=o;var s=e.length<e.highWaterMark;s||(e.needDrain=!0);if(e.writing||e.corked){var a=e.lastBufferedRequest;e.lastBufferedRequest=new ES(r,n,i),a?a.next=e.lastBufferedRequest:e.bufferedRequest=e.lastBufferedRequest,e.bufferedRequestCount+=1}else SS(t,e,!1,o,r,n,i);return s}(this,n,t,e,r)),i},MS.prototype.cork=function(){this._writableState.corked++},MS.prototype.uncork=function(){var t=this._writableState;t.corked&&(t.corked--,t.writing||t.corked||t.finished||t.bufferProcessing||!t.bufferedRequest||xS(this,t))},MS.prototype.setDefaultEncoding=function(t){if("string"==typeof t&&(t=t.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((t+"").toLowerCase())>-1))throw new TypeError("Unknown encoding: "+t);return this._writableState.defaultEncoding=t,this},MS.prototype._write=function(t,e,r){r(new Error("not implemented"))},MS.prototype._writev=null,MS.prototype.end=function(t,e,r){var n=this._writableState;"function"==typeof t?(r=t,t=null,e=null):"function"==typeof e&&(r=e,e=null),null!=t&&this.write(t,e),n.corked&&(n.corked=1,this.uncork()),n.ending||n.finished||function(t,e,r){e.ending=!0,BS(t,e),r&&(e.finished?sr(r):t.once("finish",r));e.ended=!0,t.writable=!1}(this,n,r)},dm(CS,aS);for(var PS=Object.keys(MS.prototype),IS=0;IS<PS.length;IS++){var OS=PS[IS];CS.prototype[OS]||(CS.prototype[OS]=MS.prototype[OS])}function CS(t){if(!(this instanceof CS))return new CS(t);aS.call(this,t),MS.call(this,t),t&&!1===t.readable&&(this.readable=!1),t&&!1===t.writable&&(this.writable=!1),this.allowHalfOpen=!0,t&&!1===t.allowHalfOpen&&(this.allowHalfOpen=!1),this.once("end",LS)}function LS(){this.allowHalfOpen||this._writableState.ended||sr(jS,this)}function jS(t){t.end()}function DS(t){this.afterTransform=function(e,r){return function(t,e,r){var n=t._transformState;n.transforming=!1;var i=n.writecb;if(!i)return t.emit("error",new Error("no writecb in Transform class"));n.writechunk=null,n.writecb=null,null!=r&&t.push(r);i(e);var o=t._readableState;o.reading=!1,(o.needReadable||o.length<o.highWaterMark)&&t._read(o.highWaterMark)}(t,e,r)},this.needTransform=!1,this.transforming=!1,this.writecb=null,this.writechunk=null,this.writeencoding=null}function US(t){if(!(this instanceof US))return new US(t);CS.call(this,t),this._transformState=new DS(this);var e=this;this._readableState.needReadable=!0,this._readableState.sync=!1,t&&("function"==typeof t.transform&&(this._transform=t.transform),"function"==typeof t.flush&&(this._flush=t.flush)),this.once("prefinish",function(){"function"==typeof this._flush?this._flush(function(t){FS(e,t)}):FS(e)})}function FS(t,e){if(e)return t.emit("error",e);var r=t._writableState,n=t._transformState;if(r.length)throw new Error("Calling transform done when ws.length != 0");if(n.transforming)throw new Error("Calling transform done when still transforming");return t.push(null)}function zS(t){if(!(this instanceof zS))return new zS(t);US.call(this,t)}function qS(){om.call(this)}dm(US,CS),US.prototype.push=function(t,e){return this._transformState.needTransform=!1,CS.prototype.push.call(this,t,e)},US.prototype._transform=function(t,e,r){throw new Error("Not implemented")},US.prototype._write=function(t,e,r){var n=this._transformState;if(n.writecb=r,n.writechunk=t,n.writeencoding=e,!n.transforming){var i=this._readableState;(n.needTransform||i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}},US.prototype._read=function(t){var e=this._transformState;null!==e.writechunk&&e.writecb&&!e.transforming?(e.transforming=!0,this._transform(e.writechunk,e.writeencoding,e.afterTransform)):e.needTransform=!0},dm(zS,US),zS.prototype._transform=function(t,e,r){r(null,t)},dm(qS,om),qS.Readable=aS,qS.Writable=MS,qS.Duplex=CS,qS.Transform=US,qS.PassThrough=zS,qS.Stream=qS,qS.prototype.pipe=function(t,e){var r=this;function n(e){t.writable&&!1===t.write(e)&&r.pause&&r.pause()}function i(){r.readable&&r.resume&&r.resume()}r.on("data",n),t.on("drain",i),t._isStdio||e&&!1===e.end||(r.on("end",s),r.on("close",a));var o=!1;function s(){o||(o=!0,t.end())}function a(){o||(o=!0,"function"==typeof t.destroy&&t.destroy())}function u(t){if(h(),0===om.listenerCount(this,"error"))throw t}function h(){r.removeListener("data",n),t.removeListener("drain",i),r.removeListener("end",s),r.removeListener("close",a),r.removeListener("error",u),t.removeListener("error",u),r.removeListener("end",h),r.removeListener("close",h),t.removeListener("close",h)}return r.on("error",u),t.on("error",u),r.on("end",h),r.on("close",h),t.on("close",h),t.emit("pipe",r),t};var HS=n(Object.freeze({__proto__:null,Duplex:CS,PassThrough:zS,Readable:aS,Stream:qS,Transform:US,Writable:MS,default:qS})),KS=n(iS),GS=yg.Buffer,VS=HS.Transform,WS=KS.StringDecoder;function JS(t){VS.call(this),this.hashMode="string"==typeof t,this.hashMode?this[t]=this._finalOrDigest:this.final=this._finalOrDigest,this._final&&(this.__final=this._final,this._final=null),this._decoder=null,this._encoding=null}ri(JS,VS);var ZS="undefined"!=typeof Uint8Array,YS="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof Uint8Array&&ArrayBuffer.isView&&(GS.prototype instanceof Uint8Array||GS.TYPED_ARRAY_SUPPORT);JS.prototype.update=function(t,e,r){var n=function(t,e){if(t instanceof GS)return t;if("string"==typeof t)return GS.from(t,e);if(YS&&ArrayBuffer.isView(t)){if(0===t.byteLength)return GS.alloc(0);var r=GS.from(t.buffer,t.byteOffset,t.byteLength);if(r.byteLength===t.byteLength)return r}if(ZS&&t instanceof Uint8Array)return GS.from(t);if(GS.isBuffer(t)&&t.constructor&&"function"==typeof t.constructor.isBuffer&&t.constructor.isBuffer(t))return GS.from(t);throw new TypeError('The "data" argument must be of type string or an instance of Buffer, TypedArray, or DataView.')}(t,e),i=this._update(n);return this.hashMode?this:(r&&(i=this._toString(i,r)),i)},JS.prototype.setAutoPadding=function(){},JS.prototype.getAuthTag=function(){throw new Error("trying to get auth tag in unsupported state")},JS.prototype.setAuthTag=function(){throw new Error("trying to set auth tag in unsupported state")},JS.prototype.setAAD=function(){throw new Error("trying to set aad in unsupported state")},JS.prototype._transform=function(t,e,r){var n;try{this.hashMode?this._update(t):this.push(this._update(t))}catch(t){n=t}finally{r(n)}},JS.prototype._flush=function(t){var e;try{this.push(this.__final())}catch(t){e=t}t(e)},JS.prototype._finalOrDigest=function(t){var e=this.__final()||GS.alloc(0);return t&&(e=this._toString(e,t,!0)),e},JS.prototype._toString=function(t,e,r){if(this._decoder||(this._decoder=new WS(e),this._encoding=e),this._encoding!==e)throw new Error("can’t switch encodings");var n=this._decoder.write(t);return r&&(n+=this._decoder.end()),n};var XS=JS,$S=Sw,QS=Ww,tk=XM,ek=XS;function rk(t){ek.call(this,"digest"),this._hash=t}ri(rk,ek),rk.prototype._update=function(t){this._hash.update(t)},rk.prototype._final=function(){return this._hash.digest()};var nk=function(t){return"md5"===(t=t.toLowerCase())?new $S:"rmd160"===t||"ripemd160"===t?new QS:new rk(tk(t))},ik=ri,ok=yg.Buffer,sk=XS,ak=ok.alloc(128),uk=64;function hk(t,e){sk.call(this,"digest"),"string"==typeof e&&(e=ok.from(e)),this._alg=t,this._key=e,e.length>uk?e=t(e):e.length<uk&&(e=ok.concat([e,ak],uk));for(var r=this._ipad=ok.allocUnsafe(uk),n=this._opad=ok.allocUnsafe(uk),i=0;i<uk;i++)r[i]=54^e[i],n[i]=92^e[i];this._hash=[r]}ik(hk,sk),hk.prototype._update=function(t){this._hash.push(t)},hk.prototype._final=function(){var t=this._alg(ok.concat(this._hash));return this._alg(ok.concat([this._opad,t]))};var ck=Sw,fk=ri,lk=hk,dk=XS,pk=yg.Buffer,mk=function(t){return(new ck).update(t).digest()},gk=Ww,yk=XM,bk=pk.alloc(128);function vk(t,e){dk.call(this,"digest"),"string"==typeof e&&(e=pk.from(e));var r="sha512"===t||"sha384"===t?128:64;(this._alg=t,this._key=e,e.length>r)?e=("rmd160"===t?new gk:yk(t)).update(e).digest():e.length<r&&(e=pk.concat([e,bk],r));for(var n=this._ipad=pk.allocUnsafe(r),i=this._opad=pk.allocUnsafe(r),o=0;o<r;o++)n[o]=54^e[o],i[o]=92^e[o];this._hash="rmd160"===t?new gk:yk(t),this._hash.update(n)}fk(vk,dk),vk.prototype._update=function(t){this._hash.update(t)},vk.prototype._final=function(){var t=this._hash.digest();return("rmd160"===this._alg?new gk:yk(this._alg)).update(this._opad).update(t).digest()};var wk,_k=function(t,e){return"rmd160"===(t=t.toLowerCase())||"ripemd160"===t?new vk("rmd160",e):"md5"===t?new lk(mk,e):new vk(t,e)},Ek={sha224WithRSAEncryption:{sign:"rsa",hash:"sha224",id:"302d300d06096086480165030402040500041c"},"RSA-SHA224":{sign:"ecdsa/rsa",hash:"sha224",id:"302d300d06096086480165030402040500041c"},sha256WithRSAEncryption:{sign:"rsa",hash:"sha256",id:"3031300d060960864801650304020105000420"},"RSA-SHA256":{sign:"ecdsa/rsa",hash:"sha256",id:"3031300d060960864801650304020105000420"},sha384WithRSAEncryption:{sign:"rsa",hash:"sha384",id:"3041300d060960864801650304020205000430"},"RSA-SHA384":{sign:"ecdsa/rsa",hash:"sha384",id:"3041300d060960864801650304020205000430"},sha512WithRSAEncryption:{sign:"rsa",hash:"sha512",id:"3051300d060960864801650304020305000440"},"RSA-SHA512":{sign:"ecdsa/rsa",hash:"sha512",id:"3051300d060960864801650304020305000440"},"RSA-SHA1":{sign:"rsa",hash:"sha1",id:"3021300906052b0e03021a05000414"},"ecdsa-with-SHA1":{sign:"ecdsa",hash:"sha1",id:""},sha256:{sign:"ecdsa",hash:"sha256",id:""},sha224:{sign:"ecdsa",hash:"sha224",id:""},sha384:{sign:"ecdsa",hash:"sha384",id:""},sha512:{sign:"ecdsa",hash:"sha512",id:""},"DSA-SHA":{sign:"dsa",hash:"sha1",id:""},"DSA-SHA1":{sign:"dsa",hash:"sha1",id:""},DSA:{sign:"dsa",hash:"sha1",id:""},"DSA-WITH-SHA224":{sign:"dsa",hash:"sha224",id:""},"DSA-SHA224":{sign:"dsa",hash:"sha224",id:""},"DSA-WITH-SHA256":{sign:"dsa",hash:"sha256",id:""},"DSA-SHA256":{sign:"dsa",hash:"sha256",id:""},"DSA-WITH-SHA384":{sign:"dsa",hash:"sha384",id:""},"DSA-SHA384":{sign:"dsa",hash:"sha384",id:""},"DSA-WITH-SHA512":{sign:"dsa",hash:"sha512",id:""},"DSA-SHA512":{sign:"dsa",hash:"sha512",id:""},"DSA-RIPEMD160":{sign:"dsa",hash:"rmd160",id:""},ripemd160WithRSA:{sign:"rsa",hash:"rmd160",id:"3021300906052b2403020105000414"},"RSA-RIPEMD160":{sign:"rsa",hash:"rmd160",id:"3021300906052b2403020105000414"},md5WithRSAEncryption:{sign:"rsa",hash:"md5",id:"3020300c06082a864886f70d020505000410"},"RSA-MD5":{sign:"rsa",hash:"md5",id:"3020300c06082a864886f70d020505000410"}},Ak=Ek,Mk={},Sk=Math.pow(2,30)-1,kk=function(t,e){if("number"!=typeof t)throw new TypeError("Iterations not a number");if(t<0)throw new TypeError("Bad iterations");if("number"!=typeof e)throw new TypeError("Key length not a number");if(e<0||e>Sk||e!=e)throw new TypeError("Bad key length")};if(e.process&&e.process.browser)wk="utf-8";else if(e.process&&e.process.version){wk=parseInt(vr.version.split(".")[0].slice(1),10)>=6?"utf-8":"binary"}else wk="utf-8";var xk=wk,Tk=new _(4);Tk.fill(0);var Rk=function(t,e){var r=e(function(t){if(t.length%4!=0){var e=t.length+(4-t.length%4);t=_.concat([t,Tk],e)}for(var r=new Array(t.length>>>2),n=0,i=0;n<t.length;n+=4,i++)r[i]=t.readInt32LE(n);return r}(t),8*t.length);t=new _(16);for(var n=0;n<r.length;n++)t.writeInt32LE(r[n],n<<2,!0);return t};function Bk(t,e){t[e>>5]|=128<<e%32,t[14+(e+64>>>9<<4)]=e;for(var r=1732584193,n=-271733879,i=-1732584194,o=271733878,s=0;s<t.length;s+=16){var a=r,u=n,h=i,c=o;r=Pk(r,n,i,o,t[s+0],7,-680876936),o=Pk(o,r,n,i,t[s+1],12,-389564586),i=Pk(i,o,r,n,t[s+2],17,606105819),n=Pk(n,i,o,r,t[s+3],22,-1044525330),r=Pk(r,n,i,o,t[s+4],7,-176418897),o=Pk(o,r,n,i,t[s+5],12,1200080426),i=Pk(i,o,r,n,t[s+6],17,-1473231341),n=Pk(n,i,o,r,t[s+7],22,-45705983),r=Pk(r,n,i,o,t[s+8],7,1770035416),o=Pk(o,r,n,i,t[s+9],12,-1958414417),i=Pk(i,o,r,n,t[s+10],17,-42063),n=Pk(n,i,o,r,t[s+11],22,-1990404162),r=Pk(r,n,i,o,t[s+12],7,1804603682),o=Pk(o,r,n,i,t[s+13],12,-40341101),i=Pk(i,o,r,n,t[s+14],17,-1502002290),r=Ik(r,n=Pk(n,i,o,r,t[s+15],22,1236535329),i,o,t[s+1],5,-165796510),o=Ik(o,r,n,i,t[s+6],9,-1069501632),i=Ik(i,o,r,n,t[s+11],14,643717713),n=Ik(n,i,o,r,t[s+0],20,-373897302),r=Ik(r,n,i,o,t[s+5],5,-701558691),o=Ik(o,r,n,i,t[s+10],9,38016083),i=Ik(i,o,r,n,t[s+15],14,-660478335),n=Ik(n,i,o,r,t[s+4],20,-405537848),r=Ik(r,n,i,o,t[s+9],5,568446438),o=Ik(o,r,n,i,t[s+14],9,-1019803690),i=Ik(i,o,r,n,t[s+3],14,-187363961),n=Ik(n,i,o,r,t[s+8],20,1163531501),r=Ik(r,n,i,o,t[s+13],5,-1444681467),o=Ik(o,r,n,i,t[s+2],9,-51403784),i=Ik(i,o,r,n,t[s+7],14,1735328473),r=Ok(r,n=Ik(n,i,o,r,t[s+12],20,-1926607734),i,o,t[s+5],4,-378558),o=Ok(o,r,n,i,t[s+8],11,-2022574463),i=Ok(i,o,r,n,t[s+11],16,1839030562),n=Ok(n,i,o,r,t[s+14],23,-35309556),r=Ok(r,n,i,o,t[s+1],4,-1530992060),o=Ok(o,r,n,i,t[s+4],11,1272893353),i=Ok(i,o,r,n,t[s+7],16,-155497632),n=Ok(n,i,o,r,t[s+10],23,-1094730640),r=Ok(r,n,i,o,t[s+13],4,681279174),o=Ok(o,r,n,i,t[s+0],11,-358537222),i=Ok(i,o,r,n,t[s+3],16,-722521979),n=Ok(n,i,o,r,t[s+6],23,76029189),r=Ok(r,n,i,o,t[s+9],4,-640364487),o=Ok(o,r,n,i,t[s+12],11,-421815835),i=Ok(i,o,r,n,t[s+15],16,530742520),r=Ck(r,n=Ok(n,i,o,r,t[s+2],23,-995338651),i,o,t[s+0],6,-198630844),o=Ck(o,r,n,i,t[s+7],10,1126891415),i=Ck(i,o,r,n,t[s+14],15,-1416354905),n=Ck(n,i,o,r,t[s+5],21,-57434055),r=Ck(r,n,i,o,t[s+12],6,1700485571),o=Ck(o,r,n,i,t[s+3],10,-1894986606),i=Ck(i,o,r,n,t[s+10],15,-1051523),n=Ck(n,i,o,r,t[s+1],21,-2054922799),r=Ck(r,n,i,o,t[s+8],6,1873313359),o=Ck(o,r,n,i,t[s+15],10,-30611744),i=Ck(i,o,r,n,t[s+6],15,-1560198380),n=Ck(n,i,o,r,t[s+13],21,1309151649),r=Ck(r,n,i,o,t[s+4],6,-145523070),o=Ck(o,r,n,i,t[s+11],10,-1120210379),i=Ck(i,o,r,n,t[s+2],15,718787259),n=Ck(n,i,o,r,t[s+9],21,-343485551),r=Lk(r,a),n=Lk(n,u),i=Lk(i,h),o=Lk(o,c)}return[r,n,i,o]}function Nk(t,e,r,n,i,o){return Lk((s=Lk(Lk(e,t),Lk(n,o)))<<(a=i)|s>>>32-a,r);var s,a}function Pk(t,e,r,n,i,o,s){return Nk(e&r|~e&n,t,e,i,o,s)}function Ik(t,e,r,n,i,o,s){return Nk(e&n|r&~n,t,e,i,o,s)}function Ok(t,e,r,n,i,o,s){return Nk(e^r^n,t,e,i,o,s)}function Ck(t,e,r,n,i,o,s){return Nk(r^(e|~n),t,e,i,o,s)}function Lk(t,e){var r=(65535&t)+(65535&e);return(t>>16)+(e>>16)+(r>>16)<<16|65535&r}var jk=HS.Transform;function Dk(t){jk.call(this),this._block=new _(t),this._blockSize=t,this._blockOffset=0,this._length=[0,0,0,0],this._finalized=!1}ri(Dk,jk),Dk.prototype._transform=function(t,e,r){var n=null;try{"buffer"!==e&&(t=new _(t,e)),this.update(t)}catch(t){n=t}r(n)},Dk.prototype._flush=function(t){var e=null;try{this.push(this._digest())}catch(t){e=t}t(e)},Dk.prototype.update=function(t,e){if(!_.isBuffer(t)&&"string"!=typeof t)throw new TypeError("Data must be a string or a buffer");if(this._finalized)throw new Error("Digest already called");_.isBuffer(t)||(t=new _(t,e||"binary"));for(var r=this._block,n=0;this._blockOffset+t.length-n>=this._blockSize;){for(var i=this._blockOffset;i<this._blockSize;)r[i++]=t[n++];this._update(),this._blockOffset=0}for(;n<t.length;)r[this._blockOffset++]=t[n++];for(var o=0,s=8*t.length;s>0;++o)this._length[o]+=s,(s=this._length[o]/4294967296|0)>0&&(this._length[o]-=4294967296*s);return this},Dk.prototype._update=function(t){throw new Error("_update is not implemented")},Dk.prototype.digest=function(t){if(this._finalized)throw new Error("Digest already called");this._finalized=!0;var e=this._digest();return void 0!==t&&(e=e.toString(t)),e},Dk.prototype._digest=function(){throw new Error("_digest is not implemented")};var Uk=Dk;function Fk(){Uk.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520}function zk(t,e){return t<<e|t>>>32-e}function qk(t,e,r,n,i,o,s,a){return zk(t+(e^r^n)+o+s|0,a)+i|0}function Hk(t,e,r,n,i,o,s,a){return zk(t+(e&r|~e&n)+o+s|0,a)+i|0}function Kk(t,e,r,n,i,o,s,a){return zk(t+((e|~r)^n)+o+s|0,a)+i|0}function Gk(t,e,r,n,i,o,s,a){return zk(t+(e&n|r&~n)+o+s|0,a)+i|0}function Vk(t,e,r,n,i,o,s,a){return zk(t+(e^(r|~n))+o+s|0,a)+i|0}ri(Fk,Uk),Fk.prototype._update=function(){for(var t=new Array(16),e=0;e<16;++e)t[e]=this._block.readInt32LE(4*e);var r=this._a,n=this._b,i=this._c,o=this._d,s=this._e;r=qk(r,n,i,o,s,t[0],0,11),s=qk(s,r,n,i=zk(i,10),o,t[1],0,14),o=qk(o,s,r,n=zk(n,10),i,t[2],0,15),i=qk(i,o,s,r=zk(r,10),n,t[3],0,12),n=qk(n,i,o,s=zk(s,10),r,t[4],0,5),r=qk(r,n,i,o=zk(o,10),s,t[5],0,8),s=qk(s,r,n,i=zk(i,10),o,t[6],0,7),o=qk(o,s,r,n=zk(n,10),i,t[7],0,9),i=qk(i,o,s,r=zk(r,10),n,t[8],0,11),n=qk(n,i,o,s=zk(s,10),r,t[9],0,13),r=qk(r,n,i,o=zk(o,10),s,t[10],0,14),s=qk(s,r,n,i=zk(i,10),o,t[11],0,15),o=qk(o,s,r,n=zk(n,10),i,t[12],0,6),i=qk(i,o,s,r=zk(r,10),n,t[13],0,7),n=qk(n,i,o,s=zk(s,10),r,t[14],0,9),s=Hk(s,r=qk(r,n,i,o=zk(o,10),s,t[15],0,8),n,i=zk(i,10),o,t[7],1518500249,7),o=Hk(o,s,r,n=zk(n,10),i,t[4],1518500249,6),i=Hk(i,o,s,r=zk(r,10),n,t[13],1518500249,8),n=Hk(n,i,o,s=zk(s,10),r,t[1],1518500249,13),r=Hk(r,n,i,o=zk(o,10),s,t[10],1518500249,11),s=Hk(s,r,n,i=zk(i,10),o,t[6],1518500249,9),o=Hk(o,s,r,n=zk(n,10),i,t[15],1518500249,7),i=Hk(i,o,s,r=zk(r,10),n,t[3],1518500249,15),n=Hk(n,i,o,s=zk(s,10),r,t[12],1518500249,7),r=Hk(r,n,i,o=zk(o,10),s,t[0],1518500249,12),s=Hk(s,r,n,i=zk(i,10),o,t[9],1518500249,15),o=Hk(o,s,r,n=zk(n,10),i,t[5],1518500249,9),i=Hk(i,o,s,r=zk(r,10),n,t[2],1518500249,11),n=Hk(n,i,o,s=zk(s,10),r,t[14],1518500249,7),r=Hk(r,n,i,o=zk(o,10),s,t[11],1518500249,13),o=Kk(o,s=Hk(s,r,n,i=zk(i,10),o,t[8],1518500249,12),r,n=zk(n,10),i,t[3],1859775393,11),i=Kk(i,o,s,r=zk(r,10),n,t[10],1859775393,13),n=Kk(n,i,o,s=zk(s,10),r,t[14],1859775393,6),r=Kk(r,n,i,o=zk(o,10),s,t[4],1859775393,7),s=Kk(s,r,n,i=zk(i,10),o,t[9],1859775393,14),o=Kk(o,s,r,n=zk(n,10),i,t[15],1859775393,9),i=Kk(i,o,s,r=zk(r,10),n,t[8],1859775393,13),n=Kk(n,i,o,s=zk(s,10),r,t[1],1859775393,15),r=Kk(r,n,i,o=zk(o,10),s,t[2],1859775393,14),s=Kk(s,r,n,i=zk(i,10),o,t[7],1859775393,8),o=Kk(o,s,r,n=zk(n,10),i,t[0],1859775393,13),i=Kk(i,o,s,r=zk(r,10),n,t[6],1859775393,6),n=Kk(n,i,o,s=zk(s,10),r,t[13],1859775393,5),r=Kk(r,n,i,o=zk(o,10),s,t[11],1859775393,12),s=Kk(s,r,n,i=zk(i,10),o,t[5],1859775393,7),i=Gk(i,o=Kk(o,s,r,n=zk(n,10),i,t[12],1859775393,5),s,r=zk(r,10),n,t[1],2400959708,11),n=Gk(n,i,o,s=zk(s,10),r,t[9],2400959708,12),r=Gk(r,n,i,o=zk(o,10),s,t[11],2400959708,14),s=Gk(s,r,n,i=zk(i,10),o,t[10],2400959708,15),o=Gk(o,s,r,n=zk(n,10),i,t[0],2400959708,14),i=Gk(i,o,s,r=zk(r,10),n,t[8],2400959708,15),n=Gk(n,i,o,s=zk(s,10),r,t[12],2400959708,9),r=Gk(r,n,i,o=zk(o,10),s,t[4],2400959708,8),s=Gk(s,r,n,i=zk(i,10),o,t[13],2400959708,9),o=Gk(o,s,r,n=zk(n,10),i,t[3],2400959708,14),i=Gk(i,o,s,r=zk(r,10),n,t[7],2400959708,5),n=Gk(n,i,o,s=zk(s,10),r,t[15],2400959708,6),r=Gk(r,n,i,o=zk(o,10),s,t[14],2400959708,8),s=Gk(s,r,n,i=zk(i,10),o,t[5],2400959708,6),o=Gk(o,s,r,n=zk(n,10),i,t[6],2400959708,5),n=Vk(n,i=Gk(i,o,s,r=zk(r,10),n,t[2],2400959708,12),o,s=zk(s,10),r,t[4],2840853838,9),r=Vk(r,n,i,o=zk(o,10),s,t[0],2840853838,15),s=Vk(s,r,n,i=zk(i,10),o,t[5],2840853838,5),o=Vk(o,s,r,n=zk(n,10),i,t[9],2840853838,11),i=Vk(i,o,s,r=zk(r,10),n,t[7],2840853838,6),n=Vk(n,i,o,s=zk(s,10),r,t[12],2840853838,8),r=Vk(r,n,i,o=zk(o,10),s,t[2],2840853838,13),s=Vk(s,r,n,i=zk(i,10),o,t[10],2840853838,12),o=Vk(o,s,r,n=zk(n,10),i,t[14],2840853838,5),i=Vk(i,o,s,r=zk(r,10),n,t[1],2840853838,12),n=Vk(n,i,o,s=zk(s,10),r,t[3],2840853838,13),r=Vk(r,n,i,o=zk(o,10),s,t[8],2840853838,14),s=Vk(s,r,n,i=zk(i,10),o,t[11],2840853838,11),o=Vk(o,s,r,n=zk(n,10),i,t[6],2840853838,8),i=Vk(i,o,s,r=zk(r,10),n,t[15],2840853838,5),n=Vk(n,i,o,s=zk(s,10),r,t[13],2840853838,6),o=zk(o,10);var a=this._a,u=this._b,h=this._c,c=this._d,f=this._e;a=Vk(a,u,h,c,f,t[5],1352829926,8),f=Vk(f,a,u,h=zk(h,10),c,t[14],1352829926,9),c=Vk(c,f,a,u=zk(u,10),h,t[7],1352829926,9),h=Vk(h,c,f,a=zk(a,10),u,t[0],1352829926,11),u=Vk(u,h,c,f=zk(f,10),a,t[9],1352829926,13),a=Vk(a,u,h,c=zk(c,10),f,t[2],1352829926,15),f=Vk(f,a,u,h=zk(h,10),c,t[11],1352829926,15),c=Vk(c,f,a,u=zk(u,10),h,t[4],1352829926,5),h=Vk(h,c,f,a=zk(a,10),u,t[13],1352829926,7),u=Vk(u,h,c,f=zk(f,10),a,t[6],1352829926,7),a=Vk(a,u,h,c=zk(c,10),f,t[15],1352829926,8),f=Vk(f,a,u,h=zk(h,10),c,t[8],1352829926,11),c=Vk(c,f,a,u=zk(u,10),h,t[1],1352829926,14),h=Vk(h,c,f,a=zk(a,10),u,t[10],1352829926,14),u=Vk(u,h,c,f=zk(f,10),a,t[3],1352829926,12),f=Gk(f,a=Vk(a,u,h,c=zk(c,10),f,t[12],1352829926,6),u,h=zk(h,10),c,t[6],1548603684,9),c=Gk(c,f,a,u=zk(u,10),h,t[11],1548603684,13),h=Gk(h,c,f,a=zk(a,10),u,t[3],1548603684,15),u=Gk(u,h,c,f=zk(f,10),a,t[7],1548603684,7),a=Gk(a,u,h,c=zk(c,10),f,t[0],1548603684,12),f=Gk(f,a,u,h=zk(h,10),c,t[13],1548603684,8),c=Gk(c,f,a,u=zk(u,10),h,t[5],1548603684,9),h=Gk(h,c,f,a=zk(a,10),u,t[10],1548603684,11),u=Gk(u,h,c,f=zk(f,10),a,t[14],1548603684,7),a=Gk(a,u,h,c=zk(c,10),f,t[15],1548603684,7),f=Gk(f,a,u,h=zk(h,10),c,t[8],1548603684,12),c=Gk(c,f,a,u=zk(u,10),h,t[12],1548603684,7),h=Gk(h,c,f,a=zk(a,10),u,t[4],1548603684,6),u=Gk(u,h,c,f=zk(f,10),a,t[9],1548603684,15),a=Gk(a,u,h,c=zk(c,10),f,t[1],1548603684,13),c=Kk(c,f=Gk(f,a,u,h=zk(h,10),c,t[2],1548603684,11),a,u=zk(u,10),h,t[15],1836072691,9),h=Kk(h,c,f,a=zk(a,10),u,t[5],1836072691,7),u=Kk(u,h,c,f=zk(f,10),a,t[1],1836072691,15),a=Kk(a,u,h,c=zk(c,10),f,t[3],1836072691,11),f=Kk(f,a,u,h=zk(h,10),c,t[7],1836072691,8),c=Kk(c,f,a,u=zk(u,10),h,t[14],1836072691,6),h=Kk(h,c,f,a=zk(a,10),u,t[6],1836072691,6),u=Kk(u,h,c,f=zk(f,10),a,t[9],1836072691,14),a=Kk(a,u,h,c=zk(c,10),f,t[11],1836072691,12),f=Kk(f,a,u,h=zk(h,10),c,t[8],1836072691,13),c=Kk(c,f,a,u=zk(u,10),h,t[12],1836072691,5),h=Kk(h,c,f,a=zk(a,10),u,t[2],1836072691,14),u=Kk(u,h,c,f=zk(f,10),a,t[10],1836072691,13),a=Kk(a,u,h,c=zk(c,10),f,t[0],1836072691,13),f=Kk(f,a,u,h=zk(h,10),c,t[4],1836072691,7),h=Hk(h,c=Kk(c,f,a,u=zk(u,10),h,t[13],1836072691,5),f,a=zk(a,10),u,t[8],2053994217,15),u=Hk(u,h,c,f=zk(f,10),a,t[6],2053994217,5),a=Hk(a,u,h,c=zk(c,10),f,t[4],2053994217,8),f=Hk(f,a,u,h=zk(h,10),c,t[1],2053994217,11),c=Hk(c,f,a,u=zk(u,10),h,t[3],2053994217,14),h=Hk(h,c,f,a=zk(a,10),u,t[11],2053994217,14),u=Hk(u,h,c,f=zk(f,10),a,t[15],2053994217,6),a=Hk(a,u,h,c=zk(c,10),f,t[0],2053994217,14),f=Hk(f,a,u,h=zk(h,10),c,t[5],2053994217,6),c=Hk(c,f,a,u=zk(u,10),h,t[12],2053994217,9),h=Hk(h,c,f,a=zk(a,10),u,t[2],2053994217,12),u=Hk(u,h,c,f=zk(f,10),a,t[13],2053994217,9),a=Hk(a,u,h,c=zk(c,10),f,t[9],2053994217,12),f=Hk(f,a,u,h=zk(h,10),c,t[7],2053994217,5),c=Hk(c,f,a,u=zk(u,10),h,t[10],2053994217,15),u=qk(u,h=Hk(h,c,f,a=zk(a,10),u,t[14],2053994217,8),c,f=zk(f,10),a,t[12],0,8),a=qk(a,u,h,c=zk(c,10),f,t[15],0,5),f=qk(f,a,u,h=zk(h,10),c,t[10],0,12),c=qk(c,f,a,u=zk(u,10),h,t[4],0,9),h=qk(h,c,f,a=zk(a,10),u,t[1],0,12),u=qk(u,h,c,f=zk(f,10),a,t[5],0,5),a=qk(a,u,h,c=zk(c,10),f,t[8],0,14),f=qk(f,a,u,h=zk(h,10),c,t[7],0,6),c=qk(c,f,a,u=zk(u,10),h,t[6],0,8),h=qk(h,c,f,a=zk(a,10),u,t[2],0,13),u=qk(u,h,c,f=zk(f,10),a,t[13],0,6),a=qk(a,u,h,c=zk(c,10),f,t[14],0,5),f=qk(f,a,u,h=zk(h,10),c,t[0],0,15),c=qk(c,f,a,u=zk(u,10),h,t[3],0,13),h=qk(h,c,f,a=zk(a,10),u,t[9],0,11),u=qk(u,h,c,f=zk(f,10),a,t[11],0,11),c=zk(c,10);var l=this._b+i+c|0;this._b=this._c+o+f|0,this._c=this._d+s+a|0,this._d=this._e+r+u|0,this._e=this._a+n+h|0,this._a=l},Fk.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var t=new _(20);return t.writeInt32LE(this._a,0),t.writeInt32LE(this._b,4),t.writeInt32LE(this._c,8),t.writeInt32LE(this._d,12),t.writeInt32LE(this._e,16),t};var Wk=Fk,Jk=yg.Buffer,Zk=LA,Yk="undefined"!=typeof Uint8Array,Xk=Yk&&"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView,$k=function(t,e,r){if("string"==typeof t||Jk.isBuffer(t)||Yk&&t instanceof Uint8Array||Xk&&Xk(t))return Zk(t,e);throw new TypeError(r+" must be a string, a Buffer, a Uint8Array, or a DataView")},Qk=function(t){return Rk(t,Bk)},tx=Wk,ex=XM,rx=yg.Buffer,nx=kk,ix=xk,ox=$k,sx=rx.alloc(128),ax={__proto__:null,md5:16,sha1:20,sha224:28,sha256:32,sha384:48,sha512:64,"sha512-256":32,ripemd160:20,rmd160:20},ux={__proto__:null,"sha-1":"sha1","sha-224":"sha224","sha-256":"sha256","sha-384":"sha384","sha-512":"sha512","ripemd-160":"ripemd160"};function hx(t){return(new tx).update(t).digest()}function cx(t,e,r){var n=function(t){return"rmd160"===t||"ripemd160"===t?hx:"md5"===t?Qk:function(e){return ex(t).update(e).digest()}}(t),i="sha512"===t||"sha384"===t?128:64;e.length>i?e=n(e):e.length<i&&(e=rx.concat([e,sx],i));for(var o=rx.allocUnsafe(i+ax[t]),s=rx.allocUnsafe(i+ax[t]),a=0;a<i;a++)o[a]=54^e[a],s[a]=92^e[a];var u=rx.allocUnsafe(i+r+4);o.copy(u,0,0,i),this.ipad1=u,this.ipad2=o,this.opad=s,this.alg=t,this.blocksize=i,this.hash=n,this.size=ax[t]}cx.prototype.run=function(t,e){return t.copy(e,this.blocksize),this.hash(e).copy(this.opad,this.blocksize),this.hash(this.opad)};var fx,lx,dx=function(t,e,r,n,i){nx(r,n),t=ox(t,ix,"Password"),e=ox(e,ix,"Salt");var o=(i||"sha1").toLowerCase(),s=ux[o]||o,a=ax[s];if("number"!=typeof a||!a)throw new TypeError("Digest algorithm not supported: "+i);var u=new cx(s,t,e.length),h=rx.allocUnsafe(n),c=rx.allocUnsafe(e.length+4);e.copy(c,0,0,e.length);for(var f=0,l=a,d=Math.ceil(n/l),p=1;p<=d;p++){c.writeUInt32BE(p,e.length);for(var m=u.run(c,u.ipad1),g=m,y=1;y<r;y++){g=u.run(g,u.ipad2);for(var b=0;b<l;b++)m[b]^=g[b]}m.copy(h,f),f+=l}return h},px=yg.Buffer,mx=kk,gx=xk,yx=dx,bx=$k,vx=e.crypto&&e.crypto.subtle,wx={sha:"SHA-1","sha-1":"SHA-1",sha1:"SHA-1",sha256:"SHA-256","sha-256":"SHA-256",sha384:"SHA-384","sha-384":"SHA-384","sha-512":"SHA-512",sha512:"SHA-512"},_x=[];function Ex(){return lx||(lx=e.process&&e.process.nextTick?e.process.nextTick:e.queueMicrotask?e.queueMicrotask:e.setImmediate?e.setImmediate:e.setTimeout)}function Ax(t,e,r,n,i){return vx.importKey("raw",t,{name:"PBKDF2"},!1,["deriveBits"]).then(function(t){return vx.deriveBits({name:"PBKDF2",salt:e,iterations:r,hash:{name:i}},t,n<<3)}).then(function(t){return px.from(t)})}Mk.pbkdf2=function(t,r,n,i,o,s){"function"==typeof o&&(s=o,o=void 0);var a=wx[(o=o||"sha1").toLowerCase()];if(a&&"function"==typeof e.Promise){if(mx(n,i),t=bx(t,gx,"Password"),r=bx(r,gx,"Salt"),"function"!=typeof s)throw new Error("No callback provided to pbkdf2");!function(t,e){t.then(function(t){Ex()(function(){e(null,t)})},function(t){Ex()(function(){e(t)})})}(function(t){if(e.process&&!e.process.browser)return Promise.resolve(!1);if(!vx||!vx.importKey||!vx.deriveBits)return Promise.resolve(!1);if(void 0!==_x[t])return _x[t];var r=Ax(fx=fx||px.alloc(8),fx,10,128,t).then(function(){return!0},function(){return!1});return _x[t]=r,r}(a).then(function(e){return e?Ax(t,r,n,i,a):yx(t,r,n,i,o)}),s)}else Ex()(function(){var e;try{e=yx(t,r,n,i,o)}catch(t){return void s(t)}s(null,e)})},Mk.pbkdf2Sync=dx;var Mx={},Sx={},kx={readUInt32BE:function(t,e){return(t[0+e]<<24|t[1+e]<<16|t[2+e]<<8|t[3+e])>>>0},writeUInt32BE:function(t,e,r){t[0+r]=e>>>24,t[1+r]=e>>>16&255,t[2+r]=e>>>8&255,t[3+r]=255&e},ip:function(t,e,r,n){for(var i=0,o=0,s=6;s>=0;s-=2){for(var a=0;a<=24;a+=8)i<<=1,i|=e>>>a+s&1;for(a=0;a<=24;a+=8)i<<=1,i|=t>>>a+s&1}for(s=6;s>=0;s-=2){for(a=1;a<=25;a+=8)o<<=1,o|=e>>>a+s&1;for(a=1;a<=25;a+=8)o<<=1,o|=t>>>a+s&1}r[n+0]=i>>>0,r[n+1]=o>>>0},rip:function(t,e,r,n){for(var i=0,o=0,s=0;s<4;s++)for(var a=24;a>=0;a-=8)i<<=1,i|=e>>>a+s&1,i<<=1,i|=t>>>a+s&1;for(s=4;s<8;s++)for(a=24;a>=0;a-=8)o<<=1,o|=e>>>a+s&1,o<<=1,o|=t>>>a+s&1;r[n+0]=i>>>0,r[n+1]=o>>>0},pc1:function(t,e,r,n){for(var i=0,o=0,s=7;s>=5;s--){for(var a=0;a<=24;a+=8)i<<=1,i|=e>>a+s&1;for(a=0;a<=24;a+=8)i<<=1,i|=t>>a+s&1}for(a=0;a<=24;a+=8)i<<=1,i|=e>>a+s&1;for(s=1;s<=3;s++){for(a=0;a<=24;a+=8)o<<=1,o|=e>>a+s&1;for(a=0;a<=24;a+=8)o<<=1,o|=t>>a+s&1}for(a=0;a<=24;a+=8)o<<=1,o|=t>>a+s&1;r[n+0]=i>>>0,r[n+1]=o>>>0},r28shl:function(t,e){return t<<e&268435455|t>>>28-e}},xx=[14,11,17,4,27,23,25,0,13,22,7,18,5,9,16,24,2,20,12,21,1,8,15,26,15,4,25,19,9,1,26,16,5,11,23,8,12,7,17,0,22,3,10,14,6,20,27,24];kx.pc2=function(t,e,r,n){for(var i=0,o=0,s=xx.length>>>1,a=0;a<s;a++)i<<=1,i|=t>>>xx[a]&1;for(a=s;a<xx.length;a++)o<<=1,o|=e>>>xx[a]&1;r[n+0]=i>>>0,r[n+1]=o>>>0},kx.expand=function(t,e,r){var n=0,i=0;n=(1&t)<<5|t>>>27;for(var o=23;o>=15;o-=4)n<<=6,n|=t>>>o&63;for(o=11;o>=3;o-=4)i|=t>>>o&63,i<<=6;i|=(31&t)<<1|t>>>31,e[r+0]=n>>>0,e[r+1]=i>>>0};var Tx=[14,0,4,15,13,7,1,4,2,14,15,2,11,13,8,1,3,10,10,6,6,12,12,11,5,9,9,5,0,3,7,8,4,15,1,12,14,8,8,2,13,4,6,9,2,1,11,7,15,5,12,11,9,3,7,14,3,10,10,0,5,6,0,13,15,3,1,13,8,4,14,7,6,15,11,2,3,8,4,14,9,12,7,0,2,1,13,10,12,6,0,9,5,11,10,5,0,13,14,8,7,10,11,1,10,3,4,15,13,4,1,2,5,11,8,6,12,7,6,12,9,0,3,5,2,14,15,9,10,13,0,7,9,0,14,9,6,3,3,4,15,6,5,10,1,2,13,8,12,5,7,14,11,12,4,11,2,15,8,1,13,1,6,10,4,13,9,0,8,6,15,9,3,8,0,7,11,4,1,15,2,14,12,3,5,11,10,5,14,2,7,12,7,13,13,8,14,11,3,5,0,6,6,15,9,0,10,3,1,4,2,7,8,2,5,12,11,1,12,10,4,14,15,9,10,3,6,15,9,0,0,6,12,10,11,1,7,13,13,8,15,9,1,4,3,5,14,11,5,12,2,7,8,2,4,14,2,14,12,11,4,2,1,12,7,4,10,7,11,13,6,1,8,5,5,0,3,15,15,10,13,3,0,9,14,8,9,6,4,11,2,8,1,12,11,7,10,1,13,14,7,2,8,13,15,6,9,15,12,0,5,9,6,10,3,4,0,5,14,3,12,10,1,15,10,4,15,2,9,7,2,12,6,9,8,5,0,6,13,1,3,13,4,14,14,0,7,11,5,3,11,8,9,4,14,3,15,2,5,12,2,9,8,5,12,15,3,10,7,11,0,14,4,1,10,7,1,6,13,0,11,8,6,13,4,13,11,0,2,11,14,7,15,4,0,9,8,1,13,10,3,14,12,3,9,5,7,12,5,2,10,15,6,8,1,6,1,6,4,11,11,13,13,8,12,1,3,4,7,10,14,7,10,9,15,5,6,0,8,15,0,14,5,2,9,3,2,12,13,1,2,15,8,13,4,8,6,10,15,3,11,7,1,4,10,12,9,5,3,6,14,11,5,0,0,14,12,9,7,2,7,2,11,1,4,14,1,7,9,4,12,10,14,8,2,13,0,15,6,12,10,9,13,0,15,3,3,5,5,6,8,11];kx.substitute=function(t,e){for(var r=0,n=0;n<4;n++){r<<=4,r|=Tx[64*n+(t>>>18-6*n&63)]}for(n=0;n<4;n++){r<<=4,r|=Tx[256+64*n+(e>>>18-6*n&63)]}return r>>>0};var Rx=[16,25,12,11,3,20,4,15,31,17,9,6,27,14,1,22,30,24,8,18,0,5,29,23,13,19,2,26,10,21,28,7];function Bx(t){this.options=t,this.type=this.options.type,this.blockSize=8,this._init(),this.buffer=new Array(this.blockSize),this.bufferOff=0,this.padding=!1!==t.padding}kx.permute=function(t){for(var e=0,r=0;r<Rx.length;r++)e<<=1,e|=t>>>Rx[r]&1;return e>>>0},kx.padSplit=function(t,e,r){for(var n=t.toString(2);n.length<e;)n="0"+n;for(var i=[],o=0;o<e;o+=r)i.push(n.slice(o,o+r));return i.join(" ")};var Nx=Bx;Bx.prototype._init=function(){},Bx.prototype.update=function(t){return 0===t.length?[]:"decrypt"===this.type?this._updateDecrypt(t):this._updateEncrypt(t)},Bx.prototype._buffer=function(t,e){for(var r=Math.min(this.buffer.length-this.bufferOff,t.length-e),n=0;n<r;n++)this.buffer[this.bufferOff+n]=t[e+n];return this.bufferOff+=r,r},Bx.prototype._flushBuffer=function(t,e){return this._update(this.buffer,0,t,e),this.bufferOff=0,this.blockSize},Bx.prototype._updateEncrypt=function(t){var e=0,r=0,n=(this.bufferOff+t.length)/this.blockSize|0,i=new Array(n*this.blockSize);0!==this.bufferOff&&(e+=this._buffer(t,e),this.bufferOff===this.buffer.length&&(r+=this._flushBuffer(i,r)));for(var o=t.length-(t.length-e)%this.blockSize;e<o;e+=this.blockSize)this._update(t,e,i,r),r+=this.blockSize;for(;e<t.length;e++,this.bufferOff++)this.buffer[this.bufferOff]=t[e];return i},Bx.prototype._updateDecrypt=function(t){for(var e=0,r=0,n=Math.ceil((this.bufferOff+t.length)/this.blockSize)-1,i=new Array(n*this.blockSize);n>0;n--)e+=this._buffer(t,e),r+=this._flushBuffer(i,r);return e+=this._buffer(t,e),i},Bx.prototype.final=function(t){var e,r;return t&&(e=this.update(t)),r="encrypt"===this.type?this._finalEncrypt():this._finalDecrypt(),e?e.concat(r):r},Bx.prototype._pad=function(t,e){if(0===e)return!1;for(;e<t.length;)t[e++]=0;return!0},Bx.prototype._finalEncrypt=function(){if(!this._pad(this.buffer,this.bufferOff))return[];var t=new Array(this.blockSize);return this._update(this.buffer,0,t,0),t},Bx.prototype._unpad=function(t){return t},Bx.prototype._finalDecrypt=function(){var t=new Array(this.blockSize);return this._flushBuffer(t,0),this._unpad(t)};var Px=kx,Ix=Nx;function Ox(){this.tmp=new Array(2),this.keys=null}function Cx(t){Ix.call(this,t);var e=new Ox;this._desState=e,this.deriveKeys(e,t.key)}ri(Cx,Ix);var Lx=Cx;Cx.create=function(t){return new Cx(t)};var jx=[1,1,2,2,2,2,2,2,1,2,2,2,2,2,2,1];Cx.prototype.deriveKeys=function(t,e){t.keys=new Array(32);var r=Px.readUInt32BE(e,0),n=Px.readUInt32BE(e,4);Px.pc1(r,n,t.tmp,0),r=t.tmp[0],n=t.tmp[1];for(var i=0;i<t.keys.length;i+=2){var o=jx[i>>>1];r=Px.r28shl(r,o),n=Px.r28shl(n,o),Px.pc2(r,n,t.keys,i)}},Cx.prototype._update=function(t,e,r,n){var i=this._desState,o=Px.readUInt32BE(t,e),s=Px.readUInt32BE(t,e+4);Px.ip(o,s,i.tmp,0),o=i.tmp[0],s=i.tmp[1],"encrypt"===this.type?this._encrypt(i,o,s,i.tmp,0):this._decrypt(i,o,s,i.tmp,0),o=i.tmp[0],s=i.tmp[1],Px.writeUInt32BE(r,o,n),Px.writeUInt32BE(r,s,n+4)},Cx.prototype._pad=function(t,e){if(!1===this.padding)return!1;for(var r=t.length-e,n=e;n<t.length;n++)t[n]=r;return!0},Cx.prototype._unpad=function(t){if(!1===this.padding)return t;for(var e=t[t.length-1],r=t.length-e;r<t.length;r++);return t.slice(0,t.length-e)},Cx.prototype._encrypt=function(t,e,r,n,i){for(var o=e,s=r,a=0;a<t.keys.length;a+=2){var u=t.keys[a],h=t.keys[a+1];Px.expand(s,t.tmp,0),u^=t.tmp[0],h^=t.tmp[1];var c=Px.substitute(u,h),f=s;s=(o^Px.permute(c))>>>0,o=f}Px.rip(s,o,n,i)},Cx.prototype._decrypt=function(t,e,r,n,i){for(var o=r,s=e,a=t.keys.length-2;a>=0;a-=2){var u=t.keys[a],h=t.keys[a+1];Px.expand(o,t.tmp,0),u^=t.tmp[0],h^=t.tmp[1];var c=Px.substitute(u,h),f=o;o=(s^Px.permute(c))>>>0,s=f}Px.rip(o,s,n,i)};var Dx={},Ux=ri,Fx={};function zx(t){this.iv=new Array(8);for(var e=0;e<this.iv.length;e++)this.iv[e]=t[e]}Dx.instantiate=function(t){function e(e){t.call(this,e),this._cbcInit()}Ux(e,t);for(var r=Object.keys(Fx),n=0;n<r.length;n++){var i=r[n];e.prototype[i]=Fx[i]}return e.create=function(t){return new e(t)},e},Fx._cbcInit=function(){var t=new zx(this.options.iv);this._cbcState=t},Fx._update=function(t,e,r,n){var i=this._cbcState,o=this.constructor.super_.prototype,s=i.iv;if("encrypt"===this.type){for(var a=0;a<this.blockSize;a++)s[a]^=t[e+a];o._update.call(this,s,0,r,n);for(a=0;a<this.blockSize;a++)s[a]=r[n+a]}else{o._update.call(this,t,e,r,n);for(a=0;a<this.blockSize;a++)r[n+a]^=s[a];for(a=0;a<this.blockSize;a++)s[a]=t[e+a]}};var qx=Nx,Hx=Lx;function Kx(t,e){var r=e.slice(0,8),n=e.slice(8,16),i=e.slice(16,24);this.ciphers="encrypt"===t?[Hx.create({type:"encrypt",key:r}),Hx.create({type:"decrypt",key:n}),Hx.create({type:"encrypt",key:i})]:[Hx.create({type:"decrypt",key:i}),Hx.create({type:"encrypt",key:n}),Hx.create({type:"decrypt",key:r})]}function Gx(t){qx.call(this,t);var e=new Kx(this.type,this.options.key);this._edeState=e}ri(Gx,qx);var Vx=Gx;Gx.create=function(t){return new Gx(t)},Gx.prototype._update=function(t,e,r,n){var i=this._edeState;i.ciphers[0]._update(t,e,r,n),i.ciphers[1]._update(r,n,r,n),i.ciphers[2]._update(r,n,r,n)},Gx.prototype._pad=Hx.prototype._pad,Gx.prototype._unpad=Hx.prototype._unpad,Sx.utils=kx,Sx.Cipher=Nx,Sx.DES=Lx,Sx.CBC=Dx,Sx.EDE=Vx;var Wx=XS,Jx=Sx,Zx=ri,Yx=yg.Buffer,Xx={"des-ede3-cbc":Jx.CBC.instantiate(Jx.EDE),"des-ede3":Jx.EDE,"des-ede-cbc":Jx.CBC.instantiate(Jx.EDE),"des-ede":Jx.EDE,"des-cbc":Jx.CBC.instantiate(Jx.DES),"des-ecb":Jx.DES};Xx.des=Xx["des-cbc"],Xx.des3=Xx["des-ede3-cbc"];var $x=Qx;function Qx(t){Wx.call(this);var e,r=t.mode.toLowerCase(),n=Xx[r];e=t.decrypt?"decrypt":"encrypt";var i=t.key;Yx.isBuffer(i)||(i=Yx.from(i)),"des-ede"!==r&&"des-ede-cbc"!==r||(i=Yx.concat([i,i.slice(0,8)]));var o=t.iv;Yx.isBuffer(o)||(o=Yx.from(o)),this._des=n.create({key:i,iv:o,type:e})}Zx(Qx,Wx),Qx.prototype._update=function(t){return Yx.from(this._des.update(t))},Qx.prototype._final=function(){return Yx.from(this._des.final())};var tT={},eT={},rT={encrypt:function(t,e){return t._cipher.encryptBlock(e)},decrypt:function(t,e){return t._cipher.decryptBlock(e)}},nT={},iT=function(t,e){for(var r=Math.min(t.length,e.length),n=new _(r),i=0;i<r;++i)n[i]=t[i]^e[i];return n},oT=iT;nT.encrypt=function(t,e){var r=oT(e,t._prev);return t._prev=t._cipher.encryptBlock(r),t._prev},nT.decrypt=function(t,e){var r=t._prev;t._prev=e;var n=t._cipher.decryptBlock(e);return oT(n,r)};var sT={},aT=yg.Buffer,uT=iT;function hT(t,e,r){var n=e.length,i=uT(e,t._cache);return t._cache=t._cache.slice(n),t._prev=aT.concat([t._prev,r?e:i]),i}sT.encrypt=function(t,e,r){for(var n,i=aT.allocUnsafe(0);e.length;){if(0===t._cache.length&&(t._cache=t._cipher.encryptBlock(t._prev),t._prev=aT.allocUnsafe(0)),!(t._cache.length<=e.length)){i=aT.concat([i,hT(t,e,r)]);break}n=t._cache.length,i=aT.concat([i,hT(t,e.slice(0,n),r)]),e=e.slice(n)}return i};var cT={},fT=yg.Buffer;function lT(t,e,r){var n=t._cipher.encryptBlock(t._prev)[0]^e;return t._prev=fT.concat([t._prev.slice(1),fT.from([r?e:n])]),n}cT.encrypt=function(t,e,r){for(var n=e.length,i=fT.allocUnsafe(n),o=-1;++o<n;)i[o]=lT(t,e[o],r);return i};var dT={},pT=yg.Buffer;function mT(t,e,r){for(var n,i,o=-1,s=0;++o<8;)n=e&1<<7-o?128:0,s+=(128&(i=t._cipher.encryptBlock(t._prev)[0]^n))>>o%8,t._prev=gT(t._prev,r?n:i);return s}function gT(t,e){var r=t.length,n=-1,i=pT.allocUnsafe(t.length);for(t=pT.concat([t,pT.from([e])]);++n<r;)i[n]=t[n]<<1|t[n+1]>>7;return i}dT.encrypt=function(t,e,r){for(var n=e.length,i=pT.allocUnsafe(n),o=-1;++o<n;)i[o]=mT(t,e[o],r);return i};var yT={},bT=iT;function vT(t){return t._prev=t._cipher.encryptBlock(t._prev),t._prev}yT.encrypt=function(t,e){for(;t._cache.length<e.length;)t._cache=_.concat([t._cache,vT(t)]);var r=t._cache.slice(0,e.length);return t._cache=t._cache.slice(e.length),bT(e,r)};var wT={};var _T=function(t){for(var e,r=t.length;r--;){if(255!==(e=t.readUInt8(r))){e++,t.writeUInt8(e,r);break}t.writeUInt8(0,r)}},ET=iT,AT=yg.Buffer,MT=_T;function ST(t){var e=t._cipher.encryptBlockRaw(t._prev);return MT(t._prev),e}wT.encrypt=function(t,e){var r=Math.ceil(e.length/16),n=t._cache.length;t._cache=AT.concat([t._cache,AT.allocUnsafe(16*r)]);for(var i=0;i<r;i++){var o=ST(t),s=n+16*i;t._cache.writeUInt32BE(o[0],s+0),t._cache.writeUInt32BE(o[1],s+4),t._cache.writeUInt32BE(o[2],s+8),t._cache.writeUInt32BE(o[3],s+12)}var a=t._cache.slice(0,e.length);return t._cache=t._cache.slice(e.length),ET(e,a)};var kT={"aes-128-ecb":{cipher:"AES",key:128,iv:0,mode:"ECB",type:"block"},"aes-192-ecb":{cipher:"AES",key:192,iv:0,mode:"ECB",type:"block"},"aes-256-ecb":{cipher:"AES",key:256,iv:0,mode:"ECB",type:"block"},"aes-128-cbc":{cipher:"AES",key:128,iv:16,mode:"CBC",type:"block"},"aes-192-cbc":{cipher:"AES",key:192,iv:16,mode:"CBC",type:"block"},"aes-256-cbc":{cipher:"AES",key:256,iv:16,mode:"CBC",type:"block"},aes128:{cipher:"AES",key:128,iv:16,mode:"CBC",type:"block"},aes192:{cipher:"AES",key:192,iv:16,mode:"CBC",type:"block"},aes256:{cipher:"AES",key:256,iv:16,mode:"CBC",type:"block"},"aes-128-cfb":{cipher:"AES",key:128,iv:16,mode:"CFB",type:"stream"},"aes-192-cfb":{cipher:"AES",key:192,iv:16,mode:"CFB",type:"stream"},"aes-256-cfb":{cipher:"AES",key:256,iv:16,mode:"CFB",type:"stream"},"aes-128-cfb8":{cipher:"AES",key:128,iv:16,mode:"CFB8",type:"stream"},"aes-192-cfb8":{cipher:"AES",key:192,iv:16,mode:"CFB8",type:"stream"},"aes-256-cfb8":{cipher:"AES",key:256,iv:16,mode:"CFB8",type:"stream"},"aes-128-cfb1":{cipher:"AES",key:128,iv:16,mode:"CFB1",type:"stream"},"aes-192-cfb1":{cipher:"AES",key:192,iv:16,mode:"CFB1",type:"stream"},"aes-256-cfb1":{cipher:"AES",key:256,iv:16,mode:"CFB1",type:"stream"},"aes-128-ofb":{cipher:"AES",key:128,iv:16,mode:"OFB",type:"stream"},"aes-192-ofb":{cipher:"AES",key:192,iv:16,mode:"OFB",type:"stream"},"aes-256-ofb":{cipher:"AES",key:256,iv:16,mode:"OFB",type:"stream"},"aes-128-ctr":{cipher:"AES",key:128,iv:16,mode:"CTR",type:"stream"},"aes-192-ctr":{cipher:"AES",key:192,iv:16,mode:"CTR",type:"stream"},"aes-256-ctr":{cipher:"AES",key:256,iv:16,mode:"CTR",type:"stream"},"aes-128-gcm":{cipher:"AES",key:128,iv:12,mode:"GCM",type:"auth"},"aes-192-gcm":{cipher:"AES",key:192,iv:12,mode:"GCM",type:"auth"},"aes-256-gcm":{cipher:"AES",key:256,iv:12,mode:"GCM",type:"auth"}},xT={ECB:rT,CBC:nT,CFB:sT,CFB8:cT,CFB1:dT,OFB:yT,CTR:wT,GCM:wT},TT=kT;for(var RT in TT)TT[RT].module=xT[TT[RT].mode];var BT=TT,NT={},PT=yg.Buffer;function IT(t){PT.isBuffer(t)||(t=PT.from(t));for(var e=t.length/4|0,r=new Array(e),n=0;n<e;n++)r[n]=t.readUInt32BE(4*n);return r}function OT(t){for(;0<t.length;t++)t[0]=0}function CT(t,e,r,n,i){for(var o,s,a,u,h=r[0],c=r[1],f=r[2],l=r[3],d=t[0]^e[0],p=t[1]^e[1],m=t[2]^e[2],g=t[3]^e[3],y=4,b=1;b<i;b++)o=h[d>>>24]^c[p>>>16&255]^f[m>>>8&255]^l[255&g]^e[y++],s=h[p>>>24]^c[m>>>16&255]^f[g>>>8&255]^l[255&d]^e[y++],a=h[m>>>24]^c[g>>>16&255]^f[d>>>8&255]^l[255&p]^e[y++],u=h[g>>>24]^c[d>>>16&255]^f[p>>>8&255]^l[255&m]^e[y++],d=o,p=s,m=a,g=u;return o=(n[d>>>24]<<24|n[p>>>16&255]<<16|n[m>>>8&255]<<8|n[255&g])^e[y++],s=(n[p>>>24]<<24|n[m>>>16&255]<<16|n[g>>>8&255]<<8|n[255&d])^e[y++],a=(n[m>>>24]<<24|n[g>>>16&255]<<16|n[d>>>8&255]<<8|n[255&p])^e[y++],u=(n[g>>>24]<<24|n[d>>>16&255]<<16|n[p>>>8&255]<<8|n[255&m])^e[y++],[o>>>=0,s>>>=0,a>>>=0,u>>>=0]}var LT=[0,1,2,4,8,16,32,64,128,27,54],jT=function(){for(var t=new Array(256),e=0;e<256;e++)t[e]=e<128?e<<1:e<<1^283;for(var r=[],n=[],i=[[],[],[],[]],o=[[],[],[],[]],s=0,a=0,u=0;u<256;++u){var h=a^a<<1^a<<2^a<<3^a<<4;h=h>>>8^255&h^99,r[s]=h,n[h]=s;var c=t[s],f=t[c],l=t[f],d=257*t[h]^16843008*h;i[0][s]=d<<24|d>>>8,i[1][s]=d<<16|d>>>16,i[2][s]=d<<8|d>>>24,i[3][s]=d,d=16843009*l^65537*f^257*c^16843008*s,o[0][h]=d<<24|d>>>8,o[1][h]=d<<16|d>>>16,o[2][h]=d<<8|d>>>24,o[3][h]=d,0===s?s=a=1:(s=c^t[t[t[l^c]]],a^=t[t[a]])}return{SBOX:r,INV_SBOX:n,SUB_MIX:i,INV_SUB_MIX:o}}();function DT(t){this._key=IT(t),this._reset()}DT.blockSize=16,DT.keySize=32,DT.prototype.blockSize=DT.blockSize,DT.prototype.keySize=DT.keySize,DT.prototype._reset=function(){for(var t=this._key,e=t.length,r=e+6,n=4*(r+1),i=[],o=0;o<e;o++)i[o]=t[o];for(o=e;o<n;o++){var s=i[o-1];o%e===0?(s=s<<8|s>>>24,s=jT.SBOX[s>>>24]<<24|jT.SBOX[s>>>16&255]<<16|jT.SBOX[s>>>8&255]<<8|jT.SBOX[255&s],s^=LT[o/e|0]<<24):e>6&&o%e===4&&(s=jT.SBOX[s>>>24]<<24|jT.SBOX[s>>>16&255]<<16|jT.SBOX[s>>>8&255]<<8|jT.SBOX[255&s]),i[o]=i[o-e]^s}for(var a=[],u=0;u<n;u++){var h=n-u,c=i[h-(u%4?0:4)];a[u]=u<4||h<=4?c:jT.INV_SUB_MIX[0][jT.SBOX[c>>>24]]^jT.INV_SUB_MIX[1][jT.SBOX[c>>>16&255]]^jT.INV_SUB_MIX[2][jT.SBOX[c>>>8&255]]^jT.INV_SUB_MIX[3][jT.SBOX[255&c]]}this._nRounds=r,this._keySchedule=i,this._invKeySchedule=a},DT.prototype.encryptBlockRaw=function(t){return CT(t=IT(t),this._keySchedule,jT.SUB_MIX,jT.SBOX,this._nRounds)},DT.prototype.encryptBlock=function(t){var e=this.encryptBlockRaw(t),r=PT.allocUnsafe(16);return r.writeUInt32BE(e[0],0),r.writeUInt32BE(e[1],4),r.writeUInt32BE(e[2],8),r.writeUInt32BE(e[3],12),r},DT.prototype.decryptBlock=function(t){var e=(t=IT(t))[1];t[1]=t[3],t[3]=e;var r=CT(t,this._invKeySchedule,jT.INV_SUB_MIX,jT.INV_SBOX,this._nRounds),n=PT.allocUnsafe(16);return n.writeUInt32BE(r[0],0),n.writeUInt32BE(r[3],4),n.writeUInt32BE(r[2],8),n.writeUInt32BE(r[1],12),n},DT.prototype.scrub=function(){OT(this._keySchedule),OT(this._invKeySchedule),OT(this._key)},NT.AES=DT;var UT=yg.Buffer,FT=UT.alloc(16,0);function zT(t){var e=UT.allocUnsafe(16);return e.writeUInt32BE(t[0]>>>0,0),e.writeUInt32BE(t[1]>>>0,4),e.writeUInt32BE(t[2]>>>0,8),e.writeUInt32BE(t[3]>>>0,12),e}function qT(t){this.h=t,this.state=UT.alloc(16,0),this.cache=UT.allocUnsafe(0)}qT.prototype.ghash=function(t){for(var e=-1;++e<t.length;)this.state[e]^=t[e];this._multiply()},qT.prototype._multiply=function(){for(var t,e,r,n=[(t=this.h).readUInt32BE(0),t.readUInt32BE(4),t.readUInt32BE(8),t.readUInt32BE(12)],i=[0,0,0,0],o=-1;++o<128;){for(!!(this.state[~~(o/8)]&1<<7-o%8)&&(i[0]^=n[0],i[1]^=n[1],i[2]^=n[2],i[3]^=n[3]),r=!!(1&n[3]),e=3;e>0;e--)n[e]=n[e]>>>1|(1&n[e-1])<<31;n[0]=n[0]>>>1,r&&(n[0]=n[0]^225<<24)}this.state=zT(i)},qT.prototype.update=function(t){var e;for(this.cache=UT.concat([this.cache,t]);this.cache.length>=16;)e=this.cache.slice(0,16),this.cache=this.cache.slice(16),this.ghash(e)},qT.prototype.final=function(t,e){return this.cache.length&&this.ghash(UT.concat([this.cache,FT],16)),this.ghash(zT([0,t,0,e])),this.state};var HT=qT,KT=NT,GT=yg.Buffer,VT=XS,WT=HT,JT=iT,ZT=_T;function YT(t,e,r,n){VT.call(this);var i=GT.alloc(4,0);this._cipher=new KT.AES(e);var o=this._cipher.encryptBlock(i);this._ghash=new WT(o),r=function(t,e,r){if(12===e.length)return t._finID=GT.concat([e,GT.from([0,0,0,1])]),GT.concat([e,GT.from([0,0,0,2])]);var n=new WT(r),i=e.length,o=i%16;n.update(e),o&&(o=16-o,n.update(GT.alloc(o,0))),n.update(GT.alloc(8,0));var s=8*i,a=GT.alloc(8);a.writeUIntBE(s,0,8),n.update(a),t._finID=n.state;var u=GT.from(t._finID);return ZT(u),u}(this,r,o),this._prev=GT.from(r),this._cache=GT.allocUnsafe(0),this._secCache=GT.allocUnsafe(0),this._decrypt=n,this._alen=0,this._len=0,this._mode=t,this._authTag=null,this._called=!1}ri(YT,VT),YT.prototype._update=function(t){if(!this._called&&this._alen){var e=16-this._alen%16;e<16&&(e=GT.alloc(e,0),this._ghash.update(e))}this._called=!0;var r=this._mode.encrypt(this,t);return this._decrypt?this._ghash.update(t):this._ghash.update(r),this._len+=t.length,r},YT.prototype._final=function(){if(this._decrypt&&!this._authTag)throw new Error("Unsupported state or unable to authenticate data");var t=JT(this._ghash.final(8*this._alen,8*this._len),this._cipher.encryptBlock(this._finID));if(this._decrypt&&function(t,e){var r=0;t.length!==e.length&&r++;for(var n=Math.min(t.length,e.length),i=0;i<n;++i)r+=t[i]^e[i];return r}(t,this._authTag))throw new Error("Unsupported state or unable to authenticate data");this._authTag=t,this._cipher.scrub()},YT.prototype.getAuthTag=function(){if(this._decrypt||!GT.isBuffer(this._authTag))throw new Error("Attempting to get auth tag in unsupported state");return this._authTag},YT.prototype.setAuthTag=function(t){if(!this._decrypt)throw new Error("Attempting to set auth tag in unsupported state");this._authTag=t},YT.prototype.setAAD=function(t){if(this._called)throw new Error("Attempting to set AAD in unsupported state");this._ghash.update(t),this._alen+=t.length};var XT=YT,$T=NT,QT=yg.Buffer,tR=XS;function eR(t,e,r,n){tR.call(this),this._cipher=new $T.AES(e),this._prev=QT.from(r),this._cache=QT.allocUnsafe(0),this._secCache=QT.allocUnsafe(0),this._decrypt=n,this._mode=t}ri(eR,tR),eR.prototype._update=function(t){return this._mode.encrypt(this,t,this._decrypt)},eR.prototype._final=function(){this._cipher.scrub()};var rR=eR,nR=yg.Buffer,iR=Sw;var oR=function(t,e,r,n){if(nR.isBuffer(t)||(t=nR.from(t,"binary")),e&&(nR.isBuffer(e)||(e=nR.from(e,"binary")),8!==e.length))throw new RangeError("salt should be Buffer with 8 byte length");for(var i=r/8,o=nR.alloc(i),s=nR.alloc(n||0),a=nR.alloc(0);i>0||n>0;){var u=new iR;u.update(a),u.update(t),e&&u.update(e),a=u.digest();var h=0;if(i>0){var c=o.length-i;h=Math.min(i,a.length),a.copy(o,c,0,h),i-=h}if(h<a.length&&n>0){var f=s.length-n,l=Math.min(n,a.length-h);a.copy(s,f,h,h+l),n-=l}}return a.fill(0),{key:o,iv:s}},sR=BT,aR=XT,uR=yg.Buffer,hR=rR,cR=XS,fR=NT,lR=oR;function dR(t,e,r){cR.call(this),this._cache=new mR,this._cipher=new fR.AES(e),this._prev=uR.from(r),this._mode=t,this._autopadding=!0}ri(dR,cR),dR.prototype._update=function(t){var e,r;this._cache.add(t);for(var n=[];e=this._cache.get();)r=this._mode.encrypt(this,e),n.push(r);return uR.concat(n)};var pR=uR.alloc(16,16);function mR(){this.cache=uR.allocUnsafe(0)}function gR(t,e,r){var n=sR[t.toLowerCase()];if(!n)throw new TypeError("invalid suite type");if("string"==typeof e&&(e=uR.from(e)),e.length!==n.key/8)throw new TypeError("invalid key length "+e.length);if("string"==typeof r&&(r=uR.from(r)),"GCM"!==n.mode&&r.length!==n.iv)throw new TypeError("invalid iv length "+r.length);return"stream"===n.type?new hR(n.module,e,r):"auth"===n.type?new aR(n.module,e,r):new dR(n.module,e,r)}dR.prototype._final=function(){var t=this._cache.flush();if(this._autopadding)return t=this._mode.encrypt(this,t),this._cipher.scrub(),t;if(!t.equals(pR))throw this._cipher.scrub(),new Error("data not multiple of block length")},dR.prototype.setAutoPadding=function(t){return this._autopadding=!!t,this},mR.prototype.add=function(t){this.cache=uR.concat([this.cache,t])},mR.prototype.get=function(){if(this.cache.length>15){var t=this.cache.slice(0,16);return this.cache=this.cache.slice(16),t}return null},mR.prototype.flush=function(){for(var t=16-this.cache.length,e=uR.allocUnsafe(t),r=-1;++r<t;)e.writeUInt8(t,r);return uR.concat([this.cache,e])},eT.createCipheriv=gR,eT.createCipher=function(t,e){var r=sR[t.toLowerCase()];if(!r)throw new TypeError("invalid suite type");var n=lR(e,!1,r.key,r.iv);return gR(t,n.key,n.iv)};var yR={},bR=XT,vR=yg.Buffer,wR=BT,_R=rR,ER=XS,AR=NT,MR=oR;function SR(t,e,r){ER.call(this),this._cache=new kR,this._last=void 0,this._cipher=new AR.AES(e),this._prev=vR.from(r),this._mode=t,this._autopadding=!0}function kR(){this.cache=vR.allocUnsafe(0)}function xR(t,e,r){var n=wR[t.toLowerCase()];if(!n)throw new TypeError("invalid suite type");if("string"==typeof r&&(r=vR.from(r)),"GCM"!==n.mode&&r.length!==n.iv)throw new TypeError("invalid iv length "+r.length);if("string"==typeof e&&(e=vR.from(e)),e.length!==n.key/8)throw new TypeError("invalid key length "+e.length);return"stream"===n.type?new _R(n.module,e,r,!0):"auth"===n.type?new bR(n.module,e,r,!0):new SR(n.module,e,r)}ri(SR,ER),SR.prototype._update=function(t){var e,r;this._cache.add(t);for(var n=[];e=this._cache.get(this._autopadding);)r=this._mode.decrypt(this,e),n.push(r);return vR.concat(n)},SR.prototype._final=function(){var t=this._cache.flush();if(this._autopadding)return function(t){var e=t[15];if(e<1||e>16)throw new Error("unable to decrypt data");var r=-1;for(;++r<e;)if(t[r+(16-e)]!==e)throw new Error("unable to decrypt data");if(16===e)return;return t.slice(0,16-e)}(this._mode.decrypt(this,t));if(t)throw new Error("data not multiple of block length")},SR.prototype.setAutoPadding=function(t){return this._autopadding=!!t,this},kR.prototype.add=function(t){this.cache=vR.concat([this.cache,t])},kR.prototype.get=function(t){var e;if(t){if(this.cache.length>16)return e=this.cache.slice(0,16),this.cache=this.cache.slice(16),e}else if(this.cache.length>=16)return e=this.cache.slice(0,16),this.cache=this.cache.slice(16),e;return null},kR.prototype.flush=function(){if(this.cache.length)return this.cache},yR.createDecipher=function(t,e){var r=wR[t.toLowerCase()];if(!r)throw new TypeError("invalid suite type");var n=MR(e,!1,r.key,r.iv);return xR(t,n.key,n.iv)},yR.createDecipheriv=xR;var TR=eT,RR=yR,BR=kT;tT.createCipher=tT.Cipher=TR.createCipher,tT.createCipheriv=tT.Cipheriv=TR.createCipheriv,tT.createDecipher=tT.Decipher=RR.createDecipher,tT.createDecipheriv=tT.Decipheriv=RR.createDecipheriv,tT.listCiphers=tT.getCiphers=function(){return Object.keys(BR)};var NR={};!function(t){t["des-ecb"]={key:8,iv:0},t["des-cbc"]=t.des={key:8,iv:8},t["des-ede3-cbc"]=t.des3={key:24,iv:8},t["des-ede3"]={key:24,iv:0},t["des-ede-cbc"]={key:16,iv:8},t["des-ede"]={key:16,iv:0}}(NR);var PR=$x,IR=tT,OR=BT,CR=NR,LR=oR;function jR(t,e,r){if(t=t.toLowerCase(),OR[t])return IR.createCipheriv(t,e,r);if(CR[t])return new PR({key:e,iv:r,mode:t});throw new TypeError("invalid suite type")}function DR(t,e,r){if(t=t.toLowerCase(),OR[t])return IR.createDecipheriv(t,e,r);if(CR[t])return new PR({key:e,iv:r,mode:t,decrypt:!0});throw new TypeError("invalid suite type")}Mx.createCipher=Mx.Cipher=function(t,e){var r,n;if(t=t.toLowerCase(),OR[t])r=OR[t].key,n=OR[t].iv;else{if(!CR[t])throw new TypeError("invalid suite type");r=8*CR[t].key,n=CR[t].iv}var i=LR(e,!1,r,n);return jR(t,i.key,i.iv)},Mx.createCipheriv=Mx.Cipheriv=jR,Mx.createDecipher=Mx.Decipher=function(t,e){var r,n;if(t=t.toLowerCase(),OR[t])r=OR[t].key,n=OR[t].iv;else{if(!CR[t])throw new TypeError("invalid suite type");r=8*CR[t].key,n=CR[t].iv}var i=LR(e,!1,r,n);return DR(t,i.key,i.iv)},Mx.createDecipheriv=Mx.Decipheriv=DR,Mx.listCiphers=Mx.getCiphers=function(){return Object.keys(CR).concat(IR.getCiphers())};var UR={},FR=pd,zR=wd;function qR(t){this.rand=t||new zR.Rand}var HR=qR;qR.create=function(t){return new qR(t)},qR.prototype._randbelow=function(t){var e=t.bitLength(),r=Math.ceil(e/8);do{var n=new FR(this.rand.generate(r))}while(n.cmp(t)>=0);return n},qR.prototype._randrange=function(t,e){var r=e.sub(t);return t.add(this._randbelow(r))},qR.prototype.test=function(t,e,r){var n=t.bitLength(),i=FR.mont(t),o=new FR(1).toRed(i);e||(e=Math.max(1,n/48|0));for(var s=t.subn(1),a=0;!s.testn(a);a++);for(var u=t.shrn(a),h=s.toRed(i);e>0;e--){var c=this._randrange(new FR(2),s);r&&r(c);var f=c.toRed(i).redPow(u);if(0!==f.cmp(o)&&0!==f.cmp(h)){for(var l=1;l<a;l++){if(0===(f=f.redSqr()).cmp(o))return!1;if(0===f.cmp(h))break}if(l===a)return!1}}return!0},qR.prototype.getDivisor=function(t,e){var r=t.bitLength(),n=FR.mont(t),i=new FR(1).toRed(n);e||(e=Math.max(1,r/48|0));for(var o=t.subn(1),s=0;!o.testn(s);s++);for(var a=t.shrn(s),u=o.toRed(n);e>0;e--){var h=this._randrange(new FR(2),o),c=t.gcd(h);if(0!==c.cmpn(1))return c;var f=h.toRed(n).redPow(a);if(0!==f.cmp(i)&&0!==f.cmp(u)){for(var l=1;l<s;l++){if(0===(f=f.redSqr()).cmp(i))return f.fromRed().subn(1).gcd(t);if(0===f.cmp(u))break}if(l===s)return(f=f.redSqr()).fromRed().subn(1).gcd(t)}}return!1};var KR=fw,GR=oB;oB.simpleSieve=nB,oB.fermatTest=iB;var VR=pd,WR=new VR(24),JR=new HR,ZR=new VR(1),YR=new VR(2),XR=new VR(5);new VR(16),new VR(8);var $R=new VR(10),QR=new VR(3);new VR(7);var tB=new VR(11),eB=new VR(4);new VR(12);var rB=null;function nB(t){for(var e=function(){if(null!==rB)return rB;var t=[];t[0]=2;for(var e=1,r=3;r<1048576;r+=2){for(var n=Math.ceil(Math.sqrt(r)),i=0;i<e&&t[i]<=n&&r%t[i]!==0;i++);e!==i&&t[i]<=n||(t[e++]=r)}return rB=t,t}(),r=0;r<e.length;r++)if(0===t.modn(e[r]))return 0===t.cmpn(e[r]);return!0}function iB(t){var e=VR.mont(t);return 0===YR.toRed(e).redPow(t.subn(1)).fromRed().cmpn(1)}function oB(t,e){if(t<16)return new VR(2===e||5===e?[140,123]:[140,39]);var r,n;for(e=new VR(e);;){for(r=new VR(KR(Math.ceil(t/8)));r.bitLength()>t;)r.ishrn(1);if(r.isEven()&&r.iadd(ZR),r.testn(1)||r.iadd(YR),e.cmp(YR)){if(!e.cmp(XR))for(;r.mod($R).cmp(QR);)r.iadd(eB)}else for(;r.mod(WR).cmp(tB);)r.iadd(eB);if(nB(n=r.shrn(1))&&nB(r)&&iB(n)&&iB(r)&&JR.test(n)&&JR.test(r))return r}}var sB={modp1:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a63a3620ffffffffffffffff"},modp2:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece65381ffffffffffffffff"},modp5:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca237327ffffffffffffffff"},modp14:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aacaa68ffffffffffffffff"},modp15:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a93ad2caffffffffffffffff"},modp16:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c934063199ffffffffffffffff"},modp17:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dcc4024ffffffffffffffff"},modp18:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dbe115974a3926f12fee5e438777cb6a932df8cd8bec4d073b931ba3bc832b68d9dd300741fa7bf8afc47ed2576f6936ba424663aab639c5ae4f5683423b4742bf1c978238f16cbe39d652de3fdb8befc848ad922222e04a4037c0713eb57a81a23f0c73473fc646cea306b4bcbc8862f8385ddfa9d4b7fa2c087e879683303ed5bdd3a062b3cf5b3a278a66d2a13f83f44f82ddf310ee074ab6a364597e899a0255dc164f31cc50846851df9ab48195ded7ea1b1d510bd7ee74d73faf36bc31ecfa268359046f4eb879f924009438b481c6cd7889a002ed5ee382bc9190da6fc026e479558e4475677e9aa9e3050e2765694dfc81f56e880b96e7160c980dd98edd3dfffffffffffffffff"}},aB=pd,uB=new HR,hB=new aB(24),cB=new aB(11),fB=new aB(10),lB=new aB(3),dB=new aB(7),pB=GR,mB=fw,gB=wB;function yB(t,e){return e=e||"utf8",_.isBuffer(t)||(t=new _(t,e)),this._pub=new aB(t),this}function bB(t,e){return e=e||"utf8",_.isBuffer(t)||(t=new _(t,e)),this._priv=new aB(t),this}var vB={};function wB(t,e,r){this.setGenerator(e),this.__prime=new aB(t),this._prime=aB.mont(this.__prime),this._primeLen=t.length,this._pub=void 0,this._priv=void 0,this._primeCode=void 0,r?(this.setPublicKey=yB,this.setPrivateKey=bB):this._primeCode=8}function _B(t,e){var r=new _(t.toArray());return e?r.toString(e):r}Object.defineProperty(wB.prototype,"verifyError",{enumerable:!0,get:function(){return"number"!=typeof this._primeCode&&(this._primeCode=function(t,e){var r=e.toString("hex"),n=[r,t.toString(16)].join("_");if(n in vB)return vB[n];var i,o=0;if(t.isEven()||!pB.simpleSieve||!pB.fermatTest(t)||!uB.test(t))return o+=1,o+="02"===r||"05"===r?8:4,vB[n]=o,o;switch(uB.test(t.shrn(1))||(o+=2),r){case"02":t.mod(hB).cmp(cB)&&(o+=8);break;case"05":(i=t.mod(fB)).cmp(lB)&&i.cmp(dB)&&(o+=8);break;default:o+=4}return vB[n]=o,o}(this.__prime,this.__gen)),this._primeCode}}),wB.prototype.generateKeys=function(){return this._priv||(this._priv=new aB(mB(this._primeLen))),this._pub=this._gen.toRed(this._prime).redPow(this._priv).fromRed(),this.getPublicKey()},wB.prototype.computeSecret=function(t){var e=new _((t=(t=new aB(t)).toRed(this._prime)).redPow(this._priv).fromRed().toArray()),r=this.getPrime();if(e.length<r.length){var n=new _(r.length-e.length);n.fill(0),e=_.concat([n,e])}return e},wB.prototype.getPublicKey=function(t){return _B(this._pub,t)},wB.prototype.getPrivateKey=function(t){return _B(this._priv,t)},wB.prototype.getPrime=function(t){return _B(this.__prime,t)},wB.prototype.getGenerator=function(t){return _B(this._gen,t)},wB.prototype.setGenerator=function(t,e){return e=e||"utf8",_.isBuffer(t)||(t=new _(t,e)),this.__gen=t,this._gen=new aB(t),this};var EB=GR,AB=sB,MB=gB;var SB={binary:!0,hex:!0,base64:!0};UR.DiffieHellmanGroup=UR.createDiffieHellmanGroup=UR.getDiffieHellman=function(t){var e=new _(AB[t].prime,"hex"),r=new _(AB[t].gen,"hex");return new MB(e,r)},UR.createDiffieHellman=UR.DiffieHellman=function t(e,r,n,i){return _.isBuffer(r)||void 0===SB[r]?t(e,"binary",r,n):(r=r||"binary",i=i||"binary",n=n||new _([2]),_.isBuffer(n)||(n=new _(n,i)),"number"==typeof e?new MB(EB(e,n),n,!0):(_.isBuffer(e)||(e=new _(e,r)),new MB(e,n,!0)))};var kB={exports:{}},xB={exports:{}};void 0===vr||!vr.version||0===vr.version.indexOf("v0.")||0===vr.version.indexOf("v1.")&&0!==vr.version.indexOf("v1.8.")?xB.exports={nextTick:function(t,e,r,n){if("function"!=typeof t)throw new TypeError('"callback" argument must be a function');var i,o,s=arguments.length;switch(s){case 0:case 1:return vr.nextTick(t);case 2:return vr.nextTick(function(){t.call(null,e)});case 3:return vr.nextTick(function(){t.call(null,e,r)});case 4:return vr.nextTick(function(){t.call(null,e,r,n)});default:for(i=new Array(s-1),o=0;o<i.length;)i[o++]=arguments[o];return vr.nextTick(function(){t.apply(null,i)})}}}:xB.exports=vr;var TB=xB.exports,RB={}.toString,BB=Array.isArray||function(t){return"[object Array]"==RB.call(t)},NB=fm.EventEmitter,PB={exports:{}};!function(t,e){var r=st,n=r.Buffer;function i(t,e){for(var r in t)e[r]=t[r]}function o(t,e,r){return n(t,e,r)}n.from&&n.alloc&&n.allocUnsafe&&n.allocUnsafeSlow?t.exports=r:(i(r,e),e.Buffer=o),i(n,o),o.from=function(t,e,r){if("number"==typeof t)throw new TypeError("Argument must not be a number");return n(t,e,r)},o.alloc=function(t,e,r){if("number"!=typeof t)throw new TypeError("Argument must be a number");var i=n(t);return void 0!==e?"string"==typeof r?i.fill(e,r):i.fill(e):i.fill(0),i},o.allocUnsafe=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return n(t)},o.allocUnsafeSlow=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return r.SlowBuffer(t)}}(PB,PB.exports);var IB=PB.exports,OB={};function CB(t){return Object.prototype.toString.call(t)}OB.isArray=function(t){return Array.isArray?Array.isArray(t):"[object Array]"===CB(t)},OB.isBoolean=function(t){return"boolean"==typeof t},OB.isNull=function(t){return null===t},OB.isNullOrUndefined=function(t){return null==t},OB.isNumber=function(t){return"number"==typeof t},OB.isString=function(t){return"string"==typeof t},OB.isSymbol=function(t){return"symbol"==typeof t},OB.isUndefined=function(t){return void 0===t},OB.isRegExp=function(t){return"[object RegExp]"===CB(t)},OB.isObject=function(t){return"object"==typeof t&&null!==t},OB.isDate=function(t){return"[object Date]"===CB(t)},OB.isError=function(t){return"[object Error]"===CB(t)||t instanceof Error},OB.isFunction=function(t){return"function"==typeof t},OB.isPrimitive=function(t){return null===t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||"symbol"==typeof t||void 0===t},OB.isBuffer=st.Buffer.isBuffer;var LB,jB={exports:{}};function DB(){return LB||(LB=1,function(t){var e=IB.Buffer,r=Jm;function n(t,e,r){t.copy(e,r)}t.exports=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.head=null,this.tail=null,this.length=0}return t.prototype.push=function(t){var e={data:t,next:null};this.length>0?this.tail.next=e:this.head=e,this.tail=e,++this.length},t.prototype.unshift=function(t){var e={data:t,next:this.head};0===this.length&&(this.tail=e),this.head=e,++this.length},t.prototype.shift=function(){if(0!==this.length){var t=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,t}},t.prototype.clear=function(){this.head=this.tail=null,this.length=0},t.prototype.join=function(t){if(0===this.length)return"";for(var e=this.head,r=""+e.data;e=e.next;)r+=t+e.data;return r},t.prototype.concat=function(t){if(0===this.length)return e.alloc(0);for(var r=e.allocUnsafe(t>>>0),i=this.head,o=0;i;)n(i.data,r,o),o+=i.data.length,i=i.next;return r},t}(),r&&r.inspect&&r.inspect.custom&&(t.exports.prototype[r.inspect.custom]=function(){var t=r.inspect({length:this.length});return this.constructor.name+" "+t})}(jB)),jB.exports}var UB=TB;function FB(t,e){t.emit("error",e)}var zB,qB,HB,KB,GB={destroy:function(t,e){var r=this,n=this._readableState&&this._readableState.destroyed,i=this._writableState&&this._writableState.destroyed;return n||i?(e?e(t):t&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,UB.nextTick(FB,this,t)):UB.nextTick(FB,this,t)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(t||null,function(t){!e&&t?r._writableState?r._writableState.errorEmitted||(r._writableState.errorEmitted=!0,UB.nextTick(FB,r,t)):UB.nextTick(FB,r,t):e&&e(t)}),this)},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}};function VB(){if(qB)return zB;qB=1;var t=TB;function r(t){var e=this;this.next=null,this.entry=null,this.finish=function(){!function(t,e,r){var n=t.entry;t.entry=null;for(;n;){var i=n.callback;e.pendingcb--,i(r),n=n.next}e.corkedRequestsFree.next=t}(e,t)}}zB=p;var n,i=!vr.browser&&["v0.10","v0.9."].indexOf(vr.version.slice(0,5))>-1?setImmediate:t.nextTick;p.WritableState=d;var o=Object.create(OB);o.inherits=ri;var s={deprecate:cg},a=NB,u=IB.Buffer,h=(void 0!==e?e:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{}).Uint8Array||function(){};var c,f=GB;function l(){}function d(e,o){n=n||WB(),e=e||{};var s=o instanceof n;this.objectMode=!!e.objectMode,s&&(this.objectMode=this.objectMode||!!e.writableObjectMode);var a=e.highWaterMark,u=e.writableHighWaterMark,h=this.objectMode?16:16384;this.highWaterMark=a||0===a?a:s&&(u||0===u)?u:h,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var c=!1===e.decodeStrings;this.decodeStrings=!c,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){!function(e,r){var n=e._writableState,o=n.sync,s=n.writecb;if(function(t){t.writing=!1,t.writecb=null,t.length-=t.writelen,t.writelen=0}(n),r)!function(e,r,n,i,o){--r.pendingcb,n?(t.nextTick(o,i),t.nextTick(w,e,r),e._writableState.errorEmitted=!0,e.emit("error",i)):(o(i),e._writableState.errorEmitted=!0,e.emit("error",i),w(e,r))}(e,n,o,r,s);else{var a=b(n);a||n.corked||n.bufferProcessing||!n.bufferedRequest||y(e,n),o?i(g,e,n,a,s):g(e,n,a,s)}}(o,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new r(this)}function p(t){if(n=n||WB(),!(c.call(p,this)||this instanceof n))return new p(t);this._writableState=new d(t,this),this.writable=!0,t&&("function"==typeof t.write&&(this._write=t.write),"function"==typeof t.writev&&(this._writev=t.writev),"function"==typeof t.destroy&&(this._destroy=t.destroy),"function"==typeof t.final&&(this._final=t.final)),a.call(this)}function m(t,e,r,n,i,o,s){e.writelen=n,e.writecb=s,e.writing=!0,e.sync=!0,r?t._writev(i,e.onwrite):t._write(i,o,e.onwrite),e.sync=!1}function g(t,e,r,n){r||function(t,e){0===e.length&&e.needDrain&&(e.needDrain=!1,t.emit("drain"))}(t,e),e.pendingcb--,n(),w(t,e)}function y(t,e){e.bufferProcessing=!0;var n=e.bufferedRequest;if(t._writev&&n&&n.next){var i=e.bufferedRequestCount,o=new Array(i),s=e.corkedRequestsFree;s.entry=n;for(var a=0,u=!0;n;)o[a]=n,n.isBuf||(u=!1),n=n.next,a+=1;o.allBuffers=u,m(t,e,!0,e.length,o,"",s.finish),e.pendingcb++,e.lastBufferedRequest=null,s.next?(e.corkedRequestsFree=s.next,s.next=null):e.corkedRequestsFree=new r(e),e.bufferedRequestCount=0}else{for(;n;){var h=n.chunk,c=n.encoding,f=n.callback;if(m(t,e,!1,e.objectMode?1:h.length,h,c,f),n=n.next,e.bufferedRequestCount--,e.writing)break}null===n&&(e.lastBufferedRequest=null)}e.bufferedRequest=n,e.bufferProcessing=!1}function b(t){return t.ending&&0===t.length&&null===t.bufferedRequest&&!t.finished&&!t.writing}function v(t,e){t._final(function(r){e.pendingcb--,r&&t.emit("error",r),e.prefinished=!0,t.emit("prefinish"),w(t,e)})}function w(e,r){var n=b(r);return n&&(!function(e,r){r.prefinished||r.finalCalled||("function"==typeof e._final?(r.pendingcb++,r.finalCalled=!0,t.nextTick(v,e,r)):(r.prefinished=!0,e.emit("prefinish")))}(e,r),0===r.pendingcb&&(r.finished=!0,e.emit("finish"))),n}return o.inherits(p,a),d.prototype.getBuffer=function(){for(var t=this.bufferedRequest,e=[];t;)e.push(t),t=t.next;return e},function(){try{Object.defineProperty(d.prototype,"buffer",{get:s.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(t){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(c=Function.prototype[Symbol.hasInstance],Object.defineProperty(p,Symbol.hasInstance,{value:function(t){return!!c.call(this,t)||this===p&&(t&&t._writableState instanceof d)}})):c=function(t){return t instanceof this},p.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},p.prototype.write=function(e,r,n){var i,o=this._writableState,s=!1,a=!o.objectMode&&(i=e,u.isBuffer(i)||i instanceof h);return a&&!u.isBuffer(e)&&(e=function(t){return u.from(t)}(e)),"function"==typeof r&&(n=r,r=null),a?r="buffer":r||(r=o.defaultEncoding),"function"!=typeof n&&(n=l),o.ended?function(e,r){var n=new Error("write after end");e.emit("error",n),t.nextTick(r,n)}(this,n):(a||function(e,r,n,i){var o=!0,s=!1;return null===n?s=new TypeError("May not write null values to stream"):"string"==typeof n||void 0===n||r.objectMode||(s=new TypeError("Invalid non-string/buffer chunk")),s&&(e.emit("error",s),t.nextTick(i,s),o=!1),o}(this,o,e,n))&&(o.pendingcb++,s=function(t,e,r,n,i,o){if(!r){var s=function(t,e,r){t.objectMode||!1===t.decodeStrings||"string"!=typeof e||(e=u.from(e,r));return e}(e,n,i);n!==s&&(r=!0,i="buffer",n=s)}var a=e.objectMode?1:n.length;e.length+=a;var h=e.length<e.highWaterMark;h||(e.needDrain=!0);if(e.writing||e.corked){var c=e.lastBufferedRequest;e.lastBufferedRequest={chunk:n,encoding:i,isBuf:r,callback:o,next:null},c?c.next=e.lastBufferedRequest:e.bufferedRequest=e.lastBufferedRequest,e.bufferedRequestCount+=1}else m(t,e,!1,a,n,i,o);return h}(this,o,a,e,r,n)),s},p.prototype.cork=function(){this._writableState.corked++},p.prototype.uncork=function(){var t=this._writableState;t.corked&&(t.corked--,t.writing||t.corked||t.bufferProcessing||!t.bufferedRequest||y(this,t))},p.prototype.setDefaultEncoding=function(t){if("string"==typeof t&&(t=t.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((t+"").toLowerCase())>-1))throw new TypeError("Unknown encoding: "+t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(p.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),p.prototype._write=function(t,e,r){r(new Error("_write() is not implemented"))},p.prototype._writev=null,p.prototype.end=function(e,r,n){var i=this._writableState;"function"==typeof e?(n=e,e=null,r=null):"function"==typeof r&&(n=r,r=null),null!=e&&this.write(e,r),i.corked&&(i.corked=1,this.uncork()),i.ending||function(e,r,n){r.ending=!0,w(e,r),n&&(r.finished?t.nextTick(n):e.once("finish",n));r.ended=!0,e.writable=!1}(this,i,n)},Object.defineProperty(p.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(t){this._writableState&&(this._writableState.destroyed=t)}}),p.prototype.destroy=f.destroy,p.prototype._undestroy=f.undestroy,p.prototype._destroy=function(t,e){this.end(),e(t)},zB}function WB(){if(KB)return HB;KB=1;var t=TB,e=Object.keys||function(t){var e=[];for(var r in t)e.push(r);return e};HB=u;var r=Object.create(OB);r.inherits=ri;var n=eN(),i=VB();r.inherits(u,n);for(var o=e(i.prototype),s=0;s<o.length;s++){var a=o[s];u.prototype[a]||(u.prototype[a]=i.prototype[a])}function u(t){if(!(this instanceof u))return new u(t);n.call(this,t),i.call(this,t),t&&!1===t.readable&&(this.readable=!1),t&&!1===t.writable&&(this.writable=!1),this.allowHalfOpen=!0,t&&!1===t.allowHalfOpen&&(this.allowHalfOpen=!1),this.once("end",h)}function h(){this.allowHalfOpen||this._writableState.ended||t.nextTick(c,this)}function c(t){t.end()}return Object.defineProperty(u.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(u.prototype,"destroyed",{get:function(){return void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed&&this._writableState.destroyed)},set:function(t){void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed=t,this._writableState.destroyed=t)}}),u.prototype._destroy=function(e,r){this.push(null),this.end(),t.nextTick(r,e)},HB}var JB,ZB,YB,XB,$B={},QB={exports:{}};function tN(){if(ZB)return $B;ZB=1;var t=(JB||(JB=1,function(t,e){var r=st,n=r.Buffer;function i(t,e){for(var r in t)e[r]=t[r]}function o(t,e,r){return n(t,e,r)}n.from&&n.alloc&&n.allocUnsafe&&n.allocUnsafeSlow?t.exports=r:(i(r,e),e.Buffer=o),i(n,o),o.from=function(t,e,r){if("number"==typeof t)throw new TypeError("Argument must not be a number");return n(t,e,r)},o.alloc=function(t,e,r){if("number"!=typeof t)throw new TypeError("Argument must be a number");var i=n(t);return void 0!==e?"string"==typeof r?i.fill(e,r):i.fill(e):i.fill(0),i},o.allocUnsafe=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return n(t)},o.allocUnsafeSlow=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return r.SlowBuffer(t)}}(QB,QB.exports)),QB.exports).Buffer,e=t.isEncoding||function(t){switch((t=""+t)&&t.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function r(r){var n;switch(this.encoding=function(r){var n=function(t){if(!t)return"utf8";for(var e;;)switch(t){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return t;default:if(e)return;t=(""+t).toLowerCase(),e=!0}}(r);if("string"!=typeof n&&(t.isEncoding===e||!e(r)))throw new Error("Unknown encoding: "+r);return n||r}(r),this.encoding){case"utf16le":this.text=o,this.end=s,n=4;break;case"utf8":this.fillLast=i,n=4;break;case"base64":this.text=a,this.end=u,n=3;break;default:return this.write=h,void(this.end=c)}this.lastNeed=0,this.lastTotal=0,this.lastChar=t.allocUnsafe(n)}function n(t){return t<=127?0:t>>5==6?2:t>>4==14?3:t>>3==30?4:t>>6==2?-1:-2}function i(t){var e=this.lastTotal-this.lastNeed,r=function(t,e){if(128!=(192&e[0]))return t.lastNeed=0,"�";if(t.lastNeed>1&&e.length>1){if(128!=(192&e[1]))return t.lastNeed=1,"�";if(t.lastNeed>2&&e.length>2&&128!=(192&e[2]))return t.lastNeed=2,"�"}}(this,t);return void 0!==r?r:this.lastNeed<=t.length?(t.copy(this.lastChar,e,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(t.copy(this.lastChar,e,0,t.length),void(this.lastNeed-=t.length))}function o(t,e){if((t.length-e)%2==0){var r=t.toString("utf16le",e);if(r){var n=r.charCodeAt(r.length-1);if(n>=55296&&n<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=t[t.length-1],t.toString("utf16le",e,t.length-1)}function s(t){var e=t&&t.length?this.write(t):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return e+this.lastChar.toString("utf16le",0,r)}return e}function a(t,e){var r=(t.length-e)%3;return 0===r?t.toString("base64",e):(this.lastNeed=3-r,this.lastTotal=3,1===r?this.lastChar[0]=t[t.length-1]:(this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1]),t.toString("base64",e,t.length-r))}function u(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function h(t){return t.toString(this.encoding)}function c(t){return t&&t.length?this.write(t):""}return $B.StringDecoder=r,r.prototype.write=function(t){if(0===t.length)return"";var e,r;if(this.lastNeed){if(void 0===(e=this.fillLast(t)))return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r<t.length?e?e+this.text(t,r):this.text(t,r):e||""},r.prototype.end=function(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+"�":e},r.prototype.text=function(t,e){var r=function(t,e,r){var i=e.length-1;if(i<r)return 0;var o=n(e[i]);if(o>=0)return o>0&&(t.lastNeed=o-1),o;if(--i<r||-2===o)return 0;if(o=n(e[i]),o>=0)return o>0&&(t.lastNeed=o-2),o;if(--i<r||-2===o)return 0;if(o=n(e[i]),o>=0)return o>0&&(2===o?o=0:t.lastNeed=o-3),o;return 0}(this,t,e);if(!this.lastNeed)return t.toString("utf8",e);this.lastTotal=r;var i=t.length-(r-this.lastNeed);return t.copy(this.lastChar,0,i),t.toString("utf8",e,i)},r.prototype.fillLast=function(t){if(this.lastNeed<=t.length)return t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,t.length),this.lastNeed-=t.length},$B}function eN(){if(XB)return YB;XB=1;var t=TB;YB=g;var r,n=BB;g.ReadableState=m,fm.EventEmitter;var i=function(t,e){return t.listeners(e).length},o=NB,s=IB.Buffer,a=(void 0!==e?e:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{}).Uint8Array||function(){};var u=Object.create(OB);u.inherits=ri;var h=Jm,c=void 0;c=h&&h.debuglog?h.debuglog("stream"):function(){};var f,l=DB(),d=GB;u.inherits(g,o);var p=["error","close","destroy","pause","resume"];function m(t,e){t=t||{};var n=e instanceof(r=r||WB());this.objectMode=!!t.objectMode,n&&(this.objectMode=this.objectMode||!!t.readableObjectMode);var i=t.highWaterMark,o=t.readableHighWaterMark,s=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:n&&(o||0===o)?o:s,this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=new l,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.destroyed=!1,this.defaultEncoding=t.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,t.encoding&&(f||(f=tN().StringDecoder),this.decoder=new f(t.encoding),this.encoding=t.encoding)}function g(t){if(r=r||WB(),!(this instanceof g))return new g(t);this._readableState=new m(t,this),this.readable=!0,t&&("function"==typeof t.read&&(this._read=t.read),"function"==typeof t.destroy&&(this._destroy=t.destroy)),o.call(this)}function y(t,e,r,n,i){var o,u=t._readableState;null===e?(u.reading=!1,function(t,e){if(e.ended)return;if(e.decoder){var r=e.decoder.end();r&&r.length&&(e.buffer.push(r),e.length+=e.objectMode?1:r.length)}e.ended=!0,_(t)}(t,u)):(i||(o=function(t,e){var r;n=e,s.isBuffer(n)||n instanceof a||"string"==typeof e||void 0===e||t.objectMode||(r=new TypeError("Invalid non-string/buffer chunk"));var n;return r}(u,e)),o?t.emit("error",o):u.objectMode||e&&e.length>0?("string"==typeof e||u.objectMode||Object.getPrototypeOf(e)===s.prototype||(e=function(t){return s.from(t)}(e)),n?u.endEmitted?t.emit("error",new Error("stream.unshift() after end event")):b(t,u,e,!0):u.ended?t.emit("error",new Error("stream.push() after EOF")):(u.reading=!1,u.decoder&&!r?(e=u.decoder.write(e),u.objectMode||0!==e.length?b(t,u,e,!1):A(t,u)):b(t,u,e,!1))):n||(u.reading=!1));return function(t){return!t.ended&&(t.needReadable||t.length<t.highWaterMark||0===t.length)}(u)}function b(t,e,r,n){e.flowing&&0===e.length&&!e.sync?(t.emit("data",r),t.read(0)):(e.length+=e.objectMode?1:r.length,n?e.buffer.unshift(r):e.buffer.push(r),e.needReadable&&_(t)),A(t,e)}Object.defineProperty(g.prototype,"destroyed",{get:function(){return void 0!==this._readableState&&this._readableState.destroyed},set:function(t){this._readableState&&(this._readableState.destroyed=t)}}),g.prototype.destroy=d.destroy,g.prototype._undestroy=d.undestroy,g.prototype._destroy=function(t,e){this.push(null),e(t)},g.prototype.push=function(t,e){var r,n=this._readableState;return n.objectMode?r=!0:"string"==typeof t&&((e=e||n.defaultEncoding)!==n.encoding&&(t=s.from(t,e),e=""),r=!0),y(this,t,e,!1,r)},g.prototype.unshift=function(t){return y(this,t,null,!0,!1)},g.prototype.isPaused=function(){return!1===this._readableState.flowing},g.prototype.setEncoding=function(t){return f||(f=tN().StringDecoder),this._readableState.decoder=new f(t),this._readableState.encoding=t,this};var v=8388608;function w(t,e){return t<=0||0===e.length&&e.ended?0:e.objectMode?1:t!=t?e.flowing&&e.length?e.buffer.head.data.length:e.length:(t>e.highWaterMark&&(e.highWaterMark=function(t){return t>=v?t=v:(t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++),t}(t)),t<=e.length?t:e.ended?e.length:(e.needReadable=!0,0))}function _(e){var r=e._readableState;r.needReadable=!1,r.emittedReadable||(c("emitReadable",r.flowing),r.emittedReadable=!0,r.sync?t.nextTick(E,e):E(e))}function E(t){c("emit readable"),t.emit("readable"),x(t)}function A(e,r){r.readingMore||(r.readingMore=!0,t.nextTick(M,e,r))}function M(t,e){for(var r=e.length;!e.reading&&!e.flowing&&!e.ended&&e.length<e.highWaterMark&&(c("maybeReadMore read 0"),t.read(0),r!==e.length);)r=e.length;e.readingMore=!1}function S(t){c("readable nexttick read 0"),t.read(0)}function k(t,e){e.reading||(c("resume read 0"),t.read(0)),e.resumeScheduled=!1,e.awaitDrain=0,t.emit("resume"),x(t),e.flowing&&!e.reading&&t.read(0)}function x(t){var e=t._readableState;for(c("flow",e.flowing);e.flowing&&null!==t.read(););}function T(t,e){return 0===e.length?null:(e.objectMode?r=e.buffer.shift():!t||t>=e.length?(r=e.decoder?e.buffer.join(""):1===e.buffer.length?e.buffer.head.data:e.buffer.concat(e.length),e.buffer.clear()):r=function(t,e,r){var n;t<e.head.data.length?(n=e.head.data.slice(0,t),e.head.data=e.head.data.slice(t)):n=t===e.head.data.length?e.shift():r?function(t,e){var r=e.head,n=1,i=r.data;t-=i.length;for(;r=r.next;){var o=r.data,s=t>o.length?o.length:t;if(s===o.length?i+=o:i+=o.slice(0,t),0===(t-=s)){s===o.length?(++n,r.next?e.head=r.next:e.head=e.tail=null):(e.head=r,r.data=o.slice(s));break}++n}return e.length-=n,i}(t,e):function(t,e){var r=s.allocUnsafe(t),n=e.head,i=1;n.data.copy(r),t-=n.data.length;for(;n=n.next;){var o=n.data,a=t>o.length?o.length:t;if(o.copy(r,r.length-t,0,a),0===(t-=a)){a===o.length?(++i,n.next?e.head=n.next:e.head=e.tail=null):(e.head=n,n.data=o.slice(a));break}++i}return e.length-=i,r}(t,e);return n}(t,e.buffer,e.decoder),r);var r}function R(e){var r=e._readableState;if(r.length>0)throw new Error('"endReadable()" called on non-empty stream');r.endEmitted||(r.ended=!0,t.nextTick(B,r,e))}function B(t,e){t.endEmitted||0!==t.length||(t.endEmitted=!0,e.readable=!1,e.emit("end"))}function N(t,e){for(var r=0,n=t.length;r<n;r++)if(t[r]===e)return r;return-1}return g.prototype.read=function(t){c("read",t),t=parseInt(t,10);var e=this._readableState,r=t;if(0!==t&&(e.emittedReadable=!1),0===t&&e.needReadable&&(e.length>=e.highWaterMark||e.ended))return c("read: emitReadable",e.length,e.ended),0===e.length&&e.ended?R(this):_(this),null;if(0===(t=w(t,e))&&e.ended)return 0===e.length&&R(this),null;var n,i=e.needReadable;return c("need readable",i),(0===e.length||e.length-t<e.highWaterMark)&&c("length less than watermark",i=!0),e.ended||e.reading?c("reading or ended",i=!1):i&&(c("do read"),e.reading=!0,e.sync=!0,0===e.length&&(e.needReadable=!0),this._read(e.highWaterMark),e.sync=!1,e.reading||(t=w(r,e))),null===(n=t>0?T(t,e):null)?(e.needReadable=!0,t=0):e.length-=t,0===e.length&&(e.ended||(e.needReadable=!0),r!==t&&e.ended&&R(this)),null!==n&&this.emit("data",n),n},g.prototype._read=function(t){this.emit("error",new Error("_read() is not implemented"))},g.prototype.pipe=function(e,r){var o=this,s=this._readableState;switch(s.pipesCount){case 0:s.pipes=e;break;case 1:s.pipes=[s.pipes,e];break;default:s.pipes.push(e)}s.pipesCount+=1,c("pipe count=%d opts=%j",s.pipesCount,r);var a=(!r||!1!==r.end)&&e!==vr.stdout&&e!==vr.stderr?h:b;function u(t,r){c("onunpipe"),t===o&&r&&!1===r.hasUnpiped&&(r.hasUnpiped=!0,c("cleanup"),e.removeListener("close",g),e.removeListener("finish",y),e.removeListener("drain",f),e.removeListener("error",m),e.removeListener("unpipe",u),o.removeListener("end",h),o.removeListener("end",b),o.removeListener("data",p),l=!0,!s.awaitDrain||e._writableState&&!e._writableState.needDrain||f())}function h(){c("onend"),e.end()}s.endEmitted?t.nextTick(a):o.once("end",a),e.on("unpipe",u);var f=function(t){return function(){var e=t._readableState;c("pipeOnDrain",e.awaitDrain),e.awaitDrain&&e.awaitDrain--,0===e.awaitDrain&&i(t,"data")&&(e.flowing=!0,x(t))}}(o);e.on("drain",f);var l=!1;var d=!1;function p(t){c("ondata"),d=!1,!1!==e.write(t)||d||((1===s.pipesCount&&s.pipes===e||s.pipesCount>1&&-1!==N(s.pipes,e))&&!l&&(c("false write response, pause",s.awaitDrain),s.awaitDrain++,d=!0),o.pause())}function m(t){c("onerror",t),b(),e.removeListener("error",m),0===i(e,"error")&&e.emit("error",t)}function g(){e.removeListener("finish",y),b()}function y(){c("onfinish"),e.removeListener("close",g),b()}function b(){c("unpipe"),o.unpipe(e)}return o.on("data",p),function(t,e,r){if("function"==typeof t.prependListener)return t.prependListener(e,r);t._events&&t._events[e]?n(t._events[e])?t._events[e].unshift(r):t._events[e]=[r,t._events[e]]:t.on(e,r)}(e,"error",m),e.once("close",g),e.once("finish",y),e.emit("pipe",o),s.flowing||(c("pipe resume"),o.resume()),e},g.prototype.unpipe=function(t){var e=this._readableState,r={hasUnpiped:!1};if(0===e.pipesCount)return this;if(1===e.pipesCount)return t&&t!==e.pipes||(t||(t=e.pipes),e.pipes=null,e.pipesCount=0,e.flowing=!1,t&&t.emit("unpipe",this,r)),this;if(!t){var n=e.pipes,i=e.pipesCount;e.pipes=null,e.pipesCount=0,e.flowing=!1;for(var o=0;o<i;o++)n[o].emit("unpipe",this,{hasUnpiped:!1});return this}var s=N(e.pipes,t);return-1===s||(e.pipes.splice(s,1),e.pipesCount-=1,1===e.pipesCount&&(e.pipes=e.pipes[0]),t.emit("unpipe",this,r)),this},g.prototype.on=function(e,r){var n=o.prototype.on.call(this,e,r);if("data"===e)!1!==this._readableState.flowing&&this.resume();else if("readable"===e){var i=this._readableState;i.endEmitted||i.readableListening||(i.readableListening=i.needReadable=!0,i.emittedReadable=!1,i.reading?i.length&&_(this):t.nextTick(S,this))}return n},g.prototype.addListener=g.prototype.on,g.prototype.resume=function(){var e=this._readableState;return e.flowing||(c("resume"),e.flowing=!0,function(e,r){r.resumeScheduled||(r.resumeScheduled=!0,t.nextTick(k,e,r))}(this,e)),this},g.prototype.pause=function(){return c("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(c("pause"),this._readableState.flowing=!1,this.emit("pause")),this},g.prototype.wrap=function(t){var e=this,r=this._readableState,n=!1;for(var i in t.on("end",function(){if(c("wrapped end"),r.decoder&&!r.ended){var t=r.decoder.end();t&&t.length&&e.push(t)}e.push(null)}),t.on("data",function(i){(c("wrapped data"),r.decoder&&(i=r.decoder.write(i)),r.objectMode&&null==i)||(r.objectMode||i&&i.length)&&(e.push(i)||(n=!0,t.pause()))}),t)void 0===this[i]&&"function"==typeof t[i]&&(this[i]=function(e){return function(){return t[e].apply(t,arguments)}}(i));for(var o=0;o<p.length;o++)t.on(p[o],this.emit.bind(this,p[o]));return this._read=function(e){c("wrapped _read",e),n&&(n=!1,t.resume())},this},Object.defineProperty(g.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),g._fromList=T,YB}var rN=sN,nN=WB(),iN=Object.create(OB);function oN(t,e){var r=this._transformState;r.transforming=!1;var n=r.writecb;if(!n)return this.emit("error",new Error("write callback called multiple times"));r.writechunk=null,r.writecb=null,null!=e&&this.push(e),n(t);var i=this._readableState;i.reading=!1,(i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}function sN(t){if(!(this instanceof sN))return new sN(t);nN.call(this,t),this._transformState={afterTransform:oN.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,t&&("function"==typeof t.transform&&(this._transform=t.transform),"function"==typeof t.flush&&(this._flush=t.flush)),this.on("prefinish",aN)}function aN(){var t=this;"function"==typeof this._flush?this._flush(function(e,r){uN(t,e,r)}):uN(this,null,null)}function uN(t,e,r){if(e)return t.emit("error",e);if(null!=r&&t.push(r),t._writableState.length)throw new Error("Calling transform done when ws.length != 0");if(t._transformState.transforming)throw new Error("Calling transform done when still transforming");return t.push(null)}iN.inherits=ri,iN.inherits(sN,nN),sN.prototype.push=function(t,e){return this._transformState.needTransform=!1,nN.prototype.push.call(this,t,e)},sN.prototype._transform=function(t,e,r){throw new Error("_transform() is not implemented")},sN.prototype._write=function(t,e,r){var n=this._transformState;if(n.writecb=r,n.writechunk=t,n.writeencoding=e,!n.transforming){var i=this._readableState;(n.needTransform||i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}},sN.prototype._read=function(t){var e=this._transformState;null!==e.writechunk&&e.writecb&&!e.transforming?(e.transforming=!0,this._transform(e.writechunk,e.writeencoding,e.afterTransform)):e.needTransform=!0},sN.prototype._destroy=function(t,e){var r=this;nN.prototype._destroy.call(this,t,function(t){e(t),r.emit("close")})};var hN=lN,cN=rN,fN=Object.create(OB);function lN(t){if(!(this instanceof lN))return new lN(t);cN.call(this,t)}fN.inherits=ri,fN.inherits(lN,cN),lN.prototype._transform=function(t,e,r){r(null,t)},function(t,e){(e=t.exports=eN()).Stream=e,e.Readable=e,e.Writable=VB(),e.Duplex=WB(),e.Transform=rN,e.PassThrough=hN}(kB,kB.exports);var dN=kB.exports,pN={exports:{}},mN={exports:{}};!function(t){!function(t,e){function r(t,e){if(!t)throw new Error(e||"Assertion failed")}function n(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function i(t,e,r){if(i.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(r=e,e=10),this._init(t||0,e||10,r||"be"))}var o;"object"==typeof t?t.exports=i:e.BN=i,i.BN=i,i.wordSize=26;try{o="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:st.Buffer}catch(t){}function s(t,e){var n=t.charCodeAt(e);return n>=48&&n<=57?n-48:n>=65&&n<=70?n-55:n>=97&&n<=102?n-87:void r(!1,"Invalid character in "+t)}function a(t,e,r){var n=s(t,r);return r-1>=e&&(n|=s(t,r-1)<<4),n}function u(t,e,n,i){for(var o=0,s=0,a=Math.min(t.length,n),u=e;u<a;u++){var h=t.charCodeAt(u)-48;o*=i,s=h>=49?h-49+10:h>=17?h-17+10:h,r(h>=0&&s<i,"Invalid character"),o+=s}return o}function h(t,e){t.words=e.words,t.length=e.length,t.negative=e.negative,t.red=e.red}if(i.isBN=function(t){return t instanceof i||null!==t&&"object"==typeof t&&t.constructor.wordSize===i.wordSize&&Array.isArray(t.words)},i.max=function(t,e){return t.cmp(e)>0?t:e},i.min=function(t,e){return t.cmp(e)<0?t:e},i.prototype._init=function(t,e,n){if("number"==typeof t)return this._initNumber(t,e,n);if("object"==typeof t)return this._initArray(t,e,n);"hex"===e&&(e=16),r(e===(0|e)&&e>=2&&e<=36);var i=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i<t.length&&(16===e?this._parseHex(t,i,n):(this._parseBase(t,e,i),"le"===n&&this._initArray(this.toArray(),e,n)))},i.prototype._initNumber=function(t,e,n){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(r(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===n&&this._initArray(this.toArray(),e,n)},i.prototype._initArray=function(t,e,n){if(r("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var i=0;i<this.length;i++)this.words[i]=0;var o,s,a=0;if("be"===n)for(i=t.length-1,o=0;i>=0;i-=3)s=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[o]|=s<<a&67108863,this.words[o+1]=s>>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);else if("le"===n)for(i=0,o=0;i<t.length;i+=3)s=t[i]|t[i+1]<<8|t[i+2]<<16,this.words[o]|=s<<a&67108863,this.words[o+1]=s>>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);return this._strip()},i.prototype._parseHex=function(t,e,r){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var n=0;n<this.length;n++)this.words[n]=0;var i,o=0,s=0;if("be"===r)for(n=t.length-1;n>=e;n-=2)i=a(t,e,n)<<o,this.words[s]|=67108863&i,o>=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;else for(n=(t.length-e)%2==0?e+1:e;n<t.length;n+=2)i=a(t,e,n)<<o,this.words[s]|=67108863&i,o>=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;this._strip()},i.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var n=0,i=1;i<=67108863;i*=e)n++;n--,i=i/e|0;for(var o=t.length-r,s=o%n,a=Math.min(o,o-s)+r,h=0,c=r;c<a;c+=n)h=u(t,c,c+n,e),this.imuln(i),this.words[0]+h<67108864?this.words[0]+=h:this._iaddn(h);if(0!==s){var f=1;for(h=u(t,c,t.length,e),c=0;c<s;c++)f*=e;this.imuln(f),this.words[0]+h<67108864?this.words[0]+=h:this._iaddn(h)}this._strip()},i.prototype.copy=function(t){t.words=new Array(this.length);for(var e=0;e<this.length;e++)t.words[e]=this.words[e];t.length=this.length,t.negative=this.negative,t.red=this.red},i.prototype._move=function(t){h(t,this)},i.prototype.clone=function(){var t=new i(null);return this.copy(t),t},i.prototype._expand=function(t){for(;this.length<t;)this.words[this.length++]=0;return this},i.prototype._strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},i.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for)try{i.prototype[Symbol.for("nodejs.util.inspect.custom")]=c}catch(t){i.prototype.inspect=c}else i.prototype.inspect=c;function c(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"}var f=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],l=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],d=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];i.prototype.toString=function(t,e){var n;if(e=0|e||1,16===(t=t||10)||"hex"===t){n="";for(var i=0,o=0,s=0;s<this.length;s++){var a=this.words[s],u=(16777215&(a<<i|o)).toString(16);o=a>>>24-i&16777215,(i+=2)>=26&&(i-=26,s--),n=0!==o||s!==this.length-1?f[6-u.length]+u+n:u+n}for(0!==o&&(n=o.toString(16)+n);n.length%e!==0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}if(t===(0|t)&&t>=2&&t<=36){var h=l[t],c=d[t];n="";var p=this.clone();for(p.negative=0;!p.isZero();){var m=p.modrn(c).toString(t);n=(p=p.idivn(c)).isZero()?m+n:f[h-m.length]+m+n}for(this.isZero()&&(n="0"+n);n.length%e!==0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}r(!1,"Base should be between 2 and 36")},i.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},i.prototype.toJSON=function(){return this.toString(16,2)},o&&(i.prototype.toBuffer=function(t,e){return this.toArrayLike(o,t,e)}),i.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)};function p(t,e,r){r.negative=e.negative^t.negative;var n=t.length+e.length|0;r.length=n,n=n-1|0;var i=0|t.words[0],o=0|e.words[0],s=i*o,a=67108863&s,u=s/67108864|0;r.words[0]=a;for(var h=1;h<n;h++){for(var c=u>>>26,f=67108863&u,l=Math.min(h,e.length-1),d=Math.max(0,h-t.length+1);d<=l;d++){var p=h-d|0;c+=(s=(i=0|t.words[p])*(o=0|e.words[d])+f)/67108864|0,f=67108863&s}r.words[h]=0|f,u=0|c}return 0!==u?r.words[h]=0|u:r.length--,r._strip()}i.prototype.toArrayLike=function(t,e,n){this._strip();var i=this.byteLength(),o=n||Math.max(1,i);r(i<=o,"byte array longer than desired length"),r(o>0,"Requested array length <= 0");var s=function(t,e){return t.allocUnsafe?t.allocUnsafe(e):new t(e)}(t,o);return this["_toArrayLike"+("le"===e?"LE":"BE")](s,i),s},i.prototype._toArrayLikeLE=function(t,e){for(var r=0,n=0,i=0,o=0;i<this.length;i++){var s=this.words[i]<<o|n;t[r++]=255&s,r<t.length&&(t[r++]=s>>8&255),r<t.length&&(t[r++]=s>>16&255),6===o?(r<t.length&&(t[r++]=s>>24&255),n=0,o=0):(n=s>>>24,o+=2)}if(r<t.length)for(t[r++]=n;r<t.length;)t[r++]=0},i.prototype._toArrayLikeBE=function(t,e){for(var r=t.length-1,n=0,i=0,o=0;i<this.length;i++){var s=this.words[i]<<o|n;t[r--]=255&s,r>=0&&(t[r--]=s>>8&255),r>=0&&(t[r--]=s>>16&255),6===o?(r>=0&&(t[r--]=s>>24&255),n=0,o=0):(n=s>>>24,o+=2)}if(r>=0)for(t[r--]=n;r>=0;)t[r--]=0},Math.clz32?i.prototype._countBits=function(t){return 32-Math.clz32(t)}:i.prototype._countBits=function(t){var e=t,r=0;return e>=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},i.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 8191&e||(r+=13,e>>>=13),127&e||(r+=7,e>>>=7),15&e||(r+=4,e>>>=4),3&e||(r+=2,e>>>=2),1&e||r++,r},i.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;e<this.length;e++){var r=this._zeroBits(this.words[e]);if(t+=r,26!==r)break}return t},i.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},i.prototype.toTwos=function(t){return 0!==this.negative?this.abs().inotn(t).iaddn(1):this.clone()},i.prototype.fromTwos=function(t){return this.testn(t-1)?this.notn(t).iaddn(1).ineg():this.clone()},i.prototype.isNeg=function(){return 0!==this.negative},i.prototype.neg=function(){return this.clone().ineg()},i.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},i.prototype.iuor=function(t){for(;this.length<t.length;)this.words[this.length++]=0;for(var e=0;e<t.length;e++)this.words[e]=this.words[e]|t.words[e];return this._strip()},i.prototype.ior=function(t){return r(0===(this.negative|t.negative)),this.iuor(t)},i.prototype.or=function(t){return this.length>t.length?this.clone().ior(t):t.clone().ior(this)},i.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},i.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;r<e.length;r++)this.words[r]=this.words[r]&t.words[r];return this.length=e.length,this._strip()},i.prototype.iand=function(t){return r(0===(this.negative|t.negative)),this.iuand(t)},i.prototype.and=function(t){return this.length>t.length?this.clone().iand(t):t.clone().iand(this)},i.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},i.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var n=0;n<r.length;n++)this.words[n]=e.words[n]^r.words[n];if(this!==e)for(;n<e.length;n++)this.words[n]=e.words[n];return this.length=e.length,this._strip()},i.prototype.ixor=function(t){return r(0===(this.negative|t.negative)),this.iuxor(t)},i.prototype.xor=function(t){return this.length>t.length?this.clone().ixor(t):t.clone().ixor(this)},i.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},i.prototype.inotn=function(t){r("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),n=t%26;this._expand(e),n>0&&e--;for(var i=0;i<e;i++)this.words[i]=67108863&~this.words[i];return n>0&&(this.words[i]=~this.words[i]&67108863>>26-n),this._strip()},i.prototype.notn=function(t){return this.clone().inotn(t)},i.prototype.setn=function(t,e){r("number"==typeof t&&t>=0);var n=t/26|0,i=t%26;return this._expand(n+1),this.words[n]=e?this.words[n]|1<<i:this.words[n]&~(1<<i),this._strip()},i.prototype.iadd=function(t){var e,r,n;if(0!==this.negative&&0===t.negative)return this.negative=0,e=this.isub(t),this.negative^=1,this._normSign();if(0===this.negative&&0!==t.negative)return t.negative=0,e=this.isub(t),t.negative=1,e._normSign();this.length>t.length?(r=this,n=t):(r=t,n=this);for(var i=0,o=0;o<n.length;o++)e=(0|r.words[o])+(0|n.words[o])+i,this.words[o]=67108863&e,i=e>>>26;for(;0!==i&&o<r.length;o++)e=(0|r.words[o])+i,this.words[o]=67108863&e,i=e>>>26;if(this.length=r.length,0!==i)this.words[this.length]=i,this.length++;else if(r!==this)for(;o<r.length;o++)this.words[o]=r.words[o];return this},i.prototype.add=function(t){var e;return 0!==t.negative&&0===this.negative?(t.negative=0,e=this.sub(t),t.negative^=1,e):0===t.negative&&0!==this.negative?(this.negative=0,e=t.sub(this),this.negative=1,e):this.length>t.length?this.clone().iadd(t):t.clone().iadd(this)},i.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,n,i=this.cmp(t);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(r=this,n=t):(r=t,n=this);for(var o=0,s=0;s<n.length;s++)o=(e=(0|r.words[s])-(0|n.words[s])+o)>>26,this.words[s]=67108863&e;for(;0!==o&&s<r.length;s++)o=(e=(0|r.words[s])+o)>>26,this.words[s]=67108863&e;if(0===o&&s<r.length&&r!==this)for(;s<r.length;s++)this.words[s]=r.words[s];return this.length=Math.max(this.length,s),r!==this&&(this.negative=1),this._strip()},i.prototype.sub=function(t){return this.clone().isub(t)};var m=function(t,e,r){var n,i,o,s=t.words,a=e.words,u=r.words,h=0,c=0|s[0],f=8191&c,l=c>>>13,d=0|s[1],p=8191&d,m=d>>>13,g=0|s[2],y=8191&g,b=g>>>13,v=0|s[3],w=8191&v,_=v>>>13,E=0|s[4],A=8191&E,M=E>>>13,S=0|s[5],k=8191&S,x=S>>>13,T=0|s[6],R=8191&T,B=T>>>13,N=0|s[7],P=8191&N,I=N>>>13,O=0|s[8],C=8191&O,L=O>>>13,j=0|s[9],D=8191&j,U=j>>>13,F=0|a[0],z=8191&F,q=F>>>13,H=0|a[1],K=8191&H,G=H>>>13,V=0|a[2],W=8191&V,J=V>>>13,Z=0|a[3],Y=8191&Z,X=Z>>>13,$=0|a[4],Q=8191&$,tt=$>>>13,et=0|a[5],rt=8191&et,nt=et>>>13,it=0|a[6],ot=8191&it,st=it>>>13,at=0|a[7],ut=8191&at,ht=at>>>13,ct=0|a[8],ft=8191&ct,lt=ct>>>13,dt=0|a[9],pt=8191&dt,mt=dt>>>13;r.negative=t.negative^e.negative,r.length=19;var gt=(h+(n=Math.imul(f,z))|0)+((8191&(i=(i=Math.imul(f,q))+Math.imul(l,z)|0))<<13)|0;h=((o=Math.imul(l,q))+(i>>>13)|0)+(gt>>>26)|0,gt&=67108863,n=Math.imul(p,z),i=(i=Math.imul(p,q))+Math.imul(m,z)|0,o=Math.imul(m,q);var yt=(h+(n=n+Math.imul(f,K)|0)|0)+((8191&(i=(i=i+Math.imul(f,G)|0)+Math.imul(l,K)|0))<<13)|0;h=((o=o+Math.imul(l,G)|0)+(i>>>13)|0)+(yt>>>26)|0,yt&=67108863,n=Math.imul(y,z),i=(i=Math.imul(y,q))+Math.imul(b,z)|0,o=Math.imul(b,q),n=n+Math.imul(p,K)|0,i=(i=i+Math.imul(p,G)|0)+Math.imul(m,K)|0,o=o+Math.imul(m,G)|0;var bt=(h+(n=n+Math.imul(f,W)|0)|0)+((8191&(i=(i=i+Math.imul(f,J)|0)+Math.imul(l,W)|0))<<13)|0;h=((o=o+Math.imul(l,J)|0)+(i>>>13)|0)+(bt>>>26)|0,bt&=67108863,n=Math.imul(w,z),i=(i=Math.imul(w,q))+Math.imul(_,z)|0,o=Math.imul(_,q),n=n+Math.imul(y,K)|0,i=(i=i+Math.imul(y,G)|0)+Math.imul(b,K)|0,o=o+Math.imul(b,G)|0,n=n+Math.imul(p,W)|0,i=(i=i+Math.imul(p,J)|0)+Math.imul(m,W)|0,o=o+Math.imul(m,J)|0;var vt=(h+(n=n+Math.imul(f,Y)|0)|0)+((8191&(i=(i=i+Math.imul(f,X)|0)+Math.imul(l,Y)|0))<<13)|0;h=((o=o+Math.imul(l,X)|0)+(i>>>13)|0)+(vt>>>26)|0,vt&=67108863,n=Math.imul(A,z),i=(i=Math.imul(A,q))+Math.imul(M,z)|0,o=Math.imul(M,q),n=n+Math.imul(w,K)|0,i=(i=i+Math.imul(w,G)|0)+Math.imul(_,K)|0,o=o+Math.imul(_,G)|0,n=n+Math.imul(y,W)|0,i=(i=i+Math.imul(y,J)|0)+Math.imul(b,W)|0,o=o+Math.imul(b,J)|0,n=n+Math.imul(p,Y)|0,i=(i=i+Math.imul(p,X)|0)+Math.imul(m,Y)|0,o=o+Math.imul(m,X)|0;var wt=(h+(n=n+Math.imul(f,Q)|0)|0)+((8191&(i=(i=i+Math.imul(f,tt)|0)+Math.imul(l,Q)|0))<<13)|0;h=((o=o+Math.imul(l,tt)|0)+(i>>>13)|0)+(wt>>>26)|0,wt&=67108863,n=Math.imul(k,z),i=(i=Math.imul(k,q))+Math.imul(x,z)|0,o=Math.imul(x,q),n=n+Math.imul(A,K)|0,i=(i=i+Math.imul(A,G)|0)+Math.imul(M,K)|0,o=o+Math.imul(M,G)|0,n=n+Math.imul(w,W)|0,i=(i=i+Math.imul(w,J)|0)+Math.imul(_,W)|0,o=o+Math.imul(_,J)|0,n=n+Math.imul(y,Y)|0,i=(i=i+Math.imul(y,X)|0)+Math.imul(b,Y)|0,o=o+Math.imul(b,X)|0,n=n+Math.imul(p,Q)|0,i=(i=i+Math.imul(p,tt)|0)+Math.imul(m,Q)|0,o=o+Math.imul(m,tt)|0;var _t=(h+(n=n+Math.imul(f,rt)|0)|0)+((8191&(i=(i=i+Math.imul(f,nt)|0)+Math.imul(l,rt)|0))<<13)|0;h=((o=o+Math.imul(l,nt)|0)+(i>>>13)|0)+(_t>>>26)|0,_t&=67108863,n=Math.imul(R,z),i=(i=Math.imul(R,q))+Math.imul(B,z)|0,o=Math.imul(B,q),n=n+Math.imul(k,K)|0,i=(i=i+Math.imul(k,G)|0)+Math.imul(x,K)|0,o=o+Math.imul(x,G)|0,n=n+Math.imul(A,W)|0,i=(i=i+Math.imul(A,J)|0)+Math.imul(M,W)|0,o=o+Math.imul(M,J)|0,n=n+Math.imul(w,Y)|0,i=(i=i+Math.imul(w,X)|0)+Math.imul(_,Y)|0,o=o+Math.imul(_,X)|0,n=n+Math.imul(y,Q)|0,i=(i=i+Math.imul(y,tt)|0)+Math.imul(b,Q)|0,o=o+Math.imul(b,tt)|0,n=n+Math.imul(p,rt)|0,i=(i=i+Math.imul(p,nt)|0)+Math.imul(m,rt)|0,o=o+Math.imul(m,nt)|0;var Et=(h+(n=n+Math.imul(f,ot)|0)|0)+((8191&(i=(i=i+Math.imul(f,st)|0)+Math.imul(l,ot)|0))<<13)|0;h=((o=o+Math.imul(l,st)|0)+(i>>>13)|0)+(Et>>>26)|0,Et&=67108863,n=Math.imul(P,z),i=(i=Math.imul(P,q))+Math.imul(I,z)|0,o=Math.imul(I,q),n=n+Math.imul(R,K)|0,i=(i=i+Math.imul(R,G)|0)+Math.imul(B,K)|0,o=o+Math.imul(B,G)|0,n=n+Math.imul(k,W)|0,i=(i=i+Math.imul(k,J)|0)+Math.imul(x,W)|0,o=o+Math.imul(x,J)|0,n=n+Math.imul(A,Y)|0,i=(i=i+Math.imul(A,X)|0)+Math.imul(M,Y)|0,o=o+Math.imul(M,X)|0,n=n+Math.imul(w,Q)|0,i=(i=i+Math.imul(w,tt)|0)+Math.imul(_,Q)|0,o=o+Math.imul(_,tt)|0,n=n+Math.imul(y,rt)|0,i=(i=i+Math.imul(y,nt)|0)+Math.imul(b,rt)|0,o=o+Math.imul(b,nt)|0,n=n+Math.imul(p,ot)|0,i=(i=i+Math.imul(p,st)|0)+Math.imul(m,ot)|0,o=o+Math.imul(m,st)|0;var At=(h+(n=n+Math.imul(f,ut)|0)|0)+((8191&(i=(i=i+Math.imul(f,ht)|0)+Math.imul(l,ut)|0))<<13)|0;h=((o=o+Math.imul(l,ht)|0)+(i>>>13)|0)+(At>>>26)|0,At&=67108863,n=Math.imul(C,z),i=(i=Math.imul(C,q))+Math.imul(L,z)|0,o=Math.imul(L,q),n=n+Math.imul(P,K)|0,i=(i=i+Math.imul(P,G)|0)+Math.imul(I,K)|0,o=o+Math.imul(I,G)|0,n=n+Math.imul(R,W)|0,i=(i=i+Math.imul(R,J)|0)+Math.imul(B,W)|0,o=o+Math.imul(B,J)|0,n=n+Math.imul(k,Y)|0,i=(i=i+Math.imul(k,X)|0)+Math.imul(x,Y)|0,o=o+Math.imul(x,X)|0,n=n+Math.imul(A,Q)|0,i=(i=i+Math.imul(A,tt)|0)+Math.imul(M,Q)|0,o=o+Math.imul(M,tt)|0,n=n+Math.imul(w,rt)|0,i=(i=i+Math.imul(w,nt)|0)+Math.imul(_,rt)|0,o=o+Math.imul(_,nt)|0,n=n+Math.imul(y,ot)|0,i=(i=i+Math.imul(y,st)|0)+Math.imul(b,ot)|0,o=o+Math.imul(b,st)|0,n=n+Math.imul(p,ut)|0,i=(i=i+Math.imul(p,ht)|0)+Math.imul(m,ut)|0,o=o+Math.imul(m,ht)|0;var Mt=(h+(n=n+Math.imul(f,ft)|0)|0)+((8191&(i=(i=i+Math.imul(f,lt)|0)+Math.imul(l,ft)|0))<<13)|0;h=((o=o+Math.imul(l,lt)|0)+(i>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,n=Math.imul(D,z),i=(i=Math.imul(D,q))+Math.imul(U,z)|0,o=Math.imul(U,q),n=n+Math.imul(C,K)|0,i=(i=i+Math.imul(C,G)|0)+Math.imul(L,K)|0,o=o+Math.imul(L,G)|0,n=n+Math.imul(P,W)|0,i=(i=i+Math.imul(P,J)|0)+Math.imul(I,W)|0,o=o+Math.imul(I,J)|0,n=n+Math.imul(R,Y)|0,i=(i=i+Math.imul(R,X)|0)+Math.imul(B,Y)|0,o=o+Math.imul(B,X)|0,n=n+Math.imul(k,Q)|0,i=(i=i+Math.imul(k,tt)|0)+Math.imul(x,Q)|0,o=o+Math.imul(x,tt)|0,n=n+Math.imul(A,rt)|0,i=(i=i+Math.imul(A,nt)|0)+Math.imul(M,rt)|0,o=o+Math.imul(M,nt)|0,n=n+Math.imul(w,ot)|0,i=(i=i+Math.imul(w,st)|0)+Math.imul(_,ot)|0,o=o+Math.imul(_,st)|0,n=n+Math.imul(y,ut)|0,i=(i=i+Math.imul(y,ht)|0)+Math.imul(b,ut)|0,o=o+Math.imul(b,ht)|0,n=n+Math.imul(p,ft)|0,i=(i=i+Math.imul(p,lt)|0)+Math.imul(m,ft)|0,o=o+Math.imul(m,lt)|0;var St=(h+(n=n+Math.imul(f,pt)|0)|0)+((8191&(i=(i=i+Math.imul(f,mt)|0)+Math.imul(l,pt)|0))<<13)|0;h=((o=o+Math.imul(l,mt)|0)+(i>>>13)|0)+(St>>>26)|0,St&=67108863,n=Math.imul(D,K),i=(i=Math.imul(D,G))+Math.imul(U,K)|0,o=Math.imul(U,G),n=n+Math.imul(C,W)|0,i=(i=i+Math.imul(C,J)|0)+Math.imul(L,W)|0,o=o+Math.imul(L,J)|0,n=n+Math.imul(P,Y)|0,i=(i=i+Math.imul(P,X)|0)+Math.imul(I,Y)|0,o=o+Math.imul(I,X)|0,n=n+Math.imul(R,Q)|0,i=(i=i+Math.imul(R,tt)|0)+Math.imul(B,Q)|0,o=o+Math.imul(B,tt)|0,n=n+Math.imul(k,rt)|0,i=(i=i+Math.imul(k,nt)|0)+Math.imul(x,rt)|0,o=o+Math.imul(x,nt)|0,n=n+Math.imul(A,ot)|0,i=(i=i+Math.imul(A,st)|0)+Math.imul(M,ot)|0,o=o+Math.imul(M,st)|0,n=n+Math.imul(w,ut)|0,i=(i=i+Math.imul(w,ht)|0)+Math.imul(_,ut)|0,o=o+Math.imul(_,ht)|0,n=n+Math.imul(y,ft)|0,i=(i=i+Math.imul(y,lt)|0)+Math.imul(b,ft)|0,o=o+Math.imul(b,lt)|0;var kt=(h+(n=n+Math.imul(p,pt)|0)|0)+((8191&(i=(i=i+Math.imul(p,mt)|0)+Math.imul(m,pt)|0))<<13)|0;h=((o=o+Math.imul(m,mt)|0)+(i>>>13)|0)+(kt>>>26)|0,kt&=67108863,n=Math.imul(D,W),i=(i=Math.imul(D,J))+Math.imul(U,W)|0,o=Math.imul(U,J),n=n+Math.imul(C,Y)|0,i=(i=i+Math.imul(C,X)|0)+Math.imul(L,Y)|0,o=o+Math.imul(L,X)|0,n=n+Math.imul(P,Q)|0,i=(i=i+Math.imul(P,tt)|0)+Math.imul(I,Q)|0,o=o+Math.imul(I,tt)|0,n=n+Math.imul(R,rt)|0,i=(i=i+Math.imul(R,nt)|0)+Math.imul(B,rt)|0,o=o+Math.imul(B,nt)|0,n=n+Math.imul(k,ot)|0,i=(i=i+Math.imul(k,st)|0)+Math.imul(x,ot)|0,o=o+Math.imul(x,st)|0,n=n+Math.imul(A,ut)|0,i=(i=i+Math.imul(A,ht)|0)+Math.imul(M,ut)|0,o=o+Math.imul(M,ht)|0,n=n+Math.imul(w,ft)|0,i=(i=i+Math.imul(w,lt)|0)+Math.imul(_,ft)|0,o=o+Math.imul(_,lt)|0;var xt=(h+(n=n+Math.imul(y,pt)|0)|0)+((8191&(i=(i=i+Math.imul(y,mt)|0)+Math.imul(b,pt)|0))<<13)|0;h=((o=o+Math.imul(b,mt)|0)+(i>>>13)|0)+(xt>>>26)|0,xt&=67108863,n=Math.imul(D,Y),i=(i=Math.imul(D,X))+Math.imul(U,Y)|0,o=Math.imul(U,X),n=n+Math.imul(C,Q)|0,i=(i=i+Math.imul(C,tt)|0)+Math.imul(L,Q)|0,o=o+Math.imul(L,tt)|0,n=n+Math.imul(P,rt)|0,i=(i=i+Math.imul(P,nt)|0)+Math.imul(I,rt)|0,o=o+Math.imul(I,nt)|0,n=n+Math.imul(R,ot)|0,i=(i=i+Math.imul(R,st)|0)+Math.imul(B,ot)|0,o=o+Math.imul(B,st)|0,n=n+Math.imul(k,ut)|0,i=(i=i+Math.imul(k,ht)|0)+Math.imul(x,ut)|0,o=o+Math.imul(x,ht)|0,n=n+Math.imul(A,ft)|0,i=(i=i+Math.imul(A,lt)|0)+Math.imul(M,ft)|0,o=o+Math.imul(M,lt)|0;var Tt=(h+(n=n+Math.imul(w,pt)|0)|0)+((8191&(i=(i=i+Math.imul(w,mt)|0)+Math.imul(_,pt)|0))<<13)|0;h=((o=o+Math.imul(_,mt)|0)+(i>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,n=Math.imul(D,Q),i=(i=Math.imul(D,tt))+Math.imul(U,Q)|0,o=Math.imul(U,tt),n=n+Math.imul(C,rt)|0,i=(i=i+Math.imul(C,nt)|0)+Math.imul(L,rt)|0,o=o+Math.imul(L,nt)|0,n=n+Math.imul(P,ot)|0,i=(i=i+Math.imul(P,st)|0)+Math.imul(I,ot)|0,o=o+Math.imul(I,st)|0,n=n+Math.imul(R,ut)|0,i=(i=i+Math.imul(R,ht)|0)+Math.imul(B,ut)|0,o=o+Math.imul(B,ht)|0,n=n+Math.imul(k,ft)|0,i=(i=i+Math.imul(k,lt)|0)+Math.imul(x,ft)|0,o=o+Math.imul(x,lt)|0;var Rt=(h+(n=n+Math.imul(A,pt)|0)|0)+((8191&(i=(i=i+Math.imul(A,mt)|0)+Math.imul(M,pt)|0))<<13)|0;h=((o=o+Math.imul(M,mt)|0)+(i>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,n=Math.imul(D,rt),i=(i=Math.imul(D,nt))+Math.imul(U,rt)|0,o=Math.imul(U,nt),n=n+Math.imul(C,ot)|0,i=(i=i+Math.imul(C,st)|0)+Math.imul(L,ot)|0,o=o+Math.imul(L,st)|0,n=n+Math.imul(P,ut)|0,i=(i=i+Math.imul(P,ht)|0)+Math.imul(I,ut)|0,o=o+Math.imul(I,ht)|0,n=n+Math.imul(R,ft)|0,i=(i=i+Math.imul(R,lt)|0)+Math.imul(B,ft)|0,o=o+Math.imul(B,lt)|0;var Bt=(h+(n=n+Math.imul(k,pt)|0)|0)+((8191&(i=(i=i+Math.imul(k,mt)|0)+Math.imul(x,pt)|0))<<13)|0;h=((o=o+Math.imul(x,mt)|0)+(i>>>13)|0)+(Bt>>>26)|0,Bt&=67108863,n=Math.imul(D,ot),i=(i=Math.imul(D,st))+Math.imul(U,ot)|0,o=Math.imul(U,st),n=n+Math.imul(C,ut)|0,i=(i=i+Math.imul(C,ht)|0)+Math.imul(L,ut)|0,o=o+Math.imul(L,ht)|0,n=n+Math.imul(P,ft)|0,i=(i=i+Math.imul(P,lt)|0)+Math.imul(I,ft)|0,o=o+Math.imul(I,lt)|0;var Nt=(h+(n=n+Math.imul(R,pt)|0)|0)+((8191&(i=(i=i+Math.imul(R,mt)|0)+Math.imul(B,pt)|0))<<13)|0;h=((o=o+Math.imul(B,mt)|0)+(i>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,n=Math.imul(D,ut),i=(i=Math.imul(D,ht))+Math.imul(U,ut)|0,o=Math.imul(U,ht),n=n+Math.imul(C,ft)|0,i=(i=i+Math.imul(C,lt)|0)+Math.imul(L,ft)|0,o=o+Math.imul(L,lt)|0;var Pt=(h+(n=n+Math.imul(P,pt)|0)|0)+((8191&(i=(i=i+Math.imul(P,mt)|0)+Math.imul(I,pt)|0))<<13)|0;h=((o=o+Math.imul(I,mt)|0)+(i>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,n=Math.imul(D,ft),i=(i=Math.imul(D,lt))+Math.imul(U,ft)|0,o=Math.imul(U,lt);var It=(h+(n=n+Math.imul(C,pt)|0)|0)+((8191&(i=(i=i+Math.imul(C,mt)|0)+Math.imul(L,pt)|0))<<13)|0;h=((o=o+Math.imul(L,mt)|0)+(i>>>13)|0)+(It>>>26)|0,It&=67108863;var Ot=(h+(n=Math.imul(D,pt))|0)+((8191&(i=(i=Math.imul(D,mt))+Math.imul(U,pt)|0))<<13)|0;return h=((o=Math.imul(U,mt))+(i>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,u[0]=gt,u[1]=yt,u[2]=bt,u[3]=vt,u[4]=wt,u[5]=_t,u[6]=Et,u[7]=At,u[8]=Mt,u[9]=St,u[10]=kt,u[11]=xt,u[12]=Tt,u[13]=Rt,u[14]=Bt,u[15]=Nt,u[16]=Pt,u[17]=It,u[18]=Ot,0!==h&&(u[19]=h,r.length++),r};function g(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var n=0,i=0,o=0;o<r.length-1;o++){var s=i;i=0;for(var a=67108863&n,u=Math.min(o,e.length-1),h=Math.max(0,o-t.length+1);h<=u;h++){var c=o-h,f=(0|t.words[c])*(0|e.words[h]),l=67108863&f;a=67108863&(l=l+a|0),i+=(s=(s=s+(f/67108864|0)|0)+(l>>>26)|0)>>>26,s&=67108863}r.words[o]=a,n=s,s=i}return 0!==n?r.words[o]=n:r.length--,r._strip()}function y(t,e,r){return g(t,e,r)}Math.imul||(m=p),i.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?m(this,t,e):r<63?p(this,t,e):r<1024?g(this,t,e):y(this,t,e)},i.prototype.mul=function(t){var e=new i(null);return e.words=new Array(this.length+t.length),this.mulTo(t,e)},i.prototype.mulf=function(t){var e=new i(null);return e.words=new Array(this.length+t.length),y(this,t,e)},i.prototype.imul=function(t){return this.clone().mulTo(t,this)},i.prototype.imuln=function(t){var e=t<0;e&&(t=-t),r("number"==typeof t),r(t<67108864);for(var n=0,i=0;i<this.length;i++){var o=(0|this.words[i])*t,s=(67108863&o)+(67108863&n);n>>=26,n+=o/67108864|0,n+=s>>>26,this.words[i]=67108863&s}return 0!==n&&(this.words[i]=n,this.length++),this.length=0===t?1:this.length,e?this.ineg():this},i.prototype.muln=function(t){return this.clone().imuln(t)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.imul(this.clone())},i.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r<e.length;r++){var n=r/26|0,i=r%26;e[r]=t.words[n]>>>i&1}return e}(t);if(0===e.length)return new i(1);for(var r=this,n=0;n<e.length&&0===e[n];n++,r=r.sqr());if(++n<e.length)for(var o=r.sqr();n<e.length;n++,o=o.sqr())0!==e[n]&&(r=r.mul(o));return r},i.prototype.iushln=function(t){r("number"==typeof t&&t>=0);var e,n=t%26,i=(t-n)/26,o=67108863>>>26-n<<26-n;if(0!==n){var s=0;for(e=0;e<this.length;e++){var a=this.words[e]&o,u=(0|this.words[e])-a<<n;this.words[e]=u|s,s=a>>>26-n}s&&(this.words[e]=s,this.length++)}if(0!==i){for(e=this.length-1;e>=0;e--)this.words[e+i]=this.words[e];for(e=0;e<i;e++)this.words[e]=0;this.length+=i}return this._strip()},i.prototype.ishln=function(t){return r(0===this.negative),this.iushln(t)},i.prototype.iushrn=function(t,e,n){var i;r("number"==typeof t&&t>=0),i=e?(e-e%26)/26:0;var o=t%26,s=Math.min((t-o)/26,this.length),a=67108863^67108863>>>o<<o,u=n;if(i-=s,i=Math.max(0,i),u){for(var h=0;h<s;h++)u.words[h]=this.words[h];u.length=s}if(0===s);else if(this.length>s)for(this.length-=s,h=0;h<this.length;h++)this.words[h]=this.words[h+s];else this.words[0]=0,this.length=1;var c=0;for(h=this.length-1;h>=0&&(0!==c||h>=i);h--){var f=0|this.words[h];this.words[h]=c<<26-o|f>>>o,c=f&a}return u&&0!==c&&(u.words[u.length++]=c),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},i.prototype.ishrn=function(t,e,n){return r(0===this.negative),this.iushrn(t,e,n)},i.prototype.shln=function(t){return this.clone().ishln(t)},i.prototype.ushln=function(t){return this.clone().iushln(t)},i.prototype.shrn=function(t){return this.clone().ishrn(t)},i.prototype.ushrn=function(t){return this.clone().iushrn(t)},i.prototype.testn=function(t){r("number"==typeof t&&t>=0);var e=t%26,n=(t-e)/26,i=1<<e;return!(this.length<=n)&&!!(this.words[n]&i)},i.prototype.imaskn=function(t){r("number"==typeof t&&t>=0);var e=t%26,n=(t-e)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=n)return this;if(0!==e&&n++,this.length=Math.min(n,this.length),0!==e){var i=67108863^67108863>>>e<<e;this.words[this.length-1]&=i}return this._strip()},i.prototype.maskn=function(t){return this.clone().imaskn(t)},i.prototype.iaddn=function(t){return r("number"==typeof t),r(t<67108864),t<0?this.isubn(-t):0!==this.negative?1===this.length&&(0|this.words[0])<=t?(this.words[0]=t-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(t),this.negative=1,this):this._iaddn(t)},i.prototype._iaddn=function(t){this.words[0]+=t;for(var e=0;e<this.length&&this.words[e]>=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},i.prototype.isubn=function(t){if(r("number"==typeof t),r(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e<this.length&&this.words[e]<0;e++)this.words[e]+=67108864,this.words[e+1]-=1;return this._strip()},i.prototype.addn=function(t){return this.clone().iaddn(t)},i.prototype.subn=function(t){return this.clone().isubn(t)},i.prototype.iabs=function(){return this.negative=0,this},i.prototype.abs=function(){return this.clone().iabs()},i.prototype._ishlnsubmul=function(t,e,n){var i,o,s=t.length+n;this._expand(s);var a=0;for(i=0;i<t.length;i++){o=(0|this.words[i+n])+a;var u=(0|t.words[i])*e;a=((o-=67108863&u)>>26)-(u/67108864|0),this.words[i+n]=67108863&o}for(;i<this.length-n;i++)a=(o=(0|this.words[i+n])+a)>>26,this.words[i+n]=67108863&o;if(0===a)return this._strip();for(r(-1===a),a=0,i=0;i<this.length;i++)a=(o=-(0|this.words[i])+a)>>26,this.words[i]=67108863&o;return this.negative=1,this._strip()},i.prototype._wordDiv=function(t,e){var r=(this.length,t.length),n=this.clone(),o=t,s=0|o.words[o.length-1];0!==(r=26-this._countBits(s))&&(o=o.ushln(r),n.iushln(r),s=0|o.words[o.length-1]);var a,u=n.length-o.length;if("mod"!==e){(a=new i(null)).length=u+1,a.words=new Array(a.length);for(var h=0;h<a.length;h++)a.words[h]=0}var c=n.clone()._ishlnsubmul(o,1,u);0===c.negative&&(n=c,a&&(a.words[u]=1));for(var f=u-1;f>=0;f--){var l=67108864*(0|n.words[o.length+f])+(0|n.words[o.length+f-1]);for(l=Math.min(l/s|0,67108863),n._ishlnsubmul(o,l,f);0!==n.negative;)l--,n.negative=0,n._ishlnsubmul(o,1,f),n.isZero()||(n.negative^=1);a&&(a.words[f]=l)}return a&&a._strip(),n._strip(),"div"!==e&&0!==r&&n.iushrn(r),{div:a||null,mod:n}},i.prototype.divmod=function(t,e,n){return r(!t.isZero()),this.isZero()?{div:new i(0),mod:new i(0)}:0!==this.negative&&0===t.negative?(a=this.neg().divmod(t,e),"mod"!==e&&(o=a.div.neg()),"div"!==e&&(s=a.mod.neg(),n&&0!==s.negative&&s.iadd(t)),{div:o,mod:s}):0===this.negative&&0!==t.negative?(a=this.divmod(t.neg(),e),"mod"!==e&&(o=a.div.neg()),{div:o,mod:a.mod}):0!==(this.negative&t.negative)?(a=this.neg().divmod(t.neg(),e),"div"!==e&&(s=a.mod.neg(),n&&0!==s.negative&&s.isub(t)),{div:a.div,mod:s}):t.length>this.length||this.cmp(t)<0?{div:new i(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new i(this.modrn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new i(this.modrn(t.words[0]))}:this._wordDiv(t,e);var o,s,a},i.prototype.div=function(t){return this.divmod(t,"div",!1).div},i.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},i.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},i.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,n=t.ushrn(1),i=t.andln(1),o=r.cmp(n);return o<0||1===i&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},i.prototype.modrn=function(t){var e=t<0;e&&(t=-t),r(t<=67108863);for(var n=(1<<26)%t,i=0,o=this.length-1;o>=0;o--)i=(n*i+(0|this.words[o]))%t;return e?-i:i},i.prototype.modn=function(t){return this.modrn(t)},i.prototype.idivn=function(t){var e=t<0;e&&(t=-t),r(t<=67108863);for(var n=0,i=this.length-1;i>=0;i--){var o=(0|this.words[i])+67108864*n;this.words[i]=o/t|0,n=o%t}return this._strip(),e?this.ineg():this},i.prototype.divn=function(t){return this.clone().idivn(t)},i.prototype.egcd=function(t){r(0===t.negative),r(!t.isZero());var e=this,n=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var o=new i(1),s=new i(0),a=new i(0),u=new i(1),h=0;e.isEven()&&n.isEven();)e.iushrn(1),n.iushrn(1),++h;for(var c=n.clone(),f=e.clone();!e.isZero();){for(var l=0,d=1;0===(e.words[0]&d)&&l<26;++l,d<<=1);if(l>0)for(e.iushrn(l);l-- >0;)(o.isOdd()||s.isOdd())&&(o.iadd(c),s.isub(f)),o.iushrn(1),s.iushrn(1);for(var p=0,m=1;0===(n.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(n.iushrn(p);p-- >0;)(a.isOdd()||u.isOdd())&&(a.iadd(c),u.isub(f)),a.iushrn(1),u.iushrn(1);e.cmp(n)>=0?(e.isub(n),o.isub(a),s.isub(u)):(n.isub(e),a.isub(o),u.isub(s))}return{a:a,b:u,gcd:n.iushln(h)}},i.prototype._invmp=function(t){r(0===t.negative),r(!t.isZero());var e=this,n=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var o,s=new i(1),a=new i(0),u=n.clone();e.cmpn(1)>0&&n.cmpn(1)>0;){for(var h=0,c=1;0===(e.words[0]&c)&&h<26;++h,c<<=1);if(h>0)for(e.iushrn(h);h-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);for(var f=0,l=1;0===(n.words[0]&l)&&f<26;++f,l<<=1);if(f>0)for(n.iushrn(f);f-- >0;)a.isOdd()&&a.iadd(u),a.iushrn(1);e.cmp(n)>=0?(e.isub(n),s.isub(a)):(n.isub(e),a.isub(s))}return(o=0===e.cmpn(1)?s:a).cmpn(0)<0&&o.iadd(t),o},i.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var n=0;e.isEven()&&r.isEven();n++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var i=e.cmp(r);if(i<0){var o=e;e=r,r=o}else if(0===i||0===r.cmpn(1))break;e.isub(r)}return r.iushln(n)},i.prototype.invm=function(t){return this.egcd(t).a.umod(t)},i.prototype.isEven=function(){return!(1&this.words[0])},i.prototype.isOdd=function(){return!(1&~this.words[0])},i.prototype.andln=function(t){return this.words[0]&t},i.prototype.bincn=function(t){r("number"==typeof t);var e=t%26,n=(t-e)/26,i=1<<e;if(this.length<=n)return this._expand(n+1),this.words[n]|=i,this;for(var o=i,s=n;0!==o&&s<this.length;s++){var a=0|this.words[s];o=(a+=o)>>>26,a&=67108863,this.words[s]=a}return 0!==o&&(this.words[s]=o,this.length++),this},i.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},i.prototype.cmpn=function(t){var e,n=t<0;if(0!==this.negative&&!n)return-1;if(0===this.negative&&n)return 1;if(this._strip(),this.length>1)e=1;else{n&&(t=-t),r(t<=67108863,"Number is too big");var i=0|this.words[0];e=i===t?0:i<t?-1:1}return 0!==this.negative?0|-e:e},i.prototype.cmp=function(t){if(0!==this.negative&&0===t.negative)return-1;if(0===this.negative&&0!==t.negative)return 1;var e=this.ucmp(t);return 0!==this.negative?0|-e:e},i.prototype.ucmp=function(t){if(this.length>t.length)return 1;if(this.length<t.length)return-1;for(var e=0,r=this.length-1;r>=0;r--){var n=0|this.words[r],i=0|t.words[r];if(n!==i){n<i?e=-1:n>i&&(e=1);break}}return e},i.prototype.gtn=function(t){return 1===this.cmpn(t)},i.prototype.gt=function(t){return 1===this.cmp(t)},i.prototype.gten=function(t){return this.cmpn(t)>=0},i.prototype.gte=function(t){return this.cmp(t)>=0},i.prototype.ltn=function(t){return-1===this.cmpn(t)},i.prototype.lt=function(t){return-1===this.cmp(t)},i.prototype.lten=function(t){return this.cmpn(t)<=0},i.prototype.lte=function(t){return this.cmp(t)<=0},i.prototype.eqn=function(t){return 0===this.cmpn(t)},i.prototype.eq=function(t){return 0===this.cmp(t)},i.red=function(t){return new M(t)},i.prototype.toRed=function(t){return r(!this.red,"Already a number in reduction context"),r(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},i.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function(t){return this.red=t,this},i.prototype.forceRed=function(t){return r(!this.red,"Already a number in reduction context"),this._forceRed(t)},i.prototype.redAdd=function(t){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},i.prototype.redIAdd=function(t){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},i.prototype.redSub=function(t){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},i.prototype.redISub=function(t){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},i.prototype.redShl=function(t){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},i.prototype.redMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},i.prototype.redIMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},i.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(t){return r(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var b={k256:null,p224:null,p192:null,p25519:null};function v(t,e){this.name=t,this.p=new i(e,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function w(){v.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function _(){v.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function E(){v.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function A(){v.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function M(t){if("string"==typeof t){var e=i._prime(t);this.m=e.p,this.prime=e}else r(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function S(t){M.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new i(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}v.prototype._tmp=function(){var t=new i(null);return t.words=new Array(Math.ceil(this.n/13)),t},v.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(e>this.n);var n=e<this.n?-1:r.ucmp(this.p);return 0===n?(r.words[0]=0,r.length=1):n>0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},v.prototype.split=function(t,e){t.iushrn(this.n,0,e)},v.prototype.imulK=function(t){return t.imul(this.k)},n(w,v),w.prototype.split=function(t,e){for(var r=4194303,n=Math.min(t.length,9),i=0;i<n;i++)e.words[i]=t.words[i];if(e.length=n,t.length<=9)return t.words[0]=0,void(t.length=1);var o=t.words[9];for(e.words[e.length++]=o&r,i=10;i<t.length;i++){var s=0|t.words[i];t.words[i-10]=(s&r)<<4|o>>>22,o=s}o>>>=22,t.words[i-10]=o,0===o&&t.length>10?t.length-=10:t.length-=9},w.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r<t.length;r++){var n=0|t.words[r];e+=977*n,t.words[r]=67108863&e,e=64*n+(e/67108864|0)}return 0===t.words[t.length-1]&&(t.length--,0===t.words[t.length-1]&&t.length--),t},n(_,v),n(E,v),n(A,v),A.prototype.imulK=function(t){for(var e=0,r=0;r<t.length;r++){var n=19*(0|t.words[r])+e,i=67108863&n;n>>>=26,t.words[r]=i,e=n}return 0!==e&&(t.words[t.length++]=e),t},i._prime=function(t){if(b[t])return b[t];var e;if("k256"===t)e=new w;else if("p224"===t)e=new _;else if("p192"===t)e=new E;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new A}return b[t]=e,e},M.prototype._verify1=function(t){r(0===t.negative,"red works only with positives"),r(t.red,"red works only with red numbers")},M.prototype._verify2=function(t,e){r(0===(t.negative|e.negative),"red works only with positives"),r(t.red&&t.red===e.red,"red works only with red numbers")},M.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):(h(t,t.umod(this.m)._forceRed(this)),t)},M.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},M.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},M.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},M.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},M.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},M.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},M.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},M.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},M.prototype.isqr=function(t){return this.imul(t,t.clone())},M.prototype.sqr=function(t){return this.mul(t,t)},M.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(r(e%2==1),3===e){var n=this.m.add(new i(1)).iushrn(2);return this.pow(t,n)}for(var o=this.m.subn(1),s=0;!o.isZero()&&0===o.andln(1);)s++,o.iushrn(1);r(!o.isZero());var a=new i(1).toRed(this),u=a.redNeg(),h=this.m.subn(1).iushrn(1),c=this.m.bitLength();for(c=new i(2*c*c).toRed(this);0!==this.pow(c,h).cmp(u);)c.redIAdd(u);for(var f=this.pow(c,o),l=this.pow(t,o.addn(1).iushrn(1)),d=this.pow(t,o),p=s;0!==d.cmp(a);){for(var m=d,g=0;0!==m.cmp(a);g++)m=m.redSqr();r(g<p);var y=this.pow(f,new i(1).iushln(p-g-1));l=l.redMul(y),f=y.redSqr(),d=d.redMul(f),p=g}return l},M.prototype.invm=function(t){var e=t._invmp(this.m);return 0!==e.negative?(e.negative=0,this.imod(e).redNeg()):this.imod(e)},M.prototype.pow=function(t,e){if(e.isZero())return new i(1).toRed(this);if(0===e.cmpn(1))return t.clone();var r=new Array(16);r[0]=new i(1).toRed(this),r[1]=t;for(var n=2;n<r.length;n++)r[n]=this.mul(r[n-1],t);var o=r[0],s=0,a=0,u=e.bitLength()%26;for(0===u&&(u=26),n=e.length-1;n>=0;n--){for(var h=e.words[n],c=u-1;c>=0;c--){var f=h>>c&1;o!==r[0]&&(o=this.sqr(o)),0!==f||0!==s?(s<<=1,s|=f,(4===++a||0===n&&0===c)&&(o=this.mul(o,r[s]),a=0,s=0)):a=0}u=26}return o},M.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},M.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},i.mont=function(t){return new S(t)},n(S,M),S.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},S.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},S.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},S.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new i(0)._forceRed(this);var r=t.mul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=r.isub(n).iushrn(this.shift),s=o;return o.cmp(this.m)>=0?s=o.isub(this.m):o.cmpn(0)<0&&(s=o.iadd(this.m)),s._forceRed(this)},S.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t,e)}(mN);var gN=mN.exports,yN=fw,bN=yg.Buffer;function vN(t){var e,r=t.modulus.byteLength();do{e=new gN(yN(r))}while(e.cmp(t.modulus)>=0||!e.umod(t.prime1)||!e.umod(t.prime2));return e}function wN(t,e){var r=function(t){var e=vN(t);return{blinder:e.toRed(gN.mont(t.modulus)).redPow(new gN(t.publicExponent)).fromRed(),unblinder:e.invm(t.modulus)}}(e),n=e.modulus.byteLength(),i=new gN(t).mul(r.blinder).umod(e.modulus),o=i.toRed(gN.mont(e.prime1)),s=i.toRed(gN.mont(e.prime2)),a=e.coefficient,u=e.prime1,h=e.prime2,c=o.redPow(e.exponent1).fromRed(),f=s.redPow(e.exponent2).fromRed(),l=c.isub(f).imul(a).umod(u).imul(h);return f.iadd(l).imul(r.unblinder).umod(e.modulus).toArrayLike(bN,"be",n)}wN.getr=vN;var _N=wN,EN={exports:{}};!function(t){!function(t,e){function r(t,e){if(!t)throw new Error(e||"Assertion failed")}function n(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function i(t,e,r){if(i.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(r=e,e=10),this._init(t||0,e||10,r||"be"))}var o;"object"==typeof t?t.exports=i:e.BN=i,i.BN=i,i.wordSize=26;try{o="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:st.Buffer}catch(t){}function s(t,e){var n=t.charCodeAt(e);return n>=48&&n<=57?n-48:n>=65&&n<=70?n-55:n>=97&&n<=102?n-87:void r(!1,"Invalid character in "+t)}function a(t,e,r){var n=s(t,r);return r-1>=e&&(n|=s(t,r-1)<<4),n}function u(t,e,n,i){for(var o=0,s=0,a=Math.min(t.length,n),u=e;u<a;u++){var h=t.charCodeAt(u)-48;o*=i,s=h>=49?h-49+10:h>=17?h-17+10:h,r(h>=0&&s<i,"Invalid character"),o+=s}return o}function h(t,e){t.words=e.words,t.length=e.length,t.negative=e.negative,t.red=e.red}if(i.isBN=function(t){return t instanceof i||null!==t&&"object"==typeof t&&t.constructor.wordSize===i.wordSize&&Array.isArray(t.words)},i.max=function(t,e){return t.cmp(e)>0?t:e},i.min=function(t,e){return t.cmp(e)<0?t:e},i.prototype._init=function(t,e,n){if("number"==typeof t)return this._initNumber(t,e,n);if("object"==typeof t)return this._initArray(t,e,n);"hex"===e&&(e=16),r(e===(0|e)&&e>=2&&e<=36);var i=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i<t.length&&(16===e?this._parseHex(t,i,n):(this._parseBase(t,e,i),"le"===n&&this._initArray(this.toArray(),e,n)))},i.prototype._initNumber=function(t,e,n){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(r(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===n&&this._initArray(this.toArray(),e,n)},i.prototype._initArray=function(t,e,n){if(r("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var i=0;i<this.length;i++)this.words[i]=0;var o,s,a=0;if("be"===n)for(i=t.length-1,o=0;i>=0;i-=3)s=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[o]|=s<<a&67108863,this.words[o+1]=s>>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);else if("le"===n)for(i=0,o=0;i<t.length;i+=3)s=t[i]|t[i+1]<<8|t[i+2]<<16,this.words[o]|=s<<a&67108863,this.words[o+1]=s>>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);return this._strip()},i.prototype._parseHex=function(t,e,r){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var n=0;n<this.length;n++)this.words[n]=0;var i,o=0,s=0;if("be"===r)for(n=t.length-1;n>=e;n-=2)i=a(t,e,n)<<o,this.words[s]|=67108863&i,o>=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;else for(n=(t.length-e)%2==0?e+1:e;n<t.length;n+=2)i=a(t,e,n)<<o,this.words[s]|=67108863&i,o>=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;this._strip()},i.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var n=0,i=1;i<=67108863;i*=e)n++;n--,i=i/e|0;for(var o=t.length-r,s=o%n,a=Math.min(o,o-s)+r,h=0,c=r;c<a;c+=n)h=u(t,c,c+n,e),this.imuln(i),this.words[0]+h<67108864?this.words[0]+=h:this._iaddn(h);if(0!==s){var f=1;for(h=u(t,c,t.length,e),c=0;c<s;c++)f*=e;this.imuln(f),this.words[0]+h<67108864?this.words[0]+=h:this._iaddn(h)}this._strip()},i.prototype.copy=function(t){t.words=new Array(this.length);for(var e=0;e<this.length;e++)t.words[e]=this.words[e];t.length=this.length,t.negative=this.negative,t.red=this.red},i.prototype._move=function(t){h(t,this)},i.prototype.clone=function(){var t=new i(null);return this.copy(t),t},i.prototype._expand=function(t){for(;this.length<t;)this.words[this.length++]=0;return this},i.prototype._strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},i.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for)try{i.prototype[Symbol.for("nodejs.util.inspect.custom")]=c}catch(t){i.prototype.inspect=c}else i.prototype.inspect=c;function c(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"}var f=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],l=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],d=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];i.prototype.toString=function(t,e){var n;if(e=0|e||1,16===(t=t||10)||"hex"===t){n="";for(var i=0,o=0,s=0;s<this.length;s++){var a=this.words[s],u=(16777215&(a<<i|o)).toString(16);o=a>>>24-i&16777215,(i+=2)>=26&&(i-=26,s--),n=0!==o||s!==this.length-1?f[6-u.length]+u+n:u+n}for(0!==o&&(n=o.toString(16)+n);n.length%e!==0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}if(t===(0|t)&&t>=2&&t<=36){var h=l[t],c=d[t];n="";var p=this.clone();for(p.negative=0;!p.isZero();){var m=p.modrn(c).toString(t);n=(p=p.idivn(c)).isZero()?m+n:f[h-m.length]+m+n}for(this.isZero()&&(n="0"+n);n.length%e!==0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}r(!1,"Base should be between 2 and 36")},i.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},i.prototype.toJSON=function(){return this.toString(16,2)},o&&(i.prototype.toBuffer=function(t,e){return this.toArrayLike(o,t,e)}),i.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)};function p(t,e,r){r.negative=e.negative^t.negative;var n=t.length+e.length|0;r.length=n,n=n-1|0;var i=0|t.words[0],o=0|e.words[0],s=i*o,a=67108863&s,u=s/67108864|0;r.words[0]=a;for(var h=1;h<n;h++){for(var c=u>>>26,f=67108863&u,l=Math.min(h,e.length-1),d=Math.max(0,h-t.length+1);d<=l;d++){var p=h-d|0;c+=(s=(i=0|t.words[p])*(o=0|e.words[d])+f)/67108864|0,f=67108863&s}r.words[h]=0|f,u=0|c}return 0!==u?r.words[h]=0|u:r.length--,r._strip()}i.prototype.toArrayLike=function(t,e,n){this._strip();var i=this.byteLength(),o=n||Math.max(1,i);r(i<=o,"byte array longer than desired length"),r(o>0,"Requested array length <= 0");var s=function(t,e){return t.allocUnsafe?t.allocUnsafe(e):new t(e)}(t,o);return this["_toArrayLike"+("le"===e?"LE":"BE")](s,i),s},i.prototype._toArrayLikeLE=function(t,e){for(var r=0,n=0,i=0,o=0;i<this.length;i++){var s=this.words[i]<<o|n;t[r++]=255&s,r<t.length&&(t[r++]=s>>8&255),r<t.length&&(t[r++]=s>>16&255),6===o?(r<t.length&&(t[r++]=s>>24&255),n=0,o=0):(n=s>>>24,o+=2)}if(r<t.length)for(t[r++]=n;r<t.length;)t[r++]=0},i.prototype._toArrayLikeBE=function(t,e){for(var r=t.length-1,n=0,i=0,o=0;i<this.length;i++){var s=this.words[i]<<o|n;t[r--]=255&s,r>=0&&(t[r--]=s>>8&255),r>=0&&(t[r--]=s>>16&255),6===o?(r>=0&&(t[r--]=s>>24&255),n=0,o=0):(n=s>>>24,o+=2)}if(r>=0)for(t[r--]=n;r>=0;)t[r--]=0},Math.clz32?i.prototype._countBits=function(t){return 32-Math.clz32(t)}:i.prototype._countBits=function(t){var e=t,r=0;return e>=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},i.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 8191&e||(r+=13,e>>>=13),127&e||(r+=7,e>>>=7),15&e||(r+=4,e>>>=4),3&e||(r+=2,e>>>=2),1&e||r++,r},i.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;e<this.length;e++){var r=this._zeroBits(this.words[e]);if(t+=r,26!==r)break}return t},i.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},i.prototype.toTwos=function(t){return 0!==this.negative?this.abs().inotn(t).iaddn(1):this.clone()},i.prototype.fromTwos=function(t){return this.testn(t-1)?this.notn(t).iaddn(1).ineg():this.clone()},i.prototype.isNeg=function(){return 0!==this.negative},i.prototype.neg=function(){return this.clone().ineg()},i.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},i.prototype.iuor=function(t){for(;this.length<t.length;)this.words[this.length++]=0;for(var e=0;e<t.length;e++)this.words[e]=this.words[e]|t.words[e];return this._strip()},i.prototype.ior=function(t){return r(0===(this.negative|t.negative)),this.iuor(t)},i.prototype.or=function(t){return this.length>t.length?this.clone().ior(t):t.clone().ior(this)},i.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},i.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;r<e.length;r++)this.words[r]=this.words[r]&t.words[r];return this.length=e.length,this._strip()},i.prototype.iand=function(t){return r(0===(this.negative|t.negative)),this.iuand(t)},i.prototype.and=function(t){return this.length>t.length?this.clone().iand(t):t.clone().iand(this)},i.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},i.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var n=0;n<r.length;n++)this.words[n]=e.words[n]^r.words[n];if(this!==e)for(;n<e.length;n++)this.words[n]=e.words[n];return this.length=e.length,this._strip()},i.prototype.ixor=function(t){return r(0===(this.negative|t.negative)),this.iuxor(t)},i.prototype.xor=function(t){return this.length>t.length?this.clone().ixor(t):t.clone().ixor(this)},i.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},i.prototype.inotn=function(t){r("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),n=t%26;this._expand(e),n>0&&e--;for(var i=0;i<e;i++)this.words[i]=67108863&~this.words[i];return n>0&&(this.words[i]=~this.words[i]&67108863>>26-n),this._strip()},i.prototype.notn=function(t){return this.clone().inotn(t)},i.prototype.setn=function(t,e){r("number"==typeof t&&t>=0);var n=t/26|0,i=t%26;return this._expand(n+1),this.words[n]=e?this.words[n]|1<<i:this.words[n]&~(1<<i),this._strip()},i.prototype.iadd=function(t){var e,r,n;if(0!==this.negative&&0===t.negative)return this.negative=0,e=this.isub(t),this.negative^=1,this._normSign();if(0===this.negative&&0!==t.negative)return t.negative=0,e=this.isub(t),t.negative=1,e._normSign();this.length>t.length?(r=this,n=t):(r=t,n=this);for(var i=0,o=0;o<n.length;o++)e=(0|r.words[o])+(0|n.words[o])+i,this.words[o]=67108863&e,i=e>>>26;for(;0!==i&&o<r.length;o++)e=(0|r.words[o])+i,this.words[o]=67108863&e,i=e>>>26;if(this.length=r.length,0!==i)this.words[this.length]=i,this.length++;else if(r!==this)for(;o<r.length;o++)this.words[o]=r.words[o];return this},i.prototype.add=function(t){var e;return 0!==t.negative&&0===this.negative?(t.negative=0,e=this.sub(t),t.negative^=1,e):0===t.negative&&0!==this.negative?(this.negative=0,e=t.sub(this),this.negative=1,e):this.length>t.length?this.clone().iadd(t):t.clone().iadd(this)},i.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,n,i=this.cmp(t);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(r=this,n=t):(r=t,n=this);for(var o=0,s=0;s<n.length;s++)o=(e=(0|r.words[s])-(0|n.words[s])+o)>>26,this.words[s]=67108863&e;for(;0!==o&&s<r.length;s++)o=(e=(0|r.words[s])+o)>>26,this.words[s]=67108863&e;if(0===o&&s<r.length&&r!==this)for(;s<r.length;s++)this.words[s]=r.words[s];return this.length=Math.max(this.length,s),r!==this&&(this.negative=1),this._strip()},i.prototype.sub=function(t){return this.clone().isub(t)};var m=function(t,e,r){var n,i,o,s=t.words,a=e.words,u=r.words,h=0,c=0|s[0],f=8191&c,l=c>>>13,d=0|s[1],p=8191&d,m=d>>>13,g=0|s[2],y=8191&g,b=g>>>13,v=0|s[3],w=8191&v,_=v>>>13,E=0|s[4],A=8191&E,M=E>>>13,S=0|s[5],k=8191&S,x=S>>>13,T=0|s[6],R=8191&T,B=T>>>13,N=0|s[7],P=8191&N,I=N>>>13,O=0|s[8],C=8191&O,L=O>>>13,j=0|s[9],D=8191&j,U=j>>>13,F=0|a[0],z=8191&F,q=F>>>13,H=0|a[1],K=8191&H,G=H>>>13,V=0|a[2],W=8191&V,J=V>>>13,Z=0|a[3],Y=8191&Z,X=Z>>>13,$=0|a[4],Q=8191&$,tt=$>>>13,et=0|a[5],rt=8191&et,nt=et>>>13,it=0|a[6],ot=8191&it,st=it>>>13,at=0|a[7],ut=8191&at,ht=at>>>13,ct=0|a[8],ft=8191&ct,lt=ct>>>13,dt=0|a[9],pt=8191&dt,mt=dt>>>13;r.negative=t.negative^e.negative,r.length=19;var gt=(h+(n=Math.imul(f,z))|0)+((8191&(i=(i=Math.imul(f,q))+Math.imul(l,z)|0))<<13)|0;h=((o=Math.imul(l,q))+(i>>>13)|0)+(gt>>>26)|0,gt&=67108863,n=Math.imul(p,z),i=(i=Math.imul(p,q))+Math.imul(m,z)|0,o=Math.imul(m,q);var yt=(h+(n=n+Math.imul(f,K)|0)|0)+((8191&(i=(i=i+Math.imul(f,G)|0)+Math.imul(l,K)|0))<<13)|0;h=((o=o+Math.imul(l,G)|0)+(i>>>13)|0)+(yt>>>26)|0,yt&=67108863,n=Math.imul(y,z),i=(i=Math.imul(y,q))+Math.imul(b,z)|0,o=Math.imul(b,q),n=n+Math.imul(p,K)|0,i=(i=i+Math.imul(p,G)|0)+Math.imul(m,K)|0,o=o+Math.imul(m,G)|0;var bt=(h+(n=n+Math.imul(f,W)|0)|0)+((8191&(i=(i=i+Math.imul(f,J)|0)+Math.imul(l,W)|0))<<13)|0;h=((o=o+Math.imul(l,J)|0)+(i>>>13)|0)+(bt>>>26)|0,bt&=67108863,n=Math.imul(w,z),i=(i=Math.imul(w,q))+Math.imul(_,z)|0,o=Math.imul(_,q),n=n+Math.imul(y,K)|0,i=(i=i+Math.imul(y,G)|0)+Math.imul(b,K)|0,o=o+Math.imul(b,G)|0,n=n+Math.imul(p,W)|0,i=(i=i+Math.imul(p,J)|0)+Math.imul(m,W)|0,o=o+Math.imul(m,J)|0;var vt=(h+(n=n+Math.imul(f,Y)|0)|0)+((8191&(i=(i=i+Math.imul(f,X)|0)+Math.imul(l,Y)|0))<<13)|0;h=((o=o+Math.imul(l,X)|0)+(i>>>13)|0)+(vt>>>26)|0,vt&=67108863,n=Math.imul(A,z),i=(i=Math.imul(A,q))+Math.imul(M,z)|0,o=Math.imul(M,q),n=n+Math.imul(w,K)|0,i=(i=i+Math.imul(w,G)|0)+Math.imul(_,K)|0,o=o+Math.imul(_,G)|0,n=n+Math.imul(y,W)|0,i=(i=i+Math.imul(y,J)|0)+Math.imul(b,W)|0,o=o+Math.imul(b,J)|0,n=n+Math.imul(p,Y)|0,i=(i=i+Math.imul(p,X)|0)+Math.imul(m,Y)|0,o=o+Math.imul(m,X)|0;var wt=(h+(n=n+Math.imul(f,Q)|0)|0)+((8191&(i=(i=i+Math.imul(f,tt)|0)+Math.imul(l,Q)|0))<<13)|0;h=((o=o+Math.imul(l,tt)|0)+(i>>>13)|0)+(wt>>>26)|0,wt&=67108863,n=Math.imul(k,z),i=(i=Math.imul(k,q))+Math.imul(x,z)|0,o=Math.imul(x,q),n=n+Math.imul(A,K)|0,i=(i=i+Math.imul(A,G)|0)+Math.imul(M,K)|0,o=o+Math.imul(M,G)|0,n=n+Math.imul(w,W)|0,i=(i=i+Math.imul(w,J)|0)+Math.imul(_,W)|0,o=o+Math.imul(_,J)|0,n=n+Math.imul(y,Y)|0,i=(i=i+Math.imul(y,X)|0)+Math.imul(b,Y)|0,o=o+Math.imul(b,X)|0,n=n+Math.imul(p,Q)|0,i=(i=i+Math.imul(p,tt)|0)+Math.imul(m,Q)|0,o=o+Math.imul(m,tt)|0;var _t=(h+(n=n+Math.imul(f,rt)|0)|0)+((8191&(i=(i=i+Math.imul(f,nt)|0)+Math.imul(l,rt)|0))<<13)|0;h=((o=o+Math.imul(l,nt)|0)+(i>>>13)|0)+(_t>>>26)|0,_t&=67108863,n=Math.imul(R,z),i=(i=Math.imul(R,q))+Math.imul(B,z)|0,o=Math.imul(B,q),n=n+Math.imul(k,K)|0,i=(i=i+Math.imul(k,G)|0)+Math.imul(x,K)|0,o=o+Math.imul(x,G)|0,n=n+Math.imul(A,W)|0,i=(i=i+Math.imul(A,J)|0)+Math.imul(M,W)|0,o=o+Math.imul(M,J)|0,n=n+Math.imul(w,Y)|0,i=(i=i+Math.imul(w,X)|0)+Math.imul(_,Y)|0,o=o+Math.imul(_,X)|0,n=n+Math.imul(y,Q)|0,i=(i=i+Math.imul(y,tt)|0)+Math.imul(b,Q)|0,o=o+Math.imul(b,tt)|0,n=n+Math.imul(p,rt)|0,i=(i=i+Math.imul(p,nt)|0)+Math.imul(m,rt)|0,o=o+Math.imul(m,nt)|0;var Et=(h+(n=n+Math.imul(f,ot)|0)|0)+((8191&(i=(i=i+Math.imul(f,st)|0)+Math.imul(l,ot)|0))<<13)|0;h=((o=o+Math.imul(l,st)|0)+(i>>>13)|0)+(Et>>>26)|0,Et&=67108863,n=Math.imul(P,z),i=(i=Math.imul(P,q))+Math.imul(I,z)|0,o=Math.imul(I,q),n=n+Math.imul(R,K)|0,i=(i=i+Math.imul(R,G)|0)+Math.imul(B,K)|0,o=o+Math.imul(B,G)|0,n=n+Math.imul(k,W)|0,i=(i=i+Math.imul(k,J)|0)+Math.imul(x,W)|0,o=o+Math.imul(x,J)|0,n=n+Math.imul(A,Y)|0,i=(i=i+Math.imul(A,X)|0)+Math.imul(M,Y)|0,o=o+Math.imul(M,X)|0,n=n+Math.imul(w,Q)|0,i=(i=i+Math.imul(w,tt)|0)+Math.imul(_,Q)|0,o=o+Math.imul(_,tt)|0,n=n+Math.imul(y,rt)|0,i=(i=i+Math.imul(y,nt)|0)+Math.imul(b,rt)|0,o=o+Math.imul(b,nt)|0,n=n+Math.imul(p,ot)|0,i=(i=i+Math.imul(p,st)|0)+Math.imul(m,ot)|0,o=o+Math.imul(m,st)|0;var At=(h+(n=n+Math.imul(f,ut)|0)|0)+((8191&(i=(i=i+Math.imul(f,ht)|0)+Math.imul(l,ut)|0))<<13)|0;h=((o=o+Math.imul(l,ht)|0)+(i>>>13)|0)+(At>>>26)|0,At&=67108863,n=Math.imul(C,z),i=(i=Math.imul(C,q))+Math.imul(L,z)|0,o=Math.imul(L,q),n=n+Math.imul(P,K)|0,i=(i=i+Math.imul(P,G)|0)+Math.imul(I,K)|0,o=o+Math.imul(I,G)|0,n=n+Math.imul(R,W)|0,i=(i=i+Math.imul(R,J)|0)+Math.imul(B,W)|0,o=o+Math.imul(B,J)|0,n=n+Math.imul(k,Y)|0,i=(i=i+Math.imul(k,X)|0)+Math.imul(x,Y)|0,o=o+Math.imul(x,X)|0,n=n+Math.imul(A,Q)|0,i=(i=i+Math.imul(A,tt)|0)+Math.imul(M,Q)|0,o=o+Math.imul(M,tt)|0,n=n+Math.imul(w,rt)|0,i=(i=i+Math.imul(w,nt)|0)+Math.imul(_,rt)|0,o=o+Math.imul(_,nt)|0,n=n+Math.imul(y,ot)|0,i=(i=i+Math.imul(y,st)|0)+Math.imul(b,ot)|0,o=o+Math.imul(b,st)|0,n=n+Math.imul(p,ut)|0,i=(i=i+Math.imul(p,ht)|0)+Math.imul(m,ut)|0,o=o+Math.imul(m,ht)|0;var Mt=(h+(n=n+Math.imul(f,ft)|0)|0)+((8191&(i=(i=i+Math.imul(f,lt)|0)+Math.imul(l,ft)|0))<<13)|0;h=((o=o+Math.imul(l,lt)|0)+(i>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,n=Math.imul(D,z),i=(i=Math.imul(D,q))+Math.imul(U,z)|0,o=Math.imul(U,q),n=n+Math.imul(C,K)|0,i=(i=i+Math.imul(C,G)|0)+Math.imul(L,K)|0,o=o+Math.imul(L,G)|0,n=n+Math.imul(P,W)|0,i=(i=i+Math.imul(P,J)|0)+Math.imul(I,W)|0,o=o+Math.imul(I,J)|0,n=n+Math.imul(R,Y)|0,i=(i=i+Math.imul(R,X)|0)+Math.imul(B,Y)|0,o=o+Math.imul(B,X)|0,n=n+Math.imul(k,Q)|0,i=(i=i+Math.imul(k,tt)|0)+Math.imul(x,Q)|0,o=o+Math.imul(x,tt)|0,n=n+Math.imul(A,rt)|0,i=(i=i+Math.imul(A,nt)|0)+Math.imul(M,rt)|0,o=o+Math.imul(M,nt)|0,n=n+Math.imul(w,ot)|0,i=(i=i+Math.imul(w,st)|0)+Math.imul(_,ot)|0,o=o+Math.imul(_,st)|0,n=n+Math.imul(y,ut)|0,i=(i=i+Math.imul(y,ht)|0)+Math.imul(b,ut)|0,o=o+Math.imul(b,ht)|0,n=n+Math.imul(p,ft)|0,i=(i=i+Math.imul(p,lt)|0)+Math.imul(m,ft)|0,o=o+Math.imul(m,lt)|0;var St=(h+(n=n+Math.imul(f,pt)|0)|0)+((8191&(i=(i=i+Math.imul(f,mt)|0)+Math.imul(l,pt)|0))<<13)|0;h=((o=o+Math.imul(l,mt)|0)+(i>>>13)|0)+(St>>>26)|0,St&=67108863,n=Math.imul(D,K),i=(i=Math.imul(D,G))+Math.imul(U,K)|0,o=Math.imul(U,G),n=n+Math.imul(C,W)|0,i=(i=i+Math.imul(C,J)|0)+Math.imul(L,W)|0,o=o+Math.imul(L,J)|0,n=n+Math.imul(P,Y)|0,i=(i=i+Math.imul(P,X)|0)+Math.imul(I,Y)|0,o=o+Math.imul(I,X)|0,n=n+Math.imul(R,Q)|0,i=(i=i+Math.imul(R,tt)|0)+Math.imul(B,Q)|0,o=o+Math.imul(B,tt)|0,n=n+Math.imul(k,rt)|0,i=(i=i+Math.imul(k,nt)|0)+Math.imul(x,rt)|0,o=o+Math.imul(x,nt)|0,n=n+Math.imul(A,ot)|0,i=(i=i+Math.imul(A,st)|0)+Math.imul(M,ot)|0,o=o+Math.imul(M,st)|0,n=n+Math.imul(w,ut)|0,i=(i=i+Math.imul(w,ht)|0)+Math.imul(_,ut)|0,o=o+Math.imul(_,ht)|0,n=n+Math.imul(y,ft)|0,i=(i=i+Math.imul(y,lt)|0)+Math.imul(b,ft)|0,o=o+Math.imul(b,lt)|0;var kt=(h+(n=n+Math.imul(p,pt)|0)|0)+((8191&(i=(i=i+Math.imul(p,mt)|0)+Math.imul(m,pt)|0))<<13)|0;h=((o=o+Math.imul(m,mt)|0)+(i>>>13)|0)+(kt>>>26)|0,kt&=67108863,n=Math.imul(D,W),i=(i=Math.imul(D,J))+Math.imul(U,W)|0,o=Math.imul(U,J),n=n+Math.imul(C,Y)|0,i=(i=i+Math.imul(C,X)|0)+Math.imul(L,Y)|0,o=o+Math.imul(L,X)|0,n=n+Math.imul(P,Q)|0,i=(i=i+Math.imul(P,tt)|0)+Math.imul(I,Q)|0,o=o+Math.imul(I,tt)|0,n=n+Math.imul(R,rt)|0,i=(i=i+Math.imul(R,nt)|0)+Math.imul(B,rt)|0,o=o+Math.imul(B,nt)|0,n=n+Math.imul(k,ot)|0,i=(i=i+Math.imul(k,st)|0)+Math.imul(x,ot)|0,o=o+Math.imul(x,st)|0,n=n+Math.imul(A,ut)|0,i=(i=i+Math.imul(A,ht)|0)+Math.imul(M,ut)|0,o=o+Math.imul(M,ht)|0,n=n+Math.imul(w,ft)|0,i=(i=i+Math.imul(w,lt)|0)+Math.imul(_,ft)|0,o=o+Math.imul(_,lt)|0;var xt=(h+(n=n+Math.imul(y,pt)|0)|0)+((8191&(i=(i=i+Math.imul(y,mt)|0)+Math.imul(b,pt)|0))<<13)|0;h=((o=o+Math.imul(b,mt)|0)+(i>>>13)|0)+(xt>>>26)|0,xt&=67108863,n=Math.imul(D,Y),i=(i=Math.imul(D,X))+Math.imul(U,Y)|0,o=Math.imul(U,X),n=n+Math.imul(C,Q)|0,i=(i=i+Math.imul(C,tt)|0)+Math.imul(L,Q)|0,o=o+Math.imul(L,tt)|0,n=n+Math.imul(P,rt)|0,i=(i=i+Math.imul(P,nt)|0)+Math.imul(I,rt)|0,o=o+Math.imul(I,nt)|0,n=n+Math.imul(R,ot)|0,i=(i=i+Math.imul(R,st)|0)+Math.imul(B,ot)|0,o=o+Math.imul(B,st)|0,n=n+Math.imul(k,ut)|0,i=(i=i+Math.imul(k,ht)|0)+Math.imul(x,ut)|0,o=o+Math.imul(x,ht)|0,n=n+Math.imul(A,ft)|0,i=(i=i+Math.imul(A,lt)|0)+Math.imul(M,ft)|0,o=o+Math.imul(M,lt)|0;var Tt=(h+(n=n+Math.imul(w,pt)|0)|0)+((8191&(i=(i=i+Math.imul(w,mt)|0)+Math.imul(_,pt)|0))<<13)|0;h=((o=o+Math.imul(_,mt)|0)+(i>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,n=Math.imul(D,Q),i=(i=Math.imul(D,tt))+Math.imul(U,Q)|0,o=Math.imul(U,tt),n=n+Math.imul(C,rt)|0,i=(i=i+Math.imul(C,nt)|0)+Math.imul(L,rt)|0,o=o+Math.imul(L,nt)|0,n=n+Math.imul(P,ot)|0,i=(i=i+Math.imul(P,st)|0)+Math.imul(I,ot)|0,o=o+Math.imul(I,st)|0,n=n+Math.imul(R,ut)|0,i=(i=i+Math.imul(R,ht)|0)+Math.imul(B,ut)|0,o=o+Math.imul(B,ht)|0,n=n+Math.imul(k,ft)|0,i=(i=i+Math.imul(k,lt)|0)+Math.imul(x,ft)|0,o=o+Math.imul(x,lt)|0;var Rt=(h+(n=n+Math.imul(A,pt)|0)|0)+((8191&(i=(i=i+Math.imul(A,mt)|0)+Math.imul(M,pt)|0))<<13)|0;h=((o=o+Math.imul(M,mt)|0)+(i>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,n=Math.imul(D,rt),i=(i=Math.imul(D,nt))+Math.imul(U,rt)|0,o=Math.imul(U,nt),n=n+Math.imul(C,ot)|0,i=(i=i+Math.imul(C,st)|0)+Math.imul(L,ot)|0,o=o+Math.imul(L,st)|0,n=n+Math.imul(P,ut)|0,i=(i=i+Math.imul(P,ht)|0)+Math.imul(I,ut)|0,o=o+Math.imul(I,ht)|0,n=n+Math.imul(R,ft)|0,i=(i=i+Math.imul(R,lt)|0)+Math.imul(B,ft)|0,o=o+Math.imul(B,lt)|0;var Bt=(h+(n=n+Math.imul(k,pt)|0)|0)+((8191&(i=(i=i+Math.imul(k,mt)|0)+Math.imul(x,pt)|0))<<13)|0;h=((o=o+Math.imul(x,mt)|0)+(i>>>13)|0)+(Bt>>>26)|0,Bt&=67108863,n=Math.imul(D,ot),i=(i=Math.imul(D,st))+Math.imul(U,ot)|0,o=Math.imul(U,st),n=n+Math.imul(C,ut)|0,i=(i=i+Math.imul(C,ht)|0)+Math.imul(L,ut)|0,o=o+Math.imul(L,ht)|0,n=n+Math.imul(P,ft)|0,i=(i=i+Math.imul(P,lt)|0)+Math.imul(I,ft)|0,o=o+Math.imul(I,lt)|0;var Nt=(h+(n=n+Math.imul(R,pt)|0)|0)+((8191&(i=(i=i+Math.imul(R,mt)|0)+Math.imul(B,pt)|0))<<13)|0;h=((o=o+Math.imul(B,mt)|0)+(i>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,n=Math.imul(D,ut),i=(i=Math.imul(D,ht))+Math.imul(U,ut)|0,o=Math.imul(U,ht),n=n+Math.imul(C,ft)|0,i=(i=i+Math.imul(C,lt)|0)+Math.imul(L,ft)|0,o=o+Math.imul(L,lt)|0;var Pt=(h+(n=n+Math.imul(P,pt)|0)|0)+((8191&(i=(i=i+Math.imul(P,mt)|0)+Math.imul(I,pt)|0))<<13)|0;h=((o=o+Math.imul(I,mt)|0)+(i>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,n=Math.imul(D,ft),i=(i=Math.imul(D,lt))+Math.imul(U,ft)|0,o=Math.imul(U,lt);var It=(h+(n=n+Math.imul(C,pt)|0)|0)+((8191&(i=(i=i+Math.imul(C,mt)|0)+Math.imul(L,pt)|0))<<13)|0;h=((o=o+Math.imul(L,mt)|0)+(i>>>13)|0)+(It>>>26)|0,It&=67108863;var Ot=(h+(n=Math.imul(D,pt))|0)+((8191&(i=(i=Math.imul(D,mt))+Math.imul(U,pt)|0))<<13)|0;return h=((o=Math.imul(U,mt))+(i>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,u[0]=gt,u[1]=yt,u[2]=bt,u[3]=vt,u[4]=wt,u[5]=_t,u[6]=Et,u[7]=At,u[8]=Mt,u[9]=St,u[10]=kt,u[11]=xt,u[12]=Tt,u[13]=Rt,u[14]=Bt,u[15]=Nt,u[16]=Pt,u[17]=It,u[18]=Ot,0!==h&&(u[19]=h,r.length++),r};function g(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var n=0,i=0,o=0;o<r.length-1;o++){var s=i;i=0;for(var a=67108863&n,u=Math.min(o,e.length-1),h=Math.max(0,o-t.length+1);h<=u;h++){var c=o-h,f=(0|t.words[c])*(0|e.words[h]),l=67108863&f;a=67108863&(l=l+a|0),i+=(s=(s=s+(f/67108864|0)|0)+(l>>>26)|0)>>>26,s&=67108863}r.words[o]=a,n=s,s=i}return 0!==n?r.words[o]=n:r.length--,r._strip()}function y(t,e,r){return g(t,e,r)}Math.imul||(m=p),i.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?m(this,t,e):r<63?p(this,t,e):r<1024?g(this,t,e):y(this,t,e)},i.prototype.mul=function(t){var e=new i(null);return e.words=new Array(this.length+t.length),this.mulTo(t,e)},i.prototype.mulf=function(t){var e=new i(null);return e.words=new Array(this.length+t.length),y(this,t,e)},i.prototype.imul=function(t){return this.clone().mulTo(t,this)},i.prototype.imuln=function(t){var e=t<0;e&&(t=-t),r("number"==typeof t),r(t<67108864);for(var n=0,i=0;i<this.length;i++){var o=(0|this.words[i])*t,s=(67108863&o)+(67108863&n);n>>=26,n+=o/67108864|0,n+=s>>>26,this.words[i]=67108863&s}return 0!==n&&(this.words[i]=n,this.length++),this.length=0===t?1:this.length,e?this.ineg():this},i.prototype.muln=function(t){return this.clone().imuln(t)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.imul(this.clone())},i.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r<e.length;r++){var n=r/26|0,i=r%26;e[r]=t.words[n]>>>i&1}return e}(t);if(0===e.length)return new i(1);for(var r=this,n=0;n<e.length&&0===e[n];n++,r=r.sqr());if(++n<e.length)for(var o=r.sqr();n<e.length;n++,o=o.sqr())0!==e[n]&&(r=r.mul(o));return r},i.prototype.iushln=function(t){r("number"==typeof t&&t>=0);var e,n=t%26,i=(t-n)/26,o=67108863>>>26-n<<26-n;if(0!==n){var s=0;for(e=0;e<this.length;e++){var a=this.words[e]&o,u=(0|this.words[e])-a<<n;this.words[e]=u|s,s=a>>>26-n}s&&(this.words[e]=s,this.length++)}if(0!==i){for(e=this.length-1;e>=0;e--)this.words[e+i]=this.words[e];for(e=0;e<i;e++)this.words[e]=0;this.length+=i}return this._strip()},i.prototype.ishln=function(t){return r(0===this.negative),this.iushln(t)},i.prototype.iushrn=function(t,e,n){var i;r("number"==typeof t&&t>=0),i=e?(e-e%26)/26:0;var o=t%26,s=Math.min((t-o)/26,this.length),a=67108863^67108863>>>o<<o,u=n;if(i-=s,i=Math.max(0,i),u){for(var h=0;h<s;h++)u.words[h]=this.words[h];u.length=s}if(0===s);else if(this.length>s)for(this.length-=s,h=0;h<this.length;h++)this.words[h]=this.words[h+s];else this.words[0]=0,this.length=1;var c=0;for(h=this.length-1;h>=0&&(0!==c||h>=i);h--){var f=0|this.words[h];this.words[h]=c<<26-o|f>>>o,c=f&a}return u&&0!==c&&(u.words[u.length++]=c),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},i.prototype.ishrn=function(t,e,n){return r(0===this.negative),this.iushrn(t,e,n)},i.prototype.shln=function(t){return this.clone().ishln(t)},i.prototype.ushln=function(t){return this.clone().iushln(t)},i.prototype.shrn=function(t){return this.clone().ishrn(t)},i.prototype.ushrn=function(t){return this.clone().iushrn(t)},i.prototype.testn=function(t){r("number"==typeof t&&t>=0);var e=t%26,n=(t-e)/26,i=1<<e;return!(this.length<=n)&&!!(this.words[n]&i)},i.prototype.imaskn=function(t){r("number"==typeof t&&t>=0);var e=t%26,n=(t-e)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=n)return this;if(0!==e&&n++,this.length=Math.min(n,this.length),0!==e){var i=67108863^67108863>>>e<<e;this.words[this.length-1]&=i}return this._strip()},i.prototype.maskn=function(t){return this.clone().imaskn(t)},i.prototype.iaddn=function(t){return r("number"==typeof t),r(t<67108864),t<0?this.isubn(-t):0!==this.negative?1===this.length&&(0|this.words[0])<=t?(this.words[0]=t-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(t),this.negative=1,this):this._iaddn(t)},i.prototype._iaddn=function(t){this.words[0]+=t;for(var e=0;e<this.length&&this.words[e]>=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},i.prototype.isubn=function(t){if(r("number"==typeof t),r(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e<this.length&&this.words[e]<0;e++)this.words[e]+=67108864,this.words[e+1]-=1;return this._strip()},i.prototype.addn=function(t){return this.clone().iaddn(t)},i.prototype.subn=function(t){return this.clone().isubn(t)},i.prototype.iabs=function(){return this.negative=0,this},i.prototype.abs=function(){return this.clone().iabs()},i.prototype._ishlnsubmul=function(t,e,n){var i,o,s=t.length+n;this._expand(s);var a=0;for(i=0;i<t.length;i++){o=(0|this.words[i+n])+a;var u=(0|t.words[i])*e;a=((o-=67108863&u)>>26)-(u/67108864|0),this.words[i+n]=67108863&o}for(;i<this.length-n;i++)a=(o=(0|this.words[i+n])+a)>>26,this.words[i+n]=67108863&o;if(0===a)return this._strip();for(r(-1===a),a=0,i=0;i<this.length;i++)a=(o=-(0|this.words[i])+a)>>26,this.words[i]=67108863&o;return this.negative=1,this._strip()},i.prototype._wordDiv=function(t,e){var r=(this.length,t.length),n=this.clone(),o=t,s=0|o.words[o.length-1];0!==(r=26-this._countBits(s))&&(o=o.ushln(r),n.iushln(r),s=0|o.words[o.length-1]);var a,u=n.length-o.length;if("mod"!==e){(a=new i(null)).length=u+1,a.words=new Array(a.length);for(var h=0;h<a.length;h++)a.words[h]=0}var c=n.clone()._ishlnsubmul(o,1,u);0===c.negative&&(n=c,a&&(a.words[u]=1));for(var f=u-1;f>=0;f--){var l=67108864*(0|n.words[o.length+f])+(0|n.words[o.length+f-1]);for(l=Math.min(l/s|0,67108863),n._ishlnsubmul(o,l,f);0!==n.negative;)l--,n.negative=0,n._ishlnsubmul(o,1,f),n.isZero()||(n.negative^=1);a&&(a.words[f]=l)}return a&&a._strip(),n._strip(),"div"!==e&&0!==r&&n.iushrn(r),{div:a||null,mod:n}},i.prototype.divmod=function(t,e,n){return r(!t.isZero()),this.isZero()?{div:new i(0),mod:new i(0)}:0!==this.negative&&0===t.negative?(a=this.neg().divmod(t,e),"mod"!==e&&(o=a.div.neg()),"div"!==e&&(s=a.mod.neg(),n&&0!==s.negative&&s.iadd(t)),{div:o,mod:s}):0===this.negative&&0!==t.negative?(a=this.divmod(t.neg(),e),"mod"!==e&&(o=a.div.neg()),{div:o,mod:a.mod}):0!==(this.negative&t.negative)?(a=this.neg().divmod(t.neg(),e),"div"!==e&&(s=a.mod.neg(),n&&0!==s.negative&&s.isub(t)),{div:a.div,mod:s}):t.length>this.length||this.cmp(t)<0?{div:new i(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new i(this.modrn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new i(this.modrn(t.words[0]))}:this._wordDiv(t,e);var o,s,a},i.prototype.div=function(t){return this.divmod(t,"div",!1).div},i.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},i.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},i.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,n=t.ushrn(1),i=t.andln(1),o=r.cmp(n);return o<0||1===i&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},i.prototype.modrn=function(t){var e=t<0;e&&(t=-t),r(t<=67108863);for(var n=(1<<26)%t,i=0,o=this.length-1;o>=0;o--)i=(n*i+(0|this.words[o]))%t;return e?-i:i},i.prototype.modn=function(t){return this.modrn(t)},i.prototype.idivn=function(t){var e=t<0;e&&(t=-t),r(t<=67108863);for(var n=0,i=this.length-1;i>=0;i--){var o=(0|this.words[i])+67108864*n;this.words[i]=o/t|0,n=o%t}return this._strip(),e?this.ineg():this},i.prototype.divn=function(t){return this.clone().idivn(t)},i.prototype.egcd=function(t){r(0===t.negative),r(!t.isZero());var e=this,n=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var o=new i(1),s=new i(0),a=new i(0),u=new i(1),h=0;e.isEven()&&n.isEven();)e.iushrn(1),n.iushrn(1),++h;for(var c=n.clone(),f=e.clone();!e.isZero();){for(var l=0,d=1;0===(e.words[0]&d)&&l<26;++l,d<<=1);if(l>0)for(e.iushrn(l);l-- >0;)(o.isOdd()||s.isOdd())&&(o.iadd(c),s.isub(f)),o.iushrn(1),s.iushrn(1);for(var p=0,m=1;0===(n.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(n.iushrn(p);p-- >0;)(a.isOdd()||u.isOdd())&&(a.iadd(c),u.isub(f)),a.iushrn(1),u.iushrn(1);e.cmp(n)>=0?(e.isub(n),o.isub(a),s.isub(u)):(n.isub(e),a.isub(o),u.isub(s))}return{a:a,b:u,gcd:n.iushln(h)}},i.prototype._invmp=function(t){r(0===t.negative),r(!t.isZero());var e=this,n=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var o,s=new i(1),a=new i(0),u=n.clone();e.cmpn(1)>0&&n.cmpn(1)>0;){for(var h=0,c=1;0===(e.words[0]&c)&&h<26;++h,c<<=1);if(h>0)for(e.iushrn(h);h-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);for(var f=0,l=1;0===(n.words[0]&l)&&f<26;++f,l<<=1);if(f>0)for(n.iushrn(f);f-- >0;)a.isOdd()&&a.iadd(u),a.iushrn(1);e.cmp(n)>=0?(e.isub(n),s.isub(a)):(n.isub(e),a.isub(s))}return(o=0===e.cmpn(1)?s:a).cmpn(0)<0&&o.iadd(t),o},i.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var n=0;e.isEven()&&r.isEven();n++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var i=e.cmp(r);if(i<0){var o=e;e=r,r=o}else if(0===i||0===r.cmpn(1))break;e.isub(r)}return r.iushln(n)},i.prototype.invm=function(t){return this.egcd(t).a.umod(t)},i.prototype.isEven=function(){return!(1&this.words[0])},i.prototype.isOdd=function(){return!(1&~this.words[0])},i.prototype.andln=function(t){return this.words[0]&t},i.prototype.bincn=function(t){r("number"==typeof t);var e=t%26,n=(t-e)/26,i=1<<e;if(this.length<=n)return this._expand(n+1),this.words[n]|=i,this;for(var o=i,s=n;0!==o&&s<this.length;s++){var a=0|this.words[s];o=(a+=o)>>>26,a&=67108863,this.words[s]=a}return 0!==o&&(this.words[s]=o,this.length++),this},i.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},i.prototype.cmpn=function(t){var e,n=t<0;if(0!==this.negative&&!n)return-1;if(0===this.negative&&n)return 1;if(this._strip(),this.length>1)e=1;else{n&&(t=-t),r(t<=67108863,"Number is too big");var i=0|this.words[0];e=i===t?0:i<t?-1:1}return 0!==this.negative?0|-e:e},i.prototype.cmp=function(t){if(0!==this.negative&&0===t.negative)return-1;if(0===this.negative&&0!==t.negative)return 1;var e=this.ucmp(t);return 0!==this.negative?0|-e:e},i.prototype.ucmp=function(t){if(this.length>t.length)return 1;if(this.length<t.length)return-1;for(var e=0,r=this.length-1;r>=0;r--){var n=0|this.words[r],i=0|t.words[r];if(n!==i){n<i?e=-1:n>i&&(e=1);break}}return e},i.prototype.gtn=function(t){return 1===this.cmpn(t)},i.prototype.gt=function(t){return 1===this.cmp(t)},i.prototype.gten=function(t){return this.cmpn(t)>=0},i.prototype.gte=function(t){return this.cmp(t)>=0},i.prototype.ltn=function(t){return-1===this.cmpn(t)},i.prototype.lt=function(t){return-1===this.cmp(t)},i.prototype.lten=function(t){return this.cmpn(t)<=0},i.prototype.lte=function(t){return this.cmp(t)<=0},i.prototype.eqn=function(t){return 0===this.cmpn(t)},i.prototype.eq=function(t){return 0===this.cmp(t)},i.red=function(t){return new M(t)},i.prototype.toRed=function(t){return r(!this.red,"Already a number in reduction context"),r(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},i.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function(t){return this.red=t,this},i.prototype.forceRed=function(t){return r(!this.red,"Already a number in reduction context"),this._forceRed(t)},i.prototype.redAdd=function(t){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},i.prototype.redIAdd=function(t){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},i.prototype.redSub=function(t){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},i.prototype.redISub=function(t){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},i.prototype.redShl=function(t){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},i.prototype.redMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},i.prototype.redIMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},i.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(t){return r(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var b={k256:null,p224:null,p192:null,p25519:null};function v(t,e){this.name=t,this.p=new i(e,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function w(){v.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function _(){v.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function E(){v.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function A(){v.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function M(t){if("string"==typeof t){var e=i._prime(t);this.m=e.p,this.prime=e}else r(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function S(t){M.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new i(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}v.prototype._tmp=function(){var t=new i(null);return t.words=new Array(Math.ceil(this.n/13)),t},v.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(e>this.n);var n=e<this.n?-1:r.ucmp(this.p);return 0===n?(r.words[0]=0,r.length=1):n>0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},v.prototype.split=function(t,e){t.iushrn(this.n,0,e)},v.prototype.imulK=function(t){return t.imul(this.k)},n(w,v),w.prototype.split=function(t,e){for(var r=4194303,n=Math.min(t.length,9),i=0;i<n;i++)e.words[i]=t.words[i];if(e.length=n,t.length<=9)return t.words[0]=0,void(t.length=1);var o=t.words[9];for(e.words[e.length++]=o&r,i=10;i<t.length;i++){var s=0|t.words[i];t.words[i-10]=(s&r)<<4|o>>>22,o=s}o>>>=22,t.words[i-10]=o,0===o&&t.length>10?t.length-=10:t.length-=9},w.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r<t.length;r++){var n=0|t.words[r];e+=977*n,t.words[r]=67108863&e,e=64*n+(e/67108864|0)}return 0===t.words[t.length-1]&&(t.length--,0===t.words[t.length-1]&&t.length--),t},n(_,v),n(E,v),n(A,v),A.prototype.imulK=function(t){for(var e=0,r=0;r<t.length;r++){var n=19*(0|t.words[r])+e,i=67108863&n;n>>>=26,t.words[r]=i,e=n}return 0!==e&&(t.words[t.length++]=e),t},i._prime=function(t){if(b[t])return b[t];var e;if("k256"===t)e=new w;else if("p224"===t)e=new _;else if("p192"===t)e=new E;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new A}return b[t]=e,e},M.prototype._verify1=function(t){r(0===t.negative,"red works only with positives"),r(t.red,"red works only with red numbers")},M.prototype._verify2=function(t,e){r(0===(t.negative|e.negative),"red works only with positives"),r(t.red&&t.red===e.red,"red works only with red numbers")},M.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):(h(t,t.umod(this.m)._forceRed(this)),t)},M.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},M.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},M.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},M.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},M.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},M.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},M.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},M.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},M.prototype.isqr=function(t){return this.imul(t,t.clone())},M.prototype.sqr=function(t){return this.mul(t,t)},M.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(r(e%2==1),3===e){var n=this.m.add(new i(1)).iushrn(2);return this.pow(t,n)}for(var o=this.m.subn(1),s=0;!o.isZero()&&0===o.andln(1);)s++,o.iushrn(1);r(!o.isZero());var a=new i(1).toRed(this),u=a.redNeg(),h=this.m.subn(1).iushrn(1),c=this.m.bitLength();for(c=new i(2*c*c).toRed(this);0!==this.pow(c,h).cmp(u);)c.redIAdd(u);for(var f=this.pow(c,o),l=this.pow(t,o.addn(1).iushrn(1)),d=this.pow(t,o),p=s;0!==d.cmp(a);){for(var m=d,g=0;0!==m.cmp(a);g++)m=m.redSqr();r(g<p);var y=this.pow(f,new i(1).iushln(p-g-1));l=l.redMul(y),f=y.redSqr(),d=d.redMul(f),p=g}return l},M.prototype.invm=function(t){var e=t._invmp(this.m);return 0!==e.negative?(e.negative=0,this.imod(e).redNeg()):this.imod(e)},M.prototype.pow=function(t,e){if(e.isZero())return new i(1).toRed(this);if(0===e.cmpn(1))return t.clone();var r=new Array(16);r[0]=new i(1).toRed(this),r[1]=t;for(var n=2;n<r.length;n++)r[n]=this.mul(r[n-1],t);var o=r[0],s=0,a=0,u=e.bitLength()%26;for(0===u&&(u=26),n=e.length-1;n>=0;n--){for(var h=e.words[n],c=u-1;c>=0;c--){var f=h>>c&1;o!==r[0]&&(o=this.sqr(o)),0!==f||0!==s?(s<<=1,s|=f,(4===++a||0===n&&0===c)&&(o=this.mul(o,r[s]),a=0,s=0)):a=0}u=26}return o},M.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},M.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},i.mont=function(t){return new S(t)},n(S,M),S.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},S.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},S.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},S.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new i(0)._forceRed(this);var r=t.mul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=r.isub(n).iushrn(this.shift),s=o;return o.cmp(this.m)>=0?s=o.isub(this.m):o.cmpn(0)<0&&(s=o.iadd(this.m)),s._forceRed(this)},S.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t,e)}(EN);var AN,MN=EN.exports,SN={},kN={},xN={};function TN(t){if(Object.keys)return Object.keys(t);var e=[];for(var r in t)e.push(r);return e}function RN(t,e){if(t.forEach)return t.forEach(e);for(var r=0;r<t.length;r++)e(t[r],r,t)}function BN(){try{return Object.defineProperty({},"_",{}),function(t,e,r){Object.defineProperty(t,e,{writable:!0,enumerable:!1,configurable:!0,value:r})}}catch(t){return function(t,e,r){t[e]=r}}}var NN=["Array","Boolean","Date","Error","EvalError","Function","Infinity","JSON","Math","NaN","Number","Object","RangeError","ReferenceError","RegExp","String","SyntaxError","TypeError","URIError","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","eval","isFinite","isNaN","parseFloat","parseInt","undefined","unescape"];function PN(){}function IN(t){if(!(this instanceof IN))return new IN(t);this.code=t}function ON(t){return new IN(t)}function CN(t){if(DN(t))return t;var e=new PN;return"object"==typeof t&&RN(TN(t),function(r){e[r]=t[r]}),e}function LN(t,e,r){return new IN(t).runInContext(e,r)}function jN(t,e){return new IN(t).runInThisContext(e)}function DN(t){return t instanceof PN}function UN(t,e,r){return new IN(t).runInNewContext(e,r)}PN.prototype={},IN.prototype.runInContext=function(t){if(!(t instanceof PN))throw new TypeError("needs a 'context' argument.");if(o.document){var e=o.document.createElement("iframe");e.style||(e.style={}),e.style.display="none",o.document.body.appendChild(e);var r=e.contentWindow,n=r.eval,i=r.execScript;!n&&i&&(i.call(r,"null"),n=r.eval),RN(TN(t),function(e){r[e]=t[e]}),RN(NN,function(e){t[e]&&(r[e]=t[e])});var s=TN(r),a=n.call(r,this.code);return RN(TN(r),function(e){(e in t||-1===function(t,e){if(zN)return t.indexOf(e);for(var r=0;r<t.length;++r)if(t[r]===e)return r;return-1}(s,e))&&(t[e]=r[e])}),RN(NN,function(e){e in t||function(t,e,r){"function"!=typeof AN&&(AN=BN),AN(t,e,r)}(t,e,r[e])}),o.document.body.removeChild(e),a}return function(t,e){var r=TN(o);return r.push("with (this.__ctx__){return eval(this.__code__)}"),Function.apply(null,r).apply({__code__:t,__ctx__:e})}(this.code,t)},IN.prototype.runInThisContext=function(){return new Function("code","return eval(code);").call(o,this.code)},IN.prototype.runInNewContext=function(t){var e=CN(t),r=this.runInContext(e);return t&&RN(TN(e),function(r){t[r]=e[r]}),r};var FN={runInContext:LN,isContext:DN,createContext:CN,createScript:ON,Script:IN,runInThisContext:jN,runInNewContext:UN},zN=[].indexOf;var qN,HN=n(Object.freeze({__proto__:null,Script:IN,createContext:CN,createScript:ON,default:FN,isContext:DN,runInContext:LN,runInNewContext:UN,runInThisContext:jN}));var KN={},GN={},VN=ri;function WN(t){this._reporterState={obj:null,path:[],options:t||{},errors:[]}}function JN(t,e){this.path=t,this.rethrow(e)}GN.Reporter=WN,WN.prototype.isError=function(t){return t instanceof JN},WN.prototype.save=function(){var t=this._reporterState;return{obj:t.obj,pathLen:t.path.length}},WN.prototype.restore=function(t){var e=this._reporterState;e.obj=t.obj,e.path=e.path.slice(0,t.pathLen)},WN.prototype.enterKey=function(t){return this._reporterState.path.push(t)},WN.prototype.exitKey=function(t){var e=this._reporterState;e.path=e.path.slice(0,t-1)},WN.prototype.leaveKey=function(t,e,r){var n=this._reporterState;this.exitKey(t),null!==n.obj&&(n.obj[e]=r)},WN.prototype.path=function(){return this._reporterState.path.join("/")},WN.prototype.enterObject=function(){var t=this._reporterState,e=t.obj;return t.obj={},e},WN.prototype.leaveObject=function(t){var e=this._reporterState,r=e.obj;return e.obj=t,r},WN.prototype.error=function(t){var e,r=this._reporterState,n=t instanceof JN;if(e=n?t:new JN(r.path.map(function(t){return"["+JSON.stringify(t)+"]"}).join(""),t.message||t,t.stack),!r.options.partial)throw e;return n||r.errors.push(e),e},WN.prototype.wrapResult=function(t){var e=this._reporterState;return e.options.partial?{result:this.isError(t)?null:t,errors:e.errors}:t},VN(JN,Error),JN.prototype.rethrow=function(t){if(this.message=t+" at: "+(this.path||"(shallow)"),Error.captureStackTrace&&Error.captureStackTrace(this,JN),!this.stack)try{throw new Error(this.message)}catch(t){this.stack=t.stack}return this};var ZN,YN,XN,$N,QN={};function tP(){if(ZN)return QN;ZN=1;var t=ri,e=eP().Reporter,r=st.Buffer;function n(t,n){e.call(this,n),r.isBuffer(t)?(this.base=t,this.offset=0,this.length=t.length):this.error("Input not Buffer")}function i(t,e){if(Array.isArray(t))this.length=0,this.value=t.map(function(t){return t instanceof i||(t=new i(t,e)),this.length+=t.length,t},this);else if("number"==typeof t){if(!(0<=t&&t<=255))return e.error("non-byte EncoderBuffer value");this.value=t,this.length=1}else if("string"==typeof t)this.value=t,this.length=r.byteLength(t);else{if(!r.isBuffer(t))return e.error("Unsupported type: "+typeof t);this.value=t,this.length=t.length}}return t(n,e),QN.DecoderBuffer=n,n.prototype.save=function(){return{offset:this.offset,reporter:e.prototype.save.call(this)}},n.prototype.restore=function(t){var r=new n(this.base);return r.offset=t.offset,r.length=this.offset,this.offset=t.offset,e.prototype.restore.call(this,t.reporter),r},n.prototype.isEmpty=function(){return this.offset===this.length},n.prototype.readUInt8=function(t){return this.offset+1<=this.length?this.base.readUInt8(this.offset++,!0):this.error(t||"DecoderBuffer overrun")},n.prototype.skip=function(t,e){if(!(this.offset+t<=this.length))return this.error(e||"DecoderBuffer overrun");var r=new n(this.base);return r._reporterState=this._reporterState,r.offset=this.offset,r.length=this.offset+t,this.offset+=t,r},n.prototype.raw=function(t){return this.base.slice(t?t.offset:this.offset,this.length)},QN.EncoderBuffer=i,i.prototype.join=function(t,e){return t||(t=new r(this.length)),e||(e=0),0===this.length||(Array.isArray(this.value)?this.value.forEach(function(r){r.join(t,e),e+=r.length}):("number"==typeof this.value?t[e]=this.value:"string"==typeof this.value?t.write(this.value,e):r.isBuffer(this.value)&&this.value.copy(t,e),e+=this.length)),t},QN}function eP(){return $N||($N=1,function(t){var e=t;e.Reporter=GN.Reporter,e.DecoderBuffer=tP().DecoderBuffer,e.EncoderBuffer=tP().EncoderBuffer,e.Node=function(){if(XN)return YN;XN=1;var t=eP().Reporter,e=eP().EncoderBuffer,r=eP().DecoderBuffer,n=Qn,i=["seq","seqof","set","setof","objid","bool","gentime","utctime","null_","enum","int","objDesc","bitstr","bmpstr","charstr","genstr","graphstr","ia5str","iso646str","numstr","octstr","printstr","t61str","unistr","utf8str","videostr"],o=["key","obj","use","optional","explicit","implicit","def","choice","any","contains"].concat(i);function s(t,e){var r={};this._baseState=r,r.enc=t,r.parent=e||null,r.children=null,r.tag=null,r.args=null,r.reverseArgs=null,r.choice=null,r.optional=!1,r.any=!1,r.obj=!1,r.use=null,r.useDecoder=null,r.key=null,r.default=null,r.explicit=null,r.implicit=null,r.contains=null,r.parent||(r.children=[],this._wrap())}YN=s;var a=["enc","parent","children","tag","args","reverseArgs","choice","optional","any","obj","use","alteredUse","key","default","explicit","implicit","contains"];return s.prototype.clone=function(){var t=this._baseState,e={};a.forEach(function(r){e[r]=t[r]});var r=new this.constructor(e.parent);return r._baseState=e,r},s.prototype._wrap=function(){var t=this._baseState;o.forEach(function(e){this[e]=function(){var r=new this.constructor(this);return t.children.push(r),r[e].apply(r,arguments)}},this)},s.prototype._init=function(t){var e=this._baseState;n(null===e.parent),t.call(this),e.children=e.children.filter(function(t){return t._baseState.parent===this},this)},s.prototype._useArgs=function(t){var e=this._baseState,r=t.filter(function(t){return t instanceof this.constructor},this);t=t.filter(function(t){return!(t instanceof this.constructor)},this),0!==r.length&&(n(null===e.children),e.children=r,r.forEach(function(t){t._baseState.parent=this},this)),0!==t.length&&(n(null===e.args),e.args=t,e.reverseArgs=t.map(function(t){if("object"!=typeof t||t.constructor!==Object)return t;var e={};return Object.keys(t).forEach(function(r){r==(0|r)&&(r|=0);var n=t[r];e[n]=r}),e}))},["_peekTag","_decodeTag","_use","_decodeStr","_decodeObjid","_decodeTime","_decodeNull","_decodeInt","_decodeBool","_decodeList","_encodeComposite","_encodeStr","_encodeObjid","_encodeTime","_encodeNull","_encodeInt","_encodeBool"].forEach(function(t){s.prototype[t]=function(){var e=this._baseState;throw new Error(t+" not implemented for encoding: "+e.enc)}}),i.forEach(function(t){s.prototype[t]=function(){var e=this._baseState,r=Array.prototype.slice.call(arguments);return n(null===e.tag),e.tag=t,this._useArgs(r),this}}),s.prototype.use=function(t){n(t);var e=this._baseState;return n(null===e.use),e.use=t,this},s.prototype.optional=function(){return this._baseState.optional=!0,this},s.prototype.def=function(t){var e=this._baseState;return n(null===e.default),e.default=t,e.optional=!0,this},s.prototype.explicit=function(t){var e=this._baseState;return n(null===e.explicit&&null===e.implicit),e.explicit=t,this},s.prototype.implicit=function(t){var e=this._baseState;return n(null===e.explicit&&null===e.implicit),e.implicit=t,this},s.prototype.obj=function(){var t=this._baseState,e=Array.prototype.slice.call(arguments);return t.obj=!0,0!==e.length&&this._useArgs(e),this},s.prototype.key=function(t){var e=this._baseState;return n(null===e.key),e.key=t,this},s.prototype.any=function(){return this._baseState.any=!0,this},s.prototype.choice=function(t){var e=this._baseState;return n(null===e.choice),e.choice=t,this._useArgs(Object.keys(t).map(function(e){return t[e]})),this},s.prototype.contains=function(t){var e=this._baseState;return n(null===e.use),e.contains=t,this},s.prototype._decode=function(t,e){var n=this._baseState;if(null===n.parent)return t.wrapResult(n.children[0]._decode(t,e));var i,o=n.default,s=!0,a=null;if(null!==n.key&&(a=t.enterKey(n.key)),n.optional){var u=null;if(null!==n.explicit?u=n.explicit:null!==n.implicit?u=n.implicit:null!==n.tag&&(u=n.tag),null!==u||n.any){if(s=this._peekTag(t,u,n.any),t.isError(s))return s}else{var h=t.save();try{null===n.choice?this._decodeGeneric(n.tag,t,e):this._decodeChoice(t,e),s=!0}catch(t){s=!1}t.restore(h)}}if(n.obj&&s&&(i=t.enterObject()),s){if(null!==n.explicit){var c=this._decodeTag(t,n.explicit);if(t.isError(c))return c;t=c}var f=t.offset;if(null===n.use&&null===n.choice){n.any&&(h=t.save());var l=this._decodeTag(t,null!==n.implicit?n.implicit:n.tag,n.any);if(t.isError(l))return l;n.any?o=t.raw(h):t=l}if(e&&e.track&&null!==n.tag&&e.track(t.path(),f,t.length,"tagged"),e&&e.track&&null!==n.tag&&e.track(t.path(),t.offset,t.length,"content"),n.any||(o=null===n.choice?this._decodeGeneric(n.tag,t,e):this._decodeChoice(t,e)),t.isError(o))return o;if(n.any||null!==n.choice||null===n.children||n.children.forEach(function(r){r._decode(t,e)}),n.contains&&("octstr"===n.tag||"bitstr"===n.tag)){var d=new r(o);o=this._getUse(n.contains,t._reporterState.obj)._decode(d,e)}}return n.obj&&s&&(o=t.leaveObject(i)),null===n.key||null===o&&!0!==s?null!==a&&t.exitKey(a):t.leaveKey(a,n.key,o),o},s.prototype._decodeGeneric=function(t,e,r){var n=this._baseState;return"seq"===t||"set"===t?null:"seqof"===t||"setof"===t?this._decodeList(e,t,n.args[0],r):/str$/.test(t)?this._decodeStr(e,t,r):"objid"===t&&n.args?this._decodeObjid(e,n.args[0],n.args[1],r):"objid"===t?this._decodeObjid(e,null,null,r):"gentime"===t||"utctime"===t?this._decodeTime(e,t,r):"null_"===t?this._decodeNull(e,r):"bool"===t?this._decodeBool(e,r):"objDesc"===t?this._decodeStr(e,t,r):"int"===t||"enum"===t?this._decodeInt(e,n.args&&n.args[0],r):null!==n.use?this._getUse(n.use,e._reporterState.obj)._decode(e,r):e.error("unknown tag: "+t)},s.prototype._getUse=function(t,e){var r=this._baseState;return r.useDecoder=this._use(t,e),n(null===r.useDecoder._baseState.parent),r.useDecoder=r.useDecoder._baseState.children[0],r.implicit!==r.useDecoder._baseState.implicit&&(r.useDecoder=r.useDecoder.clone(),r.useDecoder._baseState.implicit=r.implicit),r.useDecoder},s.prototype._decodeChoice=function(t,e){var r=this._baseState,n=null,i=!1;return Object.keys(r.choice).some(function(o){var s=t.save(),a=r.choice[o];try{var u=a._decode(t,e);if(t.isError(u))return!1;n={type:o,value:u},i=!0}catch(e){return t.restore(s),!1}return!0},this),i?n:t.error("Choice not matched")},s.prototype._createEncoderBuffer=function(t){return new e(t,this.reporter)},s.prototype._encode=function(t,e,r){var n=this._baseState;if(null===n.default||n.default!==t){var i=this._encodeValue(t,e,r);if(void 0!==i&&!this._skipDefault(i,e,r))return i}},s.prototype._encodeValue=function(e,r,n){var i=this._baseState;if(null===i.parent)return i.children[0]._encode(e,r||new t);var o=null;if(this.reporter=r,i.optional&&void 0===e){if(null===i.default)return;e=i.default}var s=null,a=!1;if(i.any)o=this._createEncoderBuffer(e);else if(i.choice)o=this._encodeChoice(e,r);else if(i.contains)s=this._getUse(i.contains,n)._encode(e,r),a=!0;else if(i.children)s=i.children.map(function(t){if("null_"===t._baseState.tag)return t._encode(null,r,e);if(null===t._baseState.key)return r.error("Child should have a key");var n=r.enterKey(t._baseState.key);if("object"!=typeof e)return r.error("Child expected, but input is not object");var i=t._encode(e[t._baseState.key],r,e);return r.leaveKey(n),i},this).filter(function(t){return t}),s=this._createEncoderBuffer(s);else if("seqof"===i.tag||"setof"===i.tag){if(!i.args||1!==i.args.length)return r.error("Too many args for : "+i.tag);if(!Array.isArray(e))return r.error("seqof/setof, but data is not Array");var u=this.clone();u._baseState.implicit=null,s=this._createEncoderBuffer(e.map(function(t){var n=this._baseState;return this._getUse(n.args[0],e)._encode(t,r)},u))}else null!==i.use?o=this._getUse(i.use,n)._encode(e,r):(s=this._encodePrimitive(i.tag,e),a=!0);if(!i.any&&null===i.choice){var h=null!==i.implicit?i.implicit:i.tag,c=null===i.implicit?"universal":"context";null===h?null===i.use&&r.error("Tag could be omitted only for .use()"):null===i.use&&(o=this._encodeComposite(h,a,c,s))}return null!==i.explicit&&(o=this._encodeComposite(i.explicit,!1,"context",o)),o},s.prototype._encodeChoice=function(t,e){var r=this._baseState,i=r.choice[t.type];return i||n(!1,t.type+" not found in "+JSON.stringify(Object.keys(r.choice))),i._encode(t.value,e)},s.prototype._encodePrimitive=function(t,e){var r=this._baseState;if(/str$/.test(t))return this._encodeStr(e,t);if("objid"===t&&r.args)return this._encodeObjid(e,r.reverseArgs[0],r.args[1]);if("objid"===t)return this._encodeObjid(e,null,null);if("gentime"===t||"utctime"===t)return this._encodeTime(e,t);if("null_"===t)return this._encodeNull();if("int"===t||"enum"===t)return this._encodeInt(e,r.args&&r.reverseArgs[0]);if("bool"===t)return this._encodeBool(e);if("objDesc"===t)return this._encodeStr(e,t);throw new Error("Unsupported tag: "+t)},s.prototype._isNumstr=function(t){return/^[0-9 ]*$/.test(t)},s.prototype._isPrintstr=function(t){return/^[A-Za-z0-9 '\(\)\+,\-\.\/:=\?]*$/.test(t)},YN}()}(KN)),KN}var rP,nP,iP={},oP={};function sP(){return nP||(nP=1,function(t){var e=t;e._reverse=function(t){var e={};return Object.keys(t).forEach(function(r){(0|r)==r&&(r|=0);var n=t[r];e[n]=r}),e},e.der=(rP||(rP=1,function(t){var e=sP();t.tagClass={0:"universal",1:"application",2:"context",3:"private"},t.tagClassByName=e._reverse(t.tagClass),t.tag={0:"end",1:"bool",2:"int",3:"bitstr",4:"octstr",5:"null_",6:"objid",7:"objDesc",8:"external",9:"real",10:"enum",11:"embed",12:"utf8str",13:"relativeOid",16:"seq",17:"set",18:"numstr",19:"printstr",20:"t61str",21:"videostr",22:"ia5str",23:"utctime",24:"gentime",25:"graphstr",26:"iso646str",27:"genstr",28:"unistr",29:"charstr",30:"bmpstr"},t.tagByName=e._reverse(t.tag)}(oP)),oP)}(iP)),iP}var aP,uP,hP,cP,fP,lP={};function dP(){if(uP)return aP;uP=1;var t=ri,e=MP(),r=e.base,n=e.bignum,i=e.constants.der;function o(t){this.enc="der",this.name=t.name,this.entity=t,this.tree=new s,this.tree._init(t.body)}function s(t){r.Node.call(this,"der",t)}function a(t,e){var r=t.readUInt8(e);if(t.isError(r))return r;var n=i.tagClass[r>>6],o=!(32&r);if(31&~r)r&=31;else{var s=r;for(r=0;!(128&~s);){if(s=t.readUInt8(e),t.isError(s))return s;r<<=7,r|=127&s}}return{cls:n,primitive:o,tag:r,tagStr:i.tag[r]}}function u(t,e,r){var n=t.readUInt8(r);if(t.isError(n))return n;if(!e&&128===n)return null;if(!(128&n))return n;var i=127&n;if(i>4)return t.error("length octect is too long");n=0;for(var o=0;o<i;o++){n<<=8;var s=t.readUInt8(r);if(t.isError(s))return s;n|=s}return n}return aP=o,o.prototype.decode=function(t,e){return t instanceof r.DecoderBuffer||(t=new r.DecoderBuffer(t,e)),this.tree._decode(t,e)},t(s,r.Node),s.prototype._peekTag=function(t,e,r){if(t.isEmpty())return!1;var n=t.save(),i=a(t,'Failed to peek tag: "'+e+'"');return t.isError(i)?i:(t.restore(n),i.tag===e||i.tagStr===e||i.tagStr+"of"===e||r)},s.prototype._decodeTag=function(t,e,r){var n=a(t,'Failed to decode tag of "'+e+'"');if(t.isError(n))return n;var i=u(t,n.primitive,'Failed to get length of "'+e+'"');if(t.isError(i))return i;if(!r&&n.tag!==e&&n.tagStr!==e&&n.tagStr+"of"!==e)return t.error('Failed to match tag: "'+e+'"');if(n.primitive||null!==i)return t.skip(i,'Failed to match body of: "'+e+'"');var o=t.save(),s=this._skipUntilEnd(t,'Failed to skip indefinite length body: "'+this.tag+'"');return t.isError(s)?s:(i=t.offset-o.offset,t.restore(o),t.skip(i,'Failed to match body of: "'+e+'"'))},s.prototype._skipUntilEnd=function(t,e){for(;;){var r=a(t,e);if(t.isError(r))return r;var n,i=u(t,r.primitive,e);if(t.isError(i))return i;if(n=r.primitive||null!==i?t.skip(i):this._skipUntilEnd(t,e),t.isError(n))return n;if("end"===r.tagStr)break}},s.prototype._decodeList=function(t,e,r,n){for(var i=[];!t.isEmpty();){var o=this._peekTag(t,"end");if(t.isError(o))return o;var s=r.decode(t,"der",n);if(t.isError(s)&&o)break;i.push(s)}return i},s.prototype._decodeStr=function(t,e){if("bitstr"===e){var r=t.readUInt8();return t.isError(r)?r:{unused:r,data:t.raw()}}if("bmpstr"===e){var n=t.raw();if(n.length%2==1)return t.error("Decoding of string type: bmpstr length mismatch");for(var i="",o=0;o<n.length/2;o++)i+=String.fromCharCode(n.readUInt16BE(2*o));return i}if("numstr"===e){var s=t.raw().toString("ascii");return this._isNumstr(s)?s:t.error("Decoding of string type: numstr unsupported characters")}if("octstr"===e)return t.raw();if("objDesc"===e)return t.raw();if("printstr"===e){var a=t.raw().toString("ascii");return this._isPrintstr(a)?a:t.error("Decoding of string type: printstr unsupported characters")}return/str$/.test(e)?t.raw().toString():t.error("Decoding of string type: "+e+" unsupported")},s.prototype._decodeObjid=function(t,e,r){for(var n,i=[],o=0;!t.isEmpty();){var s=t.readUInt8();o<<=7,o|=127&s,128&s||(i.push(o),o=0)}128&s&&i.push(o);var a=i[0]/40|0,u=i[0]%40;if(n=r?i:[a,u].concat(i.slice(1)),e){var h=e[n.join(" ")];void 0===h&&(h=e[n.join(".")]),void 0!==h&&(n=h)}return n},s.prototype._decodeTime=function(t,e){var r=t.raw().toString();if("gentime"===e)var n=0|r.slice(0,4),i=0|r.slice(4,6),o=0|r.slice(6,8),s=0|r.slice(8,10),a=0|r.slice(10,12),u=0|r.slice(12,14);else{if("utctime"!==e)return t.error("Decoding "+e+" time is not supported yet");n=0|r.slice(0,2),i=0|r.slice(2,4),o=0|r.slice(4,6),s=0|r.slice(6,8),a=0|r.slice(8,10),u=0|r.slice(10,12);n=n<70?2e3+n:1900+n}return Date.UTC(n,i-1,o,s,a,u,0)},s.prototype._decodeNull=function(t){return null},s.prototype._decodeBool=function(t){var e=t.readUInt8();return t.isError(e)?e:0!==e},s.prototype._decodeInt=function(t,e){var r=t.raw(),i=new n(r);return e&&(i=e[i.toString(10)]||i),i},s.prototype._use=function(t,e){return"function"==typeof t&&(t=t(e)),t._getDecoder("der").tree},aP}function pP(){return fP||(fP=1,function(t){var e=t;e.der=dP(),e.pem=function(){if(cP)return hP;cP=1;var t=ri,e=st.Buffer,r=dP();function n(t){r.call(this,t),this.enc="pem"}return t(n,r),hP=n,n.prototype.decode=function(t,n){for(var i=t.toString().split(/[\r\n]+/g),o=n.label.toUpperCase(),s=/^-----(BEGIN|END) ([^-]+)-----$/,a=-1,u=-1,h=0;h<i.length;h++){var c=i[h].match(s);if(null!==c&&c[2]===o){if(-1!==a){if("END"!==c[1])break;u=h;break}if("BEGIN"!==c[1])break;a=h}}if(-1===a||-1===u)throw new Error("PEM section not found for: "+o);var f=i.slice(a+1,u).join("");f.replace(/[^a-z0-9\+\/=]+/gi,"");var l=new e(f,"base64");return r.prototype.decode.call(this,l,n)},hP}()}(lP)),lP}var mP,gP,yP,bP,vP,wP,_P={};function EP(){if(gP)return mP;gP=1;var t=ri,e=st.Buffer,r=MP(),n=r.base,i=r.constants.der;function o(t){this.enc="der",this.name=t.name,this.entity=t,this.tree=new s,this.tree._init(t.body)}function s(t){n.Node.call(this,"der",t)}function a(t){return t<10?"0"+t:t}return mP=o,o.prototype.encode=function(t,e){return this.tree._encode(t,e).join()},t(s,n.Node),s.prototype._encodeComposite=function(t,r,n,o){var s,a=function(t,e,r,n){var o;"seqof"===t?t="seq":"setof"===t&&(t="set");if(i.tagByName.hasOwnProperty(t))o=i.tagByName[t];else{if("number"!=typeof t||(0|t)!==t)return n.error("Unknown tag: "+t);o=t}if(o>=31)return n.error("Multi-octet tag encoding unsupported");e||(o|=32);return o|=i.tagClassByName[r||"universal"]<<6,o}(t,r,n,this.reporter);if(o.length<128)return(s=new e(2))[0]=a,s[1]=o.length,this._createEncoderBuffer([s,o]);for(var u=1,h=o.length;h>=256;h>>=8)u++;(s=new e(2+u))[0]=a,s[1]=128|u;h=1+u;for(var c=o.length;c>0;h--,c>>=8)s[h]=255&c;return this._createEncoderBuffer([s,o])},s.prototype._encodeStr=function(t,r){if("bitstr"===r)return this._createEncoderBuffer([0|t.unused,t.data]);if("bmpstr"===r){for(var n=new e(2*t.length),i=0;i<t.length;i++)n.writeUInt16BE(t.charCodeAt(i),2*i);return this._createEncoderBuffer(n)}return"numstr"===r?this._isNumstr(t)?this._createEncoderBuffer(t):this.reporter.error("Encoding of string type: numstr supports only digits and space"):"printstr"===r?this._isPrintstr(t)?this._createEncoderBuffer(t):this.reporter.error("Encoding of string type: printstr supports only latin upper and lower case letters, digits, space, apostrophe, left and rigth parenthesis, plus sign, comma, hyphen, dot, slash, colon, equal sign, question mark"):/str$/.test(r)||"objDesc"===r?this._createEncoderBuffer(t):this.reporter.error("Encoding of string type: "+r+" unsupported")},s.prototype._encodeObjid=function(t,r,n){if("string"==typeof t){if(!r)return this.reporter.error("string objid given, but no values map found");if(!r.hasOwnProperty(t))return this.reporter.error("objid not found in values map");t=r[t].split(/[\s\.]+/g);for(var i=0;i<t.length;i++)t[i]|=0}else if(Array.isArray(t)){t=t.slice();for(i=0;i<t.length;i++)t[i]|=0}if(!Array.isArray(t))return this.reporter.error("objid() should be either array or string, got: "+JSON.stringify(t));if(!n){if(t[1]>=40)return this.reporter.error("Second objid identifier OOB");t.splice(0,2,40*t[0]+t[1])}var o=0;for(i=0;i<t.length;i++){var s=t[i];for(o++;s>=128;s>>=7)o++}var a=new e(o),u=a.length-1;for(i=t.length-1;i>=0;i--){s=t[i];for(a[u--]=127&s;(s>>=7)>0;)a[u--]=128|127&s}return this._createEncoderBuffer(a)},s.prototype._encodeTime=function(t,e){var r,n=new Date(t);return"gentime"===e?r=[a(n.getFullYear()),a(n.getUTCMonth()+1),a(n.getUTCDate()),a(n.getUTCHours()),a(n.getUTCMinutes()),a(n.getUTCSeconds()),"Z"].join(""):"utctime"===e?r=[a(n.getFullYear()%100),a(n.getUTCMonth()+1),a(n.getUTCDate()),a(n.getUTCHours()),a(n.getUTCMinutes()),a(n.getUTCSeconds()),"Z"].join(""):this.reporter.error("Encoding "+e+" time is not supported yet"),this._encodeStr(r,"octstr")},s.prototype._encodeNull=function(){return this._createEncoderBuffer("")},s.prototype._encodeInt=function(t,r){if("string"==typeof t){if(!r)return this.reporter.error("String int or enum given, but no values map");if(!r.hasOwnProperty(t))return this.reporter.error("Values map doesn't contain: "+JSON.stringify(t));t=r[t]}if("number"!=typeof t&&!e.isBuffer(t)){var n=t.toArray();!t.sign&&128&n[0]&&n.unshift(0),t=new e(n)}if(e.isBuffer(t)){var i=t.length;0===t.length&&i++;var o=new e(i);return t.copy(o),0===t.length&&(o[0]=0),this._createEncoderBuffer(o)}if(t<128)return this._createEncoderBuffer(t);if(t<256)return this._createEncoderBuffer([0,t]);i=1;for(var s=t;s>=256;s>>=8)i++;for(s=(o=new Array(i)).length-1;s>=0;s--)o[s]=255&t,t>>=8;return 128&o[0]&&o.unshift(0),this._createEncoderBuffer(new e(o))},s.prototype._encodeBool=function(t){return this._createEncoderBuffer(t?255:0)},s.prototype._use=function(t,e){return"function"==typeof t&&(t=t(e)),t._getEncoder("der").tree},s.prototype._skipDefault=function(t,e,r){var n,i=this._baseState;if(null===i.default)return!1;var o=t.join();if(void 0===i.defaultBuffer&&(i.defaultBuffer=this._encodeValue(i.default,e,r).join()),o.length!==i.defaultBuffer.length)return!1;for(n=0;n<o.length;n++)if(o[n]!==i.defaultBuffer[n])return!1;return!0},mP}function AP(){return vP||(vP=1,function(t){var e=t;e.der=EP(),e.pem=function(){if(bP)return yP;bP=1;var t=ri,e=EP();function r(t){e.call(this,t),this.enc="pem"}return t(r,e),yP=r,r.prototype.encode=function(t,r){for(var n=e.prototype.encode.call(this,t).toString("base64"),i=["-----BEGIN "+r.label+"-----"],o=0;o<n.length;o+=64)i.push(n.slice(o,o+64));return i.push("-----END "+r.label+"-----"),i.join("\n")},yP}()}(_P)),_P}function MP(){return wP||(wP=1,function(t){var e=t;e.bignum=pd,e.define=(qN||(qN=1,function(t){var e=MP(),r=ri;function n(t,e){this.name=t,this.body=e,this.decoders={},this.encoders={}}t.define=function(t,e){return new n(t,e)},n.prototype._createNamed=function(t){var e;try{e=HN.runInThisContext("(function "+this.name+"(entity) {\n  this._initNamed(entity);\n})")}catch(t){e=function(t){this._initNamed(t)}}return r(e,t),e.prototype._initNamed=function(e){t.call(this,e)},new e(this)},n.prototype._getDecoder=function(t){return t=t||"der",this.decoders.hasOwnProperty(t)||(this.decoders[t]=this._createNamed(e.decoders[t])),this.decoders[t]},n.prototype.decode=function(t,e,r){return this._getDecoder(e).decode(t,r)},n.prototype._getEncoder=function(t){return t=t||"der",this.encoders.hasOwnProperty(t)||(this.encoders[t]=this._createNamed(e.encoders[t])),this.encoders[t]},n.prototype.encode=function(t,e,r){return this._getEncoder(e).encode(t,r)}}(xN)),xN).define,e.base=eP(),e.constants=sP(),e.decoders=pP(),e.encoders=AP()}(kN)),kN}var SP=MP(),kP=SP.define("Time",function(){this.choice({utcTime:this.utctime(),generalTime:this.gentime()})}),xP=SP.define("AttributeTypeValue",function(){this.seq().obj(this.key("type").objid(),this.key("value").any())}),TP=SP.define("AlgorithmIdentifier",function(){this.seq().obj(this.key("algorithm").objid(),this.key("parameters").optional(),this.key("curve").objid().optional())}),RP=SP.define("SubjectPublicKeyInfo",function(){this.seq().obj(this.key("algorithm").use(TP),this.key("subjectPublicKey").bitstr())}),BP=SP.define("RelativeDistinguishedName",function(){this.setof(xP)}),NP=SP.define("RDNSequence",function(){this.seqof(BP)}),PP=SP.define("Name",function(){this.choice({rdnSequence:this.use(NP)})}),IP=SP.define("Validity",function(){this.seq().obj(this.key("notBefore").use(kP),this.key("notAfter").use(kP))}),OP=SP.define("Extension",function(){this.seq().obj(this.key("extnID").objid(),this.key("critical").bool().def(!1),this.key("extnValue").octstr())}),CP=SP.define("TBSCertificate",function(){this.seq().obj(this.key("version").explicit(0).int().optional(),this.key("serialNumber").int(),this.key("signature").use(TP),this.key("issuer").use(PP),this.key("validity").use(IP),this.key("subject").use(PP),this.key("subjectPublicKeyInfo").use(RP),this.key("issuerUniqueID").implicit(1).bitstr().optional(),this.key("subjectUniqueID").implicit(2).bitstr().optional(),this.key("extensions").explicit(3).seqof(OP).optional())}),LP=SP.define("X509Certificate",function(){this.seq().obj(this.key("tbsCertificate").use(CP),this.key("signatureAlgorithm").use(TP),this.key("signatureValue").bitstr())}),jP=MP();SN.certificate=LP;var DP=jP.define("RSAPrivateKey",function(){this.seq().obj(this.key("version").int(),this.key("modulus").int(),this.key("publicExponent").int(),this.key("privateExponent").int(),this.key("prime1").int(),this.key("prime2").int(),this.key("exponent1").int(),this.key("exponent2").int(),this.key("coefficient").int())});SN.RSAPrivateKey=DP;var UP=jP.define("RSAPublicKey",function(){this.seq().obj(this.key("modulus").int(),this.key("publicExponent").int())});SN.RSAPublicKey=UP;var FP=jP.define("AlgorithmIdentifier",function(){this.seq().obj(this.key("algorithm").objid(),this.key("none").null_().optional(),this.key("curve").objid().optional(),this.key("params").seq().obj(this.key("p").int(),this.key("q").int(),this.key("g").int()).optional())}),zP=jP.define("SubjectPublicKeyInfo",function(){this.seq().obj(this.key("algorithm").use(FP),this.key("subjectPublicKey").bitstr())});SN.PublicKey=zP;var qP=jP.define("PrivateKeyInfo",function(){this.seq().obj(this.key("version").int(),this.key("algorithm").use(FP),this.key("subjectPrivateKey").octstr())});SN.PrivateKey=qP;var HP=jP.define("EncryptedPrivateKeyInfo",function(){this.seq().obj(this.key("algorithm").seq().obj(this.key("id").objid(),this.key("decrypt").seq().obj(this.key("kde").seq().obj(this.key("id").objid(),this.key("kdeparams").seq().obj(this.key("salt").octstr(),this.key("iters").int())),this.key("cipher").seq().obj(this.key("algo").objid(),this.key("iv").octstr()))),this.key("subjectPrivateKey").octstr())});SN.EncryptedPrivateKey=HP;var KP=jP.define("DSAPrivateKey",function(){this.seq().obj(this.key("version").int(),this.key("p").int(),this.key("q").int(),this.key("g").int(),this.key("pub_key").int(),this.key("priv_key").int())});SN.DSAPrivateKey=KP,SN.DSAparam=jP.define("DSAparam",function(){this.int()});var GP=jP.define("ECParameters",function(){this.choice({namedCurve:this.objid()})}),VP=jP.define("ECPrivateKey",function(){this.seq().obj(this.key("version").int(),this.key("privateKey").octstr(),this.key("parameters").optional().explicit(0).use(GP),this.key("publicKey").optional().explicit(1).bitstr())});SN.ECPrivateKey=VP,SN.signature=jP.define("signature",function(){this.seq().obj(this.key("r").int(),this.key("s").int())});var WP=/Proc-Type: 4,ENCRYPTED[\n\r]+DEK-Info: AES-((?:128)|(?:192)|(?:256))-CBC,([0-9A-H]+)[\n\r]+([0-9A-z\n\r+/=]+)[\n\r]+/m,JP=/^-----BEGIN ((?:.*? KEY)|CERTIFICATE)-----/m,ZP=/^-----BEGIN ((?:.*? KEY)|CERTIFICATE)-----([0-9A-z\n\r+/=]+)-----END \1-----$/m,YP=oR,XP=tT,$P=yg.Buffer,QP=SN,tI={"2.16.840.1.101.3.4.1.1":"aes-128-ecb","2.16.840.1.101.3.4.1.2":"aes-128-cbc","2.16.840.1.101.3.4.1.3":"aes-128-ofb","2.16.840.1.101.3.4.1.4":"aes-128-cfb","2.16.840.1.101.3.4.1.21":"aes-192-ecb","2.16.840.1.101.3.4.1.22":"aes-192-cbc","2.16.840.1.101.3.4.1.23":"aes-192-ofb","2.16.840.1.101.3.4.1.24":"aes-192-cfb","2.16.840.1.101.3.4.1.41":"aes-256-ecb","2.16.840.1.101.3.4.1.42":"aes-256-cbc","2.16.840.1.101.3.4.1.43":"aes-256-ofb","2.16.840.1.101.3.4.1.44":"aes-256-cfb"},eI=function(t,e){var r,n=t.toString(),i=n.match(WP);if(i){var o="aes"+i[1],s=$P.from(i[2],"hex"),a=$P.from(i[3].replace(/[\r\n]/g,""),"base64"),u=YP(e,s.slice(0,8),parseInt(i[1],10)).key,h=[],c=XP.createDecipheriv(o,u,s);h.push(c.update(a)),h.push(c.final()),r=$P.concat(h)}else{var f=n.match(ZP);r=$P.from(f[2].replace(/[\r\n]/g,""),"base64")}return{tag:n.match(JP)[1],data:r}},rI=tT,nI=Mk,iI=yg.Buffer;function oI(t){var e;"object"!=typeof t||iI.isBuffer(t)||(e=t.passphrase,t=t.key),"string"==typeof t&&(t=iI.from(t));var r,n,i=eI(t,e),o=i.tag,s=i.data;switch(o){case"CERTIFICATE":n=QP.certificate.decode(s,"der").tbsCertificate.subjectPublicKeyInfo;case"PUBLIC KEY":switch(n||(n=QP.PublicKey.decode(s,"der")),r=n.algorithm.algorithm.join(".")){case"1.2.840.113549.1.1.1":return QP.RSAPublicKey.decode(n.subjectPublicKey.data,"der");case"1.2.840.10045.2.1":return n.subjectPrivateKey=n.subjectPublicKey,{type:"ec",data:n};case"1.2.840.10040.4.1":return n.algorithm.params.pub_key=QP.DSAparam.decode(n.subjectPublicKey.data,"der"),{type:"dsa",data:n.algorithm.params};default:throw new Error("unknown key id "+r)}case"ENCRYPTED PRIVATE KEY":s=function(t,e){var r=t.algorithm.decrypt.kde.kdeparams.salt,n=parseInt(t.algorithm.decrypt.kde.kdeparams.iters.toString(),10),i=tI[t.algorithm.decrypt.cipher.algo.join(".")],o=t.algorithm.decrypt.cipher.iv,s=t.subjectPrivateKey,a=parseInt(i.split("-")[1],10)/8,u=nI.pbkdf2Sync(e,r,n,a,"sha1"),h=rI.createDecipheriv(i,u,o),c=[];return c.push(h.update(s)),c.push(h.final()),iI.concat(c)}(s=QP.EncryptedPrivateKey.decode(s,"der"),e);case"PRIVATE KEY":switch(r=(n=QP.PrivateKey.decode(s,"der")).algorithm.algorithm.join(".")){case"1.2.840.113549.1.1.1":return QP.RSAPrivateKey.decode(n.subjectPrivateKey,"der");case"1.2.840.10045.2.1":return{curve:n.algorithm.curve,privateKey:QP.ECPrivateKey.decode(n.subjectPrivateKey,"der").privateKey};case"1.2.840.10040.4.1":return n.algorithm.params.priv_key=QP.DSAparam.decode(n.subjectPrivateKey,"der"),{type:"dsa",params:n.algorithm.params};default:throw new Error("unknown key id "+r)}case"RSA PUBLIC KEY":return QP.RSAPublicKey.decode(s,"der");case"RSA PRIVATE KEY":return QP.RSAPrivateKey.decode(s,"der");case"DSA PRIVATE KEY":return{type:"dsa",params:QP.DSAPrivateKey.decode(s,"der")};case"EC PRIVATE KEY":return{curve:(s=QP.ECPrivateKey.decode(s,"der")).parameters.value,privateKey:s.privateKey};default:throw new Error("unknown key type "+o)}}oI.signature=QP.signature;var sI=oI,aI={"1.3.132.0.10":"secp256k1","1.3.132.0.33":"p224","1.2.840.10045.3.1.1":"p192","1.2.840.10045.3.1.7":"p256","1.3.132.0.34":"p384","1.3.132.0.35":"p521"},uI=yg.Buffer,hI=_k,cI=_N,fI=cd.ec,lI=MN,dI=sI,pI=aI;function mI(t,e,r,n){if((t=uI.from(t.toArray())).length<e.byteLength()){var i=uI.alloc(e.byteLength()-t.length);t=uI.concat([i,t])}var o=r.length,s=function(t,e){t=gI(t,e),t=t.mod(e);var r=uI.from(t.toArray());if(r.length<e.byteLength()){var n=uI.alloc(e.byteLength()-r.length);r=uI.concat([n,r])}return r}(r,e),a=uI.alloc(o);a.fill(1);var u=uI.alloc(o);return u=hI(n,u).update(a).update(uI.from([0])).update(t).update(s).digest(),a=hI(n,u).update(a).digest(),{k:u=hI(n,u).update(a).update(uI.from([1])).update(t).update(s).digest(),v:a=hI(n,u).update(a).digest()}}function gI(t,e){var r=new lI(t),n=(t.length<<3)-e.bitLength();return n>0&&r.ishrn(n),r}function yI(t,e,r){var n,i;do{for(n=uI.alloc(0);8*n.length<t.bitLength();)e.v=hI(r,e.k).update(e.v).digest(),n=uI.concat([n,e.v]);i=gI(n,t),e.k=hI(r,e.k).update(e.v).update(uI.from([0])).digest(),e.v=hI(r,e.k).update(e.v).digest()}while(-1!==i.cmp(t));return i}function bI(t,e,r,n){return t.toRed(lI.mont(r)).redPow(e).fromRed().mod(n)}pN.exports=function(t,e,r,n,i){var o=dI(e);if(o.curve){if("ecdsa"!==n&&"ecdsa/rsa"!==n)throw new Error("wrong private key type");return function(t,e){var r=pI[e.curve.join(".")];if(!r)throw new Error("unknown curve "+e.curve.join("."));var n=new fI(r),i=n.keyFromPrivate(e.privateKey),o=i.sign(t);return uI.from(o.toDER())}(t,o)}if("dsa"===o.type){if("dsa"!==n)throw new Error("wrong private key type");return function(t,e,r){var n,i=e.params.priv_key,o=e.params.p,s=e.params.q,a=e.params.g,u=new lI(0),h=gI(t,s).mod(s),c=!1,f=mI(i,s,t,r);for(;!1===c;)u=bI(a,n=yI(s,f,r),o,s),0===(c=n.invm(s).imul(h.add(i.mul(u))).mod(s)).cmpn(0)&&(c=!1,u=new lI(0));return function(t,e){t=t.toArray(),e=e.toArray(),128&t[0]&&(t=[0].concat(t));128&e[0]&&(e=[0].concat(e));var r=t.length+e.length+4,n=[48,r,2,t.length];return n=n.concat(t,[2,e.length],e),uI.from(n)}(u,c)}(t,o,r)}if("rsa"!==n&&"ecdsa/rsa"!==n)throw new Error("wrong private key type");if(void 0!==e.padding&&1!==e.padding)throw new Error("illegal or unsupported padding mode");t=uI.concat([i,t]);for(var s=o.modulus.byteLength(),a=[0,1];t.length+a.length+1<s;)a.push(255);a.push(0);for(var u=-1;++u<t.length;)a.push(t[u]);return cI(a,o)},pN.exports.getKey=mI,pN.exports.makeKey=yI;var vI=pN.exports,wI=yg.Buffer,_I=MN,EI=cd.ec,AI=sI,MI=aI;function SI(t,e){if(t.cmpn(0)<=0)throw new Error("invalid sig");if(t.cmp(e)>=0)throw new Error("invalid sig")}var kI=function(t,e,r,n,i){var o=AI(r);if("ec"===o.type){if("ecdsa"!==n&&"ecdsa/rsa"!==n)throw new Error("wrong public key type");return function(t,e,r){var n=MI[r.data.algorithm.curve.join(".")];if(!n)throw new Error("unknown curve "+r.data.algorithm.curve.join("."));var i=new EI(n),o=r.data.subjectPrivateKey.data;return i.verify(e,t,o)}(t,e,o)}if("dsa"===o.type){if("dsa"!==n)throw new Error("wrong public key type");return function(t,e,r){var n=r.data.p,i=r.data.q,o=r.data.g,s=r.data.pub_key,a=AI.signature.decode(t,"der"),u=a.s,h=a.r;SI(u,i),SI(h,i);var c=_I.mont(n),f=u.invm(i),l=o.toRed(c).redPow(new _I(e).mul(f).mod(i)).fromRed().mul(s.toRed(c).redPow(h.mul(f).mod(i)).fromRed()).mod(n).mod(i);return 0===l.cmp(h)}(t,e,o)}if("rsa"!==n&&"ecdsa/rsa"!==n)throw new Error("wrong public key type");e=wI.concat([i,e]);for(var s=o.modulus.byteLength(),a=[1],u=0;e.length+a.length+2<s;)a.push(255),u+=1;a.push(0);for(var h=-1;++h<e.length;)a.push(e[h]);a=wI.from(a);var c=_I.mont(o.modulus);t=(t=new _I(t).toRed(c)).redPow(new _I(o.publicExponent)),t=wI.from(t.fromRed().toArray());var f=u<8?1:0;for(s=Math.min(t.length,a.length),t.length!==a.length&&(f=1),h=-1;++h<s;)f|=t[h]^a[h];return 0===f},xI=yg.Buffer,TI=nk,RI=dN,BI=ri,NI=vI,PI=kI,II=Ek;function OI(t){RI.Writable.call(this);var e=II[t];if(!e)throw new Error("Unknown message digest");this._hashType=e.hash,this._hash=TI(e.hash),this._tag=e.id,this._signType=e.sign}function CI(t){RI.Writable.call(this);var e=II[t];if(!e)throw new Error("Unknown message digest");this._hash=TI(e.hash),this._tag=e.id,this._signType=e.sign}function LI(t){return new OI(t)}function jI(t){return new CI(t)}Object.keys(II).forEach(function(t){II[t].id=xI.from(II[t].id,"hex"),II[t.toLowerCase()]=II[t]}),BI(OI,RI.Writable),OI.prototype._write=function(t,e,r){this._hash.update(t),r()},OI.prototype.update=function(t,e){return this._hash.update("string"==typeof t?xI.from(t,e):t),this},OI.prototype.sign=function(t,e){this.end();var r=this._hash.digest(),n=NI(r,t,this._hashType,this._signType,this._tag);return e?n.toString(e):n},BI(CI,RI.Writable),CI.prototype._write=function(t,e,r){this._hash.update(t),r()},CI.prototype.update=function(t,e){return this._hash.update("string"==typeof t?xI.from(t,e):t),this},CI.prototype.verify=function(t,e,r){var n="string"==typeof e?xI.from(e,r):e;this.end();var i=this._hash.digest();return PI(n,i,t,this._signType,this._tag)};var DI={Sign:LI,Verify:jI,createSign:LI,createVerify:jI},UI=cd,FI=pd,zI={secp256k1:{name:"secp256k1",byteLength:32},secp224r1:{name:"p224",byteLength:28},prime256v1:{name:"p256",byteLength:32},prime192v1:{name:"p192",byteLength:24},ed25519:{name:"ed25519",byteLength:32},secp384r1:{name:"p384",byteLength:48},secp521r1:{name:"p521",byteLength:66}};function qI(t){this.curveType=zI[t],this.curveType||(this.curveType={name:t}),this.curve=new UI.ec(this.curveType.name),this.keys=void 0}function HI(t,e,r){Array.isArray(t)||(t=t.toArray());var n=new _(t);if(r&&n.length<r){var i=new _(r-n.length);i.fill(0),n=_.concat([i,n])}return e?n.toString(e):n}zI.p224=zI.secp224r1,zI.p256=zI.secp256r1=zI.prime256v1,zI.p192=zI.secp192r1=zI.prime192v1,zI.p384=zI.secp384r1,zI.p521=zI.secp521r1,qI.prototype.generateKeys=function(t,e){return this.keys=this.curve.genKeyPair(),this.getPublicKey(t,e)},qI.prototype.computeSecret=function(t,e,r){return e=e||"utf8",_.isBuffer(t)||(t=new _(t,e)),HI(this.curve.keyFromPublic(t).getPublic().mul(this.keys.getPrivate()).getX(),r,this.curveType.byteLength)},qI.prototype.getPublicKey=function(t,e){var r=this.keys.getPublic("compressed"===e,!0);return"hybrid"===e&&(r[r.length-1]%2?r[0]=7:r[0]=6),HI(r,t)},qI.prototype.getPrivateKey=function(t){return HI(this.keys.getPrivate(),t)},qI.prototype.setPublicKey=function(t,e){return e=e||"utf8",_.isBuffer(t)||(t=new _(t,e)),this.keys._importPublic(t),this},qI.prototype.setPrivateKey=function(t,e){e=e||"utf8",_.isBuffer(t)||(t=new _(t,e));var r=new FI(t);return r=r.toString(16),this.keys=this.curve.genKeyPair(),this.keys._importPrivate(r),this};var KI={},GI=nk,VI=yg.Buffer,WI=function(t,e){for(var r,n=VI.alloc(0),i=0;n.length<e;)r=JI(i++),n=VI.concat([n,GI("sha1").update(t).update(r).digest()]);return n.slice(0,e)};function JI(t){var e=VI.allocUnsafe(4);return e.writeUInt32BE(t,0),e}var ZI=function(t,e){for(var r=t.length,n=-1;++n<r;)t[n]^=e[n];return t},YI=pd,XI=yg.Buffer;var $I=function(t,e){return XI.from(t.toRed(YI.mont(e.modulus)).redPow(new YI(e.publicExponent)).fromRed().toArray())},QI=sI,tO=fw,eO=nk,rO=WI,nO=ZI,iO=pd,oO=$I,sO=_N,aO=yg.Buffer,uO=function(t,e,r){var n;n=t.padding?t.padding:r?1:4;var i,o=QI(t);if(4===n)i=function(t,e){var r=t.modulus.byteLength(),n=e.length,i=eO("sha1").update(aO.alloc(0)).digest(),o=i.length,s=2*o;if(n>r-s-2)throw new Error("message too long");var a=aO.alloc(r-n-s-2),u=r-o-1,h=tO(o),c=nO(aO.concat([i,a,aO.alloc(1,1),e],u),rO(h,u)),f=nO(h,rO(c,o));return new iO(aO.concat([aO.alloc(1),f,c],r))}(o,e);else if(1===n)i=function(t,e,r){var n,i=e.length,o=t.modulus.byteLength();if(i>o-11)throw new Error("message too long");n=r?aO.alloc(o-i-3,255):function(t){var e,r=aO.allocUnsafe(t),n=0,i=tO(2*t),o=0;for(;n<t;)o===i.length&&(i=tO(2*t),o=0),(e=i[o++])&&(r[n++]=e);return r}(o-i-3);return new iO(aO.concat([aO.from([0,r?1:2]),n,aO.alloc(1),e],o))}(o,e,r);else{if(3!==n)throw new Error("unknown padding");if((i=new iO(e)).cmp(o.modulus)>=0)throw new Error("data too long for modulus")}return r?sO(i,o):oO(i,o)};var hO=sI,cO=WI,fO=ZI,lO=pd,dO=_N,pO=nk,mO=$I,gO=yg.Buffer,yO=function(t,e,r){var n;n=t.padding?t.padding:r?1:4;var i,o=hO(t),s=o.modulus.byteLength();if(e.length>s||new lO(e).cmp(o.modulus)>=0)throw new Error("decryption error");i=r?mO(new lO(e),o):dO(e,o);var a=gO.alloc(s-i.length);if(i=gO.concat([a,i],s),4===n)return function(t,e){var r=t.modulus.byteLength(),n=pO("sha1").update(gO.alloc(0)).digest(),i=n.length;if(0!==e[0])throw new Error("decryption error");var o=e.slice(1,i+1),s=e.slice(i+1),a=fO(o,cO(s,i)),u=fO(s,cO(a,r-i-1));if(function(t,e){t=gO.from(t),e=gO.from(e);var r=0,n=t.length;t.length!==e.length&&(r++,n=Math.min(t.length,e.length));var i=-1;for(;++i<n;)r+=t[i]^e[i];return r}(n,u.slice(0,i)))throw new Error("decryption error");var h=i;for(;0===u[h];)h++;if(1!==u[h++])throw new Error("decryption error");return u.slice(h)}(o,i);if(1===n)return function(t,e,r){var n=e.slice(0,2),i=2,o=0;for(;0!==e[i++];)if(i>=e.length){o++;break}var s=e.slice(2,i-1);("0002"!==n.toString("hex")&&!r||"0001"!==n.toString("hex")&&r)&&o++;s.length<8&&o++;if(o)throw new Error("decryption error");return e.slice(i)}(0,i,r);if(3===n)return i;throw new Error("unknown padding")};!function(t){t.publicEncrypt=uO,t.privateDecrypt=yO,t.privateEncrypt=function(e,r){return t.publicEncrypt(e,r,!0)},t.publicDecrypt=function(e,r){return t.privateDecrypt(e,r,!0)}}(KI);var bO={};function vO(){throw new Error("secure random number generation not supported by this browser\nuse chrome, FireFox or Internet Explorer 11")}var wO=yg,_O=fw,EO=wO.Buffer,AO=wO.kMaxLength,MO=e.crypto||e.msCrypto,SO=Math.pow(2,32)-1;function kO(t,e){if("number"!=typeof t||t!=t)throw new TypeError("offset must be a number");if(t>SO||t<0)throw new TypeError("offset must be a uint32");if(t>AO||t>e)throw new RangeError("offset out of range")}function xO(t,e,r){if("number"!=typeof t||t!=t)throw new TypeError("size must be a number");if(t>SO||t<0)throw new TypeError("size must be a uint32");if(t+e>r||t>AO)throw new RangeError("buffer too small")}function TO(t,e,r,n){if(vr.browser){var i=t.buffer,o=new Uint8Array(i,e,r);return MO.getRandomValues(o),n?void vr.nextTick(function(){n(null,t)}):t}if(!n)return _O(r).copy(t,e),t;_O(r,function(r,i){if(r)return n(r);i.copy(t,e),n(null,t)})}MO&&MO.getRandomValues||!vr.browser?(bO.randomFill=function(t,r,n,i){if(!(EO.isBuffer(t)||t instanceof e.Uint8Array))throw new TypeError('"buf" argument must be a Buffer or Uint8Array');if("function"==typeof r)i=r,r=0,n=t.length;else if("function"==typeof n)i=n,n=t.length-r;else if("function"!=typeof i)throw new TypeError('"cb" argument must be a function');return kO(r,t.length),xO(n,r,t.length),TO(t,r,n,i)},bO.randomFillSync=function(t,r,n){void 0===r&&(r=0);if(!(EO.isBuffer(t)||t instanceof e.Uint8Array))throw new TypeError('"buf" argument must be a Buffer or Uint8Array');kO(r,t.length),void 0===n&&(n=t.length-r);return xO(n,r,t.length),TO(t,r,n)}):(bO.randomFill=vO,bO.randomFillSync=vO),ow.randomBytes=ow.rng=ow.pseudoRandomBytes=ow.prng=fw,ow.createHash=ow.Hash=nk,ow.createHmac=ow.Hmac=_k;var RO=Ak,BO=Object.keys(RO),NO=["sha1","sha224","sha256","sha384","sha512","md5","rmd160"].concat(BO);ow.getHashes=function(){return NO};var PO=Mk;ow.pbkdf2=PO.pbkdf2,ow.pbkdf2Sync=PO.pbkdf2Sync;var IO=Mx;ow.Cipher=IO.Cipher,ow.createCipher=IO.createCipher,ow.Cipheriv=IO.Cipheriv,ow.createCipheriv=IO.createCipheriv,ow.Decipher=IO.Decipher,ow.createDecipher=IO.createDecipher,ow.Decipheriv=IO.Decipheriv,ow.createDecipheriv=IO.createDecipheriv,ow.getCiphers=IO.getCiphers,ow.listCiphers=IO.listCiphers;var OO=UR;ow.DiffieHellmanGroup=OO.DiffieHellmanGroup,ow.createDiffieHellmanGroup=OO.createDiffieHellmanGroup,ow.getDiffieHellman=OO.getDiffieHellman,ow.createDiffieHellman=OO.createDiffieHellman,ow.DiffieHellman=OO.DiffieHellman;var CO=DI;ow.createSign=CO.createSign,ow.Sign=CO.Sign,ow.createVerify=CO.createVerify,ow.Verify=CO.Verify,ow.createECDH=function(t){return new qI(t)};var LO=KI;ow.publicEncrypt=LO.publicEncrypt,ow.privateEncrypt=LO.privateEncrypt,ow.publicDecrypt=LO.publicDecrypt,ow.privateDecrypt=LO.privateDecrypt;var jO=bO;ow.randomFill=jO.randomFill,ow.randomFillSync=jO.randomFillSync,ow.createCredentials=function(){throw new Error("sorry, createCredentials is not implemented yet\nwe accept pull requests\nhttps://github.com/browserify/crypto-browserify")},ow.constants={DH_CHECK_P_NOT_SAFE_PRIME:2,DH_CHECK_P_NOT_PRIME:1,DH_UNABLE_TO_CHECK_GENERATOR:4,DH_NOT_SUITABLE_GENERATOR:8,NPN_ENABLED:1,ALPN_ENABLED:1,RSA_PKCS1_PADDING:1,RSA_SSLV23_PADDING:2,RSA_NO_PADDING:3,RSA_PKCS1_OAEP_PADDING:4,RSA_X931_PADDING:5,RSA_PKCS1_PSS_PADDING:6,POINT_CONVERSION_COMPRESSED:2,POINT_CONVERSION_UNCOMPRESSED:4,POINT_CONVERSION_HYBRID:6};var DO={},UO={},FO={},zO={exports:{}};!function(t){!function(e){var r,n=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,i=Math.ceil,o=Math.floor,s="[BigNumber Error] ",a=s+"Number primitive has more than 15 significant digits: ",u=1e14,h=14,c=9007199254740991,f=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],l=1e7,d=1e9;function p(t){var e=0|t;return t>0||t===e?e:e-1}function m(t){for(var e,r,n=1,i=t.length,o=t[0]+"";n<i;){for(e=t[n++]+"",r=h-e.length;r--;e="0"+e);o+=e}for(i=o.length;48===o.charCodeAt(--i););return o.slice(0,i+1||1)}function g(t,e){var r,n,i=t.c,o=e.c,s=t.s,a=e.s,u=t.e,h=e.e;if(!s||!a)return null;if(r=i&&!i[0],n=o&&!o[0],r||n)return r?n?0:-a:s;if(s!=a)return s;if(r=s<0,n=u==h,!i||!o)return n?0:!i^r?1:-1;if(!n)return u>h^r?1:-1;for(a=(u=i.length)<(h=o.length)?u:h,s=0;s<a;s++)if(i[s]!=o[s])return i[s]>o[s]^r?1:-1;return u==h?0:u>h^r?1:-1}function y(t,e,r,n){if(t<e||t>r||t!==o(t))throw Error(s+(n||"Argument")+("number"==typeof t?t<e||t>r?" out of range: ":" not an integer: ":" not a primitive number: ")+String(t))}function b(t){var e=t.c.length-1;return p(t.e/h)==e&&t.c[e]%2!=0}function v(t,e){return(t.length>1?t.charAt(0)+"."+t.slice(1):t)+(e<0?"e":"e+")+e}function w(t,e,r){var n,i;if(e<0){for(i=r+".";++e;i+=r);t=i+t}else if(++e>(n=t.length)){for(i=r,e-=n;--e;i+=r);t+=i}else e<n&&(t=t.slice(0,e)+"."+t.slice(e));return t}r=function t(e){var r,_,E,A,M,S,k,x,T,R,B=K.prototype={constructor:K,toString:null,valueOf:null},N=new K(1),P=20,I=4,O=-7,C=21,L=-1e7,j=1e7,D=!1,U=1,F=0,z={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},q="0123456789abcdefghijklmnopqrstuvwxyz",H=!0;function K(t,e){var r,i,s,u,f,l,d,p,m=this;if(!(m instanceof K))return new K(t,e);if(null==e){if(t&&!0===t._isBigNumber)return m.s=t.s,void(!t.c||t.e>j?m.c=m.e=null:t.e<L?m.c=[m.e=0]:(m.e=t.e,m.c=t.c.slice()));if((l="number"==typeof t)&&0*t==0){if(m.s=1/t<0?(t=-t,-1):1,t===~~t){for(u=0,f=t;f>=10;f/=10,u++);return void(u>j?m.c=m.e=null:(m.e=u,m.c=[t]))}p=String(t)}else{if(!n.test(p=String(t)))return E(m,p,l);m.s=45==p.charCodeAt(0)?(p=p.slice(1),-1):1}(u=p.indexOf("."))>-1&&(p=p.replace(".","")),(f=p.search(/e/i))>0?(u<0&&(u=f),u+=+p.slice(f+1),p=p.substring(0,f)):u<0&&(u=p.length)}else{if(y(e,2,q.length,"Base"),10==e&&H)return J(m=new K(t),P+m.e+1,I);if(p=String(t),l="number"==typeof t){if(0*t!=0)return E(m,p,l,e);if(m.s=1/t<0?(p=p.slice(1),-1):1,K.DEBUG&&p.replace(/^0\.0*|\./,"").length>15)throw Error(a+t)}else m.s=45===p.charCodeAt(0)?(p=p.slice(1),-1):1;for(r=q.slice(0,e),u=f=0,d=p.length;f<d;f++)if(r.indexOf(i=p.charAt(f))<0){if("."==i){if(f>u){u=d;continue}}else if(!s&&(p==p.toUpperCase()&&(p=p.toLowerCase())||p==p.toLowerCase()&&(p=p.toUpperCase()))){s=!0,f=-1,u=0;continue}return E(m,String(t),l,e)}l=!1,(u=(p=_(p,e,10,m.s)).indexOf("."))>-1?p=p.replace(".",""):u=p.length}for(f=0;48===p.charCodeAt(f);f++);for(d=p.length;48===p.charCodeAt(--d););if(p=p.slice(f,++d)){if(d-=f,l&&K.DEBUG&&d>15&&(t>c||t!==o(t)))throw Error(a+m.s*t);if((u=u-f-1)>j)m.c=m.e=null;else if(u<L)m.c=[m.e=0];else{if(m.e=u,m.c=[],f=(u+1)%h,u<0&&(f+=h),f<d){for(f&&m.c.push(+p.slice(0,f)),d-=h;f<d;)m.c.push(+p.slice(f,f+=h));f=h-(p=p.slice(f)).length}else f-=d;for(;f--;p+="0");m.c.push(+p)}}else m.c=[m.e=0]}function G(t,e,r,n){var i,o,s,a,u;if(null==r?r=I:y(r,0,8),!t.c)return t.toString();if(i=t.c[0],s=t.e,null==e)u=m(t.c),u=1==n||2==n&&(s<=O||s>=C)?v(u,s):w(u,s,"0");else if(o=(t=J(new K(t),e,r)).e,a=(u=m(t.c)).length,1==n||2==n&&(e<=o||o<=O)){for(;a<e;u+="0",a++);u=v(u,o)}else if(e-=s+(2===n&&o>s),u=w(u,o,"0"),o+1>a){if(--e>0)for(u+=".";e--;u+="0");}else if((e+=o-a)>0)for(o+1==a&&(u+=".");e--;u+="0");return t.s<0&&i?"-"+u:u}function V(t,e){for(var r,n,i=1,o=new K(t[0]);i<t.length;i++)(!(n=new K(t[i])).s||(r=g(o,n))===e||0===r&&o.s===e)&&(o=n);return o}function W(t,e,r){for(var n=1,i=e.length;!e[--i];e.pop());for(i=e[0];i>=10;i/=10,n++);return(r=n+r*h-1)>j?t.c=t.e=null:r<L?t.c=[t.e=0]:(t.e=r,t.c=e),t}function J(t,e,r,n){var s,a,c,l,d,p,m,g=t.c,y=f;if(g){t:{for(s=1,l=g[0];l>=10;l/=10,s++);if((a=e-s)<0)a+=h,c=e,d=g[p=0],m=o(d/y[s-c-1]%10);else if((p=i((a+1)/h))>=g.length){if(!n)break t;for(;g.length<=p;g.push(0));d=m=0,s=1,c=(a%=h)-h+1}else{for(d=l=g[p],s=1;l>=10;l/=10,s++);m=(c=(a%=h)-h+s)<0?0:o(d/y[s-c-1]%10)}if(n=n||e<0||null!=g[p+1]||(c<0?d:d%y[s-c-1]),n=r<4?(m||n)&&(0==r||r==(t.s<0?3:2)):m>5||5==m&&(4==r||n||6==r&&(a>0?c>0?d/y[s-c]:0:g[p-1])%10&1||r==(t.s<0?8:7)),e<1||!g[0])return g.length=0,n?(e-=t.e+1,g[0]=y[(h-e%h)%h],t.e=-e||0):g[0]=t.e=0,t;if(0==a?(g.length=p,l=1,p--):(g.length=p+1,l=y[h-a],g[p]=c>0?o(d/y[s-c]%y[c])*l:0),n)for(;;){if(0==p){for(a=1,c=g[0];c>=10;c/=10,a++);for(c=g[0]+=l,l=1;c>=10;c/=10,l++);a!=l&&(t.e++,g[0]==u&&(g[0]=1));break}if(g[p]+=l,g[p]!=u)break;g[p--]=0,l=1}for(a=g.length;0===g[--a];g.pop());}t.e>j?t.c=t.e=null:t.e<L&&(t.c=[t.e=0])}return t}function Z(t){var e,r=t.e;return null===r?t.toString():(e=m(t.c),e=r<=O||r>=C?v(e,r):w(e,r,"0"),t.s<0?"-"+e:e)}return K.clone=t,K.ROUND_UP=0,K.ROUND_DOWN=1,K.ROUND_CEIL=2,K.ROUND_FLOOR=3,K.ROUND_HALF_UP=4,K.ROUND_HALF_DOWN=5,K.ROUND_HALF_EVEN=6,K.ROUND_HALF_CEIL=7,K.ROUND_HALF_FLOOR=8,K.EUCLID=9,K.config=K.set=function(t){var e,r;if(null!=t){if("object"!=typeof t)throw Error(s+"Object expected: "+t);if(t.hasOwnProperty(e="DECIMAL_PLACES")&&(y(r=t[e],0,d,e),P=r),t.hasOwnProperty(e="ROUNDING_MODE")&&(y(r=t[e],0,8,e),I=r),t.hasOwnProperty(e="EXPONENTIAL_AT")&&((r=t[e])&&r.pop?(y(r[0],-d,0,e),y(r[1],0,d,e),O=r[0],C=r[1]):(y(r,-d,d,e),O=-(C=r<0?-r:r))),t.hasOwnProperty(e="RANGE"))if((r=t[e])&&r.pop)y(r[0],-d,-1,e),y(r[1],1,d,e),L=r[0],j=r[1];else{if(y(r,-d,d,e),!r)throw Error(s+e+" cannot be zero: "+r);L=-(j=r<0?-r:r)}if(t.hasOwnProperty(e="CRYPTO")){if((r=t[e])!==!!r)throw Error(s+e+" not true or false: "+r);if(r){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw D=!r,Error(s+"crypto unavailable");D=r}else D=r}if(t.hasOwnProperty(e="MODULO_MODE")&&(y(r=t[e],0,9,e),U=r),t.hasOwnProperty(e="POW_PRECISION")&&(y(r=t[e],0,d,e),F=r),t.hasOwnProperty(e="FORMAT")){if("object"!=typeof(r=t[e]))throw Error(s+e+" not an object: "+r);z=r}if(t.hasOwnProperty(e="ALPHABET")){if("string"!=typeof(r=t[e])||/^.?$|[+\-.\s]|(.).*\1/.test(r))throw Error(s+e+" invalid: "+r);H="0123456789"==r.slice(0,10),q=r}}return{DECIMAL_PLACES:P,ROUNDING_MODE:I,EXPONENTIAL_AT:[O,C],RANGE:[L,j],CRYPTO:D,MODULO_MODE:U,POW_PRECISION:F,FORMAT:z,ALPHABET:q}},K.isBigNumber=function(t){if(!t||!0!==t._isBigNumber)return!1;if(!K.DEBUG)return!0;var e,r,n=t.c,i=t.e,a=t.s;t:if("[object Array]"=={}.toString.call(n)){if((1===a||-1===a)&&i>=-d&&i<=d&&i===o(i)){if(0===n[0]){if(0===i&&1===n.length)return!0;break t}if((e=(i+1)%h)<1&&(e+=h),String(n[0]).length==e){for(e=0;e<n.length;e++)if((r=n[e])<0||r>=u||r!==o(r))break t;if(0!==r)return!0}}}else if(null===n&&null===i&&(null===a||1===a||-1===a))return!0;throw Error(s+"Invalid BigNumber: "+t)},K.maximum=K.max=function(){return V(arguments,-1)},K.minimum=K.min=function(){return V(arguments,1)},K.random=(A=9007199254740992,M=Math.random()*A&2097151?function(){return o(Math.random()*A)}:function(){return 8388608*(1073741824*Math.random()|0)+(8388608*Math.random()|0)},function(t){var e,r,n,a,u,c=0,l=[],p=new K(N);if(null==t?t=P:y(t,0,d),a=i(t/h),D)if(crypto.getRandomValues){for(e=crypto.getRandomValues(new Uint32Array(a*=2));c<a;)(u=131072*e[c]+(e[c+1]>>>11))>=9e15?(r=crypto.getRandomValues(new Uint32Array(2)),e[c]=r[0],e[c+1]=r[1]):(l.push(u%1e14),c+=2);c=a/2}else{if(!crypto.randomBytes)throw D=!1,Error(s+"crypto unavailable");for(e=crypto.randomBytes(a*=7);c<a;)(u=281474976710656*(31&e[c])+1099511627776*e[c+1]+4294967296*e[c+2]+16777216*e[c+3]+(e[c+4]<<16)+(e[c+5]<<8)+e[c+6])>=9e15?crypto.randomBytes(7).copy(e,c):(l.push(u%1e14),c+=7);c=a/7}if(!D)for(;c<a;)(u=M())<9e15&&(l[c++]=u%1e14);for(a=l[--c],t%=h,a&&t&&(u=f[h-t],l[c]=o(a/u)*u);0===l[c];l.pop(),c--);if(c<0)l=[n=0];else{for(n=-1;0===l[0];l.splice(0,1),n-=h);for(c=1,u=l[0];u>=10;u/=10,c++);c<h&&(n-=h-c)}return p.e=n,p.c=l,p}),K.sum=function(){for(var t=1,e=arguments,r=new K(e[0]);t<e.length;)r=r.plus(e[t++]);return r},_=function(){var t="0123456789";function e(t,e,r,n){for(var i,o,s=[0],a=0,u=t.length;a<u;){for(o=s.length;o--;s[o]*=e);for(s[0]+=n.indexOf(t.charAt(a++)),i=0;i<s.length;i++)s[i]>r-1&&(null==s[i+1]&&(s[i+1]=0),s[i+1]+=s[i]/r|0,s[i]%=r)}return s.reverse()}return function(n,i,o,s,a){var u,h,c,f,l,d,p,g,y=n.indexOf("."),b=P,v=I;for(y>=0&&(f=F,F=0,n=n.replace(".",""),d=(g=new K(i)).pow(n.length-y),F=f,g.c=e(w(m(d.c),d.e,"0"),10,o,t),g.e=g.c.length),c=f=(p=e(n,i,o,a?(u=q,t):(u=t,q))).length;0==p[--f];p.pop());if(!p[0])return u.charAt(0);if(y<0?--c:(d.c=p,d.e=c,d.s=s,p=(d=r(d,g,b,v,o)).c,l=d.r,c=d.e),y=p[h=c+b+1],f=o/2,l=l||h<0||null!=p[h+1],l=v<4?(null!=y||l)&&(0==v||v==(d.s<0?3:2)):y>f||y==f&&(4==v||l||6==v&&1&p[h-1]||v==(d.s<0?8:7)),h<1||!p[0])n=l?w(u.charAt(1),-b,u.charAt(0)):u.charAt(0);else{if(p.length=h,l)for(--o;++p[--h]>o;)p[h]=0,h||(++c,p=[1].concat(p));for(f=p.length;!p[--f];);for(y=0,n="";y<=f;n+=u.charAt(p[y++]));n=w(n,c,u.charAt(0))}return n}}(),r=function(){function t(t,e,r){var n,i,o,s,a=0,u=t.length,h=e%l,c=e/l|0;for(t=t.slice();u--;)a=((i=h*(o=t[u]%l)+(n=c*o+(s=t[u]/l|0)*h)%l*l+a)/r|0)+(n/l|0)+c*s,t[u]=i%r;return a&&(t=[a].concat(t)),t}function e(t,e,r,n){var i,o;if(r!=n)o=r>n?1:-1;else for(i=o=0;i<r;i++)if(t[i]!=e[i]){o=t[i]>e[i]?1:-1;break}return o}function r(t,e,r,n){for(var i=0;r--;)t[r]-=i,i=t[r]<e[r]?1:0,t[r]=i*n+t[r]-e[r];for(;!t[0]&&t.length>1;t.splice(0,1));}return function(n,i,s,a,c){var f,l,d,m,g,y,b,v,w,_,E,A,M,S,k,x,T,R=n.s==i.s?1:-1,B=n.c,N=i.c;if(!(B&&B[0]&&N&&N[0]))return new K(n.s&&i.s&&(B?!N||B[0]!=N[0]:N)?B&&0==B[0]||!N?0*R:R/0:NaN);for(w=(v=new K(R)).c=[],R=s+(l=n.e-i.e)+1,c||(c=u,l=p(n.e/h)-p(i.e/h),R=R/h|0),d=0;N[d]==(B[d]||0);d++);if(N[d]>(B[d]||0)&&l--,R<0)w.push(1),m=!0;else{for(S=B.length,x=N.length,d=0,R+=2,(g=o(c/(N[0]+1)))>1&&(N=t(N,g,c),B=t(B,g,c),x=N.length,S=B.length),M=x,E=(_=B.slice(0,x)).length;E<x;_[E++]=0);T=N.slice(),T=[0].concat(T),k=N[0],N[1]>=c/2&&k++;do{if(g=0,(f=e(N,_,x,E))<0){if(A=_[0],x!=E&&(A=A*c+(_[1]||0)),(g=o(A/k))>1)for(g>=c&&(g=c-1),b=(y=t(N,g,c)).length,E=_.length;1==e(y,_,b,E);)g--,r(y,x<b?T:N,b,c),b=y.length,f=1;else 0==g&&(f=g=1),b=(y=N.slice()).length;if(b<E&&(y=[0].concat(y)),r(_,y,E,c),E=_.length,-1==f)for(;e(N,_,x,E)<1;)g++,r(_,x<E?T:N,E,c),E=_.length}else 0===f&&(g++,_=[0]);w[d++]=g,_[0]?_[E++]=B[M]||0:(_=[B[M]],E=1)}while((M++<S||null!=_[0])&&R--);m=null!=_[0],w[0]||w.splice(0,1)}if(c==u){for(d=1,R=w[0];R>=10;R/=10,d++);J(v,s+(v.e=d+l*h-1)+1,a,m)}else v.e=l,v.r=+m;return v}}(),S=/^(-?)0([xbo])(?=\w[\w.]*$)/i,k=/^([^.]+)\.$/,x=/^\.([^.]+)$/,T=/^-?(Infinity|NaN)$/,R=/^\s*\+(?=[\w.])|^\s+|\s+$/g,E=function(t,e,r,n){var i,o=r?e:e.replace(R,"");if(T.test(o))t.s=isNaN(o)?null:o<0?-1:1;else{if(!r&&(o=o.replace(S,function(t,e,r){return i="x"==(r=r.toLowerCase())?16:"b"==r?2:8,n&&n!=i?t:e}),n&&(i=n,o=o.replace(k,"$1").replace(x,"0.$1")),e!=o))return new K(o,i);if(K.DEBUG)throw Error(s+"Not a"+(n?" base "+n:"")+" number: "+e);t.s=null}t.c=t.e=null},B.absoluteValue=B.abs=function(){var t=new K(this);return t.s<0&&(t.s=1),t},B.comparedTo=function(t,e){return g(this,new K(t,e))},B.decimalPlaces=B.dp=function(t,e){var r,n,i,o=this;if(null!=t)return y(t,0,d),null==e?e=I:y(e,0,8),J(new K(o),t+o.e+1,e);if(!(r=o.c))return null;if(n=((i=r.length-1)-p(this.e/h))*h,i=r[i])for(;i%10==0;i/=10,n--);return n<0&&(n=0),n},B.dividedBy=B.div=function(t,e){return r(this,new K(t,e),P,I)},B.dividedToIntegerBy=B.idiv=function(t,e){return r(this,new K(t,e),0,1)},B.exponentiatedBy=B.pow=function(t,e){var r,n,a,u,c,f,l,d,p=this;if((t=new K(t)).c&&!t.isInteger())throw Error(s+"Exponent not an integer: "+Z(t));if(null!=e&&(e=new K(e)),c=t.e>14,!p.c||!p.c[0]||1==p.c[0]&&!p.e&&1==p.c.length||!t.c||!t.c[0])return d=new K(Math.pow(+Z(p),c?t.s*(2-b(t)):+Z(t))),e?d.mod(e):d;if(f=t.s<0,e){if(e.c?!e.c[0]:!e.s)return new K(NaN);(n=!f&&p.isInteger()&&e.isInteger())&&(p=p.mod(e))}else{if(t.e>9&&(p.e>0||p.e<-1||(0==p.e?p.c[0]>1||c&&p.c[1]>=24e7:p.c[0]<8e13||c&&p.c[0]<=9999975e7)))return u=p.s<0&&b(t)?-0:0,p.e>-1&&(u=1/u),new K(f?1/u:u);F&&(u=i(F/h+2))}for(c?(r=new K(.5),f&&(t.s=1),l=b(t)):l=(a=Math.abs(+Z(t)))%2,d=new K(N);;){if(l){if(!(d=d.times(p)).c)break;u?d.c.length>u&&(d.c.length=u):n&&(d=d.mod(e))}if(a){if(0===(a=o(a/2)))break;l=a%2}else if(J(t=t.times(r),t.e+1,1),t.e>14)l=b(t);else{if(0===(a=+Z(t)))break;l=a%2}p=p.times(p),u?p.c&&p.c.length>u&&(p.c.length=u):n&&(p=p.mod(e))}return n?d:(f&&(d=N.div(d)),e?d.mod(e):u?J(d,F,I,undefined):d)},B.integerValue=function(t){var e=new K(this);return null==t?t=I:y(t,0,8),J(e,e.e+1,t)},B.isEqualTo=B.eq=function(t,e){return 0===g(this,new K(t,e))},B.isFinite=function(){return!!this.c},B.isGreaterThan=B.gt=function(t,e){return g(this,new K(t,e))>0},B.isGreaterThanOrEqualTo=B.gte=function(t,e){return 1===(e=g(this,new K(t,e)))||0===e},B.isInteger=function(){return!!this.c&&p(this.e/h)>this.c.length-2},B.isLessThan=B.lt=function(t,e){return g(this,new K(t,e))<0},B.isLessThanOrEqualTo=B.lte=function(t,e){return-1===(e=g(this,new K(t,e)))||0===e},B.isNaN=function(){return!this.s},B.isNegative=function(){return this.s<0},B.isPositive=function(){return this.s>0},B.isZero=function(){return!!this.c&&0==this.c[0]},B.minus=function(t,e){var r,n,i,o,s=this,a=s.s;if(e=(t=new K(t,e)).s,!a||!e)return new K(NaN);if(a!=e)return t.s=-e,s.plus(t);var c=s.e/h,f=t.e/h,l=s.c,d=t.c;if(!c||!f){if(!l||!d)return l?(t.s=-e,t):new K(d?s:NaN);if(!l[0]||!d[0])return d[0]?(t.s=-e,t):new K(l[0]?s:3==I?-0:0)}if(c=p(c),f=p(f),l=l.slice(),a=c-f){for((o=a<0)?(a=-a,i=l):(f=c,i=d),i.reverse(),e=a;e--;i.push(0));i.reverse()}else for(n=(o=(a=l.length)<(e=d.length))?a:e,a=e=0;e<n;e++)if(l[e]!=d[e]){o=l[e]<d[e];break}if(o&&(i=l,l=d,d=i,t.s=-t.s),(e=(n=d.length)-(r=l.length))>0)for(;e--;l[r++]=0);for(e=u-1;n>a;){if(l[--n]<d[n]){for(r=n;r&&!l[--r];l[r]=e);--l[r],l[n]+=u}l[n]-=d[n]}for(;0==l[0];l.splice(0,1),--f);return l[0]?W(t,l,f):(t.s=3==I?-1:1,t.c=[t.e=0],t)},B.modulo=B.mod=function(t,e){var n,i,o=this;return t=new K(t,e),!o.c||!t.s||t.c&&!t.c[0]?new K(NaN):!t.c||o.c&&!o.c[0]?new K(o):(9==U?(i=t.s,t.s=1,n=r(o,t,0,3),t.s=i,n.s*=i):n=r(o,t,0,U),(t=o.minus(n.times(t))).c[0]||1!=U||(t.s=o.s),t)},B.multipliedBy=B.times=function(t,e){var r,n,i,o,s,a,c,f,d,m,g,y,b,v,w,_=this,E=_.c,A=(t=new K(t,e)).c;if(!(E&&A&&E[0]&&A[0]))return!_.s||!t.s||E&&!E[0]&&!A||A&&!A[0]&&!E?t.c=t.e=t.s=null:(t.s*=_.s,E&&A?(t.c=[0],t.e=0):t.c=t.e=null),t;for(n=p(_.e/h)+p(t.e/h),t.s*=_.s,(c=E.length)<(m=A.length)&&(b=E,E=A,A=b,i=c,c=m,m=i),i=c+m,b=[];i--;b.push(0));for(v=u,w=l,i=m;--i>=0;){for(r=0,g=A[i]%w,y=A[i]/w|0,o=i+(s=c);o>i;)r=((f=g*(f=E[--s]%w)+(a=y*f+(d=E[s]/w|0)*g)%w*w+b[o]+r)/v|0)+(a/w|0)+y*d,b[o--]=f%v;b[o]=r}return r?++n:b.splice(0,1),W(t,b,n)},B.negated=function(){var t=new K(this);return t.s=-t.s||null,t},B.plus=function(t,e){var r,n=this,i=n.s;if(e=(t=new K(t,e)).s,!i||!e)return new K(NaN);if(i!=e)return t.s=-e,n.minus(t);var o=n.e/h,s=t.e/h,a=n.c,c=t.c;if(!o||!s){if(!a||!c)return new K(i/0);if(!a[0]||!c[0])return c[0]?t:new K(a[0]?n:0*i)}if(o=p(o),s=p(s),a=a.slice(),i=o-s){for(i>0?(s=o,r=c):(i=-i,r=a),r.reverse();i--;r.push(0));r.reverse()}for((i=a.length)-(e=c.length)<0&&(r=c,c=a,a=r,e=i),i=0;e;)i=(a[--e]=a[e]+c[e]+i)/u|0,a[e]=u===a[e]?0:a[e]%u;return i&&(a=[i].concat(a),++s),W(t,a,s)},B.precision=B.sd=function(t,e){var r,n,i,o=this;if(null!=t&&t!==!!t)return y(t,1,d),null==e?e=I:y(e,0,8),J(new K(o),t,e);if(!(r=o.c))return null;if(n=(i=r.length-1)*h+1,i=r[i]){for(;i%10==0;i/=10,n--);for(i=r[0];i>=10;i/=10,n++);}return t&&o.e+1>n&&(n=o.e+1),n},B.shiftedBy=function(t){return y(t,-9007199254740991,c),this.times("1e"+t)},B.squareRoot=B.sqrt=function(){var t,e,n,i,o,s=this,a=s.c,u=s.s,h=s.e,c=P+4,f=new K("0.5");if(1!==u||!a||!a[0])return new K(!u||u<0&&(!a||a[0])?NaN:a?s:1/0);if(0==(u=Math.sqrt(+Z(s)))||u==1/0?(((e=m(a)).length+h)%2==0&&(e+="0"),u=Math.sqrt(+e),h=p((h+1)/2)-(h<0||h%2),n=new K(e=u==1/0?"5e"+h:(e=u.toExponential()).slice(0,e.indexOf("e")+1)+h)):n=new K(u+""),n.c[0])for((u=(h=n.e)+c)<3&&(u=0);;)if(o=n,n=f.times(o.plus(r(s,o,c,1))),m(o.c).slice(0,u)===(e=m(n.c)).slice(0,u)){if(n.e<h&&--u,"9999"!=(e=e.slice(u-3,u+1))&&(i||"4999"!=e)){+e&&(+e.slice(1)||"5"!=e.charAt(0))||(J(n,n.e+P+2,1),t=!n.times(n).eq(s));break}if(!i&&(J(o,o.e+P+2,0),o.times(o).eq(s))){n=o;break}c+=4,u+=4,i=1}return J(n,n.e+P+1,I,t)},B.toExponential=function(t,e){return null!=t&&(y(t,0,d),t++),G(this,t,e,1)},B.toFixed=function(t,e){return null!=t&&(y(t,0,d),t=t+this.e+1),G(this,t,e)},B.toFormat=function(t,e,r){var n,i=this;if(null==r)null!=t&&e&&"object"==typeof e?(r=e,e=null):t&&"object"==typeof t?(r=t,t=e=null):r=z;else if("object"!=typeof r)throw Error(s+"Argument not an object: "+r);if(n=i.toFixed(t,e),i.c){var o,a=n.split("."),u=+r.groupSize,h=+r.secondaryGroupSize,c=r.groupSeparator||"",f=a[0],l=a[1],d=i.s<0,p=d?f.slice(1):f,m=p.length;if(h&&(o=u,u=h,h=o,m-=o),u>0&&m>0){for(o=m%u||u,f=p.substr(0,o);o<m;o+=u)f+=c+p.substr(o,u);h>0&&(f+=c+p.slice(o)),d&&(f="-"+f)}n=l?f+(r.decimalSeparator||"")+((h=+r.fractionGroupSize)?l.replace(new RegExp("\\d{"+h+"}\\B","g"),"$&"+(r.fractionGroupSeparator||"")):l):f}return(r.prefix||"")+n+(r.suffix||"")},B.toFraction=function(t){var e,n,i,o,a,u,c,l,d,p,g,y,b=this,v=b.c;if(null!=t&&(!(c=new K(t)).isInteger()&&(c.c||1!==c.s)||c.lt(N)))throw Error(s+"Argument "+(c.isInteger()?"out of range: ":"not an integer: ")+Z(c));if(!v)return new K(b);for(e=new K(N),d=n=new K(N),i=l=new K(N),y=m(v),a=e.e=y.length-b.e-1,e.c[0]=f[(u=a%h)<0?h+u:u],t=!t||c.comparedTo(e)>0?a>0?e:d:c,u=j,j=1/0,c=new K(y),l.c[0]=0;p=r(c,e,0,1),1!=(o=n.plus(p.times(i))).comparedTo(t);)n=i,i=o,d=l.plus(p.times(o=d)),l=o,e=c.minus(p.times(o=e)),c=o;return o=r(t.minus(n),i,0,1),l=l.plus(o.times(d)),n=n.plus(o.times(i)),l.s=d.s=b.s,g=r(d,i,a*=2,I).minus(b).abs().comparedTo(r(l,n,a,I).minus(b).abs())<1?[d,i]:[l,n],j=u,g},B.toNumber=function(){return+Z(this)},B.toPrecision=function(t,e){return null!=t&&y(t,1,d),G(this,t,e,2)},B.toString=function(t){var e,r=this,n=r.s,i=r.e;return null===i?n?(e="Infinity",n<0&&(e="-"+e)):e="NaN":(null==t?e=i<=O||i>=C?v(m(r.c),i):w(m(r.c),i,"0"):10===t&&H?e=w(m((r=J(new K(r),P+i+1,I)).c),r.e,"0"):(y(t,2,q.length,"Base"),e=_(w(m(r.c),i,"0"),10,t,n,!0)),n<0&&r.c[0]&&(e="-"+e)),e},B.valueOf=B.toJSON=function(){return Z(this)},B._isBigNumber=!0,null!=e&&K.set(e),K}(),r.default=r.BigNumber=r,t.exports?t.exports=r:(e||(e="undefined"!=typeof self&&self?self:window),e.BigNumber=r)}(e)}(zO);var qO=zO.exports;Object.defineProperty(FO,"__esModule",{value:!0});const HO=qO;FO.default=class{constructor(){this.BigNum=(t,e)=>new(HO.BigNumber.clone({DECIMAL_PLACES:e}))(t)}winstonToAr(t,{formatted:e=!1,decimals:r=12,trim:n=!0}={}){let i=this.stringToBigNum(t,r).shiftedBy(-12);return e?i.toFormat(r):i.toFixed(r)}arToWinston(t,{formatted:e=!1}={}){let r=this.stringToBigNum(t).shiftedBy(12);return e?r.toFormat():r.toFixed(0)}compare(t,e){let r=this.stringToBigNum(t),n=this.stringToBigNum(e);return r.comparedTo(n)}isEqual(t,e){return 0===this.compare(t,e)}isLessThan(t,e){let r=this.stringToBigNum(t),n=this.stringToBigNum(e);return r.isLessThan(n)}isGreaterThan(t,e){let r=this.stringToBigNum(t),n=this.stringToBigNum(e);return r.isGreaterThan(n)}add(t,e){let r=this.stringToBigNum(t);return this.stringToBigNum(e),r.plus(e).toFixed(0)}sub(t,e){let r=this.stringToBigNum(t);return this.stringToBigNum(e),r.minus(e).toFixed(0)}stringToBigNum(t,e=12){return this.BigNum(t,e)}};var KO,GO={},VO={exports:{}},WO=function(t,e){return function(){for(var r=new Array(arguments.length),n=0;n<r.length;n++)r[n]=arguments[n];return t.apply(e,r)}},JO=WO,ZO=Object.prototype.toString,YO=(KO=Object.create(null),function(t){var e=ZO.call(t);return KO[e]||(KO[e]=e.slice(8,-1).toLowerCase())});function XO(t){return t=t.toLowerCase(),function(e){return YO(e)===t}}function $O(t){return Array.isArray(t)}function QO(t){return void 0===t}var tC=XO("ArrayBuffer");function eC(t){return null!==t&&"object"==typeof t}function rC(t){if("object"!==YO(t))return!1;var e=Object.getPrototypeOf(t);return null===e||e===Object.prototype}var nC=XO("Date"),iC=XO("File"),oC=XO("Blob"),sC=XO("FileList");function aC(t){return"[object Function]"===ZO.call(t)}var uC=XO("URLSearchParams");function hC(t,e){if(null!=t)if("object"!=typeof t&&(t=[t]),$O(t))for(var r=0,n=t.length;r<n;r++)e.call(null,t[r],r,t);else for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.call(null,t[i],i,t)}var cC=function(t){return function(e){return t&&e instanceof t}}("undefined"!=typeof Uint8Array&&Object.getPrototypeOf(Uint8Array)),fC={isArray:$O,isArrayBuffer:tC,isBuffer:function(t){return null!==t&&!QO(t)&&null!==t.constructor&&!QO(t.constructor)&&"function"==typeof t.constructor.isBuffer&&t.constructor.isBuffer(t)},isFormData:function(t){var e="[object FormData]";return t&&("function"==typeof FormData&&t instanceof FormData||ZO.call(t)===e||aC(t.toString)&&t.toString()===e)},isArrayBufferView:function(t){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(t):t&&t.buffer&&tC(t.buffer)},isString:function(t){return"string"==typeof t},isNumber:function(t){return"number"==typeof t},isObject:eC,isPlainObject:rC,isUndefined:QO,isDate:nC,isFile:iC,isBlob:oC,isFunction:aC,isStream:function(t){return eC(t)&&aC(t.pipe)},isURLSearchParams:uC,isStandardBrowserEnv:function(){return("undefined"==typeof navigator||"ReactNative"!==navigator.product&&"NativeScript"!==navigator.product&&"NS"!==navigator.product)&&("undefined"!=typeof window&&"undefined"!=typeof document)},forEach:hC,merge:function t(){var e={};function r(r,n){rC(e[n])&&rC(r)?e[n]=t(e[n],r):rC(r)?e[n]=t({},r):$O(r)?e[n]=r.slice():e[n]=r}for(var n=0,i=arguments.length;n<i;n++)hC(arguments[n],r);return e},extend:function(t,e,r){return hC(e,function(e,n){t[n]=r&&"function"==typeof e?JO(e,r):e}),t},trim:function(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")},stripBOM:function(t){return 65279===t.charCodeAt(0)&&(t=t.slice(1)),t},inherits:function(t,e,r,n){t.prototype=Object.create(e.prototype,n),t.prototype.constructor=t,r&&Object.assign(t.prototype,r)},toFlatObject:function(t,e,r){var n,i,o,s={};e=e||{};do{for(i=(n=Object.getOwnPropertyNames(t)).length;i-- >0;)s[o=n[i]]||(e[o]=t[o],s[o]=!0);t=Object.getPrototypeOf(t)}while(t&&(!r||r(t,e))&&t!==Object.prototype);return e},kindOf:YO,kindOfTest:XO,endsWith:function(t,e,r){t=String(t),(void 0===r||r>t.length)&&(r=t.length),r-=e.length;var n=t.indexOf(e,r);return-1!==n&&n===r},toArray:function(t){if(!t)return null;var e=t.length;if(QO(e))return null;for(var r=new Array(e);e-- >0;)r[e]=t[e];return r},isTypedArray:cC,isFileList:sC},lC=fC;function dC(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}var pC=function(t,e,r){if(!e)return t;var n;if(r)n=r(e);else if(lC.isURLSearchParams(e))n=e.toString();else{var i=[];lC.forEach(e,function(t,e){null!=t&&(lC.isArray(t)?e+="[]":t=[t],lC.forEach(t,function(t){lC.isDate(t)?t=t.toISOString():lC.isObject(t)&&(t=JSON.stringify(t)),i.push(dC(e)+"="+dC(t))}))}),n=i.join("&")}if(n){var o=t.indexOf("#");-1!==o&&(t=t.slice(0,o)),t+=(-1===t.indexOf("?")?"?":"&")+n}return t},mC=fC;function gC(){this.handlers=[]}gC.prototype.use=function(t,e,r){return this.handlers.push({fulfilled:t,rejected:e,synchronous:!!r&&r.synchronous,runWhen:r?r.runWhen:null}),this.handlers.length-1},gC.prototype.eject=function(t){this.handlers[t]&&(this.handlers[t]=null)},gC.prototype.forEach=function(t){mC.forEach(this.handlers,function(e){null!==e&&t(e)})};var yC,bC,vC=gC,wC=fC;function _C(){if(bC)return yC;bC=1;var t=fC;function e(t,e,r,n,i){Error.call(this),this.message=t,this.name="AxiosError",e&&(this.code=e),r&&(this.config=r),n&&(this.request=n),i&&(this.response=i)}t.inherits(e,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code,status:this.response&&this.response.status?this.response.status:null}}});var r=e.prototype,n={};return["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED"].forEach(function(t){n[t]={value:t}}),Object.defineProperties(e,n),Object.defineProperty(r,"isAxiosError",{value:!0}),e.from=function(n,i,o,s,a,u){var h=Object.create(r);return t.toFlatObject(n,h,function(t){return t!==Error.prototype}),e.call(h,n.message,i,o,s,a),h.name=n.name,u&&Object.assign(h,u),h},yC=e}var EC,AC,MC,SC,kC,xC,TC={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1};function RC(){if(AC)return EC;AC=1;var t=fC;return EC=function(e,r){r=r||new FormData;var n=[];function i(e){return null===e?"":t.isDate(e)?e.toISOString():t.isArrayBuffer(e)||t.isTypedArray(e)?"function"==typeof Blob?new Blob([e]):_.from(e):e}return function e(o,s){if(t.isPlainObject(o)||t.isArray(o)){if(-1!==n.indexOf(o))throw Error("Circular reference detected in "+s);n.push(o),t.forEach(o,function(n,o){if(!t.isUndefined(n)){var a,u=s?s+"."+o:o;if(n&&!s&&"object"==typeof n)if(t.endsWith(o,"{}"))n=JSON.stringify(n);else if(t.endsWith(o,"[]")&&(a=t.toArray(n)))return void a.forEach(function(e){!t.isUndefined(e)&&r.append(u,i(e))});e(n,u)}}),n.pop()}else r.append(s,i(o))}(e),r},EC}function BC(){if(SC)return MC;SC=1;var t=_C();return MC=function(e,r,n){var i=n.config.validateStatus;n.status&&i&&!i(n.status)?r(new t("Request failed with status code "+n.status,[t.ERR_BAD_REQUEST,t.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n)):e(n)},MC}function NC(){if(xC)return kC;xC=1;var t=fC;return kC=t.isStandardBrowserEnv()?{write:function(e,r,n,i,o,s){var a=[];a.push(e+"="+encodeURIComponent(r)),t.isNumber(n)&&a.push("expires="+new Date(n).toGMTString()),t.isString(i)&&a.push("path="+i),t.isString(o)&&a.push("domain="+o),!0===s&&a.push("secure"),document.cookie=a.join("; ")},read:function(t){var e=document.cookie.match(new RegExp("(^|;\\s*)("+t+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove:function(t){this.write(t,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}},kC}var PC,IC,OC,CC,LC,jC,DC,UC,FC,zC,qC,HC,KC=function(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)},GC=function(t,e){return e?t.replace(/\/+$/,"")+"/"+e.replace(/^\/+/,""):t},VC=function(t,e){return t&&!KC(e)?GC(t,e):e};function WC(){if(IC)return PC;IC=1;var t=fC,e=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"];return PC=function(r){var n,i,o,s={};return r?(t.forEach(r.split("\n"),function(r){if(o=r.indexOf(":"),n=t.trim(r.substr(0,o)).toLowerCase(),i=t.trim(r.substr(o+1)),n){if(s[n]&&e.indexOf(n)>=0)return;s[n]="set-cookie"===n?(s[n]?s[n]:[]).concat([i]):s[n]?s[n]+", "+i:i}}),s):s},PC}function JC(){if(CC)return OC;CC=1;var t=fC;return OC=t.isStandardBrowserEnv()?function(){var e,r=/(msie|trident)/i.test(navigator.userAgent),n=document.createElement("a");function i(t){var e=t;return r&&(n.setAttribute("href",e),e=n.href),n.setAttribute("href",e),{href:n.href,protocol:n.protocol?n.protocol.replace(/:$/,""):"",host:n.host,search:n.search?n.search.replace(/^\?/,""):"",hash:n.hash?n.hash.replace(/^#/,""):"",hostname:n.hostname,port:n.port,pathname:"/"===n.pathname.charAt(0)?n.pathname:"/"+n.pathname}}return e=i(window.location.href),function(r){var n=t.isString(r)?i(r):r;return n.protocol===e.protocol&&n.host===e.host}}():function(){return!0}}function ZC(){if(jC)return LC;jC=1;var t=_C();function e(e){t.call(this,null==e?"canceled":e,t.ERR_CANCELED),this.name="CanceledError"}return fC.inherits(e,t,{__CANCEL__:!0}),LC=e}function YC(){return UC?DC:(UC=1,DC=function(t){var e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""})}function XC(){if(zC)return FC;zC=1;var t=fC,e=BC(),r=NC(),n=pC,i=VC,o=WC(),s=JC(),a=TC,u=_C(),h=ZC(),c=YC();return FC=function(f){return new Promise(function(l,d){var p,m=f.data,g=f.headers,y=f.responseType;function b(){f.cancelToken&&f.cancelToken.unsubscribe(p),f.signal&&f.signal.removeEventListener("abort",p)}t.isFormData(m)&&t.isStandardBrowserEnv()&&delete g["Content-Type"];var v=new XMLHttpRequest;if(f.auth){var w=f.auth.username||"",_=f.auth.password?unescape(encodeURIComponent(f.auth.password)):"";g.Authorization="Basic "+btoa(w+":"+_)}var E=i(f.baseURL,f.url);function A(){if(v){var t="getAllResponseHeaders"in v?o(v.getAllResponseHeaders()):null,r={data:y&&"text"!==y&&"json"!==y?v.response:v.responseText,status:v.status,statusText:v.statusText,headers:t,config:f,request:v};e(function(t){l(t),b()},function(t){d(t),b()},r),v=null}}if(v.open(f.method.toUpperCase(),n(E,f.params,f.paramsSerializer),!0),v.timeout=f.timeout,"onloadend"in v?v.onloadend=A:v.onreadystatechange=function(){v&&4===v.readyState&&(0!==v.status||v.responseURL&&0===v.responseURL.indexOf("file:"))&&setTimeout(A)},v.onabort=function(){v&&(d(new u("Request aborted",u.ECONNABORTED,f,v)),v=null)},v.onerror=function(){d(new u("Network Error",u.ERR_NETWORK,f,v,v)),v=null},v.ontimeout=function(){var t=f.timeout?"timeout of "+f.timeout+"ms exceeded":"timeout exceeded",e=f.transitional||a;f.timeoutErrorMessage&&(t=f.timeoutErrorMessage),d(new u(t,e.clarifyTimeoutError?u.ETIMEDOUT:u.ECONNABORTED,f,v)),v=null},t.isStandardBrowserEnv()){var M=(f.withCredentials||s(E))&&f.xsrfCookieName?r.read(f.xsrfCookieName):void 0;M&&(g[f.xsrfHeaderName]=M)}"setRequestHeader"in v&&t.forEach(g,function(t,e){void 0===m&&"content-type"===e.toLowerCase()?delete g[e]:v.setRequestHeader(e,t)}),t.isUndefined(f.withCredentials)||(v.withCredentials=!!f.withCredentials),y&&"json"!==y&&(v.responseType=f.responseType),"function"==typeof f.onDownloadProgress&&v.addEventListener("progress",f.onDownloadProgress),"function"==typeof f.onUploadProgress&&v.upload&&v.upload.addEventListener("progress",f.onUploadProgress),(f.cancelToken||f.signal)&&(p=function(t){v&&(d(!t||t&&t.type?new h:t),v.abort(),v=null)},f.cancelToken&&f.cancelToken.subscribe(p),f.signal&&(f.signal.aborted?p():f.signal.addEventListener("abort",p))),m||(m=null);var S=c(E);S&&-1===["http","https","file"].indexOf(S)?d(new u("Unsupported protocol "+S+":",u.ERR_BAD_REQUEST,f)):v.send(m)})},FC}var $C=fC,QC=function(t,e){wC.forEach(t,function(r,n){n!==e&&n.toUpperCase()===e.toUpperCase()&&(t[e]=r,delete t[n])})},tL=_C(),eL=TC,rL=RC(),nL={"Content-Type":"application/x-www-form-urlencoded"};function iL(t,e){!$C.isUndefined(t)&&$C.isUndefined(t["Content-Type"])&&(t["Content-Type"]=e)}var oL={transitional:eL,adapter:function(){var t;return("undefined"!=typeof XMLHttpRequest||void 0!==vr&&"[object process]"===Object.prototype.toString.call(vr))&&(t=XC()),t}(),transformRequest:[function(t,e){if(QC(e,"Accept"),QC(e,"Content-Type"),$C.isFormData(t)||$C.isArrayBuffer(t)||$C.isBuffer(t)||$C.isStream(t)||$C.isFile(t)||$C.isBlob(t))return t;if($C.isArrayBufferView(t))return t.buffer;if($C.isURLSearchParams(t))return iL(e,"application/x-www-form-urlencoded;charset=utf-8"),t.toString();var r,n=$C.isObject(t),i=e&&e["Content-Type"];if((r=$C.isFileList(t))||n&&"multipart/form-data"===i){var o=this.env&&this.env.FormData;return rL(r?{"files[]":t}:t,o&&new o)}return n||"application/json"===i?(iL(e,"application/json"),function(t,e,r){if($C.isString(t))try{return(e||JSON.parse)(t),$C.trim(t)}catch(t){if("SyntaxError"!==t.name)throw t}return(r||JSON.stringify)(t)}(t)):t}],transformResponse:[function(t){var e=this.transitional||oL.transitional,r=e&&e.silentJSONParsing,n=e&&e.forcedJSONParsing,i=!r&&"json"===this.responseType;if(i||n&&$C.isString(t)&&t.length)try{return JSON.parse(t)}catch(t){if(i){if("SyntaxError"===t.name)throw tL.from(t,tL.ERR_BAD_RESPONSE,this,null,this.response);throw t}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:HC?qC:(HC=1,qC=null)},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};$C.forEach(["delete","get","head"],function(t){oL.headers[t]={}}),$C.forEach(["post","put","patch"],function(t){oL.headers[t]=$C.merge(nL)});var sL,aL,uL=oL,hL=fC,cL=uL;function fL(){return aL?sL:(aL=1,sL=function(t){return!(!t||!t.__CANCEL__)})}var lL=fC,dL=function(t,e,r){var n=this||cL;return hL.forEach(r,function(r){t=r.call(n,t,e)}),t},pL=fL(),mL=uL,gL=ZC();function yL(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new gL}var bL,vL,wL=fC,_L=function(t,e){e=e||{};var r={};function n(t,e){return wL.isPlainObject(t)&&wL.isPlainObject(e)?wL.merge(t,e):wL.isPlainObject(e)?wL.merge({},e):wL.isArray(e)?e.slice():e}function i(r){return wL.isUndefined(e[r])?wL.isUndefined(t[r])?void 0:n(void 0,t[r]):n(t[r],e[r])}function o(t){if(!wL.isUndefined(e[t]))return n(void 0,e[t])}function s(r){return wL.isUndefined(e[r])?wL.isUndefined(t[r])?void 0:n(void 0,t[r]):n(void 0,e[r])}function a(r){return r in e?n(t[r],e[r]):r in t?n(void 0,t[r]):void 0}var u={url:o,method:o,data:o,baseURL:s,transformRequest:s,transformResponse:s,paramsSerializer:s,timeout:s,timeoutMessage:s,withCredentials:s,adapter:s,responseType:s,xsrfCookieName:s,xsrfHeaderName:s,onUploadProgress:s,onDownloadProgress:s,decompress:s,maxContentLength:s,maxBodyLength:s,beforeRedirect:s,transport:s,httpAgent:s,httpsAgent:s,cancelToken:s,socketPath:s,responseEncoding:s,validateStatus:a};return wL.forEach(Object.keys(t).concat(Object.keys(e)),function(t){var e=u[t]||i,n=e(t);wL.isUndefined(n)&&e!==a||(r[t]=n)}),r};function EL(){return vL?bL:(vL=1,bL={version:"0.27.2"})}var AL=EL().version,ML=_C(),SL={};["object","boolean","number","function","string","symbol"].forEach(function(t,e){SL[t]=function(r){return typeof r===t||"a"+(e<1?"n ":" ")+t}});var kL={};SL.transitional=function(t,e,r){return function(n,i,o){if(!1===t)throw new ML(function(t,e){return"[Axios v"+AL+"] Transitional option '"+t+"'"+e+(r?". "+r:"")}(i," has been removed"+(e?" in "+e:"")),ML.ERR_DEPRECATED);return e&&!kL[i]&&(kL[i]=!0),!t||t(n,i,o)}};var xL,TL,RL,BL,NL,PL,IL={assertOptions:function(t,e,r){if("object"!=typeof t)throw new ML("options must be an object",ML.ERR_BAD_OPTION_VALUE);for(var n=Object.keys(t),i=n.length;i-- >0;){var o=n[i],s=e[o];if(s){var a=t[o],u=void 0===a||s(a,o,t);if(!0!==u)throw new ML("option "+o+" must be "+u,ML.ERR_BAD_OPTION_VALUE)}else if(!0!==r)throw new ML("Unknown option "+o,ML.ERR_BAD_OPTION)}},validators:SL},OL=fC,CL=pC,LL=vC,jL=function(t){return yL(t),t.headers=t.headers||{},t.data=dL.call(t,t.data,t.headers,t.transformRequest),t.headers=lL.merge(t.headers.common||{},t.headers[t.method]||{},t.headers),lL.forEach(["delete","get","head","post","put","patch","common"],function(e){delete t.headers[e]}),(t.adapter||mL.adapter)(t).then(function(e){return yL(t),e.data=dL.call(t,e.data,e.headers,t.transformResponse),e},function(e){return pL(e)||(yL(t),e&&e.response&&(e.response.data=dL.call(t,e.response.data,e.response.headers,t.transformResponse))),Promise.reject(e)})},DL=_L,UL=VC,FL=IL,zL=FL.validators;function qL(t){this.defaults=t,this.interceptors={request:new LL,response:new LL}}qL.prototype.request=function(t,e){"string"==typeof t?(e=e||{}).url=t:e=t||{},(e=DL(this.defaults,e)).method?e.method=e.method.toLowerCase():this.defaults.method?e.method=this.defaults.method.toLowerCase():e.method="get";var r=e.transitional;void 0!==r&&FL.assertOptions(r,{silentJSONParsing:zL.transitional(zL.boolean),forcedJSONParsing:zL.transitional(zL.boolean),clarifyTimeoutError:zL.transitional(zL.boolean)},!1);var n=[],i=!0;this.interceptors.request.forEach(function(t){"function"==typeof t.runWhen&&!1===t.runWhen(e)||(i=i&&t.synchronous,n.unshift(t.fulfilled,t.rejected))});var o,s=[];if(this.interceptors.response.forEach(function(t){s.push(t.fulfilled,t.rejected)}),!i){var a=[jL,void 0];for(Array.prototype.unshift.apply(a,n),a=a.concat(s),o=Promise.resolve(e);a.length;)o=o.then(a.shift(),a.shift());return o}for(var u=e;n.length;){var h=n.shift(),c=n.shift();try{u=h(u)}catch(t){c(t);break}}try{o=jL(u)}catch(t){return Promise.reject(t)}for(;s.length;)o=o.then(s.shift(),s.shift());return o},qL.prototype.getUri=function(t){t=DL(this.defaults,t);var e=UL(t.baseURL,t.url);return CL(e,t.params,t.paramsSerializer)},OL.forEach(["delete","get","head","options"],function(t){qL.prototype[t]=function(e,r){return this.request(DL(r||{},{method:t,url:e,data:(r||{}).data}))}}),OL.forEach(["post","put","patch"],function(t){function e(e){return function(r,n,i){return this.request(DL(i||{},{method:t,headers:e?{"Content-Type":"multipart/form-data"}:{},url:r,data:n}))}}qL.prototype[t]=e(),qL.prototype[t+"Form"]=e(!0)});var HL=fC,KL=WO,GL=qL,VL=_L;var WL=function t(e){var r=new GL(e),n=KL(GL.prototype.request,r);return HL.extend(n,GL.prototype,r),HL.extend(n,r),n.create=function(r){return t(VL(e,r))},n}(uL);WL.Axios=GL,WL.CanceledError=ZC(),WL.CancelToken=function(){if(TL)return xL;TL=1;var t=ZC();function e(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");var r;this.promise=new Promise(function(t){r=t});var n=this;this.promise.then(function(t){if(n._listeners){var e,r=n._listeners.length;for(e=0;e<r;e++)n._listeners[e](t);n._listeners=null}}),this.promise.then=function(t){var e,r=new Promise(function(t){n.subscribe(t),e=t}).then(t);return r.cancel=function(){n.unsubscribe(e)},r},e(function(e){n.reason||(n.reason=new t(e),r(n.reason))})}return e.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},e.prototype.subscribe=function(t){this.reason?t(this.reason):this._listeners?this._listeners.push(t):this._listeners=[t]},e.prototype.unsubscribe=function(t){if(this._listeners){var e=this._listeners.indexOf(t);-1!==e&&this._listeners.splice(e,1)}},e.source=function(){var t;return{token:new e(function(e){t=e}),cancel:t}},xL=e}(),WL.isCancel=fL(),WL.VERSION=EL().version,WL.toFormData=RC(),WL.AxiosError=_C(),WL.Cancel=WL.CanceledError,WL.all=function(t){return Promise.all(t)},WL.spread=BL?RL:(BL=1,RL=function(t){return function(e){return t.apply(null,e)}}),WL.isAxiosError=function(){if(PL)return NL;PL=1;var t=fC;return NL=function(e){return t.isObject(e)&&!0===e.isAxiosError}}(),VO.exports=WL,VO.exports.default=WL;var JL=VO.exports;Object.defineProperty(GO,"__esModule",{value:!0});const ZL=JL;GO.default=class{constructor(t){this.METHOD_GET="GET",this.METHOD_POST="POST",this.applyConfig(t)}applyConfig(t){this.config=this.mergeDefaults(t)}getConfig(){return this.config}mergeDefaults(t){const e=t.protocol||"http",r=t.port||("https"===e?443:80);return{host:t.host||"127.0.0.1",protocol:e,port:r,timeout:t.timeout||2e4,logging:t.logging||!1,logger:t.logger||console.log,network:t.network}}async get(t,e){try{return await this.request().get(t,e)}catch(t){if(t.response&&t.response.status)return t.response;throw t}}async post(t,e,r){try{return await this.request().post(t,e,r)}catch(t){if(t.response&&t.response.status)return t.response;throw t}}request(){const t={};this.config.network&&(t["x-network"]=this.config.network);let e=ZL.default.create({baseURL:`${this.config.protocol}://${this.config.host}:${this.config.port}`,timeout:this.config.timeout,maxContentLength:536870912,headers:t});return this.config.logging&&(e.interceptors.request.use(t=>(this.config.logger(`Requesting: ${t.baseURL}/${t.url}`),t)),e.interceptors.response.use(t=>(this.config.logger(`Response:   ${t.config.url} - ${t.status}`),t))),e}};for(var YL={},XL={},$L={byteLength:function(t){var e=ij(t),r=e[0],n=e[1];return 3*(r+n)/4-n},toByteArray:function(t){var e,r,n=ij(t),i=n[0],o=n[1],s=new ej(function(t,e,r){return 3*(e+r)/4-r}(0,i,o)),a=0,u=o>0?i-4:i;for(r=0;r<u;r+=4)e=tj[t.charCodeAt(r)]<<18|tj[t.charCodeAt(r+1)]<<12|tj[t.charCodeAt(r+2)]<<6|tj[t.charCodeAt(r+3)],s[a++]=e>>16&255,s[a++]=e>>8&255,s[a++]=255&e;2===o&&(e=tj[t.charCodeAt(r)]<<2|tj[t.charCodeAt(r+1)]>>4,s[a++]=255&e);1===o&&(e=tj[t.charCodeAt(r)]<<10|tj[t.charCodeAt(r+1)]<<4|tj[t.charCodeAt(r+2)]>>2,s[a++]=e>>8&255,s[a++]=255&e);return s},fromByteArray:function(t){for(var e,r=t.length,n=r%3,i=[],o=16383,s=0,a=r-n;s<a;s+=o)i.push(sj(t,s,s+o>a?a:s+o));1===n?(e=t[r-1],i.push(QL[e>>2]+QL[e<<4&63]+"==")):2===n&&(e=(t[r-2]<<8)+t[r-1],i.push(QL[e>>10]+QL[e>>4&63]+QL[e<<2&63]+"="));return i.join("")}},QL=[],tj=[],ej="undefined"!=typeof Uint8Array?Uint8Array:Array,rj="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",nj=0;nj<64;++nj)QL[nj]=rj[nj],tj[rj.charCodeAt(nj)]=nj;function ij(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");return-1===r&&(r=e),[r,r===e?0:4-r%4]}function oj(t){return QL[t>>18&63]+QL[t>>12&63]+QL[t>>6&63]+QL[63&t]}function sj(t,e,r){for(var n,i=[],o=e;o<r;o+=3)n=(t[o]<<16&16711680)+(t[o+1]<<8&65280)+(255&t[o+2]),i.push(oj(n));return i.join("")}tj["-".charCodeAt(0)]=62,tj["_".charCodeAt(0)]=63,Object.defineProperty(XL,"__esModule",{value:!0}),XL.b64UrlDecode=XL.b64UrlEncode=XL.bufferTob64Url=XL.bufferTob64=XL.b64UrlToBuffer=XL.stringToB64Url=XL.stringToBuffer=XL.bufferToString=XL.b64UrlToString=XL.concatBuffers=void 0;const aj=$L;function uj(t){if("undefined"==typeof TextDecoder){return new(0,Jm.TextDecoder)("utf-8",{fatal:!0}).decode(t)}return new TextDecoder("utf-8",{fatal:!0}).decode(t)}function hj(t){if("undefined"==typeof TextEncoder){return(new(0,Jm.TextEncoder)).encode(t)}return(new TextEncoder).encode(t)}function cj(t){return new Uint8Array(aj.toByteArray(pj(t)))}function fj(t){return aj.fromByteArray(new Uint8Array(t))}function lj(t){return dj(fj(t))}function dj(t){return t.replace(/\+/g,"-").replace(/\//g,"_").replace(/\=/g,"")}function pj(t){let e;return e=(t=t.replace(/\-/g,"+").replace(/\_/g,"/")).length%4==0?0:4-t.length%4,t.concat("=".repeat(e))}XL.concatBuffers=function(t){let e=0;for(let r=0;r<t.length;r++)e+=t[r].byteLength;let r=new Uint8Array(e),n=0;r.set(new Uint8Array(t[0]),n),n+=t[0].byteLength;for(let e=1;e<t.length;e++)r.set(new Uint8Array(t[e]),n),n+=t[e].byteLength;return r},XL.b64UrlToString=function(t){return uj(cj(t))},XL.bufferToString=uj,XL.stringToBuffer=hj,XL.stringToB64Url=function(t){return lj(hj(t))},XL.b64UrlToBuffer=cj,XL.bufferTob64=fj,XL.bufferTob64Url=lj,XL.b64UrlEncode=dj,XL.b64UrlDecode=pj,Object.defineProperty(YL,"__esModule",{value:!0});const mj=XL;YL.default=class{constructor(){if(this.keyLength=4096,this.publicExponent=65537,this.hashAlgorithm="sha256",!this.detectWebCrypto())throw new Error("SubtleCrypto not available!");this.driver=crypto.subtle}async generateJWK(){let t=await this.driver.generateKey({name:"RSA-PSS",modulusLength:4096,publicExponent:new Uint8Array([1,0,1]),hash:{name:"SHA-256"}},!0,["sign"]),e=await this.driver.exportKey("jwk",t.privateKey);return{kty:e.kty,e:e.e,n:e.n,d:e.d,p:e.p,q:e.q,dp:e.dp,dq:e.dq,qi:e.qi}}async sign(t,e,{saltLength:r}={}){let n=await this.driver.sign({name:"RSA-PSS",saltLength:32},await this.jwkToCryptoKey(t),e);return new Uint8Array(n)}async hash(t,e="SHA-256"){let r=await this.driver.digest(e,t);return new Uint8Array(r)}async verify(t,e,r){const n={kty:"RSA",e:"AQAB",n:t},i=await this.jwkToPublicCryptoKey(n),o=await this.driver.digest("SHA-256",e),s=await this.driver.verify({name:"RSA-PSS",saltLength:0},i,r,e),a=await this.driver.verify({name:"RSA-PSS",saltLength:32},i,r,e),u=await this.driver.verify({name:"RSA-PSS",saltLength:Math.ceil((i.algorithm.modulusLength-1)/8)-o.byteLength-2},i,r,e);return s||a||u}async jwkToCryptoKey(t){return this.driver.importKey("jwk",t,{name:"RSA-PSS",hash:{name:"SHA-256"}},!1,["sign"])}async jwkToPublicCryptoKey(t){return this.driver.importKey("jwk",t,{name:"RSA-PSS",hash:{name:"SHA-256"}},!1,["verify"])}detectWebCrypto(){if("undefined"==typeof crypto)return!1;const t=null===crypto||void 0===crypto?void 0:crypto.subtle;if(void 0===t)return!1;return["generateKey","importKey","exportKey","digest","sign"].every(e=>"function"==typeof t[e])}async encrypt(t,e,r){const n=await this.driver.importKey("raw","string"==typeof e?mj.stringToBuffer(e):e,{name:"PBKDF2",length:32},!1,["deriveKey"]),i=await this.driver.deriveKey({name:"PBKDF2",salt:r?mj.stringToBuffer(r):mj.stringToBuffer("salt"),iterations:1e5,hash:"SHA-256"},n,{name:"AES-CBC",length:256},!1,["encrypt","decrypt"]),o=new Uint8Array(16);crypto.getRandomValues(o);const s=await this.driver.encrypt({name:"AES-CBC",iv:o},i,t);return mj.concatBuffers([o,s])}async decrypt(t,e,r){const n=await this.driver.importKey("raw","string"==typeof e?mj.stringToBuffer(e):e,{name:"PBKDF2",length:32},!1,["deriveKey"]),i=await this.driver.deriveKey({name:"PBKDF2",salt:r?mj.stringToBuffer(r):mj.stringToBuffer("salt"),iterations:1e5,hash:"SHA-256"},n,{name:"AES-CBC",length:256},!1,["encrypt","decrypt"]),o=t.slice(0,16),s=await this.driver.decrypt({name:"AES-CBC",iv:o},i,t.slice(16));return mj.concatBuffers([s])}};var gj={};Object.defineProperty(gj,"__esModule",{value:!0});gj.default=class{constructor(t){this.api=t}getInfo(){return this.api.get("info").then(t=>t.data)}getPeers(){return this.api.get("peers").then(t=>t.data)}};var yj={},bj={};Object.defineProperty(bj,"__esModule",{value:!0}),bj.getError=void 0;class vj extends Error{constructor(t,e={}){e.message?super(e.message):super(),this.type=t,this.response=e.response}getType(){return this.type}}bj.default=vj,bj.getError=function(t){let e=t.data;if("string"==typeof t.data)try{e=JSON.parse(t.data)}catch(t){}if(t.data instanceof ArrayBuffer||t.data instanceof Uint8Array)try{e=JSON.parse(e.toString())}catch(t){}return e?e.error||e:t.statusText||"unknown"};var wj,_j={},Ej={};function Aj(){if(wj)return Ej;wj=1,Object.defineProperty(Ej,"__esModule",{value:!0});const t=Gj();async function e(e){if(Array.isArray(e)){const n=t.default.utils.concatBuffers([t.default.utils.stringToBuffer("list"),t.default.utils.stringToBuffer(e.length.toString())]);return await r(e,await t.default.crypto.hash(n,"SHA-384"))}const n=t.default.utils.concatBuffers([t.default.utils.stringToBuffer("blob"),t.default.utils.stringToBuffer(e.byteLength.toString())]),i=t.default.utils.concatBuffers([await t.default.crypto.hash(n,"SHA-384"),await t.default.crypto.hash(e,"SHA-384")]);return await t.default.crypto.hash(i,"SHA-384")}async function r(n,i){if(n.length<1)return i;const o=t.default.utils.concatBuffers([i,await e(n[0])]),s=await t.default.crypto.hash(o,"SHA-384");return await r(n.slice(1),s)}return Ej.default=e,Ej}var Mj,Sj,kj={};function xj(){return Mj||(Mj=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.debug=t.validatePath=t.arrayCompare=t.bufferToInt=t.intToBuffer=t.arrayFlatten=t.generateProofs=t.buildLayers=t.generateTransactionChunks=t.generateTree=t.computeRootHash=t.generateLeaves=t.chunkData=t.MIN_CHUNK_SIZE=t.MAX_CHUNK_SIZE=void 0;const e=Gj(),r=XL;t.MAX_CHUNK_SIZE=262144,t.MIN_CHUNK_SIZE=32768;const n=32;async function i(r){let n=[],i=r,o=0;for(;i.byteLength>=t.MAX_CHUNK_SIZE;){let r=t.MAX_CHUNK_SIZE,s=i.byteLength-t.MAX_CHUNK_SIZE;s>0&&s<t.MIN_CHUNK_SIZE&&(r=Math.ceil(i.byteLength/2));const a=i.slice(0,r),u=await e.default.crypto.hash(a);o+=a.byteLength,n.push({dataHash:u,minByteRange:o-a.byteLength,maxByteRange:o}),i=i.slice(r)}return n.push({dataHash:await e.default.crypto.hash(i),minByteRange:o,maxByteRange:o+i.byteLength}),n}async function o(t){return Promise.all(t.map(async({dataHash:t,minByteRange:e,maxByteRange:r})=>({type:"leaf",id:await l(await Promise.all([l(t),l(d(r))])),dataHash:t,minByteRange:e,maxByteRange:r})))}async function s(t){return await a(await o(await i(t)))}async function a(t,e=0){if(t.length<2){return t[0]}const r=[];for(let e=0;e<t.length;e+=2)r.push(await f(t[e],t[e+1]));return a(r,e+1)}function u(t){const e=h(t);return Array.isArray(e)?c(e):[e]}function h(t,e=new Uint8Array,n=0){if("leaf"==t.type)return{offset:t.maxByteRange-1,proof:(0,r.concatBuffers)([e,t.dataHash,d(t.maxByteRange)])};if("branch"==t.type){const i=(0,r.concatBuffers)([e,t.leftChild.id,t.rightChild.id,d(t.byteRange)]);return[h(t.leftChild,i,n+1),h(t.rightChild,i,n+1)]}throw new Error("Unexpected node type")}function c(t){const e=[];return t.forEach(t=>{Array.isArray(t)?e.push(...c(t)):e.push(t)}),e}async function f(t,e){if(!e)return t;return{type:"branch",id:await l([await l(t.id),await l(e.id),await l(d(t.maxByteRange))]),byteRange:t.maxByteRange,maxByteRange:e.maxByteRange,leftChild:t,rightChild:e}}async function l(t){return Array.isArray(t)&&(t=e.default.utils.concatBuffers(t)),new Uint8Array(await e.default.crypto.hash(t))}function d(t){const e=new Uint8Array(32);for(var r=e.length-1;r>=0;r--){var n=t%256;e[r]=n,t=(t-n)/256}return e}function p(t){let e=0;for(var r=0;r<t.length;r++)e*=256,e+=t[r];return e}t.chunkData=i,t.generateLeaves=o,t.computeRootHash=async function(t){return(await s(t)).id},t.generateTree=s,t.generateTransactionChunks=async function(t){const e=await i(t),r=await o(e),n=await a(r),s=await u(n),h=e.slice(-1)[0];return h.maxByteRange-h.minByteRange===0&&(e.splice(e.length-1,1),s.splice(s.length-1,1)),{data_root:n.id,chunks:e,proofs:s}},t.buildLayers=a,t.generateProofs=u,t.arrayFlatten=c,t.intToBuffer=d,t.bufferToInt=p;t.arrayCompare=(t,e)=>t.every((t,r)=>e[r]===t),t.validatePath=async function e(r,i,o,s,a){if(s<=0)return!1;if(i>=s)return e(r,0,s-1,s,a);if(i<0)return e(r,0,0,s,a);if(64==a.length){const e=a.slice(0,n),i=a.slice(e.length,e.length+32),u=await l([await l(e),await l(i)]);return!!(0,t.arrayCompare)(r,u)&&{offset:s-1,leftBound:o,rightBound:s,chunkSize:s-o}}const u=a.slice(0,n),h=a.slice(u.length,u.length+n),c=a.slice(u.length+h.length,u.length+h.length+32),f=p(c),d=a.slice(u.length+h.length+c.length),m=await l([await l(u),await l(h),await l(c)]);return!!(0,t.arrayCompare)(r,m)&&(i<f?await e(u,i,o,Math.min(s,f),d):await e(h,i,Math.max(o,f),s,d))},t.debug=async function t(e,r=""){if(e.byteLength<1)return r;const i=e.slice(0,n),o=e.slice(i.length,i.length+n),s=e.slice(i.length+o.length,i.length+o.length+32),a=p(s),u=e.slice(i.length+o.length+s.length),h=await l([await l(i),await l(o),await l(s)]);return t(u,`${r}\n${JSON.stringify(_.from(i))},${JSON.stringify(_.from(o))},${a} => ${JSON.stringify(h)}`)}}(kj)),kj}function Tj(){if(Sj)return _j;Sj=1,Object.defineProperty(_j,"__esModule",{value:!0}),_j.Tag=void 0;const t=XL,e=Aj(),r=xj();class n{get(e,r){if(!Object.getOwnPropertyNames(this).includes(e))throw new Error(`Field "${e}" is not a property of the Arweave Transaction class.`);return this[e]instanceof Uint8Array?r&&r.decode&&r.string?t.bufferToString(this[e]):r&&r.decode&&!r.string?this[e]:t.bufferTob64Url(this[e]):r&&1==r.decode?r&&r.string?t.b64UrlToString(this[e]):t.b64UrlToBuffer(this[e]):this[e]}}class i extends n{constructor(t,e,r=!1){super(),this.name=t,this.value=e}}_j.Tag=i;return _j.default=class extends n{constructor(e={}){super(),this.format=2,this.id="",this.last_tx="",this.owner="",this.tags=[],this.target="",this.quantity="0",this.data_size="0",this.data=new Uint8Array,this.data_root="",this.reward="0",this.signature="",Object.assign(this,e),"string"==typeof this.data&&(this.data=t.b64UrlToBuffer(this.data)),e.tags&&(this.tags=e.tags.map(t=>new i(t.name,t.value)))}addTag(e,r){this.tags.push(new i(t.stringToB64Url(e),t.stringToB64Url(r)))}toJSON(){return{format:this.format,id:this.id,last_tx:this.last_tx,owner:this.owner,tags:this.tags,target:this.target,quantity:this.quantity,data:t.bufferTob64Url(this.data),data_size:this.data_size,data_root:this.data_root,data_tree:this.data_tree,reward:this.reward,signature:this.signature}}setOwner(t){this.owner=t}setSignature({id:t,owner:e,reward:r,tags:n,signature:i}){this.id=t,this.owner=e,r&&(this.reward=r),n&&(this.tags=n),this.signature=i}async prepareChunks(e){!this.chunks&&e.byteLength>0&&(this.chunks=await(0,r.generateTransactionChunks)(e),this.data_root=t.bufferTob64Url(this.chunks.data_root)),this.chunks||0!==e.byteLength||(this.chunks={chunks:[],data_root:new Uint8Array,proofs:[]},this.data_root="")}getChunk(e,r){if(!this.chunks)throw new Error("Chunks have not been prepared");const n=this.chunks.proofs[e],i=this.chunks.chunks[e];return{data_root:this.data_root,data_size:this.data_size,data_path:t.bufferTob64Url(n.proof),offset:n.offset.toString(),chunk:t.bufferTob64Url(r.slice(i.minByteRange,i.maxByteRange))}}async getSignatureData(){switch(this.format){case 1:let r=this.tags.reduce((e,r)=>t.concatBuffers([e,r.get("name",{decode:!0,string:!1}),r.get("value",{decode:!0,string:!1})]),new Uint8Array);return t.concatBuffers([this.get("owner",{decode:!0,string:!1}),this.get("target",{decode:!0,string:!1}),this.get("data",{decode:!0,string:!1}),t.stringToBuffer(this.quantity),t.stringToBuffer(this.reward),this.get("last_tx",{decode:!0,string:!1}),r]);case 2:this.data_root||await this.prepareChunks(this.data);const n=this.tags.map(t=>[t.get("name",{decode:!0,string:!1}),t.get("value",{decode:!0,string:!1})]);return await(0,e.default)([t.stringToBuffer(this.format.toString()),this.get("owner",{decode:!0,string:!1}),this.get("target",{decode:!0,string:!1}),t.stringToBuffer(this.quantity),t.stringToBuffer(this.reward),this.get("last_tx",{decode:!0,string:!1}),n,t.stringToBuffer(this.data_size),this.get("data_root",{decode:!0,string:!1})]);default:throw new Error(`Unexpected transaction format: ${this.format}`)}}},_j}var Rj,Bj,Nj={};function Pj(){if(Bj)return yj;Bj=1;var t=e&&e.__await||function(e){return this instanceof t?(this.v=e,this):new t(e)},r=e&&e.__asyncGenerator||function(e,r,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var i,o=n.apply(e,r||[]),s=[];return i={},a("next"),a("throw"),a("return"),i[Symbol.asyncIterator]=function(){return this},i;function a(t){o[t]&&(i[t]=function(e){return new Promise(function(r,n){s.push([t,e,r,n])>1||u(t,e)})})}function u(e,r){try{!function(e){e.value instanceof t?Promise.resolve(e.value.v).then(h,c):f(s[0][2],e)}(o[e](r))}catch(t){f(s[0][3],t)}}function h(t){u("next",t)}function c(t){u("throw",t)}function f(t,e){t(e),s.shift(),s.length&&u(s[0][0],s[0][1])}};Object.defineProperty(yj,"__esModule",{value:!0});const n=bj,i=Tj(),o=XL,s=function(){if(Rj)return Nj;Rj=1,Object.defineProperty(Nj,"__esModule",{value:!0}),Nj.TransactionUploader=void 0;const t=Tj(),e=XL,r=bj,n=xj(),i=["invalid_json","chunk_too_big","data_path_too_big","offset_too_big","data_size_too_big","chunk_proof_ratio_not_attractive","invalid_proof"];class o{get isComplete(){return this.txPosted&&this.chunkIndex===this.transaction.chunks.chunks.length}get totalChunks(){return this.transaction.chunks.chunks.length}get uploadedChunks(){return this.chunkIndex}get pctComplete(){return Math.trunc(this.uploadedChunks/this.totalChunks*100)}constructor(e,r){if(this.api=e,this.chunkIndex=0,this.txPosted=!1,this.lastRequestTimeEnd=0,this.totalErrors=0,this.lastResponseStatus=0,this.lastResponseError="",!r.id)throw new Error("Transaction is not signed");if(!r.chunks)throw new Error("Transaction chunks not prepared");this.data=r.data,this.transaction=new t.default(Object.assign({},r,{data:new Uint8Array(0)}))}async uploadChunk(t){if(this.isComplete)throw new Error("Upload is already complete");if(""!==this.lastResponseError?this.totalErrors++:this.totalErrors=0,100===this.totalErrors)throw new Error(`Unable to complete upload: ${this.lastResponseStatus}: ${this.lastResponseError}`);let o=""===this.lastResponseError?0:Math.max(this.lastRequestTimeEnd+4e4-Date.now(),4e4);if(o>0&&(o-=o*Math.random()*.3,await new Promise(t=>setTimeout(t,o))),this.lastResponseError="",!this.txPosted)return void await this.postTransaction();t&&(this.chunkIndex=t);const s=this.transaction.getChunk(t||this.chunkIndex,this.data);if(!await(0,n.validatePath)(this.transaction.chunks.data_root,parseInt(s.offset),0,parseInt(s.data_size),e.b64UrlToBuffer(s.data_path)))throw new Error(`Unable to validate chunk ${this.chunkIndex}`);const a=await this.api.post("chunk",this.transaction.getChunk(this.chunkIndex,this.data)).catch(t=>({status:-1,data:{error:t.message}}));if(this.lastRequestTimeEnd=Date.now(),this.lastResponseStatus=a.status,200==this.lastResponseStatus)this.chunkIndex++;else if(this.lastResponseError=(0,r.getError)(a),i.includes(this.lastResponseError))throw new Error(`Fatal error uploading chunk ${this.chunkIndex}: ${this.lastResponseError}`)}static async fromSerialized(e,r,n){if(!r||"number"!=typeof r.chunkIndex||"object"!=typeof r.transaction)throw new Error("Serialized object does not match expected format.");var i=new t.default(r.transaction);i.chunks||await i.prepareChunks(n);const s=new o(e,i);if(s.chunkIndex=r.chunkIndex,s.lastRequestTimeEnd=r.lastRequestTimeEnd,s.lastResponseError=r.lastResponseError,s.lastResponseStatus=r.lastResponseStatus,s.txPosted=r.txPosted,s.data=n,s.transaction.data_root!==r.transaction.data_root)throw new Error("Data mismatch: Uploader doesn't match provided data.");return s}static async fromTransactionId(t,e){const r=await t.get(`tx/${e}`);if(200!==r.status)throw new Error(`Tx ${e} not found: ${r.status}`);const n=r.data;return n.data=new Uint8Array(0),{txPosted:!0,chunkIndex:0,lastResponseError:"",lastRequestTimeEnd:0,lastResponseStatus:0,transaction:n}}toJSON(){return{chunkIndex:this.chunkIndex,transaction:this.transaction,lastRequestTimeEnd:this.lastRequestTimeEnd,lastResponseStatus:this.lastResponseStatus,lastResponseError:this.lastResponseError,txPosted:this.txPosted}}async postTransaction(){if(this.totalChunks<=1){this.transaction.data=this.data;const t=await this.api.post("tx",this.transaction).catch(t=>({status:-1,data:{error:t.message}}));if(this.lastRequestTimeEnd=Date.now(),this.lastResponseStatus=t.status,this.transaction.data=new Uint8Array(0),t.status>=200&&t.status<300)return this.txPosted=!0,void(this.chunkIndex=1);throw this.lastResponseError=(0,r.getError)(t),new Error(`Unable to upload transaction: ${t.status}, ${this.lastResponseError}`)}const t=await this.api.post("tx",this.transaction);if(this.lastRequestTimeEnd=Date.now(),this.lastResponseStatus=t.status,!(t.status>=200&&t.status<300))throw this.lastResponseError=(0,r.getError)(t),new Error(`Unable to upload transaction: ${t.status}, ${this.lastResponseError}`);this.txPosted=!0}}return Nj.TransactionUploader=o,Nj}();return yj.default=class{constructor(t,e,r){this.api=t,this.crypto=e,this.chunks=r}getTransactionAnchor(){return this.api.get("tx_anchor",{transformResponse:[]}).then(t=>t.data)}getPrice(t,e){let r=e?`price/${t}/${e}`:`price/${t}`;return this.api.get(r,{transformResponse:[function(t){return t}]}).then(t=>t.data)}async get(t){const e=await this.api.get(`tx/${t}`);if(200==e.status){const r=parseInt(e.data.data_size);if(e.data.format>=2&&r>0&&r<=12582912){const r=await this.getData(t);return new i.default(Object.assign(Object.assign({},e.data),{data:r}))}return new i.default(Object.assign(Object.assign({},e.data),{format:e.data.format||1}))}if(404==e.status)throw new n.default("TX_NOT_FOUND");if(410==e.status)throw new n.default("TX_FAILED");throw new n.default("TX_INVALID")}fromRaw(t){return new i.default(t)}async search(t,e){return this.api.post("arql",{op:"equals",expr1:t,expr2:e}).then(t=>t.data?t.data:[])}getStatus(t){return this.api.get(`tx/${t}/status`).then(t=>200==t.status?{status:200,confirmed:t.data}:{status:t.status,confirmed:null})}async getData(t,e){let r;try{r=await this.chunks.downloadChunkedData(t)}catch(t){}if(!r)try{r=(await this.api.get(`/${t}`)).data}catch(t){}if(!r)throw new Error(`${t} was not found!`);return e&&e.decode&&!e.string?r:e&&e.decode&&e.string?o.bufferToString(r):o.bufferTob64Url(r)}async sign(t,e,r){if(!e&&"object"!=typeof arweaveWallet)throw new Error("A new Arweave transaction must provide the jwk parameter.");if(e&&"use_wallet"!==e){t.setOwner(e.n);let n=await t.getSignatureData(),i=await this.crypto.sign(e,n,r),s=await this.crypto.hash(i);t.setSignature({id:o.bufferTob64Url(s),owner:e.n,signature:o.bufferTob64Url(i)})}else{try{(await arweaveWallet.getPermissions()).includes("SIGN_TRANSACTION")||await arweaveWallet.connect(["SIGN_TRANSACTION"])}catch(t){}const e=await arweaveWallet.sign(t,r);t.setSignature({id:e.id,owner:e.owner,reward:e.reward,tags:e.tags,signature:e.signature})}}async verify(t){const e=await t.getSignatureData(),r=t.get("signature",{decode:!0,string:!1}),n=o.bufferTob64Url(await this.crypto.hash(r));if(t.id!==n)throw new Error("Invalid transaction signature or ID! The transaction ID doesn't match the expected SHA-256 hash of the signature.");return this.crypto.verify(t.owner,e,r)}async post(t){if("string"==typeof t?t=new i.default(JSON.parse(t)):"function"==typeof t.readInt32BE?t=new i.default(JSON.parse(t.toString())):"object"!=typeof t||t instanceof i.default||(t=new i.default(t)),!(t instanceof i.default))throw new Error("Must be Transaction object");t.chunks||await t.prepareChunks(t.data);const e=await this.getUploader(t,t.data);try{for(;!e.isComplete;)await e.uploadChunk()}catch(t){if(e.lastResponseStatus>0)return{status:e.lastResponseStatus,statusText:e.lastResponseError,data:{error:e.lastResponseError}};throw t}return{status:200,statusText:"OK",data:{}}}async getUploader(t,e){let r;if(e instanceof ArrayBuffer&&(e=new Uint8Array(e)),t instanceof i.default){if(e||(e=t.data),!(e instanceof Uint8Array))throw new Error("Data format is invalid");t.chunks||await t.prepareChunks(e),r=new s.TransactionUploader(this.api,t),r.data&&0!==r.data.length||(r.data=e)}else{if("string"==typeof t&&(t=await s.TransactionUploader.fromTransactionId(this.api,t)),!(e&&e instanceof Uint8Array))throw new Error("Must provide data when resuming upload");r=await s.TransactionUploader.fromSerialized(this.api,t,e)}return r}upload(e,n){return r(this,arguments,function*(){const r=yield t(this.getUploader(e,n));for(;!r.isComplete;)yield t(r.uploadChunk()),yield yield t(r);return yield t(r)})}},yj}var Ij={};Object.defineProperty(Ij,"__esModule",{value:!0});const Oj=XL;Ij.default=class{constructor(t,e){this.api=t,this.crypto=e}getBalance(t){return this.api.get(`wallet/${t}/balance`,{transformResponse:[function(t){return t}]}).then(t=>t.data)}getLastTransactionID(t){return this.api.get(`wallet/${t}/last_tx`).then(t=>t.data)}generate(){return this.crypto.generateJWK()}async jwkToAddress(t){return t&&"use_wallet"!==t?this.getAddress(t):this.getAddress()}async getAddress(t){if(t&&"use_wallet"!==t)return this.ownerToAddress(t.n);try{await arweaveWallet.connect(["ACCESS_ADDRESS"])}catch(t){}return arweaveWallet.getActiveAddress()}async ownerToAddress(t){return Oj.bufferTob64Url(await this.crypto.hash(Oj.b64UrlToBuffer(t)))}};var Cj={};Object.defineProperty(Cj,"__esModule",{value:!0}),Cj.SiloResource=void 0;const Lj=XL;Cj.default=class{constructor(t,e,r){this.api=t,this.crypto=e,this.transactions=r}async get(t){if(!t)throw new Error("No Silo URI specified");const e=await this.parseUri(t),r=await this.transactions.search("Silo-Name",e.getAccessKey());if(0==r.length)throw new Error(`No data could be found for the Silo URI: ${t}`);const n=await this.transactions.get(r[0]);if(!n)throw new Error(`No data could be found for the Silo URI: ${t}`);const i=n.get("data",{decode:!0,string:!1});return this.crypto.decrypt(i,e.getEncryptionKey())}async readTransactionData(t,e){if(!e)throw new Error("No Silo URI specified");const r=await this.parseUri(e),n=t.get("data",{decode:!0,string:!1});return this.crypto.decrypt(n,r.getEncryptionKey())}async parseUri(t){const e=t.match(/^([a-z0-9-_]+)\.([0-9]+)/i);if(!e)throw new Error("Invalid Silo name, must be a name in the format of [a-z0-9]+.[0-9]+, e.g. 'bubble.7'");const r=e[1],n=Math.pow(2,parseInt(e[2])),i=await this.hash(Lj.stringToBuffer(r),n),o=Lj.bufferTob64(i.slice(0,15)),s=await this.hash(i.slice(16,31),1);return new jj(t,o,s)}async hash(t,e){let r=await this.crypto.hash(t);for(let t=0;t<e-1;t++)r=await this.crypto.hash(r);return r}};class jj{constructor(t,e,r){this.uri=t,this.accessKey=e,this.encryptionKey=r}getUri(){return this.uri}getAccessKey(){return this.accessKey}getEncryptionKey(){return this.encryptionKey}}Cj.SiloResource=jj;var Dj={};Object.defineProperty(Dj,"__esModule",{value:!0});const Uj=bj,Fj=XL;Dj.default=class{constructor(t){this.api=t}async getTransactionOffset(t){const e=await this.api.get(`tx/${t}/offset`);if(200===e.status)return e.data;throw new Error(`Unable to get transaction offset: ${(0,Uj.getError)(e)}`)}async getChunk(t){const e=await this.api.get(`chunk/${t}`);if(200===e.status)return e.data;throw new Error(`Unable to get chunk: ${(0,Uj.getError)(e)}`)}async getChunkData(t){const e=await this.getChunk(t);return Fj.b64UrlToBuffer(e.chunk)}firstChunkOffset(t){return parseInt(t.offset)-parseInt(t.size)+1}async downloadChunkedData(t){const e=await this.getTransactionOffset(t),r=parseInt(e.size),n=parseInt(e.offset)-r+1,i=new Uint8Array(r);let o=0;for(;o<r;){let t;this.api.config.logging;try{t=await this.getChunkData(n+o)}catch(t){}if(!t)throw new Error(`Couldn't complete data download at ${o}/${r}`);i.set(t,o),o+=t.length}return i}};var zj={};Object.defineProperty(zj,"__esModule",{value:!0});const qj=bj;class Hj{constructor(t,e){this.api=t,this.network=e}async get(t){const e=await this.api.get(`${Hj.ENDPOINT}${t}`);if(200===e.status)return e.data;throw 404===e.status?new qj.default("BLOCK_NOT_FOUND"):new Error(`Error while loading block data: ${e}`)}async getCurrent(){const{current:t}=await this.network.getInfo();return await this.get(t)}}var Kj;function Gj(){if(Kj)return UO;Kj=1,Object.defineProperty(UO,"__esModule",{value:!0});const t=FO,e=GO,r=YL,n=gj,i=Pj(),o=Ij,s=Tj(),a=XL,u=Cj,h=Dj,c=zj;class f{constructor(r){this.api=new e.default(r),this.wallets=new o.default(this.api,f.crypto),this.chunks=new h.default(this.api),this.transactions=new i.default(this.api,f.crypto,this.chunks),this.silo=new u.default(this.api,this.crypto,this.transactions),this.network=new n.default(this.api),this.blocks=new c.default(this.api,this.network),this.ar=new t.default}get crypto(){return f.crypto}get utils(){return f.utils}getConfig(){return{api:this.api.getConfig(),crypto:null}}async createTransaction(t,e){const r={};if(Object.assign(r,t),!(t.data||t.target&&t.quantity))throw new Error("A new Arweave transaction must have a 'data' value, or 'target' and 'quantity' values.");if(null==t.owner&&e&&"use_wallet"!==e&&(r.owner=e.n),null==t.last_tx&&(r.last_tx=await this.transactions.getTransactionAnchor()),"string"==typeof t.data&&(t.data=a.stringToBuffer(t.data)),t.data instanceof ArrayBuffer&&(t.data=new Uint8Array(t.data)),t.data&&!(t.data instanceof Uint8Array))throw new Error("Expected data to be a string, Uint8Array or ArrayBuffer");if(null==t.reward){const e=t.data?t.data.byteLength:0;r.reward=await this.transactions.getPrice(e,r.target)}r.data_root="",r.data_size=t.data?t.data.byteLength.toString():"0",r.data=t.data||new Uint8Array(0);const n=new s.default(r);return await n.getSignatureData(),n}async createSiloTransaction(t,e,r){const n={};if(Object.assign(n,t),!t.data)throw new Error("Silo transactions must have a 'data' value");if(!r)throw new Error("No Silo URI specified.");if(t.target||t.quantity)throw new Error("Silo transactions can only be used for storing data, sending AR to other wallets isn't supported.");if(null==t.owner){if(!e||!e.n)throw new Error("A new Arweave transaction must either have an 'owner' attribute, or you must provide the jwk parameter.");n.owner=e.n}null==t.last_tx&&(n.last_tx=await this.transactions.getTransactionAnchor());const i=await this.silo.parseUri(r);if("string"==typeof t.data){const e=await this.crypto.encrypt(a.stringToBuffer(t.data),i.getEncryptionKey());n.reward=await this.transactions.getPrice(e.byteLength),n.data=a.bufferTob64Url(e)}if(t.data instanceof Uint8Array){const e=await this.crypto.encrypt(t.data,i.getEncryptionKey());n.reward=await this.transactions.getPrice(e.byteLength),n.data=a.bufferTob64Url(e)}const o=new s.default(n);return o.addTag("Silo-Name",i.getAccessKey()),o.addTag("Silo-Version","0.1.0"),o}arql(t){return this.api.post("/arql",t).then(t=>t.data||[])}}return UO.default=f,f.crypto=new r.default,f.utils=a,UO}zj.default=Hj,Hj.ENDPOINT="block/hash/",function(t){var r=e&&e.__createBinding||(Object.create?function(t,e,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);i&&!("get"in i?!e.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}:function(t,e,r,n){void 0===n&&(n=r),t[n]=e[r]}),n=e&&e.__exportStar||function(t,e){for(var n in t)"default"===n||Object.prototype.hasOwnProperty.call(e,n)||r(e,t,n)};Object.defineProperty(t,"__esModule",{value:!0});const i=Gj();i.default.init=function(t={}){const e=function(){const t={host:"arweave.net",port:443,protocol:"https"};if("object"!=typeof location||!location.protocol||!location.hostname)return t;const e=location.protocol.replace(":",""),r=location.hostname,n=location.port?parseInt(location.port):"https"==e?443:80;return["localhost","127.0.0.1"].includes(r)||"file"==e?t:{host:r,port:n,protocol:e}}(),r=t.protocol||e.protocol,n=t.host||e.host,o=t.port||e.port;return new i.default(Object.assign(Object.assign({},t),{host:n,protocol:r,port:o}))},"object"==typeof globalThis?globalThis.Arweave=i.default:"object"==typeof self&&(self.Arweave=i.default),n(Gj(),t),t.default=i.default}(DO);var Vj=e&&e.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(iw,"__esModule",{value:!0});const Wj=ow,Jj=Vj(DO),Zj=Vj(jl),Yj=Fl;iw.default=class{constructor(t,e){this._key=t,this.pk=e,this.signatureType=1,this.ownerLength=Yj.SIG_CONFIG[1].pubLength,this.signatureLength=Yj.SIG_CONFIG[1].sigLength,e||(this.pk=Wj.createPublicKey({key:t,type:"pkcs1",format:"pem"}).export({format:"pem",type:"pkcs1"}).toString())}get publicKey(){return this._publicKey}sign(t){return Wj.createSign("sha256").update(t).sign({key:this._key,padding:Wj.constants.RSA_PKCS1_PSS_PADDING})}static async verify(t,e,r){return await Jj.default.crypto.verify(_.isBuffer(t)?Zj.default.encode(t):t,e,r)}};var Xj,$j={},Qj={},tD={},eD={},rD=st,nD=rD.Buffer,iD={};for(Xj in rD)rD.hasOwnProperty(Xj)&&"SlowBuffer"!==Xj&&"Buffer"!==Xj&&(iD[Xj]=rD[Xj]);var oD=iD.Buffer={};for(Xj in nD)nD.hasOwnProperty(Xj)&&"allocUnsafe"!==Xj&&"allocUnsafeSlow"!==Xj&&(oD[Xj]=nD[Xj]);if(iD.Buffer.prototype=nD.prototype,oD.from&&oD.from!==Uint8Array.from||(oD.from=function(t,e,r){if("number"==typeof t)throw new TypeError('The "value" argument must not be of type number. Received type '+typeof t);if(t&&void 0===t.length)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);return nD(t,e,r)}),oD.alloc||(oD.alloc=function(t,e,r){if("number"!=typeof t)throw new TypeError('The "size" argument must be of type number. Received type '+typeof t);if(t<0||t>=2*(1<<30))throw new RangeError('The value "'+t+'" is invalid for option "size"');var n=nD(t);return e&&0!==e.length?"string"==typeof r?n.fill(e,r):n.fill(e):n.fill(0),n}),!iD.kStringMaxLength)try{iD.kStringMaxLength=vr.binding("buffer").kStringMaxLength}catch(t){}iD.constants||(iD.constants={MAX_LENGTH:iD.kMaxLength},iD.kStringMaxLength&&(iD.constants.MAX_STRING_LENGTH=iD.kStringMaxLength));var sD=iD,aD={};const uD=ri;function hD(t){this._reporterState={obj:null,path:[],options:t||{},errors:[]}}function cD(t,e){this.path=t,this.rethrow(e)}aD.Reporter=hD,hD.prototype.isError=function(t){return t instanceof cD},hD.prototype.save=function(){const t=this._reporterState;return{obj:t.obj,pathLen:t.path.length}},hD.prototype.restore=function(t){const e=this._reporterState;e.obj=t.obj,e.path=e.path.slice(0,t.pathLen)},hD.prototype.enterKey=function(t){return this._reporterState.path.push(t)},hD.prototype.exitKey=function(t){const e=this._reporterState;e.path=e.path.slice(0,t-1)},hD.prototype.leaveKey=function(t,e,r){const n=this._reporterState;this.exitKey(t),null!==n.obj&&(n.obj[e]=r)},hD.prototype.path=function(){return this._reporterState.path.join("/")},hD.prototype.enterObject=function(){const t=this._reporterState,e=t.obj;return t.obj={},e},hD.prototype.leaveObject=function(t){const e=this._reporterState,r=e.obj;return e.obj=t,r},hD.prototype.error=function(t){let e;const r=this._reporterState,n=t instanceof cD;if(e=n?t:new cD(r.path.map(function(t){return"["+JSON.stringify(t)+"]"}).join(""),t.message||t,t.stack),!r.options.partial)throw e;return n||r.errors.push(e),e},hD.prototype.wrapResult=function(t){const e=this._reporterState;return e.options.partial?{result:this.isError(t)?null:t,errors:e.errors}:t},uD(cD,Error),cD.prototype.rethrow=function(t){if(this.message=t+" at: "+(this.path||"(shallow)"),Error.captureStackTrace&&Error.captureStackTrace(this,cD),!this.stack)try{throw new Error(this.message)}catch(t){this.stack=t.stack}return this};var fD={};const lD=ri,dD=aD.Reporter,pD=sD.Buffer;function mD(t,e){dD.call(this,e),pD.isBuffer(t)?(this.base=t,this.offset=0,this.length=t.length):this.error("Input not Buffer")}function gD(t,e){if(Array.isArray(t))this.length=0,this.value=t.map(function(t){return gD.isEncoderBuffer(t)||(t=new gD(t,e)),this.length+=t.length,t},this);else if("number"==typeof t){if(!(0<=t&&t<=255))return e.error("non-byte EncoderBuffer value");this.value=t,this.length=1}else if("string"==typeof t)this.value=t,this.length=pD.byteLength(t);else{if(!pD.isBuffer(t))return e.error("Unsupported type: "+typeof t);this.value=t,this.length=t.length}}lD(mD,dD),fD.DecoderBuffer=mD,mD.isDecoderBuffer=function(t){if(t instanceof mD)return!0;return"object"==typeof t&&pD.isBuffer(t.base)&&"DecoderBuffer"===t.constructor.name&&"number"==typeof t.offset&&"number"==typeof t.length&&"function"==typeof t.save&&"function"==typeof t.restore&&"function"==typeof t.isEmpty&&"function"==typeof t.readUInt8&&"function"==typeof t.skip&&"function"==typeof t.raw},mD.prototype.save=function(){return{offset:this.offset,reporter:dD.prototype.save.call(this)}},mD.prototype.restore=function(t){const e=new mD(this.base);return e.offset=t.offset,e.length=this.offset,this.offset=t.offset,dD.prototype.restore.call(this,t.reporter),e},mD.prototype.isEmpty=function(){return this.offset===this.length},mD.prototype.readUInt8=function(t){return this.offset+1<=this.length?this.base.readUInt8(this.offset++,!0):this.error(t||"DecoderBuffer overrun")},mD.prototype.skip=function(t,e){if(!(this.offset+t<=this.length))return this.error(e||"DecoderBuffer overrun");const r=new mD(this.base);return r._reporterState=this._reporterState,r.offset=this.offset,r.length=this.offset+t,this.offset+=t,r},mD.prototype.raw=function(t){return this.base.slice(t?t.offset:this.offset,this.length)},fD.EncoderBuffer=gD,gD.isEncoderBuffer=function(t){if(t instanceof gD)return!0;return"object"==typeof t&&"EncoderBuffer"===t.constructor.name&&"number"==typeof t.length&&"function"==typeof t.join},gD.prototype.join=function(t,e){return t||(t=pD.alloc(this.length)),e||(e=0),0===this.length||(Array.isArray(this.value)?this.value.forEach(function(r){r.join(t,e),e+=r.length}):("number"==typeof this.value?t[e]=this.value:"string"==typeof this.value?t.write(this.value,e):pD.isBuffer(this.value)&&this.value.copy(t,e),e+=this.length)),t};const yD=aD.Reporter,bD=fD.EncoderBuffer,vD=fD.DecoderBuffer,wD=Qn,_D=["seq","seqof","set","setof","objid","bool","gentime","utctime","null_","enum","int","objDesc","bitstr","bmpstr","charstr","genstr","graphstr","ia5str","iso646str","numstr","octstr","printstr","t61str","unistr","utf8str","videostr"],ED=["key","obj","use","optional","explicit","implicit","def","choice","any","contains"].concat(_D);function AD(t,e,r){const n={};this._baseState=n,n.name=r,n.enc=t,n.parent=e||null,n.children=null,n.tag=null,n.args=null,n.reverseArgs=null,n.choice=null,n.optional=!1,n.any=!1,n.obj=!1,n.use=null,n.useDecoder=null,n.key=null,n.default=null,n.explicit=null,n.implicit=null,n.contains=null,n.parent||(n.children=[],this._wrap())}var MD=AD;const SD=["enc","parent","children","tag","args","reverseArgs","choice","optional","any","obj","use","alteredUse","key","default","explicit","implicit","contains"];AD.prototype.clone=function(){const t=this._baseState,e={};SD.forEach(function(r){e[r]=t[r]});const r=new this.constructor(e.parent);return r._baseState=e,r},AD.prototype._wrap=function(){const t=this._baseState;ED.forEach(function(e){this[e]=function(){const r=new this.constructor(this);return t.children.push(r),r[e].apply(r,arguments)}},this)},AD.prototype._init=function(t){const e=this._baseState;wD(null===e.parent),t.call(this),e.children=e.children.filter(function(t){return t._baseState.parent===this},this)},AD.prototype._useArgs=function(t){const e=this._baseState,r=t.filter(function(t){return t instanceof this.constructor},this);t=t.filter(function(t){return!(t instanceof this.constructor)},this),0!==r.length&&(wD(null===e.children),e.children=r,r.forEach(function(t){t._baseState.parent=this},this)),0!==t.length&&(wD(null===e.args),e.args=t,e.reverseArgs=t.map(function(t){if("object"!=typeof t||t.constructor!==Object)return t;const e={};return Object.keys(t).forEach(function(r){r==(0|r)&&(r|=0);const n=t[r];e[n]=r}),e}))},["_peekTag","_decodeTag","_use","_decodeStr","_decodeObjid","_decodeTime","_decodeNull","_decodeInt","_decodeBool","_decodeList","_encodeComposite","_encodeStr","_encodeObjid","_encodeTime","_encodeNull","_encodeInt","_encodeBool"].forEach(function(t){AD.prototype[t]=function(){const e=this._baseState;throw new Error(t+" not implemented for encoding: "+e.enc)}}),_D.forEach(function(t){AD.prototype[t]=function(){const e=this._baseState,r=Array.prototype.slice.call(arguments);return wD(null===e.tag),e.tag=t,this._useArgs(r),this}}),AD.prototype.use=function(t){wD(t);const e=this._baseState;return wD(null===e.use),e.use=t,this},AD.prototype.optional=function(){return this._baseState.optional=!0,this},AD.prototype.def=function(t){const e=this._baseState;return wD(null===e.default),e.default=t,e.optional=!0,this},AD.prototype.explicit=function(t){const e=this._baseState;return wD(null===e.explicit&&null===e.implicit),e.explicit=t,this},AD.prototype.implicit=function(t){const e=this._baseState;return wD(null===e.explicit&&null===e.implicit),e.implicit=t,this},AD.prototype.obj=function(){const t=this._baseState,e=Array.prototype.slice.call(arguments);return t.obj=!0,0!==e.length&&this._useArgs(e),this},AD.prototype.key=function(t){const e=this._baseState;return wD(null===e.key),e.key=t,this},AD.prototype.any=function(){return this._baseState.any=!0,this},AD.prototype.choice=function(t){const e=this._baseState;return wD(null===e.choice),e.choice=t,this._useArgs(Object.keys(t).map(function(e){return t[e]})),this},AD.prototype.contains=function(t){const e=this._baseState;return wD(null===e.use),e.contains=t,this},AD.prototype._decode=function(t,e){const r=this._baseState;if(null===r.parent)return t.wrapResult(r.children[0]._decode(t,e));let n,i=r.default,o=!0,s=null;if(null!==r.key&&(s=t.enterKey(r.key)),r.optional){let n=null;if(null!==r.explicit?n=r.explicit:null!==r.implicit?n=r.implicit:null!==r.tag&&(n=r.tag),null!==n||r.any){if(o=this._peekTag(t,n,r.any),t.isError(o))return o}else{const n=t.save();try{null===r.choice?this._decodeGeneric(r.tag,t,e):this._decodeChoice(t,e),o=!0}catch(t){o=!1}t.restore(n)}}if(r.obj&&o&&(n=t.enterObject()),o){if(null!==r.explicit){const e=this._decodeTag(t,r.explicit);if(t.isError(e))return e;t=e}const n=t.offset;if(null===r.use&&null===r.choice){let e;r.any&&(e=t.save());const n=this._decodeTag(t,null!==r.implicit?r.implicit:r.tag,r.any);if(t.isError(n))return n;r.any?i=t.raw(e):t=n}if(e&&e.track&&null!==r.tag&&e.track(t.path(),n,t.length,"tagged"),e&&e.track&&null!==r.tag&&e.track(t.path(),t.offset,t.length,"content"),r.any||(i=null===r.choice?this._decodeGeneric(r.tag,t,e):this._decodeChoice(t,e)),t.isError(i))return i;if(r.any||null!==r.choice||null===r.children||r.children.forEach(function(r){r._decode(t,e)}),r.contains&&("octstr"===r.tag||"bitstr"===r.tag)){const n=new vD(i);i=this._getUse(r.contains,t._reporterState.obj)._decode(n,e)}}return r.obj&&o&&(i=t.leaveObject(n)),null===r.key||null===i&&!0!==o?null!==s&&t.exitKey(s):t.leaveKey(s,r.key,i),i},AD.prototype._decodeGeneric=function(t,e,r){const n=this._baseState;return"seq"===t||"set"===t?null:"seqof"===t||"setof"===t?this._decodeList(e,t,n.args[0],r):/str$/.test(t)?this._decodeStr(e,t,r):"objid"===t&&n.args?this._decodeObjid(e,n.args[0],n.args[1],r):"objid"===t?this._decodeObjid(e,null,null,r):"gentime"===t||"utctime"===t?this._decodeTime(e,t,r):"null_"===t?this._decodeNull(e,r):"bool"===t?this._decodeBool(e,r):"objDesc"===t?this._decodeStr(e,t,r):"int"===t||"enum"===t?this._decodeInt(e,n.args&&n.args[0],r):null!==n.use?this._getUse(n.use,e._reporterState.obj)._decode(e,r):e.error("unknown tag: "+t)},AD.prototype._getUse=function(t,e){const r=this._baseState;return r.useDecoder=this._use(t,e),wD(null===r.useDecoder._baseState.parent),r.useDecoder=r.useDecoder._baseState.children[0],r.implicit!==r.useDecoder._baseState.implicit&&(r.useDecoder=r.useDecoder.clone(),r.useDecoder._baseState.implicit=r.implicit),r.useDecoder},AD.prototype._decodeChoice=function(t,e){const r=this._baseState;let n=null,i=!1;return Object.keys(r.choice).some(function(o){const s=t.save(),a=r.choice[o];try{const r=a._decode(t,e);if(t.isError(r))return!1;n={type:o,value:r},i=!0}catch(e){return t.restore(s),!1}return!0},this),i?n:t.error("Choice not matched")},AD.prototype._createEncoderBuffer=function(t){return new bD(t,this.reporter)},AD.prototype._encode=function(t,e,r){const n=this._baseState;if(null!==n.default&&n.default===t)return;const i=this._encodeValue(t,e,r);return void 0===i||this._skipDefault(i,e,r)?void 0:i},AD.prototype._encodeValue=function(t,e,r){const n=this._baseState;if(null===n.parent)return n.children[0]._encode(t,e||new yD);let i=null;if(this.reporter=e,n.optional&&void 0===t){if(null===n.default)return;t=n.default}let o=null,s=!1;if(n.any)i=this._createEncoderBuffer(t);else if(n.choice)i=this._encodeChoice(t,e);else if(n.contains)o=this._getUse(n.contains,r)._encode(t,e),s=!0;else if(n.children)o=n.children.map(function(r){if("null_"===r._baseState.tag)return r._encode(null,e,t);if(null===r._baseState.key)return e.error("Child should have a key");const n=e.enterKey(r._baseState.key);if("object"!=typeof t)return e.error("Child expected, but input is not object");const i=r._encode(t[r._baseState.key],e,t);return e.leaveKey(n),i},this).filter(function(t){return t}),o=this._createEncoderBuffer(o);else if("seqof"===n.tag||"setof"===n.tag){if(!n.args||1!==n.args.length)return e.error("Too many args for : "+n.tag);if(!Array.isArray(t))return e.error("seqof/setof, but data is not Array");const r=this.clone();r._baseState.implicit=null,o=this._createEncoderBuffer(t.map(function(r){const n=this._baseState;return this._getUse(n.args[0],t)._encode(r,e)},r))}else null!==n.use?i=this._getUse(n.use,r)._encode(t,e):(o=this._encodePrimitive(n.tag,t),s=!0);if(!n.any&&null===n.choice){const t=null!==n.implicit?n.implicit:n.tag,r=null===n.implicit?"universal":"context";null===t?null===n.use&&e.error("Tag could be omitted only for .use()"):null===n.use&&(i=this._encodeComposite(t,s,r,o))}return null!==n.explicit&&(i=this._encodeComposite(n.explicit,!1,"context",i)),i},AD.prototype._encodeChoice=function(t,e){const r=this._baseState,n=r.choice[t.type];return n||wD(!1,t.type+" not found in "+JSON.stringify(Object.keys(r.choice))),n._encode(t.value,e)},AD.prototype._encodePrimitive=function(t,e){const r=this._baseState;if(/str$/.test(t))return this._encodeStr(e,t);if("objid"===t&&r.args)return this._encodeObjid(e,r.reverseArgs[0],r.args[1]);if("objid"===t)return this._encodeObjid(e,null,null);if("gentime"===t||"utctime"===t)return this._encodeTime(e,t);if("null_"===t)return this._encodeNull();if("int"===t||"enum"===t)return this._encodeInt(e,r.args&&r.reverseArgs[0]);if("bool"===t)return this._encodeBool(e);if("objDesc"===t)return this._encodeStr(e,t);throw new Error("Unsupported tag: "+t)},AD.prototype._isNumstr=function(t){return/^[0-9 ]*$/.test(t)},AD.prototype._isPrintstr=function(t){return/^[A-Za-z0-9 '()+,-./:=?]*$/.test(t)};var kD={};!function(t){function e(t){const e={};return Object.keys(t).forEach(function(r){(0|r)==r&&(r|=0);const n=t[r];e[n]=r}),e}t.tagClass={0:"universal",1:"application",2:"context",3:"private"},t.tagClassByName=e(t.tagClass),t.tag={0:"end",1:"bool",2:"int",3:"bitstr",4:"octstr",5:"null_",6:"objid",7:"objDesc",8:"external",9:"real",10:"enum",11:"embed",12:"utf8str",13:"relativeOid",16:"seq",17:"set",18:"numstr",19:"printstr",20:"t61str",21:"videostr",22:"ia5str",23:"utctime",24:"gentime",25:"graphstr",26:"iso646str",27:"genstr",28:"unistr",29:"charstr",30:"bmpstr"},t.tagByName=e(t.tag)}(kD);const xD=ri,TD=sD.Buffer,RD=MD,BD=kD;function ND(t){this.enc="der",this.name=t.name,this.entity=t,this.tree=new ID,this.tree._init(t.body)}var PD=ND;function ID(t){RD.call(this,"der",t)}function OD(t){return t<10?"0"+t:t}ND.prototype.encode=function(t,e){return this.tree._encode(t,e).join()},xD(ID,RD),ID.prototype._encodeComposite=function(t,e,r,n){const i=function(t,e,r,n){let i;"seqof"===t?t="seq":"setof"===t&&(t="set");if(BD.tagByName.hasOwnProperty(t))i=BD.tagByName[t];else{if("number"!=typeof t||(0|t)!==t)return n.error("Unknown tag: "+t);i=t}if(i>=31)return n.error("Multi-octet tag encoding unsupported");e||(i|=32);return i|=BD.tagClassByName[r||"universal"]<<6,i}(t,e,r,this.reporter);if(n.length<128){const t=TD.alloc(2);return t[0]=i,t[1]=n.length,this._createEncoderBuffer([t,n])}let o=1;for(let t=n.length;t>=256;t>>=8)o++;const s=TD.alloc(2+o);s[0]=i,s[1]=128|o;for(let t=1+o,e=n.length;e>0;t--,e>>=8)s[t]=255&e;return this._createEncoderBuffer([s,n])},ID.prototype._encodeStr=function(t,e){if("bitstr"===e)return this._createEncoderBuffer([0|t.unused,t.data]);if("bmpstr"===e){const e=TD.alloc(2*t.length);for(let r=0;r<t.length;r++)e.writeUInt16BE(t.charCodeAt(r),2*r);return this._createEncoderBuffer(e)}return"numstr"===e?this._isNumstr(t)?this._createEncoderBuffer(t):this.reporter.error("Encoding of string type: numstr supports only digits and space"):"printstr"===e?this._isPrintstr(t)?this._createEncoderBuffer(t):this.reporter.error("Encoding of string type: printstr supports only latin upper and lower case letters, digits, space, apostrophe, left and rigth parenthesis, plus sign, comma, hyphen, dot, slash, colon, equal sign, question mark"):/str$/.test(e)||"objDesc"===e?this._createEncoderBuffer(t):this.reporter.error("Encoding of string type: "+e+" unsupported")},ID.prototype._encodeObjid=function(t,e,r){if("string"==typeof t){if(!e)return this.reporter.error("string objid given, but no values map found");if(!e.hasOwnProperty(t))return this.reporter.error("objid not found in values map");t=e[t].split(/[\s.]+/g);for(let e=0;e<t.length;e++)t[e]|=0}else if(Array.isArray(t)){t=t.slice();for(let e=0;e<t.length;e++)t[e]|=0}if(!Array.isArray(t))return this.reporter.error("objid() should be either array or string, got: "+JSON.stringify(t));if(!r){if(t[1]>=40)return this.reporter.error("Second objid identifier OOB");t.splice(0,2,40*t[0]+t[1])}let n=0;for(let e=0;e<t.length;e++){let r=t[e];for(n++;r>=128;r>>=7)n++}const i=TD.alloc(n);let o=i.length-1;for(let e=t.length-1;e>=0;e--){let r=t[e];for(i[o--]=127&r;(r>>=7)>0;)i[o--]=128|127&r}return this._createEncoderBuffer(i)},ID.prototype._encodeTime=function(t,e){let r;const n=new Date(t);return"gentime"===e?r=[OD(n.getUTCFullYear()),OD(n.getUTCMonth()+1),OD(n.getUTCDate()),OD(n.getUTCHours()),OD(n.getUTCMinutes()),OD(n.getUTCSeconds()),"Z"].join(""):"utctime"===e?r=[OD(n.getUTCFullYear()%100),OD(n.getUTCMonth()+1),OD(n.getUTCDate()),OD(n.getUTCHours()),OD(n.getUTCMinutes()),OD(n.getUTCSeconds()),"Z"].join(""):this.reporter.error("Encoding "+e+" time is not supported yet"),this._encodeStr(r,"octstr")},ID.prototype._encodeNull=function(){return this._createEncoderBuffer("")},ID.prototype._encodeInt=function(t,e){if("string"==typeof t){if(!e)return this.reporter.error("String int or enum given, but no values map");if(!e.hasOwnProperty(t))return this.reporter.error("Values map doesn't contain: "+JSON.stringify(t));t=e[t]}if("number"!=typeof t&&!TD.isBuffer(t)){const e=t.toArray();!t.sign&&128&e[0]&&e.unshift(0),t=TD.from(e)}if(TD.isBuffer(t)){let e=t.length;0===t.length&&e++;const r=TD.alloc(e);return t.copy(r),0===t.length&&(r[0]=0),this._createEncoderBuffer(r)}if(t<128)return this._createEncoderBuffer(t);if(t<256)return this._createEncoderBuffer([0,t]);let r=1;for(let e=t;e>=256;e>>=8)r++;const n=new Array(r);for(let e=n.length-1;e>=0;e--)n[e]=255&t,t>>=8;return 128&n[0]&&n.unshift(0),this._createEncoderBuffer(TD.from(n))},ID.prototype._encodeBool=function(t){return this._createEncoderBuffer(t?255:0)},ID.prototype._use=function(t,e){return"function"==typeof t&&(t=t(e)),t._getEncoder("der").tree},ID.prototype._skipDefault=function(t,e,r){const n=this._baseState;let i;if(null===n.default)return!1;const o=t.join();if(void 0===n.defaultBuffer&&(n.defaultBuffer=this._encodeValue(n.default,e,r).join()),o.length!==n.defaultBuffer.length)return!1;for(i=0;i<o.length;i++)if(o[i]!==n.defaultBuffer[i])return!1;return!0};const CD=PD;function LD(t){CD.call(this,t),this.enc="pem"}ri(LD,CD);var jD=LD;LD.prototype.encode=function(t,e){const r=CD.prototype.encode.call(this,t).toString("base64"),n=["-----BEGIN "+e.label+"-----"];for(let t=0;t<r.length;t+=64)n.push(r.slice(t,t+64));return n.push("-----END "+e.label+"-----"),n.join("\n")},function(t){const e=t;e.der=PD,e.pem=jD}(eD);var DD={};const UD=ri,FD=pd,zD=fD.DecoderBuffer,qD=MD,HD=kD;function KD(t){this.enc="der",this.name=t.name,this.entity=t,this.tree=new VD,this.tree._init(t.body)}var GD=KD;function VD(t){qD.call(this,"der",t)}function WD(t,e){let r=t.readUInt8(e);if(t.isError(r))return r;const n=HD.tagClass[r>>6],i=!(32&r);if(31&~r)r&=31;else{let n=r;for(r=0;!(128&~n);){if(n=t.readUInt8(e),t.isError(n))return n;r<<=7,r|=127&n}}return{cls:n,primitive:i,tag:r,tagStr:HD.tag[r]}}function JD(t,e,r){let n=t.readUInt8(r);if(t.isError(n))return n;if(!e&&128===n)return null;if(!(128&n))return n;const i=127&n;if(i>4)return t.error("length octect is too long");n=0;for(let e=0;e<i;e++){n<<=8;const e=t.readUInt8(r);if(t.isError(e))return e;n|=e}return n}KD.prototype.decode=function(t,e){return zD.isDecoderBuffer(t)||(t=new zD(t,e)),this.tree._decode(t,e)},UD(VD,qD),VD.prototype._peekTag=function(t,e,r){if(t.isEmpty())return!1;const n=t.save(),i=WD(t,'Failed to peek tag: "'+e+'"');return t.isError(i)?i:(t.restore(n),i.tag===e||i.tagStr===e||i.tagStr+"of"===e||r)},VD.prototype._decodeTag=function(t,e,r){const n=WD(t,'Failed to decode tag of "'+e+'"');if(t.isError(n))return n;let i=JD(t,n.primitive,'Failed to get length of "'+e+'"');if(t.isError(i))return i;if(!r&&n.tag!==e&&n.tagStr!==e&&n.tagStr+"of"!==e)return t.error('Failed to match tag: "'+e+'"');if(n.primitive||null!==i)return t.skip(i,'Failed to match body of: "'+e+'"');const o=t.save(),s=this._skipUntilEnd(t,'Failed to skip indefinite length body: "'+this.tag+'"');return t.isError(s)?s:(i=t.offset-o.offset,t.restore(o),t.skip(i,'Failed to match body of: "'+e+'"'))},VD.prototype._skipUntilEnd=function(t,e){for(;;){const r=WD(t,e);if(t.isError(r))return r;const n=JD(t,r.primitive,e);if(t.isError(n))return n;let i;if(i=r.primitive||null!==n?t.skip(n):this._skipUntilEnd(t,e),t.isError(i))return i;if("end"===r.tagStr)break}},VD.prototype._decodeList=function(t,e,r,n){const i=[];for(;!t.isEmpty();){const e=this._peekTag(t,"end");if(t.isError(e))return e;const o=r.decode(t,"der",n);if(t.isError(o)&&e)break;i.push(o)}return i},VD.prototype._decodeStr=function(t,e){if("bitstr"===e){const e=t.readUInt8();return t.isError(e)?e:{unused:e,data:t.raw()}}if("bmpstr"===e){const e=t.raw();if(e.length%2==1)return t.error("Decoding of string type: bmpstr length mismatch");let r="";for(let t=0;t<e.length/2;t++)r+=String.fromCharCode(e.readUInt16BE(2*t));return r}if("numstr"===e){const e=t.raw().toString("ascii");return this._isNumstr(e)?e:t.error("Decoding of string type: numstr unsupported characters")}if("octstr"===e)return t.raw();if("objDesc"===e)return t.raw();if("printstr"===e){const e=t.raw().toString("ascii");return this._isPrintstr(e)?e:t.error("Decoding of string type: printstr unsupported characters")}return/str$/.test(e)?t.raw().toString():t.error("Decoding of string type: "+e+" unsupported")},VD.prototype._decodeObjid=function(t,e,r){let n;const i=[];let o=0,s=0;for(;!t.isEmpty();)s=t.readUInt8(),o<<=7,o|=127&s,128&s||(i.push(o),o=0);128&s&&i.push(o);const a=i[0]/40|0,u=i[0]%40;if(n=r?i:[a,u].concat(i.slice(1)),e){let t=e[n.join(" ")];void 0===t&&(t=e[n.join(".")]),void 0!==t&&(n=t)}return n},VD.prototype._decodeTime=function(t,e){const r=t.raw().toString();let n,i,o,s,a,u;if("gentime"===e)n=0|r.slice(0,4),i=0|r.slice(4,6),o=0|r.slice(6,8),s=0|r.slice(8,10),a=0|r.slice(10,12),u=0|r.slice(12,14);else{if("utctime"!==e)return t.error("Decoding "+e+" time is not supported yet");n=0|r.slice(0,2),i=0|r.slice(2,4),o=0|r.slice(4,6),s=0|r.slice(6,8),a=0|r.slice(8,10),u=0|r.slice(10,12),n=n<70?2e3+n:1900+n}return Date.UTC(n,i-1,o,s,a,u,0)},VD.prototype._decodeNull=function(){return null},VD.prototype._decodeBool=function(t){const e=t.readUInt8();return t.isError(e)?e:0!==e},VD.prototype._decodeInt=function(t,e){const r=t.raw();let n=new FD(r);return e&&(n=e[n.toString(10)]||n),n},VD.prototype._use=function(t,e){return"function"==typeof t&&(t=t(e)),t._getDecoder("der").tree};const ZD=ri,YD=sD.Buffer,XD=GD;function $D(t){XD.call(this,t),this.enc="pem"}ZD($D,XD);var QD=$D;$D.prototype.decode=function(t,e){const r=t.toString().split(/[\r\n]+/g),n=e.label.toUpperCase(),i=/^-----(BEGIN|END) ([^-]+)-----$/;let o=-1,s=-1;for(let t=0;t<r.length;t++){const e=r[t].match(i);if(null!==e&&e[2]===n){if(-1!==o){if("END"!==e[1])break;s=t;break}if("BEGIN"!==e[1])break;o=t}}if(-1===o||-1===s)throw new Error("PEM section not found for: "+n);const a=r.slice(o+1,s).join("");a.replace(/[^a-z0-9+/=]+/gi,"");const u=YD.from(a,"base64");return XD.prototype.decode.call(this,u,e)},function(t){const e=t;e.der=GD,e.pem=QD}(DD),function(t){const e=eD,r=DD,n=ri;function i(t,e){this.name=t,this.body=e,this.decoders={},this.encoders={}}t.define=function(t,e){return new i(t,e)},i.prototype._createNamed=function(t){const e=this.name;function r(t){this._initNamed(t,e)}return n(r,t),r.prototype._initNamed=function(e,r){t.call(this,e,r)},new r(this)},i.prototype._getDecoder=function(t){return t=t||"der",this.decoders.hasOwnProperty(t)||(this.decoders[t]=this._createNamed(r[t])),this.decoders[t]},i.prototype.decode=function(t,e,r){return this._getDecoder(e).decode(t,r)},i.prototype._getEncoder=function(t){return t=t||"der",this.encoders.hasOwnProperty(t)||(this.encoders[t]=this._createNamed(e[t])),this.encoders[t]},i.prototype.encode=function(t,e,r){return this._getEncoder(e).encode(t,r)}}(tD);var tU={};!function(t){const e=t;e.Reporter=aD.Reporter,e.DecoderBuffer=fD.DecoderBuffer,e.EncoderBuffer=fD.EncoderBuffer,e.Node=MD}(tU);var eU={};!function(t){const e=t;e._reverse=function(t){const e={};return Object.keys(t).forEach(function(r){(0|r)==r&&(r|=0);const n=t[r];e[n]=r}),e},e.der=kD}(eU),function(t){const e=t;e.bignum=pd,e.define=tD.define,e.base=tU,e.constants=eU,e.decoders=DD,e.encoders=eD}(Qj);var rU=e&&e.__createBinding||(Object.create?function(t,e,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);i&&!("get"in i?!e.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}:function(t,e,r,n){void 0===n&&(n=r),t[n]=e[r]}),nU=e&&e.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),iU=e&&e.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)"default"!==r&&Object.prototype.hasOwnProperty.call(t,r)&&rU(e,t,r);return nU(e,t),e};Object.defineProperty($j,"__esModule",{value:!0}),$j.jwkTopem=$j.pemTojwk=void 0;const oU=iU(Qj);function sU(t){return _.from(t,"hex").toString("base64").replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}var aU=oU.define("RSAPublicKey",function(){this.seq().obj(this.key("n").int(),this.key("e").int())}),uU=oU.define("AlgorithmIdentifier",function(){this.seq().obj(this.key("algorithm").objid(),this.key("parameters").optional().any())}),hU=oU.define("PublicKeyInfo",function(){this.seq().obj(this.key("algorithm").use(uU),this.key("publicKey").bitstr())}),cU=oU.define("Version",function(){this.int({0:"two-prime",1:"multi"})}),fU=oU.define("OtherPrimeInfos",function(){this.seq().obj(this.key("ri").int(),this.key("di").int(),this.key("ti").int())}),lU=oU.define("RSAPrivateKey",function(){this.seq().obj(this.key("version").use(cU),this.key("n").int(),this.key("e").int(),this.key("d").int(),this.key("p").int(),this.key("q").int(),this.key("dp").int(),this.key("dq").int(),this.key("qi").int(),this.key("other").optional().use(fU))}),dU=oU.define("PrivateKeyInfo",function(){this.seq().obj(this.key("version").use(cU),this.key("algorithm").use(uU),this.key("privateKey").bitstr())});function pU(t,e){return e=e||{},Object.keys(e).forEach(function(r){t[r]=e[r]}),t}function mU(t){return t.length%2==1?"0"+t:t}function gU(t,e){var r=aU.decode(t,"der"),n=mU(r.e.toString(16));return pU({kty:"RSA",n:wU(r.n),e:sU(n)},e)}function yU(t,e){var r=lU.decode(t,"der"),n=mU(r.e.toString(16));return pU({kty:"RSA",n:wU(r.n),e:sU(n),d:wU(r.d),p:wU(r.p),q:wU(r.q),dp:wU(r.dp),dq:wU(r.dq),qi:wU(r.qi)},e)}function bU(t,e){return gU(hU.decode(t,"der").publicKey.data,e)}function vU(t,e){return yU(dU.decode(t,"der").privateKey.data,e)}function wU(t){return sU(mU(t.toString(16)))}function _U(t){return/^[0-9]+$/.test(t)?new oU.bignum(t,10):function(t){return new oU.bignum(_.from(t,"base64"))}(t)}$j.pemTojwk=function(t,e){var r=t.toString().split(/(\r\n|\r|\n)+/g),n=function(t){var e=/^-----BEGIN (RSA )?(PUBLIC|PRIVATE) KEY-----$/.exec(t);if(!e)return null;var r=!!e[1];return"PRIVATE"===e[2]?r?yU:vU:r?gU:bU}((r=r.filter(function(t){return 0!==t.trim().length}))[0]);return r=r.slice(1,-1).join(""),n(_.from(r.replace(/[^\w\d\+\/=]+/g,""),"base64"),e)},$j.jwkTopem=function(t){var e=function(t){return{n:_U(t.n),e:_U(t.e),d:t.d&&_U(t.d),p:t.p&&_U(t.p),q:t.q&&_U(t.q),dp:t.dp&&_U(t.dp),dq:t.dq&&_U(t.dq),qi:t.qi&&_U(t.qi)}}(t),r=!!e.d,n=r?"PRIVATE":"PUBLIC",i="-----BEGIN RSA "+n+" KEY-----\n",o="\n-----END RSA "+n+" KEY-----\n",s=_.alloc(0);return r?(e.version="two-prime",s=lU.encode(e,"der")):s=aU.encode(e,"der"),i+s.toString("base64").match(/.{1,64}/g).join("\n")+o};var EU=e&&e.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(nw,"__esModule",{value:!0});const AU=EU(iw),MU=$j,SU=EU(jl),kU=EU(DO);class xU extends AU.default{constructor(t){super(MU.jwkTopem(t),t.n),this.jwk=t}get publicKey(){return SU.default.toBuffer(this.pk)}sign(t){return kU.default.crypto.sign(this.jwk,t)}static async verify(t,e,r){return await kU.default.crypto.verify(t,e,r)}}nw.default=xU;var TU={},RU=e&&e.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(TU,"__esModule",{value:!0});const BU=RU(Gl);class NU extends BU.default{}TU.default=NU;var PU={},IU=yg.Buffer;var OU=function(t){if(t.length>=255)throw new TypeError("Alphabet too long");for(var e=new Uint8Array(256),r=0;r<e.length;r++)e[r]=255;for(var n=0;n<t.length;n++){var i=t.charAt(n),o=i.charCodeAt(0);if(255!==e[o])throw new TypeError(i+" is ambiguous");e[o]=n}var s=t.length,a=t.charAt(0),u=Math.log(s)/Math.log(256),h=Math.log(256)/Math.log(s);function c(t){if("string"!=typeof t)throw new TypeError("Expected String");if(0===t.length)return IU.alloc(0);for(var r=0,n=0,i=0;t[r]===a;)n++,r++;for(var o=(t.length-r)*u+1>>>0,h=new Uint8Array(o);r<t.length;){var c=t.charCodeAt(r);if(c>255)return;var f=e[c];if(255===f)return;for(var l=0,d=o-1;(0!==f||l<i)&&-1!==d;d--,l++)f+=s*h[d]>>>0,h[d]=f%256>>>0,f=f/256>>>0;if(0!==f)throw new Error("Non-zero carry");i=l,r++}for(var p=o-i;p!==o&&0===h[p];)p++;var m=IU.allocUnsafe(n+(o-p));m.fill(0,0,n);for(var g=n;p!==o;)m[g++]=h[p++];return m}return{encode:function(e){if((Array.isArray(e)||e instanceof Uint8Array)&&(e=IU.from(e)),!IU.isBuffer(e))throw new TypeError("Expected Buffer");if(0===e.length)return"";for(var r=0,n=0,i=0,o=e.length;i!==o&&0===e[i];)i++,r++;for(var u=(o-i)*h+1>>>0,c=new Uint8Array(u);i!==o;){for(var f=e[i],l=0,d=u-1;(0!==f||l<n)&&-1!==d;d--,l++)f+=256*c[d]>>>0,c[d]=f%s>>>0,f=f/s>>>0;if(0!==f)throw new Error("Non-zero carry");n=l,i++}for(var p=u-n;p!==u&&0===c[p];)p++;for(var m=a.repeat(r);p<u;++p)m+=t.charAt(c[p]);return m},decodeUnsafe:c,decode:function(t){var e=c(t);if(e)return e;throw new Error("Non-base"+s+" character")}}},CU=OU("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"),LU=e&&e.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(PU,"__esModule",{value:!0});const jU=LU(Tl),DU=LU(CU);class UU extends jU.default{get publicKey(){return DU.default.decode(this.pk)}get key(){return DU.default.decode(this._key)}constructor(t){const e=DU.default.decode(t);super(DU.default.encode(e.subarray(0,32)),DU.default.encode(e.subarray(32,64)))}}PU.default=UU;var FU={};Object.defineProperty(FU,"__esModule",{value:!0});const zU=Zv,qU=Fl;FU.default=class{constructor(t){this.ownerLength=qU.SIG_CONFIG[qU.SignatureConfig.ETHEREUM].pubLength,this.signatureLength=qU.SIG_CONFIG[qU.SignatureConfig.ETHEREUM].sigLength,this.signatureType=qU.SignatureConfig.ETHEREUM,this.signer=t.getSigner()}async setPublicKey(){const t="sign this message to get public key",e=await this.signer.signMessage(t),r=await zU.ethers.utils.hashMessage(t),n=zU.ethers.utils.recoverPublicKey(zU.ethers.utils.arrayify(r),e);this.publicKey=_.from(zU.ethers.utils.arrayify(n))}async sign(t){this.publicKey||await this.setPublicKey();let e="";if(window.ethereum&&window.ethereum.isSafeheron){const r=new zU.ethers.providers.Web3Provider(window.ethereum),n=await r.getSigner().getAddress(),i=zU.ethers.utils.hashMessage(t);e=await r.send("eth_sign",[n,i])}else e=await this.signer.signMessage(t);return _.from(e.slice(2),"hex")}static verify(t,e,r){const n=zU.ethers.utils.computeAddress(t);return zU.ethers.utils.verifyMessage(e,r)===n}};var HU={},KU=e&&e.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(HU,"__esModule",{value:!0});const GU=Fl,VU=KU(DO),WU=KU(jl),JU=async(t,e)=>{let r=[];const n=(i=e,"[object String]"===Object.prototype.toString.call(i)?[e]:e);var i;try{r=await t.getPermissions()}catch{throw new Error("PLEASE_INSTALL_ARCONNECT")}0!==n.length&&n.some(t=>!r.includes(t))&&await t.connect(n)};HU.default=class{constructor(t){this.ownerLength=GU.SIG_CONFIG[GU.SignatureConfig.ARWEAVE].pubLength,this.signatureLength=GU.SIG_CONFIG[GU.SignatureConfig.ARWEAVE].sigLength,this.signatureType=GU.SignatureConfig.ARWEAVE,this.signer=t}async setPublicKey(){try{await JU(this.signer,["ACCESS_PUBLIC_KEY"])}catch{throw new Error("ACCESS_PUBLIC_KEY_PERMISSION_NEEDED")}const t=await this.signer.getActivePublicKey();this.publicKey=WU.default.toBuffer(t)}async sign(t){this.publicKey||await this.setPublicKey();try{await JU(this.signer,"SIGNATURE")}catch{throw new Error("SIGNATURE_PERMISSION_NEEDED")}const e={name:"RSA-PSS",saltLength:0};try{const r=await this.signer.signature(t,e);return new Uint8Array(Object.values(r))}catch{throw new Error("SIGNATURE_FAILED")}}static async verify(t,e,r){return await VU.default.crypto.verify(t,e,r)}};var ZU={},YU=e&&e.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(ZU,"__esModule",{value:!0});const XU=Dl,$U=YU(jl),QU=Fl;ZU.default=class{constructor(t){this.ownerLength=QU.SIG_CONFIG[2].pubLength,this.signatureLength=QU.SIG_CONFIG[2].sigLength,this.signatureType=2,this.provider=t,this._publicKey=this.provider.publicKey.toBuffer()}get publicKey(){return this._publicKey}async sign(t){if(!this.provider.signMessage)throw new Error("Selected Wallet does not support message signing");return await this.provider.signMessage(t)}static async verify(t,e,r){let n=t;return"string"==typeof t&&(n=$U.default.toBuffer(t)),XU.verify(_.from(r),_.from(e),_.from(n))}};var tF={},eF=e&&e.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(tF,"__esModule",{value:!0});const rF=eF(PU);class nF extends rF.default{constructor(t){super(t.replace("ed25519:",""))}}tF.default=nF;var iF={},oF=e&&e.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(iF,"__esModule",{value:!0});const sF=oF(Tl);class aF extends sF.default{get publicKey(){return _.from(this.pk)}get key(){return _.from(this._key)}constructor(t,e){super(t.subarray(0,32),e)}}iF.default=aF;var uF={},hF=e&&e.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(uF,"__esModule",{value:!0});const cF=hF(ZU);let fF=class extends cF.default{constructor(t){super(t),this.signatureType=4}async sign(t){return super.sign(_.from(_.from(t).toString("hex")))}static async verify(t,e,r){return super.verify(t,_.from(_.from(e).toString("hex")),r)}};uF.default=fF;var lF={},dF=e&&e.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(lF,"__esModule",{value:!0});const pF=dF(PU);class mF extends pF.default{constructor(t){super(t),this.signatureType=4}async sign(t){return super.sign(_.from(_.from(t).toString("hex")))}static async verify(t,e,r){return super.verify(t,_.from(_.from(e).toString("hex")),r)}}lF.default=mF,function(t){var r=e&&e.__createBinding||(Object.create?function(t,e,r,n){void 0===n&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){void 0===n&&(n=r),t[n]=e[r]}),n=e&&e.__exportStar||function(t,e){for(var n in t)"default"===n||Object.prototype.hasOwnProperty.call(e,n)||r(e,t,n)},i=e&&e.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(t,"__esModule",{value:!0}),t.HexSolanaSigner=t.HexInjectedSolanaSigner=t.AlgorandSigner=t.NearSigner=t.InjectedArweaveSigner=t.InjectedEthereumSigner=t.PolygonSigner=t.ArweaveSigner=t.InjectedSolanaSigner=void 0;const o=i(nw);t.ArweaveSigner=o.default,n(Gl,t);const s=i(TU);t.PolygonSigner=s.default,n(PU,t);const a=i(FU);t.InjectedEthereumSigner=a.default;const u=i(HU);t.InjectedArweaveSigner=u.default;var h=ZU;Object.defineProperty(t,"InjectedSolanaSigner",{enumerable:!0,get:function(){return i(h).default}});var c=tF;Object.defineProperty(t,"NearSigner",{enumerable:!0,get:function(){return i(c).default}});var f=iF;Object.defineProperty(t,"AlgorandSigner",{enumerable:!0,get:function(){return i(f).default}});var l=uF;Object.defineProperty(t,"HexInjectedSolanaSigner",{enumerable:!0,get:function(){return i(l).default}});var d=lF;Object.defineProperty(t,"HexSolanaSigner",{enumerable:!0,get:function(){return i(d).default}})}(rw);var gF=e&&e.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(xl,"__esModule",{value:!0}),xl.indexToType=void 0;const yF=gF(Tl),bF=gF(Gl),vF=rw;xl.indexToType={1:vF.ArweaveSigner,2:yF.default,3:bF.default,4:vF.HexInjectedSolanaSigner};var wF={};!function(t){var r=e&&e.__createBinding||(Object.create?function(t,e,r,n){void 0===n&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){void 0===n&&(n=r),t[n]=e[r]}),n=e&&e.__exportStar||function(t,e){for(var n in t)"default"===n||Object.prototype.hasOwnProperty.call(e,n)||r(e,t,n)};Object.defineProperty(t,"__esModule",{value:!0}),n(iw,t)}(wF),function(t){var r=e&&e.__createBinding||(Object.create?function(t,e,r,n){void 0===n&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){void 0===n&&(n=r),t[n]=e[r]}),n=e&&e.__exportStar||function(t,e){for(var n in t)"default"===n||Object.prototype.hasOwnProperty.call(e,n)||r(e,t,n)};Object.defineProperty(t,"__esModule",{value:!0}),n(kl,t),n(xl,t),n(wF,t),n(rw,t)}(Sl);var _F={},EF={},AF={},MF={},SF=e&&e.__createBinding||(Object.create?function(t,e,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);i&&!("get"in i?!e.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}:function(t,e,r,n){void 0===n&&(n=r),t[n]=e[r]}),kF=e&&e.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),xF=e&&e.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)"default"!==r&&Object.prototype.hasOwnProperty.call(t,r)&&SF(e,t,r);return kF(e,t),e};Object.defineProperty(MF,"__esModule",{value:!0}),MF.b64UrlDecode=MF.b64UrlEncode=MF.bufferTob64Url=MF.bufferTob64=MF.b64UrlToBuffer=MF.stringToB64Url=MF.stringToBuffer=MF.bufferToString=MF.b64UrlToString=MF.concatBuffers=void 0;const TF=xF($L);function RF(t){if("undefined"==typeof TextDecoder){return new(0,Jm.TextDecoder)("utf-8",{fatal:!0}).decode(t)}return new TextDecoder("utf-8",{fatal:!0}).decode(t)}function BF(t){if("undefined"==typeof TextEncoder){return(new(0,Jm.TextEncoder)).encode(t)}return(new TextEncoder).encode(t)}function NF(t){return new Uint8Array(TF.toByteArray(CF(t)))}function PF(t){return TF.fromByteArray(new Uint8Array(t))}function IF(t){return OF(PF(t))}function OF(t){return t.replace(/\+/g,"-").replace(/\//g,"_").replace(/\=/g,"")}function CF(t){let e;return e=(t=t.replace(/\-/g,"+").replace(/\_/g,"/")).length%4==0?0:4-t.length%4,t.concat("=".repeat(e))}MF.concatBuffers=function(t){let e=0;for(let r=0;r<t.length;r++)e+=t[r].byteLength;let r=new Uint8Array(e),n=0;r.set(new Uint8Array(t[0]),n),n+=t[0].byteLength;for(let e=1;e<t.length;e++)r.set(new Uint8Array(t[e]),n),n+=t[e].byteLength;return r},MF.b64UrlToString=function(t){return RF(NF(t))},MF.bufferToString=RF,MF.stringToBuffer=BF,MF.stringToB64Url=function(t){return IF(BF(t))},MF.b64UrlToBuffer=NF,MF.bufferTob64=PF,MF.bufferTob64Url=IF,MF.b64UrlEncode=OF,MF.b64UrlDecode=CF;var LF={};Object.defineProperty(LF,"__esModule",{value:!0}),LF.isBrowser=LF.arraybufferEqual=LF.byteArrayToLong=LF.longTo32ByteArray=LF.longTo16ByteArray=LF.shortTo2ByteArray=LF.longTo8ByteArray=void 0,LF.longTo8ByteArray=function(t){const e=[0,0,0,0,0,0,0,0];for(let r=0;r<e.length;r++){const n=255&t;e[r]=n,t=(t-n)/256}return Uint8Array.from(e)},LF.shortTo2ByteArray=function(t){if(t>29)throw new Error("Short too long");const e=[0,0];for(let r=0;r<e.length;r++){const n=255&t;e[r]=n,t=(t-n)/256}return Uint8Array.from(e)},LF.longTo16ByteArray=function(t){const e=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];for(let r=0;r<e.length;r++){const n=255&t;e[r]=n,t=(t-n)/256}return e},LF.longTo32ByteArray=function(t){const e=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];for(let r=0;r<e.length;r++){const n=255&t;e[r]=n,t=(t-n)/256}return Uint8Array.from(e)},LF.byteArrayToLong=function(t){let e=0;for(let r=t.length-1;r>=0;r--)e=256*e+t[r];return e},LF.arraybufferEqual=function(t,e){const r=t.buffer,n=e.buffer;if(r===n)return!0;if(r.byteLength!==n.byteLength)return!1;const i=new DataView(r),o=new DataView(n);let s=r.byteLength;for(;s--;)if(i.getUint8(s)!==o.getUint8(s))return!1;return!0},LF.isBrowser="undefined"!=typeof window&&void 0!==window.document;var jF={},DF=e&&e.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(jF,"__esModule",{value:!0}),jF.hashStream=jF.deepHashChunks=jF.deepHash=void 0;const UF=DF(DO),FF=ow;async function zF(t){if("function"==typeof t[Symbol.asyncIterator]){const e=t,r=FF.createHash("sha384");let n=0;for await(const t of e)n+=t.byteLength,r.update(t);const i=UF.default.utils.concatBuffers([UF.default.utils.stringToBuffer("blob"),UF.default.utils.stringToBuffer(n.toString())]),o=UF.default.utils.concatBuffers([await UF.default.crypto.hash(i,"SHA-384"),r.digest()]);return await UF.default.crypto.hash(o,"SHA-384")}if(Array.isArray(t)){const e=UF.default.utils.concatBuffers([UF.default.utils.stringToBuffer("list"),UF.default.utils.stringToBuffer(t.length.toString())]);return await qF(t,await UF.default.crypto.hash(e,"SHA-384"))}const e=t,r=UF.default.utils.concatBuffers([UF.default.utils.stringToBuffer("blob"),UF.default.utils.stringToBuffer(e.byteLength.toString())]),n=UF.default.utils.concatBuffers([await UF.default.crypto.hash(r,"SHA-384"),await UF.default.crypto.hash(e,"SHA-384")]);return await UF.default.crypto.hash(n,"SHA-384")}async function qF(t,e){if(t.length<1)return e;const r=UF.default.utils.concatBuffers([e,await zF(t[0])]),n=await UF.default.crypto.hash(r,"SHA-384");return await qF(t.slice(1),n)}jF.deepHash=zF,jF.deepHashChunks=qF,jF.hashStream=async function(t){const e=FF.createHash("sha384");for await(const r of t)e.update(r);return e.digest()};var HF=e&&e.__createBinding||(Object.create?function(t,e,r,n){void 0===n&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){void 0===n&&(n=r),t[n]=e[r]}),KF=e&&e.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),GF=e&&e.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)"default"!==r&&Object.prototype.hasOwnProperty.call(t,r)&&HF(e,t,r);return KF(e,t),e};Object.defineProperty(AF,"__esModule",{value:!0}),AF.getSignatureData=void 0;const VF=MF,WF=LF,JF=jF;AF.getSignatureData=async function(t){if(WF.isBrowser){return(await Promise.resolve().then(()=>GF(Aj()))).default([VF.stringToBuffer("dataitem"),VF.stringToBuffer("1"),VF.stringToBuffer(t.signatureType.toString()),t.rawOwner,t.rawTarget,t.rawAnchor,t.rawTags,t.rawData])}return JF.deepHash([VF.stringToBuffer("dataitem"),VF.stringToBuffer("1"),VF.stringToBuffer(t.signatureType.toString()),t.rawOwner,t.rawTarget,t.rawAnchor,t.rawTags,t.rawData])};var ZF={},YF={},XF={},$F=Ul,QF=Jm,tz=new iz(4096);function ez(t){return"function"==typeof _.alloc?_.alloc(t):new _(t)}function rz(t,e){return"function"==typeof _.from?_.from(t,e):new _(t,e)}function nz(t){return t.charAt(0).toUpperCase()+t.slice(1)}function iz(t){this._len=0|t,this._pos=0,this._slab=ez(this._len)}function oz(t){var e=Math.pow(2,31),r=Math.floor(t||Math.random()*(e-1));this._max=e,this._nextInt=function(){return r=(1103515245*r+12345)%e}}function sz(){this._index=0,this._items=[]}function az(t,e){if(this.buf=t,this.pos=0|e,this.pos<0)throw new Error("negative offset")}function uz(t,e){for(;e--;)t[e]=~t[e]}iz.prototype.alloc=function(t){var e=this._len;return t>e?ez(t):(this._pos+t>e&&(this._slab=ez(e),this._pos=0),this._slab.slice(this._pos,this._pos+=t))},oz.prototype.nextBoolean=function(){return!!(this._nextInt()%2)},oz.prototype.nextInt=function(t,e){return void 0===e&&(e=t,t=0),e=void 0===e?this._max:e,t+Math.floor(this.nextFloat()*(e-t))},oz.prototype.nextFloat=function(t,e){return void 0===e&&(e=t,t=0),t+((e=void 0===e?1:e)-t)*this._nextInt()/this._max},oz.prototype.nextString=function(t,e){t|=0;var r="";(e=e||"aA").indexOf("a")>-1&&(r+="abcdefghijklmnopqrstuvwxyz"),e.indexOf("A")>-1&&(r+="ABCDEFGHIJKLMNOPQRSTUVWXYZ"),e.indexOf("#")>-1&&(r+="0123456789"),e.indexOf("!")>-1&&(r+="~`!@#$%^&*()_+-={}[]:\";'<>?,./|\\");for(var n=[],i=0;i<t;i++)n.push(this.choice(r));return n.join("")},oz.prototype.nextBuffer=function(t){var e,r=[];for(e=0;e<t;e++)r.push(this.nextInt(256));return rz(r)},oz.prototype.choice=function(t){var e=t.length;if(!e)throw new Error("choosing from empty array");return t[this.nextInt(e)]},sz.prototype.push=function(t){var e,r=this._items,n=0|r.length;for(r.push(t);n>0&&r[n].index<r[e=n-1>>1].index;)t=r[n],r[n]=r[e],r[e]=t,n=e},sz.prototype.pop=function(){var t=this._items,e=t.length-1|0,r=t[0];if(!r||r.index>this._index)return null;if(this._index++,!e)return t.pop(),r;t[0]=t.pop();for(var n,i,o,s,a,u,h,c=e>>1,f=0;f<c&&(s=t[f],i=f+1<<1,u=t[n=1+(f<<1)],!(h=t[i])||u.index<=h.index?(a=u,o=n):(a=h,o=i),!(a.index>=s.index));)t[o]=s,t[f]=a,f=o;return r},az.prototype.isValid=function(){return this.pos<=this.buf.length},az.prototype.readBoolean=function(){return!!this.buf[this.pos++]},az.prototype.skipBoolean=function(){this.pos++},az.prototype.writeBoolean=function(t){this.buf[this.pos++]=!!t},az.prototype.readInt=az.prototype.readLong=function(){var t,e,r,n,i=0,o=0,s=this.buf;do{e=128&(t=s[this.pos++]),i|=(127&t)<<o,o+=7}while(e&&o<28);if(e){r=i,n=268435456;do{r+=(127&(t=s[this.pos++]))*n,n*=128}while(128&t);return(r%2?-(r+1):r)/2}return i>>1^-(1&i)},az.prototype.skipInt=az.prototype.skipLong=function(){for(var t=this.buf;128&t[this.pos++];);},az.prototype.writeInt=az.prototype.writeLong=function(t){var e,r,n=this.buf;if(t>=-1073741824&&t<1073741824){r=t>=0?t<<1:~t<<1|1;do{n[this.pos]=127&r,r>>=7}while(r&&(n[this.pos++]|=128))}else{e=t>=0?2*t:2*-t-1;do{n[this.pos]=127&e,e/=128}while(e>=1&&(n[this.pos++]|=128))}this.pos++},az.prototype.readFloat=function(){var t=this.buf,e=this.pos;if(this.pos+=4,!(this.pos>t.length))return this.buf.readFloatLE(e)},az.prototype.skipFloat=function(){this.pos+=4},az.prototype.writeFloat=function(t){var e=this.buf,r=this.pos;if(this.pos+=4,!(this.pos>e.length))return this.buf.writeFloatLE(t,r)},az.prototype.readDouble=function(){var t=this.buf,e=this.pos;if(this.pos+=8,!(this.pos>t.length))return this.buf.readDoubleLE(e)},az.prototype.skipDouble=function(){this.pos+=8},az.prototype.writeDouble=function(t){var e=this.buf,r=this.pos;if(this.pos+=8,!(this.pos>e.length))return this.buf.writeDoubleLE(t,r)},az.prototype.readFixed=function(t){var e=this.pos;if(this.pos+=t,!(this.pos>this.buf.length)){var r=tz.alloc(t);return this.buf.copy(r,0,e,e+t),r}},az.prototype.skipFixed=function(t){this.pos+=t},az.prototype.writeFixed=function(t,e){e=e||t.length;var r=this.pos;this.pos+=e,this.pos>this.buf.length||t.copy(this.buf,r,0,e)},az.prototype.readBytes=function(){return this.readFixed(this.readLong())},az.prototype.skipBytes=function(){var t=this.readLong();this.pos+=t},az.prototype.writeBytes=function(t){var e=t.length;this.writeLong(e),this.writeFixed(t,e)},"function"==typeof _.prototype.utf8Slice?az.prototype.readString=function(){var t=this.readLong(),e=this.pos,r=this.buf;if(this.pos+=t,!(this.pos>r.length))return this.buf.utf8Slice(e,e+t)}:az.prototype.readString=function(){var t=this.readLong(),e=this.pos,r=this.buf;if(this.pos+=t,!(this.pos>r.length))return this.buf.slice(e,e+t).toString()},az.prototype.skipString=function(){var t=this.readLong();this.pos+=t},az.prototype.writeString=function(t){var e=_.byteLength(t),r=this.buf;this.writeLong(e);var n,i,o,s,a=this.pos;if(this.pos+=e,!(this.pos>r.length))if(e>64)this._writeUtf8(t,e);else for(n=0,i=e;n<i;n++)(o=t.charCodeAt(n))<128?r[a++]=o:o<2048?(r[a++]=o>>6|192,r[a++]=63&o|128):55296==(64512&o)&&56320==(64512&(s=t.charCodeAt(n+1)))?(o=65536+((1023&o)<<10)+(1023&s),n++,r[a++]=o>>18|240,r[a++]=o>>12&63|128,r[a++]=o>>6&63|128,r[a++]=63&o|128):(r[a++]=o>>12|224,r[a++]=o>>6&63|128,r[a++]=63&o|128)},"function"==typeof _.prototype.utf8Write?az.prototype._writeUtf8=function(t,e){this.buf.utf8Write(t,this.pos-e,e)}:az.prototype._writeUtf8=function(t,e){this.buf.write(t,this.pos-e,e,"utf8")},"function"==typeof _.prototype.latin1Write?az.prototype.writeBinary=function(t,e){var r=this.pos;this.pos+=e,this.pos>this.buf.length||this.buf.latin1Write(t,r,e)}:"function"==typeof _.prototype.binaryWrite?az.prototype.writeBinary=function(t,e){var r=this.pos;this.pos+=e,this.pos>this.buf.length||this.buf.binaryWrite(t,r,e)}:az.prototype.writeBinary=function(t,e){var r=this.pos;this.pos+=e,this.pos>this.buf.length||this.buf.write(t,r,e,"binary")},az.prototype.matchBoolean=function(t){return this.buf[this.pos++]-t.buf[t.pos++]},az.prototype.matchInt=az.prototype.matchLong=function(t){var e=this.readLong(),r=t.readLong();return e===r?0:e<r?-1:1},az.prototype.matchFloat=function(t){var e=this.readFloat(),r=t.readFloat();return e===r?0:e<r?-1:1},az.prototype.matchDouble=function(t){var e=this.readDouble(),r=t.readDouble();return e===r?0:e<r?-1:1},az.prototype.matchFixed=function(t,e){return this.readFixed(e).compare(t.readFixed(e))},az.prototype.matchBytes=az.prototype.matchString=function(t){var e=this.readLong(),r=this.pos;this.pos+=e;var n=t.readLong(),i=t.pos;t.pos+=n;var o=this.buf.slice(r,this.pos),s=t.buf.slice(i,t.pos);return o.compare(s)},az.prototype.unpackLongBytes=function(){var t,e,r=ez(8),n=0,i=0,o=6,s=this.buf;for(e=1&(t=s[this.pos++]),r.fill(0),n|=(127&t)>>1;128&t;)n|=(127&(t=s[this.pos++]))<<o,(o+=7)>=8&&(o-=8,r[i++]=n,n>>=8);return r[i]=n,e&&uz(r,8),r},az.prototype.packLongBytes=function(t){var e,r=(128&t[7])>>7,n=this.buf,i=1,o=0,s=3;r?(uz(t,8),e=1):e=0;for(var a=[t.readUIntLE(0,3),t.readUIntLE(3,3),t.readUIntLE(6,2)];s&&!a[--s];);for(;o<s;)for(e|=a[o++]<<i,i+=24;i>7;)n[this.pos++]=127&e|128,e>>=7,i-=7;e|=a[s]<<i;do{n[this.pos]=127&e,e>>=7}while(e&&(n[this.pos++]|=128));this.pos++,r&&uz(t,8)};var hz={abstractFunction:function(){throw new Error("abstract")},addDeprecatedGetters:function(t,e){var r,n,i,o,s=t.prototype;for(r=0,n=e.length;r<n;r++)s[o="get"+nz(i=e[r])]=QF.deprecate(a(i),"use `."+i+"` instead of `."+o+"()`");function a(t){return function(){var e=this[t];return"function"==typeof e?e.apply(this,arguments):e}}},bufferFrom:rz,capitalize:nz,copyOwnProperties:function(t,e,r){var n,i,o,s=Object.getOwnPropertyNames(t);for(n=0,i=s.length;n<i;n++)if(o=s[n],!e.hasOwnProperty(o)||r){var a=Object.getOwnPropertyDescriptor(t,o);Object.defineProperty(e,o,a)}return e},getHash:function(t,e){e=e||"md5";var r=$F.createHash(e);return r.end(t),r.read()},compare:function(t,e){return t===e?0:t<e?-1:1},getOption:function(t,e,r){var n=t[e];return void 0===n?r:n},jsonEnd:function(t,e){e|=0;var r=t.charAt(e++);if(/[\d-]/.test(r)){for(;/[eE\d.+-]/.test(t.charAt(e));)e++;return e}if(/true|null/.test(t.slice(e-1,e+3)))return e+3;if(/false/.test(t.slice(e-1,e+4)))return e+4;var n=0,i=!1;do{switch(r){case"{":case"[":i||n++;break;case"}":case"]":if(!i&&! --n)return e;break;case'"':if(i=!i,!n&&!i)return e;break;case"\\":e++}}while(r=t.charAt(e++));return-1},newBuffer:ez,objectValues:function(t){return Object.keys(t).map(function(e){return t[e]})},toMap:function(t,e){var r,n,i={};for(r=0;r<t.length;r++)i[e(n=t[r])]=n;return i},singleIndexOf:function(t,e){var r,n,i=-1;if(!t)return-1;for(r=0,n=t.length;r<n;r++)if(t[r]===e){if(i>=0)return-2;i=r}return i},hasDuplicates:function(t,e){var r,n,i,o={};for(r=0,n=t.length;r<n;r++){if(i=t[r],e&&(i=e(i)),o[i])return!0;o[i]=!0}return!1},Lcg:oz,OrderedQueue:sz,Tap:az},cz=hz,fz=st,lz=Jm,dz=cz.Tap,pz=lz.debuglog("avsc:types"),mz=lz.format,gz={array:Dz,boolean:Sz,bytes:Nz,double:Rz,enum:Cz,error:Uz,fixed:Lz,float:Tz,int:kz,long:xz,map:jz,null:Mz,record:Uz,string:Bz},yz=/^[A-Za-z_][A-Za-z0-9_]*$/,bz=new cz.Lcg,vz=new dz(new fz.SlowBuffer(1024)),wz=null,_z=[];function Ez(t,e){var r;if(wz?(r=wz,_z.push([wz,this]),wz=null):r=this,this._hash=new Kz,this.name=void 0,this.aliases=void 0,this.doc=t&&t.doc?""+t.doc:void 0,t){var n=t.name,i=void 0===t.namespace?e&&e.namespace:t.namespace;if(void 0!==n){if(Zz(n=Wz(n,i)))throw new Error(mz("cannot rename primitive type: %j",n));var o=e&&e.registry;if(o){if(void 0!==o[n])throw new Error(mz("duplicate type name: %s",n));o[n]=r}}else if(e&&e.noAnonymousTypes)throw new Error(mz("missing name property in schema: %j",t));this.name=n,this.aliases=t.aliases?t.aliases.map(function(t){return Wz(t,i)}):[]}}function Az(t){Ez.call(this),this._branchConstructor=this._createBranchConstructor(),t||Object.freeze(this)}function Mz(){Az.call(this)}function Sz(){Az.call(this)}function kz(){Az.call(this)}function xz(){Az.call(this)}function Tz(){Az.call(this)}function Rz(){Az.call(this)}function Bz(){Az.call(this)}function Nz(){Az.call(this)}function Pz(t,e){if(Ez.call(this),!Array.isArray(t))throw new Error(mz("non-array union schema: %j",t));if(!t.length)throw new Error("empty union");this.types=Object.freeze(t.map(function(t){return Ez.forSchema(t,e)})),this._branchIndices={},this.types.forEach(function(t,e){if(Ez.isType(t,"union"))throw new Error("unions cannot be directly nested");var r=t.branchName;if(void 0!==this._branchIndices[r])throw new Error(mz("duplicate union branch name: %j",r));this._branchIndices[r]=e},this)}function Iz(t,e){Pz.call(this,t,e),this._dynamicBranches=null,this._bucketIndices={},this.types.forEach(function(t,e){if(Ez.isType(t,"abstract","logical"))this._dynamicBranches||(this._dynamicBranches=[]),this._dynamicBranches.push({index:e,type:t});else{var r=rq(t);if(void 0!==this._bucketIndices[r])throw new Error(mz("ambiguous unwrapped union: %j",this));this._bucketIndices[r]=e}},this),Object.freeze(this)}function Oz(t,e){Pz.call(this,t,e),Object.freeze(this)}function Cz(t,e){if(Ez.call(this,t,e),!Array.isArray(t.symbols)||!t.symbols.length)throw new Error(mz("invalid enum symbols: %j",t.symbols));this.symbols=Object.freeze(t.symbols.slice()),this._indices={},this.symbols.forEach(function(t,e){if(!tq(t))throw new Error(mz("invalid %s symbol: %j",this,t));if(void 0!==this._indices[t])throw new Error(mz("duplicate %s symbol: %j",this,t));this._indices[t]=e},this),this._branchConstructor=this._createBranchConstructor(),Object.freeze(this)}function Lz(t,e){if(Ez.call(this,t,e),t.size!==(0|t.size)||t.size<1)throw new Error(mz("invalid %s size",this.branchName));this.size=0|t.size,this._branchConstructor=this._createBranchConstructor(),Object.freeze(this)}function jz(t,e){if(Ez.call(this),!t.values)throw new Error(mz("missing map values: %j",t));this.valuesType=Ez.forSchema(t.values,e),this._branchConstructor=this._createBranchConstructor(),Object.freeze(this)}function Dz(t,e){if(Ez.call(this),!t.items)throw new Error(mz("missing array items: %j",t));this.itemsType=Ez.forSchema(t.items,e),this._branchConstructor=this._createBranchConstructor(),Object.freeze(this)}function Uz(t,e){var r=(e=e||{}).namespace;if(void 0!==t.namespace)e.namespace=t.namespace;else if(t.name){var n=/^(.*)\.[^.]+$/.exec(t.name);n&&(e.namespace=n[1])}if(Ez.call(this,t,e),!Array.isArray(t.fields))throw new Error(mz("non-array record fields: %j",t.fields));if(cz.hasDuplicates(t.fields,function(t){return t.name}))throw new Error(mz("duplicate field name: %j",t.fields));this._fieldsByName={},this.fields=Object.freeze(t.fields.map(function(t){var r=new qz(t,e);return this._fieldsByName[r.name]=r,r},this)),this._branchConstructor=this._createBranchConstructor(),this._isError="error"===t.type,this.recordConstructor=this._createConstructor(e.errorStackTraces),this._read=this._createReader(),this._skip=this._createSkipper(),this._write=this._createWriter(),this._check=this._createChecker(),e.namespace=r,Object.freeze(this)}function Fz(t,e){this._logicalTypeName=t.logicalType,Ez.call(this),wz=this;try{this._underlyingType=Ez.forSchema(t,e)}finally{wz=null;var r=_z.length;r&&_z[r-1][0]===this&&_z.pop()}Ez.isType(this.underlyingType,"union")?this._branchConstructor=this.underlyingType._branchConstructor:this._branchConstructor=this.underlyingType._createBranchConstructor()}function zz(t){this._concreteTypeName="long",Az.call(this,!0),this._noUnpack=!!t}function qz(t,e){var r=t.name;if("string"!=typeof r||!tq(r))throw new Error(mz("invalid field name: %s",r));this.name=r,this.type=Ez.forSchema(t.type,e),this.aliases=t.aliases||[],this.doc=void 0!==t.doc?""+t.doc:void 0,this._order=function(t){switch(t){case"ascending":return 1;case"descending":return-1;case"ignore":return 0;default:throw new Error(mz("invalid order: %j",t))}}(void 0===t.order?"ascending":t.order);var n=t.default;if(void 0!==n){var i=this.type,o=i._copy(n,{coerce:2,wrap:2});Zz(i.typeName)&&"bytes"!==i.typeName?this.defaultValue=function(){return o}:this.defaultValue=function(){return i._copy(o)}}Object.freeze(this)}function Hz(t){this._readerType=t,this._read=null,this.itemsType=null,this.size=0,this.symbols=null,this.valuesType=null}function Kz(){this.str=void 0}function Gz(t,e,r,n){if(r){if(r._readerType!==t)throw new Error("invalid resolver");return r._read(e,n)}return t._read(e)}function Vz(t){var e=t.split(".");return e[e.length-1]}function Wz(t,e){~t.indexOf(".")?t=t.replace(/^\./,""):e&&(t=e+"."+t),t.split(".").forEach(function(e){if(!tq(e))throw new Error(mz("invalid name: %j",t))});var r=Vz(t);return Zz(r)?r:t}function Jz(t){var e={};t.name&&(e[t.name]=!0);var r,n,i=t.aliases;for(r=0,n=i.length;r<n;r++)e[i[r]]=!0;return Object.keys(e)}function Zz(t){var e=gz[t];return e&&e.prototype instanceof Az}function Yz(t){if("error"===t)t="record";else{var e=/^([^:]+):(.*)$/.exec(t);e&&(t="union"===e[1]?e[2]+"Union":e[1])}return cz.capitalize(t)+"Type"}function Xz(t){var e=t.readLong();return e<0&&(e=-e,t.skipLong()),e}function $z(t){return t>=-9007199254740990&&t<=9007199254740990}function Qz(t){return t&&"Buffer"===t.type&&Array.isArray(t.data)}function tq(t){return yz.test(t)}function eq(t,e){throw new Error(mz("invalid %s: %j",e,t))}function rq(t){var e=t.typeName;switch(e){case"double":case"float":case"int":case"long":return"number";case"bytes":case"fixed":return"buffer";case"enum":return"string";case"map":case"error":case"record":return"object";default:return e}}function nq(t){if(null===t)return"null";var e=typeof t;if("object"===e){if(Array.isArray(t))return"array";if(_.isBuffer(t))return"buffer"}return e}Ez.forSchema=function(t,e){(e=e||{}).registry=e.registry||{};var r,n=function(t){switch(!0===t?t="always":!1===t?t="never":void 0===t?t="auto":"string"==typeof t&&(t=t.toLowerCase()),t){case"always":return Oz;case"never":return Iz;case"auto":return;default:throw new Error(mz("invalid wrap unions option: %j",t))}}(e.wrapUnions);if(null===t)throw new Error('invalid type: null (did you mean "null"?)');if(Ez.isType(t))return t;if(e.typeHook&&(r=e.typeHook(t,e))){if(!Ez.isType(r))throw new Error(mz("invalid typehook return value: %j",r));return r}if("string"==typeof t){if(t=Wz(t,e.namespace),r=e.registry[t])return r;if(Zz(t))return e.registry[t]=Ez.forSchema({type:t},e);throw new Error(mz("undefined type name: %s",t))}if(t.logicalType&&e.logicalTypes&&!wz){var i=e.logicalTypes[t.logicalType];if(i){var o=e.namespace,s={};Object.keys(e.registry).forEach(function(t){s[t]=e.registry[t]});try{return pz("instantiating logical type for %s",t.logicalType),new i(t,e)}catch(r){if(pz("failed to instantiate logical type for %s",t.logicalType),e.assertLogicalTypes)throw r;wz=null,e.namespace=o,e.registry=s}}}if(Array.isArray(t)){var a=t.map(function(t){return Ez.forSchema(t,e)});n||(n=function(t){var e,r,n,i,o={};for(e=0,r=t.length;e<r;e++)if(i=t[e],!Ez.isType(i,"logical")){if(o[n=rq(i)])return!0;o[n]=!0}return!1}(a)?Oz:Iz),r=new n(a,e)}else r=function(r){var n=gz[r];if(void 0===n)throw new Error(mz("unknown type: %j",r));return new n(t,e)}(t.type);return r},Ez.forValue=function(t,e){if((e=e||{}).emptyArrayType=e.emptyArrayType||Ez.forSchema({type:"array",items:"null"}),e.valueHook){var r=e.valueHook(t,e);if(void 0!==r){if(!Ez.isType(r))throw new Error(mz("invalid value hook return value: %j",r));return r}}switch(typeof t){case"string":return Ez.forSchema("string",e);case"boolean":return Ez.forSchema("boolean",e);case"number":return(0|t)===t?Ez.forSchema("int",e):Math.abs(t)<9007199254740991?Ez.forSchema("float",e):Ez.forSchema("double",e);case"object":if(null===t)return Ez.forSchema("null",e);if(Array.isArray(t))return t.length?Ez.forSchema({type:"array",items:Ez.forTypes(t.map(function(t){return Ez.forValue(t,e)}))},e):e.emptyArrayType;if(_.isBuffer(t))return Ez.forSchema("bytes",e);var n=Object.keys(t);return n.some(function(t){return!tq(t)})?Ez.forSchema({type:"map",values:Ez.forTypes(n.map(function(r){return Ez.forValue(t[r],e)}),e)},e):Ez.forSchema({type:"record",fields:n.map(function(r){return{name:r,type:Ez.forValue(t[r],e)}})},e);default:throw new Error(mz("cannot infer type from: %j",t))}},Ez.forTypes=function(t,e){if(!t.length)throw new Error("no types to combine");if(1===t.length)return t[0];e=e||{};var r=[],n=0,i=!0;if(t.forEach(function(t){switch(t.typeName){case"union:unwrapped":i=!1,r=r.concat(t.types);break;case"union:wrapped":n++,r=r.concat(t.types);break;case"null":r.push(t);break;default:i=!1,r.push(t)}}),n){if(!i)throw new Error("cannot combine wrapped union");var o={};r.forEach(function(t){var e=t.branchName,r=o[e];if(r){if(!t.equals(r))throw new Error("inconsistent branch type")}else o[e]=t});var s,a=e.wrapUnions;e.wrapUnions=!0;try{s=Ez.forSchema(Object.keys(o).map(function(t){return o[t]}),e)}catch(t){throw e.wrapUnions=a,t}return e.wrapUnions=a,s}var u={};r.forEach(function(t){var e=rq(t),r=u[e];r||(u[e]=r=[]),r.push(t)});var h=Object.keys(u).map(function(t){var r=u[t];if(1===r.length)return r[0];switch(t){case"null":case"boolean":return r[0];case"number":return function(t){var e,r,n,i,o=["int","long","float","double"],s=-1,a=null;for(e=0,r=t.length;e<r;e++)n=t[e],(i=o.indexOf(n.typeName))>s&&(s=i,a=n);return a}(r);case"string":return function(t,e){var r,n,i,o,s={};for(r=0,n=t.length;r<n;r++){if("string"===(i=t[r]).typeName)return i;var a,u;for(a=0,u=(o=i.symbols).length;a<u;a++)s[o[a]]=!0}return Ez.forSchema({type:"enum",symbols:Object.keys(s)},e)}(r,e);case"buffer":return function(t,e){var r,n,i,o=-1;for(r=0,n=t.length;r<n;r++){if("bytes"===(i=t[r]).typeName)return i;-1===o?o=i.size:i.size!==o&&(o=-2)}return o<0?Ez.forSchema("bytes",e):t[0]}(r,e);case"array":return(r=r.filter(function(t){return t!==e.emptyArrayType})).length?Ez.forSchema({type:"array",items:Ez.forTypes(r.map(function(t){return t.itemsType}))},e):e.emptyArrayType;default:return function(t,e){var r,n,i,o,s,a=[],u={},h={},c=!0;for(r=0,n=t.length;r<n;r++){var f,l,d,p,m,g;if("map"===(i=t[r]).typeName)c=!1,a.push(i.valuesType);else for(f=0,l=(o=i.fields).length;f<l;f++)m=(d=o[f]).name,g=d.type,a.push(g),c&&(u[m]||(u[m]=[]),u[m].push(g),void 0!==(p=d.defaultValue())&&(h[m]=p))}if(c){var y=Object.keys(u);for(r=0,n=y.length;r<n;r++)m=y[r],u[m].length<t.length&&void 0===h[m]&&(e&&e.strictDefaults?c=!1:(u[m].unshift(Ez.forSchema("null",e)),h[m]=null))}s=c?{type:"record",fields:y.map(function(t){var r=Ez.forTypes(u[t],e),n=h[t];if(void 0!==n&&~r.typeName.indexOf("union")){var i,o,s=r.types.slice();for(i=0,o=s.length;i<o&&!s[i].isValid(n);i++);if(i>0){var a=s[0];s[0]=s[i],s[i]=a,r=Ez.forSchema(s,e)}}return{name:t,type:r,default:h[t]}})}:{type:"map",values:Ez.forTypes(a,e)};return Ez.forSchema(s,e)}(r,e)}});return 1===h.length?h[0]:Ez.forSchema(h,e)},Ez.isType=function(){var t=arguments.length;if(!t)return!1;var e=arguments[0];if(!e||"function"!=typeof e._update||"function"!=typeof e.fingerprint)return!1;if(1===t)return!0;var r,n=e.typeName;for(r=1;r<t;r++)if(0===n.indexOf(arguments[r]))return!0;return!1},Ez.__reset=function(t){pz("resetting type buffer to %d",t),vz.buf=new fz.SlowBuffer(t)},Object.defineProperty(Ez.prototype,"branchName",{enumerable:!0,get:function(){if(this.name)return this.name;var t=Ez.isType(this,"logical")?this.underlyingType:this;return Ez.isType(t,"abstract")?t._concreteTypeName:Ez.isType(t,"union")?void 0:t.typeName}}),Ez.prototype.clone=function(t,e){return e?(e={coerce:0|!!e.coerceBuffers,fieldHook:e.fieldHook,qualifyNames:!!e.qualifyNames,skip:!!e.skipMissingFields,wrap:0|!!e.wrapUnions},this._copy(t,e)):this.fromBuffer(this.toBuffer(t))},Ez.prototype.compare=cz.abstractFunction,Ez.prototype.compareBuffers=function(t,e){return this._match(new dz(t),new dz(e))},Ez.prototype.createResolver=function(t,e){if(!Ez.isType(t))throw new Error(mz("not a type: %j",t));if(!Ez.isType(this,"union","logical")&&Ez.isType(t,"logical"))return this.createResolver(t.underlyingType,e);var r,n;if((e=e||{}).registry=e.registry||{},Ez.isType(this,"record","error")&&Ez.isType(t,"record","error")&&(n=this.name+":"+t.name,r=e.registry[n]))return r;if(r=new Hz(this),n&&(e.registry[n]=r),Ez.isType(t,"union")){var i=t.types.map(function(t){return this.createResolver(t,e)},this);r._read=function(t){var e=t.readLong();if(void 0===i[e])throw new Error(mz("invalid union index: %s",e));return i[e]._read(t)}}else this._update(r,t,e);if(!r._read)throw new Error(mz("cannot read %s as %s",t,this));return Object.freeze(r)},Ez.prototype.decode=function(t,e,r){var n=new dz(t,e),i=Gz(this,n,r);return n.isValid()?{value:i,offset:n.pos}:{value:void 0,offset:-1}},Ez.prototype.encode=function(t,e,r){var n=new dz(e,r);return this._write(n,t),n.isValid()?n.pos:e.length-n.pos},Ez.prototype.equals=function(t){return Ez.isType(t)&&this.fingerprint().equals(t.fingerprint())},Ez.prototype.fingerprint=function(t){if(t)return cz.getHash(JSON.stringify(this.schema()),t);if(!this._hash.str){var e=JSON.stringify(this.schema());this._hash.str=cz.getHash(e).toString("binary")}return cz.bufferFrom(this._hash.str,"binary")},Ez.prototype.fromBuffer=function(t,e,r){var n=new dz(t),i=Gz(this,n,e,r);if(!n.isValid())throw new Error("truncated buffer");if(!r&&n.pos<t.length)throw new Error("trailing data");return i},Ez.prototype.fromString=function(t){return this._copy(JSON.parse(t),{coerce:2})},Ez.prototype.inspect=function(){var t=this.typeName,e=Yz(t);if(Zz(t))return mz("<%s>",e);var r=this.schema({exportAttrs:!0,noDeref:!0});return"object"!=typeof r||Ez.isType(this,"logical")||(r.type=void 0),mz("<%s %j>",e,r)},Ez.prototype.isValid=function(t,e){var r,n,i=0|(e&&e.noUndeclaredFields),o=e&&e.errorHook;return o&&(n=[],r=function(e,r){o.call(this,n.slice(),e,r,t)}),this._check(t,i,r,n)},Ez.prototype.random=cz.abstractFunction,Ez.prototype.schema=function(t){return this._attrs({exportAttrs:!(!t||!t.exportAttrs),noDeref:!(!t||!t.noDeref)})},Ez.prototype.toBuffer=function(t){vz.pos=0,this._write(vz,t);var e=cz.newBuffer(vz.pos);return vz.isValid()?vz.buf.copy(e,0,0,vz.pos):this._write(new dz(e),t),e},Ez.prototype.toJSON=function(){return this.schema({exportAttrs:!0})},Ez.prototype.toString=function(t){return void 0===t?JSON.stringify(this.schema({noDeref:!0})):JSON.stringify(this._copy(t,{coerce:3}))},Ez.prototype.wrap=function(t){var e=this._branchConstructor;return null===e?null:new e(t)},Ez.prototype._attrs=function(t){t.derefed=t.derefed||{};var e=this.name;if(void 0!==e){if(t.noDeref||t.derefed[e])return e;t.derefed[e]=!0}var r={};void 0!==this.name&&(r.name=e),r.type=this.typeName;var n=this._deref(r,t);return void 0!==n&&(r=n),t.exportAttrs&&(this.aliases&&this.aliases.length&&(r.aliases=this.aliases),void 0!==this.doc&&(r.doc=this.doc)),r},Ez.prototype._createBranchConstructor=function(){var t=this.branchName;if("null"===t)return null;var e=function(e){~t.indexOf(".")?this[`${t}`]=e:this[t]=e};return e.type=this,e.prototype.unwrap=function(){return this[`${t}`]},e.prototype.unwrapped=e.prototype.unwrap,e},Ez.prototype._peek=function(t){var e=t.pos,r=this._read(t);return t.pos=e,r},Ez.prototype._check=cz.abstractFunction,Ez.prototype._copy=cz.abstractFunction,Ez.prototype._deref=cz.abstractFunction,Ez.prototype._match=cz.abstractFunction,Ez.prototype._read=cz.abstractFunction,Ez.prototype._skip=cz.abstractFunction,Ez.prototype._update=cz.abstractFunction,Ez.prototype._write=cz.abstractFunction,Ez.prototype.getAliases=function(){return this.aliases},Ez.prototype.getFingerprint=Ez.prototype.fingerprint,Ez.prototype.getName=function(t){return this.name||!t?this.name:this.branchName},Ez.prototype.getSchema=Ez.prototype.schema,Ez.prototype.getTypeName=function(){return this.typeName},lz.inherits(Az,Ez),Az.prototype._update=function(t,e){e.typeName===this.typeName&&(t._read=this._read)},Az.prototype._copy=function(t){return this._check(t,void 0,eq),t},Az.prototype._deref=function(){return this.typeName},Az.prototype.compare=cz.compare,lz.inherits(Mz,Az),Mz.prototype._check=function(t,e,r){var n=null===t;return!n&&r&&r(t,this),n},Mz.prototype._read=function(){return null},Mz.prototype._skip=function(){},Mz.prototype._write=function(t,e){null!==e&&eq(e,this)},Mz.prototype._match=function(){return 0},Mz.prototype.compare=Mz.prototype._match,Mz.prototype.typeName="null",Mz.prototype.random=Mz.prototype._read,lz.inherits(Sz,Az),Sz.prototype._check=function(t,e,r){var n="boolean"==typeof t;return!n&&r&&r(t,this),n},Sz.prototype._read=function(t){return t.readBoolean()},Sz.prototype._skip=function(t){t.skipBoolean()},Sz.prototype._write=function(t,e){"boolean"!=typeof e&&eq(e,this),t.writeBoolean(e)},Sz.prototype._match=function(t,e){return t.matchBoolean(e)},Sz.prototype.typeName="boolean",Sz.prototype.random=function(){return bz.nextBoolean()},lz.inherits(kz,Az),kz.prototype._check=function(t,e,r){var n=t===(0|t);return!n&&r&&r(t,this),n},kz.prototype._read=function(t){return t.readInt()},kz.prototype._skip=function(t){t.skipInt()},kz.prototype._write=function(t,e){e!==(0|e)&&eq(e,this),t.writeInt(e)},kz.prototype._match=function(t,e){return t.matchInt(e)},kz.prototype.typeName="int",kz.prototype.random=function(){return 0|bz.nextInt(1e3)},lz.inherits(xz,Az),xz.prototype._check=function(t,e,r){var n="number"==typeof t&&t%1==0&&$z(t);return!n&&r&&r(t,this),n},xz.prototype._read=function(t){var e=t.readLong();if(!$z(e))throw new Error("potential precision loss");return e},xz.prototype._skip=function(t){t.skipLong()},xz.prototype._write=function(t,e){("number"!=typeof e||e%1||!$z(e))&&eq(e,this),t.writeLong(e)},xz.prototype._match=function(t,e){return t.matchLong(e)},xz.prototype._update=function(t,e){switch(e.typeName){case"int":t._read=e._read;break;case"abstract:long":case"long":t._read=this._read}},xz.prototype.typeName="long",xz.prototype.random=function(){return bz.nextInt()},xz.__with=function(t,e){t=t||{};var r={toBuffer:"_toBuffer",fromBuffer:"_fromBuffer",fromJSON:"_fromJSON",toJSON:"_toJSON",isValid:"_isValid",compare:"compare"},n=new zz(e);return Object.keys(r).forEach(function(e){if(void 0===t[e])throw new Error(mz("missing method implementation: %s",e));n[r[e]]=t[e]}),Object.freeze(n)},lz.inherits(Tz,Az),Tz.prototype._check=function(t,e,r){var n="number"==typeof t;return!n&&r&&r(t,this),n},Tz.prototype._read=function(t){return t.readFloat()},Tz.prototype._skip=function(t){t.skipFloat()},Tz.prototype._write=function(t,e){"number"!=typeof e&&eq(e,this),t.writeFloat(e)},Tz.prototype._match=function(t,e){return t.matchFloat(e)},Tz.prototype._update=function(t,e){switch(e.typeName){case"float":case"int":t._read=e._read;break;case"abstract:long":case"long":t._read=function(t){return t.readLong()}}},Tz.prototype.typeName="float",Tz.prototype.random=function(){return bz.nextFloat(1e3)},lz.inherits(Rz,Az),Rz.prototype._check=function(t,e,r){var n="number"==typeof t;return!n&&r&&r(t,this),n},Rz.prototype._read=function(t){return t.readDouble()},Rz.prototype._skip=function(t){t.skipDouble()},Rz.prototype._write=function(t,e){"number"!=typeof e&&eq(e,this),t.writeDouble(e)},Rz.prototype._match=function(t,e){return t.matchDouble(e)},Rz.prototype._update=function(t,e){switch(e.typeName){case"double":case"float":case"int":t._read=e._read;break;case"abstract:long":case"long":t._read=function(t){return t.readLong()}}},Rz.prototype.typeName="double",Rz.prototype.random=function(){return bz.nextFloat()},lz.inherits(Bz,Az),Bz.prototype._check=function(t,e,r){var n="string"==typeof t;return!n&&r&&r(t,this),n},Bz.prototype._read=function(t){return t.readString()},Bz.prototype._skip=function(t){t.skipString()},Bz.prototype._write=function(t,e){"string"!=typeof e&&eq(e,this),t.writeString(e)},Bz.prototype._match=function(t,e){return t.matchString(e)},Bz.prototype._update=function(t,e){switch(e.typeName){case"bytes":case"string":t._read=this._read}},Bz.prototype.typeName="string",Bz.prototype.random=function(){return bz.nextString(bz.nextInt(32))},lz.inherits(Nz,Az),Nz.prototype._check=function(t,e,r){var n=_.isBuffer(t);return!n&&r&&r(t,this),n},Nz.prototype._read=function(t){return t.readBytes()},Nz.prototype._skip=function(t){t.skipBytes()},Nz.prototype._write=function(t,e){_.isBuffer(e)||eq(e,this),t.writeBytes(e)},Nz.prototype._match=function(t,e){return t.matchBytes(e)},Nz.prototype._update=Bz.prototype._update,Nz.prototype._copy=function(t,e){var r;switch(0|(e&&e.coerce)){case 3:return this._check(t,void 0,eq),t.toString("binary");case 2:if("string"!=typeof t)throw new Error(mz("cannot coerce to buffer: %j",t));return r=cz.bufferFrom(t,"binary"),this._check(r,void 0,eq),r;case 1:if(!Qz(t))throw new Error(mz("cannot coerce to buffer: %j",t));return r=cz.bufferFrom(t.data),this._check(r,void 0,eq),r;default:return this._check(t,void 0,eq),cz.bufferFrom(t)}},Nz.prototype.compare=_.compare,Nz.prototype.typeName="bytes",Nz.prototype.random=function(){return bz.nextBuffer(bz.nextInt(32))},lz.inherits(Pz,Ez),Pz.prototype._branchConstructor=function(){throw new Error("unions cannot be directly wrapped")},Pz.prototype._skip=function(t){this.types[t.readLong()]._skip(t)},Pz.prototype._match=function(t,e){var r=t.readLong(),n=e.readLong();return r===n?this.types[r]._match(t,e):r<n?-1:1},Pz.prototype._deref=function(t,e){return this.types.map(function(t){return t._attrs(e)})},Pz.prototype.getTypes=function(){return this.types},lz.inherits(Iz,Pz),Iz.prototype._getIndex=function(t){var e=this._bucketIndices[nq(t)];return this._dynamicBranches&&(e=this._getBranchIndex(t,e)),e},Iz.prototype._getBranchIndex=function(t,e){var r,n,i,o=this._dynamicBranches;for(r=0,n=o.length;r<n;r++)if((i=o[r]).type._check(t)){if(void 0!==e)throw new Error("ambiguous conversion");e=i.index}return e},Iz.prototype._check=function(t,e,r,n){var i=this._getIndex(t),o=void 0!==i;return o?this.types[i]._check(t,e,r,n):(r&&r(t,this),o)},Iz.prototype._read=function(t){var e=t.readLong(),r=this.types[e];if(r)return r._read(t);throw new Error(mz("invalid union index: %s",e))},Iz.prototype._write=function(t,e){var r=this._getIndex(e);void 0===r&&eq(e,this),t.writeLong(r),null!==e&&this.types[r]._write(t,e)},Iz.prototype._update=function(t,e,r){var n,i,o;for(n=0,i=this.types.length;n<i;n++){try{o=this.types[n].createResolver(e,r)}catch(t){continue}return void(t._read=function(t){return o._read(t)})}},Iz.prototype._copy=function(t,e){var r,n=e&&0|e.coerce,i=e&&0|e.wrap;if(2===i)r=0;else{switch(n){case 1:r=Qz(t)&&void 0!==this._bucketIndices.buffer?this._bucketIndices.buffer:this._getIndex(t);break;case 2:if(null===t)r=this._bucketIndices.null;else if("object"==typeof t){var o=Object.keys(t);1===o.length&&(r=this._branchIndices[o[0]],t=t[o[0]])}break;default:r=this._getIndex(t)}void 0===r&&eq(t,this)}var s=this.types[r];if(null===t||3===i)return s._copy(t,e);if(3===n){var a={};return a[s.branchName]=s._copy(t,e),a}return s._copy(t,e)},Iz.prototype.compare=function(t,e){var r=this._getIndex(t),n=this._getIndex(e);if(void 0===r)eq(t,this);else{if(void 0!==n)return r===n?this.types[r].compare(t,e):cz.compare(r,n);eq(e,this)}},Iz.prototype.typeName="union:unwrapped",Iz.prototype.random=function(){var t=bz.nextInt(this.types.length);return this.types[t].random()},lz.inherits(Oz,Pz),Oz.prototype._check=function(t,e,r,n){var i=!1;if(null===t)i=void 0!==this._branchIndices.null;else if("object"==typeof t){var o=Object.keys(t);if(1===o.length){var s=o[0],a=this._branchIndices[s];if(void 0!==a)return r?(n.push(s),i=this.types[a]._check(t[s],e,r,n),n.pop(),i):this.types[a]._check(t[s],e)}}return!i&&r&&r(t,this),i},Oz.prototype._read=function(t){var e=this.types[t.readLong()];if(!e)throw new Error(mz("invalid union index"));var r=e._branchConstructor;return null===r?null:new r(e._read(t))},Oz.prototype._write=function(t,e){var r,n,i;null===e?(void 0===(r=this._branchIndices.null)&&eq(e,this),t.writeLong(r)):(1===(n=Object.keys(e)).length&&(i=n[0],r=this._branchIndices[i]),void 0===r&&eq(e,this),t.writeLong(r),this.types[r]._write(t,e[i]))},Oz.prototype._update=function(t,e,r){var n,i,o,s;for(n=0,i=this.types.length;n<i;n++){try{o=this.types[n].createResolver(e,r)}catch(t){continue}return s=this.types[n]._branchConstructor,void(t._read=s?function(t){return new s(o._read(t))}:function(){return null})}},Oz.prototype._copy=function(t,e){var r,n,i,o=e&&0|e.wrap;if(2===o){var s=this.types[0];return null===t&&"null"===s.typeName?null:new s._branchConstructor(s._copy(t,e))}if(null===t&&void 0!==this._branchIndices.null)return null;if("object"==typeof t){var a=Object.keys(t);if(1===a.length){var u,h,c=a[0];if(void 0===(r=this._branchIndices[c])&&e.qualifyNames)for(u=0,n=this.types.length;u<n;u++)if((h=this.types[u]).name&&c===Vz(h.name)){r=u;break}void 0!==r&&(i=this.types[r]._copy(t[c],e))}}if(1===o&&void 0===i)for(r=0,n=this.types.length;r<n&&void 0===i;)try{i=this.types[r]._copy(t,e)}catch(t){r++}if(void 0!==i)return 3===o?i:new this.types[r]._branchConstructor(i);eq(t,this)},Oz.prototype.compare=function(t,e){var r=null===t?"null":Object.keys(t)[0],n=null===e?"null":Object.keys(e)[0],i=this._branchIndices[r];return r===n?"null"===r?0:this.types[i].compare(t[r],e[r]):cz.compare(i,this._branchIndices[n])},Oz.prototype.typeName="union:wrapped",Oz.prototype.random=function(){var t=bz.nextInt(this.types.length),e=this.types[t],r=e._branchConstructor;return r?new r(e.random()):null},lz.inherits(Cz,Ez),Cz.prototype._check=function(t,e,r){var n=void 0!==this._indices[t];return!n&&r&&r(t,this),n},Cz.prototype._read=function(t){var e=t.readLong(),r=this.symbols[e];if(void 0===r)throw new Error(mz("invalid %s enum index: %s",this.name,e));return r},Cz.prototype._skip=function(t){t.skipLong()},Cz.prototype._write=function(t,e){var r=this._indices[e];void 0===r&&eq(e,this),t.writeLong(r)},Cz.prototype._match=function(t,e){return t.matchLong(e)},Cz.prototype.compare=function(t,e){return cz.compare(this._indices[t],this._indices[e])},Cz.prototype._update=function(t,e){var r=this.symbols;"enum"!==e.typeName||e.name&&!~Jz(this).indexOf(e.name)||!e.symbols.every(function(t){return~r.indexOf(t)})||(t.symbols=e.symbols,t._read=e._read)},Cz.prototype._copy=function(t){return this._check(t,void 0,eq),t},Cz.prototype._deref=function(t){t.symbols=this.symbols},Cz.prototype.getSymbols=function(){return this.symbols},Cz.prototype.typeName="enum",Cz.prototype.random=function(){return bz.choice(this.symbols)},lz.inherits(Lz,Ez),Lz.prototype._check=function(t,e,r){var n=_.isBuffer(t)&&t.length===this.size;return!n&&r&&r(t,this),n},Lz.prototype._read=function(t){return t.readFixed(this.size)},Lz.prototype._skip=function(t){t.skipFixed(this.size)},Lz.prototype._write=function(t,e){_.isBuffer(e)&&e.length===this.size||eq(e,this),t.writeFixed(e,this.size)},Lz.prototype._match=function(t,e){return t.matchFixed(e,this.size)},Lz.prototype.compare=_.compare,Lz.prototype._update=function(t,e){"fixed"!==e.typeName||this.size!==e.size||e.name&&!~Jz(this).indexOf(e.name)||(t.size=this.size,t._read=this._read)},Lz.prototype._copy=Nz.prototype._copy,Lz.prototype._deref=function(t){t.size=this.size},Lz.prototype.getSize=function(){return this.size},Lz.prototype.typeName="fixed",Lz.prototype.random=function(){return bz.nextBuffer(this.size)},lz.inherits(jz,Ez),jz.prototype._check=function(t,e,r,n){if(!t||"object"!=typeof t||Array.isArray(t))return r&&r(t,this),!1;var i,o,s,a,u=Object.keys(t),h=!0;if(r){for(s=n.length,n.push(""),i=0,o=u.length;i<o;i++)a=n[s]=u[i],this.valuesType._check(t[a],e,r,n)||(h=!1);n.pop()}else for(i=0,o=u.length;i<o;i++)if(!this.valuesType._check(t[u[i]],e))return!1;return h},jz.prototype._read=function(t){for(var e,r=this.valuesType,n={};e=Xz(t);)for(;e--;){n[t.readString()]=r._read(t)}return n},jz.prototype._skip=function(t){for(var e,r,n=this.valuesType;r=t.readLong();)if(r<0)e=t.readLong(),t.pos+=e;else for(;r--;)t.skipString(),n._skip(t)},jz.prototype._write=function(t,e){e&&"object"==typeof e&&!Array.isArray(e)||eq(e,this);var r,n,i=this.valuesType,o=Object.keys(e),s=o.length;if(s)for(t.writeLong(s),r=0;r<s;r++)n=o[r],t.writeString(n),i._write(t,e[n]);t.writeLong(0)},jz.prototype._match=function(){throw new Error("maps cannot be compared")},jz.prototype._update=function(t,e,r){"map"===e.typeName&&(t.valuesType=this.valuesType.createResolver(e.valuesType,r),t._read=this._read)},jz.prototype._copy=function(t,e){if(t&&"object"==typeof t&&!Array.isArray(t)){var r,n,i,o=this.valuesType,s=Object.keys(t),a={};for(r=0,n=s.length;r<n;r++)a[i=s[r]]=o._copy(t[i],e);return a}eq(t,this)},jz.prototype.compare=jz.prototype._match,jz.prototype.typeName="map",jz.prototype.getValuesType=function(){return this.valuesType},jz.prototype.random=function(){var t,e,r={};for(t=0,e=bz.nextInt(10);t<e;t++)r[bz.nextString(bz.nextInt(20))]=this.valuesType.random();return r},jz.prototype._deref=function(t,e){t.values=this.valuesType._attrs(e)},lz.inherits(Dz,Ez),Dz.prototype._check=function(t,e,r,n){if(!Array.isArray(t))return r&&r(t,this),!1;var i,o,s,a=!0;if(r){for(s=n.length,n.push(""),i=0,o=t.length;i<o;i++)n[s]=""+i,this.itemsType._check(t[i],e,r,n)||(a=!1);n.pop()}else for(i=0,o=t.length;i<o;i++)if(!this.itemsType._check(t[i],e))return!1;return a},Dz.prototype._read=function(t){for(var e,r=this.itemsType,n=[];e=t.readLong();)for(e<0&&(e=-e,t.skipLong());e--;)n.push(r._read(t));return n},Dz.prototype._skip=function(t){for(var e,r;r=t.readLong();)if(r<0)e=t.readLong(),t.pos+=e;else for(;r--;)this.itemsType._skip(t)},Dz.prototype._write=function(t,e){Array.isArray(e)||eq(e,this);var r,n=e.length;if(n)for(t.writeLong(n),r=0;r<n;r++)this.itemsType._write(t,e[r]);t.writeLong(0)},Dz.prototype._match=function(t,e){for(var r,n=t.readLong(),i=e.readLong();n&&i;){if(r=this.itemsType._match(t,e))return r;--n||(n=Xz(t)),--i||(i=Xz(e))}return cz.compare(n,i)},Dz.prototype._update=function(t,e,r){"array"===e.typeName&&(t.itemsType=this.itemsType.createResolver(e.itemsType,r),t._read=this._read)},Dz.prototype._copy=function(t,e){Array.isArray(t)||eq(t,this);var r,n,i=new Array(t.length);for(r=0,n=t.length;r<n;r++)i[r]=this.itemsType._copy(t[r],e);return i},Dz.prototype._deref=function(t,e){t.items=this.itemsType._attrs(e)},Dz.prototype.compare=function(t,e){var r,n,i,o=t.length,s=e.length;for(r=0,n=Math.min(o,s);r<n;r++)if(i=this.itemsType.compare(t[r],e[r]))return i;return cz.compare(o,s)},Dz.prototype.getItemsType=function(){return this.itemsType},Dz.prototype.typeName="array",Dz.prototype.random=function(){var t,e,r=[];for(t=0,e=bz.nextInt(10);t<e;t++)r.push(this.itemsType.random());return r},lz.inherits(Uz,Ez),Uz.prototype._getConstructorName=function(){return this.name?Vz(this.name):this._isError?"Error$":"Record$"},Uz.prototype._createConstructor=function(t){var e,r,n,i,o,s,a,u={};for(e=0,r=this.fields.length;e<r;e++)s=void 0!==(o=(n=this.fields[e]).defaultValue)(),i=n.name,t&&this._isError&&"stack"===i&&Ez.isType(n.type,"string")&&!s&&(a=n),s&&(u[e]=o);var h=this;var c=function(t){const e=h._getConstructorName();var r={[e]:function(...e){for(var r=0,n=h.fields.length;r<n;r++){let n=h.fields[r];void 0===n.defaultValue()?this[n.name]=e[r]:void 0===e[r]?this[n.name]=t[r]():this[n.name]=e[r]}a&&void 0===this.stack&&("function"==typeof Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=Error().stack)}}[e];return r}(u);return c.getType=function(){return h},c.type=h,this._isError&&(lz.inherits(c,Error),c.prototype.name=this._getConstructorName()),c.prototype.clone=function(t){return h.clone(this,t)},c.prototype.compare=function(t){return h.compare(this,t)},c.prototype.isValid=function(t){return h.isValid(this,t)},c.prototype.toBuffer=function(){return h.toBuffer(this)},c.prototype.toString=function(){return h.toString(this)},c.prototype.wrap=function(){return h.wrap(this)},c.prototype.wrapped=c.prototype.wrap,c},Uz.prototype._createChecker=function(){const t=[];this.fields.forEach(e=>{t.push(e.type)});var e,r,n,i=this;return e=t,r=i._getConstructorName(),n={[r]:function(t,r,n,o){if(null===t||"object"!=typeof t||r&&!this._checkFields(t))return n&&n(t,this),!1;const s=[];if(!i.fields.length)return!0;for(var a=0,u=i.fields.length;a<u;a++){let e=i.fields[a];void 0!==e.defaultValue()&&s.push(t[e.name])}if(n){var h=1,c=o.length;for(o.push(""),a=0,u=i.fields.length;a<u;a++){let r=i.fields[a];o[c]=r.name,h&=void 0===r.defaultValue()?e[a]._check(t[r.name],r,n,o):void 0===s[a]||e[a]._check(s[a],r,n,o)}return o.pop(),!!h}return i.fields.reduce((n,i,o)=>n&&(void 0===i.defaultValue()?e[o]._check(t[i.name]):void 0===s[o]||e[o]._check(s[o],r)),!0)}}[r],n},Uz.prototype._createReader=function(){var t,e,r,n,i=[this.recordConstructor];for(t=0,e=this.fields.length;t<e;t++)i.push(this.fields[t].type);return r=i,n=this._getConstructorName(),{[n]:function(t){return new r[0](...r.slice(1).map(e=>e._read(t)))}}[n]},Uz.prototype._createSkipper=function(){var t,e,r=[];return this.fields.forEach(t=>{r.push(t.type)}),t=r,e=this._getConstructorName(),{[e]:function(e){t.forEach(t=>t._skip(e))}}[e]},Uz.prototype._createWriter=function(){var t=[],e={};this.fields.forEach((r,n)=>{t.push(r.type),void 0!==r.defaultValue()&&(e[n]=r.type.toBuffer(r.defaultValue()).toString("binary"))});var r,n,i,o,s=this;return r=t,n=e,i=s._getConstructorName(),o={[i]:function(t,e){for(var i=0,o=s.fields.length;i<o;i++){let o=s.fields[i];void 0===o.defaultValue()?r[i]._write(t,e[o.name]):void 0===e[o.name]?t.writeBinary(n[i],n[i].length):r[i]._write(t,e[o.name])}}}[i],o},Uz.prototype._update=function(t,e,r){if(e.name&&!~Jz(this).indexOf(e.name))throw new Error(mz("no alias found for %s",e.name));var n,i,o,s,a,u,h,c=this.fields,f=e.fields,l=cz.toMap(f,function(t){return t.name}),d={};for(n=0;n<c.length;n++){for(o=c[n],a=Jz(o),u=[],i=0;i<a.length;i++)s=a[i],l[s]&&u.push(s);if(u.length>1)throw new Error(mz("ambiguous aliasing for %s.%s (%s)",e.name,o.name,u));if(u.length)s=u[0],h={resolver:o.type.createResolver(l[s].type,r),name:"_"+o.name},d[s]?d[s].push(h):d[s]=[h];else if(void 0===o.defaultValue())throw new Error(mz("no matching field for default-less %s.%s",e.name,o.name))}var p,m,g=this;t._read=(p=g._getConstructorName(),m={[p]:function(t,r){if(!r){var n=[];for(i=0;i<c.length;i++){for(o=c[i],a=Jz(o),u=[],h=0;h<a.length;h++)s=a[h],l[s]&&u.push(s);u.length||n.push(void 0)}for(var i=0;i<f.length;i++){let r=e.fields[i];if(s=r.name,void 0===d[s])r.type._skip(t);else for(var h=d[s].length;h--;)n.unshift(h?d[s][h].resolver._peek(t):d[s][h].resolver._read(t))}return new g.recordConstructor(...n)}}}[p],m)},Uz.prototype._match=function(t,e){var r,n,i,o,s,a=this.fields;for(r=0,n=a.length;r<n;r++)if(o=(i=a[r])._order,s=i.type,o){if(o*=s._match(t,e))return o}else s._skip(t),s._skip(e);return 0},Uz.prototype._checkFields=function(t){var e,r,n=Object.keys(t);for(e=0,r=n.length;e<r;e++)if(!this._fieldsByName[n[e]])return!1;return!0},Uz.prototype._copy=function(t,e){var r,n,i,o,s=e&&e.fieldHook,a=[void 0];for(r=0,n=this.fields.length;r<n;r++)void 0===(o=t[(i=this.fields[r]).name])&&i.hasOwnProperty("defaultValue")&&(o=i.defaultValue()),(e&&!e.skip||void 0!==o)&&(o=i.type._copy(o,e)),s&&(o=s(i,o,this)),a.push(o);var u=this.recordConstructor;return new(u.bind.apply(u,a))},Uz.prototype._deref=function(t,e){t.fields=this.fields.map(function(t){var r=t.type,n={name:t.name,type:r._attrs(e)};if(e.exportAttrs){var i=t.defaultValue();void 0!==i&&(n.default=r._copy(i,{coerce:3,wrap:3}));var o=t.order;"ascending"!==o&&(n.order=o);var s=t.aliases;s.length&&(n.aliases=s);var a=t.doc;void 0!==a&&(n.doc=a)}return n})},Uz.prototype.compare=function(t,e){var r,n,i,o,s,a,u=this.fields;for(r=0,n=u.length;r<n;r++)if(o=(i=u[r]).name,s=i._order,a=i.type,s&&(s*=a.compare(t[o],e[o])))return s;return 0},Uz.prototype.random=function(){var t=this.fields.map(function(t){return t.type.random()});t.unshift(void 0);var e=this.recordConstructor;return new(e.bind.apply(e,t))},Uz.prototype.field=function(t){return this._fieldsByName[t]},Uz.prototype.getField=Uz.prototype.field,Uz.prototype.getFields=function(){return this.fields},Uz.prototype.getRecordConstructor=function(){return this.recordConstructor},Object.defineProperty(Uz.prototype,"typeName",{enumerable:!0,get:function(){return this._isError?"error":"record"}}),lz.inherits(Fz,Ez),Object.defineProperty(Fz.prototype,"typeName",{enumerable:!0,get:function(){return"logical:"+this._logicalTypeName}}),Object.defineProperty(Fz.prototype,"underlyingType",{enumerable:!0,get:function(){if(this._underlyingType)return this._underlyingType;var t,e,r;for(t=0,e=_z.length;t<e;t++)if((r=_z[t])[0]===this)return r[1]}}),Fz.prototype.getUnderlyingType=function(){return this.underlyingType},Fz.prototype._read=function(t){return this._fromValue(this.underlyingType._read(t))},Fz.prototype._write=function(t,e){this.underlyingType._write(t,this._toValue(e))},Fz.prototype._check=function(t,e,r,n){try{var i=this._toValue(t)}catch(t){}return void 0===i?(r&&r(t,this),!1):this.underlyingType._check(i,e,r,n)},Fz.prototype._copy=function(t,e){var r=this.underlyingType;switch(e&&e.coerce){case 3:return r._copy(this._toValue(t),e);case 2:return this._fromValue(r._copy(t,e));default:return this._fromValue(r._copy(this._toValue(t),e))}},Fz.prototype._update=function(t,e,r){var n=this._resolve(e,r);n&&(t._read=function(t){return n(e._read(t))})},Fz.prototype.compare=function(t,e){var r=this._toValue(t),n=this._toValue(e);return this.underlyingType.compare(r,n)},Fz.prototype.random=function(){return this._fromValue(this.underlyingType.random())},Fz.prototype._deref=function(t,e){var r=this.underlyingType,n=void 0!==r.name&&e.derefed[r.name];return t=r._attrs(e),!n&&e.exportAttrs&&("string"==typeof t&&(t={type:t}),t.logicalType=this._logicalTypeName,this._export(t)),t},Fz.prototype._skip=function(t){this.underlyingType._skip(t)},Fz.prototype._export=function(){},Fz.prototype._fromValue=cz.abstractFunction,Fz.prototype._toValue=cz.abstractFunction,Fz.prototype._resolve=cz.abstractFunction,lz.inherits(zz,xz),zz.prototype.typeName="abstract:long",zz.prototype._check=function(t,e,r){var n=this._isValid(t);return!n&&r&&r(t,this),n},zz.prototype._read=function(t){var e,r;if(this._noUnpack?(r=t.pos,t.skipLong(),e=t.buf.slice(r,t.pos)):e=t.unpackLongBytes(t),t.isValid())return this._fromBuffer(e)},zz.prototype._write=function(t,e){this._isValid(e)||eq(e,this);var r=this._toBuffer(e);this._noUnpack?t.writeFixed(r):t.packLongBytes(r)},zz.prototype._copy=function(t,e){switch(e&&e.coerce){case 3:return this._toJSON(t);case 2:return this._fromJSON(t);default:return this._fromJSON(this._toJSON(t))}},zz.prototype._deref=function(){return"long"},zz.prototype._update=function(t,e){var r=this;switch(e.typeName){case"int":t._read=function(t){return r._fromJSON(e._read(t))};break;case"long":t._read=function(t){return r._read(t)}}},zz.prototype.random=function(){return this._fromJSON(xz.prototype.random())},zz.prototype._fromBuffer=cz.abstractFunction,zz.prototype._toBuffer=cz.abstractFunction,zz.prototype._fromJSON=cz.abstractFunction,zz.prototype._toJSON=cz.abstractFunction,zz.prototype._isValid=cz.abstractFunction,zz.prototype.compare=cz.abstractFunction,qz.prototype.defaultValue=function(){},Object.defineProperty(qz.prototype,"order",{enumerable:!0,get:function(){return["descending","ignore","ascending"][this._order+1]}}),qz.prototype.getAliases=function(){return this.aliases},qz.prototype.getDefault=qz.prototype.defaultValue,qz.prototype.getName=function(){return this.name},qz.prototype.getOrder=function(){return this.order},qz.prototype.getType=function(){return this.type},Hz.prototype._peek=Ez.prototype._peek,Hz.prototype.inspect=function(){return"<Resolver>"};var iq={Type:Ez,getTypeBucket:rq,getValueBucket:nq,isPrimitive:Zz,isValidName:tq,qualify:Wz,builtins:function(){var t,e,r,n={LogicalType:Fz,UnwrappedUnionType:Iz,WrappedUnionType:Oz},i=Object.keys(gz);for(t=0,e=i.length;t<e;t++)n[Yz(r=i[t])]=gz[r];return n}()},oq={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"};function sq(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}function aq(t,e,r,n,i){if(e.subarray&&t.subarray)t.set(e.subarray(r,r+n),i);else for(var o=0;o<n;o++)t[i+o]=e[r+o]}var uq=Uint8Array,hq=Uint16Array,cq=Int32Array;function fq(t){for(var e=t.length;--e>=0;)t[e]=0}var lq=256,dq=286,pq=30,mq=15,gq=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],yq=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],bq=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],vq=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],wq=new Array(576);fq(wq);var _q=new Array(60);fq(_q);var Eq=new Array(512);fq(Eq);var Aq=new Array(256);fq(Aq);var Mq=new Array(29);fq(Mq);var Sq,kq,xq,Tq=new Array(pq);function Rq(t,e,r,n,i){this.static_tree=t,this.extra_bits=e,this.extra_base=r,this.elems=n,this.max_length=i,this.has_stree=t&&t.length}function Bq(t,e){this.dyn_tree=t,this.max_code=0,this.stat_desc=e}function Nq(t){return t<256?Eq[t]:Eq[256+(t>>>7)]}function Pq(t,e){t.pending_buf[t.pending++]=255&e,t.pending_buf[t.pending++]=e>>>8&255}function Iq(t,e,r){t.bi_valid>16-r?(t.bi_buf|=e<<t.bi_valid&65535,Pq(t,t.bi_buf),t.bi_buf=e>>16-t.bi_valid,t.bi_valid+=r-16):(t.bi_buf|=e<<t.bi_valid&65535,t.bi_valid+=r)}function Oq(t,e,r){Iq(t,r[2*e],r[2*e+1])}function Cq(t,e){var r=0;do{r|=1&t,t>>>=1,r<<=1}while(--e>0);return r>>>1}function Lq(t,e,r){var n,i,o=new Array(16),s=0;for(n=1;n<=mq;n++)o[n]=s=s+r[n-1]<<1;for(i=0;i<=e;i++){var a=t[2*i+1];0!==a&&(t[2*i]=Cq(o[a]++,a))}}function jq(t){var e;for(e=0;e<dq;e++)t.dyn_ltree[2*e]=0;for(e=0;e<pq;e++)t.dyn_dtree[2*e]=0;for(e=0;e<19;e++)t.bl_tree[2*e]=0;t.dyn_ltree[512]=1,t.opt_len=t.static_len=0,t.last_lit=t.matches=0}function Dq(t){t.bi_valid>8?Pq(t,t.bi_buf):t.bi_valid>0&&(t.pending_buf[t.pending++]=t.bi_buf),t.bi_buf=0,t.bi_valid=0}function Uq(t,e,r,n){var i=2*e,o=2*r;return t[i]<t[o]||t[i]===t[o]&&n[e]<=n[r]}function Fq(t,e,r){for(var n=t.heap[r],i=r<<1;i<=t.heap_len&&(i<t.heap_len&&Uq(e,t.heap[i+1],t.heap[i],t.depth)&&i++,!Uq(e,n,t.heap[i],t.depth));)t.heap[r]=t.heap[i],r=i,i<<=1;t.heap[r]=n}function zq(t,e,r){var n,i,o,s,a=0;if(0!==t.last_lit)do{n=t.pending_buf[t.d_buf+2*a]<<8|t.pending_buf[t.d_buf+2*a+1],i=t.pending_buf[t.l_buf+a],a++,0===n?Oq(t,i,e):(Oq(t,(o=Aq[i])+lq+1,e),0!==(s=gq[o])&&Iq(t,i-=Mq[o],s),Oq(t,o=Nq(--n),r),0!==(s=yq[o])&&Iq(t,n-=Tq[o],s))}while(a<t.last_lit);Oq(t,256,e)}function qq(t,e){var r,n,i,o=e.dyn_tree,s=e.stat_desc.static_tree,a=e.stat_desc.has_stree,u=e.stat_desc.elems,h=-1;for(t.heap_len=0,t.heap_max=573,r=0;r<u;r++)0!==o[2*r]?(t.heap[++t.heap_len]=h=r,t.depth[r]=0):o[2*r+1]=0;for(;t.heap_len<2;)o[2*(i=t.heap[++t.heap_len]=h<2?++h:0)]=1,t.depth[i]=0,t.opt_len--,a&&(t.static_len-=s[2*i+1]);for(e.max_code=h,r=t.heap_len>>1;r>=1;r--)Fq(t,o,r);i=u;do{r=t.heap[1],t.heap[1]=t.heap[t.heap_len--],Fq(t,o,1),n=t.heap[1],t.heap[--t.heap_max]=r,t.heap[--t.heap_max]=n,o[2*i]=o[2*r]+o[2*n],t.depth[i]=(t.depth[r]>=t.depth[n]?t.depth[r]:t.depth[n])+1,o[2*r+1]=o[2*n+1]=i,t.heap[1]=i++,Fq(t,o,1)}while(t.heap_len>=2);t.heap[--t.heap_max]=t.heap[1],function(t,e){var r,n,i,o,s,a,u=e.dyn_tree,h=e.max_code,c=e.stat_desc.static_tree,f=e.stat_desc.has_stree,l=e.stat_desc.extra_bits,d=e.stat_desc.extra_base,p=e.stat_desc.max_length,m=0;for(o=0;o<=mq;o++)t.bl_count[o]=0;for(u[2*t.heap[t.heap_max]+1]=0,r=t.heap_max+1;r<573;r++)(o=u[2*u[2*(n=t.heap[r])+1]+1]+1)>p&&(o=p,m++),u[2*n+1]=o,n>h||(t.bl_count[o]++,s=0,n>=d&&(s=l[n-d]),a=u[2*n],t.opt_len+=a*(o+s),f&&(t.static_len+=a*(c[2*n+1]+s)));if(0!==m){do{for(o=p-1;0===t.bl_count[o];)o--;t.bl_count[o]--,t.bl_count[o+1]+=2,t.bl_count[p]--,m-=2}while(m>0);for(o=p;0!==o;o--)for(n=t.bl_count[o];0!==n;)(i=t.heap[--r])>h||(u[2*i+1]!==o&&(t.opt_len+=(o-u[2*i+1])*u[2*i],u[2*i+1]=o),n--)}}(t,e),Lq(o,h,t.bl_count)}function Hq(t,e,r){var n,i,o=-1,s=e[1],a=0,u=7,h=4;for(0===s&&(u=138,h=3),e[2*(r+1)+1]=65535,n=0;n<=r;n++)i=s,s=e[2*(n+1)+1],++a<u&&i===s||(a<h?t.bl_tree[2*i]+=a:0!==i?(i!==o&&t.bl_tree[2*i]++,t.bl_tree[32]++):a<=10?t.bl_tree[34]++:t.bl_tree[36]++,a=0,o=i,0===s?(u=138,h=3):i===s?(u=6,h=3):(u=7,h=4))}function Kq(t,e,r){var n,i,o=-1,s=e[1],a=0,u=7,h=4;for(0===s&&(u=138,h=3),n=0;n<=r;n++)if(i=s,s=e[2*(n+1)+1],!(++a<u&&i===s)){if(a<h)do{Oq(t,i,t.bl_tree)}while(0!==--a);else 0!==i?(i!==o&&(Oq(t,i,t.bl_tree),a--),Oq(t,16,t.bl_tree),Iq(t,a-3,2)):a<=10?(Oq(t,17,t.bl_tree),Iq(t,a-3,3)):(Oq(t,18,t.bl_tree),Iq(t,a-11,7));a=0,o=i,0===s?(u=138,h=3):i===s?(u=6,h=3):(u=7,h=4)}}fq(Tq);var Gq=!1;function Vq(t){Gq||(!function(){var t,e,r,n,i,o=new Array(16);for(r=0,n=0;n<28;n++)for(Mq[n]=r,t=0;t<1<<gq[n];t++)Aq[r++]=n;for(Aq[r-1]=n,i=0,n=0;n<16;n++)for(Tq[n]=i,t=0;t<1<<yq[n];t++)Eq[i++]=n;for(i>>=7;n<pq;n++)for(Tq[n]=i<<7,t=0;t<1<<yq[n]-7;t++)Eq[256+i++]=n;for(e=0;e<=mq;e++)o[e]=0;for(t=0;t<=143;)wq[2*t+1]=8,t++,o[8]++;for(;t<=255;)wq[2*t+1]=9,t++,o[9]++;for(;t<=279;)wq[2*t+1]=7,t++,o[7]++;for(;t<=287;)wq[2*t+1]=8,t++,o[8]++;for(Lq(wq,287,o),t=0;t<pq;t++)_q[2*t+1]=5,_q[2*t]=Cq(t,5);Sq=new Rq(wq,gq,257,dq,mq),kq=new Rq(_q,yq,0,pq,mq),xq=new Rq(new Array(0),bq,0,19,7)}(),Gq=!0),t.l_desc=new Bq(t.dyn_ltree,Sq),t.d_desc=new Bq(t.dyn_dtree,kq),t.bl_desc=new Bq(t.bl_tree,xq),t.bi_buf=0,t.bi_valid=0,jq(t)}function Wq(t,e,r,n){Iq(t,0+(n?1:0),3),function(t,e,r,n){Dq(t),n&&(Pq(t,r),Pq(t,~r)),aq(t.pending_buf,t.window,e,r,t.pending),t.pending+=r}(t,e,r,!0)}function Jq(t){Iq(t,2,3),Oq(t,256,wq),function(t){16===t.bi_valid?(Pq(t,t.bi_buf),t.bi_buf=0,t.bi_valid=0):t.bi_valid>=8&&(t.pending_buf[t.pending++]=255&t.bi_buf,t.bi_buf>>=8,t.bi_valid-=8)}(t)}function Zq(t,e,r,n){var i,o,s=0;t.level>0?(2===t.strm.data_type&&(t.strm.data_type=function(t){var e,r=4093624447;for(e=0;e<=31;e++,r>>>=1)if(1&r&&0!==t.dyn_ltree[2*e])return 0;if(0!==t.dyn_ltree[18]||0!==t.dyn_ltree[20]||0!==t.dyn_ltree[26])return 1;for(e=32;e<lq;e++)if(0!==t.dyn_ltree[2*e])return 1;return 0}(t)),qq(t,t.l_desc),qq(t,t.d_desc),s=function(t){var e;for(Hq(t,t.dyn_ltree,t.l_desc.max_code),Hq(t,t.dyn_dtree,t.d_desc.max_code),qq(t,t.bl_desc),e=18;e>=3&&0===t.bl_tree[2*vq[e]+1];e--);return t.opt_len+=3*(e+1)+5+5+4,e}(t),i=t.opt_len+3+7>>>3,(o=t.static_len+3+7>>>3)<=i&&(i=o)):i=o=r+5,r+4<=i&&-1!==e?Wq(t,e,r,n):4===t.strategy||o===i?(Iq(t,2+(n?1:0),3),zq(t,wq,_q)):(Iq(t,4+(n?1:0),3),function(t,e,r,n){var i;for(Iq(t,e-257,5),Iq(t,r-1,5),Iq(t,n-4,4),i=0;i<n;i++)Iq(t,t.bl_tree[2*vq[i]+1],3);Kq(t,t.dyn_ltree,e-1),Kq(t,t.dyn_dtree,r-1)}(t,t.l_desc.max_code+1,t.d_desc.max_code+1,s+1),zq(t,t.dyn_ltree,t.dyn_dtree)),jq(t),n&&Dq(t)}function Yq(t,e,r){return t.pending_buf[t.d_buf+2*t.last_lit]=e>>>8&255,t.pending_buf[t.d_buf+2*t.last_lit+1]=255&e,t.pending_buf[t.l_buf+t.last_lit]=255&r,t.last_lit++,0===e?t.dyn_ltree[2*r]++:(t.matches++,e--,t.dyn_ltree[2*(Aq[r]+lq+1)]++,t.dyn_dtree[2*Nq(e)]++),t.last_lit===t.lit_bufsize-1}function Xq(t,e,r,n){for(var i=65535&t,o=t>>>16&65535,s=0;0!==r;){r-=s=r>2e3?2e3:r;do{o=o+(i=i+e[n++]|0)|0}while(--s);i%=65521,o%=65521}return i|o<<16}var $q=function(){for(var t,e=[],r=0;r<256;r++){t=r;for(var n=0;n<8;n++)t=1&t?3988292384^t>>>1:t>>>1;e[r]=t}return e}();function Qq(t,e,r,n){var i=$q,o=n+r;t^=-1;for(var s=n;s<o;s++)t=t>>>8^i[255&(t^e[s])];return-1^t}var tH,eH=-2,rH=258,nH=262,iH=103,oH=113,sH=666;function aH(t,e){return t.msg=oq[e],e}function uH(t){return(t<<1)-(t>4?9:0)}function hH(t){for(var e=t.length;--e>=0;)t[e]=0}function cH(t){var e=t.state,r=e.pending;r>t.avail_out&&(r=t.avail_out),0!==r&&(aq(t.output,e.pending_buf,e.pending_out,r,t.next_out),t.next_out+=r,e.pending_out+=r,t.total_out+=r,t.avail_out-=r,e.pending-=r,0===e.pending&&(e.pending_out=0))}function fH(t,e){Zq(t,t.block_start>=0?t.block_start:-1,t.strstart-t.block_start,e),t.block_start=t.strstart,cH(t.strm)}function lH(t,e){t.pending_buf[t.pending++]=e}function dH(t,e){t.pending_buf[t.pending++]=e>>>8&255,t.pending_buf[t.pending++]=255&e}function pH(t,e,r,n){var i=t.avail_in;return i>n&&(i=n),0===i?0:(t.avail_in-=i,aq(e,t.input,t.next_in,i,r),1===t.state.wrap?t.adler=Xq(t.adler,e,i,r):2===t.state.wrap&&(t.adler=Qq(t.adler,e,i,r)),t.next_in+=i,t.total_in+=i,i)}function mH(t,e){var r,n,i=t.max_chain_length,o=t.strstart,s=t.prev_length,a=t.nice_match,u=t.strstart>t.w_size-nH?t.strstart-(t.w_size-nH):0,h=t.window,c=t.w_mask,f=t.prev,l=t.strstart+rH,d=h[o+s-1],p=h[o+s];t.prev_length>=t.good_match&&(i>>=2),a>t.lookahead&&(a=t.lookahead);do{if(h[(r=e)+s]===p&&h[r+s-1]===d&&h[r]===h[o]&&h[++r]===h[o+1]){o+=2,r++;do{}while(h[++o]===h[++r]&&h[++o]===h[++r]&&h[++o]===h[++r]&&h[++o]===h[++r]&&h[++o]===h[++r]&&h[++o]===h[++r]&&h[++o]===h[++r]&&h[++o]===h[++r]&&o<l);if(n=rH-(l-o),o=l-rH,n>s){if(t.match_start=e,s=n,n>=a)break;d=h[o+s-1],p=h[o+s]}}}while((e=f[e&c])>u&&0!==--i);return s<=t.lookahead?s:t.lookahead}function gH(t){var e,r,n,i,o,s=t.w_size;do{if(i=t.window_size-t.lookahead-t.strstart,t.strstart>=s+(s-nH)){aq(t.window,t.window,s,s,0),t.match_start-=s,t.strstart-=s,t.block_start-=s,e=r=t.hash_size;do{n=t.head[--e],t.head[e]=n>=s?n-s:0}while(--r);e=r=s;do{n=t.prev[--e],t.prev[e]=n>=s?n-s:0}while(--r);i+=s}if(0===t.strm.avail_in)break;if(r=pH(t.strm,t.window,t.strstart+t.lookahead,i),t.lookahead+=r,t.lookahead+t.insert>=3)for(o=t.strstart-t.insert,t.ins_h=t.window[o],t.ins_h=(t.ins_h<<t.hash_shift^t.window[o+1])&t.hash_mask;t.insert&&(t.ins_h=(t.ins_h<<t.hash_shift^t.window[o+3-1])&t.hash_mask,t.prev[o&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=o,o++,t.insert--,!(t.lookahead+t.insert<3)););}while(t.lookahead<nH&&0!==t.strm.avail_in)}function yH(t,e){for(var r,n;;){if(t.lookahead<nH){if(gH(t),t.lookahead<nH&&0===e)return 1;if(0===t.lookahead)break}if(r=0,t.lookahead>=3&&(t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+3-1])&t.hash_mask,r=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),0!==r&&t.strstart-r<=t.w_size-nH&&(t.match_length=mH(t,r)),t.match_length>=3)if(n=Yq(t,t.strstart-t.match_start,t.match_length-3),t.lookahead-=t.match_length,t.match_length<=t.max_lazy_match&&t.lookahead>=3){t.match_length--;do{t.strstart++,t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+3-1])&t.hash_mask,r=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart}while(0!==--t.match_length);t.strstart++}else t.strstart+=t.match_length,t.match_length=0,t.ins_h=t.window[t.strstart],t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+1])&t.hash_mask;else n=Yq(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++;if(n&&(fH(t,!1),0===t.strm.avail_out))return 1}return t.insert=t.strstart<2?t.strstart:2,4===e?(fH(t,!0),0===t.strm.avail_out?3:4):t.last_lit&&(fH(t,!1),0===t.strm.avail_out)?1:2}function bH(t,e){for(var r,n,i;;){if(t.lookahead<nH){if(gH(t),t.lookahead<nH&&0===e)return 1;if(0===t.lookahead)break}if(r=0,t.lookahead>=3&&(t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+3-1])&t.hash_mask,r=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),t.prev_length=t.match_length,t.prev_match=t.match_start,t.match_length=2,0!==r&&t.prev_length<t.max_lazy_match&&t.strstart-r<=t.w_size-nH&&(t.match_length=mH(t,r),t.match_length<=5&&(1===t.strategy||3===t.match_length&&t.strstart-t.match_start>4096)&&(t.match_length=2)),t.prev_length>=3&&t.match_length<=t.prev_length){i=t.strstart+t.lookahead-3,n=Yq(t,t.strstart-1-t.prev_match,t.prev_length-3),t.lookahead-=t.prev_length-1,t.prev_length-=2;do{++t.strstart<=i&&(t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+3-1])&t.hash_mask,r=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart)}while(0!==--t.prev_length);if(t.match_available=0,t.match_length=2,t.strstart++,n&&(fH(t,!1),0===t.strm.avail_out))return 1}else if(t.match_available){if((n=Yq(t,0,t.window[t.strstart-1]))&&fH(t,!1),t.strstart++,t.lookahead--,0===t.strm.avail_out)return 1}else t.match_available=1,t.strstart++,t.lookahead--}return t.match_available&&(n=Yq(t,0,t.window[t.strstart-1]),t.match_available=0),t.insert=t.strstart<2?t.strstart:2,4===e?(fH(t,!0),0===t.strm.avail_out?3:4):t.last_lit&&(fH(t,!1),0===t.strm.avail_out)?1:2}function vH(t,e,r,n,i){this.good_length=t,this.max_lazy=e,this.nice_length=r,this.max_chain=n,this.func=i}function wH(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=8,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new hq(1146),this.dyn_dtree=new hq(122),this.bl_tree=new hq(78),hH(this.dyn_ltree),hH(this.dyn_dtree),hH(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new hq(16),this.heap=new hq(573),hH(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new hq(573),hH(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function _H(t){var e=function(t){var e;return t&&t.state?(t.total_in=t.total_out=0,t.data_type=2,(e=t.state).pending=0,e.pending_out=0,e.wrap<0&&(e.wrap=-e.wrap),e.status=e.wrap?42:oH,t.adler=2===e.wrap?0:1,e.last_flush=0,Vq(e),0):aH(t,eH)}(t);return 0===e&&function(t){t.window_size=2*t.w_size,hH(t.head),t.max_lazy_match=tH[t.level].max_lazy,t.good_match=tH[t.level].good_length,t.nice_match=tH[t.level].nice_length,t.max_chain_length=tH[t.level].max_chain,t.strstart=0,t.block_start=0,t.lookahead=0,t.insert=0,t.match_length=t.prev_length=2,t.match_available=0,t.ins_h=0}(t.state),e}function EH(t,e){var r,n,i,o;if(!t||!t.state||e>5||e<0)return t?aH(t,eH):eH;if(n=t.state,!t.output||!t.input&&0!==t.avail_in||n.status===sH&&4!==e)return aH(t,0===t.avail_out?-5:eH);if(n.strm=t,r=n.last_flush,n.last_flush=e,42===n.status)if(2===n.wrap)t.adler=0,lH(n,31),lH(n,139),lH(n,8),n.gzhead?(lH(n,(n.gzhead.text?1:0)+(n.gzhead.hcrc?2:0)+(n.gzhead.extra?4:0)+(n.gzhead.name?8:0)+(n.gzhead.comment?16:0)),lH(n,255&n.gzhead.time),lH(n,n.gzhead.time>>8&255),lH(n,n.gzhead.time>>16&255),lH(n,n.gzhead.time>>24&255),lH(n,9===n.level?2:n.strategy>=2||n.level<2?4:0),lH(n,255&n.gzhead.os),n.gzhead.extra&&n.gzhead.extra.length&&(lH(n,255&n.gzhead.extra.length),lH(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(t.adler=Qq(t.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=69):(lH(n,0),lH(n,0),lH(n,0),lH(n,0),lH(n,0),lH(n,9===n.level?2:n.strategy>=2||n.level<2?4:0),lH(n,3),n.status=oH);else{var s=8+(n.w_bits-8<<4)<<8;s|=(n.strategy>=2||n.level<2?0:n.level<6?1:6===n.level?2:3)<<6,0!==n.strstart&&(s|=32),s+=31-s%31,n.status=oH,dH(n,s),0!==n.strstart&&(dH(n,t.adler>>>16),dH(n,65535&t.adler)),t.adler=1}if(69===n.status)if(n.gzhead.extra){for(i=n.pending;n.gzindex<(65535&n.gzhead.extra.length)&&(n.pending!==n.pending_buf_size||(n.gzhead.hcrc&&n.pending>i&&(t.adler=Qq(t.adler,n.pending_buf,n.pending-i,i)),cH(t),i=n.pending,n.pending!==n.pending_buf_size));)lH(n,255&n.gzhead.extra[n.gzindex]),n.gzindex++;n.gzhead.hcrc&&n.pending>i&&(t.adler=Qq(t.adler,n.pending_buf,n.pending-i,i)),n.gzindex===n.gzhead.extra.length&&(n.gzindex=0,n.status=73)}else n.status=73;if(73===n.status)if(n.gzhead.name){i=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>i&&(t.adler=Qq(t.adler,n.pending_buf,n.pending-i,i)),cH(t),i=n.pending,n.pending===n.pending_buf_size)){o=1;break}o=n.gzindex<n.gzhead.name.length?255&n.gzhead.name.charCodeAt(n.gzindex++):0,lH(n,o)}while(0!==o);n.gzhead.hcrc&&n.pending>i&&(t.adler=Qq(t.adler,n.pending_buf,n.pending-i,i)),0===o&&(n.gzindex=0,n.status=91)}else n.status=91;if(91===n.status)if(n.gzhead.comment){i=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>i&&(t.adler=Qq(t.adler,n.pending_buf,n.pending-i,i)),cH(t),i=n.pending,n.pending===n.pending_buf_size)){o=1;break}o=n.gzindex<n.gzhead.comment.length?255&n.gzhead.comment.charCodeAt(n.gzindex++):0,lH(n,o)}while(0!==o);n.gzhead.hcrc&&n.pending>i&&(t.adler=Qq(t.adler,n.pending_buf,n.pending-i,i)),0===o&&(n.status=iH)}else n.status=iH;if(n.status===iH&&(n.gzhead.hcrc?(n.pending+2>n.pending_buf_size&&cH(t),n.pending+2<=n.pending_buf_size&&(lH(n,255&t.adler),lH(n,t.adler>>8&255),t.adler=0,n.status=oH)):n.status=oH),0!==n.pending){if(cH(t),0===t.avail_out)return n.last_flush=-1,0}else if(0===t.avail_in&&uH(e)<=uH(r)&&4!==e)return aH(t,-5);if(n.status===sH&&0!==t.avail_in)return aH(t,-5);if(0!==t.avail_in||0!==n.lookahead||0!==e&&n.status!==sH){var a=2===n.strategy?function(t,e){for(var r;;){if(0===t.lookahead&&(gH(t),0===t.lookahead)){if(0===e)return 1;break}if(t.match_length=0,r=Yq(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++,r&&(fH(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,4===e?(fH(t,!0),0===t.strm.avail_out?3:4):t.last_lit&&(fH(t,!1),0===t.strm.avail_out)?1:2}(n,e):3===n.strategy?function(t,e){for(var r,n,i,o,s=t.window;;){if(t.lookahead<=rH){if(gH(t),t.lookahead<=rH&&0===e)return 1;if(0===t.lookahead)break}if(t.match_length=0,t.lookahead>=3&&t.strstart>0&&(n=s[i=t.strstart-1])===s[++i]&&n===s[++i]&&n===s[++i]){o=t.strstart+rH;do{}while(n===s[++i]&&n===s[++i]&&n===s[++i]&&n===s[++i]&&n===s[++i]&&n===s[++i]&&n===s[++i]&&n===s[++i]&&i<o);t.match_length=rH-(o-i),t.match_length>t.lookahead&&(t.match_length=t.lookahead)}if(t.match_length>=3?(r=Yq(t,1,t.match_length-3),t.lookahead-=t.match_length,t.strstart+=t.match_length,t.match_length=0):(r=Yq(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++),r&&(fH(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,4===e?(fH(t,!0),0===t.strm.avail_out?3:4):t.last_lit&&(fH(t,!1),0===t.strm.avail_out)?1:2}(n,e):tH[n.level].func(n,e);if(3!==a&&4!==a||(n.status=sH),1===a||3===a)return 0===t.avail_out&&(n.last_flush=-1),0;if(2===a&&(1===e?Jq(n):5!==e&&(Wq(n,0,0,!1),3===e&&(hH(n.head),0===n.lookahead&&(n.strstart=0,n.block_start=0,n.insert=0))),cH(t),0===t.avail_out))return n.last_flush=-1,0}return 4!==e?0:n.wrap<=0?1:(2===n.wrap?(lH(n,255&t.adler),lH(n,t.adler>>8&255),lH(n,t.adler>>16&255),lH(n,t.adler>>24&255),lH(n,255&t.total_in),lH(n,t.total_in>>8&255),lH(n,t.total_in>>16&255),lH(n,t.total_in>>24&255)):(dH(n,t.adler>>>16),dH(n,65535&t.adler)),cH(t),n.wrap>0&&(n.wrap=-n.wrap),0!==n.pending?0:1)}tH=[new vH(0,0,0,0,function(t,e){var r=65535;for(r>t.pending_buf_size-5&&(r=t.pending_buf_size-5);;){if(t.lookahead<=1){if(gH(t),0===t.lookahead&&0===e)return 1;if(0===t.lookahead)break}t.strstart+=t.lookahead,t.lookahead=0;var n=t.block_start+r;if((0===t.strstart||t.strstart>=n)&&(t.lookahead=t.strstart-n,t.strstart=n,fH(t,!1),0===t.strm.avail_out))return 1;if(t.strstart-t.block_start>=t.w_size-nH&&(fH(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,4===e?(fH(t,!0),0===t.strm.avail_out?3:4):(t.strstart>t.block_start&&(fH(t,!1),t.strm.avail_out),1)}),new vH(4,4,8,4,yH),new vH(4,5,16,8,yH),new vH(4,6,32,32,yH),new vH(4,4,16,16,bH),new vH(8,16,32,32,bH),new vH(8,16,128,128,bH),new vH(8,32,128,256,bH),new vH(32,128,258,1024,bH),new vH(32,258,258,4096,bH)];function AH(t,e){var r,n,i,o,s,a,u,h,c,f,l,d,p,m,g,y,b,v,w,_,E,A,M,S,k;r=t.state,n=t.next_in,S=t.input,i=n+(t.avail_in-5),o=t.next_out,k=t.output,s=o-(e-t.avail_out),a=o+(t.avail_out-257),u=r.dmax,h=r.wsize,c=r.whave,f=r.wnext,l=r.window,d=r.hold,p=r.bits,m=r.lencode,g=r.distcode,y=(1<<r.lenbits)-1,b=(1<<r.distbits)-1;t:do{p<15&&(d+=S[n++]<<p,p+=8,d+=S[n++]<<p,p+=8),v=m[d&y];e:for(;;){if(d>>>=w=v>>>24,p-=w,0===(w=v>>>16&255))k[o++]=65535&v;else{if(!(16&w)){if(64&w){if(32&w){r.mode=12;break t}t.msg="invalid literal/length code",r.mode=30;break t}v=m[(65535&v)+(d&(1<<w)-1)];continue e}for(_=65535&v,(w&=15)&&(p<w&&(d+=S[n++]<<p,p+=8),_+=d&(1<<w)-1,d>>>=w,p-=w),p<15&&(d+=S[n++]<<p,p+=8,d+=S[n++]<<p,p+=8),v=g[d&b];;){if(d>>>=w=v>>>24,p-=w,16&(w=v>>>16&255)){if(E=65535&v,p<(w&=15)&&(d+=S[n++]<<p,(p+=8)<w&&(d+=S[n++]<<p,p+=8)),(E+=d&(1<<w)-1)>u){t.msg="invalid distance too far back",r.mode=30;break t}if(d>>>=w,p-=w,E>(w=o-s)){if((w=E-w)>c&&r.sane){t.msg="invalid distance too far back",r.mode=30;break t}if(A=0,M=l,0===f){if(A+=h-w,w<_){_-=w;do{k[o++]=l[A++]}while(--w);A=o-E,M=k}}else if(f<w){if(A+=h+f-w,(w-=f)<_){_-=w;do{k[o++]=l[A++]}while(--w);if(A=0,f<_){_-=w=f;do{k[o++]=l[A++]}while(--w);A=o-E,M=k}}}else if(A+=f-w,w<_){_-=w;do{k[o++]=l[A++]}while(--w);A=o-E,M=k}for(;_>2;)k[o++]=M[A++],k[o++]=M[A++],k[o++]=M[A++],_-=3;_&&(k[o++]=M[A++],_>1&&(k[o++]=M[A++]))}else{A=o-E;do{k[o++]=k[A++],k[o++]=k[A++],k[o++]=k[A++],_-=3}while(_>2);_&&(k[o++]=k[A++],_>1&&(k[o++]=k[A++]))}break}if(64&w){t.msg="invalid distance code",r.mode=30;break t}v=g[(65535&v)+(d&(1<<w)-1)]}}break}}while(n<i&&o<a);n-=_=p>>3,d&=(1<<(p-=_<<3))-1,t.next_in=n,t.next_out=o,t.avail_in=n<i?i-n+5:5-(n-i),t.avail_out=o<a?a-o+257:257-(o-a),r.hold=d,r.bits=p}var MH=15,SH=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],kH=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],xH=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],TH=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];function RH(t,e,r,n,i,o,s,a){var u,h,c,f,l,d,p,m,g,y=a.bits,b=0,v=0,w=0,_=0,E=0,A=0,M=0,S=0,k=0,x=0,T=null,R=0,B=new hq(16),N=new hq(16),P=null,I=0;for(b=0;b<=MH;b++)B[b]=0;for(v=0;v<n;v++)B[e[r+v]]++;for(E=y,_=MH;_>=1&&0===B[_];_--);if(E>_&&(E=_),0===_)return i[o++]=20971520,i[o++]=20971520,a.bits=1,0;for(w=1;w<_&&0===B[w];w++);for(E<w&&(E=w),S=1,b=1;b<=MH;b++)if(S<<=1,(S-=B[b])<0)return-1;if(S>0&&(0===t||1!==_))return-1;for(N[1]=0,b=1;b<MH;b++)N[b+1]=N[b]+B[b];for(v=0;v<n;v++)0!==e[r+v]&&(s[N[e[r+v]]++]=v);if(0===t?(T=P=s,d=19):1===t?(T=SH,R-=257,P=kH,I-=257,d=256):(T=xH,P=TH,d=-1),x=0,v=0,b=w,l=o,A=E,M=0,c=-1,f=(k=1<<E)-1,1===t&&k>852||2===t&&k>592)return 1;for(;;){p=b-M,s[v]<d?(m=0,g=s[v]):s[v]>d?(m=P[I+s[v]],g=T[R+s[v]]):(m=96,g=0),u=1<<b-M,w=h=1<<A;do{i[l+(x>>M)+(h-=u)]=p<<24|m<<16|g}while(0!==h);for(u=1<<b-1;x&u;)u>>=1;if(0!==u?(x&=u-1,x+=u):x=0,v++,0===--B[b]){if(b===_)break;b=e[r+s[v]]}if(b>E&&(x&f)!==c){for(0===M&&(M=E),l+=w,S=1<<(A=b-M);A+M<_&&!((S-=B[A+M])<=0);)A++,S<<=1;if(k+=1<<A,1===t&&k>852||2===t&&k>592)return 1;i[c=x&f]=E<<24|A<<16|l-o}}return 0!==x&&(i[l+x]=b-M<<24|64<<16),a.bits=E,0}var BH=-2,NH=12,PH=30;function IH(t){return(t>>>24&255)+(t>>>8&65280)+((65280&t)<<8)+((255&t)<<24)}function OH(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new hq(320),this.work=new hq(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function CH(t){var e;return t&&t.state?((e=t.state).wsize=0,e.whave=0,e.wnext=0,function(t){var e;return t&&t.state?(e=t.state,t.total_in=t.total_out=e.total=0,t.msg="",e.wrap&&(t.adler=1&e.wrap),e.mode=1,e.last=0,e.havedict=0,e.dmax=32768,e.head=null,e.hold=0,e.bits=0,e.lencode=e.lendyn=new cq(852),e.distcode=e.distdyn=new cq(592),e.sane=1,e.back=-1,0):BH}(t)):BH}function LH(t,e){var r,n;return t?(n=new OH,t.state=n,n.window=null,r=function(t,e){var r,n;return t&&t.state?(n=t.state,e<0?(r=0,e=-e):(r=1+(e>>4),e<48&&(e&=15)),e&&(e<8||e>15)?BH:(null!==n.window&&n.wbits!==e&&(n.window=null),n.wrap=r,n.wbits=e,CH(t))):BH}(t,e),0!==r&&(t.state=null),r):BH}var jH,DH,UH=!0;function FH(t){if(UH){var e;for(jH=new cq(512),DH=new cq(32),e=0;e<144;)t.lens[e++]=8;for(;e<256;)t.lens[e++]=9;for(;e<280;)t.lens[e++]=7;for(;e<288;)t.lens[e++]=8;for(RH(1,t.lens,0,288,jH,0,t.work,{bits:9}),e=0;e<32;)t.lens[e++]=5;RH(2,t.lens,0,32,DH,0,t.work,{bits:5}),UH=!1}t.lencode=jH,t.lenbits=9,t.distcode=DH,t.distbits=5}function zH(t,e){var r,n,i,o,s,a,u,h,c,f,l,d,p,m,g,y,b,v,w,_,E,A,M,S,k=0,x=new uq(4),T=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!t||!t.state||!t.output||!t.input&&0!==t.avail_in)return BH;(r=t.state).mode===NH&&(r.mode=13),s=t.next_out,i=t.output,u=t.avail_out,o=t.next_in,n=t.input,a=t.avail_in,h=r.hold,c=r.bits,f=a,l=u,A=0;t:for(;;)switch(r.mode){case 1:if(0===r.wrap){r.mode=13;break}for(;c<16;){if(0===a)break t;a--,h+=n[o++]<<c,c+=8}if(2&r.wrap&&35615===h){r.check=0,x[0]=255&h,x[1]=h>>>8&255,r.check=Qq(r.check,x,2,0),h=0,c=0,r.mode=2;break}if(r.flags=0,r.head&&(r.head.done=!1),!(1&r.wrap)||(((255&h)<<8)+(h>>8))%31){t.msg="incorrect header check",r.mode=PH;break}if(8!=(15&h)){t.msg="unknown compression method",r.mode=PH;break}if(c-=4,E=8+(15&(h>>>=4)),0===r.wbits)r.wbits=E;else if(E>r.wbits){t.msg="invalid window size",r.mode=PH;break}r.dmax=1<<E,t.adler=r.check=1,r.mode=512&h?10:NH,h=0,c=0;break;case 2:for(;c<16;){if(0===a)break t;a--,h+=n[o++]<<c,c+=8}if(r.flags=h,8!=(255&r.flags)){t.msg="unknown compression method",r.mode=PH;break}if(57344&r.flags){t.msg="unknown header flags set",r.mode=PH;break}r.head&&(r.head.text=h>>8&1),512&r.flags&&(x[0]=255&h,x[1]=h>>>8&255,r.check=Qq(r.check,x,2,0)),h=0,c=0,r.mode=3;case 3:for(;c<32;){if(0===a)break t;a--,h+=n[o++]<<c,c+=8}r.head&&(r.head.time=h),512&r.flags&&(x[0]=255&h,x[1]=h>>>8&255,x[2]=h>>>16&255,x[3]=h>>>24&255,r.check=Qq(r.check,x,4,0)),h=0,c=0,r.mode=4;case 4:for(;c<16;){if(0===a)break t;a--,h+=n[o++]<<c,c+=8}r.head&&(r.head.xflags=255&h,r.head.os=h>>8),512&r.flags&&(x[0]=255&h,x[1]=h>>>8&255,r.check=Qq(r.check,x,2,0)),h=0,c=0,r.mode=5;case 5:if(1024&r.flags){for(;c<16;){if(0===a)break t;a--,h+=n[o++]<<c,c+=8}r.length=h,r.head&&(r.head.extra_len=h),512&r.flags&&(x[0]=255&h,x[1]=h>>>8&255,r.check=Qq(r.check,x,2,0)),h=0,c=0}else r.head&&(r.head.extra=null);r.mode=6;case 6:if(1024&r.flags&&((d=r.length)>a&&(d=a),d&&(r.head&&(E=r.head.extra_len-r.length,r.head.extra||(r.head.extra=new Array(r.head.extra_len)),aq(r.head.extra,n,o,d,E)),512&r.flags&&(r.check=Qq(r.check,n,d,o)),a-=d,o+=d,r.length-=d),r.length))break t;r.length=0,r.mode=7;case 7:if(2048&r.flags){if(0===a)break t;d=0;do{E=n[o+d++],r.head&&E&&r.length<65536&&(r.head.name+=String.fromCharCode(E))}while(E&&d<a);if(512&r.flags&&(r.check=Qq(r.check,n,d,o)),a-=d,o+=d,E)break t}else r.head&&(r.head.name=null);r.length=0,r.mode=8;case 8:if(4096&r.flags){if(0===a)break t;d=0;do{E=n[o+d++],r.head&&E&&r.length<65536&&(r.head.comment+=String.fromCharCode(E))}while(E&&d<a);if(512&r.flags&&(r.check=Qq(r.check,n,d,o)),a-=d,o+=d,E)break t}else r.head&&(r.head.comment=null);r.mode=9;case 9:if(512&r.flags){for(;c<16;){if(0===a)break t;a--,h+=n[o++]<<c,c+=8}if(h!==(65535&r.check)){t.msg="header crc mismatch",r.mode=PH;break}h=0,c=0}r.head&&(r.head.hcrc=r.flags>>9&1,r.head.done=!0),t.adler=r.check=0,r.mode=NH;break;case 10:for(;c<32;){if(0===a)break t;a--,h+=n[o++]<<c,c+=8}t.adler=r.check=IH(h),h=0,c=0,r.mode=11;case 11:if(0===r.havedict)return t.next_out=s,t.avail_out=u,t.next_in=o,t.avail_in=a,r.hold=h,r.bits=c,2;t.adler=r.check=1,r.mode=NH;case NH:if(5===e||6===e)break t;case 13:if(r.last){h>>>=7&c,c-=7&c,r.mode=27;break}for(;c<3;){if(0===a)break t;a--,h+=n[o++]<<c,c+=8}switch(r.last=1&h,c-=1,3&(h>>>=1)){case 0:r.mode=14;break;case 1:if(FH(r),r.mode=20,6===e){h>>>=2,c-=2;break t}break;case 2:r.mode=17;break;case 3:t.msg="invalid block type",r.mode=PH}h>>>=2,c-=2;break;case 14:for(h>>>=7&c,c-=7&c;c<32;){if(0===a)break t;a--,h+=n[o++]<<c,c+=8}if((65535&h)!=(h>>>16^65535)){t.msg="invalid stored block lengths",r.mode=PH;break}if(r.length=65535&h,h=0,c=0,r.mode=15,6===e)break t;case 15:r.mode=16;case 16:if(d=r.length){if(d>a&&(d=a),d>u&&(d=u),0===d)break t;aq(i,n,o,d,s),a-=d,o+=d,u-=d,s+=d,r.length-=d;break}r.mode=NH;break;case 17:for(;c<14;){if(0===a)break t;a--,h+=n[o++]<<c,c+=8}if(r.nlen=257+(31&h),h>>>=5,c-=5,r.ndist=1+(31&h),h>>>=5,c-=5,r.ncode=4+(15&h),h>>>=4,c-=4,r.nlen>286||r.ndist>30){t.msg="too many length or distance symbols",r.mode=PH;break}r.have=0,r.mode=18;case 18:for(;r.have<r.ncode;){for(;c<3;){if(0===a)break t;a--,h+=n[o++]<<c,c+=8}r.lens[T[r.have++]]=7&h,h>>>=3,c-=3}for(;r.have<19;)r.lens[T[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,M={bits:r.lenbits},A=RH(0,r.lens,0,19,r.lencode,0,r.work,M),r.lenbits=M.bits,A){t.msg="invalid code lengths set",r.mode=PH;break}r.have=0,r.mode=19;case 19:for(;r.have<r.nlen+r.ndist;){for(;y=(k=r.lencode[h&(1<<r.lenbits)-1])>>>16&255,b=65535&k,!((g=k>>>24)<=c);){if(0===a)break t;a--,h+=n[o++]<<c,c+=8}if(b<16)h>>>=g,c-=g,r.lens[r.have++]=b;else{if(16===b){for(S=g+2;c<S;){if(0===a)break t;a--,h+=n[o++]<<c,c+=8}if(h>>>=g,c-=g,0===r.have){t.msg="invalid bit length repeat",r.mode=PH;break}E=r.lens[r.have-1],d=3+(3&h),h>>>=2,c-=2}else if(17===b){for(S=g+3;c<S;){if(0===a)break t;a--,h+=n[o++]<<c,c+=8}c-=g,E=0,d=3+(7&(h>>>=g)),h>>>=3,c-=3}else{for(S=g+7;c<S;){if(0===a)break t;a--,h+=n[o++]<<c,c+=8}c-=g,E=0,d=11+(127&(h>>>=g)),h>>>=7,c-=7}if(r.have+d>r.nlen+r.ndist){t.msg="invalid bit length repeat",r.mode=PH;break}for(;d--;)r.lens[r.have++]=E}}if(r.mode===PH)break;if(0===r.lens[256]){t.msg="invalid code -- missing end-of-block",r.mode=PH;break}if(r.lenbits=9,M={bits:r.lenbits},A=RH(1,r.lens,0,r.nlen,r.lencode,0,r.work,M),r.lenbits=M.bits,A){t.msg="invalid literal/lengths set",r.mode=PH;break}if(r.distbits=6,r.distcode=r.distdyn,M={bits:r.distbits},A=RH(2,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,M),r.distbits=M.bits,A){t.msg="invalid distances set",r.mode=PH;break}if(r.mode=20,6===e)break t;case 20:r.mode=21;case 21:if(a>=6&&u>=258){t.next_out=s,t.avail_out=u,t.next_in=o,t.avail_in=a,r.hold=h,r.bits=c,AH(t,l),s=t.next_out,i=t.output,u=t.avail_out,o=t.next_in,n=t.input,a=t.avail_in,h=r.hold,c=r.bits,r.mode===NH&&(r.back=-1);break}for(r.back=0;y=(k=r.lencode[h&(1<<r.lenbits)-1])>>>16&255,b=65535&k,!((g=k>>>24)<=c);){if(0===a)break t;a--,h+=n[o++]<<c,c+=8}if(y&&!(240&y)){for(v=g,w=y,_=b;y=(k=r.lencode[_+((h&(1<<v+w)-1)>>v)])>>>16&255,b=65535&k,!(v+(g=k>>>24)<=c);){if(0===a)break t;a--,h+=n[o++]<<c,c+=8}h>>>=v,c-=v,r.back+=v}if(h>>>=g,c-=g,r.back+=g,r.length=b,0===y){r.mode=26;break}if(32&y){r.back=-1,r.mode=NH;break}if(64&y){t.msg="invalid literal/length code",r.mode=PH;break}r.extra=15&y,r.mode=22;case 22:if(r.extra){for(S=r.extra;c<S;){if(0===a)break t;a--,h+=n[o++]<<c,c+=8}r.length+=h&(1<<r.extra)-1,h>>>=r.extra,c-=r.extra,r.back+=r.extra}r.was=r.length,r.mode=23;case 23:for(;y=(k=r.distcode[h&(1<<r.distbits)-1])>>>16&255,b=65535&k,!((g=k>>>24)<=c);){if(0===a)break t;a--,h+=n[o++]<<c,c+=8}if(!(240&y)){for(v=g,w=y,_=b;y=(k=r.distcode[_+((h&(1<<v+w)-1)>>v)])>>>16&255,b=65535&k,!(v+(g=k>>>24)<=c);){if(0===a)break t;a--,h+=n[o++]<<c,c+=8}h>>>=v,c-=v,r.back+=v}if(h>>>=g,c-=g,r.back+=g,64&y){t.msg="invalid distance code",r.mode=PH;break}r.offset=b,r.extra=15&y,r.mode=24;case 24:if(r.extra){for(S=r.extra;c<S;){if(0===a)break t;a--,h+=n[o++]<<c,c+=8}r.offset+=h&(1<<r.extra)-1,h>>>=r.extra,c-=r.extra,r.back+=r.extra}if(r.offset>r.dmax){t.msg="invalid distance too far back",r.mode=PH;break}r.mode=25;case 25:if(0===u)break t;if(d=l-u,r.offset>d){if((d=r.offset-d)>r.whave&&r.sane){t.msg="invalid distance too far back",r.mode=PH;break}d>r.wnext?(d-=r.wnext,p=r.wsize-d):p=r.wnext-d,d>r.length&&(d=r.length),m=r.window}else m=i,p=s-r.offset,d=r.length;d>u&&(d=u),u-=d,r.length-=d;do{i[s++]=m[p++]}while(--d);0===r.length&&(r.mode=21);break;case 26:if(0===u)break t;i[s++]=r.length,u--,r.mode=21;break;case 27:if(r.wrap){for(;c<32;){if(0===a)break t;a--,h|=n[o++]<<c,c+=8}if(l-=u,t.total_out+=l,r.total+=l,l&&(t.adler=r.check=r.flags?Qq(r.check,i,l,s-l):Xq(r.check,i,l,s-l)),l=u,(r.flags?h:IH(h))!==r.check){t.msg="incorrect data check",r.mode=PH;break}h=0,c=0}r.mode=28;case 28:if(r.wrap&&r.flags){for(;c<32;){if(0===a)break t;a--,h+=n[o++]<<c,c+=8}if(h!==(4294967295&r.total)){t.msg="incorrect length check",r.mode=PH;break}h=0,c=0}r.mode=29;case 29:A=1;break t;case PH:A=-3;break t;case 31:return-4;default:return BH}return t.next_out=s,t.avail_out=u,t.next_in=o,t.avail_in=a,r.hold=h,r.bits=c,(r.wsize||l!==t.avail_out&&r.mode<PH&&(r.mode<27||4!==e))&&function(t,e,r,n){var i,o=t.state;null===o.window&&(o.wsize=1<<o.wbits,o.wnext=0,o.whave=0,o.window=new uq(o.wsize)),n>=o.wsize?(aq(o.window,e,r-o.wsize,o.wsize,0),o.wnext=0,o.whave=o.wsize):((i=o.wsize-o.wnext)>n&&(i=n),aq(o.window,e,r-n,i,o.wnext),(n-=i)?(aq(o.window,e,r-n,n,0),o.wnext=n,o.whave=o.wsize):(o.wnext+=i,o.wnext===o.wsize&&(o.wnext=0),o.whave<o.wsize&&(o.whave+=i)))}(t,t.output,t.next_out,l-t.avail_out),f-=t.avail_in,l-=t.avail_out,t.total_in+=f,t.total_out+=l,r.total+=l,r.wrap&&l&&(t.adler=r.check=r.flags?Qq(r.check,i,l,t.next_out-l):Xq(r.check,i,l,t.next_out-l)),t.data_type=r.bits+(r.last?64:0)+(r.mode===NH?128:0)+(20===r.mode||15===r.mode?256:0),(0===f&&0===l||4===e)&&0===A&&(A=-5),A}var qH;function HH(t){if(t<1||t>7)throw new TypeError("Bad argument");this.mode=t,this.init_done=!1,this.write_in_progress=!1,this.pending_close=!1,this.windowBits=0,this.level=0,this.memLevel=0,this.strategy=0,this.dictionary=null}function KH(t,e){for(var r=0;r<t.length;r++)this[e+r]=t[r]}HH.prototype.init=function(t,e,r,n,i){var o;switch(this.windowBits=t,this.level=e,this.memLevel=r,this.strategy=n,3!==this.mode&&4!==this.mode||(this.windowBits+=16),7===this.mode&&(this.windowBits+=32),5!==this.mode&&6!==this.mode||(this.windowBits=-this.windowBits),this.strm=new sq,this.mode){case 1:case 3:case 5:o=function(t,e,r,n,i,o){if(!t)return eH;var s=1;if(-1===e&&(e=6),n<0?(s=0,n=-n):n>15&&(s=2,n-=16),i<1||i>9||8!==r||n<8||n>15||e<0||e>9||o<0||o>4)return aH(t,eH);8===n&&(n=9);var a=new wH;return t.state=a,a.strm=t,a.wrap=s,a.gzhead=null,a.w_bits=n,a.w_size=1<<a.w_bits,a.w_mask=a.w_size-1,a.hash_bits=i+7,a.hash_size=1<<a.hash_bits,a.hash_mask=a.hash_size-1,a.hash_shift=~~((a.hash_bits+3-1)/3),a.window=new uq(2*a.w_size),a.head=new hq(a.hash_size),a.prev=new hq(a.w_size),a.lit_bufsize=1<<i+6,a.pending_buf_size=4*a.lit_bufsize,a.pending_buf=new uq(a.pending_buf_size),a.d_buf=1*a.lit_bufsize,a.l_buf=3*a.lit_bufsize,a.level=e,a.strategy=o,a.method=r,_H(t)}(this.strm,this.level,8,this.windowBits,this.memLevel,this.strategy);break;case 2:case 4:case 6:case 7:o=LH(this.strm,this.windowBits);break;default:throw new Error("Unknown mode "+this.mode)}0===o?(this.write_in_progress=!1,this.init_done=!0):this._error(o)},HH.prototype.params=function(){throw new Error("deflateParams Not supported")},HH.prototype._writeCheck=function(){if(!this.init_done)throw new Error("write before init");if(0===this.mode)throw new Error("already finalized");if(this.write_in_progress)throw new Error("write already in progress");if(this.pending_close)throw new Error("close is pending")},HH.prototype.write=function(t,e,r,n,i,o,s){this._writeCheck(),this.write_in_progress=!0;var a=this;return vr.nextTick(function(){a.write_in_progress=!1;var u=a._write(t,e,r,n,i,o,s);a.callback(u[0],u[1]),a.pending_close&&a.close()}),this},HH.prototype.writeSync=function(t,e,r,n,i,o,s){return this._writeCheck(),this._write(t,e,r,n,i,o,s)},HH.prototype._write=function(t,e,r,n,i,o,s){if(this.write_in_progress=!0,0!==t&&1!==t&&2!==t&&3!==t&&4!==t&&5!==t)throw new Error("Invalid flush value");null==e&&(e=new _(0),n=0,r=0),i._set?i.set=i._set:i.set=KH;var a,u=this.strm;switch(u.avail_in=n,u.input=e,u.next_in=r,u.avail_out=s,u.output=i,u.next_out=o,this.mode){case 1:case 3:case 5:a=EH(u,t);break;case 7:case 2:case 4:case 6:a=zH(u,t);break;default:throw new Error("Unknown mode "+this.mode)}return 1!==a&&0!==a&&this._error(a),this.write_in_progress=!1,[u.avail_in,u.avail_out]},HH.prototype.close=function(){this.write_in_progress?this.pending_close=!0:(this.pending_close=!1,1===this.mode||3===this.mode||5===this.mode?function(t){var e;t&&t.state&&(42!==(e=t.state.status)&&69!==e&&73!==e&&91!==e&&e!==iH&&e!==oH&&e!==sH?aH(t,eH):(t.state=null,e===oH&&aH(t,-3)))}(this.strm):function(t){if(!t||!t.state)return BH;var e=t.state;e.window&&(e.window=null),t.state=null}(this.strm),this.mode=0)},HH.prototype.reset=function(){switch(this.mode){case 1:case 5:qH=_H(this.strm);break;case 2:case 6:qH=CH(this.strm)}0!==qH&&this._error(qH)},HH.prototype._error=function(t){this.onerror(oq[t]+": "+this.strm.msg,t),this.write_in_progress=!1,this.pending_close&&this.close()};var GH=Object.freeze({__proto__:null,DEFLATE:1,DEFLATERAW:5,GUNZIP:4,GZIP:3,INFLATE:2,INFLATERAW:6,NONE:0,UNZIP:7,Z_BEST_COMPRESSION:9,Z_BEST_SPEED:1,Z_BINARY:0,Z_BLOCK:5,Z_BUF_ERROR:-5,Z_DATA_ERROR:-3,Z_DEFAULT_COMPRESSION:-1,Z_DEFAULT_STRATEGY:0,Z_DEFLATED:8,Z_ERRNO:-1,Z_FILTERED:1,Z_FINISH:4,Z_FIXED:4,Z_FULL_FLUSH:3,Z_HUFFMAN_ONLY:2,Z_NEED_DICT:2,Z_NO_COMPRESSION:0,Z_NO_FLUSH:0,Z_OK:0,Z_PARTIAL_FLUSH:1,Z_RLE:3,Z_STREAM_END:1,Z_STREAM_ERROR:-2,Z_SYNC_FLUSH:2,Z_TEXT:1,Z_TREES:6,Z_UNKNOWN:2,Zlib:HH});var VH={};Object.keys(GH).forEach(function(t){VH[t]=GH[t]}),VH.Z_MIN_WINDOWBITS=8,VH.Z_MAX_WINDOWBITS=15,VH.Z_DEFAULT_WINDOWBITS=15,VH.Z_MIN_CHUNK=64,VH.Z_MAX_CHUNK=1/0,VH.Z_DEFAULT_CHUNK=16384,VH.Z_MIN_MEMLEVEL=1,VH.Z_MAX_MEMLEVEL=9,VH.Z_DEFAULT_MEMLEVEL=8,VH.Z_MIN_LEVEL=-1,VH.Z_MAX_LEVEL=9,VH.Z_DEFAULT_LEVEL=VH.Z_DEFAULT_COMPRESSION;var WH={Z_OK:VH.Z_OK,Z_STREAM_END:VH.Z_STREAM_END,Z_NEED_DICT:VH.Z_NEED_DICT,Z_ERRNO:VH.Z_ERRNO,Z_STREAM_ERROR:VH.Z_STREAM_ERROR,Z_DATA_ERROR:VH.Z_DATA_ERROR,Z_MEM_ERROR:VH.Z_MEM_ERROR,Z_BUF_ERROR:VH.Z_BUF_ERROR,Z_VERSION_ERROR:VH.Z_VERSION_ERROR};function JH(t){return new yK(t)}function ZH(t){return new bK(t)}function YH(t){return new _K(t)}function XH(t){return new EK(t)}function $H(t){return new vK(t)}function QH(t){return new wK(t)}function tK(t){return new AK(t)}function eK(t,e,r){return"function"==typeof e&&(r=e,e={}),mK(new yK(e),t,r)}function rK(t,e){return gK(new yK(e),t)}function nK(t,e,r){return"function"==typeof e&&(r=e,e={}),mK(new vK(e),t,r)}function iK(t,e){return gK(new vK(e),t)}function oK(t,e,r){return"function"==typeof e&&(r=e,e={}),mK(new _K(e),t,r)}function sK(t,e){return gK(new _K(e),t)}function aK(t,e,r){return"function"==typeof e&&(r=e,e={}),mK(new AK(e),t,r)}function uK(t,e){return gK(new AK(e),t)}function hK(t,e,r){return"function"==typeof e&&(r=e,e={}),mK(new bK(e),t,r)}function cK(t,e){return gK(new bK(e),t)}function fK(t,e,r){return"function"==typeof e&&(r=e,e={}),mK(new wK(e),t,r)}function lK(t,e){return gK(new wK(e),t)}function dK(t,e,r){return"function"==typeof e&&(r=e,e={}),mK(new EK(e),t,r)}function pK(t,e){return gK(new EK(e),t)}function mK(t,e,r){var n=[],i=0;function o(){for(var e;null!==(e=t.read());)n.push(e),i+=e.length;t.once("readable",o)}function s(){var e=_.concat(n,i);n=[],r(null,e),t.close()}t.on("error",function(e){t.removeListener("end",s),t.removeListener("readable",o),r(e)}),t.on("end",s),t.end(e),o()}function gK(t,e){if("string"==typeof e&&(e=new _(e)),!_.isBuffer(e))throw new TypeError("Not a string or buffer");var r=VH.Z_FINISH;return t._processChunk(e,r)}function yK(t){if(!(this instanceof yK))return new yK(t);MK.call(this,t,VH.DEFLATE)}function bK(t){if(!(this instanceof bK))return new bK(t);MK.call(this,t,VH.INFLATE)}function vK(t){if(!(this instanceof vK))return new vK(t);MK.call(this,t,VH.GZIP)}function wK(t){if(!(this instanceof wK))return new wK(t);MK.call(this,t,VH.GUNZIP)}function _K(t){if(!(this instanceof _K))return new _K(t);MK.call(this,t,VH.DEFLATERAW)}function EK(t){if(!(this instanceof EK))return new EK(t);MK.call(this,t,VH.INFLATERAW)}function AK(t){if(!(this instanceof AK))return new AK(t);MK.call(this,t,VH.UNZIP)}function MK(t,e){if(this._opts=t=t||{},this._chunkSize=t.chunkSize||VH.Z_DEFAULT_CHUNK,US.call(this,t),t.flush&&t.flush!==VH.Z_NO_FLUSH&&t.flush!==VH.Z_PARTIAL_FLUSH&&t.flush!==VH.Z_SYNC_FLUSH&&t.flush!==VH.Z_FULL_FLUSH&&t.flush!==VH.Z_FINISH&&t.flush!==VH.Z_BLOCK)throw new Error("Invalid flush flag: "+t.flush);if(this._flushFlag=t.flush||VH.Z_NO_FLUSH,t.chunkSize&&(t.chunkSize<VH.Z_MIN_CHUNK||t.chunkSize>VH.Z_MAX_CHUNK))throw new Error("Invalid chunk size: "+t.chunkSize);if(t.windowBits&&(t.windowBits<VH.Z_MIN_WINDOWBITS||t.windowBits>VH.Z_MAX_WINDOWBITS))throw new Error("Invalid windowBits: "+t.windowBits);if(t.level&&(t.level<VH.Z_MIN_LEVEL||t.level>VH.Z_MAX_LEVEL))throw new Error("Invalid compression level: "+t.level);if(t.memLevel&&(t.memLevel<VH.Z_MIN_MEMLEVEL||t.memLevel>VH.Z_MAX_MEMLEVEL))throw new Error("Invalid memLevel: "+t.memLevel);if(t.strategy&&t.strategy!=VH.Z_FILTERED&&t.strategy!=VH.Z_HUFFMAN_ONLY&&t.strategy!=VH.Z_RLE&&t.strategy!=VH.Z_FIXED&&t.strategy!=VH.Z_DEFAULT_STRATEGY)throw new Error("Invalid strategy: "+t.strategy);if(t.dictionary&&!_.isBuffer(t.dictionary))throw new Error("Invalid dictionary: it should be a Buffer instance");this._binding=new VH.Zlib(e);var r=this;this._hadError=!1,this._binding.onerror=function(t,e){r._binding=null,r._hadError=!0;var n=new Error(t);n.errno=e,n.code=VH.codes[e],r.emit("error",n)};var n=VH.Z_DEFAULT_COMPRESSION;"number"==typeof t.level&&(n=t.level);var i=VH.Z_DEFAULT_STRATEGY;"number"==typeof t.strategy&&(i=t.strategy),this._binding.init(t.windowBits||VH.Z_DEFAULT_WINDOWBITS,n,t.memLevel||VH.Z_DEFAULT_MEMLEVEL,i,t.dictionary),this._buffer=new _(this._chunkSize),this._offset=0,this._closed=!1,this._level=n,this._strategy=i,this.once("end",this.close)}Object.keys(WH).forEach(function(t){WH[WH[t]]=t}),dm(MK,US),MK.prototype.params=function(t,e,r){if(t<VH.Z_MIN_LEVEL||t>VH.Z_MAX_LEVEL)throw new RangeError("Invalid compression level: "+t);if(e!=VH.Z_FILTERED&&e!=VH.Z_HUFFMAN_ONLY&&e!=VH.Z_RLE&&e!=VH.Z_FIXED&&e!=VH.Z_DEFAULT_STRATEGY)throw new TypeError("Invalid strategy: "+e);if(this._level!==t||this._strategy!==e){var n=this;this.flush(VH.Z_SYNC_FLUSH,function(){n._binding.params(t,e),n._hadError||(n._level=t,n._strategy=e,r&&r())})}else vr.nextTick(r)},MK.prototype.reset=function(){return this._binding.reset()},MK.prototype._flush=function(t){this._transform(new _(0),"",t)},MK.prototype.flush=function(t,e){var r=this._writableState;if(("function"==typeof t||void 0===t&&!e)&&(e=t,t=VH.Z_FULL_FLUSH),r.ended)e&&vr.nextTick(e);else if(r.ending)e&&this.once("end",e);else if(r.needDrain){var n=this;this.once("drain",function(){n.flush(e)})}else this._flushFlag=t,this.write(new _(0),"",e)},MK.prototype.close=function(t){if(t&&vr.nextTick(t),!this._closed){this._closed=!0,this._binding.close();var e=this;vr.nextTick(function(){e.emit("close")})}},MK.prototype._transform=function(t,e,r){var n,i=this._writableState,o=(i.ending||i.ended)&&(!t||i.length===t.length);if(null===!t&&!_.isBuffer(t))return r(new Error("invalid input"));o?n=VH.Z_FINISH:(n=this._flushFlag,t.length>=i.length&&(this._flushFlag=this._opts.flush||VH.Z_NO_FLUSH)),this._processChunk(t,n,r)},MK.prototype._processChunk=function(t,e,r){var n=t&&t.length,i=this._chunkSize-this._offset,o=0,s=this,a="function"==typeof r;if(!a){var u,h=[],c=0;this.on("error",function(t){u=t});do{var f=this._binding.writeSync(e,t,o,n,this._buffer,this._offset,i)}while(!this._hadError&&p(f[0],f[1]));if(this._hadError)throw u;var l=_.concat(h,c);return this.close(),l}var d=this._binding.write(e,t,o,n,this._buffer,this._offset,i);function p(u,f){if(!s._hadError){var l=i-f;if(function(t,e){if(!t)throw new Error(e)}(l>=0,"have should not go down"),l>0){var d=s._buffer.slice(s._offset,s._offset+l);s._offset+=l,a?s.push(d):(h.push(d),c+=d.length)}if((0===f||s._offset>=s._chunkSize)&&(i=s._chunkSize,s._offset=0,s._buffer=new _(s._chunkSize)),0===f){if(o+=n-u,n=u,!a)return!0;var m=s._binding.write(e,t,o,n,s._buffer,s._offset,s._chunkSize);return m.callback=p,void(m.buffer=t)}if(!a)return!1;r()}}d.buffer=t,d.callback=p},dm(yK,MK),dm(bK,MK),dm(vK,MK),dm(wK,MK),dm(_K,MK),dm(EK,MK),dm(AK,MK);var SK={codes:WH,createDeflate:JH,createInflate:ZH,createDeflateRaw:YH,createInflateRaw:XH,createGzip:$H,createGunzip:QH,createUnzip:tK,deflate:eK,deflateSync:rK,gzip:nK,gzipSync:iK,deflateRaw:oK,deflateRawSync:sK,unzip:aK,unzipSync:uK,inflate:hK,inflateSync:cK,gunzip:fK,gunzipSync:lK,inflateRaw:dK,inflateRawSync:pK,Deflate:yK,Inflate:bK,Gzip:vK,Gunzip:wK,DeflateRaw:_K,InflateRaw:EK,Unzip:AK,Zlib:MK},kK=iq,xK=hz,TK=HS,RK=Jm,BK=n(Object.freeze({__proto__:null,Deflate:yK,DeflateRaw:_K,Gunzip:wK,Gzip:vK,Inflate:bK,InflateRaw:EK,Unzip:AK,Zlib:MK,codes:WH,createDeflate:JH,createDeflateRaw:YH,createGunzip:QH,createGzip:$H,createInflate:ZH,createInflateRaw:XH,createUnzip:tK,default:SK,deflate:eK,deflateRaw:oK,deflateRawSync:sK,deflateSync:rK,gunzip:fK,gunzipSync:lK,gzip:nK,gzipSync:iK,inflate:hK,inflateRaw:dK,inflateRawSync:pK,inflateSync:cK,unzip:aK,unzipSync:uK})),NK={namespace:"org.apache.avro.file"},PK=kK.Type.forSchema("long",NK),IK=kK.Type.forSchema({type:"map",values:"bytes"},NK),OK=kK.Type.forSchema({name:"Header",type:"record",fields:[{name:"magic",type:{type:"fixed",name:"Magic",size:4}},{name:"meta",type:IK},{name:"sync",type:{type:"fixed",name:"Sync",size:16}}]},NK),CK=kK.Type.forSchema({name:"Block",type:"record",fields:[{name:"count",type:"long"},{name:"data",type:"bytes"},{name:"sync",type:"Sync"}]},NK),LK=xK.bufferFrom("Obj"),jK=RK.format,DK=xK.Tap;function UK(t,e){var r=!!(e=e||{}).noDecode;TK.Duplex.call(this,{readableObjectMode:!r,allowHalfOpen:!1}),this._type=kK.Type.forSchema(t),this._tap=new DK(xK.newBuffer(0)),this._writeCb=null,this._needPush=!1,this._readValue=GK(r,this._type),this._finished=!1,this.on("finish",function(){this._finished=!0,this._read()})}function FK(t){var e=!!(t=t||{}).noDecode;TK.Duplex.call(this,{allowHalfOpen:!0,readableObjectMode:!e}),this._rType=void 0!==t.readerSchema?kK.Type.forSchema(t.readerSchema):void 0,this._wType=null,this._codecs=t.codecs,this._codec=void 0,this._parseHook=t.parseHook,this._tap=new DK(xK.newBuffer(0)),this._blockTap=new DK(xK.newBuffer(0)),this._syncMarker=null,this._readValue=null,this._noDecode=e,this._queue=new xK.OrderedQueue,this._decompress=null,this._index=0,this._remaining=void 0,this._needPush=!1,this._finished=!1,this.on("finish",function(){this._finished=!0,this._needPush&&this._read()})}function zK(t,e){e=e||{},TK.Transform.call(this,{writableObjectMode:!0,allowHalfOpen:!1}),this._type=kK.Type.forSchema(t),this._writeValue=function(t,e){try{this._type._write(t,e)}catch(t){this.emit("error",t)}},this._tap=new DK(xK.newBuffer(e.batchSize||65536))}function qK(t,e){var r;if(e=e||{},TK.Duplex.call(this,{allowHalfOpen:!0,writableObjectMode:!0}),kK.Type.isType(t)?(r=t,t=void 0):r=kK.Type.forSchema(t),this._schema=t,this._type=r,this._writeValue=function(t,e){try{this._type._write(t,e)}catch(t){this.emit("error",t)}},this._blockSize=e.blockSize||65536,this._tap=new DK(xK.newBuffer(this._blockSize)),this._codecs=e.codecs,this._codec=e.codec||"null",this._blockCount=0,this._syncMarker=e.syncMarker||(new xK.Lcg).nextBuffer(16),this._queue=new xK.OrderedQueue,this._pending=0,this._finished=!1,this._needHeader=!1,this._needPush=!1,this._metadata=e.metadata||{},!IK.isValid(this._metadata))throw new Error("invalid metadata");var n=this._codec;if(this._compress=(this._codecs||qK.getDefaultCodecs())[n],!this._compress)throw new Error(jK("unsupported codec: %s",n));switch(void 0!==e.omitHeader&&(e.writeHeader=e.omitHeader?"never":"auto"),e.writeHeader){case!1:case"never":break;case void 0:case"auto":this._needHeader=!0;break;default:this._writeHeader()}this.on("finish",function(){this._finished=!0,this._blockCount?this._flushChunk():this._finished&&this._needPush&&this.push(null)})}function HK(t,e,r,n){this.index=t,this.buf=e,this.cb=r,this.count=0|n}function KK(t){var e=t.pos,r=CK._read(t);return t.isValid()?r:(t.pos=e,null)}function GK(t,e,r){if(t)return i=e._skip,function(t){var e=t.pos;return i(t),t.buf.slice(e,t.pos)};if(r){var n=r.createResolver(e);return function(t){return n._read(t)}}return function(t){return e._read(t)};var i}RK.inherits(UK,TK.Duplex),UK.prototype._write=function(t,e,r){this._writeCb=r;var n=this._tap;n.buf=_.concat([n.buf.slice(n.pos),t]),n.pos=0,this._needPush&&(this._needPush=!1,this._read())},UK.prototype._read=function(){this._needPush=!1;var t=this._tap,e=t.pos,r=this._readValue(t);t.isValid()?this.push(r):this._finished?this.push(null):(t.pos=e,this._needPush=!0,this._writeCb&&this._writeCb())},RK.inherits(FK,TK.Duplex),FK.defaultCodecs=function(){return{null:function(t,e){e(null,t)},deflate:BK.inflateRaw}},FK.getDefaultCodecs=FK.defaultCodecs,FK.prototype._decodeHeader=function(){var t=this._tap;if(t.buf.length<LK.length)return!1;if(!LK.equals(t.buf.slice(0,LK.length)))return this.emit("error",new Error("invalid magic bytes")),!1;var e=OK._read(t);if(!t.isValid())return!1;this._codec=(e.meta["avro.codec"]||"null").toString();var r=this._codecs||FK.getDefaultCodecs();if(this._decompress=r[this._codec],this._decompress){try{var n=JSON.parse(e.meta["avro.schema"].toString());this._parseHook&&(n=this._parseHook(n)),this._wType=kK.Type.forSchema(n)}catch(t){return void this.emit("error",t)}return this._readValue=GK(this._noDecode,this._wType,this._rType),this._syncMarker=e.sync,this.emit("metadata",this._wType,this._codec,e),!0}this.emit("error",new Error(jK("unknown codec: %s",this._codec)))},FK.prototype._write=function(t,e,r){var n=this._tap;n.buf=_.concat([n.buf,t]),n.pos=0,this._decodeHeader()?(this._write=this._writeChunk,this._write(xK.newBuffer(0),e,r)):vr.nextTick(r)},FK.prototype._writeChunk=function(t,e,r){var n=this._tap;n.buf=_.concat([n.buf.slice(n.pos),t]),n.pos=0;for(var i,o=1;i=KK(n);){if(!this._syncMarker.equals(i.sync))return void this.emit("error",new Error("invalid sync marker"));o++,this._decompress(i.data,this._createBlockCallback(i.count,s))}function s(){--o||r()}s()},FK.prototype._createBlockCallback=function(t,e){var r=this,n=this._index++;return function(i,o){if(i){var s=new Error(jK("%s codec decompression error",r._codec));s.cause=i,r.emit("error",s),e()}else r._queue.push(new HK(n,o,e,t)),r._needPush&&r._read()}},FK.prototype._read=function(){this._needPush=!1;var t=this._blockTap;if(!this._remaining){var e=this._queue.pop();if(!e||!e.count)return this._finished?this.push(null):this._needPush=!0,void(e&&e.cb());e.cb(),this._remaining=e.count,t.buf=e.buf,t.pos=0}this._remaining--,this.push(this._readValue(t))},RK.inherits(zK,TK.Transform),zK.prototype._transform=function(t,e,r){var n=this._tap,i=n.buf,o=n.pos;if(this._writeValue(n,t),!n.isValid()){o&&this.push(function(t,e,r){var n=xK.newBuffer(r);return t.copy(n,0,e,e+r),n}(n.buf,0,o));var s=n.pos-o;s>i.length&&(n.buf=xK.newBuffer(2*s)),n.pos=0,this._writeValue(n,t)}r()},zK.prototype._flush=function(t){var e=this._tap,r=e.pos;r&&this.push(e.buf.slice(0,r)),t()},RK.inherits(qK,TK.Duplex),qK.defaultCodecs=function(){return{null:function(t,e){e(null,t)},deflate:BK.deflateRaw}},qK.getDefaultCodecs=qK.defaultCodecs,qK.prototype._writeHeader=function(){var t=JSON.stringify(this._schema?this._schema:this._type.getSchema({exportAttrs:!0})),e=xK.copyOwnProperties(this._metadata,{"avro.schema":xK.bufferFrom(t),"avro.codec":xK.bufferFrom(this._codec)},!0),r=new(OK.getRecordConstructor())(LK,e,this._syncMarker);this.push(r.toBuffer())},qK.prototype._write=function(t,e,r){this._needHeader&&(this._writeHeader(),this._needHeader=!1);var n=this._tap,i=n.pos,o=!1;if(this._writeValue(n,t),!n.isValid()){i&&(this._flushChunk(i,r),o=!0);var s=n.pos-i;s>this._blockSize&&(this._blockSize=2*s),n.buf=xK.newBuffer(this._blockSize),n.pos=0,this._writeValue(n,t)}this._blockCount++,o||r()},qK.prototype._flushChunk=function(t,e){var r=this._tap;t=t||r.pos,this._compress(r.buf.slice(0,t),this._createBlockCallback(e)),this._blockCount=0},qK.prototype._read=function(){var t=this,e=this._queue.pop();e?(this.push(PK.toBuffer(e.count,!0)),this.push(PK.toBuffer(e.buf.length,!0)),this.push(e.buf),this.push(this._syncMarker),this._finished||e.cb()):this._finished&&!this._pending?vr.nextTick(function(){t.push(null)}):this._needPush=!0},qK.prototype._createBlockCallback=function(t){var e=this,r=this._index++,n=this._blockCount;return this._pending++,function(i,o){if(i){var s=new Error(jK("%s codec compression error",e._codec));return s.cause=i,void e.emit("error",s)}e._pending--,e._queue.push(new HK(r,o,t,n)),e._needPush&&(e._needPush=!1,e._read())}};var VK={BLOCK_TYPE:CK,HEADER_TYPE:OK,MAGIC_BYTES:LK,streams:{BlockDecoder:FK,BlockEncoder:qK,RawDecoder:UK,RawEncoder:zK}},WK=iq,JK=hz,ZK=fm,YK=HS,XK=Jm,$K=JK.Tap,QK=WK.Type,tG=XK.debuglog("avsc:services"),eG=XK.format,rG={namespace:"org.apache.avro.ipc"},nG=QK.forSchema("boolean",rG),iG=QK.forSchema({type:"map",values:"bytes"},rG),oG=QK.forSchema("string",rG),sG=QK.forSchema({name:"HandshakeRequest",type:"record",fields:[{name:"clientHash",type:{name:"MD5",type:"fixed",size:16}},{name:"clientProtocol",type:["null","string"],default:null},{name:"serverHash",type:"MD5"},{name:"meta",type:["null",iG],default:null}]},rG),aG=QK.forSchema({name:"HandshakeResponse",type:"record",fields:[{name:"match",type:{name:"HandshakeMatch",type:"enum",symbols:["BOTH","CLIENT","NONE"]}},{name:"serverProtocol",type:["null","string"],default:null},{name:"serverHash",type:["null","MD5"],default:null},{name:"meta",type:["null",iG],default:null}]},rG),uG=new hG("",QK.forSchema({name:"PingRequest",type:"record",fields:[]},rG),QK.forSchema(["string"],rG),QK.forSchema("null",rG));function hG(t,e,r,n,i,o){if(this.name=t,!QK.isType(e,"record"))throw new Error("invalid request type");if(this.requestType=e,!QK.isType(r,"union")||!QK.isType(r.getTypes()[0],"string"))throw new Error("invalid error type");if(this.errorType=r,i&&(!QK.isType(n,"null")||r.getTypes().length>1))throw new Error("inapplicable one-way parameter");this.responseType=n,this.oneWay=!!i,this.doc=void 0!==o?""+o:void 0,Object.freeze(this)}function cG(t,e,r,n,i){if("string"!=typeof t)return cG.forProtocol(t,e);this.name=t,this._messagesByName=e||{},this.messages=Object.freeze(JK.objectValues(this._messagesByName)),this._typesByName=r||{},this.types=Object.freeze(JK.objectValues(this._typesByName)),this.protocol=n,this._hashStr=JK.getHash(JSON.stringify(n)).toString("binary"),this.doc=n.doc?""+n.doc:void 0,this._server=i||this.createServer({silent:!0}),Object.freeze(this)}function fG(t,e){e=e||{},ZK.EventEmitter.call(this),this._svc$=t,this._channels$=[],this._fns$=[],this._buffering$=!!e.buffering,this._cache$=e.cache||{},this._policy$=e.channelPolicy,this._strict$=!!e.strictTypes,this._timeout$=JK.getOption(e,"timeout",1e4),e.remoteProtocols&&PG(this._cache$,e.remoteProtocols,t,!0),this._svc$.messages.forEach(function(t){this[t.name]=this._createMessageHandler$(t)},this)}function lG(t,e){e=e||{},ZK.EventEmitter.call(this),this.service=t,this._handlers={},this._fns=[],this._channels={},this._nextChannelId=1,this._cache=e.cache||{},this._defaultHandler=e.defaultHandler,this._sysErrFormatter=e.systemErrorFormatter,this._silent=!!e.silent,this._strict=!!e.strictTypes,e.remoteProtocols&&PG(this._cache,e.remoteProtocols,t,!1),t.messages.forEach(function(t){var r=t.name;e.noCapitalize||(r=JK.capitalize(r)),this["on"+r]=this._createMessageHandler(t)},this)}function dG(t,e){e=e||{},ZK.EventEmitter.call(this),this.client=t,this.timeout=JK.getOption(e,"timeout",t._timeout$),this._endWritable=!!JK.getOption(e,"endWritable",!0),this._prefix=DG(e.scope);var r=t._cache$,n=t._svc$,i=e.serverHash;i||(i=n.hash);var o=r[i];o||(o=r[i=n.hash]=new AG(n,n,i)),this._adapter=o,this._registry=new EG(this,16),this.pending=0,this.destroyed=!1,this.draining=!1,this.once("_eot",function(t,e){tG("client channel EOT"),this.destroyed=!0,this.emit("eot",t,e)})}function pG(t,e,r){dG.call(this,t,r),this._writableFactory=e,r&&r.noPing||(tG("emitting ping request"),this.ping())}function mG(t,e,r,n){dG.call(this,t,n),this._readable=e,this._writable=r,this._connected=!(!n||!n.noPing),this._readable.on("end",c),this._writable.on("finish",f);var i,o=this,s=null;function a(t){if(!o.destroyed){i=o._createHandshakeRequest(o._adapter,!t);var e=[sG.toBuffer(i),JK.bufferFrom([0,0])];o._writable.write({id:o._prefix,payload:e})}}function u(t){if(o._matchesPrefix(t.id)){var e=_.concat(t.payload);try{var r=RG(aG,e).head;r.serverHash&&(o._adapter=o._getAdapter(r))}catch(t){return void o.destroy(t)}var n=r.match;tG("handshake match: %s",n),o.emit("handshake",i,r),"NONE"===n?vr.nextTick(function(){a(!0)}):(tG("successfully connected"),s&&(clearTimeout(s),s=null),o._readable.removeListener("data",u).on("data",h),o._connected=!0,o.emit("_ready"),i=null)}else tG("discarding unscoped response %s (still connecting)",t.id)}function h(t){var e=t.id;if(o._matchesPrefix(e)){var r=o._registry.get(e);r&&vr.nextTick(function(){tG("received message %s",e),r(null,_.concat(t.payload),o._adapter)})}else tG("discarding unscoped message %s",e)}function c(){o.destroy(!0)}function f(){o.destroy()}this.once("eot",function(){s&&(clearTimeout(s),s=null),o._connected||o.emit("_ready"),this._writable.removeListener("finish",f),this._endWritable&&(tG("ending transport"),this._writable.end()),this._readable.removeListener("data",u).removeListener("data",h).removeListener("end",c)}),this._connected?this._readable.on("data",h):(this._readable.on("data",u),vr.nextTick(a),o.timeout&&(s=setTimeout(function(){o.destroy(new Error("timeout"))},o.timeout)))}function gG(t,e){e=e||{},ZK.EventEmitter.call(this),this.server=t,this._endWritable=!!JK.getOption(e,"endWritable",!0),this._prefix=DG(e.scope);var r=t._cache,n=t.service,i=n.hash;r[i]||(r[i]=new AG(n,n,i)),this._adapter=null,this.destroyed=!1,this.draining=!1,this.pending=0,this.once("_eot",function(t,e){tG("server channel EOT"),this.emit("eot",t,e)})}function yG(t,e,r){gG.call(this,t,r),this._writable=void 0;var n,i=this;function o(t){var e,r=t.id,n=_.concat(t.payload);try{var o=RG(sG,n),s=o.head,a=i._getAdapter(s)}catch(t){e=LG("INVALID_HANDSHAKE_REQUEST",t)}var u=i._createHandshakeResponse(e,s);function h(t){if(!i.destroyed){if(!i._writable)return void i.once("_writable",function(){h(t)});i._writable.write({id:r,payload:[aG.toBuffer(u),t]})}i._writable&&i._endWritable&&i._writable.end()}i.emit("handshake",s,u),e?h(i._encodeSystemError(e)):i._receive(o.tail,a,h)}function s(){i.destroy()}function a(t){n.removeListener("data",o).removeListener("end",s),i.destroy(t||!0)}vr.nextTick(function(){n=e.call(i,function(t,e){vr.nextTick(function(){t?a(t):(i._writable=e.on("finish",a),i.emit("_writable"))})}).on("data",o).on("end",s)})}function bG(t,e,r,n){gG.call(this,t,n),this._adapter=void 0,this._writable=r.on("finish",u),this._readable=e.on("data",o).on("end",a),this.once("_drain",function(){this._readable.removeListener("data",o).removeListener("data",s).removeListener("end",a)}).once("eot",function(){this._writable.removeListener("finish",u),this._endWritable&&this._writable.end()});var i=this;function o(t){var e=t.id;if(i._matchesPrefix(e)){var r,n=_.concat(t.payload);try{var a=RG(sG,n),u=a.head;i._adapter=i._getAdapter(u)}catch(t){r=LG("INVALID_HANDSHAKE_REQUEST",t)}var h=i._createHandshakeResponse(r,u);i.emit("handshake",u,h),r?c(i._encodeSystemError(r)):(i._readable.removeListener("data",o).on("data",s),i._receive(a.tail,i._adapter,c))}function c(t){i.destroyed||i._writable.write({id:e,payload:[aG.toBuffer(h),t]})}}function s(t){var e=t.id;if(i._matchesPrefix(e)){var r=_.concat(t.payload);i._receive(r,i._adapter,function(t,r){i.destroyed||r||i._writable.write({id:e,payload:[t]})})}}function a(){i.destroy()}function u(){i.destroy(!0)}}function vG(t,e,r){this._msg=t,this.headers=e||{},this.request=r||{}}function wG(t,e,r,n){this._msg=t,this.headers=e,this.error=r,this.response=n}function _G(t,e){this.channel=e,this.locals={},this.message=t,Object.freeze(this)}function EG(t,e){this._ctx=t,this._mask=-1>>>(0|e),this._id=0,this._n=0,this._cbs={}}function AG(t,e,r,n){this._clientSvc=t,this._serverSvc=e,this._hash=r,this._isRemote=!!n,this._readers=NG(t,e)}function MG(){YK.Transform.call(this,{readableObjectMode:!0}),this._id=void 0,this._buf=JK.newBuffer(0),this._bufs=[],this.on("finish",function(){this.push(null)})}function SG(){YK.Transform.call(this,{writableObjectMode:!0}),this.on("finish",function(){this.push(null)})}function kG(){YK.Transform.call(this,{readableObjectMode:!0}),this._id=void 0,this._frameCount=0,this._buf=JK.newBuffer(0),this._bufs=[],this.on("finish",function(){this.push(null)})}function xG(){YK.Transform.call(this,{writableObjectMode:!0}),this.on("finish",function(){this.push(null)})}function TG(t){var e=JK.newBuffer(4);return e.writeInt32BE(t),e}function RG(t,e){var r=new $K(e),n=t._read(r);if(!r.isValid())throw new Error(eG("truncated %s",t));return{head:n,tail:r.buf.slice(r.pos)}}function BG(t,e){return t.equals(e)?t:t.createResolver(e)}function NG(t,e){var r={};return t.messages.forEach(function(t){var n=t.name,i=e.message(n);try{if(!i)throw new Error(eG("missing server message: %s",n));if(i.oneWay!==t.oneWay)throw new Error(eG("inconsistent one-way message: %s",n));r[n+"?"]=BG(i.requestType,t.requestType),r[n+"*"]=BG(t.errorType,i.errorType),r[n+"!"]=BG(t.responseType,i.responseType)}catch(t){throw LG("INCOMPATIBLE_PROTOCOL",t)}}),r}function PG(t,e,r,n){Object.keys(e).forEach(function(i){var o,s,a=e[i];n?(o=r,s=cG.forProtocol(a)):(o=cG.forProtocol(a),s=r),t[i]=new AG(o,s,i,!0)})}function IG(t,e){var r={};return Object.keys(t).forEach(function(n){var i=t[n];if(i._isRemote){var o=e?i._serverSvc:i._clientSvc;r[n]=o.protocol}}),r}function OG(t){return!!t&&"[object Error]"===Object.prototype.toString.call(t)}function CG(t,e){var r=new Error(t);return r.cause=e,r}function LG(t,e){var r=CG(t.toLowerCase().replace(/_/g," "),e);return r.rpcCode=e&&e.rpcCode?e.rpcCode:t,r}function jG(t,e,r){var n,i,o,s=[];for(n=0,i=r.length;n<i;n++)(o=r[n]).type.isValid(e[o.name],{errorHook:h});var a=s.map(function(t){return eG("%s = %j but expected %s",t.path,t.value,t.type)}).join(", "),u=new Error(eG("%s (%s)",t,a));return u.details=s,u;function h(t,e,r){var n,i,a,u=[];for(n=0,i=t.length;n<i;n++)a=t[n],isNaN(a)?u.push("."+a):u.push("["+a+"]");s.push({path:o.name+u.join(""),value:e,type:r})}}function DG(t){return t?JK.getHash(t).readInt16BE(0)<<16:0}function UG(t,e){return!((t^e)>>16)}function FG(t){return!(!t||!t.pipe)}function zG(t,e){var r=t.message(e);if(!r)throw new Error(eG("unknown message: %s",e));return r}function qG(t){var e,r=[t.wreq,t.wres],n=[];function i(){var r=n.pop();if(r){var o=!1;r.call(t.ctx,e,function(r){o?t.onError(CG("duplicate backward middleware call",r)):(e=r,o=!0,i())})}else t.onCompletion.call(t.ctx,e)}!function o(s){var a=!1;s<t.fns.length?t.fns[s].apply(t.ctx,r.concat(function(r,u){if(a)t.onError(CG("duplicate forward middleware call",r));else{if(a=!0,r||t.wres&&(void 0!==t.wres.error||void 0!==t.wres.response))return e=r,void i();u&&n.push(u),o(++s)}})):t.onTransition.apply(t.ctx,r.concat(function(r){a?t.onError(CG("duplicate handler call",r)):(a=!0,e=r,vr.nextTick(i))}))}(0)}hG.forSchema=function(t,e,r){if(r=r||{},!WK.isValidName(t))throw new Error(eG("invalid message name: %s",t));if(!Array.isArray(e.request))throw new Error(eG("invalid message request: %s",t));var n=eG("%s.%sRequest",rG.namespace,JK.capitalize(t)),i=QK.forSchema({name:n,type:"record",namespace:r.namespace||"",fields:e.request},r);if(delete r.registry[n],!e.response)throw new Error(eG("invalid message response: %s",t));var o=QK.forSchema(e.response,r);if(void 0!==e.errors&&!Array.isArray(e.errors))throw new Error(eG("invalid message errors: %s",t));return new hG(t,i,QK.forSchema(["string"].concat(e.errors||[]),r),o,!!e["one-way"],e.doc)},hG.prototype.schema=QK.prototype.getSchema,hG.prototype._attrs=function(t){var e={request:this.requestType._attrs(t).fields,response:this.responseType._attrs(t)},r=this.doc;void 0!==r&&(e.doc=r);var n=this.errorType._attrs(t);return n.length>1&&(e.errors=n.slice(1)),this.oneWay&&(e["one-way"]=!0),e},JK.addDeprecatedGetters(hG,["name","errorType","requestType","responseType"]),hG.prototype.isOneWay=XK.deprecate(function(){return this.oneWay},"use `.oneWay` directly instead of `.isOneWay()`"),cG.Client=fG,cG.Server=lG,cG.compatible=function(t,e){try{NG(t,e)}catch(t){return!1}return!0},cG.forProtocol=function(t,e){e=e||{};var r,n=t.protocol;if(!n)throw new Error("missing protocol name");if(void 0!==t.namespace)e.namespace=t.namespace;else{var i=/^(.*)\.[^.]+$/.exec(n);i&&(e.namespace=i[1])}return n=WK.qualify(n,e.namespace),t.types&&t.types.forEach(function(t){QK.forSchema(t,e)}),t.messages&&(r={},Object.keys(t.messages).forEach(function(n){r[n]=hG.forSchema(n,t.messages[n],e)})),new cG(n,r,e.registry,t)},cG.isService=function(t){return!!t&&t.hasOwnProperty("_hashStr")},cG.prototype.createClient=function(t){var e=new fG(this,t);return vr.nextTick(function(){if(t&&t.server){var r={objectMode:!0},n=[new YK.PassThrough(r),new YK.PassThrough(r)];t.server.createChannel({readable:n[0],writable:n[1]},r),e.createChannel({readable:n[1],writable:n[0]},r)}else t&&t.transport&&e.createChannel(t.transport)}),e},cG.prototype.createServer=function(t){return new lG(this,t)},Object.defineProperty(cG.prototype,"hash",{enumerable:!0,get:function(){return JK.bufferFrom(this._hashStr,"binary")}}),cG.prototype.message=function(t){return this._messagesByName[t]},cG.prototype.type=function(t){return this._typesByName[t]},cG.prototype.inspect=function(){return eG("<Service %j>",this.name)},JK.addDeprecatedGetters(cG,["message","messages","name","type","types"]),cG.prototype.createEmitter=XK.deprecate(function(t,e){e=e||{};var r=this.createClient({cache:e.cache,buffering:!1,strictTypes:e.strictErrors,timeout:e.timeout}),n=r.createChannel(t,e);return function(t,e){t.on("error",function(r){e.emit("error",r,t)})}(r,n),n},"use `.createClient()` instead of `.createEmitter()`"),cG.prototype.createListener=XK.deprecate(function(t,e){if(e&&e.strictErrors)throw new Error("use `.createServer()` to support strict errors");return this._server.createChannel(t,e)},"use `.createServer().createChannel()` instead of `.createListener()`"),cG.prototype.emit=XK.deprecate(function(t,e,r,n){if(!r||!this.equals(r.client._svc$))throw new Error("invalid emitter");var i=r.client;return fG.prototype.emitMessage.call(i,t,e,n&&n.bind(this)),r.getPending()},"create a client via `.createClient()` to emit messages instead of `.emit()`"),cG.prototype.equals=XK.deprecate(function(t){return cG.isService(t)&&this.getFingerprint().equals(t.getFingerprint())},"equality testing is deprecated, compare the `.protocol`s instead"),cG.prototype.getFingerprint=XK.deprecate(function(t){return JK.getHash(JSON.stringify(this.protocol),t)},"use `.hash` instead of `.getFingerprint()`"),cG.prototype.getSchema=XK.deprecate(QK.prototype.getSchema,"use `.protocol` instead of `.getSchema()`"),cG.prototype.on=XK.deprecate(function(t,e){var r=this;return this._server.onMessage(t,function(t,n){return e.call(r,t,this.channel,n)}),this},"use `.createServer().onMessage()` instead of `.on()`"),cG.prototype.subprotocol=XK.deprecate(function(){var t=this._server,e={strictTypes:t._strict,cache:t._cache},r=new lG(t.service,e);return r._handlers=Object.create(t._handlers),new cG(this.name,this._messagesByName,this._typesByName,this.protocol,r)},"`.subprotocol()` will be removed in 5.1"),cG.prototype._attrs=function(t){var e={protocol:this.name},r=[];this.types.forEach(function(e){if(void 0!==e.getName()){var n=e._attrs(t);"string"!=typeof n&&r.push(n)}}),r.length&&(e.types=r);var n=Object.keys(this._messagesByName);return n.length&&(e.messages={},n.forEach(function(r){e.messages[r]=this._messagesByName[r]._attrs(t)},this)),t&&t.exportAttrs&&void 0!==this.doc&&(e.doc=this.doc),e},XK.inherits(fG,ZK.EventEmitter),fG.prototype.activeChannels=function(){return this._channels$.slice()},fG.prototype.createChannel=function(t,e){var r,n=e&&e.objectMode;if("function"==typeof t){var i;i=n?t:function(e){var n=new SG,i=t(function(t,n){if(t)e(t);else{var i=(new MG).once("error",function(t){r.destroy(t)});e(null,n.pipe(i))}});if(i)return n.pipe(i),n},r=new pG(this,i,e)}else{var o,s;if(FG(t)?o=s=t:(o=t.readable,s=t.writable),!n){var a=new kG;o=o.pipe(a);var u=new xG;u.pipe(s),s=u}r=new mG(this,o,s,e),n||(r.once("eot",function(){o.unpipe(a),u.unpipe(s)}),a.once("error",function(t){r.destroy(t)}))}var h=this._channels$;return h.push(r),r.once("_drain",function(){h.splice(h.indexOf(this),1)}),this._buffering$=!1,this.emit("channel",r),r},fG.prototype.destroyChannels=function(t){this._channels$.forEach(function(e){e.destroy(t&&t.noWait)})},fG.prototype.emitMessage=function(t,e,r,n){var i=new vG(zG(this._svc$,t),{},e);this._emitMessage$(i,r,n)},fG.prototype.remoteProtocols=function(){return IG(this._cache$,!0)},Object.defineProperty(fG.prototype,"service",{enumerable:!0,get:function(){return this._svc$}}),fG.prototype.use=function(){var t,e,r;for(t=0,e=arguments.length;t<e;t++)r=arguments[t],this._fns$.push(r.length<3?r(this):r);return this},fG.prototype._emitMessage$=function(t,e,r){r||"function"!=typeof e||(r=e,e=void 0);var n=this,i=this._channels$,o=i.length;if(o){var s;if(void 0===(e=e||{}).timeout&&(e.timeout=this._timeout$),1===o)s=i[0];else if(this._policy$){if(!(s=this._policy$(this._channels$.slice())))return void tG("policy returned no channel, skipping call")}else s=i[Math.floor(Math.random()*o)];s._emit(t,e,function(t,e){var i=this,o=i.message.errorType;if(t)return n._strict$&&(t=o.clone(t.message,{wrapUnions:!0})),void s(t);function s(t,e){r?r.call(i,t,e):t&&n.emit("error",t)}e?(t=e.error,n._strict$||(void 0===t?t=null:QK.isType(o,"union:unwrapped")?"string"==typeof t&&(t=new Error(t)):t&&t.string&&"string"==typeof t.string&&(t=new Error(t.string))),s(t,e.response)):s()})}else if(this._buffering$)tG("no active client channels, buffering call"),this.once("channel",function(){this._emitMessage$(t,e,r)});else{var a=new Error("no active channels");vr.nextTick(function(){r?r.call(new _G(t._msg),a):n.emit("error",a)})}},fG.prototype._createMessageHandler$=function(t){var e=t.requestType.getFields().map(function(t){return t.getName()}),r="return function "+t.name+"(";return e.length&&(r+=e.join(", ")+", "),r+="opts, cb) {\n",r+="  var req = {",r+=e.map(function(t){return t+": "+t}).join(", "),r+="};\n",r+="  return this.emitMessage('"+t.name+"', req, opts, cb);\n",r+="};",new Function(r)()},XK.inherits(lG,ZK.EventEmitter),lG.prototype.activeChannels=function(){return JK.objectValues(this._channels)},lG.prototype.createChannel=function(t,e){var r,n=e&&e.objectMode;if("function"==typeof t){var i;i=n?t:function(e){var n=(new MG).once("error",function(t){r.destroy(t)});return t(function(t,r){if(t)e(t);else{var n=new SG;n.pipe(r),e(null,n)}}).pipe(n)},r=new yG(this,i,e)}else{var o,s;if(FG(t)?o=s=t:(o=t.readable,s=t.writable),!n){var a=new kG;o=o.pipe(a);var u=new xG;u.pipe(s),s=u}r=new bG(this,o,s,e),n||(r.once("eot",function(){o.unpipe(a),u.unpipe(s)}),a.once("error",function(t){r.destroy(t)}))}this.listeners("error").length||this.on("error",this._onError);var h=this._nextChannelId++,c=this._channels;return c[h]=r.once("eot",function(){delete c[h]}),this.emit("channel",r),r},lG.prototype.onMessage=function(t,e){return zG(this.service,t),this._handlers[t]=e,this},lG.prototype.remoteProtocols=function(){return IG(this._cache,!1)},lG.prototype.use=function(){var t,e,r;for(t=0,e=arguments.length;t<e;t++)r=arguments[t],this._fns.push(r.length<3?r(this):r);return this},lG.prototype._createMessageHandler=function(t){var e=t.name,r=t.requestType.fields,n=r.length,i=r.length?", "+r.map(function(t){return"req."+t.name}).join(", "):"",o="return function (handler) {\n";return o+="  if (handler.length > "+n+") {\n",o+="    return this.onMessage('"+e+"', function (req, cb) {\n",o+="      return handler.call(this"+i+", cb);\n",o+="    });\n",o+="  } else {\n",o+="    return this.onMessage('"+e+"', function (req) {\n",o+="      return handler.call(this"+i+");\n",o+="    });\n",o+="  }\n",o+="};\n",new Function(o)()},lG.prototype._onError=function(t){this._silent||"UNKNOWN_PROTOCOL"===t.rpcCode||t.rpcCode},XK.inherits(dG,ZK.EventEmitter),dG.prototype.destroy=function(t){tG("destroying client channel"),this.draining||(this.draining=!0,this.emit("_drain"));var e=this._registry,r=this.pending;t&&e.clear(),t||!r?OG(t)?(tG("fatal client channel error: %s",t),this.emit("_eot",r,t)):this.emit("_eot",r):tG("client channel entering drain mode (%s pending)",r)},dG.prototype.ping=function(t,e){e||"function"!=typeof t||(e=t,t=void 0);var r=this,n=new vG(uG);this._emit(n,{timeout:t},function(t){e?e.call(r,t):t&&r.destroy(t)})},dG.prototype._createHandshakeRequest=function(t,e){var r=this.client._svc$;return{clientHash:r.hash,clientProtocol:e?null:JSON.stringify(r.protocol),serverHash:t._hash}},dG.prototype._emit=function(t,e,r){var n=t._msg,i=n.oneWay?void 0:new wG(n,{}),o=new _G(n,this),s=this;function a(t,r,i){var o,a;if(s.destroyed)o=new Error("channel destroyed");else try{a=t.toBuffer()}catch(e){o=jG(eG("invalid %j request",n.name),t,[{name:"headers",type:iG},{name:"request",type:n.requestType}])}if(o)i(o);else{var u=e&&void 0!==e.timeout?e.timeout:s.timeout,h=s._registry.add(u,function(t,e,o){if(!t&&!n.oneWay)try{o._decodeResponse(e,r,n)}catch(e){t=e}i(t)});h|=s._prefix,tG("sending message %s",h),s._send(h,a,!!n&&n.oneWay)}}function u(t){s.pending--,r.call(o,t,i),!s.draining||s.destroyed||s.pending||s.destroy()}function h(t){s.client.emit("error",t,s)}this.pending++,vr.nextTick(function(){if(n.name){s.emit("outgoingCall",o,e);var r=s.client._fns$;tG("starting client middleware chain (%s middleware)",r.length),qG({fns:r,ctx:o,wreq:t,wres:i,onTransition:a,onCompletion:u,onError:h})}else a(t,i,u)})},dG.prototype._getAdapter=function(t){var e=t.serverHash,r=this.client._cache$,n=r[e];if(n)return n;var i=JSON.parse(t.serverProtocol),o=cG.forProtocol(i);return n=new AG(this.client._svc$,o,e,!0),r[e]=n},dG.prototype._matchesPrefix=function(t){return UG(t,this._prefix)},dG.prototype._send=JK.abstractFunction,JK.addDeprecatedGetters(dG,["pending","timeout"]),dG.prototype.getCache=XK.deprecate(function(){return this.client._cache$},"use `.remoteProtocols()` instead of `.getCache()`"),dG.prototype.getProtocol=XK.deprecate(function(){return this.client._svc$},"use `.service` instead or `.getProtocol()`"),dG.prototype.isDestroyed=XK.deprecate(function(){return this.destroyed},"use `.destroyed` instead of `.isDestroyed`"),XK.inherits(pG,dG),pG.prototype._send=function(t,e){var r=this._registry.get(t),n=this._adapter,i=this;return vr.nextTick(function o(s){if(i.destroyed)return;var a=i._createHandshakeRequest(n,!s),u=i._writableFactory.call(i,function(t,e){t?r(t):e.on("data",function(t){tG("received response %s",t.id);var e=_.concat(t.payload);try{var s=RG(aG,e),u=s.head;u.serverHash&&(n=i._getAdapter(u))}catch(t){return void r(t)}var h=u.match;tG("handshake match: %s",h),i.emit("handshake",a,u),"NONE"===h?vr.nextTick(function(){o(!0)}):(i._adapter=n,r(null,s.tail,n))})});if(!u)return void r(new Error("invalid writable stream"));u.write({id:t,payload:[sG.toBuffer(a),e]}),i._endWritable&&u.end()}),!0},XK.inherits(mG,dG),mG.prototype._emit=function(){if(this._connected||this.draining)dG.prototype._emit.apply(this,arguments);else{tG("queuing request");var t,e,r=[];for(t=0,e=arguments.length;t<e;t++)r.push(arguments[t]);this.once("_ready",function(){this._emit.apply(this,r)})}},mG.prototype._send=function(t,e,r){if(r){var n=this;vr.nextTick(function(){n._registry.get(t)(null,JK.bufferFrom([0,0,0]),n._adapter)})}return this._writable.write({id:t,payload:[e]})},XK.inherits(gG,ZK.EventEmitter),gG.prototype.destroy=function(t){this.draining||(this.draining=!0,this.emit("_drain")),!t&&this.pending||(this.destroyed=!0,OG(t)?(tG("fatal server channel error: %s",t),this.emit("_eot",this.pending,t)):this.emit("_eot",this.pending))},gG.prototype._createHandshakeResponse=function(t,e){var r=this.server.service,n=r.hash,i=e&&e.serverHash.equals(n);return{match:t?"NONE":i?"BOTH":"CLIENT",serverProtocol:i?null:JSON.stringify(r.protocol),serverHash:i?null:n}},gG.prototype._getAdapter=function(t){var e=t.clientHash,r=this.server._cache[e];if(r)return r;if(!t.clientProtocol)throw LG("UNKNOWN_PROTOCOL");var n=JSON.parse(t.clientProtocol);return r=new AG(cG.forProtocol(n),this.server.service,e,!0),this.server._cache[e]=r},gG.prototype._matchesPrefix=function(t){return UG(t,this._prefix)},gG.prototype._receive=function(t,e,r){var n,i=this;try{n=e._decodeRequest(t)}catch(t){return void r(i._encodeSystemError(LG("INVALID_REQUEST",t)))}var o=n._msg,s=new wG(o,{});if(!o.name)return s.response=null,void r(s.toBuffer(),!1);var a=new _G(o,this);i.emit("incomingCall",a);var u=this.server._fns;function h(t){i.server.emit("error",t,i)}tG("starting server middleware chain (%s middleware)",u.length),i.pending++,qG({fns:u,ctx:a,wreq:n,wres:s,onTransition:function(t,e,r){var n=i.server._handlers[o.name];if(n){var s=!o.oneWay;try{s?n.call(a,t.request,function(t,n){s=!1,e.error=t,e.response=n,r()}):(n.call(a,t.request),r())}catch(t){s?(s=!1,r(t)):h(t)}}else{var u=i.server._defaultHandler;if(u)u.call(a,t,e,r);else{var c=new Error(eG("no handler for %s",o.name));r(LG("NOT_IMPLEMENTED",c))}}},onCompletion:function(t){i.pending--;var e,n=i.server;if(!t){var a=s.error;n._strict||(OG(a)?s.error=o.errorType.clone(a.message,{wrapUnions:!0}):null===a&&(a=s.error=void 0),void 0===a&&void 0===s.response&&o.responseType.isValid(null)&&(s.response=null));try{e=s.toBuffer()}catch(e){t=void 0!==s.error?jG(eG("invalid %j error",o.name),s,[{name:"headers",type:iG},{name:"error",type:o.errorType}]):jG(eG("invalid %j response",o.name),s,[{name:"headers",type:iG},{name:"response",type:o.responseType}])}}e?void 0!==a&&n.emit("error",LG("APPLICATION_ERROR",a)):e=i._encodeSystemError(t,s.headers);r(e,o.oneWay),i.draining&&!i.pending&&i.destroy()},onError:h})},JK.addDeprecatedGetters(gG,["pending"]),gG.prototype.getCache=XK.deprecate(function(){return this.server._cache},"use `.remoteProtocols()` instead of `.getCache()`"),gG.prototype.getProtocol=XK.deprecate(function(){return this.server.service},"use `.service` instead of `.getProtocol()`"),gG.prototype.isDestroyed=XK.deprecate(function(){return this.destroyed},"use `.destroyed` instead of `.isDestroyed`"),gG.prototype._encodeSystemError=function(t,e){var r,n,i=this.server;if(i.emit("error",t,this),i._sysErrFormatter?r=i._sysErrFormatter.call(this,t):t.rpcCode&&(r=t.message),e)try{n=iG.toBuffer(e)}catch(t){i.emit("error",t,this)}return _.concat([n||JK.bufferFrom([0]),JK.bufferFrom([1,0]),oG.toBuffer(r||"internal server error")])},XK.inherits(yG,gG),XK.inherits(bG,gG),vG.prototype.toBuffer=function(){var t=this._msg;return _.concat([iG.toBuffer(this.headers),oG.toBuffer(t.name),t.requestType.toBuffer(this.request)])},wG.prototype.toBuffer=function(){var t=iG.toBuffer(this.headers),e=void 0!==this.error;return _.concat([t,nG.toBuffer(e),e?this._msg.errorType.toBuffer(this.error):this._msg.responseType.toBuffer(this.response)])},EG.prototype.get=function(t){return this._cbs[t&this._mask]},EG.prototype.add=function(t,e){this._id=this._id+1&this._mask;var r,n=this,i=this._id;return t>0&&(r=setTimeout(function(){o(new Error("timeout"))},t)),this._cbs[i]=o,this._n++,i;function o(){n._cbs[i]&&(delete n._cbs[i],n._n--,r&&clearTimeout(r),e.apply(n._ctx,arguments))}},EG.prototype.clear=function(){Object.keys(this._cbs).forEach(function(t){this._cbs[t](new Error("interrupted"))},this)},AG.prototype._decodeRequest=function(t){var e,r,n=new $K(t),i=iG._read(n),o=oG._read(n);if(o?(e=this._serverSvc.message(o),r=this._readers[o+"?"]._read(n)):e=uG,!n.isValid())throw new Error(eG("truncated %s request",o||"ping$"));return new vG(e,i,r)},AG.prototype._decodeResponse=function(t,e,r){var n=new $K(t);JK.copyOwnProperties(iG._read(n),e.headers,!0);var i=nG._read(n),o=r.name;if(o){var s=this._readers[o+(i?"*":"!")];if(r=this._clientSvc.message(o),i?e.error=s._read(n):e.response=s._read(n),!n.isValid())throw new Error(eG("truncated %s response",o))}else r=uG},XK.inherits(MG,YK.Transform),MG.prototype._transform=function(t,e,r){var n;for(t=_.concat([this._buf,t]);t.length>=4&&t.length>=(n=t.readInt32BE(0))+4;){if(n)this._bufs.push(t.slice(4,n+4));else{var i=this._bufs;this._bufs=[],this.push({id:null,payload:i})}t=t.slice(n+4)}this._buf=t,r()},MG.prototype._flush=function(){if(this._buf.length||this._bufs.length){var t=this._bufs.slice();t.unshift(this._buf);var e=LG("TRAILING_DATA");e.trailingData=_.concat(t).toString(),this.emit("error",e)}},XK.inherits(SG,YK.Transform),SG.prototype._transform=function(t,e,r){var n,i,o,s=t.payload;for(n=0,i=s.length;n<i;n++)o=s[n],this.push(TG(o.length)),this.push(o);this.push(TG(0)),r()},XK.inherits(kG,YK.Transform),kG.prototype._transform=function(t,e,r){for(t=_.concat([this._buf,t]);;){if(void 0===this._id){if(t.length<8)return this._buf=t,void r();this._id=t.readInt32BE(0),this._frameCount=t.readInt32BE(4),t=t.slice(8)}for(var n;this._frameCount&&t.length>=4&&t.length>=(n=t.readInt32BE(0))+4;)this._frameCount--,this._bufs.push(t.slice(4,n+4)),t=t.slice(n+4);if(this._frameCount)return this._buf=t,void r();var i={id:this._id,payload:this._bufs};this._bufs=[],this._id=void 0,this.push(i)}},kG.prototype._flush=MG.prototype._flush,XK.inherits(xG,YK.Transform),xG.prototype._transform=function(t,e,r){var n,i,o=t.payload,s=o.length;for((n=JK.newBuffer(8)).writeInt32BE(t.id,0),n.writeInt32BE(s,4),this.push(n),i=0;i<s;i++)n=o[i],this.push(TG(n.length)),this.push(n);r()};var HG={Adapter:AG,HANDSHAKE_REQUEST_TYPE:sG,HANDSHAKE_RESPONSE_TYPE:aG,Message:hG,Registry:EG,Service:cG,discoverProtocol:function(t,e,r){var n;void 0===r&&"function"==typeof e&&(r=e,e=void 0),new cG({protocol:"Empty"},rG).createClient({timeout:e&&e.timeout}).createChannel(t,{scope:e&&e.scope,endWritable:"function"==typeof t}).once("handshake",function(t,e){n=e.serverProtocol,this.destroy(!0)}).once("eot",function(t,e){e&&!/interrupted/.test(e)?r(e):r(null,JSON.parse(n))})},streams:{FrameDecoder:MG,FrameEncoder:SG,NettyDecoder:kG,NettyEncoder:xG}};function KG(){return new Error("unsupported in the browser")}var GG={createImportHook:function(){return function(t,e,r){r(KG())}},createSyncImportHook:function(){return function(){throw KG()}},existsSync:function(){return!1},readFileSync:function(){throw KG()}};function VG(t,e){for(var r=0,n=t.length-1;n>=0;n--){var i=t[n];"."===i?t.splice(n,1):".."===i?(t.splice(n,1),r++):r&&(t.splice(n,1),r--)}if(e)for(;r--;r)t.unshift("..");return t}var WG=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/,JG=function(t){return WG.exec(t).slice(1)};function ZG(){for(var t="",e=!1,r=arguments.length-1;r>=-1&&!e;r--){var n=r>=0?arguments[r]:"/";if("string"!=typeof n)throw new TypeError("Arguments to path.resolve must be strings");n&&(t=n+"/"+t,e="/"===n.charAt(0))}return t=VG(iV(t.split("/"),function(t){return!!t}),!e).join("/"),(e?"/":"")+t||"."}function YG(t){var e=XG(t),r="/"===oV(t,-1);return t=VG(iV(t.split("/"),function(t){return!!t}),!e).join("/"),t||e||(t="."),t&&r&&(t+="/"),(e?"/":"")+t}function XG(t){return"/"===t.charAt(0)}function $G(){return YG(iV(Array.prototype.slice.call(arguments,0),function(t,e){if("string"!=typeof t)throw new TypeError("Arguments to path.join must be strings");return t}).join("/"))}function QG(t,e){function r(t){for(var e=0;e<t.length&&""===t[e];e++);for(var r=t.length-1;r>=0&&""===t[r];r--);return e>r?[]:t.slice(e,r-e+1)}t=ZG(t).substr(1),e=ZG(e).substr(1);for(var n=r(t.split("/")),i=r(e.split("/")),o=Math.min(n.length,i.length),s=o,a=0;a<o;a++)if(n[a]!==i[a]){s=a;break}var u=[];for(a=s;a<n.length;a++)u.push("..");return(u=u.concat(i.slice(s))).join("/")}function tV(t){var e=JG(t),r=e[0],n=e[1];return r||n?(n&&(n=n.substr(0,n.length-1)),r+n):"."}function eV(t,e){var r=JG(t)[2];return e&&r.substr(-1*e.length)===e&&(r=r.substr(0,r.length-e.length)),r}function rV(t){return JG(t)[3]}var nV={extname:rV,basename:eV,dirname:tV,sep:"/",delimiter:":",relative:QG,join:$G,isAbsolute:XG,normalize:YG,resolve:ZG};function iV(t,e){if(t.filter)return t.filter(e);for(var r=[],n=0;n<t.length;n++)e(t[n],n,t)&&r.push(t[n]);return r}var oV="b"==="ab".substr(-1)?function(t,e,r){return t.substr(e,r)}:function(t,e,r){return e<0&&(e=t.length+e),t.substr(e,r)},sV=GG,aV=hz,uV=n(Object.freeze({__proto__:null,basename:eV,default:nV,delimiter:":",dirname:tV,extname:rV,isAbsolute:XG,join:$G,normalize:YG,relative:QG,resolve:ZG,sep:"/"})),hV=Jm.format,cV={date:{type:"int",logicalType:"date"},decimal:{type:"bytes",logicalType:"decimal"},time_ms:{type:"long",logicalType:"time-millis"},timestamp_ms:{type:"long",logicalType:"timestamp-millis"}};function fV(t,e,r){r||"function"!=typeof e||(r=e,e=void 0),(e=e||{}).importHook||(e.importHook=sV.createImportHook());var n,i,o=[];function s(){var s=i.shift();if(s){var u=uV.join(uV.dirname(t),s.name);"idl"===s.kind?fV(u,e,a):e.importHook(u,s.kind,function(t,e){if(t)r(t);else switch(s.kind){case"protocol":case"schema":if(void 0===e)return void a(null,{});try{var n=JSON.parse(e)}catch(t){return t.path=u,void r(t)}a(null,"schema"===s.kind?{types:[n]}:n);break;default:r(new Error(hV("invalid import kind: %s",s.kind)))}})}else o.length&&(n.types=n.types?o.concat(n.types):o),r(null,n)}function a(t,e){if(t)r(t);else{(e.types||[]).forEach(function(t){if(void 0===t.namespace){var r=e.namespace;if(!r){var n=/^(.*)\.[^.]+$/.exec(e.protocol);n&&(r=n[1])}t.namespace=r||""}o.push(t)});try{Object.keys(e.messages||{}).forEach(function(t){if(n.messages||(n.messages={}),n.messages[t])throw new Error(hV("duplicate message: %s",t));n.messages[t]=e.messages[t]})}catch(t){return void r(t)}s()}}e.importHook(t,"idl",function(o,a){if(o)r(o);else if(void 0!==a){try{var u=new lV(a,e)._readProtocol(a,e)}catch(o){return o.path=t,void r(o)}n=u.protocol,i=u.imports,s()}else r(null,{})})}function lV(t,e){e=e||{},this._tk=new dV(t),this._ackVoidMessages=!!e.ackVoidMessages,this._implicitTags=!e.delimitedCollections,this._typeRefs=e.typeRefs||cV}function dV(t){this._str=t,this.pos=0}function pV(t){for(var e=t.replace(/^[ \t]+|[ \t]+$/g,"").split("\n").map(function(t,e){return e?t.replace(/^\s*\*\s?/,""):t});!e[0];)e.shift();for(;!e[e.length-1];)e.pop();return e.join("\n")}lV.readProtocol=function(t,e){var r=new lV(t,e)._readProtocol();if(r.imports.length)throw new Error("unresolvable import");return r.protocol},lV.readSchema=function(t,e){var r=new lV(t,e),n=r._readJavadoc(),i=r._readType(void 0===n?{}:{doc:n});return r._tk.next({id:"(eof)"}),i},lV.prototype._readProtocol=function(){var t,e=this._tk,r=[],n=[],i={};this._readImports(r);var o={},s=this._readJavadoc();for(void 0!==s&&(o.doc=s),this._readAnnotations(o),e.next({val:"protocol"}),e.next({val:"{",silent:!0})||(o.protocol=e.next({id:"name"}).val,e.next({val:"{"}));!e.next({val:"}",silent:!0});)if(!this._readImports(r)){var a=this._readJavadoc(),u=this._readType(),h=this._readImports(r,!0),c=void 0;if(t=e.pos,!h&&(c=this._readMessage(u))){void 0!==a&&void 0===c.schema.doc&&(c.schema.doc=a);var f=!1;if("void"!==c.schema.response&&"void"!==c.schema.response.type||(f=!this._ackVoidMessages&&!c.schema.errors,"void"===c.schema.response?c.schema.response="null":c.schema.response.type="null"),f&&(c.schema["one-way"]=!0),i[c.name])throw new Error(hV("duplicate message: %s",c.name));i[c.name]=c.schema}else a&&("string"==typeof u?u={doc:a,type:u}:void 0===u.doc&&(u.doc=a)),n.push(u),e.pos=t,e.next({val:";",silent:!0});a=void 0}return e.next({id:"(eof)"}),n.length&&(o.types=n),Object.keys(i).length&&(o.messages=i),{protocol:o,imports:r}},lV.prototype._readAnnotations=function(t){for(var e=this._tk;e.next({val:"@",silent:!0});){for(var r=[];!e.next({val:"(",silent:!0});)r.push(e.next().val);t[r.join("")]=e.next({id:"json"}).val,e.next({val:")"})}},lV.prototype._readMessage=function(t){var e=this._tk,r={request:[],response:t};this._readAnnotations(r);var n=e.next().val;if("("===e.next().val){if(!e.next({val:")",silent:!0}))do{r.request.push(this._readField())}while(!e.next({val:")",silent:!0})&&e.next({val:","}));var i=e.next();switch(i.val){case"throws":r.errors=[];do{r.errors.push(this._readType())}while(!e.next({val:";",silent:!0})&&e.next({val:","}));break;case"oneway":r["one-way"]=!0,e.next({val:";"});break;case";":break;default:throw e.error("invalid message suffix",i)}return{name:n,schema:r}}},lV.prototype._readJavadoc=function(){var t=this._tk.next({id:"javadoc",emitJavadoc:!0,silent:!0});if(t)return t.val},lV.prototype._readField=function(){var t=this._tk,e=this._readJavadoc(),r={type:this._readType()};return void 0!==e&&void 0===r.doc&&(r.doc=e),this._readAnnotations(r),r.name=t.next({id:"name"}).val,t.next({val:"=",silent:!0})&&(r.default=t.next({id:"json"}).val),r},lV.prototype._readType=function(t){switch(t=t||{},this._readAnnotations(t),t.type=this._tk.next({id:"name"}).val,t.type){case"record":case"error":return this._readRecord(t);case"fixed":return this._readFixed(t);case"enum":return this._readEnum(t);case"map":return this._readMap(t);case"array":return this._readArray(t);case"union":if(Object.keys(t).length>1)throw new Error("union annotations are not supported");return this._readUnion();default:var e=this._typeRefs[t.type];return e&&(delete t.type,aV.copyOwnProperties(e,t)),Object.keys(t).length>1?t:t.type}},lV.prototype._readFixed=function(t){var e=this._tk;return e.next({val:"(",silent:!0})||(t.name=e.next({id:"name"}).val,e.next({val:"("})),t.size=parseInt(e.next({id:"number"}).val),e.next({val:")"}),t},lV.prototype._readMap=function(t){var e=this._tk,r=this._implicitTags,n=void 0===e.next({val:"<",silent:r});return t.values=this._readType(),e.next({val:">",silent:n}),t},lV.prototype._readArray=function(t){var e=this._tk,r=this._implicitTags,n=void 0===e.next({val:"<",silent:r});return t.items=this._readType(),e.next({val:">",silent:n}),t},lV.prototype._readEnum=function(t){var e=this._tk;e.next({val:"{",silent:!0})||(t.name=e.next({id:"name"}).val,e.next({val:"{"})),t.symbols=[];do{t.symbols.push(e.next().val)}while(!e.next({val:"}",silent:!0})&&e.next({val:","}));return t},lV.prototype._readUnion=function(){var t=this._tk,e=[];t.next({val:"{"});do{e.push(this._readType())}while(!t.next({val:"}",silent:!0})&&t.next({val:","}));return e},lV.prototype._readRecord=function(t){var e=this._tk;for(e.next({val:"{",silent:!0})||(t.name=e.next({id:"name"}).val,e.next({val:"{"})),t.fields=[];!e.next({val:"}",silent:!0});)t.fields.push(this._readField()),e.next({val:";"});return t},lV.prototype._readImports=function(t,e){for(var r=this._tk,n=0,i=r.pos;r.next({val:"import",silent:!0});){if(!n&&e&&r.next({val:"(",silent:!0}))return void(r.pos=i);var o=r.next({id:"name"}).val,s=JSON.parse(r.next({id:"string"}).val);r.next({val:";"}),t.push({kind:o,name:s}),n++}return n},dV.prototype.next=function(t){var e,r={pos:this.pos,id:void 0,val:void 0},n=this._skip(t&&t.emitJavadoc);if(n)r.id="javadoc",r.val=n;else{var i=this.pos,o=this._str,s=o.charAt(i);if(s)if(t&&"json"===t.id?(r.id="json",this.pos=this._endOfJson()):'"'===s?(r.id="string",this.pos=this._endOfString()):/[0-9]/.test(s)?(r.id="number",this.pos=this._endOf(/[0-9]/)):/[`A-Za-z_.]/.test(s)?(r.id="name",this.pos=this._endOf(/[`A-Za-z0-9_.]/)):(r.id="operator",this.pos=i+1),r.val=o.slice(i,this.pos),"json"===r.id)try{r.val=JSON.parse(r.val)}catch(e){throw this.error("invalid JSON",r)}else"name"===r.id&&(r.val=r.val.replace(/`/g,""));else r.id="(eof)"}if(t&&t.id&&t.id!==r.id?e=this.error(hV("expected ID %s",t.id),r):t&&t.val&&t.val!==r.val&&(e=this.error(hV("expected value %s",t.val),r)),e){if(t&&t.silent)return void(this.pos=r.pos);throw e}return r},dV.prototype.error=function(t,e){var r,n="number"!=typeof e,i=n?e.pos:e,o=this._str,s=1,a=0;for(r=0;r<i;r++)"\n"===o.charAt(r)&&(s++,a=r);var u=n?hV("invalid token %j: %s",e,t):t,h=new Error(u);return h.token=n?e:void 0,h.lineNum=s,h.colNum=i-a,h},dV.prototype._skip=function(t){for(var e,r,n=this._str,i=!1;(r=n.charAt(this.pos))&&/\s/.test(r);)this.pos++;if(e=this.pos,"/"===r)switch(n.charAt(this.pos+1)){case"/":for(this.pos+=2;(r=n.charAt(this.pos))&&"\n"!==r;)this.pos++;return this._skip(t);case"*":for(this.pos+=2,"*"===n.charAt(this.pos)&&(i=!0);r=n.charAt(this.pos++);)if("*"===r&&"/"===n.charAt(this.pos))return this.pos++,i&&t?pV(n.slice(e+3,this.pos-2)):this._skip(t);throw this.error("unterminated comment",e)}},dV.prototype._endOf=function(t){for(var e=this.pos,r=this._str;t.test(r.charAt(e));)e++;return e},dV.prototype._endOfString=function(){for(var t,e=this.pos+1,r=this._str;t=r.charAt(e);){if('"'===t)return e+1;"\\"===t?e+=2:e++}throw this.error("unterminated string",e-1)},dV.prototype._endOfJson=function(){var t=aV.jsonEnd(this._str,this.pos);if(t<0)throw this.error("invalid JSON",t);return t};var mV={Tokenizer:dV,assembleProtocol:fV,read:function(t){var e;if("string"==typeof t&&~t.indexOf(uV.sep)&&sV.existsSync(t)){var r=sV.readFileSync(t,{encoding:"utf8"});try{return JSON.parse(r)}catch(n){fV(t,{importHook:sV.createSyncImportHook()},function(t,n){e=t?r:n})}}else e=t;if("string"!=typeof e||"null"===e)return e;try{return JSON.parse(e)}catch(t){try{return lV.readProtocol(e)}catch(t){try{return lV.readSchema(e)}catch(t){return e}}}},readProtocol:lV.readProtocol,readSchema:lV.readSchema},gV=VK,yV=HG,bV=mV,vV=iq,wV=hz,_V=Ul,EV=Jm;var AV,MV,SV,kV={Service:yV.Service,Type:vV.Type,assembleProtocol:bV.assembleProtocol,createFileDecoder:function(t,e){return _V.createReadStream(t).pipe(new gV.streams.BlockDecoder(e))},createFileEncoder:function(t,e,r){var n=new gV.streams.BlockEncoder(e,r);return n.pipe(_V.createWriteStream(t,{defaultEncoding:"binary"})),n},discoverProtocol:yV.discoverProtocol,extractFileHeader:function(t,e){for(var r=void 0===(e=e||{}).decode||!!e.decode,n=Math.max(e.size||4096,4),i=_V.openSync(t,"r"),o=wV.newBuffer(n),s=0,a=new wV.Tap(o),u=null;s<4;)s+=_V.readSync(i,o,s,n-s);if(gV.MAGIC_BYTES.equals(o.slice(0,4))){do{u=gV.HEADER_TYPE._read(a)}while(!c());if(!1!==r){var h=u.meta;h["avro.schema"]=JSON.parse(h["avro.schema"].toString()),void 0!==h["avro.codec"]&&(h["avro.codec"]=h["avro.codec"].toString())}}return _V.closeSync(i),u;function c(){if(a.isValid())return!0;var t=2*a.buf.length,e=wV.newBuffer(t);return t=_V.readSync(i,e,0,t),a.buf=_.concat([a.buf,e]),a.pos=0,!1}},parse:function(t,e){var r=bV.read(t);return r.protocol?yV.Service.forProtocol(r,e):vV.Type.forSchema(r,e)},readProtocol:bV.readProtocol,readSchema:bV.readSchema,streams:gV.streams,types:vV.builtins,Protocol:yV.Service,assemble:EV.deprecate(bV.assembleProtocol,"use `assembleProtocol` instead"),combine:EV.deprecate(vV.Type.forTypes,"use `Type.forTypes` intead"),infer:EV.deprecate(vV.Type.forValue,"use `Type.forValue` instead")};function xV(){return AV||(AV=1,function(t){var r=e&&e.__createBinding||(Object.create?function(t,e,r,n){void 0===n&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){void 0===n&&(n=r),t[n]=e[r]}),n=e&&e.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),i=e&&e.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var i in t)"default"!==i&&Object.prototype.hasOwnProperty.call(t,i)&&r(e,t,i);return n(e,t),e},o=e&&e.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(t,"__esModule",{value:!0}),t.MIN_BINARY_SIZE=void 0;const s=LF,a=XF,u=o(jl),h=st,c=RV(),f=Sl,l=AF,d=o(Af),p=Fl,m=i(ow);t.MIN_BINARY_SIZE=80;class g{constructor(t){this.binary=t}static isDataItem(t){return void 0!==t.binary}get signatureType(){const t=s.byteArrayToLong(this.binary.subarray(0,2));switch(t){case 1:return p.SignatureConfig.ARWEAVE;case 2:return p.SignatureConfig.ED25519;case 3:return p.SignatureConfig.ETHEREUM;case 4:return p.SignatureConfig.SOLANA;default:throw new Error("Unknown signature type: "+t)}}async isValid(){return g.verify(this.binary)}get id(){return u.default.encode(this.rawId)}set id(t){this._id=u.default.toBuffer(t)}get rawId(){return m.createHash("sha256").update(this.rawSignature).digest()}set rawId(t){this._id=t}get rawSignature(){return this.binary.subarray(2,2+this.signatureLength)}get signature(){return u.default.encode(this.rawSignature)}get signatureLength(){return p.SIG_CONFIG[this.signatureType].sigLength}get rawOwner(){return this.binary.subarray(2+this.signatureLength,2+this.signatureLength+this.ownerLength)}get owner(){return u.default.encode(this.rawOwner)}get ownerLength(){return p.SIG_CONFIG[this.signatureType].pubLength}get rawTarget(){const t=this.getTargetStart();return 1==this.binary[t]?this.binary.subarray(t+1,t+33):h.Buffer.alloc(0)}get target(){return u.default.encode(this.rawTarget)}get rawAnchor(){const t=this.getAnchorStart();return 1==this.binary[t]?this.binary.subarray(t+1,t+33):h.Buffer.alloc(0)}get anchor(){return this.rawAnchor.toString()}get rawTags(){const t=this.getTagsStart(),e=s.byteArrayToLong(this.binary.subarray(t+8,t+16));return this.binary.subarray(t+16,t+16+e)}get tags(){const t=this.getTagsStart();if(0==s.byteArrayToLong(this.binary.subarray(t,t+8)))return[];const e=s.byteArrayToLong(this.binary.subarray(t+8,t+16));return a.tagsParser.fromBuffer(h.Buffer.from(this.binary.subarray(t+16,t+16+e)))}get tagsB64Url(){return this.tags.map(t=>({name:u.default.encode(t.name),value:u.default.encode(t.value)}))}getStartOfData(){const t=this.getTagsStart(),e=this.binary.subarray(t+8,t+16);return t+16+s.byteArrayToLong(e)}get rawData(){const t=this.getTagsStart(),e=this.binary.subarray(t+8,t+16),r=t+16+s.byteArrayToLong(e);return this.binary.subarray(r,this.binary.length)}get data(){return u.default.encode(this.rawData)}getRaw(){return this.binary}async sign(t){return this._id=await c.sign(this,t),this.rawId}isSigned(){var t,e;return(null!==(e=null===(t=this._id)||void 0===t?void 0:t.length)&&void 0!==e?e:0)>0}toJSON(){return{signature:this.signature,owner:this.owner,target:this.target,tags:this.tags.map(t=>({name:u.default.encode(t.name),value:u.default.encode(t.value)})),data:this.data}}async sendToBundler(t){if(!this.isSigned())throw new Error("You must sign before sending to bundler");const e=await d.default.post(`${t}/tx`,this.getRaw(),{headers:{"Content-Type":"application/octet-stream"},timeout:1e5,maxBodyLength:1/0,validateStatus:t=>t>200&&t<300||402!==t});if(402===e.status)throw new Error("Not enough funds to send data");return e}static async verify(e){if(e.byteLength<t.MIN_BINARY_SIZE)return!1;const r=new g(e),n=r.signatureType,i=r.getTagsStart(),o=s.byteArrayToLong(e.subarray(i,i+8)),u=e.subarray(i+8,i+16),c=s.byteArrayToLong(u);if(c>4096)return!1;if(o>0)try{if(a.tagsParser.fromBuffer(h.Buffer.from(e.subarray(i+16,i+16+c))).length!==o)return!1}catch(t){return!1}const d=f.indexToType[n],p=await l.getSignatureData(r);return await d.verify(r.rawOwner,p,r.rawSignature)}async getSignatureData(){return l.getSignatureData(this)}getTagsStart(){const t=this.getTargetStart();let e=t+(1==this.binary[t]?33:1);return e+=1==this.binary[e]?33:1,e}getTargetStart(){return 2+this.signatureLength+this.ownerLength}getAnchorStart(){let t=this.getTargetStart()+1;return t+=1==this.binary[this.getTargetStart()]?32:0,t}}t.default=g}(YF)),YF}function TV(){if(MV)return ZF;MV=1;var t=e&&e.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(ZF,"__esModule",{value:!0});const r=t(jl),n=LF,i=t(xV()),o=ow,s=32;return ZF.default=class{constructor(t){this.binary=t,this.length=this.getDataItemCount(),this.items=this.getItems()}getRaw(){return this.binary}get(t){if("number"==typeof t){if(t>=this.length)throw new RangeError("Index out of range");return this.getByIndex(t)}return this.getById(t)}getSizes(){const t=[];for(let e=s;e<s+64*this.length;e+=64)t.push(n.byteArrayToLong(this.binary.subarray(e,e+32)));return t}getIds(){const t=[];for(let e=s;e<s+64*this.length;e+=64)t.push(r.default.encode(this.binary.subarray(e+32,e+64)));return t}getIdBy(t){if(t>this.length-1)throw new RangeError("Index of bundle out of range");const e=64+64*t;return r.default.encode(this.binary.subarray(e,e+32))}async toTransaction(t,e,r){const n=await e.createTransaction({data:this.binary,...t},r);return n.addTag("Bundle-Format","binary"),n.addTag("Bundle-Version","2.0.0"),n}async verify(){for(const t of this.items){const e=await t.isValid(),n=r.default(o.createHash("sha256").update(t.rawSignature).digest());if(!e||t.id!==n)return!1}return!0}getOffset(t){let e=0;for(let r=s;r<s+64*this.length;r+=64){const i=n.byteArrayToLong(this.binary.subarray(r,r+32));e+=i;const o=this.binary.subarray(r+32,r+64);if(n.arraybufferEqual(o,t))return{startOffset:e,size:i}}return{startOffset:-1,size:-1}}getByIndex(t){let e=0;const r=32+64*t,o=n.byteArrayToLong(this.binary.subarray(r,r+32));let a=0;for(let r=s;r<s+64*this.length&&a!=t;r+=64){e+=n.byteArrayToLong(this.binary.subarray(r,r+32)),a++}const u=this.getBundleStart()+e,h=this.binary.subarray(u,u+o+200),c=new i.default(h);return c.rawId=this.binary.slice(32+64*t,64+64*t),c}getById(t){const e=r.default.toBuffer(t),n=this.getOffset(e);if(-1===n.startOffset)throw new Error("Transaction not found");const o=this.getBundleStart()+n.startOffset;return new i.default(this.binary.subarray(o,o+n.size))}getDataItemCount(){return n.byteArrayToLong(this.binary.subarray(0,32))}getBundleStart(){return 32+64*this.length}getItems(){const t=new Array(this.length);let e=0;const r=this.getBundleStart();let o=0;for(let a=s;a<s+64*this.length;a+=64){const s=n.byteArrayToLong(this.binary.subarray(a,a+32)),u=this.binary.subarray(a+32,a+64),h=r+e,c=this.binary.subarray(h,h+s);e+=s;const f=new i.default(c);f.rawId=u,t[o]=f,o++}return t}},ZF}function RV(){if(SV)return EF;SV=1;var t=e&&e.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(EF,"__esModule",{value:!0}),EF.sign=EF.getSignatureAndId=EF.bundleAndSignData=EF.unbundleData=void 0;const r=AF,n=LF,i=t(DO),o=t(TV());async function s(t,e){const n=await r.getSignatureData(t),o=await e.sign(n),s=await i.default.crypto.hash(o);return{signature:_.from(o),id:_.from(s)}}async function a(t,e){const{signature:r,id:n}=await s(t,e);return t.getRaw().set(r,2),n}return EF.unbundleData=function(t){return new o.default(t)},EF.bundleAndSignData=async function(t,e){const r=new Uint8Array(64*t.length),i=await Promise.all(t.map(async(t,i)=>{const o=t.isSigned()?t.rawId:await a(t,e),s=new Uint8Array(64);return s.set(n.longTo32ByteArray(t.getRaw().byteLength),0),s.set(o,32),r.set(s,64*i),t.getRaw()})).then(t=>_.concat(t)),s=_.concat([n.longTo32ByteArray(t.length),r,i]);return new o.default(s)},EF.getSignatureAndId=s,EF.sign=a,EF}!function(t){var r=e&&e.__createBinding||(Object.create?function(t,e,r,n){void 0===n&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){void 0===n&&(n=r),t[n]=e[r]}),n=e&&e.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),i=e&&e.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var i in t)"default"!==i&&Object.prototype.hasOwnProperty.call(t,i)&&r(e,t,i);return n(e,t),e};Object.defineProperty(t,"__esModule",{value:!0}),t.serializeTags=t.tagsParser=t.tagParser=void 0;const o=i(kV);t.tagParser=o.Type.forSchema({type:"record",name:"Tag",fields:[{name:"name",type:"string"},{name:"value",type:"string"}]}),t.tagsParser=o.Type.forSchema({type:"array",items:t.tagParser}),t.serializeTags=function(e){if(0==e.length)return new Uint8Array(0);let r;try{r=t.tagsParser.toBuffer(e)}catch(t){throw new Error("Incorrect tag format used. Make sure your tags are { name: string!, value: string! }[]")}return Uint8Array.from(r)}}(XF);var BV={};function NV(t,e){if(t===e)return 0;for(var r=t.length,n=e.length,i=0,o=Math.min(r,n);i<o;++i)if(t[i]!==e[i]){r=t[i],n=e[i];break}return r<n?-1:n<r?1:0}var PV,IV=Object.prototype.hasOwnProperty,OV=Object.keys||function(t){var e=[];for(var r in t)IV.call(t,r)&&e.push(r);return e},CV=Array.prototype.slice;function LV(){return void 0!==PV?PV:PV="foo"===function(){}.name}function jV(t){return Object.prototype.toString.call(t)}function DV(t){return!it(t)&&("function"==typeof o.ArrayBuffer&&("function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(t):!!t&&(t instanceof DataView||!!(t.buffer&&t.buffer instanceof ArrayBuffer))))}function UV(t,e){t||GV(t,!0,e,"==",VV)}var FV=/\s*function\s+([^\(\s]*)\s*/;function zV(t){if(Dm(t)){if(LV())return t.name;var e=t.toString().match(FV);return e&&e[1]}}function qV(t){this.name="AssertionError",this.actual=t.actual,this.expected=t.expected,this.operator=t.operator,t.message?(this.message=t.message,this.generatedMessage=!1):(this.message=function(t){return HV(KV(t.actual),128)+" "+t.operator+" "+HV(KV(t.expected),128)}(this),this.generatedMessage=!0);var e=t.stackStartFunction||GV;if(Error.captureStackTrace)Error.captureStackTrace(this,e);else{var r=new Error;if(r.stack){var n=r.stack,i=zV(e),o=n.indexOf("\n"+i);if(o>=0){var s=n.indexOf("\n",o+1);n=n.substring(s+1)}this.stack=n}}}function HV(t,e){return"string"==typeof t?t.length<e?t:t.slice(0,e):t}function KV(t){if(LV()||!Dm(t))return wm(t);var e=zV(t);return"[Function"+(e?": "+e:"")+"]"}function GV(t,e,r,n,i){throw new qV({message:r,actual:t,expected:e,operator:n,stackStartFunction:i})}function VV(t,e){t||GV(t,!0,e,"==",VV)}function WV(t,e,r){t!=e&&GV(t,e,r,"==",WV)}function JV(t,e,r){t==e&&GV(t,e,r,"!=",JV)}function ZV(t,e,r){XV(t,e,!1)||GV(t,e,r,"deepEqual",ZV)}function YV(t,e,r){XV(t,e,!0)||GV(t,e,r,"deepStrictEqual",YV)}function XV(t,e,r,n){if(t===e)return!0;if(it(t)&&it(e))return 0===NV(t,e);if(Lm(t)&&Lm(e))return t.getTime()===e.getTime();if(Om(t)&&Om(e))return t.source===e.source&&t.global===e.global&&t.multiline===e.multiline&&t.lastIndex===e.lastIndex&&t.ignoreCase===e.ignoreCase;if(null!==t&&"object"==typeof t||null!==e&&"object"==typeof e){if(DV(t)&&DV(e)&&jV(t)===jV(e)&&!(t instanceof Float32Array||t instanceof Float64Array))return 0===NV(new Uint8Array(t.buffer),new Uint8Array(e.buffer));if(it(t)!==it(e))return!1;var i=(n=n||{actual:[],expected:[]}).actual.indexOf(t);return-1!==i&&i===n.expected.indexOf(e)||(n.actual.push(t),n.expected.push(e),function(t,e,r,n){if(null==t||null==e)return!1;if(Um(t)||Um(e))return t===e;if(r&&Object.getPrototypeOf(t)!==Object.getPrototypeOf(e))return!1;var i=$V(t),o=$V(e);if(i&&!o||!i&&o)return!1;if(i)return XV(t=CV.call(t),e=CV.call(e),r);var s,a,u=OV(t),h=OV(e);if(u.length!==h.length)return!1;for(u.sort(),h.sort(),a=u.length-1;a>=0;a--)if(u[a]!==h[a])return!1;for(a=u.length-1;a>=0;a--)if(!XV(t[s=u[a]],e[s],r,n))return!1;return!0}(t,e,r,n))}return r?t===e:t==e}function $V(t){return"[object Arguments]"==Object.prototype.toString.call(t)}function QV(t,e,r){XV(t,e,!1)&&GV(t,e,r,"notDeepEqual",QV)}function tW(t,e,r){XV(t,e,!0)&&GV(t,e,r,"notDeepStrictEqual",tW)}function eW(t,e,r){t!==e&&GV(t,e,r,"===",eW)}function rW(t,e,r){t===e&&GV(t,e,r,"!==",rW)}function nW(t,e){if(!t||!e)return!1;if("[object RegExp]"==Object.prototype.toString.call(e))return e.test(t);try{if(t instanceof e)return!0}catch(t){}return!Error.isPrototypeOf(e)&&!0===e.call({},t)}function iW(t,e,r,n){var i;if("function"!=typeof e)throw new TypeError('"block" argument must be a function');"string"==typeof r&&(n=r,r=null),i=function(t){var e;try{t()}catch(t){e=t}return e}(e),n=(r&&r.name?" ("+r.name+").":".")+(n?" "+n:"."),t&&!i&&GV(i,r,"Missing expected exception"+n);var o="string"==typeof n,s=!t&&i&&!r;if((!t&&jm(i)&&o&&nW(i,r)||s)&&GV(i,r,"Got unwanted exception"+n),t&&i&&r&&!nW(i,r)||!t&&i)throw i}function oW(t,e,r){iW(!0,t,e,r)}function sW(t,e,r){iW(!1,t,e,r)}function aW(t){if(t)throw t}UV.AssertionError=qV,dm(qV,Error),UV.fail=GV,UV.ok=VV,UV.equal=WV,UV.notEqual=JV,UV.deepEqual=ZV,UV.deepStrictEqual=YV,UV.notDeepEqual=QV,UV.notDeepStrictEqual=tW,UV.strictEqual=eW,UV.notStrictEqual=rW,UV.throws=oW,UV.doesNotThrow=sW,UV.ifError=aW;var uW=n(Object.freeze({__proto__:null,AssertionError:qV,assert:VV,deepEqual:ZV,deepStrictEqual:YV,default:UV,doesNotThrow:sW,equal:WV,fail:GV,ifError:aW,notDeepEqual:QV,notDeepStrictEqual:tW,notEqual:JV,notStrictEqual:rW,ok:VV,strictEqual:eW,throws:oW})),hW=e&&e.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(BV,"__esModule",{value:!0}),BV.createData=void 0;const cW=hW(uW),fW=hW(jl),lW=LF,dW=hW(xV()),pW=XF;BV.createData=function(t,e,r){var n,i,o,s,a,u,h;const c=e.publicKey,f=(null==r?void 0:r.target)?fW.default.toBuffer(r.target):null,l=1+(null!==(n=null==f?void 0:f.byteLength)&&void 0!==n?n:0),d=(null==r?void 0:r.anchor)?_.from(r.anchor):null,p=1+(null!==(i=null==d?void 0:d.byteLength)&&void 0!==i?i:0),m=(null!==(s=null===(o=null==r?void 0:r.tags)||void 0===o?void 0:o.length)&&void 0!==s?s:0)>0?pW.serializeTags(r.tags):null,g=16+(m?m.byteLength:0),y=_.from(t),b=y.byteLength,v=2+e.signatureLength+e.ownerLength+l+p+g+b,w=_.alloc(v);w.set(lW.shortTo2ByteArray(e.signatureType),0),w.set(new Uint8Array(e.signatureLength).fill(0),2),cW.default(c.byteLength==e.ownerLength,new Error(`Owner must be ${e.ownerLength} bytes, but was incorrectly ${c.byteLength}`)),w.set(c,2+e.signatureLength);const E=2+e.signatureLength+e.ownerLength;w[E]=f?1:0,f&&(cW.default(32==f.byteLength,new Error("Target must be 32 bytes but was incorrectly ${_target.byteLength}")),w.set(f,E+1));const A=E+l;let M=A+1;w[A]=d?1:0,d&&(M+=d.byteLength,cW.default(32==d.byteLength,new Error("Anchor must be 32 bytes")),w.set(d,A+1)),w.set(lW.longTo8ByteArray(null!==(u=null===(a=null==r?void 0:r.tags)||void 0===a?void 0:a.length)&&void 0!==u?u:0),M);const S=lW.longTo8ByteArray(null!==(h=null==m?void 0:m.byteLength)&&void 0!==h?h:0);w.set(S,M+8),m&&w.set(m,M+16);const k=M+g;return w.set(y,k),new dW.default(w)},function(t){var r=e&&e.__createBinding||(Object.create?function(t,e,r,n){void 0===n&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){void 0===n&&(n=r),t[n]=e[r]}),n=e&&e.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),i=e&&e.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var i in t)"default"!==i&&Object.prototype.hasOwnProperty.call(t,i)&&r(e,t,i);return n(e,t),e},o=e&&e.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(t,"__esModule",{value:!0}),t.signers=t.deepHash=t.unbundleData=t.bundleAndSignData=t.createData=t.DataItem=t.Bundle=t.MIN_BINARY_SIZE=void 0;const s=RV();Object.defineProperty(t,"bundleAndSignData",{enumerable:!0,get:function(){return s.bundleAndSignData}}),Object.defineProperty(t,"unbundleData",{enumerable:!0,get:function(){return s.unbundleData}});const a=o(TV());t.Bundle=a.default;const u=i(xV());t.DataItem=u.default,Object.defineProperty(t,"MIN_BINARY_SIZE",{enumerable:!0,get:function(){return u.MIN_BINARY_SIZE}});const h=jF;Object.defineProperty(t,"deepHash",{enumerable:!0,get:function(){return h.deepHash}});const c=BV;Object.defineProperty(t,"createData",{enumerable:!0,get:function(){return c.createData}});const f=Sl,l=o(PU),d=o(Gl),p={ArweaveSigner:f.ArweaveSigner,SolanaSigner:l.default,EthereumSigner:d.default};t.signers=p}(_F);let mW="";const gW=async(t,e)=>{const r=[{name:"SDK-Timestamp",value:Date.now().toString()}],{tags:n,processId:i,data:o=""}=e,s=El(r,n);if((null!=(null==t?void 0:t.signer)||void 0!==t.signer)&&t.signer instanceof Ch){const e=new Sl.InjectedEthereumSigner(t.signer);if(""!==mW){const r=await t.signer.getSigner().getAddress(),n=_a("0x"+mW);r.toLowerCase()!==n.toLowerCase()?(await e.setPublicKey(),mW=e.publicKey.toString("hex")):(e.setPublicKey=async function(){this.publicKey=_.from(mW,"hex")},await e.setPublicKey())}else await e.setPublicKey(),mW=e.publicKey.toString("hex");const r=_F.createData(o,e,{tags:s,target:i});return await r.sign(e),r.getRaw()}if((null!=t.arJWK||void 0!==t.arJWK)&&"use_wallet"===t.arJWK){if(await(async t=>{let e=[];t=Gf(t)?[t]:t;try{e=await window.arweaveWallet.getPermissions()}catch{throw new Error("PLEASE_INSTALL_ARCONNECT")}0!==t.length&&t.some(t=>!e.includes(t))&&await window.arweaveWallet.connect(t)})(["ACCESS_ADDRESS","ACCESS_ALL_ADDRESSES","ACCESS_PUBLIC_KEY","SIGN_TRANSACTION","SIGNATURE"]),void 0!==window.arweaveWallet&&"function"==typeof window.arweaveWallet.signDataItem){const t=await window.arweaveWallet.signDataItem({data:o,tags:s,target:i});return new _F.DataItem(_.from(t)).getRaw()}throw new Error("window.arweaveWallet not undefined")}if("string"==typeof t.privateKey&&/^0x[0-9a-fA-F]{64}$/.test(t.privateKey)){const e=new ew(t.privateKey.slice(2)),r=_F.createData(o,e,{tags:s,target:i});return await r.sign(e),r.getRaw()}if(void 0!==t.arJWK&&(null!==(a=t.arJWK)&&"object"==typeof a&&"string"==typeof a.kty&&"string"==typeof a.e&&"string"==typeof a.n)){const e=new Sl.ArweaveSigner(t.arJWK),r=_F.createData(o,e,{tags:s,target:i});return await r.sign(e),r.getRaw()}var a;throw new Error("Config must provide at least one of: ethSigner, privateKey, or arJWK")};t.HyMatrixBase=Fh,t.Web3Provider=Ch,t.default=class extends Fh{constructor(t){var e,r;super(),this._config={...t,debug:null!==(e=null==t?void 0:t.debug)&&void 0!==e&&e,accid:null!==(r=null==t?void 0:t.accid)&&void 0!==r?r:""},this._apiHost=null!=(null==t?void 0:t.url)&&void 0!==t.url&&""!==t.url?t.url:(t=>!0===t?"https://hymx.permadao.io":"https://hymatrix.ai")(this._config.debug)}async info(){return await(async t=>{const e=`${t}/info`;return(await Ml({...Al,url:e,method:"GET"})).data})(this._apiHost)}async getResult(t){const e=await(async(t,e)=>{const r=`${t}/result/${e}`;return(await Ml({...Al,url:r,method:"GET"})).data})(this._apiHost,t);return e}async getResults(t,e){const r=await(async(t,e,r)=>{const n=Vf.stringify({sort:"DESC",limit:r}),i=`${t}/results/${e}${""!==n?`?${n}`:""}`;return(await Ml({...Al,url:i,method:"GET"})).data})(this._apiHost,t,e);return r}async getMessage(t){const e=await(async(t,e)=>{const r=`${t}/message/${e}`;return(await Ml({...Al,url:r,method:"GET"})).data})(this._apiHost,t);return e}async getMessageByNonce(t,e){const r=await(async(t,e,r)=>{const n=`${t}/messageByNonce/${e}/${r}`;return(await Ml({...Al,url:n,method:"GET"})).data})(this._apiHost,t,e);return r}async getAssignByNonce(t,e){const r=await(async(t,e,r)=>{const n=`${t}/assignmentByNonce/${e}/${r}`;return(await Ml({...Al,url:n,method:"GET"})).data})(this._apiHost,t,e);return r}async getAssignByMessage(t){const e=await(async(t,e)=>{const r=`${t}/assignmentByMessage/${e}`;return(await Ml({...Al,url:r,method:"GET"})).data})(this._apiHost,t);return e}async getNodes(){return await(async t=>{const e=`${t}/nodes`;return(await Ml({...Al,url:e,method:"GET"})).data})(this._apiHost)}async getNode(t){const e=null!=t?t:this._config.accid,r=await(async(t,e)=>{const r=`${t}/node/${e}`;return(await Ml({...Al,url:r,method:"GET"})).data})(this._apiHost,e);return r}async getNodesByProcess(t){const e=await(async(t,e)=>{const r=`${t}/nodesByProcess/${e}`;return(await Ml({...Al,url:r,method:"GET"})).data})(this._apiHost,t);return e}async getProcesses(t){const e=null!=t?t:this._config.accid,r=await(async(t,e)=>{const r=`${t}/processes/${e}`;return(await Ml({...Al,url:r,method:"GET"})).data})(this._apiHost,e);return r}async balanceOf(t){const e=null!=t?t:this._config.accid,r=await(async(t,e)=>{const r=`${t}/balanceof/${e}`,n=await Ml({...Al,url:r,method:"GET"});return _l(n.data).toString()})(this._apiHost,e);return r}async stakeOf(t){const e=null!=t?t:this._config.accid,r=await(async(t,e)=>{const r=`${t}/stakeof/${e}`,n=await Ml({...Al,url:r,method:"GET"});return _l(n.data).toString()})(this._apiHost,e);return r}async sendMessage(e){const r=await this.info(),n=(i=t.BaseType.TypeMessage,{"Data-Protocol":(o=r).Protocol,Variant:o.Variant,Type:i});var i,o;const s=[{name:"Data-Protocol",value:(a={Base:n}.Base)["Data-Protocol"]},{name:"Variant",value:a.Variant},{name:"Type",value:a.Type}];var a;const u=El(s,e.tags),h=await gW(this._config,{...e,tags:u}),c=await(async(t,e)=>{const r=`${t}/`;return(await Ml({...Al,url:r,method:"POST",data:e})).data})(this._apiHost,h);return{id:c.id}}},Object.defineProperty(t,"__esModule",{value:!0})});