From 41c2b97a0effe472841dea82de6b94f651182f2c Mon Sep 17 00:00:00 2001 From: Robot Date: Sat, 13 Nov 2021 00:09:54 +0000 Subject: [PATCH] chore(release): publish v7.0.0-alpha.2 ganache@7.0.0-alpha.2 --- docs/assets/js/ganache/ganache.min.js | 2 +- .../js/ganache/ganache.min.js.LICENSE.txt | 7 + docs/assets/js/ganache/ganache.min.js.map | 2 +- docs/typedoc/api.json | 2 +- docs/typedoc/classes/_api_.ethereumapi.html | 198 +- docs/typedoc/modules/_api_.html | 14 +- src/chains/ethereum/address/package-lock.json | 2710 ++- src/chains/ethereum/address/package.json | 4 +- src/chains/ethereum/block/package-lock.json | 3186 +++- src/chains/ethereum/block/package.json | 12 +- .../ethereum/ethereum/package-lock.json | 7270 +++++++- src/chains/ethereum/ethereum/package.json | 22 +- src/chains/ethereum/options/package-lock.json | 1329 +- src/chains/ethereum/options/package.json | 10 +- .../ethereum/transaction/package-lock.json | 4199 ++++- src/chains/ethereum/transaction/package.json | 12 +- src/chains/ethereum/utils/package-lock.json | 2577 ++- src/chains/ethereum/utils/package.json | 8 +- .../filecoin/filecoin/package-lock.json | 13814 +++++++++++++++- src/chains/filecoin/filecoin/package.json | 6 +- src/chains/filecoin/options/package-lock.json | 2754 ++- src/chains/filecoin/options/package.json | 4 +- src/chains/tezos/options/package-lock.json | 1165 +- src/chains/tezos/options/package.json | 2 +- src/chains/tezos/tezos/package-lock.json | 3610 +++- src/chains/tezos/tezos/package.json | 6 +- src/packages/cli/package-lock.json | 1708 +- src/packages/cli/package.json | 16 +- src/packages/colors/package-lock.json | 1165 +- src/packages/colors/package.json | 2 +- src/packages/core/package-lock.json | 3619 +++- src/packages/core/package.json | 12 +- src/packages/flavors/package-lock.json | 1162 +- src/packages/flavors/package.json | 18 +- src/packages/ganache/npm-shrinkwrap.json | 4093 ++++- src/packages/ganache/package.json | 8 +- src/packages/options/package-lock.json | 1322 +- src/packages/options/package.json | 4 +- src/packages/promise-queue/package-lock.json | 1179 +- src/packages/promise-queue/package.json | 2 +- src/packages/rlp/package-lock.json | 2729 ++- src/packages/rlp/package.json | 4 +- src/packages/secp256k1/package-lock.json | 2795 +++- src/packages/secp256k1/package.json | 2 +- src/packages/utils/package-lock.json | 1453 +- src/packages/utils/package.json | 2 +- 46 files changed, 63810 insertions(+), 410 deletions(-) diff --git a/docs/assets/js/ganache/ganache.min.js b/docs/assets/js/ganache/ganache.min.js index 025bba2687..079983c3bc 100644 --- a/docs/assets/js/ganache/ganache.min.js +++ b/docs/assets/js/ganache/ganache.min.js @@ -1,3 +1,3 @@ /*! For license information please see ganache.min.js.LICENSE.txt */ -!function webpackUniversalModuleDefinition(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.Ganache=t():e.Ganache=t()}(self,(function(){return(()=>{var __webpack_modules__=[(e,t,r)=>{"use strict";var a=r(1342),n=r(1343),o="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;t.Buffer=Buffer,t.SlowBuffer=function SlowBuffer(e){+e!=e&&(e=0);return Buffer.alloc(+e)},t.INSPECT_MAX_BYTES=50;var s=2147483647;function createBuffer(e){if(e>s)throw new RangeError('The value "'+e+'" is invalid for option "size"');var t=new Uint8Array(e);return Object.setPrototypeOf(t,Buffer.prototype),t}function Buffer(e,t,r){if("number"==typeof e){if("string"==typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return allocUnsafe(e)}return from(e,t,r)}function from(e,t,r){if("string"==typeof e)return function fromString(e,t){"string"==typeof t&&""!==t||(t="utf8");if(!Buffer.isEncoding(t))throw new TypeError("Unknown encoding: "+t);var r=0|byteLength(e,t),a=createBuffer(r),n=a.write(e,t);n!==r&&(a=a.slice(0,n));return a}(e,t);if(ArrayBuffer.isView(e))return function fromArrayView(e){if(isInstance(e,Uint8Array)){var t=new Uint8Array(e);return fromArrayBuffer(t.buffer,t.byteOffset,t.byteLength)}return fromArrayLike(e)}(e);if(null==e)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(isInstance(e,ArrayBuffer)||e&&isInstance(e.buffer,ArrayBuffer))return fromArrayBuffer(e,t,r);if("undefined"!=typeof SharedArrayBuffer&&(isInstance(e,SharedArrayBuffer)||e&&isInstance(e.buffer,SharedArrayBuffer)))return fromArrayBuffer(e,t,r);if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');var a=e.valueOf&&e.valueOf();if(null!=a&&a!==e)return Buffer.from(a,t,r);var n=function fromObject(e){if(Buffer.isBuffer(e)){var t=0|checked(e.length),r=createBuffer(t);return 0===r.length||e.copy(r,0,0,t),r}if(void 0!==e.length)return"number"!=typeof e.length||numberIsNaN(e.length)?createBuffer(0):fromArrayLike(e);if("Buffer"===e.type&&Array.isArray(e.data))return fromArrayLike(e.data)}(e);if(n)return n;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return Buffer.from(e[Symbol.toPrimitive]("string"),t,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function assertSize(e){if("number"!=typeof e)throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function allocUnsafe(e){return assertSize(e),createBuffer(e<0?0:0|checked(e))}function fromArrayLike(e){for(var t=e.length<0?0:0|checked(e.length),r=createBuffer(t),a=0;a=s)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s.toString(16)+" bytes");return 0|e}function byteLength(e,t){if(Buffer.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||isInstance(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);var r=e.length,a=arguments.length>2&&!0===arguments[2];if(!a&&0===r)return 0;for(var n=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return utf8ToBytes(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return base64ToBytes(e).length;default:if(n)return a?-1:utf8ToBytes(e).length;t=(""+t).toLowerCase(),n=!0}}function slowToString(e,t,r){var a=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return hexSlice(this,t,r);case"utf8":case"utf-8":return utf8Slice(this,t,r);case"ascii":return asciiSlice(this,t,r);case"latin1":case"binary":return latin1Slice(this,t,r);case"base64":return base64Slice(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return utf16leSlice(this,t,r);default:if(a)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),a=!0}}function swap(e,t,r){var a=e[t];e[t]=e[r],e[r]=a}function bidirectionalIndexOf(e,t,r,a,n){if(0===e.length)return-1;if("string"==typeof r?(a=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),numberIsNaN(r=+r)&&(r=n?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(n)return-1;r=e.length-1}else if(r<0){if(!n)return-1;r=0}if("string"==typeof t&&(t=Buffer.from(t,a)),Buffer.isBuffer(t))return 0===t.length?-1:arrayIndexOf(e,t,r,a,n);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?n?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):arrayIndexOf(e,[t],r,a,n);throw new TypeError("val must be string, number or Buffer")}function arrayIndexOf(e,t,r,a,n){var o,s=1,c=e.length,d=t.length;if(void 0!==a&&("ucs2"===(a=String(a).toLowerCase())||"ucs-2"===a||"utf16le"===a||"utf-16le"===a)){if(e.length<2||t.length<2)return-1;s=2,c/=2,d/=2,r/=2}function read(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}if(n){var u=-1;for(o=r;oc&&(r=c-d),o=r;o>=0;o--){for(var h=!0,l=0;ln&&(a=n):a=n;var o=t.length;a>o/2&&(a=o/2);for(var s=0;s>8,n=r%256,o.push(n),o.push(a);return o}(t,e.length-r),e,r,a)}function base64Slice(e,t,r){return 0===t&&r===e.length?a.fromByteArray(e):a.fromByteArray(e.slice(t,r))}function utf8Slice(e,t,r){r=Math.min(e.length,r);for(var a=[],n=t;n239?4:h>223?3:h>191?2:1;if(n+b<=r)switch(b){case 1:h<128&&(l=h);break;case 2:128==(192&(o=e[n+1]))&&(u=(31&h)<<6|63&o)>127&&(l=u);break;case 3:o=e[n+1],s=e[n+2],128==(192&o)&&128==(192&s)&&(u=(15&h)<<12|(63&o)<<6|63&s)>2047&&(u<55296||u>57343)&&(l=u);break;case 4:o=e[n+1],s=e[n+2],d=e[n+3],128==(192&o)&&128==(192&s)&&128==(192&d)&&(u=(15&h)<<18|(63&o)<<12|(63&s)<<6|63&d)>65535&&u<1114112&&(l=u)}null===l?(l=65533,b=1):l>65535&&(l-=65536,a.push(l>>>10&1023|55296),l=56320|1023&l),a.push(l),n+=b}return function decodeCodePointsArray(e){var t=e.length;if(t<=c)return String.fromCharCode.apply(String,e);var r="",a=0;for(;aa.length?Buffer.from(o).copy(a,n):Uint8Array.prototype.set.call(a,o,n);else{if(!Buffer.isBuffer(o))throw new TypeError('"list" argument must be an Array of Buffers');o.copy(a,n)}n+=o.length}return a},Buffer.byteLength=byteLength,Buffer.prototype._isBuffer=!0,Buffer.prototype.swap16=function swap16(){var e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;tr&&(e+=" ... "),""},o&&(Buffer.prototype[o]=Buffer.prototype.inspect),Buffer.prototype.compare=function compare(e,t,r,a,n){if(isInstance(e,Uint8Array)&&(e=Buffer.from(e,e.offset,e.byteLength)),!Buffer.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===a&&(a=0),void 0===n&&(n=this.length),t<0||r>e.length||a<0||n>this.length)throw new RangeError("out of range index");if(a>=n&&t>=r)return 0;if(a>=n)return-1;if(t>=r)return 1;if(this===e)return 0;for(var o=(n>>>=0)-(a>>>=0),s=(r>>>=0)-(t>>>=0),c=Math.min(o,s),d=this.slice(a,n),u=e.slice(t,r),h=0;h>>=0,isFinite(r)?(r>>>=0,void 0===a&&(a="utf8")):(a=r,r=void 0)}var n=this.length-t;if((void 0===r||r>n)&&(r=n),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");a||(a="utf8");for(var o=!1;;)switch(a){case"hex":return hexWrite(this,e,t,r);case"utf8":case"utf-8":return utf8Write(this,e,t,r);case"ascii":case"latin1":case"binary":return asciiWrite(this,e,t,r);case"base64":return base64Write(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ucs2Write(this,e,t,r);default:if(o)throw new TypeError("Unknown encoding: "+a);a=(""+a).toLowerCase(),o=!0}},Buffer.prototype.toJSON=function toJSON(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var c=4096;function asciiSlice(e,t,r){var a="";r=Math.min(e.length,r);for(var n=t;na)&&(r=a);for(var n="",o=t;or)throw new RangeError("Trying to access beyond buffer length")}function checkInt(e,t,r,a,n,o){if(!Buffer.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>n||te.length)throw new RangeError("Index out of range")}function checkIEEE754(e,t,r,a,n,o){if(r+a>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function writeFloat(e,t,r,a,o){return t=+t,r>>>=0,o||checkIEEE754(e,0,r,4),n.write(e,t,r,a,23,4),r+4}function writeDouble(e,t,r,a,o){return t=+t,r>>>=0,o||checkIEEE754(e,0,r,8),n.write(e,t,r,a,52,8),r+8}Buffer.prototype.slice=function slice(e,t){var r=this.length;(e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t>>=0,t>>>=0,r||checkOffset(e,t,this.length);for(var a=this[e],n=1,o=0;++o>>=0,t>>>=0,r||checkOffset(e,t,this.length);for(var a=this[e+--t],n=1;t>0&&(n*=256);)a+=this[e+--t]*n;return a},Buffer.prototype.readUint8=Buffer.prototype.readUInt8=function readUInt8(e,t){return e>>>=0,t||checkOffset(e,1,this.length),this[e]},Buffer.prototype.readUint16LE=Buffer.prototype.readUInt16LE=function readUInt16LE(e,t){return e>>>=0,t||checkOffset(e,2,this.length),this[e]|this[e+1]<<8},Buffer.prototype.readUint16BE=Buffer.prototype.readUInt16BE=function readUInt16BE(e,t){return e>>>=0,t||checkOffset(e,2,this.length),this[e]<<8|this[e+1]},Buffer.prototype.readUint32LE=Buffer.prototype.readUInt32LE=function readUInt32LE(e,t){return e>>>=0,t||checkOffset(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},Buffer.prototype.readUint32BE=Buffer.prototype.readUInt32BE=function readUInt32BE(e,t){return e>>>=0,t||checkOffset(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},Buffer.prototype.readIntLE=function readIntLE(e,t,r){e>>>=0,t>>>=0,r||checkOffset(e,t,this.length);for(var a=this[e],n=1,o=0;++o=(n*=128)&&(a-=Math.pow(2,8*t)),a},Buffer.prototype.readIntBE=function readIntBE(e,t,r){e>>>=0,t>>>=0,r||checkOffset(e,t,this.length);for(var a=t,n=1,o=this[e+--a];a>0&&(n*=256);)o+=this[e+--a]*n;return o>=(n*=128)&&(o-=Math.pow(2,8*t)),o},Buffer.prototype.readInt8=function readInt8(e,t){return e>>>=0,t||checkOffset(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},Buffer.prototype.readInt16LE=function readInt16LE(e,t){e>>>=0,t||checkOffset(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},Buffer.prototype.readInt16BE=function readInt16BE(e,t){e>>>=0,t||checkOffset(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},Buffer.prototype.readInt32LE=function readInt32LE(e,t){return e>>>=0,t||checkOffset(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},Buffer.prototype.readInt32BE=function readInt32BE(e,t){return e>>>=0,t||checkOffset(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},Buffer.prototype.readFloatLE=function readFloatLE(e,t){return e>>>=0,t||checkOffset(e,4,this.length),n.read(this,e,!0,23,4)},Buffer.prototype.readFloatBE=function readFloatBE(e,t){return e>>>=0,t||checkOffset(e,4,this.length),n.read(this,e,!1,23,4)},Buffer.prototype.readDoubleLE=function readDoubleLE(e,t){return e>>>=0,t||checkOffset(e,8,this.length),n.read(this,e,!0,52,8)},Buffer.prototype.readDoubleBE=function readDoubleBE(e,t){return e>>>=0,t||checkOffset(e,8,this.length),n.read(this,e,!1,52,8)},Buffer.prototype.writeUintLE=Buffer.prototype.writeUIntLE=function writeUIntLE(e,t,r,a){(e=+e,t>>>=0,r>>>=0,a)||checkInt(this,e,t,r,Math.pow(2,8*r)-1,0);var n=1,o=0;for(this[t]=255&e;++o>>=0,r>>>=0,a)||checkInt(this,e,t,r,Math.pow(2,8*r)-1,0);var n=r-1,o=1;for(this[t+n]=255&e;--n>=0&&(o*=256);)this[t+n]=e/o&255;return t+r},Buffer.prototype.writeUint8=Buffer.prototype.writeUInt8=function writeUInt8(e,t,r){return e=+e,t>>>=0,r||checkInt(this,e,t,1,255,0),this[t]=255&e,t+1},Buffer.prototype.writeUint16LE=Buffer.prototype.writeUInt16LE=function writeUInt16LE(e,t,r){return e=+e,t>>>=0,r||checkInt(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},Buffer.prototype.writeUint16BE=Buffer.prototype.writeUInt16BE=function writeUInt16BE(e,t,r){return e=+e,t>>>=0,r||checkInt(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},Buffer.prototype.writeUint32LE=Buffer.prototype.writeUInt32LE=function writeUInt32LE(e,t,r){return e=+e,t>>>=0,r||checkInt(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},Buffer.prototype.writeUint32BE=Buffer.prototype.writeUInt32BE=function writeUInt32BE(e,t,r){return e=+e,t>>>=0,r||checkInt(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},Buffer.prototype.writeIntLE=function writeIntLE(e,t,r,a){if(e=+e,t>>>=0,!a){var n=Math.pow(2,8*r-1);checkInt(this,e,t,r,n-1,-n)}var o=0,s=1,c=0;for(this[t]=255&e;++o>0)-c&255;return t+r},Buffer.prototype.writeIntBE=function writeIntBE(e,t,r,a){if(e=+e,t>>>=0,!a){var n=Math.pow(2,8*r-1);checkInt(this,e,t,r,n-1,-n)}var o=r-1,s=1,c=0;for(this[t+o]=255&e;--o>=0&&(s*=256);)e<0&&0===c&&0!==this[t+o+1]&&(c=1),this[t+o]=(e/s>>0)-c&255;return t+r},Buffer.prototype.writeInt8=function writeInt8(e,t,r){return e=+e,t>>>=0,r||checkInt(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},Buffer.prototype.writeInt16LE=function writeInt16LE(e,t,r){return e=+e,t>>>=0,r||checkInt(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},Buffer.prototype.writeInt16BE=function writeInt16BE(e,t,r){return e=+e,t>>>=0,r||checkInt(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},Buffer.prototype.writeInt32LE=function writeInt32LE(e,t,r){return e=+e,t>>>=0,r||checkInt(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},Buffer.prototype.writeInt32BE=function writeInt32BE(e,t,r){return e=+e,t>>>=0,r||checkInt(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},Buffer.prototype.writeFloatLE=function writeFloatLE(e,t,r){return writeFloat(this,e,t,!0,r)},Buffer.prototype.writeFloatBE=function writeFloatBE(e,t,r){return writeFloat(this,e,t,!1,r)},Buffer.prototype.writeDoubleLE=function writeDoubleLE(e,t,r){return writeDouble(this,e,t,!0,r)},Buffer.prototype.writeDoubleBE=function writeDoubleBE(e,t,r){return writeDouble(this,e,t,!1,r)},Buffer.prototype.copy=function copy(e,t,r,a){if(!Buffer.isBuffer(e))throw new TypeError("argument should be a Buffer");if(r||(r=0),a||0===a||(a=this.length),t>=e.length&&(t=e.length),t||(t=0),a>0&&a=this.length)throw new RangeError("Index out of range");if(a<0)throw new RangeError("sourceEnd out of bounds");a>this.length&&(a=this.length),e.length-t>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(o=t;o55295&&r<57344){if(!n){if(r>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(s+1===a){(t-=3)>-1&&o.push(239,191,189);continue}n=r;continue}if(r<56320){(t-=3)>-1&&o.push(239,191,189),n=r;continue}r=65536+(n-55296<<10|r-56320)}else n&&(t-=3)>-1&&o.push(239,191,189);if(n=null,r<128){if((t-=1)<0)break;o.push(r)}else if(r<2048){if((t-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=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((t-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function base64ToBytes(e){return a.toByteArray(function base64clean(e){if((e=(e=e.split("=")[0]).trim().replace(d,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function blitBuffer(e,t,r,a){for(var n=0;n=t.length||n>=e.length);++n)t[n+r]=e[n];return n}function isInstance(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function numberIsNaN(e){return e!=e}var u=function(){for(var e="0123456789abcdef",t=new Array(256),r=0;r<16;++r)for(var a=16*r,n=0;n<16;++n)t[a+n]=e[r]+e[n];return t}()},e=>{var t,r,a=e.exports={};function defaultSetTimout(){throw new Error("setTimeout has not been defined")}function defaultClearTimeout(){throw new Error("clearTimeout has not been defined")}function runTimeout(e){if(t===setTimeout)return setTimeout(e,0);if((t===defaultSetTimout||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(r){try{return t.call(null,e,0)}catch(r){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:defaultSetTimout}catch(e){t=defaultSetTimout}try{r="function"==typeof clearTimeout?clearTimeout:defaultClearTimeout}catch(e){r=defaultClearTimeout}}();var n,o=[],s=!1,c=-1;function cleanUpNextTick(){s&&n&&(s=!1,n.length?o=n.concat(o):c=-1,o.length&&drainQueue())}function drainQueue(){if(!s){var e=runTimeout(cleanUpNextTick);s=!0;for(var t=o.length;t;){for(n=o,o=[];++c1)for(var r=1;r{"use strict";const a=r(422),n=r(423),o="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;t.Buffer=Buffer,t.SlowBuffer=function SlowBuffer(e){+e!=e&&(e=0);return Buffer.alloc(+e)},t.INSPECT_MAX_BYTES=50;const s=2147483647;function createBuffer(e){if(e>s)throw new RangeError('The value "'+e+'" is invalid for option "size"');const t=new Uint8Array(e);return Object.setPrototypeOf(t,Buffer.prototype),t}function Buffer(e,t,r){if("number"==typeof e){if("string"==typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return allocUnsafe(e)}return from(e,t,r)}function from(e,t,r){if("string"==typeof e)return function fromString(e,t){"string"==typeof t&&""!==t||(t="utf8");if(!Buffer.isEncoding(t))throw new TypeError("Unknown encoding: "+t);const r=0|byteLength(e,t);let a=createBuffer(r);const n=a.write(e,t);n!==r&&(a=a.slice(0,n));return a}(e,t);if(ArrayBuffer.isView(e))return function fromArrayView(e){if(isInstance(e,Uint8Array)){const t=new Uint8Array(e);return fromArrayBuffer(t.buffer,t.byteOffset,t.byteLength)}return fromArrayLike(e)}(e);if(null==e)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(isInstance(e,ArrayBuffer)||e&&isInstance(e.buffer,ArrayBuffer))return fromArrayBuffer(e,t,r);if("undefined"!=typeof SharedArrayBuffer&&(isInstance(e,SharedArrayBuffer)||e&&isInstance(e.buffer,SharedArrayBuffer)))return fromArrayBuffer(e,t,r);if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');const a=e.valueOf&&e.valueOf();if(null!=a&&a!==e)return Buffer.from(a,t,r);const n=function fromObject(e){if(Buffer.isBuffer(e)){const t=0|checked(e.length),r=createBuffer(t);return 0===r.length||e.copy(r,0,0,t),r}if(void 0!==e.length)return"number"!=typeof e.length||numberIsNaN(e.length)?createBuffer(0):fromArrayLike(e);if("Buffer"===e.type&&Array.isArray(e.data))return fromArrayLike(e.data)}(e);if(n)return n;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return Buffer.from(e[Symbol.toPrimitive]("string"),t,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function assertSize(e){if("number"!=typeof e)throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function allocUnsafe(e){return assertSize(e),createBuffer(e<0?0:0|checked(e))}function fromArrayLike(e){const t=e.length<0?0:0|checked(e.length),r=createBuffer(t);for(let a=0;a=s)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s.toString(16)+" bytes");return 0|e}function byteLength(e,t){if(Buffer.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||isInstance(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);const r=e.length,a=arguments.length>2&&!0===arguments[2];if(!a&&0===r)return 0;let n=!1;for(;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return utf8ToBytes(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return base64ToBytes(e).length;default:if(n)return a?-1:utf8ToBytes(e).length;t=(""+t).toLowerCase(),n=!0}}function slowToString(e,t,r){let a=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return hexSlice(this,t,r);case"utf8":case"utf-8":return utf8Slice(this,t,r);case"ascii":return asciiSlice(this,t,r);case"latin1":case"binary":return latin1Slice(this,t,r);case"base64":return base64Slice(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return utf16leSlice(this,t,r);default:if(a)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),a=!0}}function swap(e,t,r){const a=e[t];e[t]=e[r],e[r]=a}function bidirectionalIndexOf(e,t,r,a,n){if(0===e.length)return-1;if("string"==typeof r?(a=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),numberIsNaN(r=+r)&&(r=n?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(n)return-1;r=e.length-1}else if(r<0){if(!n)return-1;r=0}if("string"==typeof t&&(t=Buffer.from(t,a)),Buffer.isBuffer(t))return 0===t.length?-1:arrayIndexOf(e,t,r,a,n);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?n?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):arrayIndexOf(e,[t],r,a,n);throw new TypeError("val must be string, number or Buffer")}function arrayIndexOf(e,t,r,a,n){let o,s=1,c=e.length,d=t.length;if(void 0!==a&&("ucs2"===(a=String(a).toLowerCase())||"ucs-2"===a||"utf16le"===a||"utf-16le"===a)){if(e.length<2||t.length<2)return-1;s=2,c/=2,d/=2,r/=2}function read(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}if(n){let a=-1;for(o=r;oc&&(r=c-d),o=r;o>=0;o--){let r=!0;for(let a=0;an&&(a=n):a=n;const o=t.length;let s;for(a>o/2&&(a=o/2),s=0;s>8,n=r%256,o.push(n),o.push(a);return o}(t,e.length-r),e,r,a)}function base64Slice(e,t,r){return 0===t&&r===e.length?a.fromByteArray(e):a.fromByteArray(e.slice(t,r))}function utf8Slice(e,t,r){r=Math.min(e.length,r);const a=[];let n=t;for(;n239?4:t>223?3:t>191?2:1;if(n+s<=r){let r,a,c,d;switch(s){case 1:t<128&&(o=t);break;case 2:r=e[n+1],128==(192&r)&&(d=(31&t)<<6|63&r,d>127&&(o=d));break;case 3:r=e[n+1],a=e[n+2],128==(192&r)&&128==(192&a)&&(d=(15&t)<<12|(63&r)<<6|63&a,d>2047&&(d<55296||d>57343)&&(o=d));break;case 4:r=e[n+1],a=e[n+2],c=e[n+3],128==(192&r)&&128==(192&a)&&128==(192&c)&&(d=(15&t)<<18|(63&r)<<12|(63&a)<<6|63&c,d>65535&&d<1114112&&(o=d))}}null===o?(o=65533,s=1):o>65535&&(o-=65536,a.push(o>>>10&1023|55296),o=56320|1023&o),a.push(o),n+=s}return function decodeCodePointsArray(e){const t=e.length;if(t<=c)return String.fromCharCode.apply(String,e);let r="",a=0;for(;aa.length?(Buffer.isBuffer(t)||(t=Buffer.from(t)),t.copy(a,n)):Uint8Array.prototype.set.call(a,t,n);else{if(!Buffer.isBuffer(t))throw new TypeError('"list" argument must be an Array of Buffers');t.copy(a,n)}n+=t.length}return a},Buffer.byteLength=byteLength,Buffer.prototype._isBuffer=!0,Buffer.prototype.swap16=function swap16(){const e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let t=0;tr&&(e+=" ... "),""},o&&(Buffer.prototype[o]=Buffer.prototype.inspect),Buffer.prototype.compare=function compare(e,t,r,a,n){if(isInstance(e,Uint8Array)&&(e=Buffer.from(e,e.offset,e.byteLength)),!Buffer.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===a&&(a=0),void 0===n&&(n=this.length),t<0||r>e.length||a<0||n>this.length)throw new RangeError("out of range index");if(a>=n&&t>=r)return 0;if(a>=n)return-1;if(t>=r)return 1;if(this===e)return 0;let o=(n>>>=0)-(a>>>=0),s=(r>>>=0)-(t>>>=0);const c=Math.min(o,s),d=this.slice(a,n),u=e.slice(t,r);for(let e=0;e>>=0,isFinite(r)?(r>>>=0,void 0===a&&(a="utf8")):(a=r,r=void 0)}const n=this.length-t;if((void 0===r||r>n)&&(r=n),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");a||(a="utf8");let o=!1;for(;;)switch(a){case"hex":return hexWrite(this,e,t,r);case"utf8":case"utf-8":return utf8Write(this,e,t,r);case"ascii":case"latin1":case"binary":return asciiWrite(this,e,t,r);case"base64":return base64Write(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ucs2Write(this,e,t,r);default:if(o)throw new TypeError("Unknown encoding: "+a);a=(""+a).toLowerCase(),o=!0}},Buffer.prototype.toJSON=function toJSON(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const c=4096;function asciiSlice(e,t,r){let a="";r=Math.min(e.length,r);for(let n=t;na)&&(r=a);let n="";for(let a=t;ar)throw new RangeError("Trying to access beyond buffer length")}function checkInt(e,t,r,a,n,o){if(!Buffer.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>n||te.length)throw new RangeError("Index out of range")}function wrtBigUInt64LE(e,t,r,a,n){checkIntBI(t,a,n,e,r,7);let o=Number(t&BigInt(4294967295));e[r++]=o,o>>=8,e[r++]=o,o>>=8,e[r++]=o,o>>=8,e[r++]=o;let s=Number(t>>BigInt(32)&BigInt(4294967295));return e[r++]=s,s>>=8,e[r++]=s,s>>=8,e[r++]=s,s>>=8,e[r++]=s,r}function wrtBigUInt64BE(e,t,r,a,n){checkIntBI(t,a,n,e,r,7);let o=Number(t&BigInt(4294967295));e[r+7]=o,o>>=8,e[r+6]=o,o>>=8,e[r+5]=o,o>>=8,e[r+4]=o;let s=Number(t>>BigInt(32)&BigInt(4294967295));return e[r+3]=s,s>>=8,e[r+2]=s,s>>=8,e[r+1]=s,s>>=8,e[r]=s,r+8}function checkIEEE754(e,t,r,a,n,o){if(r+a>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function writeFloat(e,t,r,a,o){return t=+t,r>>>=0,o||checkIEEE754(e,0,r,4),n.write(e,t,r,a,23,4),r+4}function writeDouble(e,t,r,a,o){return t=+t,r>>>=0,o||checkIEEE754(e,0,r,8),n.write(e,t,r,a,52,8),r+8}Buffer.prototype.slice=function slice(e,t){const r=this.length;(e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t>>=0,t>>>=0,r||checkOffset(e,t,this.length);let a=this[e],n=1,o=0;for(;++o>>=0,t>>>=0,r||checkOffset(e,t,this.length);let a=this[e+--t],n=1;for(;t>0&&(n*=256);)a+=this[e+--t]*n;return a},Buffer.prototype.readUint8=Buffer.prototype.readUInt8=function readUInt8(e,t){return e>>>=0,t||checkOffset(e,1,this.length),this[e]},Buffer.prototype.readUint16LE=Buffer.prototype.readUInt16LE=function readUInt16LE(e,t){return e>>>=0,t||checkOffset(e,2,this.length),this[e]|this[e+1]<<8},Buffer.prototype.readUint16BE=Buffer.prototype.readUInt16BE=function readUInt16BE(e,t){return e>>>=0,t||checkOffset(e,2,this.length),this[e]<<8|this[e+1]},Buffer.prototype.readUint32LE=Buffer.prototype.readUInt32LE=function readUInt32LE(e,t){return e>>>=0,t||checkOffset(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},Buffer.prototype.readUint32BE=Buffer.prototype.readUInt32BE=function readUInt32BE(e,t){return e>>>=0,t||checkOffset(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},Buffer.prototype.readBigUInt64LE=defineBigIntMethod((function readBigUInt64LE(e){validateNumber(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||boundsError(e,this.length-8);const a=t+256*this[++e]+65536*this[++e]+this[++e]*2**24,n=this[++e]+256*this[++e]+65536*this[++e]+r*2**24;return BigInt(a)+(BigInt(n)<>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||boundsError(e,this.length-8);const a=t*2**24+65536*this[++e]+256*this[++e]+this[++e],n=this[++e]*2**24+65536*this[++e]+256*this[++e]+r;return(BigInt(a)<>>=0,t>>>=0,r||checkOffset(e,t,this.length);let a=this[e],n=1,o=0;for(;++o=n&&(a-=Math.pow(2,8*t)),a},Buffer.prototype.readIntBE=function readIntBE(e,t,r){e>>>=0,t>>>=0,r||checkOffset(e,t,this.length);let a=t,n=1,o=this[e+--a];for(;a>0&&(n*=256);)o+=this[e+--a]*n;return n*=128,o>=n&&(o-=Math.pow(2,8*t)),o},Buffer.prototype.readInt8=function readInt8(e,t){return e>>>=0,t||checkOffset(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},Buffer.prototype.readInt16LE=function readInt16LE(e,t){e>>>=0,t||checkOffset(e,2,this.length);const r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},Buffer.prototype.readInt16BE=function readInt16BE(e,t){e>>>=0,t||checkOffset(e,2,this.length);const r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},Buffer.prototype.readInt32LE=function readInt32LE(e,t){return e>>>=0,t||checkOffset(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},Buffer.prototype.readInt32BE=function readInt32BE(e,t){return e>>>=0,t||checkOffset(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},Buffer.prototype.readBigInt64LE=defineBigIntMethod((function readBigInt64LE(e){validateNumber(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||boundsError(e,this.length-8);const a=this[e+4]+256*this[e+5]+65536*this[e+6]+(r<<24);return(BigInt(a)<>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||boundsError(e,this.length-8);const a=(t<<24)+65536*this[++e]+256*this[++e]+this[++e];return(BigInt(a)<>>=0,t||checkOffset(e,4,this.length),n.read(this,e,!0,23,4)},Buffer.prototype.readFloatBE=function readFloatBE(e,t){return e>>>=0,t||checkOffset(e,4,this.length),n.read(this,e,!1,23,4)},Buffer.prototype.readDoubleLE=function readDoubleLE(e,t){return e>>>=0,t||checkOffset(e,8,this.length),n.read(this,e,!0,52,8)},Buffer.prototype.readDoubleBE=function readDoubleBE(e,t){return e>>>=0,t||checkOffset(e,8,this.length),n.read(this,e,!1,52,8)},Buffer.prototype.writeUintLE=Buffer.prototype.writeUIntLE=function writeUIntLE(e,t,r,a){if(e=+e,t>>>=0,r>>>=0,!a){checkInt(this,e,t,r,Math.pow(2,8*r)-1,0)}let n=1,o=0;for(this[t]=255&e;++o>>=0,r>>>=0,!a){checkInt(this,e,t,r,Math.pow(2,8*r)-1,0)}let n=r-1,o=1;for(this[t+n]=255&e;--n>=0&&(o*=256);)this[t+n]=e/o&255;return t+r},Buffer.prototype.writeUint8=Buffer.prototype.writeUInt8=function writeUInt8(e,t,r){return e=+e,t>>>=0,r||checkInt(this,e,t,1,255,0),this[t]=255&e,t+1},Buffer.prototype.writeUint16LE=Buffer.prototype.writeUInt16LE=function writeUInt16LE(e,t,r){return e=+e,t>>>=0,r||checkInt(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},Buffer.prototype.writeUint16BE=Buffer.prototype.writeUInt16BE=function writeUInt16BE(e,t,r){return e=+e,t>>>=0,r||checkInt(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},Buffer.prototype.writeUint32LE=Buffer.prototype.writeUInt32LE=function writeUInt32LE(e,t,r){return e=+e,t>>>=0,r||checkInt(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},Buffer.prototype.writeUint32BE=Buffer.prototype.writeUInt32BE=function writeUInt32BE(e,t,r){return e=+e,t>>>=0,r||checkInt(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},Buffer.prototype.writeBigUInt64LE=defineBigIntMethod((function writeBigUInt64LE(e,t=0){return wrtBigUInt64LE(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),Buffer.prototype.writeBigUInt64BE=defineBigIntMethod((function writeBigUInt64BE(e,t=0){return wrtBigUInt64BE(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),Buffer.prototype.writeIntLE=function writeIntLE(e,t,r,a){if(e=+e,t>>>=0,!a){const a=Math.pow(2,8*r-1);checkInt(this,e,t,r,a-1,-a)}let n=0,o=1,s=0;for(this[t]=255&e;++n>0)-s&255;return t+r},Buffer.prototype.writeIntBE=function writeIntBE(e,t,r,a){if(e=+e,t>>>=0,!a){const a=Math.pow(2,8*r-1);checkInt(this,e,t,r,a-1,-a)}let n=r-1,o=1,s=0;for(this[t+n]=255&e;--n>=0&&(o*=256);)e<0&&0===s&&0!==this[t+n+1]&&(s=1),this[t+n]=(e/o>>0)-s&255;return t+r},Buffer.prototype.writeInt8=function writeInt8(e,t,r){return e=+e,t>>>=0,r||checkInt(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},Buffer.prototype.writeInt16LE=function writeInt16LE(e,t,r){return e=+e,t>>>=0,r||checkInt(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},Buffer.prototype.writeInt16BE=function writeInt16BE(e,t,r){return e=+e,t>>>=0,r||checkInt(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},Buffer.prototype.writeInt32LE=function writeInt32LE(e,t,r){return e=+e,t>>>=0,r||checkInt(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},Buffer.prototype.writeInt32BE=function writeInt32BE(e,t,r){return e=+e,t>>>=0,r||checkInt(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},Buffer.prototype.writeBigInt64LE=defineBigIntMethod((function writeBigInt64LE(e,t=0){return wrtBigUInt64LE(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),Buffer.prototype.writeBigInt64BE=defineBigIntMethod((function writeBigInt64BE(e,t=0){return wrtBigUInt64BE(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),Buffer.prototype.writeFloatLE=function writeFloatLE(e,t,r){return writeFloat(this,e,t,!0,r)},Buffer.prototype.writeFloatBE=function writeFloatBE(e,t,r){return writeFloat(this,e,t,!1,r)},Buffer.prototype.writeDoubleLE=function writeDoubleLE(e,t,r){return writeDouble(this,e,t,!0,r)},Buffer.prototype.writeDoubleBE=function writeDoubleBE(e,t,r){return writeDouble(this,e,t,!1,r)},Buffer.prototype.copy=function copy(e,t,r,a){if(!Buffer.isBuffer(e))throw new TypeError("argument should be a Buffer");if(r||(r=0),a||0===a||(a=this.length),t>=e.length&&(t=e.length),t||(t=0),a>0&&a=this.length)throw new RangeError("Index out of range");if(a<0)throw new RangeError("sourceEnd out of bounds");a>this.length&&(a=this.length),e.length-t>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(n=t;n=a+4;r-=3)t=`_${e.slice(r-3,r)}${t}`;return`${e.slice(0,r)}${t}`}function checkIntBI(e,t,r,a,n,o){if(e>r||e3?0===t||t===BigInt(0)?`>= 0${a} and < 2${a} ** ${8*(o+1)}${a}`:`>= -(2${a} ** ${8*(o+1)-1}${a}) and < 2 ** ${8*(o+1)-1}${a}`:`>= ${t}${a} and <= ${r}${a}`,new d.ERR_OUT_OF_RANGE("value",n,e)}!function checkBounds(e,t,r){validateNumber(t,"offset"),void 0!==e[t]&&void 0!==e[t+r]||boundsError(t,e.length-(r+1))}(a,n,o)}function validateNumber(e,t){if("number"!=typeof e)throw new d.ERR_INVALID_ARG_TYPE(t,"number",e)}function boundsError(e,t,r){if(Math.floor(e)!==e)throw validateNumber(e,r),new d.ERR_OUT_OF_RANGE(r||"offset","an integer",e);if(t<0)throw new d.ERR_BUFFER_OUT_OF_BOUNDS;throw new d.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${t}`,e)}E("ERR_BUFFER_OUT_OF_BOUNDS",(function(e){return e?`${e} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"}),RangeError),E("ERR_INVALID_ARG_TYPE",(function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`}),TypeError),E("ERR_OUT_OF_RANGE",(function(e,t,r){let a=`The value of "${e}" is out of range.`,n=r;return Number.isInteger(r)&&Math.abs(r)>2**32?n=addNumericalSeparator(String(r)):"bigint"==typeof r&&(n=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(n=addNumericalSeparator(n)),n+="n"),a+=` It must be ${t}. Received ${n}`,a}),RangeError);const u=/[^+/0-9A-Za-z-_]/g;function utf8ToBytes(e,t){let r;t=t||1/0;const a=e.length;let n=null;const o=[];for(let s=0;s55295&&r<57344){if(!n){if(r>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(s+1===a){(t-=3)>-1&&o.push(239,191,189);continue}n=r;continue}if(r<56320){(t-=3)>-1&&o.push(239,191,189),n=r;continue}r=65536+(n-55296<<10|r-56320)}else n&&(t-=3)>-1&&o.push(239,191,189);if(n=null,r<128){if((t-=1)<0)break;o.push(r)}else if(r<2048){if((t-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=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((t-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function base64ToBytes(e){return a.toByteArray(function base64clean(e){if((e=(e=e.split("=")[0]).trim().replace(u,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function blitBuffer(e,t,r,a){let n;for(n=0;n=t.length||n>=e.length);++n)t[n+r]=e[n];return n}function isInstance(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function numberIsNaN(e){return e!=e}const h=function(){const e="0123456789abcdef",t=new Array(256);for(let r=0;r<16;++r){const a=16*r;for(let n=0;n<16;++n)t[a+n]=e[r]+e[n]}return t}();function defineBigIntMethod(e){return"undefined"==typeof BigInt?BufferBigIntNotDefined:e}function BufferBigIntNotDefined(){throw new Error("BigInt not supported")}},(e,t,r)=>{"use strict";var a=r(1263),n=r(1264),o="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;t.Buffer=Buffer,t.SlowBuffer=function SlowBuffer(e){+e!=e&&(e=0);return Buffer.alloc(+e)},t.INSPECT_MAX_BYTES=50;var s=2147483647;function createBuffer(e){if(e>s)throw new RangeError('The value "'+e+'" is invalid for option "size"');var t=new Uint8Array(e);return Object.setPrototypeOf(t,Buffer.prototype),t}function Buffer(e,t,r){if("number"==typeof e){if("string"==typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return allocUnsafe(e)}return from(e,t,r)}function from(e,t,r){if("string"==typeof e)return function fromString(e,t){"string"==typeof t&&""!==t||(t="utf8");if(!Buffer.isEncoding(t))throw new TypeError("Unknown encoding: "+t);var r=0|byteLength(e,t),a=createBuffer(r),n=a.write(e,t);n!==r&&(a=a.slice(0,n));return a}(e,t);if(ArrayBuffer.isView(e))return function fromArrayView(e){if(isInstance(e,Uint8Array)){var t=new Uint8Array(e);return fromArrayBuffer(t.buffer,t.byteOffset,t.byteLength)}return fromArrayLike(e)}(e);if(null==e)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(isInstance(e,ArrayBuffer)||e&&isInstance(e.buffer,ArrayBuffer))return fromArrayBuffer(e,t,r);if("undefined"!=typeof SharedArrayBuffer&&(isInstance(e,SharedArrayBuffer)||e&&isInstance(e.buffer,SharedArrayBuffer)))return fromArrayBuffer(e,t,r);if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');var a=e.valueOf&&e.valueOf();if(null!=a&&a!==e)return Buffer.from(a,t,r);var n=function fromObject(e){if(Buffer.isBuffer(e)){var t=0|checked(e.length),r=createBuffer(t);return 0===r.length||e.copy(r,0,0,t),r}if(void 0!==e.length)return"number"!=typeof e.length||numberIsNaN(e.length)?createBuffer(0):fromArrayLike(e);if("Buffer"===e.type&&Array.isArray(e.data))return fromArrayLike(e.data)}(e);if(n)return n;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return Buffer.from(e[Symbol.toPrimitive]("string"),t,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function assertSize(e){if("number"!=typeof e)throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function allocUnsafe(e){return assertSize(e),createBuffer(e<0?0:0|checked(e))}function fromArrayLike(e){for(var t=e.length<0?0:0|checked(e.length),r=createBuffer(t),a=0;a=s)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s.toString(16)+" bytes");return 0|e}function byteLength(e,t){if(Buffer.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||isInstance(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);var r=e.length,a=arguments.length>2&&!0===arguments[2];if(!a&&0===r)return 0;for(var n=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return utf8ToBytes(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return base64ToBytes(e).length;default:if(n)return a?-1:utf8ToBytes(e).length;t=(""+t).toLowerCase(),n=!0}}function slowToString(e,t,r){var a=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return hexSlice(this,t,r);case"utf8":case"utf-8":return utf8Slice(this,t,r);case"ascii":return asciiSlice(this,t,r);case"latin1":case"binary":return latin1Slice(this,t,r);case"base64":return base64Slice(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return utf16leSlice(this,t,r);default:if(a)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),a=!0}}function swap(e,t,r){var a=e[t];e[t]=e[r],e[r]=a}function bidirectionalIndexOf(e,t,r,a,n){if(0===e.length)return-1;if("string"==typeof r?(a=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),numberIsNaN(r=+r)&&(r=n?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(n)return-1;r=e.length-1}else if(r<0){if(!n)return-1;r=0}if("string"==typeof t&&(t=Buffer.from(t,a)),Buffer.isBuffer(t))return 0===t.length?-1:arrayIndexOf(e,t,r,a,n);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?n?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):arrayIndexOf(e,[t],r,a,n);throw new TypeError("val must be string, number or Buffer")}function arrayIndexOf(e,t,r,a,n){var o,s=1,c=e.length,d=t.length;if(void 0!==a&&("ucs2"===(a=String(a).toLowerCase())||"ucs-2"===a||"utf16le"===a||"utf-16le"===a)){if(e.length<2||t.length<2)return-1;s=2,c/=2,d/=2,r/=2}function read(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}if(n){var u=-1;for(o=r;oc&&(r=c-d),o=r;o>=0;o--){for(var h=!0,l=0;ln&&(a=n):a=n;var o=t.length;a>o/2&&(a=o/2);for(var s=0;s>8,n=r%256,o.push(n),o.push(a);return o}(t,e.length-r),e,r,a)}function base64Slice(e,t,r){return 0===t&&r===e.length?a.fromByteArray(e):a.fromByteArray(e.slice(t,r))}function utf8Slice(e,t,r){r=Math.min(e.length,r);for(var a=[],n=t;n239?4:h>223?3:h>191?2:1;if(n+b<=r)switch(b){case 1:h<128&&(l=h);break;case 2:128==(192&(o=e[n+1]))&&(u=(31&h)<<6|63&o)>127&&(l=u);break;case 3:o=e[n+1],s=e[n+2],128==(192&o)&&128==(192&s)&&(u=(15&h)<<12|(63&o)<<6|63&s)>2047&&(u<55296||u>57343)&&(l=u);break;case 4:o=e[n+1],s=e[n+2],d=e[n+3],128==(192&o)&&128==(192&s)&&128==(192&d)&&(u=(15&h)<<18|(63&o)<<12|(63&s)<<6|63&d)>65535&&u<1114112&&(l=u)}null===l?(l=65533,b=1):l>65535&&(l-=65536,a.push(l>>>10&1023|55296),l=56320|1023&l),a.push(l),n+=b}return function decodeCodePointsArray(e){var t=e.length;if(t<=c)return String.fromCharCode.apply(String,e);var r="",a=0;for(;aa.length?Buffer.from(o).copy(a,n):Uint8Array.prototype.set.call(a,o,n);else{if(!Buffer.isBuffer(o))throw new TypeError('"list" argument must be an Array of Buffers');o.copy(a,n)}n+=o.length}return a},Buffer.byteLength=byteLength,Buffer.prototype._isBuffer=!0,Buffer.prototype.swap16=function swap16(){var e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;tr&&(e+=" ... "),""},o&&(Buffer.prototype[o]=Buffer.prototype.inspect),Buffer.prototype.compare=function compare(e,t,r,a,n){if(isInstance(e,Uint8Array)&&(e=Buffer.from(e,e.offset,e.byteLength)),!Buffer.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===a&&(a=0),void 0===n&&(n=this.length),t<0||r>e.length||a<0||n>this.length)throw new RangeError("out of range index");if(a>=n&&t>=r)return 0;if(a>=n)return-1;if(t>=r)return 1;if(this===e)return 0;for(var o=(n>>>=0)-(a>>>=0),s=(r>>>=0)-(t>>>=0),c=Math.min(o,s),d=this.slice(a,n),u=e.slice(t,r),h=0;h>>=0,isFinite(r)?(r>>>=0,void 0===a&&(a="utf8")):(a=r,r=void 0)}var n=this.length-t;if((void 0===r||r>n)&&(r=n),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");a||(a="utf8");for(var o=!1;;)switch(a){case"hex":return hexWrite(this,e,t,r);case"utf8":case"utf-8":return utf8Write(this,e,t,r);case"ascii":case"latin1":case"binary":return asciiWrite(this,e,t,r);case"base64":return base64Write(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ucs2Write(this,e,t,r);default:if(o)throw new TypeError("Unknown encoding: "+a);a=(""+a).toLowerCase(),o=!0}},Buffer.prototype.toJSON=function toJSON(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var c=4096;function asciiSlice(e,t,r){var a="";r=Math.min(e.length,r);for(var n=t;na)&&(r=a);for(var n="",o=t;or)throw new RangeError("Trying to access beyond buffer length")}function checkInt(e,t,r,a,n,o){if(!Buffer.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>n||te.length)throw new RangeError("Index out of range")}function checkIEEE754(e,t,r,a,n,o){if(r+a>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function writeFloat(e,t,r,a,o){return t=+t,r>>>=0,o||checkIEEE754(e,0,r,4),n.write(e,t,r,a,23,4),r+4}function writeDouble(e,t,r,a,o){return t=+t,r>>>=0,o||checkIEEE754(e,0,r,8),n.write(e,t,r,a,52,8),r+8}Buffer.prototype.slice=function slice(e,t){var r=this.length;(e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t>>=0,t>>>=0,r||checkOffset(e,t,this.length);for(var a=this[e],n=1,o=0;++o>>=0,t>>>=0,r||checkOffset(e,t,this.length);for(var a=this[e+--t],n=1;t>0&&(n*=256);)a+=this[e+--t]*n;return a},Buffer.prototype.readUint8=Buffer.prototype.readUInt8=function readUInt8(e,t){return e>>>=0,t||checkOffset(e,1,this.length),this[e]},Buffer.prototype.readUint16LE=Buffer.prototype.readUInt16LE=function readUInt16LE(e,t){return e>>>=0,t||checkOffset(e,2,this.length),this[e]|this[e+1]<<8},Buffer.prototype.readUint16BE=Buffer.prototype.readUInt16BE=function readUInt16BE(e,t){return e>>>=0,t||checkOffset(e,2,this.length),this[e]<<8|this[e+1]},Buffer.prototype.readUint32LE=Buffer.prototype.readUInt32LE=function readUInt32LE(e,t){return e>>>=0,t||checkOffset(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},Buffer.prototype.readUint32BE=Buffer.prototype.readUInt32BE=function readUInt32BE(e,t){return e>>>=0,t||checkOffset(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},Buffer.prototype.readIntLE=function readIntLE(e,t,r){e>>>=0,t>>>=0,r||checkOffset(e,t,this.length);for(var a=this[e],n=1,o=0;++o=(n*=128)&&(a-=Math.pow(2,8*t)),a},Buffer.prototype.readIntBE=function readIntBE(e,t,r){e>>>=0,t>>>=0,r||checkOffset(e,t,this.length);for(var a=t,n=1,o=this[e+--a];a>0&&(n*=256);)o+=this[e+--a]*n;return o>=(n*=128)&&(o-=Math.pow(2,8*t)),o},Buffer.prototype.readInt8=function readInt8(e,t){return e>>>=0,t||checkOffset(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},Buffer.prototype.readInt16LE=function readInt16LE(e,t){e>>>=0,t||checkOffset(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},Buffer.prototype.readInt16BE=function readInt16BE(e,t){e>>>=0,t||checkOffset(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},Buffer.prototype.readInt32LE=function readInt32LE(e,t){return e>>>=0,t||checkOffset(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},Buffer.prototype.readInt32BE=function readInt32BE(e,t){return e>>>=0,t||checkOffset(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},Buffer.prototype.readFloatLE=function readFloatLE(e,t){return e>>>=0,t||checkOffset(e,4,this.length),n.read(this,e,!0,23,4)},Buffer.prototype.readFloatBE=function readFloatBE(e,t){return e>>>=0,t||checkOffset(e,4,this.length),n.read(this,e,!1,23,4)},Buffer.prototype.readDoubleLE=function readDoubleLE(e,t){return e>>>=0,t||checkOffset(e,8,this.length),n.read(this,e,!0,52,8)},Buffer.prototype.readDoubleBE=function readDoubleBE(e,t){return e>>>=0,t||checkOffset(e,8,this.length),n.read(this,e,!1,52,8)},Buffer.prototype.writeUintLE=Buffer.prototype.writeUIntLE=function writeUIntLE(e,t,r,a){(e=+e,t>>>=0,r>>>=0,a)||checkInt(this,e,t,r,Math.pow(2,8*r)-1,0);var n=1,o=0;for(this[t]=255&e;++o>>=0,r>>>=0,a)||checkInt(this,e,t,r,Math.pow(2,8*r)-1,0);var n=r-1,o=1;for(this[t+n]=255&e;--n>=0&&(o*=256);)this[t+n]=e/o&255;return t+r},Buffer.prototype.writeUint8=Buffer.prototype.writeUInt8=function writeUInt8(e,t,r){return e=+e,t>>>=0,r||checkInt(this,e,t,1,255,0),this[t]=255&e,t+1},Buffer.prototype.writeUint16LE=Buffer.prototype.writeUInt16LE=function writeUInt16LE(e,t,r){return e=+e,t>>>=0,r||checkInt(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},Buffer.prototype.writeUint16BE=Buffer.prototype.writeUInt16BE=function writeUInt16BE(e,t,r){return e=+e,t>>>=0,r||checkInt(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},Buffer.prototype.writeUint32LE=Buffer.prototype.writeUInt32LE=function writeUInt32LE(e,t,r){return e=+e,t>>>=0,r||checkInt(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},Buffer.prototype.writeUint32BE=Buffer.prototype.writeUInt32BE=function writeUInt32BE(e,t,r){return e=+e,t>>>=0,r||checkInt(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},Buffer.prototype.writeIntLE=function writeIntLE(e,t,r,a){if(e=+e,t>>>=0,!a){var n=Math.pow(2,8*r-1);checkInt(this,e,t,r,n-1,-n)}var o=0,s=1,c=0;for(this[t]=255&e;++o>0)-c&255;return t+r},Buffer.prototype.writeIntBE=function writeIntBE(e,t,r,a){if(e=+e,t>>>=0,!a){var n=Math.pow(2,8*r-1);checkInt(this,e,t,r,n-1,-n)}var o=r-1,s=1,c=0;for(this[t+o]=255&e;--o>=0&&(s*=256);)e<0&&0===c&&0!==this[t+o+1]&&(c=1),this[t+o]=(e/s>>0)-c&255;return t+r},Buffer.prototype.writeInt8=function writeInt8(e,t,r){return e=+e,t>>>=0,r||checkInt(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},Buffer.prototype.writeInt16LE=function writeInt16LE(e,t,r){return e=+e,t>>>=0,r||checkInt(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},Buffer.prototype.writeInt16BE=function writeInt16BE(e,t,r){return e=+e,t>>>=0,r||checkInt(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},Buffer.prototype.writeInt32LE=function writeInt32LE(e,t,r){return e=+e,t>>>=0,r||checkInt(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},Buffer.prototype.writeInt32BE=function writeInt32BE(e,t,r){return e=+e,t>>>=0,r||checkInt(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},Buffer.prototype.writeFloatLE=function writeFloatLE(e,t,r){return writeFloat(this,e,t,!0,r)},Buffer.prototype.writeFloatBE=function writeFloatBE(e,t,r){return writeFloat(this,e,t,!1,r)},Buffer.prototype.writeDoubleLE=function writeDoubleLE(e,t,r){return writeDouble(this,e,t,!0,r)},Buffer.prototype.writeDoubleBE=function writeDoubleBE(e,t,r){return writeDouble(this,e,t,!1,r)},Buffer.prototype.copy=function copy(e,t,r,a){if(!Buffer.isBuffer(e))throw new TypeError("argument should be a Buffer");if(r||(r=0),a||0===a||(a=this.length),t>=e.length&&(t=e.length),t||(t=0),a>0&&a=this.length)throw new RangeError("Index out of range");if(a<0)throw new RangeError("sourceEnd out of bounds");a>this.length&&(a=this.length),e.length-t>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(o=t;o55295&&r<57344){if(!n){if(r>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(s+1===a){(t-=3)>-1&&o.push(239,191,189);continue}n=r;continue}if(r<56320){(t-=3)>-1&&o.push(239,191,189),n=r;continue}r=65536+(n-55296<<10|r-56320)}else n&&(t-=3)>-1&&o.push(239,191,189);if(n=null,r<128){if((t-=1)<0)break;o.push(r)}else if(r<2048){if((t-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=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((t-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function base64ToBytes(e){return a.toByteArray(function base64clean(e){if((e=(e=e.split("=")[0]).trim().replace(d,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function blitBuffer(e,t,r,a){for(var n=0;n=t.length||n>=e.length);++n)t[n+r]=e[n];return n}function isInstance(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function numberIsNaN(e){return e!=e}var u=function(){for(var e="0123456789abcdef",t=new Array(256),r=0;r<16;++r)for(var a=16*r,n=0;n<16;++n)t[a+n]=e[r]+e[n];return t}()},(e,t,r)=>{"use strict";var a=r(1284),n=r(1285),o="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;t.Buffer=Buffer,t.SlowBuffer=function SlowBuffer(e){+e!=e&&(e=0);return Buffer.alloc(+e)},t.INSPECT_MAX_BYTES=50;var s=2147483647;function createBuffer(e){if(e>s)throw new RangeError('The value "'+e+'" is invalid for option "size"');var t=new Uint8Array(e);return Object.setPrototypeOf(t,Buffer.prototype),t}function Buffer(e,t,r){if("number"==typeof e){if("string"==typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return allocUnsafe(e)}return from(e,t,r)}function from(e,t,r){if("string"==typeof e)return function fromString(e,t){"string"==typeof t&&""!==t||(t="utf8");if(!Buffer.isEncoding(t))throw new TypeError("Unknown encoding: "+t);var r=0|byteLength(e,t),a=createBuffer(r),n=a.write(e,t);n!==r&&(a=a.slice(0,n));return a}(e,t);if(ArrayBuffer.isView(e))return function fromArrayView(e){if(isInstance(e,Uint8Array)){var t=new Uint8Array(e);return fromArrayBuffer(t.buffer,t.byteOffset,t.byteLength)}return fromArrayLike(e)}(e);if(null==e)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(isInstance(e,ArrayBuffer)||e&&isInstance(e.buffer,ArrayBuffer))return fromArrayBuffer(e,t,r);if("undefined"!=typeof SharedArrayBuffer&&(isInstance(e,SharedArrayBuffer)||e&&isInstance(e.buffer,SharedArrayBuffer)))return fromArrayBuffer(e,t,r);if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');var a=e.valueOf&&e.valueOf();if(null!=a&&a!==e)return Buffer.from(a,t,r);var n=function fromObject(e){if(Buffer.isBuffer(e)){var t=0|checked(e.length),r=createBuffer(t);return 0===r.length||e.copy(r,0,0,t),r}if(void 0!==e.length)return"number"!=typeof e.length||numberIsNaN(e.length)?createBuffer(0):fromArrayLike(e);if("Buffer"===e.type&&Array.isArray(e.data))return fromArrayLike(e.data)}(e);if(n)return n;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return Buffer.from(e[Symbol.toPrimitive]("string"),t,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function assertSize(e){if("number"!=typeof e)throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function allocUnsafe(e){return assertSize(e),createBuffer(e<0?0:0|checked(e))}function fromArrayLike(e){for(var t=e.length<0?0:0|checked(e.length),r=createBuffer(t),a=0;a=s)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s.toString(16)+" bytes");return 0|e}function byteLength(e,t){if(Buffer.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||isInstance(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);var r=e.length,a=arguments.length>2&&!0===arguments[2];if(!a&&0===r)return 0;for(var n=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return utf8ToBytes(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return base64ToBytes(e).length;default:if(n)return a?-1:utf8ToBytes(e).length;t=(""+t).toLowerCase(),n=!0}}function slowToString(e,t,r){var a=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return hexSlice(this,t,r);case"utf8":case"utf-8":return utf8Slice(this,t,r);case"ascii":return asciiSlice(this,t,r);case"latin1":case"binary":return latin1Slice(this,t,r);case"base64":return base64Slice(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return utf16leSlice(this,t,r);default:if(a)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),a=!0}}function swap(e,t,r){var a=e[t];e[t]=e[r],e[r]=a}function bidirectionalIndexOf(e,t,r,a,n){if(0===e.length)return-1;if("string"==typeof r?(a=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),numberIsNaN(r=+r)&&(r=n?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(n)return-1;r=e.length-1}else if(r<0){if(!n)return-1;r=0}if("string"==typeof t&&(t=Buffer.from(t,a)),Buffer.isBuffer(t))return 0===t.length?-1:arrayIndexOf(e,t,r,a,n);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?n?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):arrayIndexOf(e,[t],r,a,n);throw new TypeError("val must be string, number or Buffer")}function arrayIndexOf(e,t,r,a,n){var o,s=1,c=e.length,d=t.length;if(void 0!==a&&("ucs2"===(a=String(a).toLowerCase())||"ucs-2"===a||"utf16le"===a||"utf-16le"===a)){if(e.length<2||t.length<2)return-1;s=2,c/=2,d/=2,r/=2}function read(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}if(n){var u=-1;for(o=r;oc&&(r=c-d),o=r;o>=0;o--){for(var h=!0,l=0;ln&&(a=n):a=n;var o=t.length;a>o/2&&(a=o/2);for(var s=0;s>8,n=r%256,o.push(n),o.push(a);return o}(t,e.length-r),e,r,a)}function base64Slice(e,t,r){return 0===t&&r===e.length?a.fromByteArray(e):a.fromByteArray(e.slice(t,r))}function utf8Slice(e,t,r){r=Math.min(e.length,r);for(var a=[],n=t;n239?4:h>223?3:h>191?2:1;if(n+b<=r)switch(b){case 1:h<128&&(l=h);break;case 2:128==(192&(o=e[n+1]))&&(u=(31&h)<<6|63&o)>127&&(l=u);break;case 3:o=e[n+1],s=e[n+2],128==(192&o)&&128==(192&s)&&(u=(15&h)<<12|(63&o)<<6|63&s)>2047&&(u<55296||u>57343)&&(l=u);break;case 4:o=e[n+1],s=e[n+2],d=e[n+3],128==(192&o)&&128==(192&s)&&128==(192&d)&&(u=(15&h)<<18|(63&o)<<12|(63&s)<<6|63&d)>65535&&u<1114112&&(l=u)}null===l?(l=65533,b=1):l>65535&&(l-=65536,a.push(l>>>10&1023|55296),l=56320|1023&l),a.push(l),n+=b}return function decodeCodePointsArray(e){var t=e.length;if(t<=c)return String.fromCharCode.apply(String,e);var r="",a=0;for(;aa.length?Buffer.from(o).copy(a,n):Uint8Array.prototype.set.call(a,o,n);else{if(!Buffer.isBuffer(o))throw new TypeError('"list" argument must be an Array of Buffers');o.copy(a,n)}n+=o.length}return a},Buffer.byteLength=byteLength,Buffer.prototype._isBuffer=!0,Buffer.prototype.swap16=function swap16(){var e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;tr&&(e+=" ... "),""},o&&(Buffer.prototype[o]=Buffer.prototype.inspect),Buffer.prototype.compare=function compare(e,t,r,a,n){if(isInstance(e,Uint8Array)&&(e=Buffer.from(e,e.offset,e.byteLength)),!Buffer.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===a&&(a=0),void 0===n&&(n=this.length),t<0||r>e.length||a<0||n>this.length)throw new RangeError("out of range index");if(a>=n&&t>=r)return 0;if(a>=n)return-1;if(t>=r)return 1;if(this===e)return 0;for(var o=(n>>>=0)-(a>>>=0),s=(r>>>=0)-(t>>>=0),c=Math.min(o,s),d=this.slice(a,n),u=e.slice(t,r),h=0;h>>=0,isFinite(r)?(r>>>=0,void 0===a&&(a="utf8")):(a=r,r=void 0)}var n=this.length-t;if((void 0===r||r>n)&&(r=n),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");a||(a="utf8");for(var o=!1;;)switch(a){case"hex":return hexWrite(this,e,t,r);case"utf8":case"utf-8":return utf8Write(this,e,t,r);case"ascii":case"latin1":case"binary":return asciiWrite(this,e,t,r);case"base64":return base64Write(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ucs2Write(this,e,t,r);default:if(o)throw new TypeError("Unknown encoding: "+a);a=(""+a).toLowerCase(),o=!0}},Buffer.prototype.toJSON=function toJSON(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var c=4096;function asciiSlice(e,t,r){var a="";r=Math.min(e.length,r);for(var n=t;na)&&(r=a);for(var n="",o=t;or)throw new RangeError("Trying to access beyond buffer length")}function checkInt(e,t,r,a,n,o){if(!Buffer.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>n||te.length)throw new RangeError("Index out of range")}function checkIEEE754(e,t,r,a,n,o){if(r+a>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function writeFloat(e,t,r,a,o){return t=+t,r>>>=0,o||checkIEEE754(e,0,r,4),n.write(e,t,r,a,23,4),r+4}function writeDouble(e,t,r,a,o){return t=+t,r>>>=0,o||checkIEEE754(e,0,r,8),n.write(e,t,r,a,52,8),r+8}Buffer.prototype.slice=function slice(e,t){var r=this.length;(e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t>>=0,t>>>=0,r||checkOffset(e,t,this.length);for(var a=this[e],n=1,o=0;++o>>=0,t>>>=0,r||checkOffset(e,t,this.length);for(var a=this[e+--t],n=1;t>0&&(n*=256);)a+=this[e+--t]*n;return a},Buffer.prototype.readUint8=Buffer.prototype.readUInt8=function readUInt8(e,t){return e>>>=0,t||checkOffset(e,1,this.length),this[e]},Buffer.prototype.readUint16LE=Buffer.prototype.readUInt16LE=function readUInt16LE(e,t){return e>>>=0,t||checkOffset(e,2,this.length),this[e]|this[e+1]<<8},Buffer.prototype.readUint16BE=Buffer.prototype.readUInt16BE=function readUInt16BE(e,t){return e>>>=0,t||checkOffset(e,2,this.length),this[e]<<8|this[e+1]},Buffer.prototype.readUint32LE=Buffer.prototype.readUInt32LE=function readUInt32LE(e,t){return e>>>=0,t||checkOffset(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},Buffer.prototype.readUint32BE=Buffer.prototype.readUInt32BE=function readUInt32BE(e,t){return e>>>=0,t||checkOffset(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},Buffer.prototype.readIntLE=function readIntLE(e,t,r){e>>>=0,t>>>=0,r||checkOffset(e,t,this.length);for(var a=this[e],n=1,o=0;++o=(n*=128)&&(a-=Math.pow(2,8*t)),a},Buffer.prototype.readIntBE=function readIntBE(e,t,r){e>>>=0,t>>>=0,r||checkOffset(e,t,this.length);for(var a=t,n=1,o=this[e+--a];a>0&&(n*=256);)o+=this[e+--a]*n;return o>=(n*=128)&&(o-=Math.pow(2,8*t)),o},Buffer.prototype.readInt8=function readInt8(e,t){return e>>>=0,t||checkOffset(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},Buffer.prototype.readInt16LE=function readInt16LE(e,t){e>>>=0,t||checkOffset(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},Buffer.prototype.readInt16BE=function readInt16BE(e,t){e>>>=0,t||checkOffset(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},Buffer.prototype.readInt32LE=function readInt32LE(e,t){return e>>>=0,t||checkOffset(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},Buffer.prototype.readInt32BE=function readInt32BE(e,t){return e>>>=0,t||checkOffset(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},Buffer.prototype.readFloatLE=function readFloatLE(e,t){return e>>>=0,t||checkOffset(e,4,this.length),n.read(this,e,!0,23,4)},Buffer.prototype.readFloatBE=function readFloatBE(e,t){return e>>>=0,t||checkOffset(e,4,this.length),n.read(this,e,!1,23,4)},Buffer.prototype.readDoubleLE=function readDoubleLE(e,t){return e>>>=0,t||checkOffset(e,8,this.length),n.read(this,e,!0,52,8)},Buffer.prototype.readDoubleBE=function readDoubleBE(e,t){return e>>>=0,t||checkOffset(e,8,this.length),n.read(this,e,!1,52,8)},Buffer.prototype.writeUintLE=Buffer.prototype.writeUIntLE=function writeUIntLE(e,t,r,a){(e=+e,t>>>=0,r>>>=0,a)||checkInt(this,e,t,r,Math.pow(2,8*r)-1,0);var n=1,o=0;for(this[t]=255&e;++o>>=0,r>>>=0,a)||checkInt(this,e,t,r,Math.pow(2,8*r)-1,0);var n=r-1,o=1;for(this[t+n]=255&e;--n>=0&&(o*=256);)this[t+n]=e/o&255;return t+r},Buffer.prototype.writeUint8=Buffer.prototype.writeUInt8=function writeUInt8(e,t,r){return e=+e,t>>>=0,r||checkInt(this,e,t,1,255,0),this[t]=255&e,t+1},Buffer.prototype.writeUint16LE=Buffer.prototype.writeUInt16LE=function writeUInt16LE(e,t,r){return e=+e,t>>>=0,r||checkInt(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},Buffer.prototype.writeUint16BE=Buffer.prototype.writeUInt16BE=function writeUInt16BE(e,t,r){return e=+e,t>>>=0,r||checkInt(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},Buffer.prototype.writeUint32LE=Buffer.prototype.writeUInt32LE=function writeUInt32LE(e,t,r){return e=+e,t>>>=0,r||checkInt(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},Buffer.prototype.writeUint32BE=Buffer.prototype.writeUInt32BE=function writeUInt32BE(e,t,r){return e=+e,t>>>=0,r||checkInt(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},Buffer.prototype.writeIntLE=function writeIntLE(e,t,r,a){if(e=+e,t>>>=0,!a){var n=Math.pow(2,8*r-1);checkInt(this,e,t,r,n-1,-n)}var o=0,s=1,c=0;for(this[t]=255&e;++o>0)-c&255;return t+r},Buffer.prototype.writeIntBE=function writeIntBE(e,t,r,a){if(e=+e,t>>>=0,!a){var n=Math.pow(2,8*r-1);checkInt(this,e,t,r,n-1,-n)}var o=r-1,s=1,c=0;for(this[t+o]=255&e;--o>=0&&(s*=256);)e<0&&0===c&&0!==this[t+o+1]&&(c=1),this[t+o]=(e/s>>0)-c&255;return t+r},Buffer.prototype.writeInt8=function writeInt8(e,t,r){return e=+e,t>>>=0,r||checkInt(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},Buffer.prototype.writeInt16LE=function writeInt16LE(e,t,r){return e=+e,t>>>=0,r||checkInt(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},Buffer.prototype.writeInt16BE=function writeInt16BE(e,t,r){return e=+e,t>>>=0,r||checkInt(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},Buffer.prototype.writeInt32LE=function writeInt32LE(e,t,r){return e=+e,t>>>=0,r||checkInt(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},Buffer.prototype.writeInt32BE=function writeInt32BE(e,t,r){return e=+e,t>>>=0,r||checkInt(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},Buffer.prototype.writeFloatLE=function writeFloatLE(e,t,r){return writeFloat(this,e,t,!0,r)},Buffer.prototype.writeFloatBE=function writeFloatBE(e,t,r){return writeFloat(this,e,t,!1,r)},Buffer.prototype.writeDoubleLE=function writeDoubleLE(e,t,r){return writeDouble(this,e,t,!0,r)},Buffer.prototype.writeDoubleBE=function writeDoubleBE(e,t,r){return writeDouble(this,e,t,!1,r)},Buffer.prototype.copy=function copy(e,t,r,a){if(!Buffer.isBuffer(e))throw new TypeError("argument should be a Buffer");if(r||(r=0),a||0===a||(a=this.length),t>=e.length&&(t=e.length),t||(t=0),a>0&&a=this.length)throw new RangeError("Index out of range");if(a<0)throw new RangeError("sourceEnd out of bounds");a>this.length&&(a=this.length),e.length-t>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(o=t;o55295&&r<57344){if(!n){if(r>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(s+1===a){(t-=3)>-1&&o.push(239,191,189);continue}n=r;continue}if(r<56320){(t-=3)>-1&&o.push(239,191,189),n=r;continue}r=65536+(n-55296<<10|r-56320)}else n&&(t-=3)>-1&&o.push(239,191,189);if(n=null,r<128){if((t-=1)<0)break;o.push(r)}else if(r<2048){if((t-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=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((t-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function base64ToBytes(e){return a.toByteArray(function base64clean(e){if((e=(e=e.split("=")[0]).trim().replace(d,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function blitBuffer(e,t,r,a){for(var n=0;n=t.length||n>=e.length);++n)t[n+r]=e[n];return n}function isInstance(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function numberIsNaN(e){return e!=e}var u=function(){for(var e="0123456789abcdef",t=new Array(256),r=0;r<16;++r)for(var a=16*r,n=0;n<16;++n)t[a+n]=e[r]+e[n];return t}()},function(e,t,r){"use strict";var a=this&&this.__createBinding||(Object.create?function(e,t,r,a){void 0===a&&(a=r),Object.defineProperty(e,a,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,a){void 0===a&&(a=r),e[a]=t[r]}),n=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||t.hasOwnProperty(r)||a(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),n(r(198),t),n(r(36),t),n(r(567),t),n(r(63),t),n(r(568),t),n(r(78),t),n(r(137),t),n(r(138),t),n(r(246),t),n(r(62),t)},(e,t,r)=>{"use strict";var a=r(1);function _typeof(e){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function _typeof(e){return typeof e}:function _typeof(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var n,o,s=r(807).codes,c=s.ERR_AMBIGUOUS_ARGUMENT,d=s.ERR_INVALID_ARG_TYPE,u=s.ERR_INVALID_ARG_VALUE,h=s.ERR_INVALID_RETURN_VALUE,l=s.ERR_MISSING_ARGS,b=r(818),g=r(40).inspect,p=r(40).types,B=p.isPromise,m=p.isRegExp,I=Object.assign?Object.assign:r(819).assign,y=Object.is?Object.is:r(481);new Map;function lazyLoadComparison(){var e=r(823);n=e.isDeepEqual,o=e.isDeepStrictEqual}var v=!1,x=e.exports=ok,C={};function innerFail(e){if(e.message instanceof Error)throw e.message;throw new b(e)}function innerOk(e,t,r,a){if(!r){var n=!1;if(0===t)n=!0,a="No value argument passed to `assert.ok()`";else if(a instanceof Error)throw a;var o=new b({actual:r,expected:!0,message:a,operator:"==",stackStartFn:e});throw o.generatedMessage=n,o}}function ok(){for(var e=arguments.length,t=new Array(e),r=0;r1?t-1:0),a=1;a1?t-1:0),a=1;a1?t-1:0),a=1;a1?t-1:0),a=1;a{"use strict";var a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n=r(367),o=n.keccak224,s=n.keccak384,c=n.keccak256,d=n.keccak512,u=r(993),h=r(6),l=r(41),b=r(202),g=r(199),p=r(19).Buffer;Object.assign(t,r(62)),t.MAX_INTEGER=new b("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",16),t.TWO_POW256=new b("10000000000000000000000000000000000000000000000000000000000000000",16),t.KECCAK256_NULL_S="c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470",t.SHA3_NULL_S=t.KECCAK256_NULL_S,t.KECCAK256_NULL=p.from(t.KECCAK256_NULL_S,"hex"),t.SHA3_NULL=t.KECCAK256_NULL,t.KECCAK256_RLP_ARRAY_S="1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",t.SHA3_RLP_ARRAY_S=t.KECCAK256_RLP_ARRAY_S,t.KECCAK256_RLP_ARRAY=p.from(t.KECCAK256_RLP_ARRAY_S,"hex"),t.SHA3_RLP_ARRAY=t.KECCAK256_RLP_ARRAY,t.KECCAK256_RLP_S="56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",t.SHA3_RLP_S=t.KECCAK256_RLP_S,t.KECCAK256_RLP=p.from(t.KECCAK256_RLP_S,"hex"),t.SHA3_RLP=t.KECCAK256_RLP,t.BN=b,t.rlp=l,t.secp256k1=u,t.zeros=function(e){return p.allocUnsafe(e).fill(0)},t.zeroAddress=function(){var e=t.zeros(20);return t.bufferToHex(e)},t.setLengthLeft=t.setLength=function(e,r,a){var n=t.zeros(r);return e=t.toBuffer(e),a?e.length0&&"0"===r.toString();)r=(e=e.slice(1))[0];return e},t.toBuffer=function(e){if(!p.isBuffer(e))if(Array.isArray(e))e=p.from(e);else if("string"==typeof e)e=t.isHexString(e)?p.from(t.padToEven(t.stripHexPrefix(e)),"hex"):p.from(e);else if("number"==typeof e)e=t.intToBuffer(e);else if(null==e)e=p.allocUnsafe(0);else if(b.isBN(e))e=e.toArrayLike(p);else{if(!e.toArray)throw new Error("invalid type");e=p.from(e.toArray())}return e},t.bufferToInt=function(e){return new b(t.toBuffer(e)).toNumber()},t.bufferToHex=function(e){return"0x"+(e=t.toBuffer(e)).toString("hex")},t.fromSigned=function(e){return new b(e).fromTwos(256)},t.toUnsigned=function(e){return p.from(e.toTwos(256).toArray())},t.keccak=function(e,r){switch(e=t.toBuffer(e),r||(r=256),r){case 224:return o(e);case 256:return c(e);case 384:return s(e);case 512:return d(e);default:throw new Error("Invald algorithm: keccak"+r)}},t.keccak256=function(e){return t.keccak(e)},t.sha3=t.keccak,t.sha256=function(e){return e=t.toBuffer(e),g("sha256").update(e).digest()},t.ripemd160=function(e,r){e=t.toBuffer(e);var a=g("rmd160").update(e).digest();return!0===r?t.setLength(a,32):a},t.rlphash=function(e){return t.keccak(l.encode(e))},t.isValidPrivate=function(e){return u.privateKeyVerify(e)},t.isValidPublic=function(e,t){return 64===e.length?u.publicKeyVerify(p.concat([p.from([4]),e])):!!t&&u.publicKeyVerify(e)},t.pubToAddress=t.publicToAddress=function(e,r){return e=t.toBuffer(e),r&&64!==e.length&&(e=u.publicKeyConvert(e,!1).slice(1)),h(64===e.length),t.keccak(e).slice(-20)};var B=t.privateToPublic=function(e){return e=t.toBuffer(e),u.publicKeyCreate(e,!1).slice(1)};t.importPublic=function(e){return 64!==(e=t.toBuffer(e)).length&&(e=u.publicKeyConvert(e,!1).slice(1)),e},t.ecsign=function(e,t){var r=u.sign(e,t),a={};return a.r=r.signature.slice(0,32),a.s=r.signature.slice(32,64),a.v=r.recovery+27,a},t.hashPersonalMessage=function(e){var r=t.toBuffer("Ethereum Signed Message:\n"+e.length.toString());return t.keccak(p.concat([r,e]))},t.ecrecover=function(e,r,a,n){var o=p.concat([t.setLength(a,32),t.setLength(n,32)],64),s=r-27;if(0!==s&&1!==s)throw new Error("Invalid signature v value");var c=u.recover(e,o,s);return u.publicKeyConvert(c,!1).slice(1)},t.toRpcSig=function(e,r,a){if(27!==e&&28!==e)throw new Error("Invalid recovery id");return t.bufferToHex(p.concat([t.setLengthLeft(r,32),t.setLengthLeft(a,32),t.toBuffer(e-27)]))},t.fromRpcSig=function(e){if(65!==(e=t.toBuffer(e)).length)throw new Error("Invalid signature length");var r=e[64];return r<27&&(r+=27),{v:r,r:e.slice(0,32),s:e.slice(32,64)}},t.privateToAddress=function(e){return t.publicToAddress(B(e))},t.isValidAddress=function(e){return/^0x[0-9a-fA-F]{40}$/.test(e)},t.isZeroAddress=function(e){return t.zeroAddress()===t.addHexPrefix(e)},t.toChecksumAddress=function(e){e=t.stripHexPrefix(e).toLowerCase();for(var r=t.keccak(e).toString("hex"),a="0x",n=0;n=8?a+=e[n].toUpperCase():a+=e[n];return a},t.isValidChecksumAddress=function(e){return t.isValidAddress(e)&&t.toChecksumAddress(e)===e},t.generateAddress=function(e,r){return e=t.toBuffer(e),r=(r=new b(r)).isZero()?null:p.from(r.toArray()),t.rlphash([e,r]).slice(-20)},t.isPrecompiled=function(e){var r=t.unpad(e);return 1===r.length&&r[0]>=1&&r[0]<=8},t.addHexPrefix=function(e){return"string"!=typeof e||t.isHexPrefixed(e)?e:"0x"+e},t.isValidSignature=function(e,t,r,a){var n=new b("7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0",16),o=new b("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141",16);return 32===t.length&&32===r.length&&((27===e||28===e)&&(t=new b(t),r=new b(r),!(t.isZero()||t.gt(o)||r.isZero()||r.gt(o))&&(!1!==a||1!==new b(r).cmp(n))))},t.baToJSON=function(e){if(p.isBuffer(e))return"0x"+e.toString("hex");if(e instanceof Array){for(var r=[],a=0;a=n.length,"The field "+r.name+" must not have more "+r.length+" bytes")):r.allowZero&&0===n.length||!r.length||h(r.length===n.length,"The field "+r.name+" must have byte length of "+r.length),e.raw[a]=n}e._fields.push(r.name),Object.defineProperty(e,r.name,{enumerable:!0,configurable:!0,get:getter,set:setter}),r.default&&(e[r.name]=r.default),r.alias&&Object.defineProperty(e,r.alias,{enumerable:!1,configurable:!0,set:setter,get:getter})})),n)if("string"==typeof n&&(n=p.from(t.stripHexPrefix(n),"hex")),p.isBuffer(n)&&(n=l.decode(n)),Array.isArray(n)){if(n.length>e._fields.length)throw new Error("wrong number of fields in data");n.forEach((function(r,a){e[e._fields[a]]=t.toBuffer(r)}))}else{if("object"!==(void 0===n?"undefined":a(n)))throw new Error("invalid data");var o=Object.keys(n);r.forEach((function(t){-1!==o.indexOf(t.name)&&(e[t.name]=n[t.name]),-1!==o.indexOf(t.alias)&&(e[t.alias]=n[t.alias])}))}}},function(e,t,r){"use strict";var a=this&&this.__createBinding||(Object.create?function(e,t,r,a){void 0===a&&(a=r),Object.defineProperty(e,a,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,a){void 0===a&&(a=r),e[a]=t[r]}),n=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||a(t,e,r)},o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.PromiEvent=t.JsonRpcErrorCode=t.makeResponse=t.makeRequest=t.makeError=void 0,n(r(154),t),n(r(24),t),n(r(1257),t),n(r(725),t),n(r(724),t);var s=r(782);Object.defineProperty(t,"makeError",{enumerable:!0,get:function(){return s.makeError}}),Object.defineProperty(t,"makeRequest",{enumerable:!0,get:function(){return s.makeRequest}}),Object.defineProperty(t,"makeResponse",{enumerable:!0,get:function(){return s.makeResponse}}),Object.defineProperty(t,"JsonRpcErrorCode",{enumerable:!0,get:function(){return s.JsonRpcErrorCode}});var c=r(266);Object.defineProperty(t,"PromiEvent",{enumerable:!0,get:function(){return o(c).default}})},(e,t,r)=>{"use strict";var a=r(0).Buffer,n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o=r(367),s=o.keccak224,c=o.keccak384,d=o.keccak256,u=o.keccak512,h=r(995),l=r(6),b=r(41),g=r(202),p=r(199);t.MAX_INTEGER=new g("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",16),t.TWO_POW256=new g("10000000000000000000000000000000000000000000000000000000000000000",16),t.SHA3_NULL_S="c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470",t.SHA3_NULL=new a(t.SHA3_NULL_S,"hex"),t.SHA3_RLP_ARRAY_S="1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",t.SHA3_RLP_ARRAY=new a(t.SHA3_RLP_ARRAY_S,"hex"),t.SHA3_RLP_S="56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",t.SHA3_RLP=new a(t.SHA3_RLP_S,"hex"),t.BN=g,t.rlp=b,t.secp256k1=h,t.zeros=function(e){var t=new a(e);return t.fill(0),t},t.setLengthLeft=t.setLength=function(e,r,a){var n=t.zeros(r);return e=t.toBuffer(e),a?e.length0&&"0"===r.toString();)r=(e=e.slice(1))[0];return e},t.toBuffer=function(e){if(!a.isBuffer(e))if(Array.isArray(e))e=new a(e);else if("string"==typeof e)e=t.isHexPrefixed(e)?new a(t.padToEven(t.stripHexPrefix(e)),"hex"):new a(e);else if("number"==typeof e)e=t.intToBuffer(e);else if(null==e)e=new a([]);else{if(!e.toArray)throw new Error("invalid type");e=new a(e.toArray())}return e},t.intToHex=function(e){l(e%1==0,"number is not a integer"),l(e>=0,"number must be positive");var t=e.toString(16);return t.length%2&&(t="0"+t),"0x"+t},t.intToBuffer=function(e){var r=t.intToHex(e);return new a(r.slice(2),"hex")},t.bufferToInt=function(e){return parseInt(t.bufferToHex(e),16)},t.bufferToHex=function(e){return 0===(e=t.toBuffer(e)).length?0:"0x"+e.toString("hex")},t.fromSigned=function(e){return new g(e).fromTwos(256)},t.toUnsigned=function(e){return new a(e.toTwos(256).toArray())},t.sha3=function(e,r){switch(e=t.toBuffer(e),r||(r=256),r){case 224:return s(e);case 256:return d(e);case 384:return c(e);case 512:return u(e);default:throw new Error("Invalid algorithm: keccak"+r)}},t.sha256=function(e){return e=t.toBuffer(e),p("sha256").update(e).digest()},t.ripemd160=function(e,r){e=t.toBuffer(e);var a=p("rmd160").update(e).digest();return!0===r?t.setLength(a,32):a},t.rlphash=function(e){return t.sha3(b.encode(e))},t.isValidPrivate=function(e){return h.privateKeyVerify(e)},t.isValidPublic=function(e,t){return 64===e.length?h.publicKeyVerify(a.concat([new a([4]),e])):!!t&&h.publicKeyVerify(e)},t.pubToAddress=t.publicToAddress=function(e,r){return e=t.toBuffer(e),r&&64!==e.length&&(e=h.publicKeyConvert(e,!1).slice(1)),l(64===e.length),t.sha3(e).slice(-20)};var B=t.privateToPublic=function(e){return e=t.toBuffer(e),h.publicKeyCreate(e,!1).slice(1)};t.importPublic=function(e){return 64!==(e=t.toBuffer(e)).length&&(e=h.publicKeyConvert(e,!1).slice(1)),e},t.ecsign=function(e,t){var r=h.sign(e,t),a={};return a.r=r.signature.slice(0,32),a.s=r.signature.slice(32,64),a.v=r.recovery+27,a},t.ecrecover=function(e,r,n,o){var s=a.concat([t.setLength(n,32),t.setLength(o,32)],64),c=t.bufferToInt(r)-27;if(0!==c&&1!==c)throw new Error("Invalid signature v value");var d=h.recover(e,s,c);return h.publicKeyConvert(d,!1).slice(1)},t.toRpcSig=function(e,r,n){return t.bufferToHex(a.concat([r,n,t.toBuffer(e-27)]))},t.fromRpcSig=function(e){var r=(e=t.toBuffer(e))[64];return r<27&&(r+=27),{v:r,r:e.slice(0,32),s:e.slice(32,64)}},t.privateToAddress=function(e){return t.publicToAddress(B(e))},t.isValidAddress=function(e){return/^0x[0-9a-fA-F]{40}$/i.test(e)},t.toChecksumAddress=function(e){e=t.stripHexPrefix(e).toLowerCase();for(var r=t.sha3(e).toString("hex"),a="0x",n=0;n=8?a+=e[n].toUpperCase():a+=e[n];return a},t.isValidChecksumAddress=function(e){return t.isValidAddress(e)&&t.toChecksumAddress(e)===e},t.generateAddress=function(e,r){return e=t.toBuffer(e),r=(r=new g(r)).isZero()?null:new a(r.toArray()),t.rlphash([e,r]).slice(-20)},t.isPrecompiled=function(e){var r=t.unpad(e);return 1===r.length&&r[0]>0&&r[0]<5},t.isHexPrefixed=function(e){return"0x"===e.slice(0,2)},t.stripHexPrefix=function(e){return"string"!=typeof e?e:t.isHexPrefixed(e)?e.slice(2):e},t.addHexPrefix=function(e){return"string"!=typeof e||t.isHexPrefixed(e)?e:"0x"+e},t.padToEven=function(e){return e.length%2&&(e="0"+e),e},t.baToJSON=function(e){if(a.isBuffer(e))return"0x"+e.toString("hex");if(e instanceof Array){for(var r=[],n=0;n=o.length,"The field "+r.name+" must not have more "+r.length+" bytes")):r.allowZero&&0===o.length||!r.length||l(r.length===o.length,"The field "+r.name+" must have byte length of "+r.length),e.raw[n]=o}e._fields.push(r.name),Object.defineProperty(e,r.name,{enumerable:!0,configurable:!0,get:getter,set:setter}),r.default&&(e[r.name]=r.default),r.alias&&Object.defineProperty(e,r.alias,{enumerable:!1,configurable:!0,set:setter,get:getter})})),o)if("string"==typeof o&&(o=new a(t.stripHexPrefix(o),"hex")),a.isBuffer(o)&&(o=b.decode(o)),Array.isArray(o)){if(o.length>e._fields.length)throw new Error("wrong number of fields in data");o.forEach((function(r,a){e[e._fields[a]]=t.toBuffer(r)}))}else{if("object"!==(void 0===o?"undefined":n(o)))throw new Error("invalid data");for(var s in o)-1!==e._fields.indexOf(s)&&(e[s]=o[s])}}},e=>{"function"==typeof Object.create?e.exports=function inherits(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:e.exports=function inherits(e,t){if(t){e.super_=t;var TempCtor=function(){};TempCtor.prototype=t.prototype,e.prototype=new TempCtor,e.prototype.constructor=e}}},(e,t,r)=>{var a=r(2),n=a.Buffer;function copyProps(e,t){for(var r in e)t[r]=e[r]}function SafeBuffer(e,t,r){return n(e,t,r)}n.from&&n.alloc&&n.allocUnsafe&&n.allocUnsafeSlow?e.exports=a:(copyProps(a,t),t.Buffer=SafeBuffer),SafeBuffer.prototype=Object.create(n.prototype),copyProps(n,SafeBuffer),SafeBuffer.from=function(e,t,r){if("number"==typeof e)throw new TypeError("Argument must not be a number");return n(e,t,r)},SafeBuffer.alloc=function(e,t,r){if("number"!=typeof e)throw new TypeError("Argument must be a number");var a=n(e);return void 0!==t?"string"==typeof r?a.fill(t,r):a.fill(t):a.fill(0),a},SafeBuffer.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return n(e)},SafeBuffer.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return a.SlowBuffer(e)}},function(e,t,r){"use strict";var a=r(0).Buffer,n=this&&this.__assign||function(){return(n=Object.assign||function(e){for(var t,r=1,a=arguments.length;r0&&n[n.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!n||o[1]>n[0]&&o[1] "+p+"))")),y=!0,this._vm._common.gteHardfork("spuriousDragon")&&g.returnValue.length>this._vm._common.param("vm","maxCodeSize")&&(y=!1),v=!1,p.lte(e.gasLimit)&&(this._vm._allowUnlimitedContractSize||y)?this._vm._common.isActivatedEIP(3541)&&g.returnValue.slice(0,1).equals(a.from("EF","hex"))?g=n(n({},g),INVALID_BYTECODE_RESULT(e.gasLimit)):g.gasUsed=p:this._vm._common.gteHardfork("homestead")?(this._vm.DEBUG&&m("Not enough gas or code size not allowed (>= Homestead)"),g=n(n({},g),OOGResult(e.gasLimit))):(this._vm.DEBUG&&m("Not enough gas or code size not allowed (Frontier)"),p.sub(B).lte(e.gasLimit)?(g=n(n({},g),COOGResult(p.sub(B))),v=!0):g=n(n({},g),OOGResult(e.gasLimit))),g.exceptionError||!g.returnValue||""===g.returnValue.toString()?[3,14]:[4,this._state.putContractCode(e.to,g.returnValue)];case 13:return s.sent(),this._vm.DEBUG&&m("Code saved on new contract creation"),[3,17];case 14:return v?this._vm._common.gteHardfork("homestead")?[3,17]:[4,this._state.getAccount(e.to)]:[3,17];case 15:return x=s.sent(),[4,this._state.putAccount(e.to,x)];case 16:s.sent(),s.label=17;case 17:return[2,{gasUsed:g.gasUsed,createdAddress:e.to,execResult:g}]}}))}))},EVM.prototype.runInterpreter=function(e,t){return void 0===t&&(t={}),o(this,void 0,void 0,(function(){var r,o,c,d,b,p,m;return s(this,(function(s){switch(s.label){case 0:return o={blockchain:this._vm.blockchain,address:e.to||u.Address.zero(),caller:e.caller||u.Address.zero(),callData:e.data||a.from([0]),callValue:e.value||new u.BN(0),code:e.code,isStatic:e.isStatic||!1,depth:e.depth||0,gasPrice:this._tx.gasPrice,origin:this._tx.origin||e.caller||u.Address.zero(),block:this._block||new h.Block},[4,this._state.getAccount(e.to||u.Address.zero())];case 1:return o.contract=s.sent(),o.codeAddress=e.codeAddress,r=o,c=new g.default(r,this._state,this,this._vm._common,e.gasLimit.clone()),e.selfdestruct&&(c._result.selfdestruct=e.selfdestruct),d=this._refund.clone(),[4,new B.default(this._vm,c).run(e.code,t)];case 2:return b=s.sent(),p=c._result,m=e.gasLimit.sub(c._gasLeft),b.exceptionError&&(b.exceptionError.error!==l.ERROR.REVERT&&(m=e.gasLimit),p=n(n({},p),{logs:[],selfdestruct:{}}),this._refund=d),[2,n(n({},p),{runState:n(n(n({},b.runState),p),c._env),exceptionError:b.exceptionError,gas:c._gasLeft,gasUsed:m,returnValue:p.returnValue?p.returnValue:a.alloc(0)})]}}))}))},EVM.prototype.getPrecompile=function(e){return b.getPrecompile(e,this._vm._common)},EVM.prototype.runPrecompile=function(e,t,r){if("function"!=typeof e)throw new Error("Invalid precompile");return e({data:t,gasLimit:r,_common:this._vm._common,_VM:this._vm})},EVM.prototype._loadCode=function(e){return o(this,void 0,void 0,(function(){var t,r;return s(this,(function(a){switch(a.label){case 0:return e.code?[3,3]:(t=this.getPrecompile(e.codeAddress))?(e.code=t,e.isCompiled=!0,[3,3]):[3,1];case 1:return r=e,[4,this._state.getContractCode(e.codeAddress)];case 2:r.code=a.sent(),e.isCompiled=!1,a.label=3;case 3:return[2]}}))}))},EVM.prototype._generateAddress=function(e){return o(this,void 0,void 0,(function(){var t,r,n;return s(this,(function(o){switch(o.label){case 0:return e.salt?(t=u.generateAddress2(e.caller.buf,e.salt,e.code),[3,3]):[3,1];case 1:return[4,this._state.getAccount(e.caller)];case 2:r=o.sent(),n=r.nonce.subn(1),t=u.generateAddress(e.caller.buf,n.toArrayLike(a)),o.label=3;case 3:return[2,new u.Address(t)]}}))}))},EVM.prototype._reduceSenderBalance=function(e,t){return o(this,void 0,void 0,(function(){var r;return s(this,(function(a){return e.balance.isub(t.value),r=this._state.putAccount(t.caller,e),this._vm.DEBUG&&m("Reduced sender ("+t.caller+") balance (-> "+e.balance+")"),[2,r]}))}))},EVM.prototype._addToBalance=function(e,t){return o(this,void 0,void 0,(function(){var r,a;return s(this,(function(n){if((r=e.balance.add(t.value)).gt(u.MAX_INTEGER))throw new l.VmError(l.ERROR.VALUE_OVERFLOW);return e.balance=r,a=this._state.putAccount(t.to,e),this._vm.DEBUG&&m("Added toAccount ("+t.to+") balance (-> "+e.balance+")"),[2,a]}))}))},EVM.prototype._touchAccount=function(e){return o(this,void 0,void 0,(function(){var t;return s(this,(function(r){switch(r.label){case 0:return[4,this._state.getAccount(e)];case 1:return t=r.sent(),[2,this._state.putAccount(e,t)]}}))}))},EVM}();t.default=y},(e,t,r)=>{"use strict";var a,n=SyntaxError,o=Function,s=TypeError,getEvalledConstructor=function(e){try{return o('"use strict"; return ('+e+").constructor;")()}catch(e){}},c=Object.getOwnPropertyDescriptor;if(c)try{c({},"")}catch(e){c=null}var throwTypeError=function(){throw new s},d=c?function(){try{return throwTypeError}catch(e){try{return c(arguments,"callee").get}catch(e){return throwTypeError}}}():throwTypeError,u=r(416)(),h=Object.getPrototypeOf||function(e){return e.__proto__},l={},b="undefined"==typeof Uint8Array?a:h(Uint8Array),g={"%AggregateError%":"undefined"==typeof AggregateError?a:AggregateError,"%Array%":Array,"%ArrayBuffer%":"undefined"==typeof ArrayBuffer?a:ArrayBuffer,"%ArrayIteratorPrototype%":u?h([][Symbol.iterator]()):a,"%AsyncFromSyncIteratorPrototype%":a,"%AsyncFunction%":l,"%AsyncGenerator%":l,"%AsyncGeneratorFunction%":l,"%AsyncIteratorPrototype%":l,"%Atomics%":"undefined"==typeof Atomics?a:Atomics,"%BigInt%":"undefined"==typeof BigInt?a:BigInt,"%Boolean%":Boolean,"%DataView%":"undefined"==typeof DataView?a:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":"undefined"==typeof Float32Array?a:Float32Array,"%Float64Array%":"undefined"==typeof Float64Array?a:Float64Array,"%FinalizationRegistry%":"undefined"==typeof FinalizationRegistry?a:FinalizationRegistry,"%Function%":o,"%GeneratorFunction%":l,"%Int8Array%":"undefined"==typeof Int8Array?a:Int8Array,"%Int16Array%":"undefined"==typeof Int16Array?a:Int16Array,"%Int32Array%":"undefined"==typeof Int32Array?a:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":u?h(h([][Symbol.iterator]())):a,"%JSON%":"object"==typeof JSON?JSON:a,"%Map%":"undefined"==typeof Map?a:Map,"%MapIteratorPrototype%":"undefined"!=typeof Map&&u?h((new Map)[Symbol.iterator]()):a,"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":"undefined"==typeof Promise?a:Promise,"%Proxy%":"undefined"==typeof Proxy?a:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":"undefined"==typeof Reflect?a:Reflect,"%RegExp%":RegExp,"%Set%":"undefined"==typeof Set?a:Set,"%SetIteratorPrototype%":"undefined"!=typeof Set&&u?h((new Set)[Symbol.iterator]()):a,"%SharedArrayBuffer%":"undefined"==typeof SharedArrayBuffer?a:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":u?h(""[Symbol.iterator]()):a,"%Symbol%":u?Symbol:a,"%SyntaxError%":n,"%ThrowTypeError%":d,"%TypedArray%":b,"%TypeError%":s,"%Uint8Array%":"undefined"==typeof Uint8Array?a:Uint8Array,"%Uint8ClampedArray%":"undefined"==typeof Uint8ClampedArray?a:Uint8ClampedArray,"%Uint16Array%":"undefined"==typeof Uint16Array?a:Uint16Array,"%Uint32Array%":"undefined"==typeof Uint32Array?a:Uint32Array,"%URIError%":URIError,"%WeakMap%":"undefined"==typeof WeakMap?a:WeakMap,"%WeakRef%":"undefined"==typeof WeakRef?a:WeakRef,"%WeakSet%":"undefined"==typeof WeakSet?a:WeakSet},p=function doEval(e){var t;if("%AsyncFunction%"===e)t=getEvalledConstructor("async function () {}");else if("%GeneratorFunction%"===e)t=getEvalledConstructor("function* () {}");else if("%AsyncGeneratorFunction%"===e)t=getEvalledConstructor("async function* () {}");else if("%AsyncGenerator%"===e){var r=doEval("%AsyncGeneratorFunction%");r&&(t=r.prototype)}else if("%AsyncIteratorPrototype%"===e){var a=doEval("%AsyncGenerator%");a&&(t=h(a.prototype))}return g[e]=t,t},B={"%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"]},m=r(415),I=r(175),y=m.call(Function.call,Array.prototype.concat),v=m.call(Function.apply,Array.prototype.splice),x=m.call(Function.call,String.prototype.replace),C=m.call(Function.call,String.prototype.slice),Q=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,w=/\\(\\)?/g,_=function stringToPath(e){var t=C(e,0,1),r=C(e,-1);if("%"===t&&"%"!==r)throw new n("invalid intrinsic syntax, expected closing `%`");if("%"===r&&"%"!==t)throw new n("invalid intrinsic syntax, expected opening `%`");var a=[];return x(e,Q,(function(e,t,r,n){a[a.length]=r?x(n,w,"$1"):t||e})),a},k=function getBaseIntrinsic(e,t){var r,a=e;if(I(B,a)&&(a="%"+(r=B[a])[0]+"%"),I(g,a)){var o=g[a];if(o===l&&(o=p(a)),void 0===o&&!t)throw new s("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:r,name:a,value:o}}throw new n("intrinsic "+e+" does not exist!")};e.exports=function GetIntrinsic(e,t){if("string"!=typeof e||0===e.length)throw new s("intrinsic name must be a non-empty string");if(arguments.length>1&&"boolean"!=typeof t)throw new s('"allowMissing" argument must be a boolean');var r=_(e),a=r.length>0?r[0]:"",o=k("%"+a+"%",t),d=o.name,u=o.value,h=!1,l=o.alias;l&&(a=l[0],v(r,y([0,1],l)));for(var b=1,p=!0;b=r.length){var Q=c(u,B);u=(p=!!Q)&&"get"in Q&&!("originalValue"in Q.get)?Q.get:u[B]}else p=I(u,B),u=u[B];p&&!h&&(g[d]=u)}}return u}},function(e,t,r){"use strict";var a=this&&this.__createBinding||(Object.create?function(e,t,r,a){void 0===a&&(a=r),Object.defineProperty(e,a,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,a){void 0===a&&(a=r),e[a]=t[r]}),n=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||a(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),n(r(20),t)},e=>{"function"==typeof Object.create?e.exports=function inherits(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:e.exports=function inherits(e,t){if(t){e.super_=t;var TempCtor=function(){};TempCtor.prototype=t.prototype,e.prototype=new TempCtor,e.prototype.constructor=e}}},function(e,t,r){"use strict";var a=this&&this.__createBinding||(Object.create?function(e,t,r,a){void 0===a&&(a=r),Object.defineProperty(e,a,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,a){void 0===a&&(a=r),e[a]=t[r]}),n=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||t.hasOwnProperty(r)||a(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),n(r(185),t),n(r(34),t),n(r(519),t),n(r(59),t),n(r(520),t),n(r(73),t),n(r(131),t),n(r(132),t),n(r(238),t),n(r(186),t)},()=>{},function(e,t,r){"use strict";var a=this&&this.__createBinding||(Object.create?function(e,t,r,a){void 0===a&&(a=r),Object.defineProperty(e,a,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,a){void 0===a&&(a=r),e[a]=t[r]}),n=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||a(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),n(r(342),t),n(r(353),t),n(r(521),t),n(r(1328),t),n(r(913),t),n(r(522),t),n(r(1329),t),n(r(1330),t),n(r(160),t),n(r(239),t),n(r(914),t),n(r(1331),t),n(r(1332),t)},(e,t,r)=>{var a=r(0),n=a.Buffer;function copyProps(e,t){for(var r in e)t[r]=e[r]}function SafeBuffer(e,t,r){return n(e,t,r)}n.from&&n.alloc&&n.allocUnsafe&&n.allocUnsafeSlow?e.exports=a:(copyProps(a,t),t.Buffer=SafeBuffer),SafeBuffer.prototype=Object.create(n.prototype),copyProps(n,SafeBuffer),SafeBuffer.from=function(e,t,r){if("number"==typeof e)throw new TypeError("Argument must not be a number");return n(e,t,r)},SafeBuffer.alloc=function(e,t,r){if("number"!=typeof e)throw new TypeError("Argument must be a number");var a=n(e);return void 0!==t?"string"==typeof r?a.fill(t,r):a.fill(t):a.fill(0),a},SafeBuffer.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return n(e)},SafeBuffer.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return a.SlowBuffer(e)}},function(e,t,r){"use strict";var a=this&&this.__createBinding||(Object.create?function(e,t,r,a){void 0===a&&(a=r),Object.defineProperty(e,a,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,a){void 0===a&&(a=r),e[a]=t[r]}),n=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||a(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),n(r(784),t),n(r(785),t),n(r(786),t),n(r(1271),t),n(r(1272),t),n(r(1274),t),n(r(500),t),n(r(1275),t),n(r(1276),t),n(r(1277),t),n(r(1278),t),n(r(847),t),n(r(1279),t),n(r(1280),t),n(r(1281),t),n(r(1282),t),n(r(1283),t)},e=>{"function"==typeof Object.create?e.exports=function inherits(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:e.exports=function inherits(e,t){if(t){e.super_=t;var TempCtor=function(){};TempCtor.prototype=t.prototype,e.prototype=new TempCtor,e.prototype.constructor=e}}},e=>{"function"==typeof Object.create?e.exports=function inherits(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:e.exports=function inherits(e,t){if(t){e.super_=t;var TempCtor=function(){};TempCtor.prototype=t.prototype,e.prototype=new TempCtor,e.prototype.constructor=e}}},e=>{"function"==typeof Object.create?e.exports=function inherits(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:e.exports=function inherits(e,t){if(t){e.super_=t;var TempCtor=function(){};TempCtor.prototype=t.prototype,e.prototype=new TempCtor,e.prototype.constructor=e}}},function(e,t,r){"use strict";var a=this&&this.__createBinding||(Object.create?function(e,t,r,a){void 0===a&&(a=r),Object.defineProperty(e,a,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,a){void 0===a&&(a=r),e[a]=t[r]}),n=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||a(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),n(r(1227),t),n(r(1229),t),n(r(256),t),n(r(1230),t),n(r(257),t),n(r(1231),t),n(r(723),t),n(r(722),t),n(r(122),t),n(r(1232),t),n(r(424),t),n(r(1234),t),n(r(430),t)},(e,t,r)=>{var a;function createDebug(e){function debug(){if(debug.enabled){var e=debug,r=+new Date,n=r-(a||r);e.diff=n,e.prev=a,e.curr=r,a=r;for(var o=new Array(arguments.length),s=0;s=65&&r<=70?r-55:r>=97&&r<=102?r-87:r-48&15}function parseHexByte(e,t,r){var a=parseHex4Bits(e,r);return r-1>=t&&(a|=parseHex4Bits(e,r-1)<<4),a}function parseBase(e,t,r,a){for(var n=0,o=Math.min(e.length,r),s=t;s=49?c-49+10:c>=17?c-17+10:c}return n}BN.isBN=function isBN(e){return e instanceof BN||null!==e&&"object"==typeof e&&e.constructor.wordSize===BN.wordSize&&Array.isArray(e.words)},BN.max=function max(e,t){return e.cmp(t)>0?e:t},BN.min=function min(e,t){return e.cmp(t)<0?e:t},BN.prototype._init=function init(e,t,r){if("number"==typeof e)return this._initNumber(e,t,r);if("object"==typeof e)return this._initArray(e,t,r);"hex"===t&&(t=16),assert(t===(0|t)&&t>=2&&t<=36);var a=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&(a++,this.negative=1),a=0;a-=3)o=e[a]|e[a-1]<<8|e[a-2]<<16,this.words[n]|=o<>>26-s&67108863,(s+=24)>=26&&(s-=26,n++);else if("le"===r)for(a=0,n=0;a>>26-s&67108863,(s+=24)>=26&&(s-=26,n++);return this.strip()},BN.prototype._parseHex=function _parseHex(e,t,r){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var a=0;a=t;a-=2)n=parseHexByte(e,t,a)<=18?(o-=18,s+=1,this.words[s]|=n>>>26):o+=8;else for(a=(e.length-t)%2==0?t+1:t;a=18?(o-=18,s+=1,this.words[s]|=n>>>26):o+=8;this.strip()},BN.prototype._parseBase=function _parseBase(e,t,r){this.words=[0],this.length=1;for(var a=0,n=1;n<=67108863;n*=t)a++;a--,n=n/t|0;for(var o=e.length-r,s=o%a,c=Math.min(o,o-s)+r,d=0,u=r;u1&&0===this.words[this.length-1];)this.length--;return this._normSign()},BN.prototype._normSign=function _normSign(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},BN.prototype.inspect=function inspect(){return(this.red?""};var n=["","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"],o=[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],s=[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 smallMulTo(e,t,r){r.negative=t.negative^e.negative;var a=e.length+t.length|0;r.length=a,a=a-1|0;var n=0|e.words[0],o=0|t.words[0],s=n*o,c=67108863&s,d=s/67108864|0;r.words[0]=c;for(var u=1;u>>26,l=67108863&d,b=Math.min(u,t.length-1),g=Math.max(0,u-e.length+1);g<=b;g++){var p=u-g|0;h+=(s=(n=0|e.words[p])*(o=0|t.words[g])+l)/67108864|0,l=67108863&s}r.words[u]=0|l,d=0|h}return 0!==d?r.words[u]=0|d:r.length--,r.strip()}BN.prototype.toString=function toString(e,t){var r;if(t=0|t||1,16===(e=e||10)||"hex"===e){r="";for(var a=0,c=0,d=0;d>>24-a&16777215)||d!==this.length-1?n[6-h.length]+h+r:h+r,(a+=2)>=26&&(a-=26,d--)}for(0!==c&&(r=c.toString(16)+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(e===(0|e)&&e>=2&&e<=36){var l=o[e],b=s[e];r="";var g=this.clone();for(g.negative=0;!g.isZero();){var p=g.modn(b).toString(e);r=(g=g.idivn(b)).isZero()?p+r:n[l-p.length]+p+r}for(this.isZero()&&(r="0"+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}assert(!1,"Base should be between 2 and 36")},BN.prototype.toNumber=function toNumber(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&assert(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},BN.prototype.toJSON=function toJSON(){return this.toString(16)},BN.prototype.toBuffer=function toBuffer(e,t){return assert(void 0!==a),this.toArrayLike(a,e,t)},BN.prototype.toArray=function toArray(e,t){return this.toArrayLike(Array,e,t)},BN.prototype.toArrayLike=function toArrayLike(e,t,r){var a=this.byteLength(),n=r||Math.max(1,a);assert(a<=n,"byte array longer than desired length"),assert(n>0,"Requested array length <= 0"),this.strip();var o,s,c="le"===t,d=new e(n),u=this.clone();if(c){for(s=0;!u.isZero();s++)o=u.andln(255),u.iushrn(8),d[s]=o;for(;s=4096&&(r+=13,t>>>=13),t>=64&&(r+=7,t>>>=7),t>=8&&(r+=4,t>>>=4),t>=2&&(r+=2,t>>>=2),r+t},BN.prototype._zeroBits=function _zeroBits(e){if(0===e)return 26;var t=e,r=0;return 0==(8191&t)&&(r+=13,t>>>=13),0==(127&t)&&(r+=7,t>>>=7),0==(15&t)&&(r+=4,t>>>=4),0==(3&t)&&(r+=2,t>>>=2),0==(1&t)&&r++,r},BN.prototype.bitLength=function bitLength(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},BN.prototype.zeroBits=function zeroBits(){if(this.isZero())return 0;for(var e=0,t=0;te.length?this.clone().ior(e):e.clone().ior(this)},BN.prototype.uor=function uor(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},BN.prototype.iuand=function iuand(e){var t;t=this.length>e.length?e:this;for(var r=0;re.length?this.clone().iand(e):e.clone().iand(this)},BN.prototype.uand=function uand(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},BN.prototype.iuxor=function iuxor(e){var t,r;this.length>e.length?(t=this,r=e):(t=e,r=this);for(var a=0;ae.length?this.clone().ixor(e):e.clone().ixor(this)},BN.prototype.uxor=function uxor(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},BN.prototype.inotn=function inotn(e){assert("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),r=e%26;this._expand(t),r>0&&t--;for(var a=0;a0&&(this.words[a]=~this.words[a]&67108863>>26-r),this.strip()},BN.prototype.notn=function notn(e){return this.clone().inotn(e)},BN.prototype.setn=function setn(e,t){assert("number"==typeof e&&e>=0);var r=e/26|0,a=e%26;return this._expand(r+1),this.words[r]=t?this.words[r]|1<e.length?(r=this,a=e):(r=e,a=this);for(var n=0,o=0;o>>26;for(;0!==n&&o>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;oe.length?this.clone().iadd(e):e.clone().iadd(this)},BN.prototype.isub=function isub(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var r,a,n=this.cmp(e);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,a=e):(r=e,a=this);for(var o=0,s=0;s>26,this.words[s]=67108863&t;for(;0!==o&&s>26,this.words[s]=67108863&t;if(0===o&&s>>13,g=0|s[1],p=8191&g,B=g>>>13,m=0|s[2],I=8191&m,y=m>>>13,v=0|s[3],x=8191&v,C=v>>>13,Q=0|s[4],w=8191&Q,_=Q>>>13,k=0|s[5],N=8191&k,D=k>>>13,U=0|s[6],G=8191&U,T=U>>>13,L=0|s[7],P=8191&L,q=L>>>13,O=0|s[8],H=8191&O,Y=O>>>13,j=0|s[9],J=8191&j,z=j>>>13,W=0|c[0],V=8191&W,X=W>>>13,$=0|c[1],et=8191&$,tt=$>>>13,rt=0|c[2],at=8191&rt,it=rt>>>13,nt=0|c[3],ot=8191&nt,At=nt>>>13,st=0|c[4],ct=8191&st,dt=st>>>13,ut=0|c[5],ht=8191&ut,bt=ut>>>13,pt=0|c[6],Bt=8191&pt,mt=pt>>>13,It=0|c[7],Et=8191&It,yt=It>>>13,vt=0|c[8],xt=8191&vt,Ct=vt>>>13,Qt=0|c[9],wt=8191&Qt,Mt=Qt>>>13;r.negative=e.negative^t.negative,r.length=19;var _t=(u+(a=Math.imul(l,V))|0)+((8191&(n=(n=Math.imul(l,X))+Math.imul(b,V)|0))<<13)|0;u=((o=Math.imul(b,X))+(n>>>13)|0)+(_t>>>26)|0,_t&=67108863,a=Math.imul(p,V),n=(n=Math.imul(p,X))+Math.imul(B,V)|0,o=Math.imul(B,X);var kt=(u+(a=a+Math.imul(l,et)|0)|0)+((8191&(n=(n=n+Math.imul(l,tt)|0)+Math.imul(b,et)|0))<<13)|0;u=((o=o+Math.imul(b,tt)|0)+(n>>>13)|0)+(kt>>>26)|0,kt&=67108863,a=Math.imul(I,V),n=(n=Math.imul(I,X))+Math.imul(y,V)|0,o=Math.imul(y,X),a=a+Math.imul(p,et)|0,n=(n=n+Math.imul(p,tt)|0)+Math.imul(B,et)|0,o=o+Math.imul(B,tt)|0;var St=(u+(a=a+Math.imul(l,at)|0)|0)+((8191&(n=(n=n+Math.imul(l,it)|0)+Math.imul(b,at)|0))<<13)|0;u=((o=o+Math.imul(b,it)|0)+(n>>>13)|0)+(St>>>26)|0,St&=67108863,a=Math.imul(x,V),n=(n=Math.imul(x,X))+Math.imul(C,V)|0,o=Math.imul(C,X),a=a+Math.imul(I,et)|0,n=(n=n+Math.imul(I,tt)|0)+Math.imul(y,et)|0,o=o+Math.imul(y,tt)|0,a=a+Math.imul(p,at)|0,n=(n=n+Math.imul(p,it)|0)+Math.imul(B,at)|0,o=o+Math.imul(B,it)|0;var Nt=(u+(a=a+Math.imul(l,ot)|0)|0)+((8191&(n=(n=n+Math.imul(l,At)|0)+Math.imul(b,ot)|0))<<13)|0;u=((o=o+Math.imul(b,At)|0)+(n>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,a=Math.imul(w,V),n=(n=Math.imul(w,X))+Math.imul(_,V)|0,o=Math.imul(_,X),a=a+Math.imul(x,et)|0,n=(n=n+Math.imul(x,tt)|0)+Math.imul(C,et)|0,o=o+Math.imul(C,tt)|0,a=a+Math.imul(I,at)|0,n=(n=n+Math.imul(I,it)|0)+Math.imul(y,at)|0,o=o+Math.imul(y,it)|0,a=a+Math.imul(p,ot)|0,n=(n=n+Math.imul(p,At)|0)+Math.imul(B,ot)|0,o=o+Math.imul(B,At)|0;var Dt=(u+(a=a+Math.imul(l,ct)|0)|0)+((8191&(n=(n=n+Math.imul(l,dt)|0)+Math.imul(b,ct)|0))<<13)|0;u=((o=o+Math.imul(b,dt)|0)+(n>>>13)|0)+(Dt>>>26)|0,Dt&=67108863,a=Math.imul(N,V),n=(n=Math.imul(N,X))+Math.imul(D,V)|0,o=Math.imul(D,X),a=a+Math.imul(w,et)|0,n=(n=n+Math.imul(w,tt)|0)+Math.imul(_,et)|0,o=o+Math.imul(_,tt)|0,a=a+Math.imul(x,at)|0,n=(n=n+Math.imul(x,it)|0)+Math.imul(C,at)|0,o=o+Math.imul(C,it)|0,a=a+Math.imul(I,ot)|0,n=(n=n+Math.imul(I,At)|0)+Math.imul(y,ot)|0,o=o+Math.imul(y,At)|0,a=a+Math.imul(p,ct)|0,n=(n=n+Math.imul(p,dt)|0)+Math.imul(B,ct)|0,o=o+Math.imul(B,dt)|0;var Rt=(u+(a=a+Math.imul(l,ht)|0)|0)+((8191&(n=(n=n+Math.imul(l,bt)|0)+Math.imul(b,ht)|0))<<13)|0;u=((o=o+Math.imul(b,bt)|0)+(n>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,a=Math.imul(G,V),n=(n=Math.imul(G,X))+Math.imul(T,V)|0,o=Math.imul(T,X),a=a+Math.imul(N,et)|0,n=(n=n+Math.imul(N,tt)|0)+Math.imul(D,et)|0,o=o+Math.imul(D,tt)|0,a=a+Math.imul(w,at)|0,n=(n=n+Math.imul(w,it)|0)+Math.imul(_,at)|0,o=o+Math.imul(_,it)|0,a=a+Math.imul(x,ot)|0,n=(n=n+Math.imul(x,At)|0)+Math.imul(C,ot)|0,o=o+Math.imul(C,At)|0,a=a+Math.imul(I,ct)|0,n=(n=n+Math.imul(I,dt)|0)+Math.imul(y,ct)|0,o=o+Math.imul(y,dt)|0,a=a+Math.imul(p,ht)|0,n=(n=n+Math.imul(p,bt)|0)+Math.imul(B,ht)|0,o=o+Math.imul(B,bt)|0;var Ft=(u+(a=a+Math.imul(l,Bt)|0)|0)+((8191&(n=(n=n+Math.imul(l,mt)|0)+Math.imul(b,Bt)|0))<<13)|0;u=((o=o+Math.imul(b,mt)|0)+(n>>>13)|0)+(Ft>>>26)|0,Ft&=67108863,a=Math.imul(P,V),n=(n=Math.imul(P,X))+Math.imul(q,V)|0,o=Math.imul(q,X),a=a+Math.imul(G,et)|0,n=(n=n+Math.imul(G,tt)|0)+Math.imul(T,et)|0,o=o+Math.imul(T,tt)|0,a=a+Math.imul(N,at)|0,n=(n=n+Math.imul(N,it)|0)+Math.imul(D,at)|0,o=o+Math.imul(D,it)|0,a=a+Math.imul(w,ot)|0,n=(n=n+Math.imul(w,At)|0)+Math.imul(_,ot)|0,o=o+Math.imul(_,At)|0,a=a+Math.imul(x,ct)|0,n=(n=n+Math.imul(x,dt)|0)+Math.imul(C,ct)|0,o=o+Math.imul(C,dt)|0,a=a+Math.imul(I,ht)|0,n=(n=n+Math.imul(I,bt)|0)+Math.imul(y,ht)|0,o=o+Math.imul(y,bt)|0,a=a+Math.imul(p,Bt)|0,n=(n=n+Math.imul(p,mt)|0)+Math.imul(B,Bt)|0,o=o+Math.imul(B,mt)|0;var Ut=(u+(a=a+Math.imul(l,Et)|0)|0)+((8191&(n=(n=n+Math.imul(l,yt)|0)+Math.imul(b,Et)|0))<<13)|0;u=((o=o+Math.imul(b,yt)|0)+(n>>>13)|0)+(Ut>>>26)|0,Ut&=67108863,a=Math.imul(H,V),n=(n=Math.imul(H,X))+Math.imul(Y,V)|0,o=Math.imul(Y,X),a=a+Math.imul(P,et)|0,n=(n=n+Math.imul(P,tt)|0)+Math.imul(q,et)|0,o=o+Math.imul(q,tt)|0,a=a+Math.imul(G,at)|0,n=(n=n+Math.imul(G,it)|0)+Math.imul(T,at)|0,o=o+Math.imul(T,it)|0,a=a+Math.imul(N,ot)|0,n=(n=n+Math.imul(N,At)|0)+Math.imul(D,ot)|0,o=o+Math.imul(D,At)|0,a=a+Math.imul(w,ct)|0,n=(n=n+Math.imul(w,dt)|0)+Math.imul(_,ct)|0,o=o+Math.imul(_,dt)|0,a=a+Math.imul(x,ht)|0,n=(n=n+Math.imul(x,bt)|0)+Math.imul(C,ht)|0,o=o+Math.imul(C,bt)|0,a=a+Math.imul(I,Bt)|0,n=(n=n+Math.imul(I,mt)|0)+Math.imul(y,Bt)|0,o=o+Math.imul(y,mt)|0,a=a+Math.imul(p,Et)|0,n=(n=n+Math.imul(p,yt)|0)+Math.imul(B,Et)|0,o=o+Math.imul(B,yt)|0;var Gt=(u+(a=a+Math.imul(l,xt)|0)|0)+((8191&(n=(n=n+Math.imul(l,Ct)|0)+Math.imul(b,xt)|0))<<13)|0;u=((o=o+Math.imul(b,Ct)|0)+(n>>>13)|0)+(Gt>>>26)|0,Gt&=67108863,a=Math.imul(J,V),n=(n=Math.imul(J,X))+Math.imul(z,V)|0,o=Math.imul(z,X),a=a+Math.imul(H,et)|0,n=(n=n+Math.imul(H,tt)|0)+Math.imul(Y,et)|0,o=o+Math.imul(Y,tt)|0,a=a+Math.imul(P,at)|0,n=(n=n+Math.imul(P,it)|0)+Math.imul(q,at)|0,o=o+Math.imul(q,it)|0,a=a+Math.imul(G,ot)|0,n=(n=n+Math.imul(G,At)|0)+Math.imul(T,ot)|0,o=o+Math.imul(T,At)|0,a=a+Math.imul(N,ct)|0,n=(n=n+Math.imul(N,dt)|0)+Math.imul(D,ct)|0,o=o+Math.imul(D,dt)|0,a=a+Math.imul(w,ht)|0,n=(n=n+Math.imul(w,bt)|0)+Math.imul(_,ht)|0,o=o+Math.imul(_,bt)|0,a=a+Math.imul(x,Bt)|0,n=(n=n+Math.imul(x,mt)|0)+Math.imul(C,Bt)|0,o=o+Math.imul(C,mt)|0,a=a+Math.imul(I,Et)|0,n=(n=n+Math.imul(I,yt)|0)+Math.imul(y,Et)|0,o=o+Math.imul(y,yt)|0,a=a+Math.imul(p,xt)|0,n=(n=n+Math.imul(p,Ct)|0)+Math.imul(B,xt)|0,o=o+Math.imul(B,Ct)|0;var Tt=(u+(a=a+Math.imul(l,wt)|0)|0)+((8191&(n=(n=n+Math.imul(l,Mt)|0)+Math.imul(b,wt)|0))<<13)|0;u=((o=o+Math.imul(b,Mt)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,a=Math.imul(J,et),n=(n=Math.imul(J,tt))+Math.imul(z,et)|0,o=Math.imul(z,tt),a=a+Math.imul(H,at)|0,n=(n=n+Math.imul(H,it)|0)+Math.imul(Y,at)|0,o=o+Math.imul(Y,it)|0,a=a+Math.imul(P,ot)|0,n=(n=n+Math.imul(P,At)|0)+Math.imul(q,ot)|0,o=o+Math.imul(q,At)|0,a=a+Math.imul(G,ct)|0,n=(n=n+Math.imul(G,dt)|0)+Math.imul(T,ct)|0,o=o+Math.imul(T,dt)|0,a=a+Math.imul(N,ht)|0,n=(n=n+Math.imul(N,bt)|0)+Math.imul(D,ht)|0,o=o+Math.imul(D,bt)|0,a=a+Math.imul(w,Bt)|0,n=(n=n+Math.imul(w,mt)|0)+Math.imul(_,Bt)|0,o=o+Math.imul(_,mt)|0,a=a+Math.imul(x,Et)|0,n=(n=n+Math.imul(x,yt)|0)+Math.imul(C,Et)|0,o=o+Math.imul(C,yt)|0,a=a+Math.imul(I,xt)|0,n=(n=n+Math.imul(I,Ct)|0)+Math.imul(y,xt)|0,o=o+Math.imul(y,Ct)|0;var Lt=(u+(a=a+Math.imul(p,wt)|0)|0)+((8191&(n=(n=n+Math.imul(p,Mt)|0)+Math.imul(B,wt)|0))<<13)|0;u=((o=o+Math.imul(B,Mt)|0)+(n>>>13)|0)+(Lt>>>26)|0,Lt&=67108863,a=Math.imul(J,at),n=(n=Math.imul(J,it))+Math.imul(z,at)|0,o=Math.imul(z,it),a=a+Math.imul(H,ot)|0,n=(n=n+Math.imul(H,At)|0)+Math.imul(Y,ot)|0,o=o+Math.imul(Y,At)|0,a=a+Math.imul(P,ct)|0,n=(n=n+Math.imul(P,dt)|0)+Math.imul(q,ct)|0,o=o+Math.imul(q,dt)|0,a=a+Math.imul(G,ht)|0,n=(n=n+Math.imul(G,bt)|0)+Math.imul(T,ht)|0,o=o+Math.imul(T,bt)|0,a=a+Math.imul(N,Bt)|0,n=(n=n+Math.imul(N,mt)|0)+Math.imul(D,Bt)|0,o=o+Math.imul(D,mt)|0,a=a+Math.imul(w,Et)|0,n=(n=n+Math.imul(w,yt)|0)+Math.imul(_,Et)|0,o=o+Math.imul(_,yt)|0,a=a+Math.imul(x,xt)|0,n=(n=n+Math.imul(x,Ct)|0)+Math.imul(C,xt)|0,o=o+Math.imul(C,Ct)|0;var Pt=(u+(a=a+Math.imul(I,wt)|0)|0)+((8191&(n=(n=n+Math.imul(I,Mt)|0)+Math.imul(y,wt)|0))<<13)|0;u=((o=o+Math.imul(y,Mt)|0)+(n>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,a=Math.imul(J,ot),n=(n=Math.imul(J,At))+Math.imul(z,ot)|0,o=Math.imul(z,At),a=a+Math.imul(H,ct)|0,n=(n=n+Math.imul(H,dt)|0)+Math.imul(Y,ct)|0,o=o+Math.imul(Y,dt)|0,a=a+Math.imul(P,ht)|0,n=(n=n+Math.imul(P,bt)|0)+Math.imul(q,ht)|0,o=o+Math.imul(q,bt)|0,a=a+Math.imul(G,Bt)|0,n=(n=n+Math.imul(G,mt)|0)+Math.imul(T,Bt)|0,o=o+Math.imul(T,mt)|0,a=a+Math.imul(N,Et)|0,n=(n=n+Math.imul(N,yt)|0)+Math.imul(D,Et)|0,o=o+Math.imul(D,yt)|0,a=a+Math.imul(w,xt)|0,n=(n=n+Math.imul(w,Ct)|0)+Math.imul(_,xt)|0,o=o+Math.imul(_,Ct)|0;var qt=(u+(a=a+Math.imul(x,wt)|0)|0)+((8191&(n=(n=n+Math.imul(x,Mt)|0)+Math.imul(C,wt)|0))<<13)|0;u=((o=o+Math.imul(C,Mt)|0)+(n>>>13)|0)+(qt>>>26)|0,qt&=67108863,a=Math.imul(J,ct),n=(n=Math.imul(J,dt))+Math.imul(z,ct)|0,o=Math.imul(z,dt),a=a+Math.imul(H,ht)|0,n=(n=n+Math.imul(H,bt)|0)+Math.imul(Y,ht)|0,o=o+Math.imul(Y,bt)|0,a=a+Math.imul(P,Bt)|0,n=(n=n+Math.imul(P,mt)|0)+Math.imul(q,Bt)|0,o=o+Math.imul(q,mt)|0,a=a+Math.imul(G,Et)|0,n=(n=n+Math.imul(G,yt)|0)+Math.imul(T,Et)|0,o=o+Math.imul(T,yt)|0,a=a+Math.imul(N,xt)|0,n=(n=n+Math.imul(N,Ct)|0)+Math.imul(D,xt)|0,o=o+Math.imul(D,Ct)|0;var Ot=(u+(a=a+Math.imul(w,wt)|0)|0)+((8191&(n=(n=n+Math.imul(w,Mt)|0)+Math.imul(_,wt)|0))<<13)|0;u=((o=o+Math.imul(_,Mt)|0)+(n>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,a=Math.imul(J,ht),n=(n=Math.imul(J,bt))+Math.imul(z,ht)|0,o=Math.imul(z,bt),a=a+Math.imul(H,Bt)|0,n=(n=n+Math.imul(H,mt)|0)+Math.imul(Y,Bt)|0,o=o+Math.imul(Y,mt)|0,a=a+Math.imul(P,Et)|0,n=(n=n+Math.imul(P,yt)|0)+Math.imul(q,Et)|0,o=o+Math.imul(q,yt)|0,a=a+Math.imul(G,xt)|0,n=(n=n+Math.imul(G,Ct)|0)+Math.imul(T,xt)|0,o=o+Math.imul(T,Ct)|0;var Ht=(u+(a=a+Math.imul(N,wt)|0)|0)+((8191&(n=(n=n+Math.imul(N,Mt)|0)+Math.imul(D,wt)|0))<<13)|0;u=((o=o+Math.imul(D,Mt)|0)+(n>>>13)|0)+(Ht>>>26)|0,Ht&=67108863,a=Math.imul(J,Bt),n=(n=Math.imul(J,mt))+Math.imul(z,Bt)|0,o=Math.imul(z,mt),a=a+Math.imul(H,Et)|0,n=(n=n+Math.imul(H,yt)|0)+Math.imul(Y,Et)|0,o=o+Math.imul(Y,yt)|0,a=a+Math.imul(P,xt)|0,n=(n=n+Math.imul(P,Ct)|0)+Math.imul(q,xt)|0,o=o+Math.imul(q,Ct)|0;var Yt=(u+(a=a+Math.imul(G,wt)|0)|0)+((8191&(n=(n=n+Math.imul(G,Mt)|0)+Math.imul(T,wt)|0))<<13)|0;u=((o=o+Math.imul(T,Mt)|0)+(n>>>13)|0)+(Yt>>>26)|0,Yt&=67108863,a=Math.imul(J,Et),n=(n=Math.imul(J,yt))+Math.imul(z,Et)|0,o=Math.imul(z,yt),a=a+Math.imul(H,xt)|0,n=(n=n+Math.imul(H,Ct)|0)+Math.imul(Y,xt)|0,o=o+Math.imul(Y,Ct)|0;var jt=(u+(a=a+Math.imul(P,wt)|0)|0)+((8191&(n=(n=n+Math.imul(P,Mt)|0)+Math.imul(q,wt)|0))<<13)|0;u=((o=o+Math.imul(q,Mt)|0)+(n>>>13)|0)+(jt>>>26)|0,jt&=67108863,a=Math.imul(J,xt),n=(n=Math.imul(J,Ct))+Math.imul(z,xt)|0,o=Math.imul(z,Ct);var Jt=(u+(a=a+Math.imul(H,wt)|0)|0)+((8191&(n=(n=n+Math.imul(H,Mt)|0)+Math.imul(Y,wt)|0))<<13)|0;u=((o=o+Math.imul(Y,Mt)|0)+(n>>>13)|0)+(Jt>>>26)|0,Jt&=67108863;var Kt=(u+(a=Math.imul(J,wt))|0)+((8191&(n=(n=Math.imul(J,Mt))+Math.imul(z,wt)|0))<<13)|0;return u=((o=Math.imul(z,Mt))+(n>>>13)|0)+(Kt>>>26)|0,Kt&=67108863,d[0]=_t,d[1]=kt,d[2]=St,d[3]=Nt,d[4]=Dt,d[5]=Rt,d[6]=Ft,d[7]=Ut,d[8]=Gt,d[9]=Tt,d[10]=Lt,d[11]=Pt,d[12]=qt,d[13]=Ot,d[14]=Ht,d[15]=Yt,d[16]=jt,d[17]=Jt,d[18]=Kt,0!==u&&(d[19]=u,r.length++),r};function jumboMulTo(e,t,r){return(new FFTM).mulp(e,t,r)}function FFTM(e,t){this.x=e,this.y=t}Math.imul||(c=smallMulTo),BN.prototype.mulTo=function mulTo(e,t){var r=this.length+e.length;return 10===this.length&&10===e.length?c(this,e,t):r<63?smallMulTo(this,e,t):r<1024?function bigMulTo(e,t,r){r.negative=t.negative^e.negative,r.length=e.length+t.length;for(var a=0,n=0,o=0;o>>26)|0)>>>26,s&=67108863}r.words[o]=c,a=s,s=n}return 0!==a?r.words[o]=a:r.length--,r.strip()}(this,e,t):jumboMulTo(this,e,t)},FFTM.prototype.makeRBT=function makeRBT(e){for(var t=new Array(e),r=BN.prototype._countBits(e)-1,a=0;a>=1;return a},FFTM.prototype.permute=function permute(e,t,r,a,n,o){for(var s=0;s>>=1)n++;return 1<>>=13,r[2*o+1]=8191&n,n>>>=13;for(o=2*t;o>=26,t+=a/67108864|0,t+=n>>>26,this.words[r]=67108863&n}return 0!==t&&(this.words[r]=t,this.length++),this},BN.prototype.muln=function muln(e){return this.clone().imuln(e)},BN.prototype.sqr=function sqr(){return this.mul(this)},BN.prototype.isqr=function isqr(){return this.imul(this.clone())},BN.prototype.pow=function pow(e){var t=function toBitArray(e){for(var t=new Array(e.bitLength()),r=0;r>>n}return t}(e);if(0===t.length)return new BN(1);for(var r=this,a=0;a=0);var t,r=e%26,a=(e-r)/26,n=67108863>>>26-r<<26-r;if(0!==r){var o=0;for(t=0;t>>26-r}o&&(this.words[t]=o,this.length++)}if(0!==a){for(t=this.length-1;t>=0;t--)this.words[t+a]=this.words[t];for(t=0;t=0),a=t?(t-t%26)/26:0;var n=e%26,o=Math.min((e-n)/26,this.length),s=67108863^67108863>>>n<o)for(this.length-=o,d=0;d=0&&(0!==u||d>=a);d--){var h=0|this.words[d];this.words[d]=u<<26-n|h>>>n,u=h&s}return c&&0!==u&&(c.words[c.length++]=u),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},BN.prototype.ishrn=function ishrn(e,t,r){return assert(0===this.negative),this.iushrn(e,t,r)},BN.prototype.shln=function shln(e){return this.clone().ishln(e)},BN.prototype.ushln=function ushln(e){return this.clone().iushln(e)},BN.prototype.shrn=function shrn(e){return this.clone().ishrn(e)},BN.prototype.ushrn=function ushrn(e){return this.clone().iushrn(e)},BN.prototype.testn=function testn(e){assert("number"==typeof e&&e>=0);var t=e%26,r=(e-t)/26,a=1<=0);var t=e%26,r=(e-t)/26;if(assert(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==t&&r++,this.length=Math.min(r,this.length),0!==t){var a=67108863^67108863>>>t<=67108864;t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},BN.prototype.isubn=function isubn(e){if(assert("number"==typeof e),assert(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t>26)-(c/67108864|0),this.words[a+r]=67108863&n}for(;a>26,this.words[a+r]=67108863&n;if(0===s)return this.strip();for(assert(-1===s),s=0,a=0;a>26,this.words[a]=67108863&n;return this.negative=1,this.strip()},BN.prototype._wordDiv=function _wordDiv(e,t){var r=(this.length,e.length),a=this.clone(),n=e,o=0|n.words[n.length-1];0!==(r=26-this._countBits(o))&&(n=n.ushln(r),a.iushln(r),o=0|n.words[n.length-1]);var s,c=a.length-n.length;if("mod"!==t){(s=new BN(null)).length=c+1,s.words=new Array(s.length);for(var d=0;d=0;h--){var l=67108864*(0|a.words[n.length+h])+(0|a.words[n.length+h-1]);for(l=Math.min(l/o|0,67108863),a._ishlnsubmul(n,l,h);0!==a.negative;)l--,a.negative=0,a._ishlnsubmul(n,1,h),a.isZero()||(a.negative^=1);s&&(s.words[h]=l)}return s&&s.strip(),a.strip(),"div"!==t&&0!==r&&a.iushrn(r),{div:s||null,mod:a}},BN.prototype.divmod=function divmod(e,t,r){return assert(!e.isZero()),this.isZero()?{div:new BN(0),mod:new BN(0)}:0!==this.negative&&0===e.negative?(o=this.neg().divmod(e,t),"mod"!==t&&(a=o.div.neg()),"div"!==t&&(n=o.mod.neg(),r&&0!==n.negative&&n.iadd(e)),{div:a,mod:n}):0===this.negative&&0!==e.negative?(o=this.divmod(e.neg(),t),"mod"!==t&&(a=o.div.neg()),{div:a,mod:o.mod}):0!=(this.negative&e.negative)?(o=this.neg().divmod(e.neg(),t),"div"!==t&&(n=o.mod.neg(),r&&0!==n.negative&&n.isub(e)),{div:o.div,mod:n}):e.length>this.length||this.cmp(e)<0?{div:new BN(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new BN(this.modn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new BN(this.modn(e.words[0]))}:this._wordDiv(e,t);var a,n,o},BN.prototype.div=function div(e){return this.divmod(e,"div",!1).div},BN.prototype.mod=function mod(e){return this.divmod(e,"mod",!1).mod},BN.prototype.umod=function umod(e){return this.divmod(e,"mod",!0).mod},BN.prototype.divRound=function divRound(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var r=0!==t.div.negative?t.mod.isub(e):t.mod,a=e.ushrn(1),n=e.andln(1),o=r.cmp(a);return o<0||1===n&&0===o?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},BN.prototype.modn=function modn(e){assert(e<=67108863);for(var t=(1<<26)%e,r=0,a=this.length-1;a>=0;a--)r=(t*r+(0|this.words[a]))%e;return r},BN.prototype.idivn=function idivn(e){assert(e<=67108863);for(var t=0,r=this.length-1;r>=0;r--){var a=(0|this.words[r])+67108864*t;this.words[r]=a/e|0,t=a%e}return this.strip()},BN.prototype.divn=function divn(e){return this.clone().idivn(e)},BN.prototype.egcd=function egcd(e){assert(0===e.negative),assert(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var a=new BN(1),n=new BN(0),o=new BN(0),s=new BN(1),c=0;t.isEven()&&r.isEven();)t.iushrn(1),r.iushrn(1),++c;for(var d=r.clone(),u=t.clone();!t.isZero();){for(var h=0,l=1;0==(t.words[0]&l)&&h<26;++h,l<<=1);if(h>0)for(t.iushrn(h);h-- >0;)(a.isOdd()||n.isOdd())&&(a.iadd(d),n.isub(u)),a.iushrn(1),n.iushrn(1);for(var b=0,g=1;0==(r.words[0]&g)&&b<26;++b,g<<=1);if(b>0)for(r.iushrn(b);b-- >0;)(o.isOdd()||s.isOdd())&&(o.iadd(d),s.isub(u)),o.iushrn(1),s.iushrn(1);t.cmp(r)>=0?(t.isub(r),a.isub(o),n.isub(s)):(r.isub(t),o.isub(a),s.isub(n))}return{a:o,b:s,gcd:r.iushln(c)}},BN.prototype._invmp=function _invmp(e){assert(0===e.negative),assert(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var a,n=new BN(1),o=new BN(0),s=r.clone();t.cmpn(1)>0&&r.cmpn(1)>0;){for(var c=0,d=1;0==(t.words[0]&d)&&c<26;++c,d<<=1);if(c>0)for(t.iushrn(c);c-- >0;)n.isOdd()&&n.iadd(s),n.iushrn(1);for(var u=0,h=1;0==(r.words[0]&h)&&u<26;++u,h<<=1);if(u>0)for(r.iushrn(u);u-- >0;)o.isOdd()&&o.iadd(s),o.iushrn(1);t.cmp(r)>=0?(t.isub(r),n.isub(o)):(r.isub(t),o.isub(n))}return(a=0===t.cmpn(1)?n:o).cmpn(0)<0&&a.iadd(e),a},BN.prototype.gcd=function gcd(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),r=e.clone();t.negative=0,r.negative=0;for(var a=0;t.isEven()&&r.isEven();a++)t.iushrn(1),r.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=t.cmp(r);if(n<0){var o=t;t=r,r=o}else if(0===n||0===r.cmpn(1))break;t.isub(r)}return r.iushln(a)},BN.prototype.invm=function invm(e){return this.egcd(e).a.umod(e)},BN.prototype.isEven=function isEven(){return 0==(1&this.words[0])},BN.prototype.isOdd=function isOdd(){return 1==(1&this.words[0])},BN.prototype.andln=function andln(e){return this.words[0]&e},BN.prototype.bincn=function bincn(e){assert("number"==typeof e);var t=e%26,r=(e-t)/26,a=1<>>26,s&=67108863,this.words[o]=s}return 0!==n&&(this.words[o]=n,this.length++),this},BN.prototype.isZero=function isZero(){return 1===this.length&&0===this.words[0]},BN.prototype.cmpn=function cmpn(e){var t,r=e<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this.strip(),this.length>1)t=1;else{r&&(e=-e),assert(e<=67108863,"Number is too big");var a=0|this.words[0];t=a===e?0:ae.length)return 1;if(this.length=0;r--){var a=0|this.words[r],n=0|e.words[r];if(a!==n){an&&(t=1);break}}return t},BN.prototype.gtn=function gtn(e){return 1===this.cmpn(e)},BN.prototype.gt=function gt(e){return 1===this.cmp(e)},BN.prototype.gten=function gten(e){return this.cmpn(e)>=0},BN.prototype.gte=function gte(e){return this.cmp(e)>=0},BN.prototype.ltn=function ltn(e){return-1===this.cmpn(e)},BN.prototype.lt=function lt(e){return-1===this.cmp(e)},BN.prototype.lten=function lten(e){return this.cmpn(e)<=0},BN.prototype.lte=function lte(e){return this.cmp(e)<=0},BN.prototype.eqn=function eqn(e){return 0===this.cmpn(e)},BN.prototype.eq=function eq(e){return 0===this.cmp(e)},BN.red=function red(e){return new Red(e)},BN.prototype.toRed=function toRed(e){return assert(!this.red,"Already a number in reduction context"),assert(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},BN.prototype.fromRed=function fromRed(){return assert(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},BN.prototype._forceRed=function _forceRed(e){return this.red=e,this},BN.prototype.forceRed=function forceRed(e){return assert(!this.red,"Already a number in reduction context"),this._forceRed(e)},BN.prototype.redAdd=function redAdd(e){return assert(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},BN.prototype.redIAdd=function redIAdd(e){return assert(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},BN.prototype.redSub=function redSub(e){return assert(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},BN.prototype.redISub=function redISub(e){return assert(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},BN.prototype.redShl=function redShl(e){return assert(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},BN.prototype.redMul=function redMul(e){return assert(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},BN.prototype.redIMul=function redIMul(e){return assert(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},BN.prototype.redSqr=function redSqr(){return assert(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},BN.prototype.redISqr=function redISqr(){return assert(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},BN.prototype.redSqrt=function redSqrt(){return assert(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},BN.prototype.redInvm=function redInvm(){return assert(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},BN.prototype.redNeg=function redNeg(){return assert(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},BN.prototype.redPow=function redPow(e){return assert(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var d={k256:null,p224:null,p192:null,p25519:null};function MPrime(e,t){this.name=e,this.p=new BN(t,16),this.n=this.p.bitLength(),this.k=new BN(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function K256(){MPrime.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function P224(){MPrime.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function P192(){MPrime.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function P25519(){MPrime.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function Red(e){if("string"==typeof e){var t=BN._prime(e);this.m=t.p,this.prime=t}else assert(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function Mont(e){Red.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new BN(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)}MPrime.prototype._tmp=function _tmp(){var e=new BN(null);return e.words=new Array(Math.ceil(this.n/13)),e},MPrime.prototype.ireduce=function ireduce(e){var t,r=e;do{this.split(r,this.tmp),t=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(t>this.n);var a=t0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},MPrime.prototype.split=function split(e,t){e.iushrn(this.n,0,t)},MPrime.prototype.imulK=function imulK(e){return e.imul(this.k)},inherits(K256,MPrime),K256.prototype.split=function split(e,t){for(var r=4194303,a=Math.min(e.length,9),n=0;n>>22,o=s}o>>>=22,e.words[n-10]=o,0===o&&e.length>10?e.length-=10:e.length-=9},K256.prototype.imulK=function imulK(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,r=0;r>>=26,e.words[r]=n,t=a}return 0!==t&&(e.words[e.length++]=t),e},BN._prime=function prime(e){if(d[e])return d[e];var prime;if("k256"===e)prime=new K256;else if("p224"===e)prime=new P224;else if("p192"===e)prime=new P192;else{if("p25519"!==e)throw new Error("Unknown prime "+e);prime=new P25519}return d[e]=prime,prime},Red.prototype._verify1=function _verify1(e){assert(0===e.negative,"red works only with positives"),assert(e.red,"red works only with red numbers")},Red.prototype._verify2=function _verify2(e,t){assert(0==(e.negative|t.negative),"red works only with positives"),assert(e.red&&e.red===t.red,"red works only with red numbers")},Red.prototype.imod=function imod(e){return this.prime?this.prime.ireduce(e)._forceRed(this):e.umod(this.m)._forceRed(this)},Red.prototype.neg=function neg(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},Red.prototype.add=function add(e,t){this._verify2(e,t);var r=e.add(t);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},Red.prototype.iadd=function iadd(e,t){this._verify2(e,t);var r=e.iadd(t);return r.cmp(this.m)>=0&&r.isub(this.m),r},Red.prototype.sub=function sub(e,t){this._verify2(e,t);var r=e.sub(t);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},Red.prototype.isub=function isub(e,t){this._verify2(e,t);var r=e.isub(t);return r.cmpn(0)<0&&r.iadd(this.m),r},Red.prototype.shl=function shl(e,t){return this._verify1(e),this.imod(e.ushln(t))},Red.prototype.imul=function imul(e,t){return this._verify2(e,t),this.imod(e.imul(t))},Red.prototype.mul=function mul(e,t){return this._verify2(e,t),this.imod(e.mul(t))},Red.prototype.isqr=function isqr(e){return this.imul(e,e.clone())},Red.prototype.sqr=function sqr(e){return this.mul(e,e)},Red.prototype.sqrt=function sqrt(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(assert(t%2==1),3===t){var r=this.m.add(new BN(1)).iushrn(2);return this.pow(e,r)}for(var a=this.m.subn(1),n=0;!a.isZero()&&0===a.andln(1);)n++,a.iushrn(1);assert(!a.isZero());var o=new BN(1).toRed(this),s=o.redNeg(),c=this.m.subn(1).iushrn(1),d=this.m.bitLength();for(d=new BN(2*d*d).toRed(this);0!==this.pow(d,c).cmp(s);)d.redIAdd(s);for(var u=this.pow(d,a),h=this.pow(e,a.addn(1).iushrn(1)),l=this.pow(e,a),b=n;0!==l.cmp(o);){for(var g=l,p=0;0!==g.cmp(o);p++)g=g.redSqr();assert(p=0;a--){for(var d=t.words[a],u=c-1;u>=0;u--){var h=d>>u&1;n!==r[0]&&(n=this.sqr(n)),0!==h||0!==o?(o<<=1,o|=h,(4===++s||0===a&&0===u)&&(n=this.mul(n,r[o]),s=0,o=0)):s=0}c=26}return n},Red.prototype.convertTo=function convertTo(e){var t=e.umod(this.m);return t===e?t.clone():t},Red.prototype.convertFrom=function convertFrom(e){var t=e.clone();return t.red=null,t},BN.mont=function mont(e){return new Mont(e)},inherits(Mont,Red),Mont.prototype.convertTo=function convertTo(e){return this.imod(e.ushln(this.shift))},Mont.prototype.convertFrom=function convertFrom(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},Mont.prototype.imul=function imul(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var r=e.imul(t),a=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(a).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},Mont.prototype.mul=function mul(e,t){if(e.isZero()||t.isZero())return new BN(0)._forceRed(this);var r=e.mul(t),a=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(a).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},Mont.prototype.invm=function invm(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(e=r.nmd(e),this)},function(e,t,r){"use strict";var a=r(0).Buffer,n=this&&this.__assign||function(){return(n=Object.assign||function(e){for(var t,r=1,a=arguments.length;r0&&n[n.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!n||o[1]>n[0]&&o[1]=e.length&&(e=void 0),{value:e&&e[a++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},l=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var a,n,o=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(a=o.next()).done;)s.push(a.value)}catch(e){n={error:e}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return s},b=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.generateTxReceipt=t.encodeReceipt=t.rewardAccount=t.calculateMinerReward=void 0;var g=r(49),p=r(41),B=r(166),m=r(5),I=r(54),y=b(r(303)),v=r(106),x=r(143),C=c(r(1466)),Q=g.debug("vm:block"),w=C.DAOAccounts,_=C.DAORefundContract;function applyBlock(e,t){return d(this,void 0,void 0,(function(){var r;return u(this,(function(a){switch(a.label){case 0:if(t.skipBlockValidation)return[3,3];if(!e.header.gasLimit.gte(new m.BN("8000000000000000",16)))return[3,1];throw new Error("Invalid block with gas limit greater than (2^63 - 1)");case 1:return this.DEBUG&&Q("Validate block"),[4,e.validate(this.blockchain)];case 2:a.sent(),a.label=3;case 3:return this.DEBUG&&Q("Apply transactions"),[4,applyTransactions.bind(this)(e,t)];case 4:return r=a.sent(),"pow"!==this._common.consensusType()?[3,6]:[4,assignBlockRewards.bind(this)(e)];case 5:a.sent(),a.label=6;case 6:return[2,r]}}))}))}function applyTransactions(e,t){return d(this,void 0,void 0,(function(){var r,a,n,o,s,c,d,h,l,b,g,I;return u(this,(function(u){switch(u.label){case 0:r=new y.default,a=new m.BN(0),n=new B.BaseTrie,o=[],s=[],c=0,u.label=1;case 1:if(!(c "+a+")"),r.or(g.bloom),o.push(g.receipt),I=encodeReceipt(d,g.receipt),[4,n.put(p.encode(c),I)];case 3:u.sent(),u.label=4;case 4:return c++,[3,1];case 5:return[2,{bloom:r,gasUsed:a,receiptRoot:n.root,receipts:o,results:s}]}}))}))}function assignBlockRewards(e){return d(this,void 0,void 0,(function(){var t,r,a,n,o,s,c,d,l,b,g,p,B;return u(this,(function(u){switch(u.label){case 0:this.DEBUG&&Q("Assign block rewards"),t=this.stateManager,r=new m.BN(this._common.param("pow","minerReward")),a=e.uncleHeaders,u.label=1;case 1:u.trys.push([1,6,7,8]),n=h(a),o=n.next(),u.label=2;case 2:return o.done?[3,5]:(s=o.value,c=function calculateOmmerReward(e,t,r){var a=t.sub(e),n=new m.BN(8).sub(a).mul(r.divn(8));n.ltn(0)&&(n=new m.BN(0));return n}(s.number,e.header.number,r),[4,rewardAccount(t,s.coinbase,c)]);case 3:d=u.sent(),this.DEBUG&&Q("Add uncle reward "+c+" to account "+s.coinbase+" (-> "+d.balance+")"),u.label=4;case 4:return o=n.next(),[3,2];case 5:return[3,8];case 6:return l=u.sent(),p={error:l},[3,8];case 7:try{o&&!o.done&&(B=n.return)&&B.call(n)}finally{if(p)throw p.error}return[7];case 8:return b=calculateMinerReward(r,a.length),[4,rewardAccount(t,e.header.coinbase,b)];case 9:return g=u.sent(),this.DEBUG&&Q("Add miner reward "+b+" to account "+e.header.coinbase+" (-> "+g.balance+")"),[2]}}))}))}function calculateMinerReward(e,t){var r=e.divn(32).muln(t);return e.add(r)}function rewardAccount(e,t,r){return d(this,void 0,void 0,(function(){var a;return u(this,(function(n){switch(n.label){case 0:return[4,e.getAccount(t)];case 1:return(a=n.sent()).balance.iadd(r),[4,e.putAccount(t,a)];case 2:return n.sent(),[2,a]}}))}))}function encodeReceipt(e,t){var r=p.encode(Object.values(t));if(!e.supports(x.Capability.EIP2718TypedTransaction))return r;var n=m.intToBuffer(e.type);return a.concat([n,r])}function _applyDAOHardfork(e){return d(this,void 0,void 0,(function(){var t,r,n,o,s,c,d,l,b,g;return u(this,(function(u){switch(u.label){case 0:return t=new m.Address(a.from(_,"hex")),e.accountExists(t)?[3,2]:[4,e.putAccount(t,new m.Account)];case 1:u.sent(),u.label=2;case 2:return[4,e.getAccount(t)];case 3:r=u.sent(),u.label=4;case 4:u.trys.push([4,10,11,12]),n=h(w),o=n.next(),u.label=5;case 5:return o.done?[3,9]:(s=o.value,c=new m.Address(a.from(s,"hex")),[4,e.getAccount(c)]);case 6:return d=u.sent(),r.balance.iadd(d.balance),d.balance=new m.BN(0),[4,e.putAccount(c,d)];case 7:u.sent(),u.label=8;case 8:return o=n.next(),[3,5];case 9:return[3,12];case 10:return l=u.sent(),b={error:l},[3,12];case 11:try{o&&!o.done&&(g=n.return)&&g.call(n)}finally{if(b)throw b.error}return[7];case 12:return[4,e.putAccount(t,r)];case 13:return u.sent(),[2]}}))}))}function _genTxTrie(e){return d(this,void 0,void 0,(function(){var t,r,a,n,o,s,c,d,b;return u(this,(function(u){switch(u.label){case 0:t=new B.BaseTrie,u.label=1;case 1:u.trys.push([1,6,7,8]),r=h(e.transactions.entries()),a=r.next(),u.label=2;case 2:return a.done?[3,5]:(n=l(a.value,2),o=n[0],s=n[1],[4,t.put(p.encode(o),s.serialize())]);case 3:u.sent(),u.label=4;case 4:return a=r.next(),[3,2];case 5:return[3,8];case 6:return c=u.sent(),d={error:c},[3,8];case 7:try{a&&!a.done&&(b=r.return)&&b.call(r)}finally{if(d)throw d.error}return[7];case 8:return[2,t.root]}}))}))}t.default=function runBlock(e){return d(this,void 0,void 0,(function(){var t,r,a,o,s,c,d,h,l,b,g,p,B,m,y;return u(this,(function(u){switch(u.label){case 0:return t=this.stateManager,r=e.root,a=e.block,o=!!e.generate,[4,this._emit("beforeBlock",a)];case 1:return u.sent(),this._hardforkByBlockNumber&&this._common.setHardforkByBlockNumber(a.header.number.toNumber()),this.DEBUG&&(Q("-".repeat(100)),Q("Running block hash="+a.hash().toString("hex")+" number="+a.header.number.toNumber()+" hardfork="+this._common.hardfork())),r?(this.DEBUG&&Q("Set provided state root "+r.toString("hex")),[4,t.setStateRoot(r)]):[3,3];case 2:u.sent(),u.label=3;case 3:return this._common.hardforkIsActiveOnChain("dao")&&a.header.number.eq(this._common.hardforkBlockBN("dao"))?(this.DEBUG&&Q("Apply DAO hardfork"),[4,_applyDAOHardfork(t)]):[3,5];case 4:u.sent(),u.label=5;case 5:return[4,t.checkpoint()];case 6:u.sent(),this.DEBUG&&Q("block checkpoint"),u.label=7;case 7:return u.trys.push([7,9,,11]),[4,applyBlock.bind(this)(a,e)];case 8:return s=u.sent(),this.DEBUG&&Q("Received block results gasUsed="+s.gasUsed+" bloom="+v.short(s.bloom.bitvector)+" ("+s.bloom.bitvector.length+" bytes) receiptRoot="+s.receiptRoot.toString("hex")+" receipts="+s.receipts.length+" txResults="+s.results.length),[3,11];case 9:return c=u.sent(),[4,t.revert()];case 10:throw u.sent(),this.DEBUG&&Q("block checkpoint reverted"),c;case 11:return[4,t.commit()];case 12:return u.sent(),this.DEBUG&&Q("block checkpoint committed"),[4,t.getStateRoot(!1)];case 13:return d=u.sent(),o?(h=s.bloom.bitvector,l=s.gasUsed,b=s.receiptRoot,[4,_genTxTrie(a)]):[3,15];case 14:return g=u.sent(),p={stateRoot:d,bloom:h,gasUsed:l,receiptTrie:b,transactionsTrie:g},B=n(n({},a),{header:n(n({},a.header),p)}),a=I.Block.fromBlockData(B,{common:this._common}),[3,16];case 15:if(s.receiptRoot&&!s.receiptRoot.equals(a.header.receiptTrie))throw this.DEBUG&&Q("Invalid receiptTrie received="+s.receiptRoot.toString("hex")+" expected="+a.header.receiptTrie.toString("hex")),new Error("invalid receiptTrie");if(!s.bloom.bitvector.equals(a.header.bloom))throw this.DEBUG&&Q("Invalid bloom received="+s.bloom.bitvector.toString("hex")+" expected="+a.header.bloom.toString("hex")),new Error("invalid bloom");if(!s.gasUsed.eq(a.header.gasUsed))throw this.DEBUG&&Q("Invalid gasUsed received="+s.gasUsed+" expected="+a.header.gasUsed),new Error("invalid gasUsed");if(!d.equals(a.header.stateRoot))throw this.DEBUG&&Q("Invalid stateRoot received="+d.toString("hex")+" expected="+a.header.stateRoot.toString("hex")),new Error("invalid block stateRoot");u.label=16;case 16:return m={receipts:s.receipts,results:s.results,stateRoot:d,gasUsed:s.gasUsed,logsBloom:s.bloom.bitvector,receiptRoot:s.receiptRoot},y=n(n({},m),{block:a}),[4,this._emit("afterBlock",y)];case 17:return u.sent(),this.DEBUG&&Q("Running block finished hash="+a.hash().toString("hex")+" number="+a.header.number.toNumber()+" hardfork="+this._common.hardfork()),[2,m]}}))}))},t.calculateMinerReward=calculateMinerReward,t.rewardAccount=rewardAccount,t.encodeReceipt=encodeReceipt,t.generateTxReceipt=function generateTxReceipt(e,t,r){var o;return d(this,void 0,void 0,(function(){var s,c,d,h,l,b;return u(this,(function(u){switch(u.label){case 0:return s={gasUsed:r.toArrayLike(a),bitvector:t.bloom.bitvector,logs:null!==(o=t.execResult.logs)&&void 0!==o?o:[]},h="Generate tx receipt transactionType="+e.type+" gasUsed="+r.toString()+" bitvector="+v.short(s.bitvector)+" ("+s.bitvector.length+" bytes) logs="+s.logs.length,e.supports(999)?[3,4]:this._common.gteHardfork("byzantium")?(c=n({status:t.execResult.exceptionError?0:1},s),l=t.execResult.exceptionError?"error":"ok",h+=" status="+c.status+" ("+l+") (>= Byzantium)",[3,3]):[3,1];case 1:return[4,this.stateManager.getStateRoot(!0)];case 2:b=u.sent(),c=n({stateRoot:b},s),h+=" stateRoot="+c.stateRoot.toString("hex")+" (< Byzantium)",u.label=3;case 3:return d=p.encode(Object.values(c)),[3,5];case 4:c=n({status:t.execResult.exceptionError?0:1},s),d=a.concat([m.intToBuffer(e.type),p.encode(Object.values(c))]),u.label=5;case 5:return[2,{txReceipt:c,encodedReceipt:d,receiptLog:h}]}}))}))}},(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.VmError=t.ERROR=void 0,function(e){e.OUT_OF_GAS="out of gas",e.CODESTORE_OUT_OF_GAS="code store out of gas",e.STACK_UNDERFLOW="stack underflow",e.STACK_OVERFLOW="stack overflow",e.INVALID_JUMP="invalid JUMP",e.INVALID_OPCODE="invalid opcode",e.OUT_OF_RANGE="value out of range",e.REVERT="revert",e.STATIC_STATE_CHANGE="static state change",e.INTERNAL_ERROR="internal error",e.CREATE_COLLISION="create collision",e.STOP="stop",e.REFUND_EXHAUSTED="refund exhausted",e.VALUE_OVERFLOW="value overflow",e.INVALID_BEGINSUB="invalid BEGINSUB",e.INVALID_RETURNSUB="invalid RETURNSUB",e.INVALID_JUMPSUB="invalid JUMPSUB",e.INVALID_BYTECODE_RESULT="invalid bytecode deployed",e.BLS_12_381_INVALID_INPUT_LENGTH="invalid input length",e.BLS_12_381_POINT_NOT_ON_CURVE="point not on curve",e.BLS_12_381_INPUT_EMPTY="input is empty",e.BLS_12_381_FP_NOT_IN_FIELD="fp point not in field"}(t.ERROR||(t.ERROR={}));t.VmError=class VmError{constructor(e){this.error=e,this.errorType="VmError"}}},function(e,t,r){"use strict";var a=r(0).Buffer,n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.VmErrorResult=t.INVALID_BYTECODE_RESULT=t.COOGResult=t.OOGResult=void 0;const o=r(49),s=r(5),c=r(54),d=r(28),u=r(413),h=n(r(685)),l=r(306),b=n(r(687)),g=o.debug("vm:evm"),p=o.debug("vm:evm:gas");function OOGResult(e){return{returnValue:a.alloc(0),gasUsed:e,exceptionError:new d.VmError(d.ERROR.OUT_OF_GAS)}}function COOGResult(e){return{returnValue:a.alloc(0),gasUsed:e,exceptionError:new d.VmError(d.ERROR.CODESTORE_OUT_OF_GAS)}}function INVALID_BYTECODE_RESULT(e){return{returnValue:a.alloc(0),gasUsed:e,exceptionError:new d.VmError(d.ERROR.INVALID_BYTECODE_RESULT)}}t.OOGResult=OOGResult,t.COOGResult=COOGResult,t.INVALID_BYTECODE_RESULT=INVALID_BYTECODE_RESULT,t.VmErrorResult=function VmErrorResult(e,t){return{returnValue:a.alloc(0),gasUsed:t,exceptionError:e}};t.default=class EVM{constructor(e,t,r){this._vm=e,this._state=this._vm.stateManager,this._tx=t,this._block=r,this._refund=new s.BN(0)}async executeMessage(e){var t;let r;await this._vm._emit("beforeMessage",e),!e.to&&this._vm._common.isActivatedEIP(2929)&&(e.code=e.data,this._state.addWarmedAddress((await this._generateAddress(e)).buf)),await this._state.checkpoint(),this._vm.DEBUG&&(g("-".repeat(100)),g("message checkpoint")),this._vm.DEBUG&&g(`New message caller=${e.caller.toString()} gasLimit=${e.gasLimit.toString()} to=${e.to?e.to.toString():""} value=${e.value.toString()} delegatecall=${e.delegatecall?"yes":"no"}`),e.to?(this._vm.DEBUG&&g(`Message CALL execution (to: ${e.to.toString()})`),r=await this._executeCall(e)):(this._vm.DEBUG&&g("Message CREATE execution (to undefined)"),r=await this._executeCreate(e)),this._vm.DEBUG&&g(`Received message results gasUsed=${r.gasUsed} execResult: [ gasUsed=${r.gasUsed} exceptionError=${r.execResult.exceptionError?r.execResult.exceptionError.toString():""} returnValue=${l.short(r.execResult.returnValue)} gasRefund=${null===(t=r.execResult.gasRefund)||void 0===t?void 0:t.toString()} ]`),r.execResult.gasRefund=this._refund.clone();const a=r.execResult.exceptionError;return a&&(this._vm._common.gteHardfork("homestead")||a.error!=d.ERROR.CODESTORE_OUT_OF_GAS)?(r.execResult.logs=[],await this._state.revert(),this._vm.DEBUG&&g("message checkpoint reverted")):(await this._state.commit(),this._vm.DEBUG&&g("message checkpoint committed")),await this._vm._emit("afterMessage",r),r}async _executeCall(e){const t=await this._state.getAccount(e.caller);e.delegatecall||await this._reduceSenderBalance(t,e);const r=await this._state.getAccount(e.to);let n;if(!e.delegatecall)try{await this._addToBalance(r,e)}catch(e){n=e}await this._loadCode(e);let o,c=!1;return e.code&&0!==e.code.length||(c=!0,this._vm.DEBUG&&g("Exit early on no code")),n&&(c=!0,this._vm.DEBUG&&g("Exit early on value tranfer overflowed")),c?{gasUsed:new s.BN(0),execResult:{gasUsed:new s.BN(0),exceptionError:n,returnValue:a.alloc(0)}}:(e.isCompiled?(this._vm.DEBUG&&g("Run precompile"),o=await this.runPrecompile(e.code,e.data,e.gasLimit)):(this._vm.DEBUG&&g("Start bytecode processing..."),o=await this.runInterpreter(e)),{gasUsed:o.gasUsed,execResult:o})}async _executeCreate(e){const t=await this._state.getAccount(e.caller);await this._reduceSenderBalance(t,e),e.code=e.data,e.data=a.alloc(0),e.to=await this._generateAddress(e),this._vm.DEBUG&&g(`Generated CREATE contract address ${e.to.toString()}`);let r=await this._state.getAccount(e.to);if(r.nonce&&r.nonce.gtn(0)||!r.codeHash.equals(s.KECCAK256_NULL))return this._vm.DEBUG&&g("Returning on address collision"),{gasUsed:e.gasLimit,createdAddress:e.to,execResult:{returnValue:a.alloc(0),exceptionError:new d.VmError(d.ERROR.CREATE_COLLISION),gasUsed:e.gasLimit}};await this._state.clearContractStorage(e.to);const n={address:e.to,code:e.code};let o;await this._vm._emit("newContract",n),r=await this._state.getAccount(e.to),this._vm._common.gteHardfork("spuriousDragon")&&r.nonce.iaddn(1);try{await this._addToBalance(r,e)}catch(e){o=e}let c=!1;if(e.code&&0!==e.code.length||(c=!0,this._vm.DEBUG&&g("Exit early on no code")),o&&(c=!0,this._vm.DEBUG&&g("Exit early on value tranfer overflowed")),c)return{gasUsed:new s.BN(0),createdAddress:e.to,execResult:{gasUsed:new s.BN(0),exceptionError:o,returnValue:a.alloc(0)}};this._vm.DEBUG&&g("Start bytecode processing...");let u=await this.runInterpreter(e),h=u.gasUsed,l=new s.BN(0);u.exceptionError||(l=new s.BN(u.returnValue.length).imuln(this._vm._common.param("gasPrices","createData")),h=h.add(l),this._vm.DEBUG&&p(`Add return value size fee (${l} to gas used (-> ${h}))`));let b=!0;this._vm._common.gteHardfork("spuriousDragon")&&u.returnValue.length>this._vm._common.param("vm","maxCodeSize")&&(b=!1);let B=!1;if(h.lte(e.gasLimit)&&(this._vm._allowUnlimitedContractSize||b)?this._vm._common.isActivatedEIP(3541)&&u.returnValue.slice(0,1).equals(a.from("EF","hex"))?u=Object.assign(Object.assign({},u),INVALID_BYTECODE_RESULT(e.gasLimit)):u.gasUsed=h:this._vm._common.gteHardfork("homestead")?(this._vm.DEBUG&&g("Not enough gas or code size not allowed (>= Homestead)"),u=Object.assign(Object.assign({},u),OOGResult(e.gasLimit))):(this._vm.DEBUG&&g("Not enough gas or code size not allowed (Frontier)"),h.sub(l).lte(e.gasLimit)?(u=Object.assign(Object.assign({},u),COOGResult(h.sub(l))),B=!0):u=Object.assign(Object.assign({},u),OOGResult(e.gasLimit))),!u.exceptionError&&u.returnValue&&""!==u.returnValue.toString())await this._state.putContractCode(e.to,u.returnValue),this._vm.DEBUG&&g("Code saved on new contract creation");else if(B&&!this._vm._common.gteHardfork("homestead")){const t=await this._state.getAccount(e.to);await this._state.putAccount(e.to,t)}return{gasUsed:u.gasUsed,createdAddress:e.to,execResult:u}}async runInterpreter(e,t={}){const r={blockchain:this._vm.blockchain,address:e.to||s.Address.zero(),caller:e.caller||s.Address.zero(),callData:e.data||a.from([0]),callValue:e.value||new s.BN(0),code:e.code,isStatic:e.isStatic||!1,depth:e.depth||0,gasPrice:this._tx.gasPrice,origin:this._tx.origin||e.caller||s.Address.zero(),block:this._block||new c.Block,contract:await this._state.getAccount(e.to||s.Address.zero()),codeAddress:e.codeAddress},n=new h.default(r,this._state,this,this._vm._common,e.gasLimit.clone());e.selfdestruct&&(n._result.selfdestruct=e.selfdestruct);const o=this._refund.clone(),u=new b.default(this._vm,n),l=await u.run(e.code,t);let g=n._result,p=e.gasLimit.sub(n._gasLeft);return l.exceptionError&&(l.exceptionError.error!==d.ERROR.REVERT&&(p=e.gasLimit),g=Object.assign(Object.assign({},g),{logs:[],selfdestruct:{}}),this._refund=o),Object.assign(Object.assign({},g),{runState:Object.assign(Object.assign(Object.assign({},l.runState),g),n._env),exceptionError:l.exceptionError,gas:n._gasLeft,gasUsed:p,returnValue:g.returnValue?g.returnValue:a.alloc(0)})}getPrecompile(e){return u.getPrecompile(e,this._vm._common)}runPrecompile(e,t,r){if("function"!=typeof e)throw new Error("Invalid precompile");return e({data:t,gasLimit:r,_common:this._vm._common,_VM:this._vm})}async _loadCode(e){if(!e.code){const t=this.getPrecompile(e.codeAddress);t?(e.code=t,e.isCompiled=!0):(e.code=await this._state.getContractCode(e.codeAddress),e.isCompiled=!1)}}async _generateAddress(e){let t;if(e.salt)t=s.generateAddress2(e.caller.buf,e.salt,e.code);else{const r=(await this._state.getAccount(e.caller)).nonce.subn(1);t=s.generateAddress(e.caller.buf,r.toArrayLike(a))}return new s.Address(t)}async _reduceSenderBalance(e,t){e.balance.isub(t.value);const r=this._state.putAccount(t.caller,e);return this._vm.DEBUG&&g(`Reduced sender (${t.caller}) balance (-> ${e.balance})`),r}async _addToBalance(e,t){const r=e.balance.add(t.value);if(r.gt(s.MAX_INTEGER))throw new d.VmError(d.ERROR.VALUE_OVERFLOW);e.balance=r;const a=this._state.putAccount(t.to,e);return this._vm.DEBUG&&g(`Added toAccount (${t.to}) balance (-> ${e.balance})`),a}async _touchAccount(e){const t=await this._state.getAccount(e);return this._state.putAccount(e,t)}}},(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.VmError=t.ERROR=void 0,function(e){e.OUT_OF_GAS="out of gas",e.CODESTORE_OUT_OF_GAS="code store out of gas",e.STACK_UNDERFLOW="stack underflow",e.STACK_OVERFLOW="stack overflow",e.INVALID_JUMP="invalid JUMP",e.INVALID_OPCODE="invalid opcode",e.OUT_OF_RANGE="value out of range",e.REVERT="revert",e.STATIC_STATE_CHANGE="static state change",e.INTERNAL_ERROR="internal error",e.CREATE_COLLISION="create collision",e.STOP="stop",e.REFUND_EXHAUSTED="refund exhausted",e.VALUE_OVERFLOW="value overflow",e.INVALID_BEGINSUB="invalid BEGINSUB",e.INVALID_RETURNSUB="invalid RETURNSUB",e.INVALID_JUMPSUB="invalid JUMPSUB",e.INVALID_BYTECODE_RESULT="invalid bytecode deployed",e.BLS_12_381_INVALID_INPUT_LENGTH="invalid input length",e.BLS_12_381_POINT_NOT_ON_CURVE="point not on curve",e.BLS_12_381_INPUT_EMPTY="input is empty",e.BLS_12_381_FP_NOT_IN_FIELD="fp point not in field"}(t.ERROR||(t.ERROR={}));var r=function r(e){this.error=e,this.errorType="VmError"};t.VmError=r},(e,t,r)=>{"use strict";var a=r(2).Buffer;Object.defineProperty(t,"__esModule",{value:!0}),t.BaseJsonRpcType=t.toBuffers=t.toStrings=t.bufCache=t.strCache=void 0;const n=r(24),o=r(24),s=r(122);t.strCache=new WeakMap,t.bufCache=new WeakMap,t.toStrings=new WeakMap,t.toBuffers=new WeakMap;const c=Symbol.for("nodejs.util.inspect.custom");t.BaseJsonRpcType=class BaseJsonRpcType{constructor(e){const r=this;if(a.isBuffer(e))t.toStrings.set(this,(()=>e.toString("hex"))),t.bufCache.set(this,e),r[Symbol.toStringTag]="Buffer";else{const c=typeof e;switch(c){case"number":if(e%1!=0)throw new Error("`Cannot wrap a decimal value as a json-rpc type`");t.toStrings.set(this,(()=>e.toString(16))),t.toBuffers.set(this,(()=>0===e?s.BUFFER_EMPTY:o.uintToBuffer(e)));break;case"bigint":t.toStrings.set(this,(()=>e.toString(16))),t.toBuffers.set(this,(()=>0n===e?s.BUFFER_EMPTY:n.bigIntToBuffer(e)));break;case"string":if(0!==e.indexOf("0x"))throw new Error(`cannot convert string value "${e}" into type \`${this.constructor.name}\`; strings must be hex-encoded and prefixed with "0x".`);t.strCache.set(this,e.toLowerCase()),t.toBuffers.set(this,(()=>{let t=e.slice(2);return t.length%2==1&&(t="0"+t),a.from(t,"hex")}));break;default:if(null==e){this.toString=()=>e,t.bufCache.set(this,s.BUFFER_EMPTY);break}throw new Error(`Cannot wrap a "${c}" as a json-rpc type`)}r[Symbol.toStringTag]=c}this.value=e}[c](e,t){return this.value}toString(){let e=t.strCache.get(this);return void 0===e&&(e="0x"+t.toStrings.get(this)(),t.strCache.set(this,e)),e}toBuffer(){let e=t.bufCache.get(this);return void 0===e&&(e=t.toBuffers.get(this)(),t.bufCache.set(this,e)),e}valueOf(){return this.value}toJSON(){return this.toString()}isNull(){return null==this.value}}},e=>{"use strict";var t,r="object"==typeof Reflect?Reflect:null,a=r&&"function"==typeof r.apply?r.apply:function ReflectApply(e,t,r){return Function.prototype.apply.call(e,t,r)};t=r&&"function"==typeof r.ownKeys?r.ownKeys:Object.getOwnPropertySymbols?function ReflectOwnKeys(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function ReflectOwnKeys(e){return Object.getOwnPropertyNames(e)};var n=Number.isNaN||function NumberIsNaN(e){return e!=e};function EventEmitter(){EventEmitter.init.call(this)}e.exports=EventEmitter,e.exports.once=function once(e,t){return new Promise((function(r,a){function eventListener(){void 0!==n&&e.removeListener("error",n),r([].slice.call(arguments))}var n;"error"!==t&&(n=function errorListener(r){e.removeListener(t,eventListener),a(r)},e.once("error",n)),e.once(t,eventListener)}))},EventEmitter.EventEmitter=EventEmitter,EventEmitter.prototype._events=void 0,EventEmitter.prototype._eventsCount=0,EventEmitter.prototype._maxListeners=void 0;var o=10;function checkListener(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function _getMaxListeners(e){return void 0===e._maxListeners?EventEmitter.defaultMaxListeners:e._maxListeners}function _addListener(e,t,r,a){var n,o,s;if(checkListener(r),void 0===(o=e._events)?(o=e._events=Object.create(null),e._eventsCount=0):(void 0!==o.newListener&&(e.emit("newListener",t,r.listener?r.listener:r),o=e._events),s=o[t]),void 0===s)s=o[t]=r,++e._eventsCount;else if("function"==typeof s?s=o[t]=a?[r,s]:[s,r]:a?s.unshift(r):s.push(r),(n=_getMaxListeners(e))>0&&s.length>n&&!s.warned){s.warned=!0;var c=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");c.name="MaxListenersExceededWarning",c.emitter=e,c.type=t,c.count=s.length,function ProcessEmitWarning(e){console&&console.warn&&console.warn(e)}(c)}return e}function onceWrapper(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function _onceWrap(e,t,r){var a={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},n=onceWrapper.bind(a);return n.listener=r,a.wrapFn=n,n}function _listeners(e,t,r){var a=e._events;if(void 0===a)return[];var n=a[t];return void 0===n?[]:"function"==typeof n?r?[n.listener||n]:[n]:r?function unwrapListeners(e){for(var t=new Array(e.length),r=0;r0&&(s=t[0]),s instanceof Error)throw s;var c=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw c.context=s,c}var d=o[e];if(void 0===d)return!1;if("function"==typeof d)a(d,this,t);else{var u=d.length,h=arrayClone(d,u);for(r=0;r=0;o--)if(r[o]===t||r[o].listener===t){s=r[o].listener,n=o;break}if(n<0)return this;0===n?r.shift():function spliceOne(e,t){for(;t+1=0;a--)this.removeListener(e,t[a]);return this},EventEmitter.prototype.listeners=function listeners(e){return _listeners(this,e,!0)},EventEmitter.prototype.rawListeners=function rawListeners(e){return _listeners(this,e,!1)},EventEmitter.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):listenerCount.call(e,t)},EventEmitter.prototype.listenerCount=listenerCount,EventEmitter.prototype.eventNames=function eventNames(){return this._eventsCount>0?t(this._events):[]}},function(e,t,r){"use strict";var a=r(3).Buffer,n=this&&this.__createBinding||(Object.create?function(e,t,r,a){void 0===a&&(a=r),Object.defineProperty(e,a,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,a){void 0===a&&(a=r),e[a]=t[r]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),s=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.hasOwnProperty.call(e,r)&&n(t,e,r);return o(t,e),t},c=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var a,n,o=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(a=o.next()).done;)s.push(a.value)}catch(e){n={error:e}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return s},d=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.isZeroAddress=t.zeroAddress=t.importPublic=t.privateToAddress=t.privateToPublic=t.publicToAddress=t.pubToAddress=t.isValidPublic=t.isValidPrivate=t.generateAddress2=t.generateAddress=t.isValidChecksumAddress=t.toChecksumAddress=t.isValidAddress=t.Account=void 0;var u=d(r(6)),h=d(r(127)),l=s(r(180)),b=r(125),g=r(87),p=r(184),B=r(71),m=r(57),I=r(341),y=r(236),v=function(){function Account(e,t,r,a){void 0===e&&(e=new h.default(0)),void 0===t&&(t=new h.default(0)),void 0===r&&(r=p.KECCAK256_RLP),void 0===a&&(a=p.KECCAK256_NULL),this.nonce=e,this.balance=t,this.stateRoot=r,this.codeHash=a,this._validate()}return Account.fromAccountData=function(e){var t=e.nonce,r=e.balance,a=e.stateRoot,n=e.codeHash;return new Account(t?new h.default(B.toBuffer(t)):void 0,r?new h.default(B.toBuffer(r)):void 0,a?B.toBuffer(a):void 0,n?B.toBuffer(n):void 0)},Account.fromRlpSerializedAccount=function(e){var t=l.decode(e);if(!Array.isArray(t))throw new Error("Invalid serialized account input. Must be array");return this.fromValuesArray(t)},Account.fromValuesArray=function(e){var t=c(e,4),r=t[0],a=t[1],n=t[2],o=t[3];return new Account(new h.default(r),new h.default(a),n,o)},Account.prototype._validate=function(){if(this.nonce.lt(new h.default(0)))throw new Error("nonce must be greater than zero");if(this.balance.lt(new h.default(0)))throw new Error("balance must be greater than zero");if(32!==this.stateRoot.length)throw new Error("stateRoot must have a length of 32");if(32!==this.codeHash.length)throw new Error("codeHash must have a length of 32")},Account.prototype.raw=function(){return[y.bnToUnpaddedBuffer(this.nonce),y.bnToUnpaddedBuffer(this.balance),this.stateRoot,this.codeHash]},Account.prototype.serialize=function(){return l.encode(this.raw())},Account.prototype.isContract=function(){return!this.codeHash.equals(p.KECCAK256_NULL)},Account.prototype.isEmpty=function(){return this.balance.isZero()&&this.nonce.isZero()&&this.codeHash.equals(p.KECCAK256_NULL)},Account}();t.Account=v,t.isValidAddress=function(e){try{I.assertIsString(e)}catch(e){return!1}return/^0x[0-9a-fA-F]{40}$/.test(e)},t.toChecksumAddress=function(e,t){I.assertIsHexString(e);var r=g.stripHexPrefix(e).toLowerCase(),a="";t&&(a=y.toType(t,y.TypeOutput.BN).toString()+"0x");for(var n=m.keccakFromString(a+r).toString("hex"),o="0x",s=0;s=8?o+=r[s].toUpperCase():o+=r[s];return o},t.isValidChecksumAddress=function(e,r){return t.isValidAddress(e)&&t.toChecksumAddress(e,r)===e},t.generateAddress=function(e,t){I.assertIsBuffer(e),I.assertIsBuffer(t);var r=new h.default(t);return r.isZero()?m.rlphash([e,null]).slice(-20):m.rlphash([e,a.from(r.toArray())]).slice(-20)},t.generateAddress2=function(e,t,r){return I.assertIsBuffer(e),I.assertIsBuffer(t),I.assertIsBuffer(r),u.default(20===e.length),u.default(32===t.length),m.keccak256(a.concat([a.from("ff","hex"),e,t,m.keccak256(r)])).slice(-20)},t.isValidPrivate=function(e){return b.privateKeyVerify(e)},t.isValidPublic=function(e,t){return void 0===t&&(t=!1),I.assertIsBuffer(e),64===e.length?b.publicKeyVerify(a.concat([a.from([4]),e])):!!t&&b.publicKeyVerify(e)},t.pubToAddress=function(e,t){return void 0===t&&(t=!1),I.assertIsBuffer(e),t&&64!==e.length&&(e=a.from(b.publicKeyConvert(e,!1).slice(1))),u.default(64===e.length),m.keccak(e).slice(-20)},t.publicToAddress=t.pubToAddress,t.privateToPublic=function(e){return I.assertIsBuffer(e),a.from(b.publicKeyCreate(e,!1)).slice(1)},t.privateToAddress=function(e){return t.publicToAddress(t.privateToPublic(e))},t.importPublic=function(e){return I.assertIsBuffer(e),64!==e.length&&(e=a.from(b.publicKeyConvert(e,!1).slice(1))),e},t.zeroAddress=function(){var e=B.zeros(20);return B.bufferToHex(e)},t.isZeroAddress=function(e){try{I.assertIsString(e)}catch(e){return!1}return t.zeroAddress()===e}},function(e,t,r){"use strict";var a=r(4).Buffer,n=this&&this.__createBinding||(Object.create?function(e,t,r,a){void 0===a&&(a=r),Object.defineProperty(e,a,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,a){void 0===a&&(a=r),e[a]=t[r]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),s=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.hasOwnProperty.call(e,r)&&n(t,e,r);return o(t,e),t},c=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var a,n,o=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(a=o.next()).done;)s.push(a.value)}catch(e){n={error:e}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return s},d=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.isZeroAddress=t.zeroAddress=t.importPublic=t.privateToAddress=t.privateToPublic=t.publicToAddress=t.pubToAddress=t.isValidPublic=t.isValidPrivate=t.generateAddress2=t.generateAddress=t.isValidChecksumAddress=t.toChecksumAddress=t.isValidAddress=t.Account=void 0;var u=d(r(6)),h=d(r(130)),l=s(r(343)),b=r(158),g=r(186),p=r(185),B=r(73),m=r(59),I=r(346),y=r(238),v=function(){function Account(e,t,r,a){void 0===e&&(e=new h.default(0)),void 0===t&&(t=new h.default(0)),void 0===r&&(r=p.KECCAK256_RLP),void 0===a&&(a=p.KECCAK256_NULL),this.nonce=e,this.balance=t,this.stateRoot=r,this.codeHash=a,this._validate()}return Account.fromAccountData=function(e){var t=e.nonce,r=e.balance,a=e.stateRoot,n=e.codeHash;return new Account(t?new h.default(B.toBuffer(t)):void 0,r?new h.default(B.toBuffer(r)):void 0,a?B.toBuffer(a):void 0,n?B.toBuffer(n):void 0)},Account.fromRlpSerializedAccount=function(e){var t=l.decode(e);if(!Array.isArray(t))throw new Error("Invalid serialized account input. Must be array");return this.fromValuesArray(t)},Account.fromValuesArray=function(e){var t=c(e,4),r=t[0],a=t[1],n=t[2],o=t[3];return new Account(new h.default(r),new h.default(a),n,o)},Account.prototype._validate=function(){if(this.nonce.lt(new h.default(0)))throw new Error("nonce must be greater than zero");if(this.balance.lt(new h.default(0)))throw new Error("balance must be greater than zero");if(32!==this.stateRoot.length)throw new Error("stateRoot must have a length of 32");if(32!==this.codeHash.length)throw new Error("codeHash must have a length of 32")},Account.prototype.raw=function(){return[y.bnToUnpaddedBuffer(this.nonce),y.bnToUnpaddedBuffer(this.balance),this.stateRoot,this.codeHash]},Account.prototype.serialize=function(){return l.encode(this.raw())},Account.prototype.isContract=function(){return!this.codeHash.equals(p.KECCAK256_NULL)},Account.prototype.isEmpty=function(){return this.balance.isZero()&&this.nonce.isZero()&&this.codeHash.equals(p.KECCAK256_NULL)},Account}();t.Account=v,t.isValidAddress=function(e){try{I.assertIsString(e)}catch(e){return!1}return/^0x[0-9a-fA-F]{40}$/.test(e)},t.toChecksumAddress=function(e,t){I.assertIsHexString(e);var r=g.stripHexPrefix(e).toLowerCase(),a="";t&&(a=y.toType(t,y.TypeOutput.BN).toString()+"0x");for(var n=m.keccakFromString(a+r).toString("hex"),o="0x",s=0;s=8?o+=r[s].toUpperCase():o+=r[s];return o},t.isValidChecksumAddress=function(e,r){return t.isValidAddress(e)&&t.toChecksumAddress(e,r)===e},t.generateAddress=function(e,t){I.assertIsBuffer(e),I.assertIsBuffer(t);var r=new h.default(t);return r.isZero()?m.rlphash([e,null]).slice(-20):m.rlphash([e,a.from(r.toArray())]).slice(-20)},t.generateAddress2=function(e,t,r){return I.assertIsBuffer(e),I.assertIsBuffer(t),I.assertIsBuffer(r),u.default(20===e.length),u.default(32===t.length),m.keccak256(a.concat([a.from("ff","hex"),e,t,m.keccak256(r)])).slice(-20)},t.isValidPrivate=function(e){return b.privateKeyVerify(e)},t.isValidPublic=function(e,t){return void 0===t&&(t=!1),I.assertIsBuffer(e),64===e.length?b.publicKeyVerify(a.concat([a.from([4]),e])):!!t&&b.publicKeyVerify(e)},t.pubToAddress=function(e,t){return void 0===t&&(t=!1),I.assertIsBuffer(e),t&&64!==e.length&&(e=a.from(b.publicKeyConvert(e,!1).slice(1))),u.default(64===e.length),m.keccak(e).slice(-20)},t.publicToAddress=t.pubToAddress,t.privateToPublic=function(e){return I.assertIsBuffer(e),a.from(b.publicKeyCreate(e,!1)).slice(1)},t.privateToAddress=function(e){return t.publicToAddress(t.privateToPublic(e))},t.importPublic=function(e){return I.assertIsBuffer(e),64!==e.length&&(e=a.from(b.publicKeyConvert(e,!1).slice(1))),e},t.zeroAddress=function(){var e=B.zeros(20);return B.bufferToHex(e)},t.isZeroAddress=function(e){try{I.assertIsString(e)}catch(e){return!1}return t.zeroAddress()===e}},function(e,t,r){"use strict";var a=r(2).Buffer,n=this&&this.__createBinding||(Object.create?function(e,t,r,a){void 0===a&&(a=r),Object.defineProperty(e,a,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,a){void 0===a&&(a=r),e[a]=t[r]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),s=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.hasOwnProperty.call(e,r)&&n(t,e,r);return o(t,e),t},c=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var a,n,o=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(a=o.next()).done;)s.push(a.value)}catch(e){n={error:e}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return s},d=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.isZeroAddress=t.zeroAddress=t.importPublic=t.privateToAddress=t.privateToPublic=t.publicToAddress=t.pubToAddress=t.isValidPublic=t.isValidPrivate=t.generateAddress2=t.generateAddress=t.isValidChecksumAddress=t.toChecksumAddress=t.isValidAddress=t.Account=void 0;var u=d(r(6)),h=d(r(134)),l=s(r(354)),b=r(162),g=r(195),p=r(194),B=r(76),m=r(61),I=r(357),y=r(243),v=function(){function Account(e,t,r,a){void 0===e&&(e=new h.default(0)),void 0===t&&(t=new h.default(0)),void 0===r&&(r=p.KECCAK256_RLP),void 0===a&&(a=p.KECCAK256_NULL),this.nonce=e,this.balance=t,this.stateRoot=r,this.codeHash=a,this._validate()}return Account.fromAccountData=function(e){var t=e.nonce,r=e.balance,a=e.stateRoot,n=e.codeHash;return new Account(t?new h.default(B.toBuffer(t)):void 0,r?new h.default(B.toBuffer(r)):void 0,a?B.toBuffer(a):void 0,n?B.toBuffer(n):void 0)},Account.fromRlpSerializedAccount=function(e){var t=l.decode(e);if(!Array.isArray(t))throw new Error("Invalid serialized account input. Must be array");return this.fromValuesArray(t)},Account.fromValuesArray=function(e){var t=c(e,4),r=t[0],a=t[1],n=t[2],o=t[3];return new Account(new h.default(r),new h.default(a),n,o)},Account.prototype._validate=function(){if(this.nonce.lt(new h.default(0)))throw new Error("nonce must be greater than zero");if(this.balance.lt(new h.default(0)))throw new Error("balance must be greater than zero");if(32!==this.stateRoot.length)throw new Error("stateRoot must have a length of 32");if(32!==this.codeHash.length)throw new Error("codeHash must have a length of 32")},Account.prototype.raw=function(){return[y.bnToUnpaddedBuffer(this.nonce),y.bnToUnpaddedBuffer(this.balance),this.stateRoot,this.codeHash]},Account.prototype.serialize=function(){return l.encode(this.raw())},Account.prototype.isContract=function(){return!this.codeHash.equals(p.KECCAK256_NULL)},Account.prototype.isEmpty=function(){return this.balance.isZero()&&this.nonce.isZero()&&this.codeHash.equals(p.KECCAK256_NULL)},Account}();t.Account=v,t.isValidAddress=function(e){try{I.assertIsString(e)}catch(e){return!1}return/^0x[0-9a-fA-F]{40}$/.test(e)},t.toChecksumAddress=function(e,t){I.assertIsHexString(e);var r=g.stripHexPrefix(e).toLowerCase(),a="";t&&(a=y.toType(t,y.TypeOutput.BN).toString()+"0x");for(var n=m.keccakFromString(a+r).toString("hex"),o="0x",s=0;s=8?o+=r[s].toUpperCase():o+=r[s];return o},t.isValidChecksumAddress=function(e,r){return t.isValidAddress(e)&&t.toChecksumAddress(e,r)===e},t.generateAddress=function(e,t){I.assertIsBuffer(e),I.assertIsBuffer(t);var r=new h.default(t);return r.isZero()?m.rlphash([e,null]).slice(-20):m.rlphash([e,a.from(r.toArray())]).slice(-20)},t.generateAddress2=function(e,t,r){return I.assertIsBuffer(e),I.assertIsBuffer(t),I.assertIsBuffer(r),u.default(20===e.length),u.default(32===t.length),m.keccak256(a.concat([a.from("ff","hex"),e,t,m.keccak256(r)])).slice(-20)},t.isValidPrivate=function(e){return b.privateKeyVerify(e)},t.isValidPublic=function(e,t){return void 0===t&&(t=!1),I.assertIsBuffer(e),64===e.length?b.publicKeyVerify(a.concat([a.from([4]),e])):!!t&&b.publicKeyVerify(e)},t.pubToAddress=function(e,t){return void 0===t&&(t=!1),I.assertIsBuffer(e),t&&64!==e.length&&(e=a.from(b.publicKeyConvert(e,!1).slice(1))),u.default(64===e.length),m.keccak(e).slice(-20)},t.publicToAddress=t.pubToAddress,t.privateToPublic=function(e){return I.assertIsBuffer(e),a.from(b.publicKeyCreate(e,!1)).slice(1)},t.privateToAddress=function(e){return t.publicToAddress(t.privateToPublic(e))},t.importPublic=function(e){return I.assertIsBuffer(e),64!==e.length&&(e=a.from(b.publicKeyConvert(e,!1).slice(1))),e},t.zeroAddress=function(){var e=B.zeros(20);return B.bufferToHex(e)},t.isZeroAddress=function(e){try{I.assertIsString(e)}catch(e){return!1}return t.zeroAddress()===e}},function(e,t,r){"use strict";var a=r(0).Buffer,n=this&&this.__createBinding||(Object.create?function(e,t,r,a){void 0===a&&(a=r),Object.defineProperty(e,a,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,a){void 0===a&&(a=r),e[a]=t[r]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),s=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.hasOwnProperty.call(e,r)&&n(t,e,r);return o(t,e),t},c=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var a,n,o=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(a=o.next()).done;)s.push(a.value)}catch(e){n={error:e}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return s},d=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.isZeroAddress=t.zeroAddress=t.importPublic=t.privateToAddress=t.privateToPublic=t.publicToAddress=t.pubToAddress=t.isValidPublic=t.isValidPrivate=t.generateAddress2=t.generateAddress=t.isValidChecksumAddress=t.toChecksumAddress=t.isValidAddress=t.Account=void 0;var u=d(r(6)),h=d(r(48)),l=s(r(41)),b=r(89),g=r(62),p=r(198),B=r(78),m=r(63),I=r(366),y=r(246),v=function(){function Account(e,t,r,a){void 0===e&&(e=new h.default(0)),void 0===t&&(t=new h.default(0)),void 0===r&&(r=p.KECCAK256_RLP),void 0===a&&(a=p.KECCAK256_NULL),this.nonce=e,this.balance=t,this.stateRoot=r,this.codeHash=a,this._validate()}return Account.fromAccountData=function(e){var t=e.nonce,r=e.balance,a=e.stateRoot,n=e.codeHash;return new Account(t?new h.default(B.toBuffer(t)):void 0,r?new h.default(B.toBuffer(r)):void 0,a?B.toBuffer(a):void 0,n?B.toBuffer(n):void 0)},Account.fromRlpSerializedAccount=function(e){var t=l.decode(e);if(!Array.isArray(t))throw new Error("Invalid serialized account input. Must be array");return this.fromValuesArray(t)},Account.fromValuesArray=function(e){var t=c(e,4),r=t[0],a=t[1],n=t[2],o=t[3];return new Account(new h.default(r),new h.default(a),n,o)},Account.prototype._validate=function(){if(this.nonce.lt(new h.default(0)))throw new Error("nonce must be greater than zero");if(this.balance.lt(new h.default(0)))throw new Error("balance must be greater than zero");if(32!==this.stateRoot.length)throw new Error("stateRoot must have a length of 32");if(32!==this.codeHash.length)throw new Error("codeHash must have a length of 32")},Account.prototype.raw=function(){return[y.bnToUnpaddedBuffer(this.nonce),y.bnToUnpaddedBuffer(this.balance),this.stateRoot,this.codeHash]},Account.prototype.serialize=function(){return l.encode(this.raw())},Account.prototype.isContract=function(){return!this.codeHash.equals(p.KECCAK256_NULL)},Account.prototype.isEmpty=function(){return this.balance.isZero()&&this.nonce.isZero()&&this.codeHash.equals(p.KECCAK256_NULL)},Account}();t.Account=v,t.isValidAddress=function(e){try{I.assertIsString(e)}catch(e){return!1}return/^0x[0-9a-fA-F]{40}$/.test(e)},t.toChecksumAddress=function(e,t){I.assertIsHexString(e);var r=g.stripHexPrefix(e).toLowerCase(),a="";t&&(a=y.toType(t,y.TypeOutput.BN).toString()+"0x");for(var n=m.keccakFromString(a+r).toString("hex"),o="0x",s=0;s=8?o+=r[s].toUpperCase():o+=r[s];return o},t.isValidChecksumAddress=function(e,r){return t.isValidAddress(e)&&t.toChecksumAddress(e,r)===e},t.generateAddress=function(e,t){I.assertIsBuffer(e),I.assertIsBuffer(t);var r=new h.default(t);return r.isZero()?m.rlphash([e,null]).slice(-20):m.rlphash([e,a.from(r.toArray())]).slice(-20)},t.generateAddress2=function(e,t,r){return I.assertIsBuffer(e),I.assertIsBuffer(t),I.assertIsBuffer(r),u.default(20===e.length),u.default(32===t.length),m.keccak256(a.concat([a.from("ff","hex"),e,t,m.keccak256(r)])).slice(-20)},t.isValidPrivate=function(e){return b.privateKeyVerify(e)},t.isValidPublic=function(e,t){return void 0===t&&(t=!1),I.assertIsBuffer(e),64===e.length?b.publicKeyVerify(a.concat([a.from([4]),e])):!!t&&b.publicKeyVerify(e)},t.pubToAddress=function(e,t){return void 0===t&&(t=!1),I.assertIsBuffer(e),t&&64!==e.length&&(e=a.from(b.publicKeyConvert(e,!1).slice(1))),u.default(64===e.length),m.keccak(e).slice(-20)},t.publicToAddress=t.pubToAddress,t.privateToPublic=function(e){return I.assertIsBuffer(e),a.from(b.publicKeyCreate(e,!1)).slice(1)},t.privateToAddress=function(e){return t.publicToAddress(t.privateToPublic(e))},t.importPublic=function(e){return I.assertIsBuffer(e),64!==e.length&&(e=a.from(b.publicKeyConvert(e,!1).slice(1))),e},t.zeroAddress=function(){var e=B.zeros(20);return B.bufferToHex(e)},t.isZeroAddress=function(e){try{I.assertIsString(e)}catch(e){return!1}return t.zeroAddress()===e}},function(e,t,r){"use strict";var a=r(0).Buffer,n=this&&this.__createBinding||(Object.create?function(e,t,r,a){void 0===a&&(a=r),Object.defineProperty(e,a,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,a){void 0===a&&(a=r),e[a]=t[r]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),s=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.hasOwnProperty.call(e,r)&&n(t,e,r);return o(t,e),t},c=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var a,n,o=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(a=o.next()).done;)s.push(a.value)}catch(e){n={error:e}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return s},d=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.isZeroAddress=t.zeroAddress=t.importPublic=t.privateToAddress=t.privateToPublic=t.publicToAddress=t.pubToAddress=t.isValidPublic=t.isValidPrivate=t.generateAddress2=t.generateAddress=t.isValidChecksumAddress=t.toChecksumAddress=t.isValidAddress=t.Account=void 0;var u=d(r(6)),h=d(r(48)),l=s(r(41)),b=r(89),g=r(62),p=r(203),B=r(79),m=r(64),I=r(372),y=r(248),v=function(){function Account(e,t,r,a){void 0===e&&(e=new h.default(0)),void 0===t&&(t=new h.default(0)),void 0===r&&(r=p.KECCAK256_RLP),void 0===a&&(a=p.KECCAK256_NULL),this.nonce=e,this.balance=t,this.stateRoot=r,this.codeHash=a,this._validate()}return Account.fromAccountData=function(e){var t=e.nonce,r=e.balance,a=e.stateRoot,n=e.codeHash;return new Account(t?new h.default(B.toBuffer(t)):void 0,r?new h.default(B.toBuffer(r)):void 0,a?B.toBuffer(a):void 0,n?B.toBuffer(n):void 0)},Account.fromRlpSerializedAccount=function(e){var t=l.decode(e);if(!Array.isArray(t))throw new Error("Invalid serialized account input. Must be array");return this.fromValuesArray(t)},Account.fromValuesArray=function(e){var t=c(e,4),r=t[0],a=t[1],n=t[2],o=t[3];return new Account(new h.default(r),new h.default(a),n,o)},Account.prototype._validate=function(){if(this.nonce.lt(new h.default(0)))throw new Error("nonce must be greater than zero");if(this.balance.lt(new h.default(0)))throw new Error("balance must be greater than zero");if(32!==this.stateRoot.length)throw new Error("stateRoot must have a length of 32");if(32!==this.codeHash.length)throw new Error("codeHash must have a length of 32")},Account.prototype.raw=function(){return[y.bnToUnpaddedBuffer(this.nonce),y.bnToUnpaddedBuffer(this.balance),this.stateRoot,this.codeHash]},Account.prototype.serialize=function(){return l.encode(this.raw())},Account.prototype.isContract=function(){return!this.codeHash.equals(p.KECCAK256_NULL)},Account.prototype.isEmpty=function(){return this.balance.isZero()&&this.nonce.isZero()&&this.codeHash.equals(p.KECCAK256_NULL)},Account}();t.Account=v,t.isValidAddress=function(e){try{I.assertIsString(e)}catch(e){return!1}return/^0x[0-9a-fA-F]{40}$/.test(e)},t.toChecksumAddress=function(e,t){I.assertIsHexString(e);var r=g.stripHexPrefix(e).toLowerCase(),a="";t&&(a=y.toType(t,y.TypeOutput.BN).toString()+"0x");for(var n=m.keccakFromString(a+r).toString("hex"),o="0x",s=0;s=8?o+=r[s].toUpperCase():o+=r[s];return o},t.isValidChecksumAddress=function(e,r){return t.isValidAddress(e)&&t.toChecksumAddress(e,r)===e},t.generateAddress=function(e,t){I.assertIsBuffer(e),I.assertIsBuffer(t);var r=new h.default(t);return r.isZero()?m.rlphash([e,null]).slice(-20):m.rlphash([e,a.from(r.toArray())]).slice(-20)},t.generateAddress2=function(e,t,r){return I.assertIsBuffer(e),I.assertIsBuffer(t),I.assertIsBuffer(r),u.default(20===e.length),u.default(32===t.length),m.keccak256(a.concat([a.from("ff","hex"),e,t,m.keccak256(r)])).slice(-20)},t.isValidPrivate=function(e){return b.privateKeyVerify(e)},t.isValidPublic=function(e,t){return void 0===t&&(t=!1),I.assertIsBuffer(e),64===e.length?b.publicKeyVerify(a.concat([a.from([4]),e])):!!t&&b.publicKeyVerify(e)},t.pubToAddress=function(e,t){return void 0===t&&(t=!1),I.assertIsBuffer(e),t&&64!==e.length&&(e=a.from(b.publicKeyConvert(e,!1).slice(1))),u.default(64===e.length),m.keccak(e).slice(-20)},t.publicToAddress=t.pubToAddress,t.privateToPublic=function(e){return I.assertIsBuffer(e),a.from(b.publicKeyCreate(e,!1)).slice(1)},t.privateToAddress=function(e){return t.publicToAddress(t.privateToPublic(e))},t.importPublic=function(e){return I.assertIsBuffer(e),64!==e.length&&(e=a.from(b.publicKeyConvert(e,!1).slice(1))),e},t.zeroAddress=function(){var e=B.zeros(20);return B.bufferToHex(e)},t.isZeroAddress=function(e){try{I.assertIsString(e)}catch(e){return!1}return t.zeroAddress()===e}},e=>{"function"==typeof Object.create?e.exports=function inherits(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:e.exports=function inherits(e,t){if(t){e.super_=t;var TempCtor=function(){};TempCtor.prototype=t.prototype,e.prototype=new TempCtor,e.prototype.constructor=e}}},(e,t,r)=>{e.exports=Stream;var a=r(32).EventEmitter;function Stream(){a.call(this)}r(10)(Stream,a),Stream.Readable=r(313),Stream.Writable=r(314),Stream.Duplex=r(155),Stream.Transform=r(315),Stream.PassThrough=r(428),Stream.finished=r(258),Stream.pipeline=r(429),Stream.Stream=Stream,Stream.prototype.pipe=function(e,t){var r=this;function ondata(t){e.writable&&!1===e.write(t)&&r.pause&&r.pause()}function ondrain(){r.readable&&r.resume&&r.resume()}r.on("data",ondata),e.on("drain",ondrain),e._isStdio||t&&!1===t.end||(r.on("end",onend),r.on("close",onclose));var n=!1;function onend(){n||(n=!0,e.end())}function onclose(){n||(n=!0,"function"==typeof e.destroy&&e.destroy())}function onerror(e){if(cleanup(),0===a.listenerCount(this,"error"))throw e}function cleanup(){r.removeListener("data",ondata),e.removeListener("drain",ondrain),r.removeListener("end",onend),r.removeListener("close",onclose),r.removeListener("error",onerror),e.removeListener("error",onerror),r.removeListener("end",cleanup),r.removeListener("close",cleanup),e.removeListener("close",cleanup)}return r.on("error",onerror),e.on("error",onerror),r.on("end",cleanup),r.on("close",cleanup),e.on("close",cleanup),e.emit("pipe",r),e}},(e,t,r)=>{var a=r(1),n=Object.getOwnPropertyDescriptors||function getOwnPropertyDescriptors(e){for(var t=Object.keys(e),r={},a=0;a=n)return e;switch(e){case"%s":return String(a[r++]);case"%d":return Number(a[r++]);case"%j":try{return JSON.stringify(a[r++])}catch(e){return"[Circular]"}default:return e}})),c=a[r];r=3&&(a.depth=arguments[2]),arguments.length>=4&&(a.colors=arguments[3]),isBoolean(r)?a.showHidden=r:r&&t._extend(a,r),isUndefined(a.showHidden)&&(a.showHidden=!1),isUndefined(a.depth)&&(a.depth=2),isUndefined(a.colors)&&(a.colors=!1),isUndefined(a.customInspect)&&(a.customInspect=!0),a.colors&&(a.stylize=stylizeWithColor),formatValue(a,e,a.depth)}function stylizeWithColor(e,t){var r=inspect.styles[t];return r?"["+inspect.colors[r][0]+"m"+e+"["+inspect.colors[r][1]+"m":e}function stylizeNoColor(e,t){return e}function formatValue(e,r,a){if(e.customInspect&&r&&isFunction(r.inspect)&&r.inspect!==t.inspect&&(!r.constructor||r.constructor.prototype!==r)){var n=r.inspect(a,e);return isString(n)||(n=formatValue(e,n,a)),n}var o=function formatPrimitive(e,t){if(isUndefined(t))return e.stylize("undefined","undefined");if(isString(t)){var r="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(r,"string")}if(isNumber(t))return e.stylize(""+t,"number");if(isBoolean(t))return e.stylize(""+t,"boolean");if(isNull(t))return e.stylize("null","null")}(e,r);if(o)return o;var s=Object.keys(r),c=function arrayToHash(e){var t={};return e.forEach((function(e,r){t[e]=!0})),t}(s);if(e.showHidden&&(s=Object.getOwnPropertyNames(r)),isError(r)&&(s.indexOf("message")>=0||s.indexOf("description")>=0))return formatError(r);if(0===s.length){if(isFunction(r)){var d=r.name?": "+r.name:"";return e.stylize("[Function"+d+"]","special")}if(isRegExp(r))return e.stylize(RegExp.prototype.toString.call(r),"regexp");if(isDate(r))return e.stylize(Date.prototype.toString.call(r),"date");if(isError(r))return formatError(r)}var u,h="",l=!1,b=["{","}"];(isArray(r)&&(l=!0,b=["[","]"]),isFunction(r))&&(h=" [Function"+(r.name?": "+r.name:"")+"]");return isRegExp(r)&&(h=" "+RegExp.prototype.toString.call(r)),isDate(r)&&(h=" "+Date.prototype.toUTCString.call(r)),isError(r)&&(h=" "+formatError(r)),0!==s.length||l&&0!=r.length?a<0?isRegExp(r)?e.stylize(RegExp.prototype.toString.call(r),"regexp"):e.stylize("[Object]","special"):(e.seen.push(r),u=l?function formatArray(e,t,r,a,n){for(var o=[],s=0,c=t.length;s=0&&0,e+t.replace(/\u001b\[\d\d?m/g,"").length+1}),0)>60)return r[0]+(""===t?"":t+"\n ")+" "+e.join(",\n ")+" "+r[1];return r[0]+t+" "+e.join(", ")+" "+r[1]}(u,h,b)):b[0]+h+b[1]}function formatError(e){return"["+Error.prototype.toString.call(e)+"]"}function formatProperty(e,t,r,a,n,o){var s,c,d;if((d=Object.getOwnPropertyDescriptor(t,n)||{value:t[n]}).get?c=d.set?e.stylize("[Getter/Setter]","special"):e.stylize("[Getter]","special"):d.set&&(c=e.stylize("[Setter]","special")),hasOwnProperty(a,n)||(s="["+n+"]"),c||(e.seen.indexOf(d.value)<0?(c=isNull(r)?formatValue(e,d.value,null):formatValue(e,d.value,r-1)).indexOf("\n")>-1&&(c=o?c.split("\n").map((function(e){return" "+e})).join("\n").substr(2):"\n"+c.split("\n").map((function(e){return" "+e})).join("\n")):c=e.stylize("[Circular]","special")),isUndefined(s)){if(o&&n.match(/^\d+$/))return c;(s=JSON.stringify(""+n)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(s=s.substr(1,s.length-2),s=e.stylize(s,"name")):(s=s.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),s=e.stylize(s,"string"))}return s+": "+c}function isArray(e){return Array.isArray(e)}function isBoolean(e){return"boolean"==typeof e}function isNull(e){return null===e}function isNumber(e){return"number"==typeof e}function isString(e){return"string"==typeof e}function isUndefined(e){return void 0===e}function isRegExp(e){return isObject(e)&&"[object RegExp]"===objectToString(e)}function isObject(e){return"object"==typeof e&&null!==e}function isDate(e){return isObject(e)&&"[object Date]"===objectToString(e)}function isError(e){return isObject(e)&&("[object Error]"===objectToString(e)||e instanceof Error)}function isFunction(e){return"function"==typeof e}function objectToString(e){return Object.prototype.toString.call(e)}function pad(e){return e<10?"0"+e.toString(10):e.toString(10)}t.debuglog=function(e){if(e=e.toUpperCase(),!s[e])if(c.test(e)){var r=a.pid;s[e]=function(){var a=t.format.apply(t,arguments);console.error("%s %d: %s",e,r,a)}}else s[e]=function(){};return s[e]},t.inspect=inspect,inspect.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]},inspect.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},t.types=r(808),t.isArray=isArray,t.isBoolean=isBoolean,t.isNull=isNull,t.isNullOrUndefined=function isNullOrUndefined(e){return null==e},t.isNumber=isNumber,t.isString=isString,t.isSymbol=function isSymbol(e){return"symbol"==typeof e},t.isUndefined=isUndefined,t.isRegExp=isRegExp,t.types.isRegExp=isRegExp,t.isObject=isObject,t.isDate=isDate,t.types.isDate=isDate,t.isError=isError,t.types.isNativeError=isError,t.isFunction=isFunction,t.isPrimitive=function isPrimitive(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||void 0===e},t.isBuffer=r(817);var u=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function timestamp(){var e=new Date,t=[pad(e.getHours()),pad(e.getMinutes()),pad(e.getSeconds())].join(":");return[e.getDate(),u[e.getMonth()],t].join(" ")}function hasOwnProperty(e,t){return Object.prototype.hasOwnProperty.call(e,t)}t.log=function(){console.log("%s - %s",timestamp(),t.format.apply(t,arguments))},t.inherits=r(10),t._extend=function(e,t){if(!t||!isObject(t))return e;for(var r=Object.keys(t),a=r.length;a--;)e[r[a]]=t[r[a]];return e};var h="undefined"!=typeof Symbol?Symbol("util.promisify.custom"):void 0;function callbackifyOnRejected(e,t){if(!e){var r=new Error("Promise was rejected with a falsy value");r.reason=e,e=r}return t(e)}t.promisify=function promisify(e){if("function"!=typeof e)throw new TypeError('The "original" argument must be of type Function');if(h&&e[h]){var t;if("function"!=typeof(t=e[h]))throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(t,h,{value:t,enumerable:!1,writable:!1,configurable:!0}),t}function t(){for(var t,r,a=new Promise((function(e,a){t=e,r=a})),n=[],o=0;o{"use strict";var a=r(0).Buffer;Object.defineProperty(t,"__esModule",{value:!0}),t.getLength=t.decode=t.encode=void 0;var n=r(548);function safeParseInt(e,t){if("00"===e.slice(0,2))throw new Error("invalid RLP: extra zeros");return parseInt(e,t)}function encodeLength(e,t){if(e<56)return a.from([e+t]);var r=intToHex(e),n=intToHex(t+55+r.length/2);return a.from(n+r,"hex")}function _decode(e){var t,r,n,o,s,c=[],d=e[0];if(d<=127)return{data:e.slice(0,1),remainder:e.slice(1)};if(d<=183){if(t=d-127,n=128===d?a.from([]):e.slice(1,t),2===t&&n[0]<128)throw new Error("invalid rlp encoding: byte must be less 0x80");return{data:n,remainder:e.slice(t)}}if(d<=191){if(r=d-182,e.length-1e.length)throw new Error("invalid rlp: total length is larger than the data");if(0===(o=e.slice(r,u)).length)throw new Error("invalid rlp, List has a invalid length");for(;o.length;)s=_decode(o),c.push(s.data),o=s.remainder;return{data:c,remainder:e.slice(u)}}function isHexPrefixed(e){return"0x"===e.slice(0,2)}function intToHex(e){if(e<0)throw new Error("Invalid integer as argument, must be unsigned!");var t=e.toString(16);return t.length%2?"0"+t:t}function toBuffer(e){if(!a.isBuffer(e)){if("string"==typeof e)return isHexPrefixed(e)?a.from(function padToEven(e){return e.length%2?"0"+e:e}(function stripHexPrefix(e){return"string"!=typeof e?e:isHexPrefixed(e)?e.slice(2):e}(e)),"hex"):a.from(e);if("number"==typeof e||"bigint"==typeof e)return e?function intToBuffer(e){var t=intToHex(e);return a.from(t,"hex")}(e):a.from([]);if(null==e)return a.from([]);if(e instanceof Uint8Array)return a.from(e);if(n.isBN(e))return a.from(e.toArray());throw new Error("invalid type")}return e}t.encode=function encode(e){if(Array.isArray(e)){for(var t=[],r=0;r{var a=r(2),n=a.Buffer;function copyProps(e,t){for(var r in e)t[r]=e[r]}function SafeBuffer(e,t,r){return n(e,t,r)}n.from&&n.alloc&&n.allocUnsafe&&n.allocUnsafeSlow?e.exports=a:(copyProps(a,t),t.Buffer=SafeBuffer),SafeBuffer.prototype=Object.create(n.prototype),copyProps(n,SafeBuffer),SafeBuffer.from=function(e,t,r){if("number"==typeof e)throw new TypeError("Argument must not be a number");return n(e,t,r)},SafeBuffer.alloc=function(e,t,r){if("number"!=typeof e)throw new TypeError("Argument must be a number");var a=n(e);return void 0!==t?"string"==typeof r?a.fill(t,r):a.fill(t):a.fill(0),a},SafeBuffer.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return n(e)},SafeBuffer.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return a.SlowBuffer(e)}},function(e,t,r){"use strict";var a,n=r(0).Buffer,o=this&&this.__extends||(a=function(e,t){return(a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function __(){this.constructor=e}a(e,t),e.prototype=null===t?Object.create(t):(__.prototype=t.prototype,new __)}),s=this&&this.__assign||function(){return(s=Object.assign||function(e){for(var t,r=1,a=arguments.length;r=e.length&&(e=void 0),{value:e&&e[a++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0}),t.Hardfork=t.Chain=t.CustomChain=void 0;var d,u,h=r(32),l=r(1060),b=r(5),g=r(289),p=r(1412),B=r(1425);!function(e){e.PolygonMainnet="polygon-mainnet",e.PolygonMumbai="polygon-mumbai",e.ArbitrumRinkebyTestnet="arbitrum-rinkeby-testnet",e.xDaiChain="x-dai-chain"}(d=t.CustomChain||(t.CustomChain={})),function(e){e[e.Mainnet=1]="Mainnet",e[e.Ropsten=3]="Ropsten",e[e.Rinkeby=4]="Rinkeby",e[e.Kovan=42]="Kovan",e[e.Goerli=5]="Goerli",e[e.Calaveras=123]="Calaveras"}(t.Chain||(t.Chain={})),function(e){e.Chainstart="chainstart",e.Homestead="homestead",e.Dao="dao",e.TangerineWhistle="tangerineWhistle",e.SpuriousDragon="spuriousDragon",e.Byzantium="byzantium",e.Constantinople="constantinople",e.Petersburg="petersburg",e.Istanbul="istanbul",e.MuirGlacier="muirGlacier",e.Berlin="berlin",e.London="london"}(u=t.Hardfork||(t.Hardfork={}));var m=function(e){function Common(t){var r,a,n=e.call(this)||this;return n._supportedHardforks=[],n._eips=[],n._customChains=null!==(r=t.customChains)&&void 0!==r?r:[],n._chainParams=n.setChain(t.chain),n.DEFAULT_HARDFORK=null!==(a=n._chainParams.defaultHardfork)&&void 0!==a?a:u.Istanbul,n._hardfork=n.DEFAULT_HARDFORK,t.supportedHardforks&&(n._supportedHardforks=t.supportedHardforks),t.hardfork&&n.setHardfork(t.hardfork),t.eips&&n.setEIPs(t.eips),n}return o(Common,e),Common.custom=function(e,t){var r;void 0===t&&(t={});var a=null!==(r=t.baseChain)&&void 0!==r?r:"mainnet",n=s({},Common._getChainParams(a));if(n.name="custom-chain","string"!=typeof e)return new Common(s({chain:s(s({},n),e)},t));if(e===d.PolygonMainnet)return Common.custom({name:d.PolygonMainnet,chainId:137,networkId:137});if(e===d.PolygonMumbai)return Common.custom({name:d.PolygonMumbai,chainId:80001,networkId:80001});if(e===d.ArbitrumRinkebyTestnet)return Common.custom({name:d.ArbitrumRinkebyTestnet,chainId:421611,networkId:421611});if(e===d.xDaiChain)return Common.custom({name:d.xDaiChain,chainId:100,networkId:100});throw new Error("Custom chain "+e+" not supported")},Common.forCustomChain=function(e,t,r,a){var n=Common._getChainParams(e);return new Common({chain:s(s({},n),t),hardfork:r,supportedHardforks:a})},Common.isSupportedChainId=function(e){var t=g._getInitializedChains();return Boolean(t.names[e.toString()])},Common._getChainParams=function(e,t){var r=g._getInitializedChains(t);if("number"==typeof e||b.BN.isBN(e)){if(e=e.toString(),r.names[e])return r[r.names[e]];throw new Error("Chain with ID "+e+" not supported")}if(r[e])return r[e];throw new Error("Chain with name "+e+" not supported")},Common.prototype.setChain=function(e){var t,r;if("number"==typeof e||"string"==typeof e||b.BN.isBN(e))this._chainParams=Common._getChainParams(e,this._customChains);else{if("object"!=typeof e)throw new Error("Wrong input format");if(this._customChains.length>0)throw new Error("Chain must be a string, number, or BN when initialized with customChains passed in");try{for(var a=c(["networkId","genesis","hardforks","bootstrapNodes"]),n=a.next();!n.done;n=a.next()){var o=n.value;if(void 0===e[o])throw new Error("Missing required chain parameter: "+o)}}catch(e){t={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(t)throw t.error}}this._chainParams=e}return this._chainParams},Common.prototype.setHardfork=function(e){var t,r;if(!this._isSupportedHardfork(e))throw new Error("Hardfork "+e+" not set as supported in supportedHardforks");var a=!1;try{for(var n=c(p.hardforks),o=n.next();!o.done;o=n.next()){o.value[0]===e&&(this._hardfork!==e&&(this._hardfork=e,this.emit("hardforkChanged",e)),a=!0)}}catch(e){t={error:e}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}if(!a)throw new Error("Hardfork with name "+e+" not supported")},Common.prototype.getHardforkByBlockNumber=function(e){var t,r;e=b.toType(e,b.TypeOutput.BN);var a=u.Chainstart;try{for(var n=c(this.hardforks()),o=n.next();!o.done;o=n.next()){var s=o.value;null!==s.block&&(e.gte(new b.BN(s.block))&&(a=s.name))}}catch(e){t={error:e}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}return a},Common.prototype.setHardforkByBlockNumber=function(e){e=b.toType(e,b.TypeOutput.BN);var t=this.getHardforkByBlockNumber(e);return this.setHardfork(t),t},Common.prototype._chooseHardfork=function(e,t){if(void 0===t&&(t=!0),e){if(t&&!this._isSupportedHardfork(e))throw new Error("Hardfork "+e+" not set as supported in supportedHardforks")}else e=this._hardfork;return e},Common.prototype._getHardfork=function(e){var t,r,a=this.hardforks();try{for(var n=c(a),o=n.next();!o.done;o=n.next()){var s=o.value;if(s.name===e)return s}}catch(e){t={error:e}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}throw new Error("Hardfork "+e+" not defined for chain "+this.chainName())},Common.prototype._isSupportedHardfork=function(e){var t,r;if(!(this._supportedHardforks.length>0))return!0;try{for(var a=c(this._supportedHardforks),n=a.next();!n.done;n=a.next()){if(e===n.value)return!0}}catch(e){t={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(t)throw t.error}}return!1},Common.prototype.setEIPs=function(e){var t,r,a=this;void 0===e&&(e=[]);var _loop_1=function(t){if(!(t in B.EIPs))throw new Error(t+" not supported");var r=n.gteHardfork(B.EIPs[t].minimumHardfork);if(!r)throw new Error(t+" cannot be activated on hardfork "+n.hardfork()+", minimumHardfork: "+r);B.EIPs[t].requiredEIPs&&B.EIPs[t].requiredEIPs.forEach((function(r){if(!e.includes(r)&&!a.isActivatedEIP(r))throw new Error(t+" requires EIP "+r+", but is not included in the EIP list")}))},n=this;try{for(var o=c(e),s=o.next();!s.done;s=o.next()){_loop_1(s.value)}}catch(e){t={error:e}}finally{try{s&&!s.done&&(r=o.return)&&r.call(o)}finally{if(t)throw t.error}}this._eips=e},Common.prototype.param=function(e,t){var r,a,n=null;try{for(var o=c(this._eips),s=o.next();!s.done;s=o.next()){var d=s.value;if(null!==(n=this.paramByEIP(e,t,d)))return n}}catch(e){r={error:e}}finally{try{s&&!s.done&&(a=o.return)&&a.call(o)}finally{if(r)throw r.error}}return this.paramByHardfork(e,t,this._hardfork)},Common.prototype.paramByHardfork=function(e,t,r){var a,n,o,s;r=this._chooseHardfork(r);var d=null;try{for(var u=c(p.hardforks),h=u.next();!h.done;h=u.next()){var l=h.value;if(l[1].hasOwnProperty("eips")){var b=l[1].eips;try{for(var g=(o=void 0,c(b)),B=g.next();!B.done;B=g.next()){var m=B.value,I=this.paramByEIP(e,t,m);d=null!==I?I:d}}catch(e){o={error:e}}finally{try{B&&!B.done&&(s=g.return)&&s.call(g)}finally{if(o)throw o.error}}}else{if(!l[1][e])throw new Error("Topic "+e+" not defined");void 0!==l[1][e][t]&&(d=l[1][e][t].v)}if(l[0]===r)break}}catch(e){a={error:e}}finally{try{h&&!h.done&&(n=u.return)&&n.call(u)}finally{if(a)throw a.error}}return d},Common.prototype.paramByEIP=function(e,t,r){if(!(r in B.EIPs))throw new Error(r+" not supported");var a=B.EIPs[r];if(!(e in a))throw new Error("Topic "+e+" not defined");return void 0===a[e][t]?null:a[e][t].v},Common.prototype.paramByBlock=function(e,t,r){var a=this.activeHardforks(r),n=a[a.length-1].name;return this.paramByHardfork(e,t,n)},Common.prototype.isActivatedEIP=function(e){var t,r;if(this.eips().includes(e))return!0;try{for(var a=c(p.hardforks),n=a.next();!n.done;n=a.next()){var o=n.value[1];if(this.gteHardfork(o.name)&&"eips"in o&&o.eips.includes(e))return!0}}catch(e){t={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(t)throw t.error}}return!1},Common.prototype.hardforkIsActiveOnBlock=function(e,t,r){var a;void 0===r&&(r={}),t=b.toType(t,b.TypeOutput.BN);var n=null!==(a=r.onlySupported)&&void 0!==a&&a;e=this._chooseHardfork(e,n);var o=this.hardforkBlockBN(e);return!(!o||!t.gte(o))},Common.prototype.activeOnBlock=function(e,t){return this.hardforkIsActiveOnBlock(null,e,t)},Common.prototype.hardforkGteHardfork=function(e,t,r){var a,n;void 0===r&&(r={});var o,s=void 0!==r.onlyActive&&r.onlyActive;e=this._chooseHardfork(e,r.onlySupported),o=s?this.activeHardforks(null,r):this.hardforks();var d=-1,u=-1,h=0;try{for(var l=c(o),b=l.next();!b.done;b=l.next()){var g=b.value;g.name===e&&(d=h),g.name===t&&(u=h),h+=1}}catch(e){a={error:e}}finally{try{b&&!b.done&&(n=l.return)&&n.call(l)}finally{if(a)throw a.error}}return d>=u&&-1!==u},Common.prototype.gteHardfork=function(e,t){return this.hardforkGteHardfork(null,e,t)},Common.prototype.hardforkIsActiveOnChain=function(e,t){var r,a,n;void 0===t&&(t={});var o=null!==(n=t.onlySupported)&&void 0!==n&&n;e=this._chooseHardfork(e,o);try{for(var s=c(this.hardforks()),d=s.next();!d.done;d=s.next()){var u=d.value;if(u.name===e&&null!==u.block)return!0}}catch(e){r={error:e}}finally{try{d&&!d.done&&(a=s.return)&&a.call(s)}finally{if(r)throw r.error}}return!1},Common.prototype.activeHardforks=function(e,t){var r,a;void 0===t&&(t={});var n=[],o=this.hardforks();try{for(var s=c(o),d=s.next();!d.done;d=s.next()){var u=d.value;if(null!==u.block){if(null!=e&&e0)return r[r.length-1].name;throw new Error("No (supported) active hardfork found")},Common.prototype.hardforkBlock=function(e){return b.toType(this.hardforkBlockBN(e),b.TypeOutput.Number)},Common.prototype.hardforkBlockBN=function(e){return e=this._chooseHardfork(e,!1),new b.BN(this._getHardfork(e).block)},Common.prototype.isHardforkBlock=function(e,t){return e=b.toType(e,b.TypeOutput.BN),t=this._chooseHardfork(t,!1),this.hardforkBlockBN(t).eq(e)},Common.prototype.nextHardforkBlock=function(e){var t=this.nextHardforkBlockBN(e);return null===t?null:b.toType(t,b.TypeOutput.Number)},Common.prototype.nextHardforkBlockBN=function(e){e=this._chooseHardfork(e,!1);var t=this.hardforkBlockBN(e);return this.hardforks().reduce((function(e,r){var a=new b.BN(r.block);return a.gt(t)&&null===e?a:e}),null)},Common.prototype.isNextHardforkBlock=function(e,t){e=b.toType(e,b.TypeOutput.BN),t=this._chooseHardfork(t,!1);var r=this.nextHardforkBlockBN(t);return null!==r&&r.eq(e)},Common.prototype._calcForkHash=function(e){var t,r,a=n.from(this.genesis().hash.substr(2),"hex"),o=n.alloc(0),s=0;try{for(var d=c(this.hardforks()),u=d.next();!u.done;u=d.next()){var h=u.value,g=h.block;if(0!==g&&null!==g&&g!==s){var p=n.from(g.toString(16).padStart(16,"0"),"hex");o=n.concat([o,p])}if(h.name===e)break;s=g}}catch(e){t={error:e}}finally{try{u&&!u.done&&(r=d.return)&&r.call(d)}finally{if(t)throw t.error}}var B=n.concat([a,o]);return"0x"+b.intToBuffer(l.buf(B)>>>0).toString("hex")},Common.prototype.forkHash=function(e){e=this._chooseHardfork(e,!1);var t=this._getHardfork(e);if(null===t.block){throw new Error("No fork hash calculation possible for non-applied or future hardfork")}return void 0!==t.forkHash?t.forkHash:this._calcForkHash(e)},Common.prototype.hardforkForForkHash=function(e){var t=this.hardforks().filter((function(t){return t.forkHash===e}));return t.length>=1?t[t.length-1]:null},Common.prototype.genesis=function(){return this._chainParams.genesis},Common.prototype.hardforks=function(){return this._chainParams.hardforks},Common.prototype.bootstrapNodes=function(){return this._chainParams.bootstrapNodes},Common.prototype.dnsNetworks=function(){return this._chainParams.dnsNetworks},Common.prototype.hardfork=function(){return this._hardfork},Common.prototype.chainId=function(){return b.toType(this.chainIdBN(),b.TypeOutput.Number)},Common.prototype.chainIdBN=function(){return new b.BN(this._chainParams.chainId)},Common.prototype.chainName=function(){return this._chainParams.name},Common.prototype.networkId=function(){return b.toType(this.networkIdBN(),b.TypeOutput.Number)},Common.prototype.networkIdBN=function(){return new b.BN(this._chainParams.networkId)},Common.prototype.eips=function(){return this._eips},Common.prototype.consensusType=function(){return this._chainParams.consensus.type},Common.prototype.consensusAlgorithm=function(){return this._chainParams.consensus.algorithm},Common.prototype.consensusConfig=function(){return this._chainParams.consensus[this.consensusAlgorithm()]},Common.prototype.copy=function(){return Object.assign(Object.create(Object.getPrototypeOf(this)),this)},Common}(h.EventEmitter);t.default=m},function(e,t,r){"use strict";var a=r(0).Buffer,n=this&&this.__createBinding||(Object.create?function(e,t,r,a){void 0===a&&(a=r),Object.defineProperty(e,a,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,a){void 0===a&&(a=r),e[a]=t[r]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),s=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.hasOwnProperty.call(e,r)&&n(t,e,r);return o(t,e),t},c=this&&this.__awaiter||function(e,t,r,a){return new(r||(r=Promise))((function(n,o){function fulfilled(e){try{step(a.next(e))}catch(e){o(e)}}function rejected(e){try{step(a.throw(e))}catch(e){o(e)}}function step(e){e.done?n(e.value):function adopt(e){return e instanceof r?e:new r((function(t){t(e)}))}(e.value).then(fulfilled,rejected)}step((a=a.apply(e,t||[])).next())}))},d=this&&this.__generator||function(e,t){var r,a,n,o,s={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return o={next:verb(0),throw:verb(1),return:verb(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function verb(o){return function(c){return function step(o){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,a&&(n=2&o[0]?a.return:o[0]?a.throw||((n=a.return)&&n.call(a),0):a.next)&&!(n=n.call(a,o[1])).done)return n;switch(a=0,n&&(o=[2&o[0],n.value]),o[0]){case 0:case 1:n=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,a=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(n=s.trys,(n=n.length>0&&n[n.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!n||o[1]>n[0]&&o[1]0)&&!(a=o.next()).done;)s.push(a.value)}catch(e){n={error:e}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return s},h=this&&this.__spread||function(){for(var e=[],t=0;t{"use strict";var a=r(2).Buffer;Object.defineProperty(t,"__esModule",{value:!0}),t.decode=t.encodeLength=t.encode=t.digest=t.encodeRange=t.getLength=void 0;const n=r(1273);Object.defineProperty(t,"getLength",{enumerable:!0,get:function(){return n.getLength}});const o=r(8);function encode(e){if(Array.isArray(e)){let t=0;const r=[];for(let a=0,n=e.length;a{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Address=void 0;const a=r(8);class Address extends a.Data{constructor(e){super(e,Address.ByteLength)}static from(e){return new Address(e)}}t.Address=Address,Address.ByteLength=20},function(e,t,r){!function(e,t){"use strict";function assert(e,t){if(!e)throw new Error(t||"Assertion failed")}function inherits(e,t){e.super_=t;var TempCtor=function(){};TempCtor.prototype=t.prototype,e.prototype=new TempCtor,e.prototype.constructor=e}function BN(e,t,r){if(BN.isBN(e))return e;this.negative=0,this.words=null,this.length=0,this.red=null,null!==e&&("le"!==t&&"be"!==t||(r=t,t=10),this._init(e||0,t||10,r||"be"))}var a;"object"==typeof e?e.exports=BN:t.BN=BN,BN.BN=BN,BN.wordSize=26;try{a="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:r(17).Buffer}catch(e){}function parseHex4Bits(e,t){var r=e.charCodeAt(t);return r>=48&&r<=57?r-48:r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:void assert(!1,"Invalid character in "+e)}function parseHexByte(e,t,r){var a=parseHex4Bits(e,r);return r-1>=t&&(a|=parseHex4Bits(e,r-1)<<4),a}function parseBase(e,t,r,a){for(var n=0,o=0,s=Math.min(e.length,r),c=t;c=49?d-49+10:d>=17?d-17+10:d,assert(d>=0&&o0?e:t},BN.min=function min(e,t){return e.cmp(t)<0?e:t},BN.prototype._init=function init(e,t,r){if("number"==typeof e)return this._initNumber(e,t,r);if("object"==typeof e)return this._initArray(e,t,r);"hex"===t&&(t=16),assert(t===(0|t)&&t>=2&&t<=36);var a=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&(a++,this.negative=1),a=0;a-=3)o=e[a]|e[a-1]<<8|e[a-2]<<16,this.words[n]|=o<>>26-s&67108863,(s+=24)>=26&&(s-=26,n++);else if("le"===r)for(a=0,n=0;a>>26-s&67108863,(s+=24)>=26&&(s-=26,n++);return this._strip()},BN.prototype._parseHex=function _parseHex(e,t,r){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var a=0;a=t;a-=2)n=parseHexByte(e,t,a)<=18?(o-=18,s+=1,this.words[s]|=n>>>26):o+=8;else for(a=(e.length-t)%2==0?t+1:t;a=18?(o-=18,s+=1,this.words[s]|=n>>>26):o+=8;this._strip()},BN.prototype._parseBase=function _parseBase(e,t,r){this.words=[0],this.length=1;for(var a=0,n=1;n<=67108863;n*=t)a++;a--,n=n/t|0;for(var o=e.length-r,s=o%a,c=Math.min(o,o-s)+r,d=0,u=r;u1&&0===this.words[this.length-1];)this.length--;return this._normSign()},BN.prototype._normSign=function _normSign(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for)try{BN.prototype[Symbol.for("nodejs.util.inspect.custom")]=inspect}catch(e){BN.prototype.inspect=inspect}else BN.prototype.inspect=inspect;function inspect(){return(this.red?""}var n=["","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"],o=[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],s=[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];BN.prototype.toString=function toString(e,t){var r;if(t=0|t||1,16===(e=e||10)||"hex"===e){r="";for(var a=0,c=0,d=0;d>>24-a&16777215)||d!==this.length-1?n[6-h.length]+h+r:h+r,(a+=2)>=26&&(a-=26,d--)}for(0!==c&&(r=c.toString(16)+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(e===(0|e)&&e>=2&&e<=36){var l=o[e],b=s[e];r="";var g=this.clone();for(g.negative=0;!g.isZero();){var p=g.modrn(b).toString(e);r=(g=g.idivn(b)).isZero()?p+r:n[l-p.length]+p+r}for(this.isZero()&&(r="0"+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}assert(!1,"Base should be between 2 and 36")},BN.prototype.toNumber=function toNumber(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&assert(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},BN.prototype.toJSON=function toJSON(){return this.toString(16,2)},a&&(BN.prototype.toBuffer=function toBuffer(e,t){return this.toArrayLike(a,e,t)}),BN.prototype.toArray=function toArray(e,t){return this.toArrayLike(Array,e,t)};function smallMulTo(e,t,r){r.negative=t.negative^e.negative;var a=e.length+t.length|0;r.length=a,a=a-1|0;var n=0|e.words[0],o=0|t.words[0],s=n*o,c=67108863&s,d=s/67108864|0;r.words[0]=c;for(var u=1;u>>26,l=67108863&d,b=Math.min(u,t.length-1),g=Math.max(0,u-e.length+1);g<=b;g++){var p=u-g|0;h+=(s=(n=0|e.words[p])*(o=0|t.words[g])+l)/67108864|0,l=67108863&s}r.words[u]=0|l,d=0|h}return 0!==d?r.words[u]=0|d:r.length--,r._strip()}BN.prototype.toArrayLike=function toArrayLike(e,t,r){this._strip();var a=this.byteLength(),n=r||Math.max(1,a);assert(a<=n,"byte array longer than desired length"),assert(n>0,"Requested array length <= 0");var o=function allocate(e,t){return e.allocUnsafe?e.allocUnsafe(t):new e(t)}(e,n);return this["_toArrayLike"+("le"===t?"LE":"BE")](o,a),o},BN.prototype._toArrayLikeLE=function _toArrayLikeLE(e,t){for(var r=0,a=0,n=0,o=0;n>8&255),r>16&255),6===o?(r>24&255),a=0,o=0):(a=s>>>24,o+=2)}if(r=0&&(e[r--]=s>>8&255),r>=0&&(e[r--]=s>>16&255),6===o?(r>=0&&(e[r--]=s>>24&255),a=0,o=0):(a=s>>>24,o+=2)}if(r>=0)for(e[r--]=a;r>=0;)e[r--]=0},Math.clz32?BN.prototype._countBits=function _countBits(e){return 32-Math.clz32(e)}:BN.prototype._countBits=function _countBits(e){var t=e,r=0;return t>=4096&&(r+=13,t>>>=13),t>=64&&(r+=7,t>>>=7),t>=8&&(r+=4,t>>>=4),t>=2&&(r+=2,t>>>=2),r+t},BN.prototype._zeroBits=function _zeroBits(e){if(0===e)return 26;var t=e,r=0;return 0==(8191&t)&&(r+=13,t>>>=13),0==(127&t)&&(r+=7,t>>>=7),0==(15&t)&&(r+=4,t>>>=4),0==(3&t)&&(r+=2,t>>>=2),0==(1&t)&&r++,r},BN.prototype.bitLength=function bitLength(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},BN.prototype.zeroBits=function zeroBits(){if(this.isZero())return 0;for(var e=0,t=0;te.length?this.clone().ior(e):e.clone().ior(this)},BN.prototype.uor=function uor(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},BN.prototype.iuand=function iuand(e){var t;t=this.length>e.length?e:this;for(var r=0;re.length?this.clone().iand(e):e.clone().iand(this)},BN.prototype.uand=function uand(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},BN.prototype.iuxor=function iuxor(e){var t,r;this.length>e.length?(t=this,r=e):(t=e,r=this);for(var a=0;ae.length?this.clone().ixor(e):e.clone().ixor(this)},BN.prototype.uxor=function uxor(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},BN.prototype.inotn=function inotn(e){assert("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),r=e%26;this._expand(t),r>0&&t--;for(var a=0;a0&&(this.words[a]=~this.words[a]&67108863>>26-r),this._strip()},BN.prototype.notn=function notn(e){return this.clone().inotn(e)},BN.prototype.setn=function setn(e,t){assert("number"==typeof e&&e>=0);var r=e/26|0,a=e%26;return this._expand(r+1),this.words[r]=t?this.words[r]|1<e.length?(r=this,a=e):(r=e,a=this);for(var n=0,o=0;o>>26;for(;0!==n&&o>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;oe.length?this.clone().iadd(e):e.clone().iadd(this)},BN.prototype.isub=function isub(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var r,a,n=this.cmp(e);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,a=e):(r=e,a=this);for(var o=0,s=0;s>26,this.words[s]=67108863&t;for(;0!==o&&s>26,this.words[s]=67108863&t;if(0===o&&s>>13,g=0|s[1],p=8191&g,B=g>>>13,m=0|s[2],I=8191&m,y=m>>>13,v=0|s[3],x=8191&v,C=v>>>13,Q=0|s[4],w=8191&Q,_=Q>>>13,k=0|s[5],N=8191&k,D=k>>>13,U=0|s[6],G=8191&U,T=U>>>13,L=0|s[7],P=8191&L,q=L>>>13,O=0|s[8],H=8191&O,Y=O>>>13,j=0|s[9],J=8191&j,z=j>>>13,W=0|c[0],V=8191&W,X=W>>>13,$=0|c[1],et=8191&$,tt=$>>>13,rt=0|c[2],at=8191&rt,it=rt>>>13,nt=0|c[3],ot=8191&nt,At=nt>>>13,st=0|c[4],ct=8191&st,dt=st>>>13,ut=0|c[5],ht=8191&ut,bt=ut>>>13,pt=0|c[6],Bt=8191&pt,mt=pt>>>13,It=0|c[7],Et=8191&It,yt=It>>>13,vt=0|c[8],xt=8191&vt,Ct=vt>>>13,Qt=0|c[9],wt=8191&Qt,Mt=Qt>>>13;r.negative=e.negative^t.negative,r.length=19;var _t=(u+(a=Math.imul(l,V))|0)+((8191&(n=(n=Math.imul(l,X))+Math.imul(b,V)|0))<<13)|0;u=((o=Math.imul(b,X))+(n>>>13)|0)+(_t>>>26)|0,_t&=67108863,a=Math.imul(p,V),n=(n=Math.imul(p,X))+Math.imul(B,V)|0,o=Math.imul(B,X);var kt=(u+(a=a+Math.imul(l,et)|0)|0)+((8191&(n=(n=n+Math.imul(l,tt)|0)+Math.imul(b,et)|0))<<13)|0;u=((o=o+Math.imul(b,tt)|0)+(n>>>13)|0)+(kt>>>26)|0,kt&=67108863,a=Math.imul(I,V),n=(n=Math.imul(I,X))+Math.imul(y,V)|0,o=Math.imul(y,X),a=a+Math.imul(p,et)|0,n=(n=n+Math.imul(p,tt)|0)+Math.imul(B,et)|0,o=o+Math.imul(B,tt)|0;var St=(u+(a=a+Math.imul(l,at)|0)|0)+((8191&(n=(n=n+Math.imul(l,it)|0)+Math.imul(b,at)|0))<<13)|0;u=((o=o+Math.imul(b,it)|0)+(n>>>13)|0)+(St>>>26)|0,St&=67108863,a=Math.imul(x,V),n=(n=Math.imul(x,X))+Math.imul(C,V)|0,o=Math.imul(C,X),a=a+Math.imul(I,et)|0,n=(n=n+Math.imul(I,tt)|0)+Math.imul(y,et)|0,o=o+Math.imul(y,tt)|0,a=a+Math.imul(p,at)|0,n=(n=n+Math.imul(p,it)|0)+Math.imul(B,at)|0,o=o+Math.imul(B,it)|0;var Nt=(u+(a=a+Math.imul(l,ot)|0)|0)+((8191&(n=(n=n+Math.imul(l,At)|0)+Math.imul(b,ot)|0))<<13)|0;u=((o=o+Math.imul(b,At)|0)+(n>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,a=Math.imul(w,V),n=(n=Math.imul(w,X))+Math.imul(_,V)|0,o=Math.imul(_,X),a=a+Math.imul(x,et)|0,n=(n=n+Math.imul(x,tt)|0)+Math.imul(C,et)|0,o=o+Math.imul(C,tt)|0,a=a+Math.imul(I,at)|0,n=(n=n+Math.imul(I,it)|0)+Math.imul(y,at)|0,o=o+Math.imul(y,it)|0,a=a+Math.imul(p,ot)|0,n=(n=n+Math.imul(p,At)|0)+Math.imul(B,ot)|0,o=o+Math.imul(B,At)|0;var Dt=(u+(a=a+Math.imul(l,ct)|0)|0)+((8191&(n=(n=n+Math.imul(l,dt)|0)+Math.imul(b,ct)|0))<<13)|0;u=((o=o+Math.imul(b,dt)|0)+(n>>>13)|0)+(Dt>>>26)|0,Dt&=67108863,a=Math.imul(N,V),n=(n=Math.imul(N,X))+Math.imul(D,V)|0,o=Math.imul(D,X),a=a+Math.imul(w,et)|0,n=(n=n+Math.imul(w,tt)|0)+Math.imul(_,et)|0,o=o+Math.imul(_,tt)|0,a=a+Math.imul(x,at)|0,n=(n=n+Math.imul(x,it)|0)+Math.imul(C,at)|0,o=o+Math.imul(C,it)|0,a=a+Math.imul(I,ot)|0,n=(n=n+Math.imul(I,At)|0)+Math.imul(y,ot)|0,o=o+Math.imul(y,At)|0,a=a+Math.imul(p,ct)|0,n=(n=n+Math.imul(p,dt)|0)+Math.imul(B,ct)|0,o=o+Math.imul(B,dt)|0;var Rt=(u+(a=a+Math.imul(l,ht)|0)|0)+((8191&(n=(n=n+Math.imul(l,bt)|0)+Math.imul(b,ht)|0))<<13)|0;u=((o=o+Math.imul(b,bt)|0)+(n>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,a=Math.imul(G,V),n=(n=Math.imul(G,X))+Math.imul(T,V)|0,o=Math.imul(T,X),a=a+Math.imul(N,et)|0,n=(n=n+Math.imul(N,tt)|0)+Math.imul(D,et)|0,o=o+Math.imul(D,tt)|0,a=a+Math.imul(w,at)|0,n=(n=n+Math.imul(w,it)|0)+Math.imul(_,at)|0,o=o+Math.imul(_,it)|0,a=a+Math.imul(x,ot)|0,n=(n=n+Math.imul(x,At)|0)+Math.imul(C,ot)|0,o=o+Math.imul(C,At)|0,a=a+Math.imul(I,ct)|0,n=(n=n+Math.imul(I,dt)|0)+Math.imul(y,ct)|0,o=o+Math.imul(y,dt)|0,a=a+Math.imul(p,ht)|0,n=(n=n+Math.imul(p,bt)|0)+Math.imul(B,ht)|0,o=o+Math.imul(B,bt)|0;var Ft=(u+(a=a+Math.imul(l,Bt)|0)|0)+((8191&(n=(n=n+Math.imul(l,mt)|0)+Math.imul(b,Bt)|0))<<13)|0;u=((o=o+Math.imul(b,mt)|0)+(n>>>13)|0)+(Ft>>>26)|0,Ft&=67108863,a=Math.imul(P,V),n=(n=Math.imul(P,X))+Math.imul(q,V)|0,o=Math.imul(q,X),a=a+Math.imul(G,et)|0,n=(n=n+Math.imul(G,tt)|0)+Math.imul(T,et)|0,o=o+Math.imul(T,tt)|0,a=a+Math.imul(N,at)|0,n=(n=n+Math.imul(N,it)|0)+Math.imul(D,at)|0,o=o+Math.imul(D,it)|0,a=a+Math.imul(w,ot)|0,n=(n=n+Math.imul(w,At)|0)+Math.imul(_,ot)|0,o=o+Math.imul(_,At)|0,a=a+Math.imul(x,ct)|0,n=(n=n+Math.imul(x,dt)|0)+Math.imul(C,ct)|0,o=o+Math.imul(C,dt)|0,a=a+Math.imul(I,ht)|0,n=(n=n+Math.imul(I,bt)|0)+Math.imul(y,ht)|0,o=o+Math.imul(y,bt)|0,a=a+Math.imul(p,Bt)|0,n=(n=n+Math.imul(p,mt)|0)+Math.imul(B,Bt)|0,o=o+Math.imul(B,mt)|0;var Ut=(u+(a=a+Math.imul(l,Et)|0)|0)+((8191&(n=(n=n+Math.imul(l,yt)|0)+Math.imul(b,Et)|0))<<13)|0;u=((o=o+Math.imul(b,yt)|0)+(n>>>13)|0)+(Ut>>>26)|0,Ut&=67108863,a=Math.imul(H,V),n=(n=Math.imul(H,X))+Math.imul(Y,V)|0,o=Math.imul(Y,X),a=a+Math.imul(P,et)|0,n=(n=n+Math.imul(P,tt)|0)+Math.imul(q,et)|0,o=o+Math.imul(q,tt)|0,a=a+Math.imul(G,at)|0,n=(n=n+Math.imul(G,it)|0)+Math.imul(T,at)|0,o=o+Math.imul(T,it)|0,a=a+Math.imul(N,ot)|0,n=(n=n+Math.imul(N,At)|0)+Math.imul(D,ot)|0,o=o+Math.imul(D,At)|0,a=a+Math.imul(w,ct)|0,n=(n=n+Math.imul(w,dt)|0)+Math.imul(_,ct)|0,o=o+Math.imul(_,dt)|0,a=a+Math.imul(x,ht)|0,n=(n=n+Math.imul(x,bt)|0)+Math.imul(C,ht)|0,o=o+Math.imul(C,bt)|0,a=a+Math.imul(I,Bt)|0,n=(n=n+Math.imul(I,mt)|0)+Math.imul(y,Bt)|0,o=o+Math.imul(y,mt)|0,a=a+Math.imul(p,Et)|0,n=(n=n+Math.imul(p,yt)|0)+Math.imul(B,Et)|0,o=o+Math.imul(B,yt)|0;var Gt=(u+(a=a+Math.imul(l,xt)|0)|0)+((8191&(n=(n=n+Math.imul(l,Ct)|0)+Math.imul(b,xt)|0))<<13)|0;u=((o=o+Math.imul(b,Ct)|0)+(n>>>13)|0)+(Gt>>>26)|0,Gt&=67108863,a=Math.imul(J,V),n=(n=Math.imul(J,X))+Math.imul(z,V)|0,o=Math.imul(z,X),a=a+Math.imul(H,et)|0,n=(n=n+Math.imul(H,tt)|0)+Math.imul(Y,et)|0,o=o+Math.imul(Y,tt)|0,a=a+Math.imul(P,at)|0,n=(n=n+Math.imul(P,it)|0)+Math.imul(q,at)|0,o=o+Math.imul(q,it)|0,a=a+Math.imul(G,ot)|0,n=(n=n+Math.imul(G,At)|0)+Math.imul(T,ot)|0,o=o+Math.imul(T,At)|0,a=a+Math.imul(N,ct)|0,n=(n=n+Math.imul(N,dt)|0)+Math.imul(D,ct)|0,o=o+Math.imul(D,dt)|0,a=a+Math.imul(w,ht)|0,n=(n=n+Math.imul(w,bt)|0)+Math.imul(_,ht)|0,o=o+Math.imul(_,bt)|0,a=a+Math.imul(x,Bt)|0,n=(n=n+Math.imul(x,mt)|0)+Math.imul(C,Bt)|0,o=o+Math.imul(C,mt)|0,a=a+Math.imul(I,Et)|0,n=(n=n+Math.imul(I,yt)|0)+Math.imul(y,Et)|0,o=o+Math.imul(y,yt)|0,a=a+Math.imul(p,xt)|0,n=(n=n+Math.imul(p,Ct)|0)+Math.imul(B,xt)|0,o=o+Math.imul(B,Ct)|0;var Tt=(u+(a=a+Math.imul(l,wt)|0)|0)+((8191&(n=(n=n+Math.imul(l,Mt)|0)+Math.imul(b,wt)|0))<<13)|0;u=((o=o+Math.imul(b,Mt)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,a=Math.imul(J,et),n=(n=Math.imul(J,tt))+Math.imul(z,et)|0,o=Math.imul(z,tt),a=a+Math.imul(H,at)|0,n=(n=n+Math.imul(H,it)|0)+Math.imul(Y,at)|0,o=o+Math.imul(Y,it)|0,a=a+Math.imul(P,ot)|0,n=(n=n+Math.imul(P,At)|0)+Math.imul(q,ot)|0,o=o+Math.imul(q,At)|0,a=a+Math.imul(G,ct)|0,n=(n=n+Math.imul(G,dt)|0)+Math.imul(T,ct)|0,o=o+Math.imul(T,dt)|0,a=a+Math.imul(N,ht)|0,n=(n=n+Math.imul(N,bt)|0)+Math.imul(D,ht)|0,o=o+Math.imul(D,bt)|0,a=a+Math.imul(w,Bt)|0,n=(n=n+Math.imul(w,mt)|0)+Math.imul(_,Bt)|0,o=o+Math.imul(_,mt)|0,a=a+Math.imul(x,Et)|0,n=(n=n+Math.imul(x,yt)|0)+Math.imul(C,Et)|0,o=o+Math.imul(C,yt)|0,a=a+Math.imul(I,xt)|0,n=(n=n+Math.imul(I,Ct)|0)+Math.imul(y,xt)|0,o=o+Math.imul(y,Ct)|0;var Lt=(u+(a=a+Math.imul(p,wt)|0)|0)+((8191&(n=(n=n+Math.imul(p,Mt)|0)+Math.imul(B,wt)|0))<<13)|0;u=((o=o+Math.imul(B,Mt)|0)+(n>>>13)|0)+(Lt>>>26)|0,Lt&=67108863,a=Math.imul(J,at),n=(n=Math.imul(J,it))+Math.imul(z,at)|0,o=Math.imul(z,it),a=a+Math.imul(H,ot)|0,n=(n=n+Math.imul(H,At)|0)+Math.imul(Y,ot)|0,o=o+Math.imul(Y,At)|0,a=a+Math.imul(P,ct)|0,n=(n=n+Math.imul(P,dt)|0)+Math.imul(q,ct)|0,o=o+Math.imul(q,dt)|0,a=a+Math.imul(G,ht)|0,n=(n=n+Math.imul(G,bt)|0)+Math.imul(T,ht)|0,o=o+Math.imul(T,bt)|0,a=a+Math.imul(N,Bt)|0,n=(n=n+Math.imul(N,mt)|0)+Math.imul(D,Bt)|0,o=o+Math.imul(D,mt)|0,a=a+Math.imul(w,Et)|0,n=(n=n+Math.imul(w,yt)|0)+Math.imul(_,Et)|0,o=o+Math.imul(_,yt)|0,a=a+Math.imul(x,xt)|0,n=(n=n+Math.imul(x,Ct)|0)+Math.imul(C,xt)|0,o=o+Math.imul(C,Ct)|0;var Pt=(u+(a=a+Math.imul(I,wt)|0)|0)+((8191&(n=(n=n+Math.imul(I,Mt)|0)+Math.imul(y,wt)|0))<<13)|0;u=((o=o+Math.imul(y,Mt)|0)+(n>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,a=Math.imul(J,ot),n=(n=Math.imul(J,At))+Math.imul(z,ot)|0,o=Math.imul(z,At),a=a+Math.imul(H,ct)|0,n=(n=n+Math.imul(H,dt)|0)+Math.imul(Y,ct)|0,o=o+Math.imul(Y,dt)|0,a=a+Math.imul(P,ht)|0,n=(n=n+Math.imul(P,bt)|0)+Math.imul(q,ht)|0,o=o+Math.imul(q,bt)|0,a=a+Math.imul(G,Bt)|0,n=(n=n+Math.imul(G,mt)|0)+Math.imul(T,Bt)|0,o=o+Math.imul(T,mt)|0,a=a+Math.imul(N,Et)|0,n=(n=n+Math.imul(N,yt)|0)+Math.imul(D,Et)|0,o=o+Math.imul(D,yt)|0,a=a+Math.imul(w,xt)|0,n=(n=n+Math.imul(w,Ct)|0)+Math.imul(_,xt)|0,o=o+Math.imul(_,Ct)|0;var qt=(u+(a=a+Math.imul(x,wt)|0)|0)+((8191&(n=(n=n+Math.imul(x,Mt)|0)+Math.imul(C,wt)|0))<<13)|0;u=((o=o+Math.imul(C,Mt)|0)+(n>>>13)|0)+(qt>>>26)|0,qt&=67108863,a=Math.imul(J,ct),n=(n=Math.imul(J,dt))+Math.imul(z,ct)|0,o=Math.imul(z,dt),a=a+Math.imul(H,ht)|0,n=(n=n+Math.imul(H,bt)|0)+Math.imul(Y,ht)|0,o=o+Math.imul(Y,bt)|0,a=a+Math.imul(P,Bt)|0,n=(n=n+Math.imul(P,mt)|0)+Math.imul(q,Bt)|0,o=o+Math.imul(q,mt)|0,a=a+Math.imul(G,Et)|0,n=(n=n+Math.imul(G,yt)|0)+Math.imul(T,Et)|0,o=o+Math.imul(T,yt)|0,a=a+Math.imul(N,xt)|0,n=(n=n+Math.imul(N,Ct)|0)+Math.imul(D,xt)|0,o=o+Math.imul(D,Ct)|0;var Ot=(u+(a=a+Math.imul(w,wt)|0)|0)+((8191&(n=(n=n+Math.imul(w,Mt)|0)+Math.imul(_,wt)|0))<<13)|0;u=((o=o+Math.imul(_,Mt)|0)+(n>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,a=Math.imul(J,ht),n=(n=Math.imul(J,bt))+Math.imul(z,ht)|0,o=Math.imul(z,bt),a=a+Math.imul(H,Bt)|0,n=(n=n+Math.imul(H,mt)|0)+Math.imul(Y,Bt)|0,o=o+Math.imul(Y,mt)|0,a=a+Math.imul(P,Et)|0,n=(n=n+Math.imul(P,yt)|0)+Math.imul(q,Et)|0,o=o+Math.imul(q,yt)|0,a=a+Math.imul(G,xt)|0,n=(n=n+Math.imul(G,Ct)|0)+Math.imul(T,xt)|0,o=o+Math.imul(T,Ct)|0;var Ht=(u+(a=a+Math.imul(N,wt)|0)|0)+((8191&(n=(n=n+Math.imul(N,Mt)|0)+Math.imul(D,wt)|0))<<13)|0;u=((o=o+Math.imul(D,Mt)|0)+(n>>>13)|0)+(Ht>>>26)|0,Ht&=67108863,a=Math.imul(J,Bt),n=(n=Math.imul(J,mt))+Math.imul(z,Bt)|0,o=Math.imul(z,mt),a=a+Math.imul(H,Et)|0,n=(n=n+Math.imul(H,yt)|0)+Math.imul(Y,Et)|0,o=o+Math.imul(Y,yt)|0,a=a+Math.imul(P,xt)|0,n=(n=n+Math.imul(P,Ct)|0)+Math.imul(q,xt)|0,o=o+Math.imul(q,Ct)|0;var Yt=(u+(a=a+Math.imul(G,wt)|0)|0)+((8191&(n=(n=n+Math.imul(G,Mt)|0)+Math.imul(T,wt)|0))<<13)|0;u=((o=o+Math.imul(T,Mt)|0)+(n>>>13)|0)+(Yt>>>26)|0,Yt&=67108863,a=Math.imul(J,Et),n=(n=Math.imul(J,yt))+Math.imul(z,Et)|0,o=Math.imul(z,yt),a=a+Math.imul(H,xt)|0,n=(n=n+Math.imul(H,Ct)|0)+Math.imul(Y,xt)|0,o=o+Math.imul(Y,Ct)|0;var jt=(u+(a=a+Math.imul(P,wt)|0)|0)+((8191&(n=(n=n+Math.imul(P,Mt)|0)+Math.imul(q,wt)|0))<<13)|0;u=((o=o+Math.imul(q,Mt)|0)+(n>>>13)|0)+(jt>>>26)|0,jt&=67108863,a=Math.imul(J,xt),n=(n=Math.imul(J,Ct))+Math.imul(z,xt)|0,o=Math.imul(z,Ct);var Jt=(u+(a=a+Math.imul(H,wt)|0)|0)+((8191&(n=(n=n+Math.imul(H,Mt)|0)+Math.imul(Y,wt)|0))<<13)|0;u=((o=o+Math.imul(Y,Mt)|0)+(n>>>13)|0)+(Jt>>>26)|0,Jt&=67108863;var Kt=(u+(a=Math.imul(J,wt))|0)+((8191&(n=(n=Math.imul(J,Mt))+Math.imul(z,wt)|0))<<13)|0;return u=((o=Math.imul(z,Mt))+(n>>>13)|0)+(Kt>>>26)|0,Kt&=67108863,d[0]=_t,d[1]=kt,d[2]=St,d[3]=Nt,d[4]=Dt,d[5]=Rt,d[6]=Ft,d[7]=Ut,d[8]=Gt,d[9]=Tt,d[10]=Lt,d[11]=Pt,d[12]=qt,d[13]=Ot,d[14]=Ht,d[15]=Yt,d[16]=jt,d[17]=Jt,d[18]=Kt,0!==u&&(d[19]=u,r.length++),r};function bigMulTo(e,t,r){r.negative=t.negative^e.negative,r.length=e.length+t.length;for(var a=0,n=0,o=0;o>>26)|0)>>>26,s&=67108863}r.words[o]=c,a=s,s=n}return 0!==a?r.words[o]=a:r.length--,r._strip()}function jumboMulTo(e,t,r){return bigMulTo(e,t,r)}function FFTM(e,t){this.x=e,this.y=t}Math.imul||(c=smallMulTo),BN.prototype.mulTo=function mulTo(e,t){var r=this.length+e.length;return 10===this.length&&10===e.length?c(this,e,t):r<63?smallMulTo(this,e,t):r<1024?bigMulTo(this,e,t):jumboMulTo(this,e,t)},FFTM.prototype.makeRBT=function makeRBT(e){for(var t=new Array(e),r=BN.prototype._countBits(e)-1,a=0;a>=1;return a},FFTM.prototype.permute=function permute(e,t,r,a,n,o){for(var s=0;s>>=1)n++;return 1<>>=13,r[2*o+1]=8191&n,n>>>=13;for(o=2*t;o>=26,r+=n/67108864|0,r+=o>>>26,this.words[a]=67108863&o}return 0!==r&&(this.words[a]=r,this.length++),t?this.ineg():this},BN.prototype.muln=function muln(e){return this.clone().imuln(e)},BN.prototype.sqr=function sqr(){return this.mul(this)},BN.prototype.isqr=function isqr(){return this.imul(this.clone())},BN.prototype.pow=function pow(e){var t=function toBitArray(e){for(var t=new Array(e.bitLength()),r=0;r>>n&1}return t}(e);if(0===t.length)return new BN(1);for(var r=this,a=0;a=0);var t,r=e%26,a=(e-r)/26,n=67108863>>>26-r<<26-r;if(0!==r){var o=0;for(t=0;t>>26-r}o&&(this.words[t]=o,this.length++)}if(0!==a){for(t=this.length-1;t>=0;t--)this.words[t+a]=this.words[t];for(t=0;t=0),a=t?(t-t%26)/26:0;var n=e%26,o=Math.min((e-n)/26,this.length),s=67108863^67108863>>>n<o)for(this.length-=o,d=0;d=0&&(0!==u||d>=a);d--){var h=0|this.words[d];this.words[d]=u<<26-n|h>>>n,u=h&s}return c&&0!==u&&(c.words[c.length++]=u),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},BN.prototype.ishrn=function ishrn(e,t,r){return assert(0===this.negative),this.iushrn(e,t,r)},BN.prototype.shln=function shln(e){return this.clone().ishln(e)},BN.prototype.ushln=function ushln(e){return this.clone().iushln(e)},BN.prototype.shrn=function shrn(e){return this.clone().ishrn(e)},BN.prototype.ushrn=function ushrn(e){return this.clone().iushrn(e)},BN.prototype.testn=function testn(e){assert("number"==typeof e&&e>=0);var t=e%26,r=(e-t)/26,a=1<=0);var t=e%26,r=(e-t)/26;if(assert(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==t&&r++,this.length=Math.min(r,this.length),0!==t){var a=67108863^67108863>>>t<=67108864;t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},BN.prototype.isubn=function isubn(e){if(assert("number"==typeof e),assert(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t>26)-(c/67108864|0),this.words[a+r]=67108863&n}for(;a>26,this.words[a+r]=67108863&n;if(0===s)return this._strip();for(assert(-1===s),s=0,a=0;a>26,this.words[a]=67108863&n;return this.negative=1,this._strip()},BN.prototype._wordDiv=function _wordDiv(e,t){var r=(this.length,e.length),a=this.clone(),n=e,o=0|n.words[n.length-1];0!==(r=26-this._countBits(o))&&(n=n.ushln(r),a.iushln(r),o=0|n.words[n.length-1]);var s,c=a.length-n.length;if("mod"!==t){(s=new BN(null)).length=c+1,s.words=new Array(s.length);for(var d=0;d=0;h--){var l=67108864*(0|a.words[n.length+h])+(0|a.words[n.length+h-1]);for(l=Math.min(l/o|0,67108863),a._ishlnsubmul(n,l,h);0!==a.negative;)l--,a.negative=0,a._ishlnsubmul(n,1,h),a.isZero()||(a.negative^=1);s&&(s.words[h]=l)}return s&&s._strip(),a._strip(),"div"!==t&&0!==r&&a.iushrn(r),{div:s||null,mod:a}},BN.prototype.divmod=function divmod(e,t,r){return assert(!e.isZero()),this.isZero()?{div:new BN(0),mod:new BN(0)}:0!==this.negative&&0===e.negative?(o=this.neg().divmod(e,t),"mod"!==t&&(a=o.div.neg()),"div"!==t&&(n=o.mod.neg(),r&&0!==n.negative&&n.iadd(e)),{div:a,mod:n}):0===this.negative&&0!==e.negative?(o=this.divmod(e.neg(),t),"mod"!==t&&(a=o.div.neg()),{div:a,mod:o.mod}):0!=(this.negative&e.negative)?(o=this.neg().divmod(e.neg(),t),"div"!==t&&(n=o.mod.neg(),r&&0!==n.negative&&n.isub(e)),{div:o.div,mod:n}):e.length>this.length||this.cmp(e)<0?{div:new BN(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new BN(this.modrn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new BN(this.modrn(e.words[0]))}:this._wordDiv(e,t);var a,n,o},BN.prototype.div=function div(e){return this.divmod(e,"div",!1).div},BN.prototype.mod=function mod(e){return this.divmod(e,"mod",!1).mod},BN.prototype.umod=function umod(e){return this.divmod(e,"mod",!0).mod},BN.prototype.divRound=function divRound(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var r=0!==t.div.negative?t.mod.isub(e):t.mod,a=e.ushrn(1),n=e.andln(1),o=r.cmp(a);return o<0||1===n&&0===o?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},BN.prototype.modrn=function modrn(e){var t=e<0;t&&(e=-e),assert(e<=67108863);for(var r=(1<<26)%e,a=0,n=this.length-1;n>=0;n--)a=(r*a+(0|this.words[n]))%e;return t?-a:a},BN.prototype.modn=function modn(e){return this.modrn(e)},BN.prototype.idivn=function idivn(e){var t=e<0;t&&(e=-e),assert(e<=67108863);for(var r=0,a=this.length-1;a>=0;a--){var n=(0|this.words[a])+67108864*r;this.words[a]=n/e|0,r=n%e}return this._strip(),t?this.ineg():this},BN.prototype.divn=function divn(e){return this.clone().idivn(e)},BN.prototype.egcd=function egcd(e){assert(0===e.negative),assert(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var a=new BN(1),n=new BN(0),o=new BN(0),s=new BN(1),c=0;t.isEven()&&r.isEven();)t.iushrn(1),r.iushrn(1),++c;for(var d=r.clone(),u=t.clone();!t.isZero();){for(var h=0,l=1;0==(t.words[0]&l)&&h<26;++h,l<<=1);if(h>0)for(t.iushrn(h);h-- >0;)(a.isOdd()||n.isOdd())&&(a.iadd(d),n.isub(u)),a.iushrn(1),n.iushrn(1);for(var b=0,g=1;0==(r.words[0]&g)&&b<26;++b,g<<=1);if(b>0)for(r.iushrn(b);b-- >0;)(o.isOdd()||s.isOdd())&&(o.iadd(d),s.isub(u)),o.iushrn(1),s.iushrn(1);t.cmp(r)>=0?(t.isub(r),a.isub(o),n.isub(s)):(r.isub(t),o.isub(a),s.isub(n))}return{a:o,b:s,gcd:r.iushln(c)}},BN.prototype._invmp=function _invmp(e){assert(0===e.negative),assert(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var a,n=new BN(1),o=new BN(0),s=r.clone();t.cmpn(1)>0&&r.cmpn(1)>0;){for(var c=0,d=1;0==(t.words[0]&d)&&c<26;++c,d<<=1);if(c>0)for(t.iushrn(c);c-- >0;)n.isOdd()&&n.iadd(s),n.iushrn(1);for(var u=0,h=1;0==(r.words[0]&h)&&u<26;++u,h<<=1);if(u>0)for(r.iushrn(u);u-- >0;)o.isOdd()&&o.iadd(s),o.iushrn(1);t.cmp(r)>=0?(t.isub(r),n.isub(o)):(r.isub(t),o.isub(n))}return(a=0===t.cmpn(1)?n:o).cmpn(0)<0&&a.iadd(e),a},BN.prototype.gcd=function gcd(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),r=e.clone();t.negative=0,r.negative=0;for(var a=0;t.isEven()&&r.isEven();a++)t.iushrn(1),r.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=t.cmp(r);if(n<0){var o=t;t=r,r=o}else if(0===n||0===r.cmpn(1))break;t.isub(r)}return r.iushln(a)},BN.prototype.invm=function invm(e){return this.egcd(e).a.umod(e)},BN.prototype.isEven=function isEven(){return 0==(1&this.words[0])},BN.prototype.isOdd=function isOdd(){return 1==(1&this.words[0])},BN.prototype.andln=function andln(e){return this.words[0]&e},BN.prototype.bincn=function bincn(e){assert("number"==typeof e);var t=e%26,r=(e-t)/26,a=1<>>26,s&=67108863,this.words[o]=s}return 0!==n&&(this.words[o]=n,this.length++),this},BN.prototype.isZero=function isZero(){return 1===this.length&&0===this.words[0]},BN.prototype.cmpn=function cmpn(e){var t,r=e<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this._strip(),this.length>1)t=1;else{r&&(e=-e),assert(e<=67108863,"Number is too big");var a=0|this.words[0];t=a===e?0:ae.length)return 1;if(this.length=0;r--){var a=0|this.words[r],n=0|e.words[r];if(a!==n){an&&(t=1);break}}return t},BN.prototype.gtn=function gtn(e){return 1===this.cmpn(e)},BN.prototype.gt=function gt(e){return 1===this.cmp(e)},BN.prototype.gten=function gten(e){return this.cmpn(e)>=0},BN.prototype.gte=function gte(e){return this.cmp(e)>=0},BN.prototype.ltn=function ltn(e){return-1===this.cmpn(e)},BN.prototype.lt=function lt(e){return-1===this.cmp(e)},BN.prototype.lten=function lten(e){return this.cmpn(e)<=0},BN.prototype.lte=function lte(e){return this.cmp(e)<=0},BN.prototype.eqn=function eqn(e){return 0===this.cmpn(e)},BN.prototype.eq=function eq(e){return 0===this.cmp(e)},BN.red=function red(e){return new Red(e)},BN.prototype.toRed=function toRed(e){return assert(!this.red,"Already a number in reduction context"),assert(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},BN.prototype.fromRed=function fromRed(){return assert(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},BN.prototype._forceRed=function _forceRed(e){return this.red=e,this},BN.prototype.forceRed=function forceRed(e){return assert(!this.red,"Already a number in reduction context"),this._forceRed(e)},BN.prototype.redAdd=function redAdd(e){return assert(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},BN.prototype.redIAdd=function redIAdd(e){return assert(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},BN.prototype.redSub=function redSub(e){return assert(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},BN.prototype.redISub=function redISub(e){return assert(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},BN.prototype.redShl=function redShl(e){return assert(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},BN.prototype.redMul=function redMul(e){return assert(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},BN.prototype.redIMul=function redIMul(e){return assert(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},BN.prototype.redSqr=function redSqr(){return assert(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},BN.prototype.redISqr=function redISqr(){return assert(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},BN.prototype.redSqrt=function redSqrt(){return assert(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},BN.prototype.redInvm=function redInvm(){return assert(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},BN.prototype.redNeg=function redNeg(){return assert(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},BN.prototype.redPow=function redPow(e){return assert(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var d={k256:null,p224:null,p192:null,p25519:null};function MPrime(e,t){this.name=e,this.p=new BN(t,16),this.n=this.p.bitLength(),this.k=new BN(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function K256(){MPrime.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function P224(){MPrime.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function P192(){MPrime.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function P25519(){MPrime.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function Red(e){if("string"==typeof e){var t=BN._prime(e);this.m=t.p,this.prime=t}else assert(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function Mont(e){Red.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new BN(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)}MPrime.prototype._tmp=function _tmp(){var e=new BN(null);return e.words=new Array(Math.ceil(this.n/13)),e},MPrime.prototype.ireduce=function ireduce(e){var t,r=e;do{this.split(r,this.tmp),t=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(t>this.n);var a=t0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},MPrime.prototype.split=function split(e,t){e.iushrn(this.n,0,t)},MPrime.prototype.imulK=function imulK(e){return e.imul(this.k)},inherits(K256,MPrime),K256.prototype.split=function split(e,t){for(var r=4194303,a=Math.min(e.length,9),n=0;n>>22,o=s}o>>>=22,e.words[n-10]=o,0===o&&e.length>10?e.length-=10:e.length-=9},K256.prototype.imulK=function imulK(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,r=0;r>>=26,e.words[r]=n,t=a}return 0!==t&&(e.words[e.length++]=t),e},BN._prime=function prime(e){if(d[e])return d[e];var prime;if("k256"===e)prime=new K256;else if("p224"===e)prime=new P224;else if("p192"===e)prime=new P192;else{if("p25519"!==e)throw new Error("Unknown prime "+e);prime=new P25519}return d[e]=prime,prime},Red.prototype._verify1=function _verify1(e){assert(0===e.negative,"red works only with positives"),assert(e.red,"red works only with red numbers")},Red.prototype._verify2=function _verify2(e,t){assert(0==(e.negative|t.negative),"red works only with positives"),assert(e.red&&e.red===t.red,"red works only with red numbers")},Red.prototype.imod=function imod(e){return this.prime?this.prime.ireduce(e)._forceRed(this):(move(e,e.umod(this.m)._forceRed(this)),e)},Red.prototype.neg=function neg(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},Red.prototype.add=function add(e,t){this._verify2(e,t);var r=e.add(t);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},Red.prototype.iadd=function iadd(e,t){this._verify2(e,t);var r=e.iadd(t);return r.cmp(this.m)>=0&&r.isub(this.m),r},Red.prototype.sub=function sub(e,t){this._verify2(e,t);var r=e.sub(t);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},Red.prototype.isub=function isub(e,t){this._verify2(e,t);var r=e.isub(t);return r.cmpn(0)<0&&r.iadd(this.m),r},Red.prototype.shl=function shl(e,t){return this._verify1(e),this.imod(e.ushln(t))},Red.prototype.imul=function imul(e,t){return this._verify2(e,t),this.imod(e.imul(t))},Red.prototype.mul=function mul(e,t){return this._verify2(e,t),this.imod(e.mul(t))},Red.prototype.isqr=function isqr(e){return this.imul(e,e.clone())},Red.prototype.sqr=function sqr(e){return this.mul(e,e)},Red.prototype.sqrt=function sqrt(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(assert(t%2==1),3===t){var r=this.m.add(new BN(1)).iushrn(2);return this.pow(e,r)}for(var a=this.m.subn(1),n=0;!a.isZero()&&0===a.andln(1);)n++,a.iushrn(1);assert(!a.isZero());var o=new BN(1).toRed(this),s=o.redNeg(),c=this.m.subn(1).iushrn(1),d=this.m.bitLength();for(d=new BN(2*d*d).toRed(this);0!==this.pow(d,c).cmp(s);)d.redIAdd(s);for(var u=this.pow(d,a),h=this.pow(e,a.addn(1).iushrn(1)),l=this.pow(e,a),b=n;0!==l.cmp(o);){for(var g=l,p=0;0!==g.cmp(o);p++)g=g.redSqr();assert(p=0;a--){for(var d=t.words[a],u=c-1;u>=0;u--){var h=d>>u&1;n!==r[0]&&(n=this.sqr(n)),0!==h||0!==o?(o<<=1,o|=h,(4===++s||0===a&&0===u)&&(n=this.mul(n,r[o]),s=0,o=0)):s=0}c=26}return n},Red.prototype.convertTo=function convertTo(e){var t=e.umod(this.m);return t===e?t.clone():t},Red.prototype.convertFrom=function convertFrom(e){var t=e.clone();return t.red=null,t},BN.mont=function mont(e){return new Mont(e)},inherits(Mont,Red),Mont.prototype.convertTo=function convertTo(e){return this.imod(e.ushln(this.shift))},Mont.prototype.convertFrom=function convertFrom(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},Mont.prototype.imul=function imul(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var r=e.imul(t),a=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(a).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},Mont.prototype.mul=function mul(e,t){if(e.isZero()||t.isZero())return new BN(0)._forceRed(this);var r=e.mul(t),a=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(a).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},Mont.prototype.invm=function invm(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(e=r.nmd(e),this)},(e,t,r)=>{var a=r(1);function load(){var e;try{e=t.storage.debug}catch(e){}return!e&&void 0!==a&&"env"in a&&(e=a.env.DEBUG),e}(t=e.exports=r(25)).log=function log(){return"object"==typeof console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)},t.formatArgs=function formatArgs(e){var r=this.useColors;if(e[0]=(r?"%c":"")+this.namespace+(r?" %c":" ")+e[0]+(r?"%c ":" ")+"+"+t.humanize(this.diff),!r)return;var a="color: "+this.color;e.splice(1,0,a,"color: inherit");var n=0,o=0;e[0].replace(/%[a-zA-Z%]/g,(function(e){"%%"!==e&&(n++,"%c"===e&&(o=n))})),e.splice(o,0,a)},t.save=function save(e){try{null==e?t.storage.removeItem("debug"):t.storage.debug=e}catch(e){}},t.load=load,t.useColors=function useColors(){if("undefined"!=typeof window&&window.process&&"renderer"===window.process.type)return!0;return"undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},t.storage="undefined"!=typeof chrome&&void 0!==chrome.storage?chrome.storage.local:function localstorage(){try{return window.localStorage}catch(e){}}(),t.colors=["lightseagreen","forestgreen","goldenrod","dodgerblue","darkorchid","crimson"],t.formatters.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}},t.enable(load())},(e,t,r)=>{"use strict";var a=r(2).Buffer;Object.defineProperty(t,"__esModule",{value:!0}),t.createDecipheriv=t.createCipheriv=t.randomBytes=t.pseudoRandomBytes=t.createHash=t.createHmac=t.scrypt=void 0;const n=r(317);Object.defineProperty(t,"createCipheriv",{enumerable:!0,get:function(){return n.createCipheriv}}),Object.defineProperty(t,"createDecipheriv",{enumerable:!0,get:function(){return n.createDecipheriv}});const o=r(441),scrypt=(e,t,r,n,s)=>{o.scrypt(a.from(e,"utf8"),a.from(t,"utf8"),n.N,n.r,n.p,r).then((e=>{s(null,a.from(e))})).catch((e=>s(e,void 0)))};t.scrypt=scrypt;const s=r(1243);Object.defineProperty(t,"createHmac",{enumerable:!0,get:function(){return s.createHmac}}),Object.defineProperty(t,"createHash",{enumerable:!0,get:function(){return s.createHash}}),Object.defineProperty(t,"pseudoRandomBytes",{enumerable:!0,get:function(){return s.pseudoRandomBytes}}),Object.defineProperty(t,"randomBytes",{enumerable:!0,get:function(){return s.randomBytes}}),t.default={scrypt,createHmac:s.createHmac,createHash:s.createHash,pseudoRandomBytes:s.pseudoRandomBytes,randomBytes:s.randomBytes,createCipheriv:n.createCipheriv,createDecipheriv:n.createDecipheriv}},function(e,t,r){"use strict";var a=this&&this.__createBinding||(Object.create?function(e,t,r,a){void 0===a&&(a=r),Object.defineProperty(e,a,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,a){void 0===a&&(a=r),e[a]=t[r]}),n=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||t.hasOwnProperty(r)||a(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),n(r(184),t),n(r(33),t),n(r(497),t),n(r(57),t),n(r(498),t),n(r(71),t),n(r(128),t),n(r(129),t),n(r(236),t),n(r(87),t)},function(e,t,r){"use strict";var a=this&&this.__createBinding||(Object.create?function(e,t,r,a){void 0===a&&(a=r),Object.defineProperty(e,a,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,a){void 0===a&&(a=r),e[a]=t[r]}),n=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||t.hasOwnProperty(r)||a(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),n(r(194),t),n(r(35),t),n(r(546),t),n(r(61),t),n(r(547),t),n(r(76),t),n(r(135),t),n(r(136),t),n(r(243),t),n(r(195),t)},function(e,t,r){"use strict";var a=this&&this.__createBinding||(Object.create?function(e,t,r,a){void 0===a&&(a=r),Object.defineProperty(e,a,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,a){void 0===a&&(a=r),e[a]=t[r]}),n=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||a(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),n(r(1395),t),n(r(1396),t),n(r(1397),t),n(r(287),t),n(r(1398),t)},function(e,t,r){"use strict";var a=this&&this.__createBinding||(Object.create?function(e,t,r,a){void 0===a&&(a=r),Object.defineProperty(e,a,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,a){void 0===a&&(a=r),e[a]=t[r]}),n=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||t.hasOwnProperty(r)||a(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0});var o=r(103);Object.defineProperty(t,"Block",{enumerable:!0,get:function(){return o.Block}});var s=r(92);Object.defineProperty(t,"BlockHeader",{enumerable:!0,get:function(){return s.BlockHeader}}),n(r(1439),t)},function(e,t,r){"use strict";var a=r(0).Buffer,n=this&&this.__awaiter||function(e,t,r,a){return new(r||(r=Promise))((function(n,o){function fulfilled(e){try{step(a.next(e))}catch(e){o(e)}}function rejected(e){try{step(a.throw(e))}catch(e){o(e)}}function step(e){e.done?n(e.value):function adopt(e){return e instanceof r?e:new r((function(t){t(e)}))}(e.value).then(fulfilled,rejected)}step((a=a.apply(e,t||[])).next())}))},o=this&&this.__generator||function(e,t){var r,a,n,o,s={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return o={next:verb(0),throw:verb(1),return:verb(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function verb(o){return function(c){return function step(o){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,a&&(n=2&o[0]?a.return:o[0]?a.throw||((n=a.return)&&n.call(a),0):a.next)&&!(n=n.call(a,o[1])).done)return n;switch(a=0,n&&(o=[2&o[0],n.value]),o[0]){case 0:case 1:n=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,a=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(n=s.trys,(n=n.length>0&&n[n.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!n||o[1]>n[0]&&o[1]0)&&!(a=o.next()).done;)s.push(a.value)}catch(e){n={error:e}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return s};Object.defineProperty(t,"__esModule",{value:!0}),t.handlers=void 0;var c=r(5),d=r(121),u=r(1456),h=r(1457),l=r(647),b=r(30);t.handlers=new Map([[0,function(){d.trap(b.ERROR.STOP)}],[1,function(e){var t=s(e.stack.popN(2),2),r=t[0],a=t[1],n=r.add(a).mod(c.TWO_POW256);e.stack.push(n)}],[2,function(e){var t=s(e.stack.popN(2),2),r=t[0],a=t[1],n=r.mul(a).mod(c.TWO_POW256);e.stack.push(n)}],[3,function(e){var t=s(e.stack.popN(2),2),r=t[0],a=t[1],n=r.sub(a).toTwos(256);e.stack.push(n)}],[4,function(e){var t,r=s(e.stack.popN(2),2),a=r[0],n=r[1];t=n.isZero()?new c.BN(n):a.div(n),e.stack.push(t)}],[5,function(e){var t,r=s(e.stack.popN(2),2),a=r[0],n=r[1];n.isZero()?t=new c.BN(n):(a=a.fromTwos(256),n=n.fromTwos(256),t=a.div(n).toTwos(256)),e.stack.push(t)}],[6,function(e){var t,r=s(e.stack.popN(2),2),a=r[0],n=r[1];t=n.isZero()?new c.BN(n):a.mod(n),e.stack.push(t)}],[7,function(e){var t,r=s(e.stack.popN(2),2),a=r[0],n=r[1];n.isZero()?t=new c.BN(n):(a=a.fromTwos(256),n=n.fromTwos(256),t=a.abs().mod(n.abs()),a.isNeg()&&(t=t.ineg()),t=t.toTwos(256)),e.stack.push(t)}],[8,function(e){var t,r=s(e.stack.popN(3),3),a=r[0],n=r[1],o=r[2];t=o.isZero()?new c.BN(o):a.add(n).mod(o),e.stack.push(t)}],[9,function(e){var t,r=s(e.stack.popN(3),3),a=r[0],n=r[1],o=r[2];t=o.isZero()?new c.BN(o):a.mul(n).mod(o),e.stack.push(t)}],[10,function(e){var t=s(e.stack.popN(2),2),r=t[0],a=t[1];if(a.isZero())e.stack.push(new c.BN(1));else{var n=a.byteLength();(n<1||n>32)&&d.trap(b.ERROR.OUT_OF_RANGE);var o=e._common.param("gasPrices","expByte"),u=new c.BN(n).muln(o);if(e.eei.useGas(u,"EXP opcode"),r.isZero())e.stack.push(new c.BN(0));else{var h=c.BN.red(c.TWO_POW256),l=r.toRed(h).redPow(a);e.stack.push(l.fromRed())}}}],[11,function(e){var t=s(e.stack.popN(2),2),r=t[0],a=t[1];if(r.ltn(31)){var n=r.muln(8).iaddn(7).toNumber(),o=new c.BN(1).ishln(n).isubn(1);a=a.testn(n)?a.or(o.notn(256)):a.and(o)}else a=new c.BN(a);e.stack.push(a)}],[16,function(e){var t=s(e.stack.popN(2),2),r=t[0],a=t[1],n=new c.BN(r.lt(a)?1:0);e.stack.push(n)}],[17,function(e){var t=s(e.stack.popN(2),2),r=t[0],a=t[1],n=new c.BN(r.gt(a)?1:0);e.stack.push(n)}],[18,function(e){var t=s(e.stack.popN(2),2),r=t[0],a=t[1],n=new c.BN(r.fromTwos(256).lt(a.fromTwos(256))?1:0);e.stack.push(n)}],[19,function(e){var t=s(e.stack.popN(2),2),r=t[0],a=t[1],n=new c.BN(r.fromTwos(256).gt(a.fromTwos(256))?1:0);e.stack.push(n)}],[20,function(e){var t=s(e.stack.popN(2),2),r=t[0],a=t[1],n=new c.BN(r.eq(a)?1:0);e.stack.push(n)}],[21,function(e){var t=e.stack.pop(),r=new c.BN(t.isZero()?1:0);e.stack.push(r)}],[22,function(e){var t=s(e.stack.popN(2),2),r=t[0],a=t[1],n=r.and(a);e.stack.push(n)}],[23,function(e){var t=s(e.stack.popN(2),2),r=t[0],a=t[1],n=r.or(a);e.stack.push(n)}],[24,function(e){var t=s(e.stack.popN(2),2),r=t[0],a=t[1],n=r.xor(a);e.stack.push(n)}],[25,function(e){var t=e.stack.pop().notn(256);e.stack.push(t)}],[26,function(e){var t=s(e.stack.popN(2),2),r=t[0],a=t[1];if(r.gten(32))e.stack.push(new c.BN(0));else{var n=new c.BN(a.shrn(8*(31-r.toNumber())).andln(255));e.stack.push(n)}}],[27,function(e){var t=s(e.stack.popN(2),2),r=t[0],a=t[1];if(r.gten(256))e.stack.push(new c.BN(0));else{var n=a.shln(r.toNumber()).iand(c.MAX_INTEGER);e.stack.push(n)}}],[28,function(e){var t=s(e.stack.popN(2),2),r=t[0],a=t[1];if(r.gten(256))e.stack.push(new c.BN(0));else{var n=a.shrn(r.toNumber());e.stack.push(n)}}],[29,function(e){var t,r=s(e.stack.popN(2),2),a=r[0],n=r[1],o=n.testn(255);if(a.gten(256))return t=o?new c.BN(c.MAX_INTEGER):new c.BN(0),void e.stack.push(t);var d=n.shrn(a.toNumber());if(o){var u=255-a.toNumber(),h=c.MAX_INTEGER.shrn(u).shln(u);t=d.ior(h)}else t=d;e.stack.push(t)}],[32,function(e){var t=s(e.stack.popN(2),2),r=t[0],n=t[1];d.subMemUsage(e,r,n);var o=a.alloc(0);n.isZero()||(o=e.memory.read(r.toNumber(),n.toNumber())),e.eei.useGas(new c.BN(e._common.param("gasPrices","sha3Word")).imul(d.divCeil(n,new c.BN(32))),"SHA3 opcode");var u=new c.BN(c.keccak256(o));e.stack.push(u)}],[48,function(e){var t=new c.BN(e.eei.getAddress().buf);e.stack.push(t)}],[49,function(e){return n(this,void 0,void 0,(function(){var t,r,a;return o(this,(function(n){switch(n.label){case 0:return t=e.stack.pop(),r=new c.Address(d.addressToBuffer(t)),l.accessAddressEIP2929(e,r),[4,e.eei.getExternalBalance(r)];case 1:return a=n.sent(),e.stack.push(a),[2]}}))}))}],[50,function(e){e.stack.push(e.eei.getTxOrigin())}],[51,function(e){e.stack.push(e.eei.getCaller())}],[52,function(e){e.stack.push(e.eei.getCallValue())}],[53,function(e){var t=e.stack.pop();if(t.gt(e.eei.getCallDataSize()))e.stack.push(new c.BN(0));else{var r=t.toNumber(),n=e.eei.getCallData().slice(r,r+32);n=n.length?n:a.from([0]);var o=new c.BN(c.setLengthRight(n,32));e.stack.push(o)}}],[54,function(e){var t=e.eei.getCallDataSize();e.stack.push(t)}],[55,function(e){var t=s(e.stack.popN(3),3),r=t[0],a=t[1],n=t[2];if(d.subMemUsage(e,r,n),!n.eqn(0)){e.eei.useGas(new c.BN(e._common.param("gasPrices","copy")).imul(d.divCeil(n,new c.BN(32))),"CALLDATACOPY opcode");var o=d.getDataSlice(e.eei.getCallData(),a,n),u=r.toNumber(),h=n.toNumber();e.memory.extend(u,h),e.memory.write(u,h,o)}}],[56,function(e){e.stack.push(e.eei.getCodeSize())}],[57,function(e){var t=s(e.stack.popN(3),3),r=t[0],a=t[1],n=t[2];if(d.subMemUsage(e,r,n),!n.eqn(0)){e.eei.useGas(new c.BN(e._common.param("gasPrices","copy")).imul(d.divCeil(n,new c.BN(32))),"CODECOPY opcode");var o=d.getDataSlice(e.eei.getCode(),a,n),u=r.toNumber(),h=n.toNumber();e.memory.extend(u,h),e.memory.write(u,h,o)}}],[59,function(e){return n(this,void 0,void 0,(function(){var t,r,a;return o(this,(function(n){switch(n.label){case 0:return t=e.stack.pop(),r=new c.Address(d.addressToBuffer(t)),l.accessAddressEIP2929(e,r),[4,e.eei.getExternalCodeSize(t)];case 1:return a=n.sent(),e.stack.push(a),[2]}}))}))}],[60,function(e){return n(this,void 0,void 0,(function(){var t,r,a,n,u,h,b,g,p,B;return o(this,(function(o){switch(o.label){case 0:return t=s(e.stack.popN(4),4),r=t[0],a=t[1],n=t[2],u=t[3],d.subMemUsage(e,a,u),h=new c.Address(d.addressToBuffer(r)),l.accessAddressEIP2929(e,h),u.eqn(0)?[3,2]:(e.eei.useGas(new c.BN(e._common.param("gasPrices","copy")).imul(d.divCeil(u,new c.BN(32))),"EXTCODECOPY opcode"),[4,e.eei.getExternalCode(r)]);case 1:b=o.sent(),g=d.getDataSlice(b,n,u),p=a.toNumber(),B=u.toNumber(),e.memory.extend(p,B),e.memory.write(p,B,g),o.label=2;case 2:return[2]}}))}))}],[63,function(e){return n(this,void 0,void 0,(function(){var t,r,a;return o(this,(function(n){switch(n.label){case 0:return t=e.stack.pop(),r=new c.Address(d.addressToBuffer(t)),l.accessAddressEIP2929(e,r),[4,e.eei.isAccountEmpty(r)];case 1:return n.sent()?(e.stack.push(new c.BN(0)),[2]):[4,e.eei.getExternalCode(t)];case 2:return 0===(a=n.sent()).length?(e.stack.push(new c.BN(c.KECCAK256_NULL)),[2]):(e.stack.push(new c.BN(c.keccak256(a))),[2])}}))}))}],[61,function(e){e.stack.push(e.eei.getReturnDataSize())}],[62,function(e){var t=s(e.stack.popN(3),3),r=t[0],a=t[1],n=t[2];if(a.add(n).gt(e.eei.getReturnDataSize())&&d.trap(b.ERROR.OUT_OF_GAS),d.subMemUsage(e,r,n),!n.eqn(0)){e.eei.useGas(new c.BN(e._common.param("gasPrices","copy")).mul(d.divCeil(n,new c.BN(32))),"RETURNDATACOPY opcode");var o=d.getDataSlice(e.eei.getReturnData(),a,n),u=r.toNumber(),h=n.toNumber();e.memory.extend(u,h),e.memory.write(u,h,o)}}],[58,function(e){e.stack.push(e.eei.getTxGasPrice())}],[64,function(e){return n(this,void 0,void 0,(function(){var t,r,a;return o(this,(function(n){switch(n.label){case 0:return t=e.stack.pop(),(r=e.eei.getBlockNumber().sub(t)).gtn(256)||r.lten(0)?(e.stack.push(new c.BN(0)),[2]):[4,e.eei.getBlockHash(t)];case 1:return a=n.sent(),e.stack.push(a),[2]}}))}))}],[65,function(e){e.stack.push(e.eei.getBlockCoinbase())}],[66,function(e){e.stack.push(e.eei.getBlockTimestamp())}],[67,function(e){e.stack.push(e.eei.getBlockNumber())}],[68,function(e){e.stack.push(e.eei.getBlockDifficulty())}],[69,function(e){e.stack.push(e.eei.getBlockGasLimit())}],[70,function(e){e.stack.push(e.eei.getChainId())}],[71,function(e){e.stack.push(e.eei.getSelfBalance())}],[72,function(e){e.stack.push(e.eei.getBlockBaseFee())}],[80,function(e){e.stack.pop()}],[81,function(e){var t=e.stack.pop();d.subMemUsage(e,t,new c.BN(32));var r=e.memory.read(t.toNumber(),32);e.stack.push(new c.BN(r))}],[82,function(e){var t=s(e.stack.popN(2),2),r=t[0],n=t[1].toArrayLike(a,"be",32);d.subMemUsage(e,r,new c.BN(32));var o=r.toNumber();e.memory.extend(o,32),e.memory.write(o,32,n)}],[83,function(e){var t=s(e.stack.popN(2),2),r=t[0],n=t[1],o=a.from([n.andln(255)]);d.subMemUsage(e,r,new c.BN(1));var u=r.toNumber();e.memory.extend(u,1),e.memory.write(u,1,o)}],[84,function(e){return n(this,void 0,void 0,(function(){var t,r,n,s;return o(this,(function(o){switch(o.label){case 0:return t=e.stack.pop(),r=t.toArrayLike(a,"be",32),l.accessStorageEIP2929(e,r,!1),[4,e.eei.storageLoad(r)];case 1:return n=o.sent(),s=n.length?new c.BN(n):new c.BN(0),e.stack.push(s),[2]}}))}))}],[85,function(e){return n(this,void 0,void 0,(function(){var t,r,n,c,g,p;return o(this,(function(o){switch(o.label){case 0:return e.eei.isStatic()&&d.trap(b.ERROR.STATIC_STATE_CHANGE),t=s(e.stack.popN(2),2),r=t[0],n=t[1],c=r.toArrayLike(a,"be",32),g=n.isZero()?a.from([]):n.toArrayLike(a,"be"),[4,d.getContractStorage(e,e.eei.getAddress(),c)];case 1:return p=o.sent(),"constantinople"===e._common.hardfork()?u.updateSstoreGasEIP1283(e,p,d.setLengthLeftStorage(g)):e._common.gteHardfork("istanbul")?h.updateSstoreGasEIP2200(e,p,d.setLengthLeftStorage(g),c):d.updateSstoreGas(e,p,d.setLengthLeftStorage(g),c),l.accessStorageEIP2929(e,c,!0),[4,e.eei.storageStore(c,g)];case 2:return o.sent(),[2]}}))}))}],[86,function(e){var t=e.stack.pop();t.gt(e.eei.getCodeSize())&&d.trap(b.ERROR.INVALID_JUMP+" at "+d.describeLocation(e));var r=t.toNumber();d.jumpIsValid(e,r)||d.trap(b.ERROR.INVALID_JUMP+" at "+d.describeLocation(e)),e.programCounter=r}],[87,function(e){var t=s(e.stack.popN(2),2),r=t[0];if(!t[1].isZero()){r.gt(e.eei.getCodeSize())&&d.trap(b.ERROR.INVALID_JUMP+" at "+d.describeLocation(e));var a=r.toNumber();d.jumpIsValid(e,a)||d.trap(b.ERROR.INVALID_JUMP+" at "+d.describeLocation(e)),e.programCounter=a}}],[88,function(e){e.stack.push(new c.BN(e.programCounter-1))}],[89,function(e){e.stack.push(e.memoryWordCount.muln(32))}],[90,function(e){e.stack.push(new c.BN(e.eei.getGasLeft()))}],[91,function(){}],[92,function(e){d.trap(b.ERROR.INVALID_BEGINSUB+" at "+d.describeLocation(e))}],[93,function(e){e.returnStack.length<1&&d.trap(b.ERROR.INVALID_RETURNSUB);var t=e.returnStack.pop();e.programCounter=t.toNumber()}],[94,function(e){var t=e.stack.pop();t.gt(e.eei.getCodeSize())&&d.trap(b.ERROR.INVALID_JUMPSUB+" at "+d.describeLocation(e));var r=t.toNumber();d.jumpSubIsValid(e,r)||d.trap(b.ERROR.INVALID_JUMPSUB+" at "+d.describeLocation(e)),e.returnStack.push(new c.BN(e.programCounter)),e.programCounter=r+1}],[96,function(e){var t=e.opCode-95,r=new c.BN(e.eei.getCode().slice(e.programCounter,e.programCounter+t));e.programCounter+=t,e.stack.push(r)}],[128,function(e){var t=e.opCode-127;e.stack.dup(t)}],[144,function(e){var t=e.opCode-143;e.stack.swap(t)}],[160,function(e){e.eei.isStatic()&&d.trap(b.ERROR.STATIC_STATE_CHANGE);var t=s(e.stack.popN(2),2),r=t[0],n=t[1],o=e.opCode-160;(o<0||o>4)&&d.trap(b.ERROR.OUT_OF_RANGE);var u=e.stack.popN(o).map((function(e){return e.toArrayLike(a,"be",32)}));d.subMemUsage(e,r,n);var h=a.alloc(0);n.isZero()||(h=e.memory.read(r.toNumber(),n.toNumber())),e.eei.useGas(new c.BN(e._common.param("gasPrices","logTopic")).imuln(o).iadd(n.muln(e._common.param("gasPrices","logData"))),"LOG opcode"),e.eei.log(h,o,u)}],[240,function(e){return n(this,void 0,void 0,(function(){var t,r,n,u,h,g,p;return o(this,(function(o){switch(o.label){case 0:return e.eei.isStatic()&&d.trap(b.ERROR.STATIC_STATE_CHANGE),t=s(e.stack.popN(3),3),r=t[0],n=t[1],u=t[2],l.accessAddressEIP2929(e,e.eei.getAddress(),!1),d.subMemUsage(e,n,u),h=new c.BN(e.eei.getGasLeft()),h=d.maxCallGas(h,e.eei.getGasLeft(),e),g=a.alloc(0),u.isZero()||(g=e.memory.read(n.toNumber(),u.toNumber())),[4,e.eei.create(h,r,g)];case 1:return p=o.sent(),e.stack.push(p),[2]}}))}))}],[245,function(e){return n(this,void 0,void 0,(function(){var t,r,n,u,h,g,p,B;return o(this,(function(o){switch(o.label){case 0:return e.eei.isStatic()&&d.trap(b.ERROR.STATIC_STATE_CHANGE),t=s(e.stack.popN(4),4),r=t[0],n=t[1],u=t[2],h=t[3],d.subMemUsage(e,n,u),l.accessAddressEIP2929(e,e.eei.getAddress(),!1),e.eei.useGas(new c.BN(e._common.param("gasPrices","sha3Word")).imul(d.divCeil(u,new c.BN(32))),"CREATE2 opcode"),g=new c.BN(e.eei.getGasLeft()),g=d.maxCallGas(g,e.eei.getGasLeft(),e),p=a.alloc(0),u.isZero()||(p=e.memory.read(n.toNumber(),u.toNumber())),[4,e.eei.create2(g,r,p,h.toArrayLike(a,"be",32))];case 1:return B=o.sent(),e.stack.push(B),[2]}}))}))}],[241,function(e){return n(this,void 0,void 0,(function(){var t,r,n,u,h,g,p,B,m,I,y,v;return o(this,(function(o){switch(o.label){case 0:return t=s(e.stack.popN(7),7),r=t[0],n=t[1],u=t[2],h=t[3],g=t[4],p=t[5],B=t[6],m=new c.Address(d.addressToBuffer(n)),e.eei.isStatic()&&!u.isZero()&&d.trap(b.ERROR.STATIC_STATE_CHANGE),d.subMemUsage(e,h,g),d.subMemUsage(e,p,B),l.accessAddressEIP2929(e,m),u.isZero()||e.eei.useGas(new c.BN(e._common.param("gasPrices","callValueTransfer")),"CALL opcode -> callValueTransfer"),I=a.alloc(0),g.isZero()||(I=e.memory.read(h.toNumber(),g.toNumber())),e._common.gteHardfork("spuriousDragon")?[4,e.eei.isAccountEmpty(m)]:[3,2];case 1:return o.sent()&&!u.isZero()&&e.eei.useGas(new c.BN(e._common.param("gasPrices","callNewAccount")),"CALL opcode -> callNewAccount (>= SpuriousDragon)"),[3,4];case 2:return[4,e.eei.accountExists(m)];case 3:o.sent()||e.eei.useGas(new c.BN(e._common.param("gasPrices","callNewAccount")),"CALL opcode -> callNewAccount (< SpuriousDragon)"),o.label=4;case 4:return(y=d.maxCallGas(r,e.eei.getGasLeft(),e)).gt(e.eei.getGasLeft())&&d.trap(b.ERROR.OUT_OF_GAS),u.isZero()||(e.eei._gasLeft.iaddn(e._common.param("gasPrices","callStipend")),y.iaddn(e._common.param("gasPrices","callStipend"))),[4,e.eei.call(y,m,u,I)];case 5:return v=o.sent(),d.writeCallOutput(e,p,B),e.stack.push(v),[2]}}))}))}],[242,function(e){return n(this,void 0,void 0,(function(){var t,r,n,u,h,g,p,B,m,I,y,v;return o(this,(function(o){switch(o.label){case 0:return t=s(e.stack.popN(7),7),r=t[0],n=t[1],u=t[2],h=t[3],g=t[4],p=t[5],B=t[6],m=new c.Address(d.addressToBuffer(n)),d.subMemUsage(e,h,g),d.subMemUsage(e,p,B),l.accessAddressEIP2929(e,m),u.isZero()||e.eei.useGas(new c.BN(e._common.param("gasPrices","callValueTransfer")),"CALLCODE opcode -> callValueTransfer"),(I=d.maxCallGas(r,e.eei.getGasLeft(),e)).gt(e.eei.getGasLeft())&&d.trap(b.ERROR.OUT_OF_GAS),u.isZero()||(e.eei._gasLeft.iaddn(e._common.param("gasPrices","callStipend")),I.iaddn(e._common.param("gasPrices","callStipend"))),y=a.alloc(0),g.isZero()||(y=e.memory.read(h.toNumber(),g.toNumber())),[4,e.eei.callCode(I,m,u,y)];case 1:return v=o.sent(),d.writeCallOutput(e,p,B),e.stack.push(v),[2]}}))}))}],[244,function(e){return n(this,void 0,void 0,(function(){var t,r,n,u,h,g,p,B,m,I,y,v;return o(this,(function(o){switch(o.label){case 0:return t=e.eei.getCallValue(),r=s(e.stack.popN(6),6),n=r[0],u=r[1],h=r[2],g=r[3],p=r[4],B=r[5],m=new c.Address(d.addressToBuffer(u)),d.subMemUsage(e,h,g),d.subMemUsage(e,p,B),l.accessAddressEIP2929(e,m),(I=d.maxCallGas(n,e.eei.getGasLeft(),e)).gt(e.eei.getGasLeft())&&d.trap(b.ERROR.OUT_OF_GAS),y=a.alloc(0),g.isZero()||(y=e.memory.read(h.toNumber(),g.toNumber())),[4,e.eei.callDelegate(I,m,t,y)];case 1:return v=o.sent(),d.writeCallOutput(e,p,B),e.stack.push(v),[2]}}))}))}],[250,function(e){return n(this,void 0,void 0,(function(){var t,r,n,u,h,b,g,p,B,m,I,y;return o(this,(function(o){switch(o.label){case 0:return t=new c.BN(0),r=s(e.stack.popN(6),6),n=r[0],u=r[1],h=r[2],b=r[3],g=r[4],p=r[5],B=new c.Address(d.addressToBuffer(u)),d.subMemUsage(e,h,b),d.subMemUsage(e,g,p),l.accessAddressEIP2929(e,B),m=d.maxCallGas(n,e.eei.getGasLeft(),e),I=a.alloc(0),b.isZero()||(I=e.memory.read(h.toNumber(),b.toNumber())),[4,e.eei.callStatic(m,B,t,I)];case 1:return y=o.sent(),d.writeCallOutput(e,g,p),e.stack.push(y),[2]}}))}))}],[243,function(e){var t=s(e.stack.popN(2),2),r=t[0],n=t[1];d.subMemUsage(e,r,n);var o=a.alloc(0);n.isZero()||(o=e.memory.read(r.toNumber(),n.toNumber())),e.eei.finish(o)}],[253,function(e){var t=s(e.stack.popN(2),2),r=t[0],n=t[1];d.subMemUsage(e,r,n);var o=a.alloc(0);n.isZero()||(o=e.memory.read(r.toNumber(),n.toNumber())),e.eei.revert(o)}],[255,function(e){return n(this,void 0,void 0,(function(){var t,r,a;return o(this,(function(n){switch(n.label){case 0:return t=e.stack.pop(),e.eei.isStatic()&&d.trap(b.ERROR.STATIC_STATE_CHANGE),r=new c.Address(d.addressToBuffer(t)),a=!1,e._common.gteHardfork("spuriousDragon")?[4,e.eei.getExternalBalance(e.eei.getAddress())]:[3,4];case 1:return n.sent().gtn(0)?[4,e.eei.isAccountEmpty(r)]:[3,3];case 2:n.sent()&&(a=!0),n.label=3;case 3:return[3,6];case 4:return e._common.gteHardfork("tangerineWhistle")?[4,e.stateManager.accountExists(r)]:[3,6];case 5:n.sent()||(a=!0),n.label=6;case 6:return a&&e.eei.useGas(new c.BN(e._common.param("gasPrices","callNewAccount")),"SELFDESTRUCT opcode -> callNewAccount"),l.accessAddressEIP2929(e,r,!0,!0),[2,e.eei.selfDestruct(r)]}}))}))}]]);for(var g=t.handlers.get(96),p=97;p<=127;p++)t.handlers.set(p,g);var B=t.handlers.get(128);for(p=129;p<=143;p++)t.handlers.set(p,B);var m=t.handlers.get(144);for(p=145;p<=159;p++)t.handlers.set(p,m);var I=t.handlers.get(160);for(p=161;p<=164;p++)t.handlers.set(p,I)},(e,t,r)=>{var a=r(3),n=a.Buffer;function copyProps(e,t){for(var r in e)t[r]=e[r]}function SafeBuffer(e,t,r){return n(e,t,r)}n.from&&n.alloc&&n.allocUnsafe&&n.allocUnsafeSlow?e.exports=a:(copyProps(a,t),t.Buffer=SafeBuffer),SafeBuffer.prototype=Object.create(n.prototype),copyProps(n,SafeBuffer),SafeBuffer.from=function(e,t,r){if("number"==typeof e)throw new TypeError("Argument must not be a number");return n(e,t,r)},SafeBuffer.alloc=function(e,t,r){if("number"!=typeof e)throw new TypeError("Argument must be a number");var a=n(e);return void 0!==t?"string"==typeof r?a.fill(t,r):a.fill(t):a.fill(0),a},SafeBuffer.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return n(e)},SafeBuffer.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return a.SlowBuffer(e)}},function(e,t,r){"use strict";var a=r(3).Buffer,n=this&&this.__createBinding||(Object.create?function(e,t,r,a){void 0===a&&(a=r),Object.defineProperty(e,a,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,a){void 0===a&&(a=r),e[a]=t[r]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),s=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.hasOwnProperty.call(e,r)&&n(t,e,r);return o(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.rlphash=t.ripemd160FromArray=t.ripemd160FromString=t.ripemd160=t.sha256FromArray=t.sha256FromString=t.sha256=t.keccakFromArray=t.keccakFromHexString=t.keccakFromString=t.keccak256=t.keccak=void 0;var c=r(826),d=r(487),u=s(r(180)),h=r(71),l=r(341);t.keccak=function(e,t){switch(void 0===t&&(t=256),l.assertIsBuffer(e),t){case 224:return c.keccak224(e);case 256:return c.keccak256(e);case 384:return c.keccak384(e);case 512:return c.keccak512(e);default:throw new Error("Invald algorithm: keccak"+t)}},t.keccak256=function(e){return t.keccak(e)},t.keccakFromString=function(e,r){void 0===r&&(r=256),l.assertIsString(e);var n=a.from(e,"utf8");return t.keccak(n,r)},t.keccakFromHexString=function(e,r){return void 0===r&&(r=256),l.assertIsHexString(e),t.keccak(h.toBuffer(e),r)},t.keccakFromArray=function(e,r){return void 0===r&&(r=256),l.assertIsArray(e),t.keccak(h.toBuffer(e),r)};var _sha256=function(e){return e=h.toBuffer(e),d("sha256").update(e).digest()};t.sha256=function(e){return l.assertIsBuffer(e),_sha256(e)},t.sha256FromString=function(e){return l.assertIsString(e),_sha256(e)},t.sha256FromArray=function(e){return l.assertIsArray(e),_sha256(e)};var _ripemd160=function(e,t){e=h.toBuffer(e);var r=d("rmd160").update(e).digest();return!0===t?h.setLengthLeft(r,32):r};t.ripemd160=function(e,t){return l.assertIsBuffer(e),_ripemd160(e,t)},t.ripemd160FromString=function(e,t){return l.assertIsString(e),_ripemd160(e,t)},t.ripemd160FromArray=function(e,t){return l.assertIsArray(e),_ripemd160(e,t)},t.rlphash=function(e){return t.keccak(u.encode(e))}},(e,t,r)=>{var a=r(4),n=a.Buffer;function copyProps(e,t){for(var r in e)t[r]=e[r]}function SafeBuffer(e,t,r){return n(e,t,r)}n.from&&n.alloc&&n.allocUnsafe&&n.allocUnsafeSlow?e.exports=a:(copyProps(a,t),t.Buffer=SafeBuffer),SafeBuffer.prototype=Object.create(n.prototype),copyProps(n,SafeBuffer),SafeBuffer.from=function(e,t,r){if("number"==typeof e)throw new TypeError("Argument must not be a number");return n(e,t,r)},SafeBuffer.alloc=function(e,t,r){if("number"!=typeof e)throw new TypeError("Argument must be a number");var a=n(e);return void 0!==t?"string"==typeof r?a.fill(t,r):a.fill(t):a.fill(0),a},SafeBuffer.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return n(e)},SafeBuffer.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return a.SlowBuffer(e)}},function(e,t,r){"use strict";var a=r(4).Buffer,n=this&&this.__createBinding||(Object.create?function(e,t,r,a){void 0===a&&(a=r),Object.defineProperty(e,a,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,a){void 0===a&&(a=r),e[a]=t[r]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),s=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.hasOwnProperty.call(e,r)&&n(t,e,r);return o(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.rlphash=t.ripemd160FromArray=t.ripemd160FromString=t.ripemd160=t.sha256FromArray=t.sha256FromString=t.sha256=t.keccakFromArray=t.keccakFromHexString=t.keccakFromString=t.keccak256=t.keccak=void 0;var c=r(1290),d=r(874),u=s(r(343)),h=r(73),l=r(346);t.keccak=function(e,t){switch(void 0===t&&(t=256),l.assertIsBuffer(e),t){case 224:return c.keccak224(e);case 256:return c.keccak256(e);case 384:return c.keccak384(e);case 512:return c.keccak512(e);default:throw new Error("Invald algorithm: keccak"+t)}},t.keccak256=function(e){return t.keccak(e)},t.keccakFromString=function(e,r){void 0===r&&(r=256),l.assertIsString(e);var n=a.from(e,"utf8");return t.keccak(n,r)},t.keccakFromHexString=function(e,r){return void 0===r&&(r=256),l.assertIsHexString(e),t.keccak(h.toBuffer(e),r)},t.keccakFromArray=function(e,r){return void 0===r&&(r=256),l.assertIsArray(e),t.keccak(h.toBuffer(e),r)};var _sha256=function(e){return e=h.toBuffer(e),d("sha256").update(e).digest()};t.sha256=function(e){return l.assertIsBuffer(e),_sha256(e)},t.sha256FromString=function(e){return l.assertIsString(e),_sha256(e)},t.sha256FromArray=function(e){return l.assertIsArray(e),_sha256(e)};var _ripemd160=function(e,t){e=h.toBuffer(e);var r=d("rmd160").update(e).digest();return!0===t?h.setLengthLeft(r,32):r};t.ripemd160=function(e,t){return l.assertIsBuffer(e),_ripemd160(e,t)},t.ripemd160FromString=function(e,t){return l.assertIsString(e),_ripemd160(e,t)},t.ripemd160FromArray=function(e,t){return l.assertIsArray(e),_ripemd160(e,t)},t.rlphash=function(e){return t.keccak(u.encode(e))}},(e,t,r)=>{var a=r(2),n=a.Buffer;function copyProps(e,t){for(var r in e)t[r]=e[r]}function SafeBuffer(e,t,r){return n(e,t,r)}n.from&&n.alloc&&n.allocUnsafe&&n.allocUnsafeSlow?e.exports=a:(copyProps(a,t),t.Buffer=SafeBuffer),SafeBuffer.prototype=Object.create(n.prototype),copyProps(n,SafeBuffer),SafeBuffer.from=function(e,t,r){if("number"==typeof e)throw new TypeError("Argument must not be a number");return n(e,t,r)},SafeBuffer.alloc=function(e,t,r){if("number"!=typeof e)throw new TypeError("Argument must be a number");var a=n(e);return void 0!==t?"string"==typeof r?a.fill(t,r):a.fill(t):a.fill(0),a},SafeBuffer.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return n(e)},SafeBuffer.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return a.SlowBuffer(e)}},function(e,t,r){"use strict";var a=r(2).Buffer,n=this&&this.__createBinding||(Object.create?function(e,t,r,a){void 0===a&&(a=r),Object.defineProperty(e,a,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,a){void 0===a&&(a=r),e[a]=t[r]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),s=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.hasOwnProperty.call(e,r)&&n(t,e,r);return o(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.rlphash=t.ripemd160FromArray=t.ripemd160FromString=t.ripemd160=t.sha256FromArray=t.sha256FromString=t.sha256=t.keccakFromArray=t.keccakFromHexString=t.keccakFromString=t.keccak256=t.keccak=void 0;var c=r(1337),d=r(941),u=s(r(354)),h=r(76),l=r(357);t.keccak=function(e,t){switch(void 0===t&&(t=256),l.assertIsBuffer(e),t){case 224:return c.keccak224(e);case 256:return c.keccak256(e);case 384:return c.keccak384(e);case 512:return c.keccak512(e);default:throw new Error("Invald algorithm: keccak"+t)}},t.keccak256=function(e){return t.keccak(e)},t.keccakFromString=function(e,r){void 0===r&&(r=256),l.assertIsString(e);var n=a.from(e,"utf8");return t.keccak(n,r)},t.keccakFromHexString=function(e,r){return void 0===r&&(r=256),l.assertIsHexString(e),t.keccak(h.toBuffer(e),r)},t.keccakFromArray=function(e,r){return void 0===r&&(r=256),l.assertIsArray(e),t.keccak(h.toBuffer(e),r)};var _sha256=function(e){return e=h.toBuffer(e),d("sha256").update(e).digest()};t.sha256=function(e){return l.assertIsBuffer(e),_sha256(e)},t.sha256FromString=function(e){return l.assertIsString(e),_sha256(e)},t.sha256FromArray=function(e){return l.assertIsArray(e),_sha256(e)};var _ripemd160=function(e,t){e=h.toBuffer(e);var r=d("rmd160").update(e).digest();return!0===t?h.setLengthLeft(r,32):r};t.ripemd160=function(e,t){return l.assertIsBuffer(e),_ripemd160(e,t)},t.ripemd160FromString=function(e,t){return l.assertIsString(e),_ripemd160(e,t)},t.ripemd160FromArray=function(e,t){return l.assertIsArray(e),_ripemd160(e,t)},t.rlphash=function(e){return t.keccak(u.encode(e))}},(e,t,r)=>{"use strict";var a=r(0).Buffer,n=r(553),o=r(976);function padToEven(e){var t=e;if("string"!=typeof t)throw new Error("[ethjs-util] while padding to even, value must be string, is currently "+typeof t+", while padToEven.");return t.length%2&&(t="0"+t),t}function intToHex(e){return"0x"+e.toString(16)}e.exports={arrayContainsArray:function arrayContainsArray(e,t,r){if(!0!==Array.isArray(e))throw new Error("[ethjs-util] method arrayContainsArray requires input 'superset' to be an array got type '"+typeof e+"'");if(!0!==Array.isArray(t))throw new Error("[ethjs-util] method arrayContainsArray requires input 'subset' to be an array got type '"+typeof t+"'");return t[Boolean(r)?"some":"every"]((function(t){return e.indexOf(t)>=0}))},intToBuffer:function intToBuffer(e){var t=intToHex(e);return new a(padToEven(t.slice(2)),"hex")},getBinarySize:function getBinarySize(e){if("string"!=typeof e)throw new Error("[ethjs-util] while getting binary size, method getBinarySize requires input 'str' to be type String, got '"+typeof e+"'.");return a.byteLength(e,"utf8")},isHexPrefixed:n,stripHexPrefix:o,padToEven,intToHex,fromAscii:function fromAscii(e){for(var t="",r=0;r{mt.default.setMapToMode(mt.default.IRTF),mt.default.verifyOrderG1(!0),mt.default.verifyOrderG2(!0)}));var Et;function makeTrie(e,t,r){return e.fallback?new ut.ForkTrie(t,r?r.toBuffer():null,e):new dt.GanacheTrie(t,r?r.toBuffer():null,e)}!function(e){e[e.started=1]="started",e[e.starting=2]="starting",e[e.stopped=4]="stopped",e[e.stopping=8]="stopping",e[e.paused=16]="paused"}(Et=t.Status||(t.Status={}));class Blockchain extends Y.default.Typed{constructor(e,t,r){super(),a.set(this,Et.starting),n.set(this,void 0),o.set(this,void 0),s.set(this,null),c.set(this,!1),d.set(this,void 0),u.set(this,void 0),h.set(this,void 0),l.set(this,(({block:e,serialized:t,storageKeys:r,transactions:a})=>{const{blocks:n}=this;return n.latest=e,L(this,d).batch((()=>{const o=e.hash(),s=e.header,c=s.number,d=c.toBuffer(),h=j.BlockLogs.create(o),l=s.timestamp,b=new Date(1e3*l.toNumber()).toString(),p=[];return a.forEach(((e,t)=>{const r=e.hash.toBuffer(),a=$.Quantity.from(t),n=e.serializeForDb(o,c,a);this.transactions.set(r,n);const d=e.getReceipt(),u=d.serialize(!0);this.transactionReceipts.set(r,u),e.getLogs().forEach(h.append.bind(h,a,e.hash)),p.push(L(this,g).call(this,r,d,s.number,b,e.execException))})),r.forEach((e=>{this.storageKeys.put(e.hashedKey,e.key)})),h.blockNumber=s.number,this.blockLogs.set(d,h.serialize()),n.putBlock(d,o,t),p.length>0&&L(this,u).logging.logger.log(p.join(q.EOL)),{block:e,blockLogs:h,transactions:a}}))})),b.set(this,(async e=>{const t=L(this,u),{block:r,blockLogs:a,transactions:n}=e;return n.forEach((e=>{e.finalize("confirmed",e.execException)})),L(this,h)&&t.miner.legacyInstamine?await new Promise((e=>{k.nextTick((async()=>{await Promise.all([this.emit("blockLogs",a),this.emit("block",r)]),e(void 0)}))})):await Promise.all([this.emit("blockLogs",a),this.emit("block",r)]),e})),g.set(this,((e,t,r,a,n)=>{let o=`${q.EOL} Transaction: ${$.Data.from(e)}${q.EOL}`;const s=t.contractAddress;return null!=s&&(o+=` Contract created: ${it.Address.from(s)}${q.EOL}`),o+=` Gas usage: ${$.Quantity.from(t.raw[1]).toNumber()}\n Block number: ${r.toNumber()}\n Block time: ${a}${q.EOL}`,n&&(o+=` Runtime error: ${n.data.message}${q.EOL}`,n.data.reason&&(o+=` Revert reason: ${n.data.reason}${q.EOL}`)),o})),p.set(this,(async e=>(T(this,o,L(this,o).then((()=>L(this,l).call(this,e))).then(L(this,b))),L(this,o)))),B.set(this,((e,t)=>{const r=e.header,a=r.number.toBigInt()||0n;return new ot.RuntimeBlock($.Quantity.from(a+1n),e.hash(),this.coinbase,L(this,u).miner.blockGasLimit.toBuffer(),pt.BUFFER_ZERO,$.Quantity.from(null==t?L(this,x).call(this):t),L(this,u).miner.difficulty,r.totalDifficulty,ot.Block.calcNextBaseFee(e))})),this.isStarted=()=>L(this,a)===Et.started,this.mine=async(e,t,r=!1)=>{await L(this,o);const a=L(this,B).call(this,this.blocks.latest,t);return L(this,n).mine(a,e,r)},m.set(this,(()=>0!=(L(this,a)&Et.paused))),this.createVmFromStateTrie=async(e,t,r)=>{const a=this.blocks,n={getBlock:async e=>{const t=await a.get(e.toBuffer()).catch((e=>null));return t?{hash:()=>t.hash().toBuffer()}:null}},o=this.common,s=new V.default({state:e,activatePrecompiles:!1,common:o,allowUnlimitedContractSize:t,blockchain:n,stateManager:this.fallback?new st.ForkStateManager({common:o,trie:e}):new ct.DefaultStateManager({common:o,trie:e})});return r&&(await ht.activatePrecompiles(s.stateManager),o.isActivatedEIP(2537)&&await It),s._isInitialized=!0,s},I.set(this,(e=>Promise.all(e.map((e=>this.trie.put(e.address.toBuffer(),e.serialize())))))),y.set(this,(async(e,t,r)=>{if(null!=this.fallback){const{block:a}=this.fallback,{miner:n}=L(this,u),o=this.vm.stateManager;let s;o.checkpoint(),r.forEach((e=>{const t={buf:e.address.toBuffer()};o._cache.put(t,e),o.touchAccount(t)})),await o.commit(),this.common.isActivatedEIP(1559)&&(s=void 0===a.header.baseFeePerGas?ot.Block.INITIAL_BASE_FEE_PER_GAS:a.header.baseFeePerGas.toBigInt());const c=new ot.RuntimeBlock($.Quantity.from(a.header.number.toBigInt()+1n),a.hash(),this.coinbase,t.toBuffer(),pt.BUFFER_ZERO,$.Quantity.from(e),n.difficulty,a.header.totalDifficulty,s),{block:d,serialized:h}=c.finalize(z.KECCAK256_RLP,z.KECCAK256_RLP,$.BUFFER_256_ZERO,this.trie.root,0n,n.extraData,[],new Map),l=d.hash();return this.blocks.putBlock(d.header.number.toBuffer(),l,h).then((e=>({block:d,blockLogs:j.BlockLogs.create(l)})))}await L(this,I).call(this,r);const a=$.RPCQUANTITY_EMPTY,n=this.common.isActivatedEIP(1559)?ot.Block.INITIAL_BASE_FEE_PER_GAS:void 0,o=new ot.RuntimeBlock(a,$.Data.from($.BUFFER_32_ZERO),this.coinbase,t.toBuffer(),pt.BUFFER_ZERO,$.Quantity.from(e),L(this,u).miner.difficulty,$.RPCQUANTITY_ZERO,n),{block:s,serialized:c}=o.finalize(z.KECCAK256_RLP,z.KECCAK256_RLP,$.BUFFER_256_ZERO,this.trie.root,0n,L(this,u).miner.extraData,[],new Map);s.header.number=$.RPCQUANTITY_ZERO;const d=s.hash();return this.blocks.putBlock(s.header.number.toBuffer(),d,c).then((e=>({block:s,blockLogs:j.BlockLogs.create(d)})))})),v.set(this,0),x.set(this,(()=>Math.floor((Date.now()+L(this,v))/1e3))),C.set(this,(e=>L(this,d).batch((()=>{const{blocks:t,transactions:r,transactionReceipts:a,blockLogs:n}=this;e.forEach((e=>{e.getTransactions().forEach((e=>{const t=e.hash.toBuffer();r.del(t),a.del(t)}));const o=e.header.number.toBuffer();t.del(o),t.del(e.hash().toBuffer()),n.del(o)}))})))),Q.set(this,{snaps:[],blocks:null,unsubscribeFromBlocks:null}),w.set(this,(async(e,t,r,a,n)=>{let o=-1;const s=[],u=this.blocks,h={getBlock:async e=>{const t=await u.get(e.toBuffer()).catch((e=>null));return t?{hash:()=>t.hash().toBuffer()}:null}},l=this.common,b=await V.default.create({state:e,activatePrecompiles:!1,common:l,allowUnlimitedContractSize:this.vm.allowUnlimitedContractSize,blockchain:h,stateManager:this.fallback?new st.ForkStateManager({common:l,trie:e}):new ct.DefaultStateManager({common:l,trie:e})}),g={},p=t.transactions[t.transactions.length-1];let B=0;const m=[],I=j.TraceDataFactory(),y={},stepListener=async(e,t)=>{L(this,c)&&this.emit("ganache:vm:tx:step",Bt.makeStepEvent(y,e));const a=e.gasLeft.toNumber(),n=p.gasLimit.toNumber()-a-B;B+=n;const d=[];if(!0!==r.disableMemory){let t=0;for(;tr?s.pop():o{b.removeListener("step",stepListener),b.removeListener("afterTransaction",afterTxListener),this.emit("ganache:vm:tx:after",{context:y})},beforeTxListener=async e=>{if(e===p&&(this.emit("ganache:vm:tx:before",{context:y}),b.on("step",stepListener),b.on("afterTx",afterTxListener),a&&n)){const e=L(this,d);return Promise.all(a.map((async t=>{let r=await e.storageKeys.get(t);const a=await b.stateManager.getContractStorage({buf:it.Address.from(n).toBuffer()},r);g[$.Data.from(t,t.length).toString()]={key:$.Data.from(r,r.length),value:$.Data.from(a,32)}})))}};return b.on("beforeTx",beforeTxListener),b.stateManager._cache.flush=()=>{},await At.runTransactions(b,t.transactions,t),b.removeListener("step",stepListener),b.removeListener("beforeTx",beforeTxListener),b.removeListener("afterTx",afterTxListener),{gas:B,structLogs:m,returnValue:"",storage:g}})),_.set(this,((e,t,r)=>{const a=new ot.RuntimeBlock($.Quantity.from((t.header.number.toBigInt()||0n)+1n),t.hash(),t.header.miner,t.header.gasLimit.toBuffer(),pt.BUFFER_ZERO,e.header.timestamp,L(this,u).miner.difficulty,t.header.totalDifficulty,ot.Block.calcNextBaseFee(t));a.transactions=[],a.uncleHeaders=[];const n=e.getTransactions();for(const e of n)if(a.transactions.push(e.toVmTransaction()),e.hash.toBuffer().equals(r))break;return a})),T(this,u,e),this.fallback=r;const D=T(this,h,!e.miner.blockTime||e.miner.blockTime<=0),U=e.miner.legacyInstamine;U&&console.info("Legacy instamining, where transactions are fully mined before the hash is returned, is deprecated and will be removed in the future."),D||(U&&console.info("Setting `legacyInstamine` to `true` has no effect when blockTime is non-zero"),e.chain.vmErrorsOnRPCResponse&&console.info("Setting `vmErrorsOnRPCResponse` to `true` has no effect on transactions when blockTime is non-zero")),this.coinbase=t,T(this,d,new H.default(e.database,this))}async initialize(e){const t=L(this,d),r=L(this,u),l=L(this,h);try{let a;this.fallback?(await this.fallback.initialize(),await t.initialize(),a=this.common=this.fallback.common,r.fork.blockNumber=this.fallback.blockNumber.toNumber(),r.chain.networkId=a.networkId(),r.chain.chainId=a.chainId()):(await t.initialize(),a=this.common=function createCommon(e,t,r){const a=W.default.forCustomChain($.KNOWN_CHAINIDS.has(e)?e:1,{name:"ganache",networkId:t,chainId:e,comment:"Local test network"},r);return a.on=()=>{},a}(r.chain.chainId,r.chain.networkId,r.chain.hardfork));const d=this.blocks=await tt.default.initialize(this,a,t.blockIndexes,t.blocks);this.blockLogs=new rt.default(t.blockLogs,this),this.transactions=new at.default(r.miner,a,this,t.transactions),this.transactionReceipts=new bt.default(t.transactionReceipts,this),this.accounts=new et.default(this),this.storageKeys=t.storageKeys;const{latest:u}=d;{let e;u?(T(this,o,Promise.resolve({block:u,blockLogs:null})),({stateRoot:e}=u.header)):e=null,this.trie=makeTrie(this,t.trie,e)}this.vm=await this.createVmFromStateTrie(this.trie,r.chain.allowUnlimitedContractSize,!0);{let t;if(null!=r.chain.time){const e=r.chain.time.getTime();t=Math.floor(e/1e3),this.setTime(e)}else t=L(this,x).call(this);u||(e.length>0&&await L(this,I).call(this,e),T(this,o,L(this,y).call(this,t,r.miner.blockGasLimit,e)),d.earliest=d.latest=await L(this,o).then((({block:e})=>e)))}{const e=this.transactions.transactionPool,t=r.miner,a=T(this,n,new O.default(t,e.executables,this.vm,L(this,B)));a.on("ganache:vm:tx:before",(e=>{this.emit("ganache:vm:tx:before",e)})),a.on("ganache:vm:tx:step",(e=>{L(this,c)&&this.emit("ganache:vm:tx:step",e)})),a.on("ganache:vm:tx:after",(e=>{this.emit("ganache:vm:tx:after",e)}));const o=Promise.resolve(null),mineAll=e=>L(this,m).call(this)?o:this.mine(e);if(l)e.on("drain",mineAll.bind(null,O.Capacity.Single));else{const wait=()=>$.unref(T(this,s,setTimeout(next,1e3*t.blockTime))),next=()=>mineAll(O.Capacity.FillBlock).then(wait);wait()}a.on("block",L(this,p)),this.once("stop").then((()=>a.clearListeners()))}}catch(e){throw T(this,a,Et.stopping),await this.stop().catch((e=>{})),e}T(this,a,Et.started),this.emit("ready")}pause(){T(this,a,L(this,a)|Et.paused)}resume(e=1){if(L(this,m).call(this))return T(this,a,L(this,a)^Et.paused),L(this,h)?this.mine(O.Capacity.FillBlock):void 0;console.log("Warning: startMining called when miner was already started")}increaseTime(e){return e<0&&(e=0),T(this,v,L(this,v)+e)}setTime(e){return T(this,v,e-Date.now())}snapshot(){const e=L(this,Q),t=e.snaps.push({block:this.blocks.latest,timeAdjustment:L(this,v)});return 1===t&&(e.unsubscribeFromBlocks=this.on("block",(t=>{e.blocks={current:t.hash().toBuffer(),next:e.blocks}}))),L(this,u).logging.logger.log("Saved snapshot #"+t),t}async revert(e){const t=e.valueOf();if(null==t)throw new Error("invalid snapshotId");if(L(this,u).logging.logger.log("Reverting to snapshot #"+e),t<1n)return!1;const r=L(this,Q),a=r.snaps,s=Number(t-1n),c=a[s];if(!c)return!1;await this.transactions.pause(),await L(this,n).pause(),await L(this,o),this.transactions.clear();const d=this.blocks,h=d.latest.hash().toBuffer(),l=c.block,b=l.header,g=l.hash().toBuffer();if(a.splice(s),0===a.length&&r.unsubscribeFromBlocks(),!h.equals(g)){const e=[];let t=r.blocks;for(;null!==t&&!t.current.equals(g);)e.push(d.getByHash(t.current)),t=t.next;r.blocks=t,await Promise.all(e).then(L(this,C)),function setStateRootSync(e,t){e._trie.root=t,e._cache.clear(),e._storageTries={}}(this.vm.stateManager,b.stateRoot.toBuffer()),d.latest=l}return T(this,v,c.timeAdjustment),L(this,n).resume(),this.transactions.resume(),!0}async queueTransaction(e,t){!0===await this.transactions.add(e,t)&&k.nextTick(this.emit.bind(this),"pendingTransaction",e);const r=e.hash;if(L(this,m).call(this)||!L(this,h))return r;if(L(this,h)&&L(this,u).miner.legacyInstamine){const{status:t,error:r}=await e.once("finalized");if(r&&("rejected"===t||L(this,u).chain.vmErrorsOnRPCResponse))throw r}return r}async simulateTransaction(e,t){let r;const a=e.data;let n=e.gas.toBigInt();const o=null!=e.to;let s=null;if(o){const t=e.to.toBuffer();s={equals:e=>t.equals(e.buf),buf:t}}else s=null;const d=n-nt.calculateIntrinsicGas(a,o,this.common),h={};if(this.emit("ganache:vm:tx:before",{context:h}),d>=0n){const a=this.trie.copy(!1);a.setContext(t.header.stateRoot.toBuffer(),null,t.header.number);const o=await this.createVmFromStateTrie(a,L(this,u).chain.allowUnlimitedContractSize,!1);o.stateManager.checkpoint(),o.on("step",(e=>{if(!L(this,c))return;const t=Bt.makeStepEvent(h,e);this.emit("ganache:vm:tx:step",t)}));const l=e.from.toBuffer();if(this.common.isActivatedEIP(2929)){const e=o.stateManager;ht.warmPrecompiles(e),e.addWarmedAddress(l),s&&e.addWarmedAddress(s.buf)}const b=await o.stateManager.getAccount({buf:l});b.nonce.iaddn(1);const g=new z.BN((n*e.gasPrice.toBigInt()).toString());b.balance.isub(g),await o.stateManager.putAccount({buf:l},b),r=await o.runCall({caller:{buf:l,equals:e=>l.equals(e.buf)},data:e.data&&e.data.toBuffer(),gasPrice:new z.BN(e.gasPrice.toBuffer()),gasLimit:new z.BN($.Quantity.from(d).toBuffer()),to:s,value:null==e.value?new z.BN(0):new z.BN(e.value.toBuffer()),block:e.block})}else r={execResult:{runState:{programCounter:0},exceptionError:new X.VmError(X.ERROR.OUT_OF_GAS),returnValue:$.BUFFER_EMPTY}};if(this.emit("ganache:vm:tx:after",{context:h}),r.execResult.exceptionError){if(L(this,u).chain.vmErrorsOnRPCResponse){const e=$.RPCQUANTITY_EMPTY;throw new j.RuntimeError(e,r,j.RETURN_TYPES.RETURN_VALUE)}return $.Data.from(r.execResult.returnValue||"0x")}return $.Data.from(r.execResult.returnValue||"0x")}async traceTransaction(e,t){const r=$.Data.from(e).toBuffer(),a=await this.transactions.get(r);if(!a)throw new Error("Unknown transaction "+e);const n=await this.blocks.get(a.blockNumber.toBuffer()),o=await this.blocks.getByHash(n.header.parentHash.toBuffer()),s=L(this,_).call(this,n,o,r);s.transactions=s.transactions.slice(0,1+a.index.toNumber());const c=this.trie.copy();c.setContext(o.header.stateRoot.toBuffer(),null,o.header.number);const{gas:d,structLogs:u,returnValue:h,storage:l}=await L(this,w).call(this,c,s,t);return{gas:d,structLogs:u,returnValue:h,storage:l}}async storageRangeAt(e,t,r,a,n){const o=await this.blocks.getByHash(e),s=o.getTransactions()[t];if(!s)throw new Error(`transaction index ${t} is out of range for block ${e}`);const c=await this.blocks.getByHash(o.header.parentHash.toBuffer()),u=makeTrie(this,L(this,d).trie,c.header.stateRoot),h=it.Address.from(r).toBuffer(),l=await u.get(h);if(!l)throw new Error(`account ${r} doesn't exist`);const{keys:b,nextKey:g}=await(()=>{const e=u.copy(!1);return e.setContext(J.decode(l)[2],h,c.header.number),new Promise(((t,r)=>{const o=$.Data.from(a).toBuffer(),compare=(e,t)=>e.compare(t)<0,s=[];e.createReadStream().on("data",(({key:e})=>{if(o.compare(e)>0)return;const t=$.findInsertPosition(s,e,compare);t>n||s.splice(t,0,e)})).on("error",r).on("end",(()=>{s.length>n?t({keys:s.slice(0,n),nextKey:$.Data.from(s[n])}):t({keys:s,nextKey:null})}))}))})(),p=s.hash.toBuffer(),B=L(this,_).call(this,o,c,p),{storage:m}=await L(this,w).call(this,u,B,{disableMemory:!0,disableStack:!0,disableStorage:!1},b,h);return{storage:m,nextKey:g}}toggleStepEvent(e){T(this,c,e),L(this,n).toggleStepEvent(e)}async stop(){L(this,a)===Et.starting&&await this.once("ready"),T(this,a,Et.stopping),clearTimeout(L(this,s)),this.vm&&this.vm.removeAllListeners(),this.transactions&&await this.transactions.pause(),L(this,n)&&await L(this,n).pause(),await L(this,o),this.fallback&&await this.fallback.close(),await this.emit("stop"),L(this,d)&&await L(this,d).close(),T(this,a,Et.stopped)}}t.default=Blockchain,a=new WeakMap,n=new WeakMap,o=new WeakMap,s=new WeakMap,c=new WeakMap,d=new WeakMap,u=new WeakMap,h=new WeakMap,l=new WeakMap,b=new WeakMap,g=new WeakMap,p=new WeakMap,B=new WeakMap,m=new WeakMap,I=new WeakMap,y=new WeakMap,v=new WeakMap,x=new WeakMap,C=new WeakMap,Q=new WeakMap,w=new WeakMap,_=new WeakMap},(e,t,r)=>{"use strict";var a,n=SyntaxError,o=Function,s=TypeError,getEvalledConstructor=function(e){try{return o('"use strict"; return ('+e+").constructor;")()}catch(e){}},c=Object.getOwnPropertyDescriptor;if(c)try{c({},"")}catch(e){c=null}var throwTypeError=function(){throw new s},d=c?function(){try{return throwTypeError}catch(e){try{return c(arguments,"callee").get}catch(e){return throwTypeError}}}():throwTypeError,u=r(675)(),h=Object.getPrototypeOf||function(e){return e.__proto__},l={},b="undefined"==typeof Uint8Array?a:h(Uint8Array),g={"%AggregateError%":"undefined"==typeof AggregateError?a:AggregateError,"%Array%":Array,"%ArrayBuffer%":"undefined"==typeof ArrayBuffer?a:ArrayBuffer,"%ArrayIteratorPrototype%":u?h([][Symbol.iterator]()):a,"%AsyncFromSyncIteratorPrototype%":a,"%AsyncFunction%":l,"%AsyncGenerator%":l,"%AsyncGeneratorFunction%":l,"%AsyncIteratorPrototype%":l,"%Atomics%":"undefined"==typeof Atomics?a:Atomics,"%BigInt%":"undefined"==typeof BigInt?a:BigInt,"%Boolean%":Boolean,"%DataView%":"undefined"==typeof DataView?a:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":"undefined"==typeof Float32Array?a:Float32Array,"%Float64Array%":"undefined"==typeof Float64Array?a:Float64Array,"%FinalizationRegistry%":"undefined"==typeof FinalizationRegistry?a:FinalizationRegistry,"%Function%":o,"%GeneratorFunction%":l,"%Int8Array%":"undefined"==typeof Int8Array?a:Int8Array,"%Int16Array%":"undefined"==typeof Int16Array?a:Int16Array,"%Int32Array%":"undefined"==typeof Int32Array?a:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":u?h(h([][Symbol.iterator]())):a,"%JSON%":"object"==typeof JSON?JSON:a,"%Map%":"undefined"==typeof Map?a:Map,"%MapIteratorPrototype%":"undefined"!=typeof Map&&u?h((new Map)[Symbol.iterator]()):a,"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":"undefined"==typeof Promise?a:Promise,"%Proxy%":"undefined"==typeof Proxy?a:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":"undefined"==typeof Reflect?a:Reflect,"%RegExp%":RegExp,"%Set%":"undefined"==typeof Set?a:Set,"%SetIteratorPrototype%":"undefined"!=typeof Set&&u?h((new Set)[Symbol.iterator]()):a,"%SharedArrayBuffer%":"undefined"==typeof SharedArrayBuffer?a:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":u?h(""[Symbol.iterator]()):a,"%Symbol%":u?Symbol:a,"%SyntaxError%":n,"%ThrowTypeError%":d,"%TypedArray%":b,"%TypeError%":s,"%Uint8Array%":"undefined"==typeof Uint8Array?a:Uint8Array,"%Uint8ClampedArray%":"undefined"==typeof Uint8ClampedArray?a:Uint8ClampedArray,"%Uint16Array%":"undefined"==typeof Uint16Array?a:Uint16Array,"%Uint32Array%":"undefined"==typeof Uint32Array?a:Uint32Array,"%URIError%":URIError,"%WeakMap%":"undefined"==typeof WeakMap?a:WeakMap,"%WeakRef%":"undefined"==typeof WeakRef?a:WeakRef,"%WeakSet%":"undefined"==typeof WeakSet?a:WeakSet},p=function doEval(e){var t;if("%AsyncFunction%"===e)t=getEvalledConstructor("async function () {}");else if("%GeneratorFunction%"===e)t=getEvalledConstructor("function* () {}");else if("%AsyncGeneratorFunction%"===e)t=getEvalledConstructor("async function* () {}");else if("%AsyncGenerator%"===e){var r=doEval("%AsyncGeneratorFunction%");r&&(t=r.prototype)}else if("%AsyncIteratorPrototype%"===e){var a=doEval("%AsyncGenerator%");a&&(t=h(a.prototype))}return g[e]=t,t},B={"%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"]},m=r(411),I=r(253),y=m.call(Function.call,Array.prototype.concat),v=m.call(Function.apply,Array.prototype.splice),x=m.call(Function.call,String.prototype.replace),C=m.call(Function.call,String.prototype.slice),Q=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,w=/\\(\\)?/g,_=function stringToPath(e){var t=C(e,0,1),r=C(e,-1);if("%"===t&&"%"!==r)throw new n("invalid intrinsic syntax, expected closing `%`");if("%"===r&&"%"!==t)throw new n("invalid intrinsic syntax, expected opening `%`");var a=[];return x(e,Q,(function(e,t,r,n){a[a.length]=r?x(n,w,"$1"):t||e})),a},k=function getBaseIntrinsic(e,t){var r,a=e;if(I(B,a)&&(a="%"+(r=B[a])[0]+"%"),I(g,a)){var o=g[a];if(o===l&&(o=p(a)),void 0===o&&!t)throw new s("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:r,name:a,value:o}}throw new n("intrinsic "+e+" does not exist!")};e.exports=function GetIntrinsic(e,t){if("string"!=typeof e||0===e.length)throw new s("intrinsic name must be a non-empty string");if(arguments.length>1&&"boolean"!=typeof t)throw new s('"allowMissing" argument must be a boolean');var r=_(e),a=r.length>0?r[0]:"",o=k("%"+a+"%",t),d=o.name,u=o.value,h=!1,l=o.alias;l&&(a=l[0],v(r,y([0,1],l)));for(var b=1,p=!0;b=r.length){var Q=c(u,B);u=(p=!!Q)&&"get"in Q&&!("originalValue"in Q.get)?Q.get:u[B]}else p=I(u,B),u=u[B];p&&!h&&(g[d]=u)}}return u}},e=>{function assert(e,t){if(!e)throw new Error(t||"Assertion failed")}e.exports=assert,assert.equal=function assertEqual(e,t,r){if(e!=t)throw new Error(r||"Assertion failed: "+e+" != "+t)}},(e,t,r)=>{"use strict";var a=t,n=r(26),o=r(67),s=r(454);a.assert=o,a.toArray=s.toArray,a.zero2=s.zero2,a.toHex=s.toHex,a.encode=s.encode,a.getNAF=function getNAF(e,t,r){var a=new Array(Math.max(e.bitLength(),r)+1);a.fill(0);for(var n=1<(n>>1)-1?(n>>1)-d:d,o.isubn(c)):c=0,a[s]=c,o.iushrn(1)}return a},a.getJSF=function getJSF(e,t){var r=[[],[]];e=e.clone(),t=t.clone();for(var a,n=0,o=0;e.cmpn(-n)>0||t.cmpn(-o)>0;){var s,c,d=e.andln(3)+n&3,u=t.andln(3)+o&3;3===d&&(d=-1),3===u&&(u=-1),s=0==(1&d)?0:3!==(a=e.andln(7)+n&7)&&5!==a||2!==u?d:-d,r[0].push(s),c=0==(1&u)?0:3!==(a=t.andln(7)+o&7)&&5!==a||2!==d?u:-u,r[1].push(c),2*n===s+1&&(n=1-n),2*o===c+1&&(o=1-o),e.iushrn(1),t.iushrn(1)}return r},a.cachedProperty=function cachedProperty(e,t,r){var a="_"+t;e.prototype[t]=function cachedProperty(){return void 0!==this[a]?this[a]:this[a]=r.call(this)}},a.parseBytes=function parseBytes(e){return"string"==typeof e?a.toArray(e,"hex"):e},a.intFromLE=function intFromLE(e){return new n(e,"hex","le")}},(e,t,r)=>{"use strict";var a=t,n=r(95),o=r(157),s=r(470);a.assert=o,a.toArray=s.toArray,a.zero2=s.zero2,a.toHex=s.toHex,a.encode=s.encode,a.getNAF=function getNAF(e,t,r){var a=new Array(Math.max(e.bitLength(),r)+1);a.fill(0);for(var n=1<(n>>1)-1?(n>>1)-d:d,o.isubn(c)):c=0,a[s]=c,o.iushrn(1)}return a},a.getJSF=function getJSF(e,t){var r=[[],[]];e=e.clone(),t=t.clone();for(var a,n=0,o=0;e.cmpn(-n)>0||t.cmpn(-o)>0;){var s,c,d=e.andln(3)+n&3,u=t.andln(3)+o&3;3===d&&(d=-1),3===u&&(u=-1),s=0==(1&d)?0:3!==(a=e.andln(7)+n&7)&&5!==a||2!==u?d:-d,r[0].push(s),c=0==(1&u)?0:3!==(a=t.andln(7)+o&7)&&5!==a||2!==d?u:-u,r[1].push(c),2*n===s+1&&(n=1-n),2*o===c+1&&(o=1-o),e.iushrn(1),t.iushrn(1)}return r},a.cachedProperty=function cachedProperty(e,t,r){var a="_"+t;e.prototype[t]=function cachedProperty(){return void 0!==this[a]?this[a]:this[a]=r.call(this)}},a.parseBytes=function parseBytes(e){return"string"==typeof e?a.toArray(e,"hex"):e},a.intFromLE=function intFromLE(e){return new n(e,"hex","le")}},(e,t,r)=>{"use strict";var a=r(3).Buffer;Object.defineProperty(t,"__esModule",{value:!0}),t.baToJSON=t.addHexPrefix=t.toUnsigned=t.fromSigned=t.bufferToHex=t.bufferToInt=t.toBuffer=t.stripZeros=t.unpad=t.setLengthRight=t.setLength=t.setLengthLeft=t.zeros=void 0;var n=r(87),o=r(126);t.zeros=function(e){return a.allocUnsafe(e).fill(0)},t.setLengthLeft=function(e,r,a){void 0===a&&(a=!1);var n=t.zeros(r);return e=t.toBuffer(e),a?e.length0&&"0"===t.toString();)t=(e=e.slice(1))[0];return e},t.stripZeros=t.unpad,t.toBuffer=function(e){if(!a.isBuffer(e))if(Array.isArray(e))e=a.from(e);else if("string"==typeof e){if(!n.isHexString(e))throw new Error("Cannot convert string to buffer. toBuffer only supports 0x-prefixed hex strings and this string was given: "+e);e=a.from(n.padToEven(n.stripHexPrefix(e)),"hex")}else if("number"==typeof e)e=n.intToBuffer(e);else if(null==e)e=a.allocUnsafe(0);else if(o.isBN(e))e=e.toArrayLike(a);else{if(!e.toArray)throw new Error("invalid type");e=a.from(e.toArray())}return e},t.bufferToInt=function(e){return new o(t.toBuffer(e)).toNumber()},t.bufferToHex=function(e){return"0x"+(e=t.toBuffer(e)).toString("hex")},t.fromSigned=function(e){return new o(e).fromTwos(256)},t.toUnsigned=function(e){return a.from(e.toTwos(256).toArray())},t.addHexPrefix=function(e){return"string"!=typeof e||n.isHexPrefixed(e)?e:"0x"+e},t.baToJSON=function(e){if(a.isBuffer(e))return"0x"+e.toString("hex");if(e instanceof Array){for(var r=[],n=0;n0&&"0"===t.toString();)t=(e=e.slice(1))[0];return e};t.unpadBuffer=function(e){return c.assertIsBuffer(e),stripZeros(e)},t.unpadArray=function(e){return c.assertIsArray(e),stripZeros(e)},t.unpadHexString=function(e){return c.assertIsHexString(e),e=s.stripHexPrefix(e),stripZeros(e)},t.toBuffer=function(e){if(null==e)return a.allocUnsafe(0);if(a.isBuffer(e))return a.from(e);if(Array.isArray(e)||e instanceof Uint8Array)return a.from(e);if("string"==typeof e){if(!s.isHexString(e))throw new Error("Cannot convert string to buffer. toBuffer only supports 0x-prefixed hex strings and this string was given: "+e);return a.from(s.padToEven(s.stripHexPrefix(e)),"hex")}if("number"==typeof e)return s.intToBuffer(e);if(o.default.isBN(e))return e.toArrayLike(a);if(e.toArray)return a.from(e.toArray());if(e.toBuffer)return a.from(e.toBuffer());throw new Error("invalid type")},t.bufferToInt=function(e){return new o.default(t.toBuffer(e)).toNumber()},t.bufferToHex=function(e){return"0x"+(e=t.toBuffer(e)).toString("hex")},t.fromSigned=function(e){return new o.default(e).fromTwos(256)},t.toUnsigned=function(e){return a.from(e.toTwos(256).toArray())},t.addHexPrefix=function(e){return"string"!=typeof e||s.isHexPrefixed(e)?e:"0x"+e},t.baToJSON=function(e){if(a.isBuffer(e))return"0x"+e.toString("hex");if(e instanceof Array){for(var r=[],n=0;n{"use strict";var a=t,n=r(96),o=r(159),s=r(503);a.assert=o,a.toArray=s.toArray,a.zero2=s.zero2,a.toHex=s.toHex,a.encode=s.encode,a.getNAF=function getNAF(e,t,r){var a=new Array(Math.max(e.bitLength(),r)+1);a.fill(0);for(var n=1<(n>>1)-1?(n>>1)-d:d,o.isubn(c)):c=0,a[s]=c,o.iushrn(1)}return a},a.getJSF=function getJSF(e,t){var r=[[],[]];e=e.clone(),t=t.clone();for(var a,n=0,o=0;e.cmpn(-n)>0||t.cmpn(-o)>0;){var s,c,d=e.andln(3)+n&3,u=t.andln(3)+o&3;3===d&&(d=-1),3===u&&(u=-1),s=0==(1&d)?0:3!==(a=e.andln(7)+n&7)&&5!==a||2!==u?d:-d,r[0].push(s),c=0==(1&u)?0:3!==(a=t.andln(7)+o&7)&&5!==a||2!==d?u:-u,r[1].push(c),2*n===s+1&&(n=1-n),2*o===c+1&&(o=1-o),e.iushrn(1),t.iushrn(1)}return r},a.cachedProperty=function cachedProperty(e,t,r){var a="_"+t;e.prototype[t]=function cachedProperty(){return void 0!==this[a]?this[a]:this[a]=r.call(this)}},a.parseBytes=function parseBytes(e){return"string"==typeof e?a.toArray(e,"hex"):e},a.intFromLE=function intFromLE(e){return new n(e,"hex","le")}},function(e,t,r){"use strict";var a=r(4).Buffer,n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.baToJSON=t.addHexPrefix=t.toUnsigned=t.fromSigned=t.bufferToHex=t.bufferToInt=t.toBuffer=t.unpadHexString=t.unpadArray=t.unpadBuffer=t.setLengthRight=t.setLengthLeft=t.zeros=void 0;var o=n(r(130)),s=r(186),c=r(346);t.zeros=function(e){return a.allocUnsafe(e).fill(0)};var setLength=function(e,r,a){var n=t.zeros(r);return a?e.length0&&"0"===t.toString();)t=(e=e.slice(1))[0];return e};t.unpadBuffer=function(e){return c.assertIsBuffer(e),stripZeros(e)},t.unpadArray=function(e){return c.assertIsArray(e),stripZeros(e)},t.unpadHexString=function(e){return c.assertIsHexString(e),e=s.stripHexPrefix(e),stripZeros(e)},t.toBuffer=function(e){if(null==e)return a.allocUnsafe(0);if(a.isBuffer(e))return a.from(e);if(Array.isArray(e)||e instanceof Uint8Array)return a.from(e);if("string"==typeof e){if(!s.isHexString(e))throw new Error("Cannot convert string to buffer. toBuffer only supports 0x-prefixed hex strings and this string was given: "+e);return a.from(s.padToEven(s.stripHexPrefix(e)),"hex")}if("number"==typeof e)return s.intToBuffer(e);if(o.default.isBN(e))return e.toArrayLike(a);if(e.toArray)return a.from(e.toArray());if(e.toBuffer)return a.from(e.toBuffer());throw new Error("invalid type")},t.bufferToInt=function(e){return new o.default(t.toBuffer(e)).toNumber()},t.bufferToHex=function(e){return"0x"+(e=t.toBuffer(e)).toString("hex")},t.fromSigned=function(e){return new o.default(e).fromTwos(256)},t.toUnsigned=function(e){return a.from(e.toTwos(256).toArray())},t.addHexPrefix=function(e){return"string"!=typeof e||s.isHexPrefixed(e)?e:"0x"+e},t.baToJSON=function(e){if(a.isBuffer(e))return"0x"+e.toString("hex");if(e instanceof Array){for(var r=[],n=0;n{"use strict";var a=t,n=r(98),o=r(161),s=r(523);a.assert=o,a.toArray=s.toArray,a.zero2=s.zero2,a.toHex=s.toHex,a.encode=s.encode,a.getNAF=function getNAF(e,t,r){var a=new Array(Math.max(e.bitLength(),r)+1);a.fill(0);for(var n=1<(n>>1)-1?(n>>1)-d:d,o.isubn(c)):c=0,a[s]=c,o.iushrn(1)}return a},a.getJSF=function getJSF(e,t){var r=[[],[]];e=e.clone(),t=t.clone();for(var a,n=0,o=0;e.cmpn(-n)>0||t.cmpn(-o)>0;){var s,c,d=e.andln(3)+n&3,u=t.andln(3)+o&3;3===d&&(d=-1),3===u&&(u=-1),s=0==(1&d)?0:3!==(a=e.andln(7)+n&7)&&5!==a||2!==u?d:-d,r[0].push(s),c=0==(1&u)?0:3!==(a=t.andln(7)+o&7)&&5!==a||2!==d?u:-u,r[1].push(c),2*n===s+1&&(n=1-n),2*o===c+1&&(o=1-o),e.iushrn(1),t.iushrn(1)}return r},a.cachedProperty=function cachedProperty(e,t,r){var a="_"+t;e.prototype[t]=function cachedProperty(){return void 0!==this[a]?this[a]:this[a]=r.call(this)}},a.parseBytes=function parseBytes(e){return"string"==typeof e?a.toArray(e,"hex"):e},a.intFromLE=function intFromLE(e){return new n(e,"hex","le")}},(e,t,r)=>{"use strict";var a=t,n=r(99),o=r(163),s=r(530);a.assert=o,a.toArray=s.toArray,a.zero2=s.zero2,a.toHex=s.toHex,a.encode=s.encode,a.getNAF=function getNAF(e,t,r){var a=new Array(Math.max(e.bitLength(),r)+1);a.fill(0);for(var n=1<(n>>1)-1?(n>>1)-d:d,o.isubn(c)):c=0,a[s]=c,o.iushrn(1)}return a},a.getJSF=function getJSF(e,t){var r=[[],[]];e=e.clone(),t=t.clone();for(var a,n=0,o=0;e.cmpn(-n)>0||t.cmpn(-o)>0;){var s,c,d=e.andln(3)+n&3,u=t.andln(3)+o&3;3===d&&(d=-1),3===u&&(u=-1),s=0==(1&d)?0:3!==(a=e.andln(7)+n&7)&&5!==a||2!==u?d:-d,r[0].push(s),c=0==(1&u)?0:3!==(a=t.andln(7)+o&7)&&5!==a||2!==d?u:-u,r[1].push(c),2*n===s+1&&(n=1-n),2*o===c+1&&(o=1-o),e.iushrn(1),t.iushrn(1)}return r},a.cachedProperty=function cachedProperty(e,t,r){var a="_"+t;e.prototype[t]=function cachedProperty(){return void 0!==this[a]?this[a]:this[a]=r.call(this)}},a.parseBytes=function parseBytes(e){return"string"==typeof e?a.toArray(e,"hex"):e},a.intFromLE=function intFromLE(e){return new n(e,"hex","le")}},function(e,t,r){"use strict";var a=r(2).Buffer,n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.baToJSON=t.addHexPrefix=t.toUnsigned=t.fromSigned=t.bufferToHex=t.bufferToInt=t.toBuffer=t.unpadHexString=t.unpadArray=t.unpadBuffer=t.setLengthRight=t.setLengthLeft=t.zeros=void 0;var o=n(r(134)),s=r(195),c=r(357);t.zeros=function(e){return a.allocUnsafe(e).fill(0)};var setLength=function(e,r,a){var n=t.zeros(r);return a?e.length0&&"0"===t.toString();)t=(e=e.slice(1))[0];return e};t.unpadBuffer=function(e){return c.assertIsBuffer(e),stripZeros(e)},t.unpadArray=function(e){return c.assertIsArray(e),stripZeros(e)},t.unpadHexString=function(e){return c.assertIsHexString(e),e=s.stripHexPrefix(e),stripZeros(e)},t.toBuffer=function(e){if(null==e)return a.allocUnsafe(0);if(a.isBuffer(e))return a.from(e);if(Array.isArray(e)||e instanceof Uint8Array)return a.from(e);if("string"==typeof e){if(!s.isHexString(e))throw new Error("Cannot convert string to buffer. toBuffer only supports 0x-prefixed hex strings and this string was given: "+e);return a.from(s.padToEven(s.stripHexPrefix(e)),"hex")}if("number"==typeof e)return s.intToBuffer(e);if(o.default.isBN(e))return e.toArrayLike(a);if(e.toArray)return a.from(e.toArray());if(e.toBuffer)return a.from(e.toBuffer());throw new Error("invalid type")},t.bufferToInt=function(e){return new o.default(t.toBuffer(e)).toNumber()},t.bufferToHex=function(e){return"0x"+(e=t.toBuffer(e)).toString("hex")},t.fromSigned=function(e){return new o.default(e).fromTwos(256)},t.toUnsigned=function(e){return a.from(e.toTwos(256).toArray())},t.addHexPrefix=function(e){return"string"!=typeof e||s.isHexPrefixed(e)?e:"0x"+e},t.baToJSON=function(e){if(a.isBuffer(e))return"0x"+e.toString("hex");if(e instanceof Array){for(var r=[],n=0;n{"use strict";var a=t,n=r(100),o=r(164),s=r(549);a.assert=o,a.toArray=s.toArray,a.zero2=s.zero2,a.toHex=s.toHex,a.encode=s.encode,a.getNAF=function getNAF(e,t,r){var a=new Array(Math.max(e.bitLength(),r)+1);a.fill(0);for(var n=1<(n>>1)-1?(n>>1)-d:d,o.isubn(c)):c=0,a[s]=c,o.iushrn(1)}return a},a.getJSF=function getJSF(e,t){var r=[[],[]];e=e.clone(),t=t.clone();for(var a,n=0,o=0;e.cmpn(-n)>0||t.cmpn(-o)>0;){var s,c,d=e.andln(3)+n&3,u=t.andln(3)+o&3;3===d&&(d=-1),3===u&&(u=-1),s=0==(1&d)?0:3!==(a=e.andln(7)+n&7)&&5!==a||2!==u?d:-d,r[0].push(s),c=0==(1&u)?0:3!==(a=t.andln(7)+o&7)&&5!==a||2!==d?u:-u,r[1].push(c),2*n===s+1&&(n=1-n),2*o===c+1&&(o=1-o),e.iushrn(1),t.iushrn(1)}return r},a.cachedProperty=function cachedProperty(e,t,r){var a="_"+t;e.prototype[t]=function cachedProperty(){return void 0!==this[a]?this[a]:this[a]=r.call(this)}},a.parseBytes=function parseBytes(e){return"string"==typeof e?a.toArray(e,"hex"):e},a.intFromLE=function intFromLE(e){return new n(e,"hex","le")}},function(e,t,r){"use strict";var a=r(0).Buffer,n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.baToJSON=t.addHexPrefix=t.toUnsigned=t.fromSigned=t.bufferToHex=t.bufferToInt=t.toBuffer=t.unpadHexString=t.unpadArray=t.unpadBuffer=t.setLengthRight=t.setLengthLeft=t.zeros=void 0;var o=n(r(48)),s=r(62),c=r(366);t.zeros=function(e){return a.allocUnsafe(e).fill(0)};var setLength=function(e,r,a){var n=t.zeros(r);return a?e.length0&&"0"===t.toString();)t=(e=e.slice(1))[0];return e};t.unpadBuffer=function(e){return c.assertIsBuffer(e),stripZeros(e)},t.unpadArray=function(e){return c.assertIsArray(e),stripZeros(e)},t.unpadHexString=function(e){return c.assertIsHexString(e),e=s.stripHexPrefix(e),stripZeros(e)},t.toBuffer=function(e){if(null==e)return a.allocUnsafe(0);if(a.isBuffer(e))return a.from(e);if(Array.isArray(e)||e instanceof Uint8Array)return a.from(e);if("string"==typeof e){if(!s.isHexString(e))throw new Error("Cannot convert string to buffer. toBuffer only supports 0x-prefixed hex strings and this string was given: "+e);return a.from(s.padToEven(s.stripHexPrefix(e)),"hex")}if("number"==typeof e)return s.intToBuffer(e);if(o.default.isBN(e))return e.toArrayLike(a);if(e.toArray)return a.from(e.toArray());if(e.toBuffer)return a.from(e.toBuffer());throw new Error("invalid type")},t.bufferToInt=function(e){return new o.default(t.toBuffer(e)).toNumber()},t.bufferToHex=function(e){return"0x"+(e=t.toBuffer(e)).toString("hex")},t.fromSigned=function(e){return new o.default(e).fromTwos(256)},t.toUnsigned=function(e){return a.from(e.toTwos(256).toArray())},t.addHexPrefix=function(e){return"string"!=typeof e||s.isHexPrefixed(e)?e:"0x"+e},t.baToJSON=function(e){if(a.isBuffer(e))return"0x"+e.toString("hex");if(e instanceof Array){for(var r=[],n=0;n0&&"0"===t.toString();)t=(e=e.slice(1))[0];return e};t.unpadBuffer=function(e){return c.assertIsBuffer(e),stripZeros(e)},t.unpadArray=function(e){return c.assertIsArray(e),stripZeros(e)},t.unpadHexString=function(e){return c.assertIsHexString(e),e=s.stripHexPrefix(e),stripZeros(e)},t.toBuffer=function(e){if(null==e)return a.allocUnsafe(0);if(a.isBuffer(e))return a.from(e);if(Array.isArray(e)||e instanceof Uint8Array)return a.from(e);if("string"==typeof e){if(!s.isHexString(e))throw new Error("Cannot convert string to buffer. toBuffer only supports 0x-prefixed hex strings and this string was given: "+e);return a.from(s.padToEven(s.stripHexPrefix(e)),"hex")}if("number"==typeof e)return s.intToBuffer(e);if(o.default.isBN(e))return e.toArrayLike(a);if(e.toArray)return a.from(e.toArray());if(e.toBuffer)return a.from(e.toBuffer());throw new Error("invalid type")},t.bufferToInt=function(e){return new o.default(t.toBuffer(e)).toNumber()},t.bufferToHex=function(e){return"0x"+(e=t.toBuffer(e)).toString("hex")},t.fromSigned=function(e){return new o.default(e).fromTwos(256)},t.toUnsigned=function(e){return a.from(e.toTwos(256).toArray())},t.addHexPrefix=function(e){return"string"!=typeof e||s.isHexPrefixed(e)?e:"0x"+e},t.baToJSON=function(e){if(a.isBuffer(e))return"0x"+e.toString("hex");if(e instanceof Array){for(var r=[],n=0;n0&&n[n.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!n||o[1]>n[0]&&o[1]=e.length&&(e=void 0),{value:e&&e[a++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},s=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var a,n,o=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(a=o.next()).done;)s.push(a.value)}catch(e){n={error:e}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return s},c=this&&this.__spread||function(){for(var e=[],t=0;t1},Blockchain.prototype.cliqueSaveGenesisSigners=function(e){return a(this,void 0,void 0,(function(){var t;return n(this,(function(r){switch(r.label){case 0:return t=[new l.BN(0),e.header.cliqueEpochTransitionSigners()],[4,this.cliqueUpdateSignerStates(t)];case 1:return r.sent(),v("[Block 0] Genesis block -> update signer states"),[4,this.cliqueUpdateVotes()];case 2:return r.sent(),[2]}}))}))},Blockchain.prototype.cliqueUpdateSignerStates=function(e){var t;return a(this,void 0,void 0,(function(){var r,a,s,c,d,u,h,b,g,p,B,y,x,C;return n(this,(function(n){switch(n.label){case 0:return r=[],e&&this._cliqueLatestSignerStates.push(e),a=this.CLIQUE_SIGNER_HISTORY_BLOCK_LIMIT,s=this._cliqueLatestBlockSigners,(c=null===(t=s[s.length-1])||void 0===t?void 0:t[0])&&(d=c.subn(a),u=this._cliqueLatestSignerStates,h=u[u.length-1],this._cliqueLatestSignerStates=u.filter((function(e){return e[0].gte(d)})),0===this._cliqueLatestSignerStates.length&&this._cliqueLatestSignerStates.push(h)),b=this._cliqueLatestSignerStates.map((function(e){return[e[0].toBuffer(),e[1].map((function(e){return e.toBuffer()}))]})),r.push(m.DBOp.set(I.DBTarget.CliqueSignerStates,l.rlp.encode(b))),[4,this.dbManager.batch(r)];case 1:n.sent(),g=0;try{for(p=o(this.cliqueActiveSigners()),B=p.next();!B.done;B=p.next())y=B.value,v("Clique signer ["+g+"]: "+y),g++}catch(e){x={error:e}}finally{try{B&&!B.done&&(C=p.return)&&C.call(p)}finally{if(x)throw x.error}}return[2]}}))}))},Blockchain.prototype.cliqueUpdateVotes=function(e){var t;return a(this,void 0,void 0,(function(){var r,a,s,c,d,u,h,b,g,p,B,x,C,Q,w;return n(this,(function(_){switch(_.label){case 0:if(!e||e.coinbase.isZero())return[3,4];r=e.cliqueSigner(),a=e.coinbase,s=e.nonce,c=[e.number,[r,a,s]],d=function(t){var d,h,b,g,p,B,m,I,x,C,Q,w,_,k,N,D,U,G,T,L,P;return n(this,(function(n){switch(n.label){case 0:d=e.number.sub(e.number.mod(new l.BN(u._common.consensusConfig().epoch))),h=u.cliqueSignerLimit(),b=u.cliqueActiveSigners(),g=!1,p=u._cliqueLatestVotes.filter((function(e){return e[0].gte(d)&&!e[1][0].equals(r)&&e[1][1].equals(a)&&e[1][2].equals(y.CLIQUE_NONCE_AUTH)})),B=[],m=function(e){0===B.filter((function(t){return t.equals(e[1][0])})).length&&B.push(e[1][0])};try{for(G=void 0,I=o(p),x=I.next();!x.done;x=I.next())N=x.value,m(N)}catch(e){G={error:e}}finally{try{x&&!x.done&&(T=I.return)&&T.call(I)}finally{if(G)throw G.error}}C=B.length,2===t&&s.equals(y.CLIQUE_NONCE_AUTH)&&(C+=1),C>=h&&(g=!0,b.push(a),b.sort((function(e,t){return e.toBuffer().compare(t.toBuffer())})),u._cliqueLatestVotes=u._cliqueLatestVotes.filter((function(e){return!e[1][1].equals(a)})),v("[Block "+e.number.toNumber()+"] Clique majority consensus (AUTH "+a+")")),p=u._cliqueLatestVotes.filter((function(e){return e[0].gte(d)&&!e[1][0].equals(r)&&e[1][1].equals(a)&&e[1][2].equals(y.CLIQUE_NONCE_DROP)})),Q=[],w=function(e){0===Q.filter((function(t){return t.equals(e[1][0])})).length&&Q.push(e[1][0])};try{for(L=void 0,_=o(p),k=_.next();!k.done;k=_.next())N=k.value,w(N)}catch(e){L={error:e}}finally{try{k&&!k.done&&(P=_.return)&&P.call(_)}finally{if(L)throw L.error}}return D=Q.length,2===t&&s.equals(y.CLIQUE_NONCE_DROP)&&(D+=1),D>=h&&(g=!0,b=b.filter((function(e){return!e.equals(a)})),u._cliqueLatestVotes=u._cliqueLatestVotes.filter((function(e){return!e[1][0].equals(a)&&!e[1][1].equals(a)})),v("[Block "+e.number.toNumber()+"] Clique majority consensus (DROP "+a+")")),1===t&&(u._cliqueLatestVotes.push(c),v("[Block "+e.number.toNumber()+"] New clique vote: "+r+" -> "+a+" "+(s.equals(y.CLIQUE_NONCE_AUTH)?"AUTH":"DROP"))),g?(v(1===t?"[Block "+e.number.toNumber()+"] Clique majority consensus on existing votes -> update signer states":"[Block "+e.number.toNumber()+"] Clique majority consensus on new vote -> update signer states"),U=[e.number,b],[4,u.cliqueUpdateSignerStates(U)]):[3,2];case 1:return n.sent(),[2,{value:void 0}];case 2:return[2]}}))},u=this,h=1,_.label=1;case 1:return h<=2?[5,d(h)]:[3,4];case 2:if("object"==typeof(b=_.sent()))return[2,b.value];_.label=3;case 3:return h++,[3,1];case 4:return g=this.CLIQUE_SIGNER_HISTORY_BLOCK_LIMIT,p=this._cliqueLatestBlockSigners,(B=null===(t=p[p.length-1])||void 0===t?void 0:t[0])&&(x=B.sub(B.mod(new l.BN(this._common.consensusConfig().epoch))),C=x.subn(g),this._cliqueLatestVotes=this._cliqueLatestVotes.filter((function(e){return e[0].gte(C)}))),Q=[],w=this._cliqueLatestVotes.map((function(e){return[e[0].toBuffer(),[e[1][0].toBuffer(),e[1][1].toBuffer(),e[1][2]]]})),Q.push(m.DBOp.set(I.DBTarget.CliqueVotes,l.rlp.encode(w))),[4,this.dbManager.batch(Q)];case 5:return _.sent(),[2]}}))}))},Blockchain.prototype.cliqueUpdateLatestBlockSigners=function(e){return a(this,void 0,void 0,(function(){var t,r,a,o,s;return n(this,(function(n){switch(n.label){case 0:if(t=[],e){if(e.isGenesis())return[2];r=[e.number,e.cliqueSigner()],this._cliqueLatestBlockSigners.push(r),a=this._cliqueLatestBlockSigners.length,o=this.cliqueSignerLimit(),a>o&&(this._cliqueLatestBlockSigners=this._cliqueLatestBlockSigners.slice(a-o,a))}return s=this._cliqueLatestBlockSigners.map((function(e){return[e[0].toBuffer(),e[1].toBuffer()]})),t.push(m.DBOp.set(I.DBTarget.CliqueBlockSigners,l.rlp.encode(s))),[4,this.dbManager.batch(t)];case 1:return n.sent(),[2]}}))}))},Blockchain.prototype.cliqueActiveSigners=function(){this._requireClique();var e=this._cliqueLatestSignerStates;return c(e[e.length-1][1])},Blockchain.prototype.cliqueSignerLimit=function(){return Math.floor(this.cliqueActiveSigners().length/2)+1},Blockchain.prototype.getIteratorHead=function(e){return void 0===e&&(e="vm"),a(this,void 0,void 0,(function(){var t=this;return n(this,(function(r){switch(r.label){case 0:return[4,this.initAndLock((function(){return a(t,void 0,void 0,(function(){var t;return n(this,(function(r){switch(r.label){case 0:if(!(t=this._heads[e]||this._genesis))throw new Error("No head found.");return[4,this._getBlock(t)];case 1:return[2,r.sent()]}}))}))}))];case 1:return[2,r.sent()]}}))}))},Blockchain.prototype.getHead=function(e){return void 0===e&&(e="vm"),a(this,void 0,void 0,(function(){var t=this;return n(this,(function(r){switch(r.label){case 0:return[4,this.initAndLock((function(){return a(t,void 0,void 0,(function(){var t;return n(this,(function(r){switch(r.label){case 0:if(!(t=this._heads[e]||this._headBlockHash))throw new Error("No head found.");return[4,this._getBlock(t)];case 1:return[2,r.sent()]}}))}))}))];case 1:return[2,r.sent()]}}))}))},Blockchain.prototype.getLatestHeader=function(){return a(this,void 0,void 0,(function(){var e=this;return n(this,(function(t){switch(t.label){case 0:return[4,this.initAndLock((function(){return a(e,void 0,void 0,(function(){return n(this,(function(e){switch(e.label){case 0:if(!this._headHeaderHash)throw new Error("No head header set");return[4,this._getBlock(this._headHeaderHash)];case 1:return[2,e.sent().header]}}))}))}))];case 1:return[2,t.sent()]}}))}))},Blockchain.prototype.getLatestBlock=function(){return a(this,void 0,void 0,(function(){var e=this;return n(this,(function(t){return[2,this.initAndLock((function(){return a(e,void 0,void 0,(function(){return n(this,(function(e){if(!this._headBlockHash)throw new Error("No head block set");return[2,this._getBlock(this._headBlockHash)]}))}))}))]}))}))},Blockchain.prototype.putBlocks=function(e){return a(this,void 0,void 0,(function(){var t;return n(this,(function(r){switch(r.label){case 0:return[4,this.initPromise];case 1:r.sent(),t=0,r.label=2;case 2:return t=a))return[3,6];o=void 0,n.label=2;case 2:return n.trys.push([2,4,,5]),[4,this.dbManager.hashToNumber(e[r])];case 3:return o=n.sent(),[3,5];case 4:if("NotFoundError"!==(s=n.sent()).type)throw s;return[3,5];case 5:return o?a=r+1:t=r-1,r=Math.floor((a+t)/2),[3,1];case 6:return[2,e.slice(a)]}}))}))}))];case 1:return[2,r.sent()]}}))}))},Blockchain.prototype.delBlock=function(e){return a(this,void 0,void 0,(function(){return n(this,(function(t){switch(t.label){case 0:return[4,this.initPromise];case 1:return t.sent(),[4,this._delBlock(e)];case 2:return t.sent(),[2]}}))}))},Blockchain.prototype._delBlock=function(e){return a(this,void 0,void 0,(function(){var t,r,a,o,s,c,d;return n(this,(function(n){switch(n.label){case 0:return t=[],[4,this._getHeader(e)];case 1:return r=n.sent(),o=(a=r).number,s=a.parentHash,[4,this.safeNumberToHash(o)];case 2:return c=n.sent(),d=!!c&&c.equals(e),[4,this._delChild(e,o,d?s:null,t)];case 3:return n.sent(),d?[4,this._deleteCanonicalChainReferences(o,s,t)]:[3,5];case 4:n.sent(),n.label=5;case 5:return[4,this.dbManager.batch(t)];case 6:return n.sent(),[2]}}))}))},Blockchain.prototype._delChild=function(e,t,r,o){var s,c;return a(this,void 0,void 0,(function(){var a,d;return n(this,(function(n){switch(n.label){case 0:if(o.push(m.DBOp.del(I.DBTarget.Header,{blockHash:e,blockNumber:t})),o.push(m.DBOp.del(I.DBTarget.Body,{blockHash:e,blockNumber:t})),o.push(m.DBOp.del(I.DBTarget.HashToNumber,{blockHash:e})),o.push(m.DBOp.del(I.DBTarget.TotalDifficulty,{blockHash:e,blockNumber:t})),!r)return[2];(null===(s=this._headHeaderHash)||void 0===s?void 0:s.equals(e))&&(this._headHeaderHash=r),(null===(c=this._headBlockHash)||void 0===c?void 0:c.equals(e))&&(this._headBlockHash=r),n.label=1;case 1:return n.trys.push([1,4,,5]),[4,this._getCanonicalHeader(t.addn(1))];case 2:return a=n.sent(),[4,this._delChild(a.hash(),a.number,r,o)];case 3:return n.sent(),[3,5];case 4:if("NotFoundError"!==(d=n.sent()).type)throw d;return[3,5];case 5:return[2]}}))}))},Blockchain.prototype.iterator=function(e,t,r){return a(this,void 0,void 0,(function(){return n(this,(function(a){return[2,this._iterator(e,t,r)]}))}))},Blockchain.prototype._iterator=function(e,t,r){return a(this,void 0,void 0,(function(){var o=this;return n(this,(function(s){switch(s.label){case 0:return[4,this.initAndLock((function(){return a(o,void 0,void 0,(function(){var a,o,s,c,d,u,h,l;return n(this,(function(n){switch(n.label){case 0:if(!(a=this._heads[e]||this._genesis))return[2,0];if(r&&r<0)throw"If maxBlocks is provided, it has to be a non-negative number";return[4,this.dbManager.hashToNumber(a)];case 1:s=n.sent(),c=s.addn(1),d=0,n.label=2;case 2:if(r===d)return[3,8];n.label=3;case 3:return n.trys.push([3,6,,7]),[4,this._getBlock(c)];case 4:return u=n.sent(),this._heads[e]=u.hash(),h=!!o&&o.hash().equals(u.header.parentHash),o=u,[4,t(u,h)];case 5:return n.sent(),c.iaddn(1),d++,[3,7];case 6:if("NotFoundError"===(l=n.sent()).type)return[3,8];throw l;case 7:return[3,2];case 8:return[4,this._saveHeads()];case 9:return n.sent(),[2,d]}}))}))}))];case 1:return[2,s.sent()]}}))}))},Blockchain.prototype.setIteratorHead=function(e,t){return a(this,void 0,void 0,(function(){return n(this,(function(r){switch(r.label){case 0:return[4,this.setHead(e,t)];case 1:return[2,r.sent()]}}))}))},Blockchain.prototype.setHead=function(e,t){return a(this,void 0,void 0,(function(){var r=this;return n(this,(function(o){switch(o.label){case 0:return[4,this.initAndLock((function(){return a(r,void 0,void 0,(function(){return n(this,(function(r){switch(r.label){case 0:return this._heads[e]=t,[4,this._saveHeads()];case 1:return r.sent(),[2]}}))}))}))];case 1:return o.sent(),[2]}}))}))},Blockchain.prototype._findAncient=function(e){return a(this,void 0,void 0,(function(){var t;return n(this,(function(r){switch(r.label){case 0:if(!this._headHeaderHash)throw new Error("No head header set");return[4,this._getBlock(this._headHeaderHash)];case 1:return(t=r.sent().header).number.gt(e.number)?[4,this._getCanonicalHeader(e.number)]:[3,3];case 2:return t=r.sent(),[3,5];case 3:return t.number.eq(e.number)||!e.number.gtn(0)?[3,5]:[4,this._getHeader(e.parentHash,e.number.subn(1))];case 4:return e=r.sent(),[3,3];case 5:if(!t.number.eq(e.number))throw new Error("Failed to find ancient header");r.label=6;case 6:return t.hash().equals(e.hash())||!t.number.gtn(0)?[3,9]:[4,this._getCanonicalHeader(t.number.subn(1))];case 7:return t=r.sent(),[4,this._getHeader(e.parentHash,e.number.subn(1))];case 8:return e=r.sent(),[3,6];case 9:if(!t.hash().equals(e.hash()))throw new Error("Failed to find ancient header");return[2,t]}}))}))},Blockchain.prototype._cliqueBuildSnapshots=function(e){return a(this,void 0,void 0,(function(){return n(this,(function(t){switch(t.label){case 0:return e.cliqueIsEpochTransition()?[3,2]:[4,this.cliqueUpdateVotes(e)];case 1:t.sent(),t.label=2;case 2:return[4,this.cliqueUpdateLatestBlockSigners(e)];case 3:return t.sent(),[2]}}))}))},Blockchain.prototype._cliqueDeleteSnapshots=function(e){return a(this,void 0,void 0,(function(){return n(this,(function(t){switch(t.label){case 0:return this._cliqueLatestSignerStates=this._cliqueLatestSignerStates.filter((function(t){return t[0].lte(e)})),[4,this.cliqueUpdateSignerStates()];case 1:return t.sent(),this._cliqueLatestVotes=this._cliqueLatestVotes.filter((function(t){return t[0].lte(e)})),[4,this.cliqueUpdateVotes()];case 2:return t.sent(),this._cliqueLatestBlockSigners=this._cliqueLatestBlockSigners.filter((function(t){return t[0].lte(e)})),[4,this.cliqueUpdateLatestBlockSigners()];case 3:return t.sent(),[2]}}))}))},Blockchain.prototype._deleteCanonicalChainReferences=function(e,t,r){var o;return a(this,void 0,void 0,(function(){var a,s=this;return n(this,(function(n){switch(n.label){case 0:return e=e.clone(),[4,this.safeNumberToHash(e)];case 1:a=n.sent(),n.label=2;case 2:return a?(r.push(m.DBOp.del(I.DBTarget.NumberToHash,{blockNumber:e})),Object.keys(this._heads).forEach((function(e){s._heads[e].equals(a)&&(s._heads[e]=t)})),(null===(o=this._headBlockHash)||void 0===o?void 0:o.equals(a))&&(this._headBlockHash=t),e.iaddn(1),[4,this.safeNumberToHash(e)]):[3,4];case 3:return a=n.sent(),[3,2];case 4:return[2]}}))}))},Blockchain.prototype._rebuildCanonical=function(e,t){var r;return a(this,void 0,void 0,(function(){var o,s,c,d,u,h,l,b,g,p=this;return n(this,(function(B){switch(B.label){case 0:o=e.number.clone(),s=e.hash(),c=!1,d=[],u=!1,h=function(){return a(p,void 0,void 0,(function(){return n(this,(function(t){switch(t.label){case 0:return[4,this.safeNumberToHash(o)];case 1:return c=t.sent(),s=e.hash(),[2,!c||!s.equals(c)]}}))}))},B.label=1;case 1:return[4,h()];case 2:if(!B.sent())return[3,7];if(l=e.hash(),b=e.number,m.DBSaveLookups(l,b).map((function(e){t.push(e)})),b.isZero())return[3,7];Object.keys(this._heads).forEach((function(e){c&&p._heads[e].equals(c)&&d.push(e)})),c&&(null===(r=this._headBlockHash)||void 0===r?void 0:r.equals(c))&&(u=!0),o.isubn(1),B.label=3;case 3:return B.trys.push([3,5,,6]),[4,this._getHeader(e.parentHash,o)];case 4:return e=B.sent(),[3,6];case 5:if(g=B.sent(),d=[],"NotFoundError"!==g.type)throw g;return[3,7];case 6:return[3,1];case 7:return d.forEach((function(e){p._heads[e]=s})),u&&(this._headBlockHash=s),[2]}}))}))},Blockchain.prototype._saveHeadOps=function(){return[m.DBOp.set(I.DBTarget.Heads,this._heads),m.DBOp.set(I.DBTarget.HeadHeader,this._headHeaderHash),m.DBOp.set(I.DBTarget.HeadBlock,this._headBlockHash)]},Blockchain.prototype._saveHeads=function(){return a(this,void 0,void 0,(function(){return n(this,(function(e){return[2,this.dbManager.batch(this._saveHeadOps())]}))}))},Blockchain.prototype._getHeader=function(e,t){return a(this,void 0,void 0,(function(){return n(this,(function(r){switch(r.label){case 0:return t?[3,2]:[4,this.dbManager.hashToNumber(e)];case 1:t=r.sent(),r.label=2;case 2:return[2,this.dbManager.getHeader(e,t)]}}))}))},Blockchain.prototype._getCanonicalHeader=function(e){return a(this,void 0,void 0,(function(){var t;return n(this,(function(r){switch(r.label){case 0:return[4,this.dbManager.numberToHash(e)];case 1:return t=r.sent(),[2,this._getHeader(t,e)]}}))}))},Blockchain.prototype.safeNumberToHash=function(e){return a(this,void 0,void 0,(function(){var t;return n(this,(function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,this.dbManager.numberToHash(e)];case 1:return[2,r.sent()];case 2:if("NotFoundError"!==(t=r.sent()).type)throw t;return[2,!1];case 3:return[2]}}))}))},Blockchain}();t.default=C},function(e,t,r){"use strict";var a=r(1),n=r(0).Buffer,o=this&&this.__awaiter||function(e,t,r,a){return new(r||(r=Promise))((function(n,o){function fulfilled(e){try{step(a.next(e))}catch(e){o(e)}}function rejected(e){try{step(a.throw(e))}catch(e){o(e)}}function step(e){e.done?n(e.value):function adopt(e){return e instanceof r?e:new r((function(t){t(e)}))}(e.value).then(fulfilled,rejected)}step((a=a.apply(e,t||[])).next())}))},s=this&&this.__generator||function(e,t){var r,a,n,o,s={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return o={next:verb(0),throw:verb(1),return:verb(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function verb(o){return function(c){return function step(o){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,a&&(n=2&o[0]?a.return:o[0]?a.throw||((n=a.return)&&n.call(a),0):a.next)&&!(n=n.call(a,o[1])).done)return n;switch(a=0,n&&(o=[2&o[0],n.value]),o[0]){case 0:case 1:n=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,a=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(n=s.trys,(n=n.length>0&&n[n.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!n||o[1]>n[0]&&o[1]=e.length&&(e=void 0),{value:e&&e[a++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},d=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var a,n,o=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(a=o.next()).done;)s.push(a.value)}catch(e){n={error:e}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return s},u=this&&this.__spread||function(){for(var e=[],t=0;t "+x.short(r)+") for account "+e),a.codeHash=r,[4,this.putAccount(e,a)];case 3:return n.sent(),[2]}}))}))},DefaultStateManager.prototype.getContractCode=function(e){return o(this,void 0,void 0,(function(){var t,r;return s(this,(function(a){switch(a.label){case 0:return[4,this.getAccount(e)];case 1:return(t=a.sent()).isContract()?[4,this._trie.db.get(t.codeHash)]:[2,n.alloc(0)];case 2:return[2,null!=(r=a.sent())?r:n.alloc(0)]}}))}))},DefaultStateManager.prototype._lookupStorageTrie=function(e){return o(this,void 0,void 0,(function(){var t,r;return s(this,(function(a){switch(a.label){case 0:return[4,this.getAccount(e)];case 1:return t=a.sent(),(r=this._trie.copy(!1)).root=t.stateRoot,r.db.checkpoints=[],[2,r]}}))}))},DefaultStateManager.prototype._getStorageTrie=function(e){return o(this,void 0,void 0,(function(){var t,r;return s(this,(function(a){switch(a.label){case 0:return t=e.buf.toString("hex"),(r=this._storageTries[t])?[3,2]:[4,this._lookupStorageTrie(e)];case 1:r=a.sent(),a.label=2;case 2:return[2,r]}}))}))},DefaultStateManager.prototype.getContractStorage=function(e,t){return o(this,void 0,void 0,(function(){var r;return s(this,(function(a){switch(a.label){case 0:if(32!==t.length)throw new Error("Storage key must be 32 bytes long");return[4,this._getStorageTrie(e)];case 1:return[4,a.sent().get(t)];case 2:return r=a.sent(),[2,B.decode(r)]}}))}))},DefaultStateManager.prototype.getOriginalContractStorage=function(e,t){return o(this,void 0,void 0,(function(){var r,a,n,o;return s(this,(function(s){switch(s.label){case 0:if(32!==t.length)throw new Error("Storage key must be 32 bytes long");return r=e.buf.toString("hex"),a=t.toString("hex"),this._originalStorageCache.has(r)?n=this._originalStorageCache.get(r):(n=new Map,this._originalStorageCache.set(r,n)),n.has(a)?[2,n.get(a)]:[3,1];case 1:return[4,this.getContractStorage(e,t)];case 2:return o=s.sent(),n.set(a,o),[2,o]}}))}))},DefaultStateManager.prototype._clearOriginalStorageCache=function(){this._originalStorageCache=new Map},DefaultStateManager.prototype.clearOriginalStorageCache=function(){this._clearOriginalStorageCache()},DefaultStateManager.prototype._modifyContractStorage=function(e,t){return o(this,void 0,void 0,(function(){var r=this;return s(this,(function(a){return[2,new Promise((function(a){return o(r,void 0,void 0,(function(){var r,n=this;return s(this,(function(c){switch(c.label){case 0:return[4,this._getStorageTrie(e)];case 1:return r=c.sent(),t(r,(function(){return o(n,void 0,void 0,(function(){var t,n;return s(this,(function(o){switch(o.label){case 0:return t=e.buf.toString("hex"),this._storageTries[t]=r,(n=this._cache.get(e)).stateRoot=r.root,[4,this.putAccount(e,n)];case 1:return o.sent(),this.touchAccount(e),a(),[2]}}))}))})),[2]}}))}))}))]}))}))},DefaultStateManager.prototype.putContractStorage=function(e,t,r){return o(this,void 0,void 0,(function(){var a=this;return s(this,(function(n){switch(n.label){case 0:if(32!==t.length)throw new Error("Storage key must be 32 bytes long");if(r.length>32)throw new Error("Storage value cannot be longer than 32 bytes");return r=p.unpadBuffer(r),[4,this._modifyContractStorage(e,(function(n,c){return o(a,void 0,void 0,(function(){var a;return s(this,(function(o){switch(o.label){case 0:return r&&r.length?(a=B.encode(r),this.DEBUG&&C("Update contract storage for account "+e+" to "+x.short(r)),[4,n.put(t,a)]):[3,2];case 1:return o.sent(),[3,4];case 2:return this.DEBUG&&C("Delete contract storage for account"),[4,n.del(t)];case 3:o.sent(),o.label=4;case 4:return c(),[2]}}))}))}))];case 1:return n.sent(),[2]}}))}))},DefaultStateManager.prototype.clearContractStorage=function(e){return o(this,void 0,void 0,(function(){return s(this,(function(t){switch(t.label){case 0:return[4,this._modifyContractStorage(e,(function(e,t){e.root=e.EMPTY_TRIE_ROOT,t()}))];case 1:return t.sent(),[2]}}))}))},DefaultStateManager.prototype.checkpoint=function(){return o(this,void 0,void 0,(function(){return s(this,(function(e){return this._trie.checkpoint(),this._cache.checkpoint(),this._touchedStack.push(new l(Array.from(this._touched))),this._accessedStorage.push(new Map),this._checkpointCount++,[2]}))}))},DefaultStateManager.prototype._accessedStorageMerge=function(e,t){var r=e[e.length-1];r&&(null==t||t.forEach((function(e,t){r.get(t)||r.set(t,new l);var a=r.get(t);e.forEach((function(e){a.add(e)}))})))},DefaultStateManager.prototype.commit=function(){return o(this,void 0,void 0,(function(){var e;return s(this,(function(t){switch(t.label){case 0:return[4,this._trie.commit()];case 1:return t.sent(),this._cache.commit(),this._touchedStack.pop(),this._checkpointCount--,(e=this._accessedStorage.pop())&&this._accessedStorageMerge(this._accessedStorage,e),0!==this._checkpointCount?[3,3]:[4,this._cache.flush()];case 2:t.sent(),this._clearOriginalStorageCache(),t.label=3;case 3:return[2]}}))}))},DefaultStateManager.prototype.revert=function(){return o(this,void 0,void 0,(function(){var e,t;return s(this,(function(r){switch(r.label){case 0:return[4,this._trie.revert()];case 1:if(r.sent(),this._cache.revert(),this._storageTries={},(e=this._accessedStorage.pop())&&this._accessedStorageReverted.push(e),!(t=this._touchedStack.pop()))throw new Error("Reverting to invalid state checkpoint failed");return this._touched.has(v.ripemdPrecompileAddress)&&t.add(v.ripemdPrecompileAddress),this._touched=t,this._checkpointCount--,0!==this._checkpointCount?[3,3]:[4,this._cache.flush()];case 2:r.sent(),this._clearOriginalStorageCache(),r.label=3;case 3:return[2]}}))}))},DefaultStateManager.prototype.getStateRoot=function(){return o(this,void 0,void 0,(function(){return s(this,(function(e){switch(e.label){case 0:return[4,this._cache.flush()];case 1:return e.sent(),[2,this._trie.root]}}))}))},DefaultStateManager.prototype.setStateRoot=function(e){return o(this,void 0,void 0,(function(){return s(this,(function(t){switch(t.label){case 0:if(0!==this._checkpointCount)throw new Error("Cannot set state root with uncommitted checkpoints");return[4,this._cache.flush()];case 1:return t.sent(),e.equals(this._trie.EMPTY_TRIE_ROOT)?[3,3]:[4,this._trie.checkRoot(e)];case 2:if(!t.sent())throw new Error("State trie does not contain state root");t.label=3;case 3:return this._trie.root=e,this._cache.clear(),this._storageTries={},[2]}}))}))},DefaultStateManager.prototype.dumpStorage=function(e){return o(this,void 0,void 0,(function(){var t=this;return s(this,(function(r){return[2,new Promise((function(r,a){t._getStorageTrie(e).then((function(e){var t={},a=e.createReadStream();a.on("data",(function(e){t[e.key.toString("hex")]=e.value.toString("hex")})),a.on("end",(function(){r(t)}))})).catch((function(e){a(e)}))}))]}))}))},DefaultStateManager.prototype.hasGenesisState=function(){return o(this,void 0,void 0,(function(){var e;return s(this,(function(t){switch(t.label){case 0:return e=this._common.genesis().stateRoot,[4,this._trie.checkRoot(e)];case 1:return[2,t.sent()]}}))}))},DefaultStateManager.prototype.generateCanonicalGenesis=function(){return o(this,void 0,void 0,(function(){return s(this,(function(e){switch(e.label){case 0:if(0!==this._checkpointCount)throw new Error("Cannot create genesis state with uncommitted checkpoints");return[4,this.hasGenesisState()];case 1:return e.sent()?[3,3]:[4,this.generateGenesis(I.genesisStateByName(this._common.chainName()))];case 2:e.sent(),e.label=3;case 3:return[2]}}))}))},DefaultStateManager.prototype.generateGenesis=function(e){return o(this,void 0,void 0,(function(){var t,r,a,n,o,d,u,h,l,b;return s(this,(function(s){switch(s.label){case 0:if(0!==this._checkpointCount)throw new Error("Cannot create genesis state with uncommitted checkpoints");this.DEBUG&&C("Save genesis state into the state trie"),t=Object.keys(e),s.label=1;case 1:s.trys.push([1,6,7,8]),r=c(t),a=r.next(),s.label=2;case 2:return a.done?[3,5]:(n=a.value,o=new p.BN(p.toBuffer(e[n])),d=p.Account.fromAccountData({balance:o}),u=p.toBuffer(n),[4,this._trie.put(u,d.serialize())]);case 3:s.sent(),s.label=4;case 4:return a=r.next(),[3,2];case 5:return[3,8];case 6:return h=s.sent(),l={error:h},[3,8];case 7:try{a&&!a.done&&(b=r.return)&&b.call(r)}finally{if(l)throw l.error}return[7];case 8:return[2]}}))}))},DefaultStateManager.prototype.accountIsEmpty=function(e){return o(this,void 0,void 0,(function(){return s(this,(function(t){switch(t.label){case 0:return[4,this.getAccount(e)];case 1:return[2,t.sent().isEmpty()]}}))}))},DefaultStateManager.prototype.accountExists=function(e){return o(this,void 0,void 0,(function(){return s(this,(function(t){switch(t.label){case 0:return this._cache.lookup(e)&&!this._cache.keyIsDeleted(e)?[2,!0]:[4,this._cache._trie.get(e.buf)];case 1:return t.sent()?[2,!0]:[2,!1]}}))}))},DefaultStateManager.prototype.isWarmedAddress=function(e){for(var t=this._accessedStorage.length-1;t>=0;t--){if(this._accessedStorage[t].has(e.toString("hex")))return!0}return!1},DefaultStateManager.prototype.addWarmedAddress=function(e){var t=e.toString("hex");if(!this._accessedStorage[this._accessedStorage.length-1].get(t)){var r=new l;this._accessedStorage[this._accessedStorage.length-1].set(t,r)}},DefaultStateManager.prototype.isWarmedStorage=function(e,t){for(var r=e.toString("hex"),a=t.toString("hex"),n=this._accessedStorage.length-1;n>=0;n--){var o=this._accessedStorage[n];if(o.has(r)&&o.get(r).has(a))return!0}return!1},DefaultStateManager.prototype.addWarmedStorage=function(e,t){var r=e.toString("hex"),a=this._accessedStorage[this._accessedStorage.length-1].get(r);a||(a=new l,this._accessedStorage[this._accessedStorage.length-1].set(r,a)),a.add(t.toString("hex"))},DefaultStateManager.prototype.clearWarmedAccounts=function(){this._accessedStorage=[new Map],this._accessedStorageReverted=[new Map]},DefaultStateManager.prototype.generateAccessList=function(e,t){var r=this;void 0===e&&(e=[]),void 0===t&&(t=[]);for(var a=u(this._accessedStorage,this._accessedStorageReverted);a.length>=2;){var n=a.pop();n&&this._accessedStorageMerge(a,n)}var o=new Map(u(a[0].entries()).sort()),s=[];return o.forEach((function(a,n){var o=p.Address.fromString("0x"+n),c=v.getActivePrecompiles(r._common).find((function(e){return e.equals(o)})),d=e.find((function(e){return e.equals(o)})),u=void 0!==t.find((function(e){return e.equals(o)}))&&0===a.size;if(!c&&!d&&!u){var h={address:"0x"+n,storageKeys:Array.from(a).map((function(e){return"0x"+e})).sort()};s.push(h)}})),s},DefaultStateManager.prototype.cleanupTouchedAccounts=function(){return o(this,void 0,void 0,(function(){var e,t,r,a,o,d,u,h;return s(this,(function(s){switch(s.label){case 0:if(!this._common.gteHardfork("spuriousDragon"))return[3,8];e=Array.from(this._touched),s.label=1;case 1:s.trys.push([1,6,7,8]),t=c(e),r=t.next(),s.label=2;case 2:return r.done?[3,5]:(a=r.value,o=new p.Address(n.from(a,"hex")),[4,this.accountIsEmpty(o)]);case 3:s.sent()&&(this._cache.del(o),this.DEBUG&&C("Cleanup touched account address="+o.toString()+" (>= SpuriousDragon)")),s.label=4;case 4:return r=t.next(),[3,2];case 5:return[3,8];case 6:return d=s.sent(),u={error:d},[3,8];case 7:try{r&&!r.done&&(h=t.return)&&h.call(t)}finally{if(u)throw u.error}return[7];case 8:return this._touched.clear(),[2]}}))}))},DefaultStateManager}();t.default=Q},function(e,t,r){"use strict";var a=this&&this.__assign||function(){return(a=Object.assign||function(e){for(var t,r=1,a=arguments.length;r0&&n[n.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!n||o[1]>n[0]&&o[1]=e.length&&(e=void 0),{value:e&&e[a++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},c=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var a,n,o=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(a=o.next()).done;)s.push(a.value)}catch(e){n={error:e}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return s},d=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.BlockBuilder=void 0;var u=r(5),h=r(41),l=r(166),b=r(54),g=d(r(303)),p=r(27),B=function(){function BlockBuilder(e,t){var r,n,o,s,c,d;this.gasUsed=new u.BN(0),this.transactions=[],this.transactionResults=[],this.checkpointed=!1,this.reverted=!1,this.built=!1,this.vm=e,this.blockOpts=a(a({},t.blockOpts),{common:this.vm._common}),this.headerData=a(a({},t.headerData),{parentHash:null!==(n=null===(r=t.headerData)||void 0===r?void 0:r.parentHash)&&void 0!==n?n:t.parentBlock.hash(),number:null!==(s=null===(o=t.headerData)||void 0===o?void 0:o.number)&&void 0!==s?s:t.parentBlock.header.number.addn(1),gasLimit:null!==(d=null===(c=t.headerData)||void 0===c?void 0:c.gasLimit)&&void 0!==d?d:t.parentBlock.header.gasLimit}),this.vm._common.isActivatedEIP(1559)&&void 0===this.headerData.baseFeePerGas&&(this.headerData.baseFeePerGas=t.parentBlock.header.calcNextBaseFee())}return BlockBuilder.prototype.checkStatus=function(){if(this.built)throw new Error("Block has already been built");if(this.reverted)throw new Error("State has already been reverted")},BlockBuilder.prototype.transactionsTrie=function(){return n(this,void 0,void 0,(function(){var e,t,r,a,n,d,u,b,g;return o(this,(function(o){switch(o.label){case 0:e=new l.BaseTrie,o.label=1;case 1:o.trys.push([1,6,7,8]),t=s(this.transactions.entries()),r=t.next(),o.label=2;case 2:return r.done?[3,5]:(a=c(r.value,2),n=a[0],d=a[1],[4,e.put(h.encode(n),d.serialize())]);case 3:o.sent(),o.label=4;case 4:return r=t.next(),[3,2];case 5:return[3,8];case 6:return u=o.sent(),b={error:u},[3,8];case 7:try{r&&!r.done&&(g=t.return)&&g.call(t)}finally{if(b)throw b.error}return[7];case 8:return[2,e.root]}}))}))},BlockBuilder.prototype.bloom=function(){var e,t,r=new g.default;try{for(var a=s(this.transactionResults),n=a.next();!n.done;n=a.next()){var o=n.value;r.or(o.bloom)}}catch(t){e={error:t}}finally{try{n&&!n.done&&(t=a.return)&&t.call(a)}finally{if(e)throw e.error}}return r.bitvector},BlockBuilder.prototype.receiptTrie=function(){return n(this,void 0,void 0,(function(){var e,t,r,a,n,d,b,g,B,m,I,y;return o(this,(function(o){switch(o.label){case 0:e=new u.BN(0),t=new l.BaseTrie,o.label=1;case 1:o.trys.push([1,6,7,8]),r=s(this.transactionResults.entries()),a=r.next(),o.label=2;case 2:return a.done?[3,5]:(n=c(a.value,2),d=n[0],b=n[1],g=this.transactions[d],e.iadd(b.gasUsed),B=p.encodeReceipt(g,b.receipt),[4,t.put(h.encode(d),B)]);case 3:o.sent(),o.label=4;case 4:return a=r.next(),[3,2];case 5:return[3,8];case 6:return m=o.sent(),I={error:m},[3,8];case 7:try{a&&!a.done&&(y=r.return)&&y.call(r)}finally{if(I)throw I.error}return[7];case 8:return[2,t.root]}}))}))},BlockBuilder.prototype.rewardMiner=function(){return n(this,void 0,void 0,(function(){var e,t,r;return o(this,(function(a){switch(a.label){case 0:return e=new u.BN(this.vm._common.param("pow","minerReward")),t=p.calculateMinerReward(e,0),r=this.headerData.coinbase?new u.Address(u.toBuffer(this.headerData.coinbase)):u.Address.zero(),[4,p.rewardAccount(this.vm.stateManager,r,t)];case 1:return a.sent(),[2]}}))}))},BlockBuilder.prototype.addTransaction=function(e){return n(this,void 0,void 0,(function(){var t,r,n,s,c,d;return o(this,(function(o){switch(o.label){case 0:return this.checkStatus(),this.checkpointed?[3,2]:[4,this.vm.stateManager.checkpoint()];case 1:o.sent(),this.checkpointed=!0,o.label=2;case 2:if(t=new u.BN(u.toBuffer(this.headerData.gasLimit)),r=t.sub(this.gasUsed),e.gasLimit.gt(r))throw new Error("tx has a higher gas limit than the remaining gas in the block");return n=a(a({},this.headerData),{gasUsed:this.gasUsed}),s={header:n,transactions:this.transactions},c=b.Block.fromBlockData(s,this.blockOpts),[4,this.vm.runTx({tx:e,block:c})];case 3:return d=o.sent(),this.transactions.push(e),this.transactionResults.push(d),this.gasUsed.iadd(d.gasUsed),[2,d]}}))}))},BlockBuilder.prototype.revert=function(){return n(this,void 0,void 0,(function(){return o(this,(function(e){switch(e.label){case 0:return this.checkStatus(),this.checkpointed?[4,this.vm.stateManager.revert()]:[3,2];case 1:e.sent(),this.reverted=!0,e.label=2;case 2:return[2]}}))}))},BlockBuilder.prototype.build=function(e){var t,r,s;return n(this,void 0,void 0,(function(){var n,c,d,u,h,l,g,p,B,m,I;return o(this,(function(o){switch(o.label){case 0:return this.checkStatus(),n=this.blockOpts,"pow"!==(c=this.vm._common.consensusType())?[3,2]:[4,this.rewardMiner()];case 1:o.sent(),o.label=2;case 2:return[4,this.vm.stateManager.getStateRoot(!0)];case 3:return d=o.sent(),[4,this.transactionsTrie()];case 4:return u=o.sent(),[4,this.receiptTrie()];case 5:return h=o.sent(),l=this.bloom(),g=this.gasUsed,p=null!==(t=this.headerData.timestamp)&&void 0!==t?t:Math.round(Date.now()/1e3),B=a(a({},this.headerData),{stateRoot:d,transactionsTrie:u,receiptTrie:h,bloom:l,gasUsed:g,timestamp:p}),"pow"===c&&(B.nonce=null!==(r=null==e?void 0:e.nonce)&&void 0!==r?r:B.nonce,B.mixHash=null!==(s=null==e?void 0:e.mixHash)&&void 0!==s?s:B.mixHash),m={header:B,transactions:this.transactions},I=b.Block.fromBlockData(m,n),[4,this.vm.blockchain.putBlock(I)];case 6:return o.sent(),this.built=!0,this.checkpointed?[4,this.vm.stateManager.commit()]:[3,8];case 7:o.sent(),this.checkpointed=!1,o.label=8;case 8:return[2,I]}}))}))},BlockBuilder}();t.BlockBuilder=B,t.default=function buildBlock(e){return n(this,void 0,void 0,(function(){return o(this,(function(t){return[2,new B(this,e)]}))}))}},(e,t,r)=>{"use strict";var a=r(1179);e.exports=function Type(e){return"symbol"==typeof e?"Symbol":"bigint"==typeof e?"BigInt":a(e)}},()=>{},function(e,t,r){"use strict";var a=this&&this.__createBinding||(Object.create?function(e,t,r,a){void 0===a&&(a=r),Object.defineProperty(e,a,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,a){void 0===a&&(a=r),e[a]=t[r]}),n=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||t.hasOwnProperty(r)||a(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),t.secp256k1=t.rlp=t.BN=void 0;var o=r(332);t.secp256k1=o;var s=r(87),c=r(126);t.BN=c;var d=r(180);t.rlp=d,Object.assign(t,s),n(r(335),t),n(r(181),t),n(r(274),t),n(r(1269),t),n(r(70),t),n(r(1270),t)},(e,t,r)=>{"use strict";var a=r(3).Buffer,n=r(476),o=r(806);function padToEven(e){var t=e;if("string"!=typeof t)throw new Error("[ethjs-util] while padding to even, value must be string, is currently "+typeof t+", while padToEven.");return t.length%2&&(t="0"+t),t}function intToHex(e){return"0x"+e.toString(16)}e.exports={arrayContainsArray:function arrayContainsArray(e,t,r){if(!0!==Array.isArray(e))throw new Error("[ethjs-util] method arrayContainsArray requires input 'superset' to be an array got type '"+typeof e+"'");if(!0!==Array.isArray(t))throw new Error("[ethjs-util] method arrayContainsArray requires input 'subset' to be an array got type '"+typeof t+"'");return t[Boolean(r)?"some":"every"]((function(t){return e.indexOf(t)>=0}))},intToBuffer:function intToBuffer(e){var t=intToHex(e);return new a(padToEven(t.slice(2)),"hex")},getBinarySize:function getBinarySize(e){if("string"!=typeof e)throw new Error("[ethjs-util] while getting binary size, method getBinarySize requires input 'str' to be type String, got '"+typeof e+"'.");return a.byteLength(e,"utf8")},isHexPrefixed:n,stripHexPrefix:o,padToEven,intToHex,fromAscii:function fromAscii(e){for(var t="",r=0;r0&&n[n.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!n||o[1]>n[0]&&o[1]0&&n[n.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!n||o[1]>n[0]&&o[1]0)&&!(a=o.next()).done;)s.push(a.value)}catch(e){n={error:e}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return s},d=this&&this.__spread||function(){for(var e=[],t=0;t0)&&!(a=o.next()).done;)s.push(a.value)}catch(e){n={error:e}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return s},d=this&&this.__spread||function(){for(var e=[],t=0;t0?this._value:null},set:function(e){this._value=e},enumerable:!1,configurable:!0}),BranchNode.prototype.setBranch=function(e,t){this._branches[e]=t},BranchNode.prototype.raw=function(){return d(this._branches,[this._value])},BranchNode.prototype.serialize=function(){return u.encode(this.raw())},BranchNode.prototype.hash=function(){return h.keccak256(this.serialize())},BranchNode.prototype.getBranch=function(e){var t=this._branches[e];return null!==t&&t.length>0?t:null},BranchNode.prototype.getChildren=function(){for(var e=[],t=0;t<16;t++){var r=this._branches[t];null!==r&&r.length>0&&e.push([t,r])}return e},BranchNode}();t.BranchNode=g;var p=function(){function ExtensionNode(e,t){this._nibbles=e,this._value=t}return ExtensionNode.encodeKey=function(e){return b.addHexPrefix(e,!1)},ExtensionNode.decodeKey=function(e){return b.removeHexPrefix(e)},Object.defineProperty(ExtensionNode.prototype,"key",{get:function(){return this._nibbles.slice(0)},set:function(e){this._nibbles=e},enumerable:!1,configurable:!0}),Object.defineProperty(ExtensionNode.prototype,"value",{get:function(){return this._value},set:function(e){this._value=e},enumerable:!1,configurable:!0}),ExtensionNode.prototype.encodedKey=function(){return ExtensionNode.encodeKey(this._nibbles.slice(0))},ExtensionNode.prototype.raw=function(){return[l.nibblesToBuffer(this.encodedKey()),this._value]},ExtensionNode.prototype.serialize=function(){return u.encode(this.raw())},ExtensionNode.prototype.hash=function(){return h.keccak256(this.serialize())},ExtensionNode}();t.ExtensionNode=p;var B=function(){function LeafNode(e,t){this._nibbles=e,this._value=t}return LeafNode.encodeKey=function(e){return b.addHexPrefix(e,!0)},LeafNode.decodeKey=function(e){return b.removeHexPrefix(e)},Object.defineProperty(LeafNode.prototype,"key",{get:function(){return this._nibbles.slice(0)},set:function(e){this._nibbles=e},enumerable:!1,configurable:!0}),Object.defineProperty(LeafNode.prototype,"value",{get:function(){return this._value},set:function(e){this._value=e},enumerable:!1,configurable:!0}),LeafNode.prototype.encodedKey=function(){return LeafNode.encodeKey(this._nibbles.slice(0))},LeafNode.prototype.raw=function(){return[l.nibblesToBuffer(this.encodedKey()),this._value]},LeafNode.prototype.serialize=function(){return u.encode(this.raw())},LeafNode.prototype.hash=function(){return h.keccak256(this.serialize())},LeafNode}();function decodeRawNode(e){if(17===e.length)return g.fromArray(e);if(2===e.length){var t=l.bufferToNibbles(e[0]);return b.isTerminator(t)?new B(B.decodeKey(t),e[1]):new p(p.decodeKey(t),e[1])}throw new Error("Invalid node")}t.LeafNode=B,t.decodeRawNode=decodeRawNode,t.decodeNode=function decodeNode(e){var t=u.decode(e);if(!Array.isArray(t))throw new Error("Invalid node");return decodeRawNode(t)},t.isRawNode=function isRawNode(e){return Array.isArray(e)&&!a.isBuffer(e)}},function(e,t,r){"use strict";var a=r(0).Buffer,n=this&&this.__assign||function(){return(n=Object.assign||function(e){for(var t,r=1,a=arguments.length;r0&&n[n.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!n||o[1]>n[0]&&o[1]0)&&!(a=o.next()).done;)s.push(a.value)}catch(e){n={error:e}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return s},d=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.BlockHeader=void 0;var u=d(r(44)),h=r(5),l=r(1438),b=new h.BN(a.from("ffffffffffffff","hex")),g=function(){function BlockHeader(e,t,r,n,o,s,c,d,g,p,B,m,I,y,v,x,C){var Q;if(void 0===x&&(x={}),this._errorPostfix="",x.common)this._common=x.common.copy();else{var w="mainnet";x.initWithGenesisHeader?this._common=new u.default({chain:w,hardfork:"chainstart"}):this._common=new u.default({chain:w})}if(x.hardforkByBlockNumber&&this._common.setHardforkByBlockNumber(g.toNumber()),this._common.isActivatedEIP(1559))void 0===C&&(C=new h.BN(7));else if(C)throw new Error("A base fee for a block can only be set with EIP1559 being activated");if(x.initWithGenesisHeader&&(g=new h.BN(0),p.eq(b)&&(p=new h.BN(h.toBuffer(this._common.genesis().gasLimit))),m.isZero()&&(m=new h.BN(h.toBuffer(this._common.genesis().timestamp))),d.isZero()&&(d=new h.BN(h.toBuffer(this._common.genesis().difficulty))),0===I.length&&(I=h.toBuffer(this._common.genesis().extraData)),v.equals(h.zeros(8))&&(v=h.toBuffer(this._common.genesis().nonce)),n.equals(h.zeros(32))&&(n=h.toBuffer(this._common.genesis().stateRoot))),this.parentHash=e,this.uncleHash=t,this.coinbase=r,this.stateRoot=n,this.transactionsTrie=o,this.receiptTrie=s,this.bloom=c,this.difficulty=d,this.number=g,this.gasLimit=p,this.gasUsed=B,this.timestamp=m,this.extraData=I,this.mixHash=y,this.nonce=v,this.baseFeePerGas=C,this._validateHeaderFields(),this._checkDAOExtraData(),x.calcDifficultyFromHeader&&(this.difficulty=this.canonicalDifficulty(x.calcDifficultyFromHeader)),x.cliqueSigner){var _=l.CLIQUE_EXTRA_VANITY+l.CLIQUE_EXTRA_SEAL;if(this.extraData.length<_){var k=_-this.extraData.length;this.extraData=a.concat([this.extraData,a.alloc(k)])}this.extraData=this.cliqueSealBlock(x.cliqueSigner)}this._errorPostfix="block number="+this.number.toNumber()+" hash="+this.hash().toString("hex"),(null===(Q=null==x?void 0:x.freeze)||void 0===Q||Q)&&Object.freeze(this)}return BlockHeader.fromHeaderData=function(e,t){void 0===e&&(e={}),void 0===t&&(t={});var r=e.parentHash,n=e.uncleHash,o=e.coinbase,s=e.stateRoot,c=e.transactionsTrie,d=e.receiptTrie,u=e.bloom,l=e.difficulty,g=e.number,p=e.gasLimit,B=e.gasUsed,m=e.timestamp,I=e.extraData,y=e.mixHash,v=e.nonce,x=e.baseFeePerGas;return new BlockHeader(r?h.toBuffer(r):h.zeros(32),n?h.toBuffer(n):h.KECCAK256_RLP_ARRAY,o?new h.Address(h.toBuffer(o)):h.Address.zero(),s?h.toBuffer(s):h.zeros(32),c?h.toBuffer(c):h.KECCAK256_RLP,d?h.toBuffer(d):h.KECCAK256_RLP,u?h.toBuffer(u):h.zeros(256),l?new h.BN(h.toBuffer(l)):new h.BN(0),g?new h.BN(h.toBuffer(g)):new h.BN(0),p?new h.BN(h.toBuffer(p)):b,B?new h.BN(h.toBuffer(B)):new h.BN(0),m?new h.BN(h.toBuffer(m)):new h.BN(0),I?h.toBuffer(I):a.from([]),y?h.toBuffer(y):h.zeros(32),v?h.toBuffer(v):h.zeros(8),t,void 0!==x?new h.BN(h.toBuffer(x)):void 0)},BlockHeader.fromRLPSerializedHeader=function(e,t){void 0===t&&(t={});var r=h.rlp.decode(e);if(!Array.isArray(r))throw new Error("Invalid serialized header input. Must be array");return BlockHeader.fromValuesArray(r,t)},BlockHeader.fromValuesArray=function(e,t){void 0===t&&(t={});var r=c(e,16),a=r[0],n=r[1],o=r[2],s=r[3],d=r[4],u=r[5],l=r[6],b=r[7],g=r[8],p=r[9],B=r[10],m=r[11],I=r[12],y=r[13],v=r[14],x=r[15];if(e.length>16)throw new Error("invalid header. More values than expected were received");if(e.length<15)throw new Error("invalid header. Less values than expected were received");return new BlockHeader(h.toBuffer(a),h.toBuffer(n),new h.Address(h.toBuffer(o)),h.toBuffer(s),h.toBuffer(d),h.toBuffer(u),h.toBuffer(l),new h.BN(h.toBuffer(b)),new h.BN(h.toBuffer(g)),new h.BN(h.toBuffer(p)),new h.BN(h.toBuffer(B)),new h.BN(h.toBuffer(m)),h.toBuffer(I),h.toBuffer(y),h.toBuffer(v),t,void 0!==x?new h.BN(h.toBuffer(x)):void 0)},BlockHeader.genesis=function(e,t){return void 0===e&&(e={}),t=n(n({},t),{initWithGenesisHeader:!0}),BlockHeader.fromHeaderData(e,t)},BlockHeader.prototype._validateHeaderFields=function(){var e=this,t=e.parentHash,r=e.stateRoot,a=e.transactionsTrie,n=e.receiptTrie,o=e.mixHash,s=e.nonce;if(32!==t.length)throw new Error("parentHash must be 32 bytes, received "+t.length+" bytes");if(32!==r.length)throw new Error("stateRoot must be 32 bytes, received "+r.length+" bytes");if(32!==a.length)throw new Error("transactionsTrie must be 32 bytes, received "+a.length+" bytes");if(32!==n.length)throw new Error("receiptTrie must be 32 bytes, received "+n.length+" bytes");if(32!==o.length)throw new Error("mixHash must be 32 bytes, received "+o.length+" bytes");if(8!==s.length){if(!this._common.networkIdBN().eqn(42))throw new Error("nonce must be 8 bytes, received "+s.length+" bytes");if(65!==s.length)throw new Error("nonce must be 65 bytes on kovan, received "+s.length+" bytes")}},BlockHeader.prototype.canonicalDifficulty=function(e){if("pow"!==this._common.consensusType())throw new Error("difficulty calculation is only supported on PoW chains");if("ethash"!==this._common.consensusAlgorithm())throw new Error("difficulty calculation currently only supports the ethash algorithm");var t,r=this._getHardfork(),a=this.timestamp,n=e.timestamp,o=e.difficulty,s=new h.BN(this._common.paramByHardfork("pow","minimumDifficulty",r)),c=o.div(new h.BN(this._common.paramByHardfork("pow","difficultyBoundDivisor",r))),d=this.number.clone();if(this._common.hardforkGteHardfork(r,"byzantium")){var u=e.uncleHash.equals(h.KECCAK256_RLP_ARRAY)?1:2,l=a.sub(n).idivn(9).ineg().iaddn(u);(b=new h.BN(-99)).gt(l)&&(l=b),t=o.add(c.mul(l))}if(this._common.hardforkGteHardfork(r,"byzantium"))d.isubn(this._common.param("pow","difficultyBombDelay")),d.ltn(0)&&(d=new h.BN(0));else if(this._common.hardforkGteHardfork(r,"homestead")){var b;l=a.sub(n).idivn(10).ineg().iaddn(1);(b=new h.BN(-99)).gt(l)&&(l=b),t=o.add(c.mul(l))}else t=n.addn(this._common.paramByHardfork("pow","durationLimit",r)).gt(a)?c.add(o):o.sub(c);var g=d.divn(1e5).isubn(2);return g.isNeg()||t.iadd(new h.BN(2).pow(g)),t.lt(s)&&(t=s),t},BlockHeader.prototype.validateDifficulty=function(e){return this.canonicalDifficulty(e).eq(this.difficulty)},BlockHeader.prototype.validateCliqueDifficulty=function(e){var t=this;if(this._requireClique("validateCliqueDifficulty"),!this.difficulty.eq(l.CLIQUE_DIFF_INTURN)&&!this.difficulty.eq(l.CLIQUE_DIFF_NOTURN))throw new Error("difficulty for clique block must be INTURN (2) or NOTURN (1), received: "+this.difficulty.toString());if("cliqueActiveSigners"in e==!1)throw new Error("PoA blockchain requires method blockchain.cliqueActiveSigners() to validate clique difficulty");var r=e.cliqueActiveSigners();if(0===r.length)return!0;var a=r.findIndex((function(e){return e.equals(t.cliqueSigner())})),n=this.number.modn(r.length)===a;return!!(n&&this.difficulty.eq(l.CLIQUE_DIFF_INTURN)||!n&&this.difficulty.eq(l.CLIQUE_DIFF_NOTURN))},BlockHeader.prototype.validateGasLimit=function(e){var t=e.gasLimit;if(this.number.eq(this._common.hardforkBlockBN("london"))){var r=new h.BN(this._common.param("gasConfig","elasticityMultiplier"));t=t.mul(r)}var a=this.gasLimit,n=this._getHardfork(),o=t.div(new h.BN(this._common.paramByHardfork("gasConfig","gasLimitBoundDivisor",n))),s=t.add(o),c=t.sub(o);return a.lt(s)&&a.gt(c)&&a.gte(this._common.paramByHardfork("gasConfig","minGasLimit",n))},BlockHeader.prototype.validate=function(e,t){return o(this,void 0,void 0,(function(){var r,n,o,c,d,u,b,g,p;return s(this,(function(s){switch(s.label){case 0:if(this.isGenesis())return[2];if(r=this._getHardfork(),"clique"!==this._common.consensusAlgorithm()){if(this.extraData.length>this._common.paramByHardfork("vm","maxExtraDataSize",r))throw c="invalid amount of extra data",this._error(c)}else{if(n=l.CLIQUE_EXTRA_VANITY+l.CLIQUE_EXTRA_SEAL,this.cliqueIsEpochTransition()){if((o=this.extraData.length-n)%20!=0)throw c="invalid signer list length in extraData, received signer length of "+o+" (not divisible by 20)",this._error(c);if(!this.coinbase.isZero())throw c="coinbase must be filled with zeros on epoch transition blocks, received "+this.coinbase.toString(),this._error(c)}else if(this.extraData.length!==n)throw c="extraData must be "+n+" bytes on non-epoch transition blocks, received "+this.extraData.length+" bytes",this._error(c);if(!this.mixHash.equals(a.alloc(32)))throw c="mixHash must be filled with zeros, received "+this.mixHash,this._error(c);if(!this.validateCliqueDifficulty(e))throw c="invalid clique difficulty",this._error(c)}return[4,this._getHeaderByHash(e,this.parentHash)];case 1:if(!(d=s.sent()))throw new Error("could not find parent header");if(!this.number.eq(d.number.addn(1)))throw new Error("invalid number");if(this.timestamp.lte(d.timestamp))throw new Error("invalid timestamp");if("clique"===this._common.consensusAlgorithm()&&(u=this._common.consensusConfig().period,d.timestamp.addn(u).gt(this.timestamp)))throw new Error("invalid timestamp diff (lower than period)");if("pow"===this._common.consensusType()&&!this.validateDifficulty(d))throw new Error("invalid difficulty");if(!this.validateGasLimit(d))throw new Error("invalid gas limit");if(t&&(!(b=t.sub(d.number)).ltn(8)||!b.gtn(1)))throw new Error("uncle block has a parent that is too old or too young");if(this.gasUsed.gt(this.gasLimit))throw new Error("Invalid block: too much gas used");if(this._common.isActivatedEIP(1559)){if(!this.baseFeePerGas)throw new Error("EIP1559 block has no base fee field");if(this.number.eq(this._common.hardforkBlockBN("london"))){if(g=new h.BN(this._common.param("gasConfig","initialBaseFee")),!this.baseFeePerGas.eq(g))throw new Error("Initial EIP1559 block does not have initial base fee")}else if(p=d.calcNextBaseFee(),!this.baseFeePerGas.eq(p))throw new Error("Invalid block: base fee not correct")}return[2]}}))}))},BlockHeader.prototype.calcNextBaseFee=function(){if(!this._common.isActivatedEIP(1559))throw new Error("calcNextBaseFee() can only be called with EIP1559 being activated");var e,t=new h.BN(this._common.param("gasConfig","elasticityMultiplier")),r=this.gasLimit.div(t);if(r.eq(this.gasUsed))e=this.baseFeePerGas;else if(this.gasUsed.gt(r)){var a=this.gasUsed.sub(r),n=new h.BN(this._common.param("gasConfig","baseFeeMaxChangeDenominator")),o=this.baseFeePerGas.mul(a).div(r).div(n);e=h.BN.max(o,new h.BN(1)).add(this.baseFeePerGas)}else{a=r.sub(this.gasUsed),n=new h.BN(this._common.param("gasConfig","baseFeeMaxChangeDenominator")),o=this.baseFeePerGas.mul(a).div(r).div(n);e=h.BN.max(this.baseFeePerGas.sub(o),new h.BN(0))}return e},BlockHeader.prototype.raw=function(){var e=[this.parentHash,this.uncleHash,this.coinbase.buf,this.stateRoot,this.transactionsTrie,this.receiptTrie,this.bloom,h.bnToUnpaddedBuffer(this.difficulty),h.bnToUnpaddedBuffer(this.number),h.bnToUnpaddedBuffer(this.gasLimit),h.bnToUnpaddedBuffer(this.gasUsed),h.bnToUnpaddedBuffer(this.timestamp),this.extraData,this.mixHash,this.nonce];return this._common.isActivatedEIP(1559)&&e.push(h.bnToUnpaddedBuffer(this.baseFeePerGas)),e},BlockHeader.prototype.hash=function(){return h.rlphash(this.raw())},BlockHeader.prototype.isGenesis=function(){return this.number.isZero()},BlockHeader.prototype._requireClique=function(e){if("clique"!==this._common.consensusAlgorithm())throw new Error("BlockHeader."+e+"() call only supported for clique PoA networks")},BlockHeader.prototype.cliqueSigHash=function(){this._requireClique("cliqueSigHash");var e=this.raw();return e[12]=this.extraData.slice(0,this.extraData.length-l.CLIQUE_EXTRA_SEAL),h.rlphash(e)},BlockHeader.prototype.cliqueIsEpochTransition=function(){this._requireClique("cliqueIsEpochTransition");var e=new h.BN(this._common.consensusConfig().epoch);return this.number.mod(e).isZero()},BlockHeader.prototype.cliqueExtraVanity=function(){return this._requireClique("cliqueExtraVanity"),this.extraData.slice(0,l.CLIQUE_EXTRA_VANITY)},BlockHeader.prototype.cliqueExtraSeal=function(){return this._requireClique("cliqueExtraSeal"),this.extraData.slice(-l.CLIQUE_EXTRA_SEAL)},BlockHeader.prototype.cliqueSealBlock=function(e){this._requireClique("cliqueSealBlock");var t=h.ecsign(this.cliqueSigHash(),e),r=a.concat([t.r,t.s,h.intToBuffer(t.v-27)]),n=this.extraData.slice(0,this.extraData.length-l.CLIQUE_EXTRA_SEAL);return a.concat([n,r])},BlockHeader.prototype.cliqueEpochTransitionSigners=function(){if(this._requireClique("cliqueEpochTransitionSigners"),!this.cliqueIsEpochTransition())throw new Error("Signers are only included in epoch transition blocks (clique)");for(var e=l.CLIQUE_EXTRA_VANITY,t=this.extraData.length-l.CLIQUE_EXTRA_SEAL,r=this.extraData.slice(e,t),a=[],n=0;n<=r.length-20;n+=20)a.push(r.slice(n,n+20));return a.map((function(e){return new h.Address(e)}))},BlockHeader.prototype.cliqueVerifySignature=function(e){this._requireClique("cliqueVerifySignature");var t=this.cliqueSigner();return!!e.find((function(e){return e.equals(t)}))},BlockHeader.prototype.cliqueSigner=function(){this._requireClique("cliqueSigner");var e=this.cliqueExtraSeal();if(0===e.length)return h.Address.zero();var t=e.slice(0,32),r=e.slice(32,64),a=new h.BN(e.slice(64,65)).addn(27),n=h.ecrecover(this.cliqueSigHash(),a,t,r);return h.Address.fromPublicKey(n)},BlockHeader.prototype.serialize=function(){return h.rlp.encode(this.raw())},BlockHeader.prototype.toJSON=function(){var e={parentHash:"0x"+this.parentHash.toString("hex"),uncleHash:"0x"+this.uncleHash.toString("hex"),coinbase:this.coinbase.toString(),stateRoot:"0x"+this.stateRoot.toString("hex"),transactionsTrie:"0x"+this.transactionsTrie.toString("hex"),receiptTrie:"0x"+this.receiptTrie.toString("hex"),bloom:"0x"+this.bloom.toString("hex"),difficulty:h.bnToHex(this.difficulty),number:h.bnToHex(this.number),gasLimit:h.bnToHex(this.gasLimit),gasUsed:h.bnToHex(this.gasUsed),timestamp:h.bnToHex(this.timestamp),extraData:"0x"+this.extraData.toString("hex"),mixHash:"0x"+this.mixHash.toString("hex"),nonce:"0x"+this.nonce.toString("hex")};return this._common.isActivatedEIP(1559)&&(e.baseFee="0x"+this.baseFeePerGas.toString("hex")),e},BlockHeader.prototype._error=function(e){return e+=" ("+this._errorPostfix+")",new Error(e)},BlockHeader.prototype._getHardfork=function(){return this._common.hardfork()||this._common.activeHardfork(this.number.toNumber())},BlockHeader.prototype._getHeaderByHash=function(e,t){return o(this,void 0,void 0,(function(){var r;return s(this,(function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),[4,e.getBlock(t)];case 1:return[2,a.sent().header];case 2:if("NotFoundError"===(r=a.sent()).type)return[2,void 0];throw r;case 3:return[2]}}))}))},BlockHeader.prototype._checkDAOExtraData=function(){var e=a.from("64616f2d686172642d666f726b","hex"),t=new h.BN(9);if(this._common.hardforkIsActiveOnChain("dao")){var r=this.number,n=this._common.hardforkBlockBN("dao");if(r.gte(n))if(r.sub(n).lte(t)&&!this.extraData.equals(e))throw new Error("extraData should be 'dao-hard-fork'")}},BlockHeader}();t.BlockHeader=g},(e,t,r)=>{"use strict";var a=r(0).Buffer;Object.defineProperty(t,"__esModule",{value:!0}),t.bufReverse=t.fnvBuffer=t.fnv=t.getSeed=t.getEpoc=t.getFullSize=t.getCacheSize=t.params=void 0;var n=r(5),o=r(1063);function fnv(e,t){return((16777216*e|0)+(403*e|0)^t)>>>0}t.params={DATASET_BYTES_INIT:1073741824,DATASET_BYTES_GROWTH:8388608,CACHE_BYTES_INIT:16777216,CACHE_BYTES_GROWTH:131072,CACHE_MULTIPLIER:1024,EPOCH_LENGTH:3e4,MIX_BYTES:128,HASH_BYTES:64,DATASET_PARENTS:256,CACHE_ROUNDS:3,ACCESSES:64,WORD_BYTES:4},t.getCacheSize=function getCacheSize(e){var r=new o,a=t.params.CACHE_BYTES_INIT+t.params.CACHE_BYTES_GROWTH*e;for(a-=t.params.HASH_BYTES;!r.test(new n.BN(a/t.params.HASH_BYTES));)a-=2*t.params.HASH_BYTES;return a},t.getFullSize=function getFullSize(e){var r=new o,a=t.params.DATASET_BYTES_INIT+t.params.DATASET_BYTES_GROWTH*e;for(a-=t.params.MIX_BYTES;!r.test(new n.BN(a/t.params.MIX_BYTES));)a-=2*t.params.MIX_BYTES;return a},t.getEpoc=function getEpoc(e){return Math.floor(e/t.params.EPOCH_LENGTH)},t.getSeed=function getSeed(e,t,r){for(var a=t;a=65&&r<=70?r-55:r>=97&&r<=102?r-87:r-48&15}function parseHexByte(e,t,r){var a=parseHex4Bits(e,r);return r-1>=t&&(a|=parseHex4Bits(e,r-1)<<4),a}function parseBase(e,t,r,a){for(var n=0,o=Math.min(e.length,r),s=t;s=49?c-49+10:c>=17?c-17+10:c}return n}BN.isBN=function isBN(e){return e instanceof BN||null!==e&&"object"==typeof e&&e.constructor.wordSize===BN.wordSize&&Array.isArray(e.words)},BN.max=function max(e,t){return e.cmp(t)>0?e:t},BN.min=function min(e,t){return e.cmp(t)<0?e:t},BN.prototype._init=function init(e,t,r){if("number"==typeof e)return this._initNumber(e,t,r);if("object"==typeof e)return this._initArray(e,t,r);"hex"===t&&(t=16),assert(t===(0|t)&&t>=2&&t<=36);var a=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&(a++,this.negative=1),a=0;a-=3)o=e[a]|e[a-1]<<8|e[a-2]<<16,this.words[n]|=o<>>26-s&67108863,(s+=24)>=26&&(s-=26,n++);else if("le"===r)for(a=0,n=0;a>>26-s&67108863,(s+=24)>=26&&(s-=26,n++);return this.strip()},BN.prototype._parseHex=function _parseHex(e,t,r){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var a=0;a=t;a-=2)n=parseHexByte(e,t,a)<=18?(o-=18,s+=1,this.words[s]|=n>>>26):o+=8;else for(a=(e.length-t)%2==0?t+1:t;a=18?(o-=18,s+=1,this.words[s]|=n>>>26):o+=8;this.strip()},BN.prototype._parseBase=function _parseBase(e,t,r){this.words=[0],this.length=1;for(var a=0,n=1;n<=67108863;n*=t)a++;a--,n=n/t|0;for(var o=e.length-r,s=o%a,c=Math.min(o,o-s)+r,d=0,u=r;u1&&0===this.words[this.length-1];)this.length--;return this._normSign()},BN.prototype._normSign=function _normSign(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},BN.prototype.inspect=function inspect(){return(this.red?""};var n=["","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"],o=[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],s=[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 smallMulTo(e,t,r){r.negative=t.negative^e.negative;var a=e.length+t.length|0;r.length=a,a=a-1|0;var n=0|e.words[0],o=0|t.words[0],s=n*o,c=67108863&s,d=s/67108864|0;r.words[0]=c;for(var u=1;u>>26,l=67108863&d,b=Math.min(u,t.length-1),g=Math.max(0,u-e.length+1);g<=b;g++){var p=u-g|0;h+=(s=(n=0|e.words[p])*(o=0|t.words[g])+l)/67108864|0,l=67108863&s}r.words[u]=0|l,d=0|h}return 0!==d?r.words[u]=0|d:r.length--,r.strip()}BN.prototype.toString=function toString(e,t){var r;if(t=0|t||1,16===(e=e||10)||"hex"===e){r="";for(var a=0,c=0,d=0;d>>24-a&16777215)||d!==this.length-1?n[6-h.length]+h+r:h+r,(a+=2)>=26&&(a-=26,d--)}for(0!==c&&(r=c.toString(16)+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(e===(0|e)&&e>=2&&e<=36){var l=o[e],b=s[e];r="";var g=this.clone();for(g.negative=0;!g.isZero();){var p=g.modn(b).toString(e);r=(g=g.idivn(b)).isZero()?p+r:n[l-p.length]+p+r}for(this.isZero()&&(r="0"+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}assert(!1,"Base should be between 2 and 36")},BN.prototype.toNumber=function toNumber(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&assert(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},BN.prototype.toJSON=function toJSON(){return this.toString(16)},BN.prototype.toBuffer=function toBuffer(e,t){return assert(void 0!==a),this.toArrayLike(a,e,t)},BN.prototype.toArray=function toArray(e,t){return this.toArrayLike(Array,e,t)},BN.prototype.toArrayLike=function toArrayLike(e,t,r){var a=this.byteLength(),n=r||Math.max(1,a);assert(a<=n,"byte array longer than desired length"),assert(n>0,"Requested array length <= 0"),this.strip();var o,s,c="le"===t,d=new e(n),u=this.clone();if(c){for(s=0;!u.isZero();s++)o=u.andln(255),u.iushrn(8),d[s]=o;for(;s=4096&&(r+=13,t>>>=13),t>=64&&(r+=7,t>>>=7),t>=8&&(r+=4,t>>>=4),t>=2&&(r+=2,t>>>=2),r+t},BN.prototype._zeroBits=function _zeroBits(e){if(0===e)return 26;var t=e,r=0;return 0==(8191&t)&&(r+=13,t>>>=13),0==(127&t)&&(r+=7,t>>>=7),0==(15&t)&&(r+=4,t>>>=4),0==(3&t)&&(r+=2,t>>>=2),0==(1&t)&&r++,r},BN.prototype.bitLength=function bitLength(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},BN.prototype.zeroBits=function zeroBits(){if(this.isZero())return 0;for(var e=0,t=0;te.length?this.clone().ior(e):e.clone().ior(this)},BN.prototype.uor=function uor(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},BN.prototype.iuand=function iuand(e){var t;t=this.length>e.length?e:this;for(var r=0;re.length?this.clone().iand(e):e.clone().iand(this)},BN.prototype.uand=function uand(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},BN.prototype.iuxor=function iuxor(e){var t,r;this.length>e.length?(t=this,r=e):(t=e,r=this);for(var a=0;ae.length?this.clone().ixor(e):e.clone().ixor(this)},BN.prototype.uxor=function uxor(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},BN.prototype.inotn=function inotn(e){assert("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),r=e%26;this._expand(t),r>0&&t--;for(var a=0;a0&&(this.words[a]=~this.words[a]&67108863>>26-r),this.strip()},BN.prototype.notn=function notn(e){return this.clone().inotn(e)},BN.prototype.setn=function setn(e,t){assert("number"==typeof e&&e>=0);var r=e/26|0,a=e%26;return this._expand(r+1),this.words[r]=t?this.words[r]|1<e.length?(r=this,a=e):(r=e,a=this);for(var n=0,o=0;o>>26;for(;0!==n&&o>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;oe.length?this.clone().iadd(e):e.clone().iadd(this)},BN.prototype.isub=function isub(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var r,a,n=this.cmp(e);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,a=e):(r=e,a=this);for(var o=0,s=0;s>26,this.words[s]=67108863&t;for(;0!==o&&s>26,this.words[s]=67108863&t;if(0===o&&s>>13,g=0|s[1],p=8191&g,B=g>>>13,m=0|s[2],I=8191&m,y=m>>>13,v=0|s[3],x=8191&v,C=v>>>13,Q=0|s[4],w=8191&Q,_=Q>>>13,k=0|s[5],N=8191&k,D=k>>>13,U=0|s[6],G=8191&U,T=U>>>13,L=0|s[7],P=8191&L,q=L>>>13,O=0|s[8],H=8191&O,Y=O>>>13,j=0|s[9],J=8191&j,z=j>>>13,W=0|c[0],V=8191&W,X=W>>>13,$=0|c[1],et=8191&$,tt=$>>>13,rt=0|c[2],at=8191&rt,it=rt>>>13,nt=0|c[3],ot=8191&nt,At=nt>>>13,st=0|c[4],ct=8191&st,dt=st>>>13,ut=0|c[5],ht=8191&ut,bt=ut>>>13,pt=0|c[6],Bt=8191&pt,mt=pt>>>13,It=0|c[7],Et=8191&It,yt=It>>>13,vt=0|c[8],xt=8191&vt,Ct=vt>>>13,Qt=0|c[9],wt=8191&Qt,Mt=Qt>>>13;r.negative=e.negative^t.negative,r.length=19;var _t=(u+(a=Math.imul(l,V))|0)+((8191&(n=(n=Math.imul(l,X))+Math.imul(b,V)|0))<<13)|0;u=((o=Math.imul(b,X))+(n>>>13)|0)+(_t>>>26)|0,_t&=67108863,a=Math.imul(p,V),n=(n=Math.imul(p,X))+Math.imul(B,V)|0,o=Math.imul(B,X);var kt=(u+(a=a+Math.imul(l,et)|0)|0)+((8191&(n=(n=n+Math.imul(l,tt)|0)+Math.imul(b,et)|0))<<13)|0;u=((o=o+Math.imul(b,tt)|0)+(n>>>13)|0)+(kt>>>26)|0,kt&=67108863,a=Math.imul(I,V),n=(n=Math.imul(I,X))+Math.imul(y,V)|0,o=Math.imul(y,X),a=a+Math.imul(p,et)|0,n=(n=n+Math.imul(p,tt)|0)+Math.imul(B,et)|0,o=o+Math.imul(B,tt)|0;var St=(u+(a=a+Math.imul(l,at)|0)|0)+((8191&(n=(n=n+Math.imul(l,it)|0)+Math.imul(b,at)|0))<<13)|0;u=((o=o+Math.imul(b,it)|0)+(n>>>13)|0)+(St>>>26)|0,St&=67108863,a=Math.imul(x,V),n=(n=Math.imul(x,X))+Math.imul(C,V)|0,o=Math.imul(C,X),a=a+Math.imul(I,et)|0,n=(n=n+Math.imul(I,tt)|0)+Math.imul(y,et)|0,o=o+Math.imul(y,tt)|0,a=a+Math.imul(p,at)|0,n=(n=n+Math.imul(p,it)|0)+Math.imul(B,at)|0,o=o+Math.imul(B,it)|0;var Nt=(u+(a=a+Math.imul(l,ot)|0)|0)+((8191&(n=(n=n+Math.imul(l,At)|0)+Math.imul(b,ot)|0))<<13)|0;u=((o=o+Math.imul(b,At)|0)+(n>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,a=Math.imul(w,V),n=(n=Math.imul(w,X))+Math.imul(_,V)|0,o=Math.imul(_,X),a=a+Math.imul(x,et)|0,n=(n=n+Math.imul(x,tt)|0)+Math.imul(C,et)|0,o=o+Math.imul(C,tt)|0,a=a+Math.imul(I,at)|0,n=(n=n+Math.imul(I,it)|0)+Math.imul(y,at)|0,o=o+Math.imul(y,it)|0,a=a+Math.imul(p,ot)|0,n=(n=n+Math.imul(p,At)|0)+Math.imul(B,ot)|0,o=o+Math.imul(B,At)|0;var Dt=(u+(a=a+Math.imul(l,ct)|0)|0)+((8191&(n=(n=n+Math.imul(l,dt)|0)+Math.imul(b,ct)|0))<<13)|0;u=((o=o+Math.imul(b,dt)|0)+(n>>>13)|0)+(Dt>>>26)|0,Dt&=67108863,a=Math.imul(N,V),n=(n=Math.imul(N,X))+Math.imul(D,V)|0,o=Math.imul(D,X),a=a+Math.imul(w,et)|0,n=(n=n+Math.imul(w,tt)|0)+Math.imul(_,et)|0,o=o+Math.imul(_,tt)|0,a=a+Math.imul(x,at)|0,n=(n=n+Math.imul(x,it)|0)+Math.imul(C,at)|0,o=o+Math.imul(C,it)|0,a=a+Math.imul(I,ot)|0,n=(n=n+Math.imul(I,At)|0)+Math.imul(y,ot)|0,o=o+Math.imul(y,At)|0,a=a+Math.imul(p,ct)|0,n=(n=n+Math.imul(p,dt)|0)+Math.imul(B,ct)|0,o=o+Math.imul(B,dt)|0;var Rt=(u+(a=a+Math.imul(l,ht)|0)|0)+((8191&(n=(n=n+Math.imul(l,bt)|0)+Math.imul(b,ht)|0))<<13)|0;u=((o=o+Math.imul(b,bt)|0)+(n>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,a=Math.imul(G,V),n=(n=Math.imul(G,X))+Math.imul(T,V)|0,o=Math.imul(T,X),a=a+Math.imul(N,et)|0,n=(n=n+Math.imul(N,tt)|0)+Math.imul(D,et)|0,o=o+Math.imul(D,tt)|0,a=a+Math.imul(w,at)|0,n=(n=n+Math.imul(w,it)|0)+Math.imul(_,at)|0,o=o+Math.imul(_,it)|0,a=a+Math.imul(x,ot)|0,n=(n=n+Math.imul(x,At)|0)+Math.imul(C,ot)|0,o=o+Math.imul(C,At)|0,a=a+Math.imul(I,ct)|0,n=(n=n+Math.imul(I,dt)|0)+Math.imul(y,ct)|0,o=o+Math.imul(y,dt)|0,a=a+Math.imul(p,ht)|0,n=(n=n+Math.imul(p,bt)|0)+Math.imul(B,ht)|0,o=o+Math.imul(B,bt)|0;var Ft=(u+(a=a+Math.imul(l,Bt)|0)|0)+((8191&(n=(n=n+Math.imul(l,mt)|0)+Math.imul(b,Bt)|0))<<13)|0;u=((o=o+Math.imul(b,mt)|0)+(n>>>13)|0)+(Ft>>>26)|0,Ft&=67108863,a=Math.imul(P,V),n=(n=Math.imul(P,X))+Math.imul(q,V)|0,o=Math.imul(q,X),a=a+Math.imul(G,et)|0,n=(n=n+Math.imul(G,tt)|0)+Math.imul(T,et)|0,o=o+Math.imul(T,tt)|0,a=a+Math.imul(N,at)|0,n=(n=n+Math.imul(N,it)|0)+Math.imul(D,at)|0,o=o+Math.imul(D,it)|0,a=a+Math.imul(w,ot)|0,n=(n=n+Math.imul(w,At)|0)+Math.imul(_,ot)|0,o=o+Math.imul(_,At)|0,a=a+Math.imul(x,ct)|0,n=(n=n+Math.imul(x,dt)|0)+Math.imul(C,ct)|0,o=o+Math.imul(C,dt)|0,a=a+Math.imul(I,ht)|0,n=(n=n+Math.imul(I,bt)|0)+Math.imul(y,ht)|0,o=o+Math.imul(y,bt)|0,a=a+Math.imul(p,Bt)|0,n=(n=n+Math.imul(p,mt)|0)+Math.imul(B,Bt)|0,o=o+Math.imul(B,mt)|0;var Ut=(u+(a=a+Math.imul(l,Et)|0)|0)+((8191&(n=(n=n+Math.imul(l,yt)|0)+Math.imul(b,Et)|0))<<13)|0;u=((o=o+Math.imul(b,yt)|0)+(n>>>13)|0)+(Ut>>>26)|0,Ut&=67108863,a=Math.imul(H,V),n=(n=Math.imul(H,X))+Math.imul(Y,V)|0,o=Math.imul(Y,X),a=a+Math.imul(P,et)|0,n=(n=n+Math.imul(P,tt)|0)+Math.imul(q,et)|0,o=o+Math.imul(q,tt)|0,a=a+Math.imul(G,at)|0,n=(n=n+Math.imul(G,it)|0)+Math.imul(T,at)|0,o=o+Math.imul(T,it)|0,a=a+Math.imul(N,ot)|0,n=(n=n+Math.imul(N,At)|0)+Math.imul(D,ot)|0,o=o+Math.imul(D,At)|0,a=a+Math.imul(w,ct)|0,n=(n=n+Math.imul(w,dt)|0)+Math.imul(_,ct)|0,o=o+Math.imul(_,dt)|0,a=a+Math.imul(x,ht)|0,n=(n=n+Math.imul(x,bt)|0)+Math.imul(C,ht)|0,o=o+Math.imul(C,bt)|0,a=a+Math.imul(I,Bt)|0,n=(n=n+Math.imul(I,mt)|0)+Math.imul(y,Bt)|0,o=o+Math.imul(y,mt)|0,a=a+Math.imul(p,Et)|0,n=(n=n+Math.imul(p,yt)|0)+Math.imul(B,Et)|0,o=o+Math.imul(B,yt)|0;var Gt=(u+(a=a+Math.imul(l,xt)|0)|0)+((8191&(n=(n=n+Math.imul(l,Ct)|0)+Math.imul(b,xt)|0))<<13)|0;u=((o=o+Math.imul(b,Ct)|0)+(n>>>13)|0)+(Gt>>>26)|0,Gt&=67108863,a=Math.imul(J,V),n=(n=Math.imul(J,X))+Math.imul(z,V)|0,o=Math.imul(z,X),a=a+Math.imul(H,et)|0,n=(n=n+Math.imul(H,tt)|0)+Math.imul(Y,et)|0,o=o+Math.imul(Y,tt)|0,a=a+Math.imul(P,at)|0,n=(n=n+Math.imul(P,it)|0)+Math.imul(q,at)|0,o=o+Math.imul(q,it)|0,a=a+Math.imul(G,ot)|0,n=(n=n+Math.imul(G,At)|0)+Math.imul(T,ot)|0,o=o+Math.imul(T,At)|0,a=a+Math.imul(N,ct)|0,n=(n=n+Math.imul(N,dt)|0)+Math.imul(D,ct)|0,o=o+Math.imul(D,dt)|0,a=a+Math.imul(w,ht)|0,n=(n=n+Math.imul(w,bt)|0)+Math.imul(_,ht)|0,o=o+Math.imul(_,bt)|0,a=a+Math.imul(x,Bt)|0,n=(n=n+Math.imul(x,mt)|0)+Math.imul(C,Bt)|0,o=o+Math.imul(C,mt)|0,a=a+Math.imul(I,Et)|0,n=(n=n+Math.imul(I,yt)|0)+Math.imul(y,Et)|0,o=o+Math.imul(y,yt)|0,a=a+Math.imul(p,xt)|0,n=(n=n+Math.imul(p,Ct)|0)+Math.imul(B,xt)|0,o=o+Math.imul(B,Ct)|0;var Tt=(u+(a=a+Math.imul(l,wt)|0)|0)+((8191&(n=(n=n+Math.imul(l,Mt)|0)+Math.imul(b,wt)|0))<<13)|0;u=((o=o+Math.imul(b,Mt)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,a=Math.imul(J,et),n=(n=Math.imul(J,tt))+Math.imul(z,et)|0,o=Math.imul(z,tt),a=a+Math.imul(H,at)|0,n=(n=n+Math.imul(H,it)|0)+Math.imul(Y,at)|0,o=o+Math.imul(Y,it)|0,a=a+Math.imul(P,ot)|0,n=(n=n+Math.imul(P,At)|0)+Math.imul(q,ot)|0,o=o+Math.imul(q,At)|0,a=a+Math.imul(G,ct)|0,n=(n=n+Math.imul(G,dt)|0)+Math.imul(T,ct)|0,o=o+Math.imul(T,dt)|0,a=a+Math.imul(N,ht)|0,n=(n=n+Math.imul(N,bt)|0)+Math.imul(D,ht)|0,o=o+Math.imul(D,bt)|0,a=a+Math.imul(w,Bt)|0,n=(n=n+Math.imul(w,mt)|0)+Math.imul(_,Bt)|0,o=o+Math.imul(_,mt)|0,a=a+Math.imul(x,Et)|0,n=(n=n+Math.imul(x,yt)|0)+Math.imul(C,Et)|0,o=o+Math.imul(C,yt)|0,a=a+Math.imul(I,xt)|0,n=(n=n+Math.imul(I,Ct)|0)+Math.imul(y,xt)|0,o=o+Math.imul(y,Ct)|0;var Lt=(u+(a=a+Math.imul(p,wt)|0)|0)+((8191&(n=(n=n+Math.imul(p,Mt)|0)+Math.imul(B,wt)|0))<<13)|0;u=((o=o+Math.imul(B,Mt)|0)+(n>>>13)|0)+(Lt>>>26)|0,Lt&=67108863,a=Math.imul(J,at),n=(n=Math.imul(J,it))+Math.imul(z,at)|0,o=Math.imul(z,it),a=a+Math.imul(H,ot)|0,n=(n=n+Math.imul(H,At)|0)+Math.imul(Y,ot)|0,o=o+Math.imul(Y,At)|0,a=a+Math.imul(P,ct)|0,n=(n=n+Math.imul(P,dt)|0)+Math.imul(q,ct)|0,o=o+Math.imul(q,dt)|0,a=a+Math.imul(G,ht)|0,n=(n=n+Math.imul(G,bt)|0)+Math.imul(T,ht)|0,o=o+Math.imul(T,bt)|0,a=a+Math.imul(N,Bt)|0,n=(n=n+Math.imul(N,mt)|0)+Math.imul(D,Bt)|0,o=o+Math.imul(D,mt)|0,a=a+Math.imul(w,Et)|0,n=(n=n+Math.imul(w,yt)|0)+Math.imul(_,Et)|0,o=o+Math.imul(_,yt)|0,a=a+Math.imul(x,xt)|0,n=(n=n+Math.imul(x,Ct)|0)+Math.imul(C,xt)|0,o=o+Math.imul(C,Ct)|0;var Pt=(u+(a=a+Math.imul(I,wt)|0)|0)+((8191&(n=(n=n+Math.imul(I,Mt)|0)+Math.imul(y,wt)|0))<<13)|0;u=((o=o+Math.imul(y,Mt)|0)+(n>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,a=Math.imul(J,ot),n=(n=Math.imul(J,At))+Math.imul(z,ot)|0,o=Math.imul(z,At),a=a+Math.imul(H,ct)|0,n=(n=n+Math.imul(H,dt)|0)+Math.imul(Y,ct)|0,o=o+Math.imul(Y,dt)|0,a=a+Math.imul(P,ht)|0,n=(n=n+Math.imul(P,bt)|0)+Math.imul(q,ht)|0,o=o+Math.imul(q,bt)|0,a=a+Math.imul(G,Bt)|0,n=(n=n+Math.imul(G,mt)|0)+Math.imul(T,Bt)|0,o=o+Math.imul(T,mt)|0,a=a+Math.imul(N,Et)|0,n=(n=n+Math.imul(N,yt)|0)+Math.imul(D,Et)|0,o=o+Math.imul(D,yt)|0,a=a+Math.imul(w,xt)|0,n=(n=n+Math.imul(w,Ct)|0)+Math.imul(_,xt)|0,o=o+Math.imul(_,Ct)|0;var qt=(u+(a=a+Math.imul(x,wt)|0)|0)+((8191&(n=(n=n+Math.imul(x,Mt)|0)+Math.imul(C,wt)|0))<<13)|0;u=((o=o+Math.imul(C,Mt)|0)+(n>>>13)|0)+(qt>>>26)|0,qt&=67108863,a=Math.imul(J,ct),n=(n=Math.imul(J,dt))+Math.imul(z,ct)|0,o=Math.imul(z,dt),a=a+Math.imul(H,ht)|0,n=(n=n+Math.imul(H,bt)|0)+Math.imul(Y,ht)|0,o=o+Math.imul(Y,bt)|0,a=a+Math.imul(P,Bt)|0,n=(n=n+Math.imul(P,mt)|0)+Math.imul(q,Bt)|0,o=o+Math.imul(q,mt)|0,a=a+Math.imul(G,Et)|0,n=(n=n+Math.imul(G,yt)|0)+Math.imul(T,Et)|0,o=o+Math.imul(T,yt)|0,a=a+Math.imul(N,xt)|0,n=(n=n+Math.imul(N,Ct)|0)+Math.imul(D,xt)|0,o=o+Math.imul(D,Ct)|0;var Ot=(u+(a=a+Math.imul(w,wt)|0)|0)+((8191&(n=(n=n+Math.imul(w,Mt)|0)+Math.imul(_,wt)|0))<<13)|0;u=((o=o+Math.imul(_,Mt)|0)+(n>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,a=Math.imul(J,ht),n=(n=Math.imul(J,bt))+Math.imul(z,ht)|0,o=Math.imul(z,bt),a=a+Math.imul(H,Bt)|0,n=(n=n+Math.imul(H,mt)|0)+Math.imul(Y,Bt)|0,o=o+Math.imul(Y,mt)|0,a=a+Math.imul(P,Et)|0,n=(n=n+Math.imul(P,yt)|0)+Math.imul(q,Et)|0,o=o+Math.imul(q,yt)|0,a=a+Math.imul(G,xt)|0,n=(n=n+Math.imul(G,Ct)|0)+Math.imul(T,xt)|0,o=o+Math.imul(T,Ct)|0;var Ht=(u+(a=a+Math.imul(N,wt)|0)|0)+((8191&(n=(n=n+Math.imul(N,Mt)|0)+Math.imul(D,wt)|0))<<13)|0;u=((o=o+Math.imul(D,Mt)|0)+(n>>>13)|0)+(Ht>>>26)|0,Ht&=67108863,a=Math.imul(J,Bt),n=(n=Math.imul(J,mt))+Math.imul(z,Bt)|0,o=Math.imul(z,mt),a=a+Math.imul(H,Et)|0,n=(n=n+Math.imul(H,yt)|0)+Math.imul(Y,Et)|0,o=o+Math.imul(Y,yt)|0,a=a+Math.imul(P,xt)|0,n=(n=n+Math.imul(P,Ct)|0)+Math.imul(q,xt)|0,o=o+Math.imul(q,Ct)|0;var Yt=(u+(a=a+Math.imul(G,wt)|0)|0)+((8191&(n=(n=n+Math.imul(G,Mt)|0)+Math.imul(T,wt)|0))<<13)|0;u=((o=o+Math.imul(T,Mt)|0)+(n>>>13)|0)+(Yt>>>26)|0,Yt&=67108863,a=Math.imul(J,Et),n=(n=Math.imul(J,yt))+Math.imul(z,Et)|0,o=Math.imul(z,yt),a=a+Math.imul(H,xt)|0,n=(n=n+Math.imul(H,Ct)|0)+Math.imul(Y,xt)|0,o=o+Math.imul(Y,Ct)|0;var jt=(u+(a=a+Math.imul(P,wt)|0)|0)+((8191&(n=(n=n+Math.imul(P,Mt)|0)+Math.imul(q,wt)|0))<<13)|0;u=((o=o+Math.imul(q,Mt)|0)+(n>>>13)|0)+(jt>>>26)|0,jt&=67108863,a=Math.imul(J,xt),n=(n=Math.imul(J,Ct))+Math.imul(z,xt)|0,o=Math.imul(z,Ct);var Jt=(u+(a=a+Math.imul(H,wt)|0)|0)+((8191&(n=(n=n+Math.imul(H,Mt)|0)+Math.imul(Y,wt)|0))<<13)|0;u=((o=o+Math.imul(Y,Mt)|0)+(n>>>13)|0)+(Jt>>>26)|0,Jt&=67108863;var Kt=(u+(a=Math.imul(J,wt))|0)+((8191&(n=(n=Math.imul(J,Mt))+Math.imul(z,wt)|0))<<13)|0;return u=((o=Math.imul(z,Mt))+(n>>>13)|0)+(Kt>>>26)|0,Kt&=67108863,d[0]=_t,d[1]=kt,d[2]=St,d[3]=Nt,d[4]=Dt,d[5]=Rt,d[6]=Ft,d[7]=Ut,d[8]=Gt,d[9]=Tt,d[10]=Lt,d[11]=Pt,d[12]=qt,d[13]=Ot,d[14]=Ht,d[15]=Yt,d[16]=jt,d[17]=Jt,d[18]=Kt,0!==u&&(d[19]=u,r.length++),r};function jumboMulTo(e,t,r){return(new FFTM).mulp(e,t,r)}function FFTM(e,t){this.x=e,this.y=t}Math.imul||(c=smallMulTo),BN.prototype.mulTo=function mulTo(e,t){var r=this.length+e.length;return 10===this.length&&10===e.length?c(this,e,t):r<63?smallMulTo(this,e,t):r<1024?function bigMulTo(e,t,r){r.negative=t.negative^e.negative,r.length=e.length+t.length;for(var a=0,n=0,o=0;o>>26)|0)>>>26,s&=67108863}r.words[o]=c,a=s,s=n}return 0!==a?r.words[o]=a:r.length--,r.strip()}(this,e,t):jumboMulTo(this,e,t)},FFTM.prototype.makeRBT=function makeRBT(e){for(var t=new Array(e),r=BN.prototype._countBits(e)-1,a=0;a>=1;return a},FFTM.prototype.permute=function permute(e,t,r,a,n,o){for(var s=0;s>>=1)n++;return 1<>>=13,r[2*o+1]=8191&n,n>>>=13;for(o=2*t;o>=26,t+=a/67108864|0,t+=n>>>26,this.words[r]=67108863&n}return 0!==t&&(this.words[r]=t,this.length++),this},BN.prototype.muln=function muln(e){return this.clone().imuln(e)},BN.prototype.sqr=function sqr(){return this.mul(this)},BN.prototype.isqr=function isqr(){return this.imul(this.clone())},BN.prototype.pow=function pow(e){var t=function toBitArray(e){for(var t=new Array(e.bitLength()),r=0;r>>n}return t}(e);if(0===t.length)return new BN(1);for(var r=this,a=0;a=0);var t,r=e%26,a=(e-r)/26,n=67108863>>>26-r<<26-r;if(0!==r){var o=0;for(t=0;t>>26-r}o&&(this.words[t]=o,this.length++)}if(0!==a){for(t=this.length-1;t>=0;t--)this.words[t+a]=this.words[t];for(t=0;t=0),a=t?(t-t%26)/26:0;var n=e%26,o=Math.min((e-n)/26,this.length),s=67108863^67108863>>>n<o)for(this.length-=o,d=0;d=0&&(0!==u||d>=a);d--){var h=0|this.words[d];this.words[d]=u<<26-n|h>>>n,u=h&s}return c&&0!==u&&(c.words[c.length++]=u),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},BN.prototype.ishrn=function ishrn(e,t,r){return assert(0===this.negative),this.iushrn(e,t,r)},BN.prototype.shln=function shln(e){return this.clone().ishln(e)},BN.prototype.ushln=function ushln(e){return this.clone().iushln(e)},BN.prototype.shrn=function shrn(e){return this.clone().ishrn(e)},BN.prototype.ushrn=function ushrn(e){return this.clone().iushrn(e)},BN.prototype.testn=function testn(e){assert("number"==typeof e&&e>=0);var t=e%26,r=(e-t)/26,a=1<=0);var t=e%26,r=(e-t)/26;if(assert(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==t&&r++,this.length=Math.min(r,this.length),0!==t){var a=67108863^67108863>>>t<=67108864;t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},BN.prototype.isubn=function isubn(e){if(assert("number"==typeof e),assert(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t>26)-(c/67108864|0),this.words[a+r]=67108863&n}for(;a>26,this.words[a+r]=67108863&n;if(0===s)return this.strip();for(assert(-1===s),s=0,a=0;a>26,this.words[a]=67108863&n;return this.negative=1,this.strip()},BN.prototype._wordDiv=function _wordDiv(e,t){var r=(this.length,e.length),a=this.clone(),n=e,o=0|n.words[n.length-1];0!==(r=26-this._countBits(o))&&(n=n.ushln(r),a.iushln(r),o=0|n.words[n.length-1]);var s,c=a.length-n.length;if("mod"!==t){(s=new BN(null)).length=c+1,s.words=new Array(s.length);for(var d=0;d=0;h--){var l=67108864*(0|a.words[n.length+h])+(0|a.words[n.length+h-1]);for(l=Math.min(l/o|0,67108863),a._ishlnsubmul(n,l,h);0!==a.negative;)l--,a.negative=0,a._ishlnsubmul(n,1,h),a.isZero()||(a.negative^=1);s&&(s.words[h]=l)}return s&&s.strip(),a.strip(),"div"!==t&&0!==r&&a.iushrn(r),{div:s||null,mod:a}},BN.prototype.divmod=function divmod(e,t,r){return assert(!e.isZero()),this.isZero()?{div:new BN(0),mod:new BN(0)}:0!==this.negative&&0===e.negative?(o=this.neg().divmod(e,t),"mod"!==t&&(a=o.div.neg()),"div"!==t&&(n=o.mod.neg(),r&&0!==n.negative&&n.iadd(e)),{div:a,mod:n}):0===this.negative&&0!==e.negative?(o=this.divmod(e.neg(),t),"mod"!==t&&(a=o.div.neg()),{div:a,mod:o.mod}):0!=(this.negative&e.negative)?(o=this.neg().divmod(e.neg(),t),"div"!==t&&(n=o.mod.neg(),r&&0!==n.negative&&n.isub(e)),{div:o.div,mod:n}):e.length>this.length||this.cmp(e)<0?{div:new BN(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new BN(this.modn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new BN(this.modn(e.words[0]))}:this._wordDiv(e,t);var a,n,o},BN.prototype.div=function div(e){return this.divmod(e,"div",!1).div},BN.prototype.mod=function mod(e){return this.divmod(e,"mod",!1).mod},BN.prototype.umod=function umod(e){return this.divmod(e,"mod",!0).mod},BN.prototype.divRound=function divRound(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var r=0!==t.div.negative?t.mod.isub(e):t.mod,a=e.ushrn(1),n=e.andln(1),o=r.cmp(a);return o<0||1===n&&0===o?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},BN.prototype.modn=function modn(e){assert(e<=67108863);for(var t=(1<<26)%e,r=0,a=this.length-1;a>=0;a--)r=(t*r+(0|this.words[a]))%e;return r},BN.prototype.idivn=function idivn(e){assert(e<=67108863);for(var t=0,r=this.length-1;r>=0;r--){var a=(0|this.words[r])+67108864*t;this.words[r]=a/e|0,t=a%e}return this.strip()},BN.prototype.divn=function divn(e){return this.clone().idivn(e)},BN.prototype.egcd=function egcd(e){assert(0===e.negative),assert(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var a=new BN(1),n=new BN(0),o=new BN(0),s=new BN(1),c=0;t.isEven()&&r.isEven();)t.iushrn(1),r.iushrn(1),++c;for(var d=r.clone(),u=t.clone();!t.isZero();){for(var h=0,l=1;0==(t.words[0]&l)&&h<26;++h,l<<=1);if(h>0)for(t.iushrn(h);h-- >0;)(a.isOdd()||n.isOdd())&&(a.iadd(d),n.isub(u)),a.iushrn(1),n.iushrn(1);for(var b=0,g=1;0==(r.words[0]&g)&&b<26;++b,g<<=1);if(b>0)for(r.iushrn(b);b-- >0;)(o.isOdd()||s.isOdd())&&(o.iadd(d),s.isub(u)),o.iushrn(1),s.iushrn(1);t.cmp(r)>=0?(t.isub(r),a.isub(o),n.isub(s)):(r.isub(t),o.isub(a),s.isub(n))}return{a:o,b:s,gcd:r.iushln(c)}},BN.prototype._invmp=function _invmp(e){assert(0===e.negative),assert(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var a,n=new BN(1),o=new BN(0),s=r.clone();t.cmpn(1)>0&&r.cmpn(1)>0;){for(var c=0,d=1;0==(t.words[0]&d)&&c<26;++c,d<<=1);if(c>0)for(t.iushrn(c);c-- >0;)n.isOdd()&&n.iadd(s),n.iushrn(1);for(var u=0,h=1;0==(r.words[0]&h)&&u<26;++u,h<<=1);if(u>0)for(r.iushrn(u);u-- >0;)o.isOdd()&&o.iadd(s),o.iushrn(1);t.cmp(r)>=0?(t.isub(r),n.isub(o)):(r.isub(t),o.isub(n))}return(a=0===t.cmpn(1)?n:o).cmpn(0)<0&&a.iadd(e),a},BN.prototype.gcd=function gcd(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),r=e.clone();t.negative=0,r.negative=0;for(var a=0;t.isEven()&&r.isEven();a++)t.iushrn(1),r.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=t.cmp(r);if(n<0){var o=t;t=r,r=o}else if(0===n||0===r.cmpn(1))break;t.isub(r)}return r.iushln(a)},BN.prototype.invm=function invm(e){return this.egcd(e).a.umod(e)},BN.prototype.isEven=function isEven(){return 0==(1&this.words[0])},BN.prototype.isOdd=function isOdd(){return 1==(1&this.words[0])},BN.prototype.andln=function andln(e){return this.words[0]&e},BN.prototype.bincn=function bincn(e){assert("number"==typeof e);var t=e%26,r=(e-t)/26,a=1<>>26,s&=67108863,this.words[o]=s}return 0!==n&&(this.words[o]=n,this.length++),this},BN.prototype.isZero=function isZero(){return 1===this.length&&0===this.words[0]},BN.prototype.cmpn=function cmpn(e){var t,r=e<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this.strip(),this.length>1)t=1;else{r&&(e=-e),assert(e<=67108863,"Number is too big");var a=0|this.words[0];t=a===e?0:ae.length)return 1;if(this.length=0;r--){var a=0|this.words[r],n=0|e.words[r];if(a!==n){an&&(t=1);break}}return t},BN.prototype.gtn=function gtn(e){return 1===this.cmpn(e)},BN.prototype.gt=function gt(e){return 1===this.cmp(e)},BN.prototype.gten=function gten(e){return this.cmpn(e)>=0},BN.prototype.gte=function gte(e){return this.cmp(e)>=0},BN.prototype.ltn=function ltn(e){return-1===this.cmpn(e)},BN.prototype.lt=function lt(e){return-1===this.cmp(e)},BN.prototype.lten=function lten(e){return this.cmpn(e)<=0},BN.prototype.lte=function lte(e){return this.cmp(e)<=0},BN.prototype.eqn=function eqn(e){return 0===this.cmpn(e)},BN.prototype.eq=function eq(e){return 0===this.cmp(e)},BN.red=function red(e){return new Red(e)},BN.prototype.toRed=function toRed(e){return assert(!this.red,"Already a number in reduction context"),assert(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},BN.prototype.fromRed=function fromRed(){return assert(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},BN.prototype._forceRed=function _forceRed(e){return this.red=e,this},BN.prototype.forceRed=function forceRed(e){return assert(!this.red,"Already a number in reduction context"),this._forceRed(e)},BN.prototype.redAdd=function redAdd(e){return assert(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},BN.prototype.redIAdd=function redIAdd(e){return assert(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},BN.prototype.redSub=function redSub(e){return assert(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},BN.prototype.redISub=function redISub(e){return assert(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},BN.prototype.redShl=function redShl(e){return assert(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},BN.prototype.redMul=function redMul(e){return assert(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},BN.prototype.redIMul=function redIMul(e){return assert(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},BN.prototype.redSqr=function redSqr(){return assert(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},BN.prototype.redISqr=function redISqr(){return assert(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},BN.prototype.redSqrt=function redSqrt(){return assert(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},BN.prototype.redInvm=function redInvm(){return assert(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},BN.prototype.redNeg=function redNeg(){return assert(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},BN.prototype.redPow=function redPow(e){return assert(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var d={k256:null,p224:null,p192:null,p25519:null};function MPrime(e,t){this.name=e,this.p=new BN(t,16),this.n=this.p.bitLength(),this.k=new BN(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function K256(){MPrime.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function P224(){MPrime.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function P192(){MPrime.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function P25519(){MPrime.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function Red(e){if("string"==typeof e){var t=BN._prime(e);this.m=t.p,this.prime=t}else assert(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function Mont(e){Red.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new BN(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)}MPrime.prototype._tmp=function _tmp(){var e=new BN(null);return e.words=new Array(Math.ceil(this.n/13)),e},MPrime.prototype.ireduce=function ireduce(e){var t,r=e;do{this.split(r,this.tmp),t=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(t>this.n);var a=t0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},MPrime.prototype.split=function split(e,t){e.iushrn(this.n,0,t)},MPrime.prototype.imulK=function imulK(e){return e.imul(this.k)},inherits(K256,MPrime),K256.prototype.split=function split(e,t){for(var r=4194303,a=Math.min(e.length,9),n=0;n>>22,o=s}o>>>=22,e.words[n-10]=o,0===o&&e.length>10?e.length-=10:e.length-=9},K256.prototype.imulK=function imulK(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,r=0;r>>=26,e.words[r]=n,t=a}return 0!==t&&(e.words[e.length++]=t),e},BN._prime=function prime(e){if(d[e])return d[e];var prime;if("k256"===e)prime=new K256;else if("p224"===e)prime=new P224;else if("p192"===e)prime=new P192;else{if("p25519"!==e)throw new Error("Unknown prime "+e);prime=new P25519}return d[e]=prime,prime},Red.prototype._verify1=function _verify1(e){assert(0===e.negative,"red works only with positives"),assert(e.red,"red works only with red numbers")},Red.prototype._verify2=function _verify2(e,t){assert(0==(e.negative|t.negative),"red works only with positives"),assert(e.red&&e.red===t.red,"red works only with red numbers")},Red.prototype.imod=function imod(e){return this.prime?this.prime.ireduce(e)._forceRed(this):e.umod(this.m)._forceRed(this)},Red.prototype.neg=function neg(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},Red.prototype.add=function add(e,t){this._verify2(e,t);var r=e.add(t);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},Red.prototype.iadd=function iadd(e,t){this._verify2(e,t);var r=e.iadd(t);return r.cmp(this.m)>=0&&r.isub(this.m),r},Red.prototype.sub=function sub(e,t){this._verify2(e,t);var r=e.sub(t);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},Red.prototype.isub=function isub(e,t){this._verify2(e,t);var r=e.isub(t);return r.cmpn(0)<0&&r.iadd(this.m),r},Red.prototype.shl=function shl(e,t){return this._verify1(e),this.imod(e.ushln(t))},Red.prototype.imul=function imul(e,t){return this._verify2(e,t),this.imod(e.imul(t))},Red.prototype.mul=function mul(e,t){return this._verify2(e,t),this.imod(e.mul(t))},Red.prototype.isqr=function isqr(e){return this.imul(e,e.clone())},Red.prototype.sqr=function sqr(e){return this.mul(e,e)},Red.prototype.sqrt=function sqrt(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(assert(t%2==1),3===t){var r=this.m.add(new BN(1)).iushrn(2);return this.pow(e,r)}for(var a=this.m.subn(1),n=0;!a.isZero()&&0===a.andln(1);)n++,a.iushrn(1);assert(!a.isZero());var o=new BN(1).toRed(this),s=o.redNeg(),c=this.m.subn(1).iushrn(1),d=this.m.bitLength();for(d=new BN(2*d*d).toRed(this);0!==this.pow(d,c).cmp(s);)d.redIAdd(s);for(var u=this.pow(d,a),h=this.pow(e,a.addn(1).iushrn(1)),l=this.pow(e,a),b=n;0!==l.cmp(o);){for(var g=l,p=0;0!==g.cmp(o);p++)g=g.redSqr();assert(p=0;a--){for(var d=t.words[a],u=c-1;u>=0;u--){var h=d>>u&1;n!==r[0]&&(n=this.sqr(n)),0!==h||0!==o?(o<<=1,o|=h,(4===++s||0===a&&0===u)&&(n=this.mul(n,r[o]),s=0,o=0)):s=0}c=26}return n},Red.prototype.convertTo=function convertTo(e){var t=e.umod(this.m);return t===e?t.clone():t},Red.prototype.convertFrom=function convertFrom(e){var t=e.clone();return t.red=null,t},BN.mont=function mont(e){return new Mont(e)},inherits(Mont,Red),Mont.prototype.convertTo=function convertTo(e){return this.imod(e.ushln(this.shift))},Mont.prototype.convertFrom=function convertFrom(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},Mont.prototype.imul=function imul(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var r=e.imul(t),a=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(a).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},Mont.prototype.mul=function mul(e,t){if(e.isZero()||t.isZero())return new BN(0)._forceRed(this);var r=e.mul(t),a=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(a).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},Mont.prototype.invm=function invm(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(e=r.nmd(e),this)},function(e,t,r){!function(e,t){"use strict";function assert(e,t){if(!e)throw new Error(t||"Assertion failed")}function inherits(e,t){e.super_=t;var TempCtor=function(){};TempCtor.prototype=t.prototype,e.prototype=new TempCtor,e.prototype.constructor=e}function BN(e,t,r){if(BN.isBN(e))return e;this.negative=0,this.words=null,this.length=0,this.red=null,null!==e&&("le"!==t&&"be"!==t||(r=t,t=10),this._init(e||0,t||10,r||"be"))}var a;"object"==typeof e?e.exports=BN:t.BN=BN,BN.BN=BN,BN.wordSize=26;try{a="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:r(17).Buffer}catch(e){}function parseHex4Bits(e,t){var r=e.charCodeAt(t);return r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:r-48&15}function parseHexByte(e,t,r){var a=parseHex4Bits(e,r);return r-1>=t&&(a|=parseHex4Bits(e,r-1)<<4),a}function parseBase(e,t,r,a){for(var n=0,o=Math.min(e.length,r),s=t;s=49?c-49+10:c>=17?c-17+10:c}return n}BN.isBN=function isBN(e){return e instanceof BN||null!==e&&"object"==typeof e&&e.constructor.wordSize===BN.wordSize&&Array.isArray(e.words)},BN.max=function max(e,t){return e.cmp(t)>0?e:t},BN.min=function min(e,t){return e.cmp(t)<0?e:t},BN.prototype._init=function init(e,t,r){if("number"==typeof e)return this._initNumber(e,t,r);if("object"==typeof e)return this._initArray(e,t,r);"hex"===t&&(t=16),assert(t===(0|t)&&t>=2&&t<=36);var a=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&(a++,this.negative=1),a=0;a-=3)o=e[a]|e[a-1]<<8|e[a-2]<<16,this.words[n]|=o<>>26-s&67108863,(s+=24)>=26&&(s-=26,n++);else if("le"===r)for(a=0,n=0;a>>26-s&67108863,(s+=24)>=26&&(s-=26,n++);return this.strip()},BN.prototype._parseHex=function _parseHex(e,t,r){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var a=0;a=t;a-=2)n=parseHexByte(e,t,a)<=18?(o-=18,s+=1,this.words[s]|=n>>>26):o+=8;else for(a=(e.length-t)%2==0?t+1:t;a=18?(o-=18,s+=1,this.words[s]|=n>>>26):o+=8;this.strip()},BN.prototype._parseBase=function _parseBase(e,t,r){this.words=[0],this.length=1;for(var a=0,n=1;n<=67108863;n*=t)a++;a--,n=n/t|0;for(var o=e.length-r,s=o%a,c=Math.min(o,o-s)+r,d=0,u=r;u1&&0===this.words[this.length-1];)this.length--;return this._normSign()},BN.prototype._normSign=function _normSign(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},BN.prototype.inspect=function inspect(){return(this.red?""};var n=["","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"],o=[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],s=[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 smallMulTo(e,t,r){r.negative=t.negative^e.negative;var a=e.length+t.length|0;r.length=a,a=a-1|0;var n=0|e.words[0],o=0|t.words[0],s=n*o,c=67108863&s,d=s/67108864|0;r.words[0]=c;for(var u=1;u>>26,l=67108863&d,b=Math.min(u,t.length-1),g=Math.max(0,u-e.length+1);g<=b;g++){var p=u-g|0;h+=(s=(n=0|e.words[p])*(o=0|t.words[g])+l)/67108864|0,l=67108863&s}r.words[u]=0|l,d=0|h}return 0!==d?r.words[u]=0|d:r.length--,r.strip()}BN.prototype.toString=function toString(e,t){var r;if(t=0|t||1,16===(e=e||10)||"hex"===e){r="";for(var a=0,c=0,d=0;d>>24-a&16777215)||d!==this.length-1?n[6-h.length]+h+r:h+r,(a+=2)>=26&&(a-=26,d--)}for(0!==c&&(r=c.toString(16)+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(e===(0|e)&&e>=2&&e<=36){var l=o[e],b=s[e];r="";var g=this.clone();for(g.negative=0;!g.isZero();){var p=g.modn(b).toString(e);r=(g=g.idivn(b)).isZero()?p+r:n[l-p.length]+p+r}for(this.isZero()&&(r="0"+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}assert(!1,"Base should be between 2 and 36")},BN.prototype.toNumber=function toNumber(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&assert(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},BN.prototype.toJSON=function toJSON(){return this.toString(16)},BN.prototype.toBuffer=function toBuffer(e,t){return assert(void 0!==a),this.toArrayLike(a,e,t)},BN.prototype.toArray=function toArray(e,t){return this.toArrayLike(Array,e,t)},BN.prototype.toArrayLike=function toArrayLike(e,t,r){var a=this.byteLength(),n=r||Math.max(1,a);assert(a<=n,"byte array longer than desired length"),assert(n>0,"Requested array length <= 0"),this.strip();var o,s,c="le"===t,d=new e(n),u=this.clone();if(c){for(s=0;!u.isZero();s++)o=u.andln(255),u.iushrn(8),d[s]=o;for(;s=4096&&(r+=13,t>>>=13),t>=64&&(r+=7,t>>>=7),t>=8&&(r+=4,t>>>=4),t>=2&&(r+=2,t>>>=2),r+t},BN.prototype._zeroBits=function _zeroBits(e){if(0===e)return 26;var t=e,r=0;return 0==(8191&t)&&(r+=13,t>>>=13),0==(127&t)&&(r+=7,t>>>=7),0==(15&t)&&(r+=4,t>>>=4),0==(3&t)&&(r+=2,t>>>=2),0==(1&t)&&r++,r},BN.prototype.bitLength=function bitLength(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},BN.prototype.zeroBits=function zeroBits(){if(this.isZero())return 0;for(var e=0,t=0;te.length?this.clone().ior(e):e.clone().ior(this)},BN.prototype.uor=function uor(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},BN.prototype.iuand=function iuand(e){var t;t=this.length>e.length?e:this;for(var r=0;re.length?this.clone().iand(e):e.clone().iand(this)},BN.prototype.uand=function uand(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},BN.prototype.iuxor=function iuxor(e){var t,r;this.length>e.length?(t=this,r=e):(t=e,r=this);for(var a=0;ae.length?this.clone().ixor(e):e.clone().ixor(this)},BN.prototype.uxor=function uxor(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},BN.prototype.inotn=function inotn(e){assert("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),r=e%26;this._expand(t),r>0&&t--;for(var a=0;a0&&(this.words[a]=~this.words[a]&67108863>>26-r),this.strip()},BN.prototype.notn=function notn(e){return this.clone().inotn(e)},BN.prototype.setn=function setn(e,t){assert("number"==typeof e&&e>=0);var r=e/26|0,a=e%26;return this._expand(r+1),this.words[r]=t?this.words[r]|1<e.length?(r=this,a=e):(r=e,a=this);for(var n=0,o=0;o>>26;for(;0!==n&&o>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;oe.length?this.clone().iadd(e):e.clone().iadd(this)},BN.prototype.isub=function isub(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var r,a,n=this.cmp(e);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,a=e):(r=e,a=this);for(var o=0,s=0;s>26,this.words[s]=67108863&t;for(;0!==o&&s>26,this.words[s]=67108863&t;if(0===o&&s>>13,g=0|s[1],p=8191&g,B=g>>>13,m=0|s[2],I=8191&m,y=m>>>13,v=0|s[3],x=8191&v,C=v>>>13,Q=0|s[4],w=8191&Q,_=Q>>>13,k=0|s[5],N=8191&k,D=k>>>13,U=0|s[6],G=8191&U,T=U>>>13,L=0|s[7],P=8191&L,q=L>>>13,O=0|s[8],H=8191&O,Y=O>>>13,j=0|s[9],J=8191&j,z=j>>>13,W=0|c[0],V=8191&W,X=W>>>13,$=0|c[1],et=8191&$,tt=$>>>13,rt=0|c[2],at=8191&rt,it=rt>>>13,nt=0|c[3],ot=8191&nt,At=nt>>>13,st=0|c[4],ct=8191&st,dt=st>>>13,ut=0|c[5],ht=8191&ut,bt=ut>>>13,pt=0|c[6],Bt=8191&pt,mt=pt>>>13,It=0|c[7],Et=8191&It,yt=It>>>13,vt=0|c[8],xt=8191&vt,Ct=vt>>>13,Qt=0|c[9],wt=8191&Qt,Mt=Qt>>>13;r.negative=e.negative^t.negative,r.length=19;var _t=(u+(a=Math.imul(l,V))|0)+((8191&(n=(n=Math.imul(l,X))+Math.imul(b,V)|0))<<13)|0;u=((o=Math.imul(b,X))+(n>>>13)|0)+(_t>>>26)|0,_t&=67108863,a=Math.imul(p,V),n=(n=Math.imul(p,X))+Math.imul(B,V)|0,o=Math.imul(B,X);var kt=(u+(a=a+Math.imul(l,et)|0)|0)+((8191&(n=(n=n+Math.imul(l,tt)|0)+Math.imul(b,et)|0))<<13)|0;u=((o=o+Math.imul(b,tt)|0)+(n>>>13)|0)+(kt>>>26)|0,kt&=67108863,a=Math.imul(I,V),n=(n=Math.imul(I,X))+Math.imul(y,V)|0,o=Math.imul(y,X),a=a+Math.imul(p,et)|0,n=(n=n+Math.imul(p,tt)|0)+Math.imul(B,et)|0,o=o+Math.imul(B,tt)|0;var St=(u+(a=a+Math.imul(l,at)|0)|0)+((8191&(n=(n=n+Math.imul(l,it)|0)+Math.imul(b,at)|0))<<13)|0;u=((o=o+Math.imul(b,it)|0)+(n>>>13)|0)+(St>>>26)|0,St&=67108863,a=Math.imul(x,V),n=(n=Math.imul(x,X))+Math.imul(C,V)|0,o=Math.imul(C,X),a=a+Math.imul(I,et)|0,n=(n=n+Math.imul(I,tt)|0)+Math.imul(y,et)|0,o=o+Math.imul(y,tt)|0,a=a+Math.imul(p,at)|0,n=(n=n+Math.imul(p,it)|0)+Math.imul(B,at)|0,o=o+Math.imul(B,it)|0;var Nt=(u+(a=a+Math.imul(l,ot)|0)|0)+((8191&(n=(n=n+Math.imul(l,At)|0)+Math.imul(b,ot)|0))<<13)|0;u=((o=o+Math.imul(b,At)|0)+(n>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,a=Math.imul(w,V),n=(n=Math.imul(w,X))+Math.imul(_,V)|0,o=Math.imul(_,X),a=a+Math.imul(x,et)|0,n=(n=n+Math.imul(x,tt)|0)+Math.imul(C,et)|0,o=o+Math.imul(C,tt)|0,a=a+Math.imul(I,at)|0,n=(n=n+Math.imul(I,it)|0)+Math.imul(y,at)|0,o=o+Math.imul(y,it)|0,a=a+Math.imul(p,ot)|0,n=(n=n+Math.imul(p,At)|0)+Math.imul(B,ot)|0,o=o+Math.imul(B,At)|0;var Dt=(u+(a=a+Math.imul(l,ct)|0)|0)+((8191&(n=(n=n+Math.imul(l,dt)|0)+Math.imul(b,ct)|0))<<13)|0;u=((o=o+Math.imul(b,dt)|0)+(n>>>13)|0)+(Dt>>>26)|0,Dt&=67108863,a=Math.imul(N,V),n=(n=Math.imul(N,X))+Math.imul(D,V)|0,o=Math.imul(D,X),a=a+Math.imul(w,et)|0,n=(n=n+Math.imul(w,tt)|0)+Math.imul(_,et)|0,o=o+Math.imul(_,tt)|0,a=a+Math.imul(x,at)|0,n=(n=n+Math.imul(x,it)|0)+Math.imul(C,at)|0,o=o+Math.imul(C,it)|0,a=a+Math.imul(I,ot)|0,n=(n=n+Math.imul(I,At)|0)+Math.imul(y,ot)|0,o=o+Math.imul(y,At)|0,a=a+Math.imul(p,ct)|0,n=(n=n+Math.imul(p,dt)|0)+Math.imul(B,ct)|0,o=o+Math.imul(B,dt)|0;var Rt=(u+(a=a+Math.imul(l,ht)|0)|0)+((8191&(n=(n=n+Math.imul(l,bt)|0)+Math.imul(b,ht)|0))<<13)|0;u=((o=o+Math.imul(b,bt)|0)+(n>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,a=Math.imul(G,V),n=(n=Math.imul(G,X))+Math.imul(T,V)|0,o=Math.imul(T,X),a=a+Math.imul(N,et)|0,n=(n=n+Math.imul(N,tt)|0)+Math.imul(D,et)|0,o=o+Math.imul(D,tt)|0,a=a+Math.imul(w,at)|0,n=(n=n+Math.imul(w,it)|0)+Math.imul(_,at)|0,o=o+Math.imul(_,it)|0,a=a+Math.imul(x,ot)|0,n=(n=n+Math.imul(x,At)|0)+Math.imul(C,ot)|0,o=o+Math.imul(C,At)|0,a=a+Math.imul(I,ct)|0,n=(n=n+Math.imul(I,dt)|0)+Math.imul(y,ct)|0,o=o+Math.imul(y,dt)|0,a=a+Math.imul(p,ht)|0,n=(n=n+Math.imul(p,bt)|0)+Math.imul(B,ht)|0,o=o+Math.imul(B,bt)|0;var Ft=(u+(a=a+Math.imul(l,Bt)|0)|0)+((8191&(n=(n=n+Math.imul(l,mt)|0)+Math.imul(b,Bt)|0))<<13)|0;u=((o=o+Math.imul(b,mt)|0)+(n>>>13)|0)+(Ft>>>26)|0,Ft&=67108863,a=Math.imul(P,V),n=(n=Math.imul(P,X))+Math.imul(q,V)|0,o=Math.imul(q,X),a=a+Math.imul(G,et)|0,n=(n=n+Math.imul(G,tt)|0)+Math.imul(T,et)|0,o=o+Math.imul(T,tt)|0,a=a+Math.imul(N,at)|0,n=(n=n+Math.imul(N,it)|0)+Math.imul(D,at)|0,o=o+Math.imul(D,it)|0,a=a+Math.imul(w,ot)|0,n=(n=n+Math.imul(w,At)|0)+Math.imul(_,ot)|0,o=o+Math.imul(_,At)|0,a=a+Math.imul(x,ct)|0,n=(n=n+Math.imul(x,dt)|0)+Math.imul(C,ct)|0,o=o+Math.imul(C,dt)|0,a=a+Math.imul(I,ht)|0,n=(n=n+Math.imul(I,bt)|0)+Math.imul(y,ht)|0,o=o+Math.imul(y,bt)|0,a=a+Math.imul(p,Bt)|0,n=(n=n+Math.imul(p,mt)|0)+Math.imul(B,Bt)|0,o=o+Math.imul(B,mt)|0;var Ut=(u+(a=a+Math.imul(l,Et)|0)|0)+((8191&(n=(n=n+Math.imul(l,yt)|0)+Math.imul(b,Et)|0))<<13)|0;u=((o=o+Math.imul(b,yt)|0)+(n>>>13)|0)+(Ut>>>26)|0,Ut&=67108863,a=Math.imul(H,V),n=(n=Math.imul(H,X))+Math.imul(Y,V)|0,o=Math.imul(Y,X),a=a+Math.imul(P,et)|0,n=(n=n+Math.imul(P,tt)|0)+Math.imul(q,et)|0,o=o+Math.imul(q,tt)|0,a=a+Math.imul(G,at)|0,n=(n=n+Math.imul(G,it)|0)+Math.imul(T,at)|0,o=o+Math.imul(T,it)|0,a=a+Math.imul(N,ot)|0,n=(n=n+Math.imul(N,At)|0)+Math.imul(D,ot)|0,o=o+Math.imul(D,At)|0,a=a+Math.imul(w,ct)|0,n=(n=n+Math.imul(w,dt)|0)+Math.imul(_,ct)|0,o=o+Math.imul(_,dt)|0,a=a+Math.imul(x,ht)|0,n=(n=n+Math.imul(x,bt)|0)+Math.imul(C,ht)|0,o=o+Math.imul(C,bt)|0,a=a+Math.imul(I,Bt)|0,n=(n=n+Math.imul(I,mt)|0)+Math.imul(y,Bt)|0,o=o+Math.imul(y,mt)|0,a=a+Math.imul(p,Et)|0,n=(n=n+Math.imul(p,yt)|0)+Math.imul(B,Et)|0,o=o+Math.imul(B,yt)|0;var Gt=(u+(a=a+Math.imul(l,xt)|0)|0)+((8191&(n=(n=n+Math.imul(l,Ct)|0)+Math.imul(b,xt)|0))<<13)|0;u=((o=o+Math.imul(b,Ct)|0)+(n>>>13)|0)+(Gt>>>26)|0,Gt&=67108863,a=Math.imul(J,V),n=(n=Math.imul(J,X))+Math.imul(z,V)|0,o=Math.imul(z,X),a=a+Math.imul(H,et)|0,n=(n=n+Math.imul(H,tt)|0)+Math.imul(Y,et)|0,o=o+Math.imul(Y,tt)|0,a=a+Math.imul(P,at)|0,n=(n=n+Math.imul(P,it)|0)+Math.imul(q,at)|0,o=o+Math.imul(q,it)|0,a=a+Math.imul(G,ot)|0,n=(n=n+Math.imul(G,At)|0)+Math.imul(T,ot)|0,o=o+Math.imul(T,At)|0,a=a+Math.imul(N,ct)|0,n=(n=n+Math.imul(N,dt)|0)+Math.imul(D,ct)|0,o=o+Math.imul(D,dt)|0,a=a+Math.imul(w,ht)|0,n=(n=n+Math.imul(w,bt)|0)+Math.imul(_,ht)|0,o=o+Math.imul(_,bt)|0,a=a+Math.imul(x,Bt)|0,n=(n=n+Math.imul(x,mt)|0)+Math.imul(C,Bt)|0,o=o+Math.imul(C,mt)|0,a=a+Math.imul(I,Et)|0,n=(n=n+Math.imul(I,yt)|0)+Math.imul(y,Et)|0,o=o+Math.imul(y,yt)|0,a=a+Math.imul(p,xt)|0,n=(n=n+Math.imul(p,Ct)|0)+Math.imul(B,xt)|0,o=o+Math.imul(B,Ct)|0;var Tt=(u+(a=a+Math.imul(l,wt)|0)|0)+((8191&(n=(n=n+Math.imul(l,Mt)|0)+Math.imul(b,wt)|0))<<13)|0;u=((o=o+Math.imul(b,Mt)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,a=Math.imul(J,et),n=(n=Math.imul(J,tt))+Math.imul(z,et)|0,o=Math.imul(z,tt),a=a+Math.imul(H,at)|0,n=(n=n+Math.imul(H,it)|0)+Math.imul(Y,at)|0,o=o+Math.imul(Y,it)|0,a=a+Math.imul(P,ot)|0,n=(n=n+Math.imul(P,At)|0)+Math.imul(q,ot)|0,o=o+Math.imul(q,At)|0,a=a+Math.imul(G,ct)|0,n=(n=n+Math.imul(G,dt)|0)+Math.imul(T,ct)|0,o=o+Math.imul(T,dt)|0,a=a+Math.imul(N,ht)|0,n=(n=n+Math.imul(N,bt)|0)+Math.imul(D,ht)|0,o=o+Math.imul(D,bt)|0,a=a+Math.imul(w,Bt)|0,n=(n=n+Math.imul(w,mt)|0)+Math.imul(_,Bt)|0,o=o+Math.imul(_,mt)|0,a=a+Math.imul(x,Et)|0,n=(n=n+Math.imul(x,yt)|0)+Math.imul(C,Et)|0,o=o+Math.imul(C,yt)|0,a=a+Math.imul(I,xt)|0,n=(n=n+Math.imul(I,Ct)|0)+Math.imul(y,xt)|0,o=o+Math.imul(y,Ct)|0;var Lt=(u+(a=a+Math.imul(p,wt)|0)|0)+((8191&(n=(n=n+Math.imul(p,Mt)|0)+Math.imul(B,wt)|0))<<13)|0;u=((o=o+Math.imul(B,Mt)|0)+(n>>>13)|0)+(Lt>>>26)|0,Lt&=67108863,a=Math.imul(J,at),n=(n=Math.imul(J,it))+Math.imul(z,at)|0,o=Math.imul(z,it),a=a+Math.imul(H,ot)|0,n=(n=n+Math.imul(H,At)|0)+Math.imul(Y,ot)|0,o=o+Math.imul(Y,At)|0,a=a+Math.imul(P,ct)|0,n=(n=n+Math.imul(P,dt)|0)+Math.imul(q,ct)|0,o=o+Math.imul(q,dt)|0,a=a+Math.imul(G,ht)|0,n=(n=n+Math.imul(G,bt)|0)+Math.imul(T,ht)|0,o=o+Math.imul(T,bt)|0,a=a+Math.imul(N,Bt)|0,n=(n=n+Math.imul(N,mt)|0)+Math.imul(D,Bt)|0,o=o+Math.imul(D,mt)|0,a=a+Math.imul(w,Et)|0,n=(n=n+Math.imul(w,yt)|0)+Math.imul(_,Et)|0,o=o+Math.imul(_,yt)|0,a=a+Math.imul(x,xt)|0,n=(n=n+Math.imul(x,Ct)|0)+Math.imul(C,xt)|0,o=o+Math.imul(C,Ct)|0;var Pt=(u+(a=a+Math.imul(I,wt)|0)|0)+((8191&(n=(n=n+Math.imul(I,Mt)|0)+Math.imul(y,wt)|0))<<13)|0;u=((o=o+Math.imul(y,Mt)|0)+(n>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,a=Math.imul(J,ot),n=(n=Math.imul(J,At))+Math.imul(z,ot)|0,o=Math.imul(z,At),a=a+Math.imul(H,ct)|0,n=(n=n+Math.imul(H,dt)|0)+Math.imul(Y,ct)|0,o=o+Math.imul(Y,dt)|0,a=a+Math.imul(P,ht)|0,n=(n=n+Math.imul(P,bt)|0)+Math.imul(q,ht)|0,o=o+Math.imul(q,bt)|0,a=a+Math.imul(G,Bt)|0,n=(n=n+Math.imul(G,mt)|0)+Math.imul(T,Bt)|0,o=o+Math.imul(T,mt)|0,a=a+Math.imul(N,Et)|0,n=(n=n+Math.imul(N,yt)|0)+Math.imul(D,Et)|0,o=o+Math.imul(D,yt)|0,a=a+Math.imul(w,xt)|0,n=(n=n+Math.imul(w,Ct)|0)+Math.imul(_,xt)|0,o=o+Math.imul(_,Ct)|0;var qt=(u+(a=a+Math.imul(x,wt)|0)|0)+((8191&(n=(n=n+Math.imul(x,Mt)|0)+Math.imul(C,wt)|0))<<13)|0;u=((o=o+Math.imul(C,Mt)|0)+(n>>>13)|0)+(qt>>>26)|0,qt&=67108863,a=Math.imul(J,ct),n=(n=Math.imul(J,dt))+Math.imul(z,ct)|0,o=Math.imul(z,dt),a=a+Math.imul(H,ht)|0,n=(n=n+Math.imul(H,bt)|0)+Math.imul(Y,ht)|0,o=o+Math.imul(Y,bt)|0,a=a+Math.imul(P,Bt)|0,n=(n=n+Math.imul(P,mt)|0)+Math.imul(q,Bt)|0,o=o+Math.imul(q,mt)|0,a=a+Math.imul(G,Et)|0,n=(n=n+Math.imul(G,yt)|0)+Math.imul(T,Et)|0,o=o+Math.imul(T,yt)|0,a=a+Math.imul(N,xt)|0,n=(n=n+Math.imul(N,Ct)|0)+Math.imul(D,xt)|0,o=o+Math.imul(D,Ct)|0;var Ot=(u+(a=a+Math.imul(w,wt)|0)|0)+((8191&(n=(n=n+Math.imul(w,Mt)|0)+Math.imul(_,wt)|0))<<13)|0;u=((o=o+Math.imul(_,Mt)|0)+(n>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,a=Math.imul(J,ht),n=(n=Math.imul(J,bt))+Math.imul(z,ht)|0,o=Math.imul(z,bt),a=a+Math.imul(H,Bt)|0,n=(n=n+Math.imul(H,mt)|0)+Math.imul(Y,Bt)|0,o=o+Math.imul(Y,mt)|0,a=a+Math.imul(P,Et)|0,n=(n=n+Math.imul(P,yt)|0)+Math.imul(q,Et)|0,o=o+Math.imul(q,yt)|0,a=a+Math.imul(G,xt)|0,n=(n=n+Math.imul(G,Ct)|0)+Math.imul(T,xt)|0,o=o+Math.imul(T,Ct)|0;var Ht=(u+(a=a+Math.imul(N,wt)|0)|0)+((8191&(n=(n=n+Math.imul(N,Mt)|0)+Math.imul(D,wt)|0))<<13)|0;u=((o=o+Math.imul(D,Mt)|0)+(n>>>13)|0)+(Ht>>>26)|0,Ht&=67108863,a=Math.imul(J,Bt),n=(n=Math.imul(J,mt))+Math.imul(z,Bt)|0,o=Math.imul(z,mt),a=a+Math.imul(H,Et)|0,n=(n=n+Math.imul(H,yt)|0)+Math.imul(Y,Et)|0,o=o+Math.imul(Y,yt)|0,a=a+Math.imul(P,xt)|0,n=(n=n+Math.imul(P,Ct)|0)+Math.imul(q,xt)|0,o=o+Math.imul(q,Ct)|0;var Yt=(u+(a=a+Math.imul(G,wt)|0)|0)+((8191&(n=(n=n+Math.imul(G,Mt)|0)+Math.imul(T,wt)|0))<<13)|0;u=((o=o+Math.imul(T,Mt)|0)+(n>>>13)|0)+(Yt>>>26)|0,Yt&=67108863,a=Math.imul(J,Et),n=(n=Math.imul(J,yt))+Math.imul(z,Et)|0,o=Math.imul(z,yt),a=a+Math.imul(H,xt)|0,n=(n=n+Math.imul(H,Ct)|0)+Math.imul(Y,xt)|0,o=o+Math.imul(Y,Ct)|0;var jt=(u+(a=a+Math.imul(P,wt)|0)|0)+((8191&(n=(n=n+Math.imul(P,Mt)|0)+Math.imul(q,wt)|0))<<13)|0;u=((o=o+Math.imul(q,Mt)|0)+(n>>>13)|0)+(jt>>>26)|0,jt&=67108863,a=Math.imul(J,xt),n=(n=Math.imul(J,Ct))+Math.imul(z,xt)|0,o=Math.imul(z,Ct);var Jt=(u+(a=a+Math.imul(H,wt)|0)|0)+((8191&(n=(n=n+Math.imul(H,Mt)|0)+Math.imul(Y,wt)|0))<<13)|0;u=((o=o+Math.imul(Y,Mt)|0)+(n>>>13)|0)+(Jt>>>26)|0,Jt&=67108863;var Kt=(u+(a=Math.imul(J,wt))|0)+((8191&(n=(n=Math.imul(J,Mt))+Math.imul(z,wt)|0))<<13)|0;return u=((o=Math.imul(z,Mt))+(n>>>13)|0)+(Kt>>>26)|0,Kt&=67108863,d[0]=_t,d[1]=kt,d[2]=St,d[3]=Nt,d[4]=Dt,d[5]=Rt,d[6]=Ft,d[7]=Ut,d[8]=Gt,d[9]=Tt,d[10]=Lt,d[11]=Pt,d[12]=qt,d[13]=Ot,d[14]=Ht,d[15]=Yt,d[16]=jt,d[17]=Jt,d[18]=Kt,0!==u&&(d[19]=u,r.length++),r};function jumboMulTo(e,t,r){return(new FFTM).mulp(e,t,r)}function FFTM(e,t){this.x=e,this.y=t}Math.imul||(c=smallMulTo),BN.prototype.mulTo=function mulTo(e,t){var r=this.length+e.length;return 10===this.length&&10===e.length?c(this,e,t):r<63?smallMulTo(this,e,t):r<1024?function bigMulTo(e,t,r){r.negative=t.negative^e.negative,r.length=e.length+t.length;for(var a=0,n=0,o=0;o>>26)|0)>>>26,s&=67108863}r.words[o]=c,a=s,s=n}return 0!==a?r.words[o]=a:r.length--,r.strip()}(this,e,t):jumboMulTo(this,e,t)},FFTM.prototype.makeRBT=function makeRBT(e){for(var t=new Array(e),r=BN.prototype._countBits(e)-1,a=0;a>=1;return a},FFTM.prototype.permute=function permute(e,t,r,a,n,o){for(var s=0;s>>=1)n++;return 1<>>=13,r[2*o+1]=8191&n,n>>>=13;for(o=2*t;o>=26,t+=a/67108864|0,t+=n>>>26,this.words[r]=67108863&n}return 0!==t&&(this.words[r]=t,this.length++),this},BN.prototype.muln=function muln(e){return this.clone().imuln(e)},BN.prototype.sqr=function sqr(){return this.mul(this)},BN.prototype.isqr=function isqr(){return this.imul(this.clone())},BN.prototype.pow=function pow(e){var t=function toBitArray(e){for(var t=new Array(e.bitLength()),r=0;r>>n}return t}(e);if(0===t.length)return new BN(1);for(var r=this,a=0;a=0);var t,r=e%26,a=(e-r)/26,n=67108863>>>26-r<<26-r;if(0!==r){var o=0;for(t=0;t>>26-r}o&&(this.words[t]=o,this.length++)}if(0!==a){for(t=this.length-1;t>=0;t--)this.words[t+a]=this.words[t];for(t=0;t=0),a=t?(t-t%26)/26:0;var n=e%26,o=Math.min((e-n)/26,this.length),s=67108863^67108863>>>n<o)for(this.length-=o,d=0;d=0&&(0!==u||d>=a);d--){var h=0|this.words[d];this.words[d]=u<<26-n|h>>>n,u=h&s}return c&&0!==u&&(c.words[c.length++]=u),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},BN.prototype.ishrn=function ishrn(e,t,r){return assert(0===this.negative),this.iushrn(e,t,r)},BN.prototype.shln=function shln(e){return this.clone().ishln(e)},BN.prototype.ushln=function ushln(e){return this.clone().iushln(e)},BN.prototype.shrn=function shrn(e){return this.clone().ishrn(e)},BN.prototype.ushrn=function ushrn(e){return this.clone().iushrn(e)},BN.prototype.testn=function testn(e){assert("number"==typeof e&&e>=0);var t=e%26,r=(e-t)/26,a=1<=0);var t=e%26,r=(e-t)/26;if(assert(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==t&&r++,this.length=Math.min(r,this.length),0!==t){var a=67108863^67108863>>>t<=67108864;t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},BN.prototype.isubn=function isubn(e){if(assert("number"==typeof e),assert(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t>26)-(c/67108864|0),this.words[a+r]=67108863&n}for(;a>26,this.words[a+r]=67108863&n;if(0===s)return this.strip();for(assert(-1===s),s=0,a=0;a>26,this.words[a]=67108863&n;return this.negative=1,this.strip()},BN.prototype._wordDiv=function _wordDiv(e,t){var r=(this.length,e.length),a=this.clone(),n=e,o=0|n.words[n.length-1];0!==(r=26-this._countBits(o))&&(n=n.ushln(r),a.iushln(r),o=0|n.words[n.length-1]);var s,c=a.length-n.length;if("mod"!==t){(s=new BN(null)).length=c+1,s.words=new Array(s.length);for(var d=0;d=0;h--){var l=67108864*(0|a.words[n.length+h])+(0|a.words[n.length+h-1]);for(l=Math.min(l/o|0,67108863),a._ishlnsubmul(n,l,h);0!==a.negative;)l--,a.negative=0,a._ishlnsubmul(n,1,h),a.isZero()||(a.negative^=1);s&&(s.words[h]=l)}return s&&s.strip(),a.strip(),"div"!==t&&0!==r&&a.iushrn(r),{div:s||null,mod:a}},BN.prototype.divmod=function divmod(e,t,r){return assert(!e.isZero()),this.isZero()?{div:new BN(0),mod:new BN(0)}:0!==this.negative&&0===e.negative?(o=this.neg().divmod(e,t),"mod"!==t&&(a=o.div.neg()),"div"!==t&&(n=o.mod.neg(),r&&0!==n.negative&&n.iadd(e)),{div:a,mod:n}):0===this.negative&&0!==e.negative?(o=this.divmod(e.neg(),t),"mod"!==t&&(a=o.div.neg()),{div:a,mod:o.mod}):0!=(this.negative&e.negative)?(o=this.neg().divmod(e.neg(),t),"div"!==t&&(n=o.mod.neg(),r&&0!==n.negative&&n.isub(e)),{div:o.div,mod:n}):e.length>this.length||this.cmp(e)<0?{div:new BN(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new BN(this.modn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new BN(this.modn(e.words[0]))}:this._wordDiv(e,t);var a,n,o},BN.prototype.div=function div(e){return this.divmod(e,"div",!1).div},BN.prototype.mod=function mod(e){return this.divmod(e,"mod",!1).mod},BN.prototype.umod=function umod(e){return this.divmod(e,"mod",!0).mod},BN.prototype.divRound=function divRound(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var r=0!==t.div.negative?t.mod.isub(e):t.mod,a=e.ushrn(1),n=e.andln(1),o=r.cmp(a);return o<0||1===n&&0===o?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},BN.prototype.modn=function modn(e){assert(e<=67108863);for(var t=(1<<26)%e,r=0,a=this.length-1;a>=0;a--)r=(t*r+(0|this.words[a]))%e;return r},BN.prototype.idivn=function idivn(e){assert(e<=67108863);for(var t=0,r=this.length-1;r>=0;r--){var a=(0|this.words[r])+67108864*t;this.words[r]=a/e|0,t=a%e}return this.strip()},BN.prototype.divn=function divn(e){return this.clone().idivn(e)},BN.prototype.egcd=function egcd(e){assert(0===e.negative),assert(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var a=new BN(1),n=new BN(0),o=new BN(0),s=new BN(1),c=0;t.isEven()&&r.isEven();)t.iushrn(1),r.iushrn(1),++c;for(var d=r.clone(),u=t.clone();!t.isZero();){for(var h=0,l=1;0==(t.words[0]&l)&&h<26;++h,l<<=1);if(h>0)for(t.iushrn(h);h-- >0;)(a.isOdd()||n.isOdd())&&(a.iadd(d),n.isub(u)),a.iushrn(1),n.iushrn(1);for(var b=0,g=1;0==(r.words[0]&g)&&b<26;++b,g<<=1);if(b>0)for(r.iushrn(b);b-- >0;)(o.isOdd()||s.isOdd())&&(o.iadd(d),s.isub(u)),o.iushrn(1),s.iushrn(1);t.cmp(r)>=0?(t.isub(r),a.isub(o),n.isub(s)):(r.isub(t),o.isub(a),s.isub(n))}return{a:o,b:s,gcd:r.iushln(c)}},BN.prototype._invmp=function _invmp(e){assert(0===e.negative),assert(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var a,n=new BN(1),o=new BN(0),s=r.clone();t.cmpn(1)>0&&r.cmpn(1)>0;){for(var c=0,d=1;0==(t.words[0]&d)&&c<26;++c,d<<=1);if(c>0)for(t.iushrn(c);c-- >0;)n.isOdd()&&n.iadd(s),n.iushrn(1);for(var u=0,h=1;0==(r.words[0]&h)&&u<26;++u,h<<=1);if(u>0)for(r.iushrn(u);u-- >0;)o.isOdd()&&o.iadd(s),o.iushrn(1);t.cmp(r)>=0?(t.isub(r),n.isub(o)):(r.isub(t),o.isub(n))}return(a=0===t.cmpn(1)?n:o).cmpn(0)<0&&a.iadd(e),a},BN.prototype.gcd=function gcd(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),r=e.clone();t.negative=0,r.negative=0;for(var a=0;t.isEven()&&r.isEven();a++)t.iushrn(1),r.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=t.cmp(r);if(n<0){var o=t;t=r,r=o}else if(0===n||0===r.cmpn(1))break;t.isub(r)}return r.iushln(a)},BN.prototype.invm=function invm(e){return this.egcd(e).a.umod(e)},BN.prototype.isEven=function isEven(){return 0==(1&this.words[0])},BN.prototype.isOdd=function isOdd(){return 1==(1&this.words[0])},BN.prototype.andln=function andln(e){return this.words[0]&e},BN.prototype.bincn=function bincn(e){assert("number"==typeof e);var t=e%26,r=(e-t)/26,a=1<>>26,s&=67108863,this.words[o]=s}return 0!==n&&(this.words[o]=n,this.length++),this},BN.prototype.isZero=function isZero(){return 1===this.length&&0===this.words[0]},BN.prototype.cmpn=function cmpn(e){var t,r=e<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this.strip(),this.length>1)t=1;else{r&&(e=-e),assert(e<=67108863,"Number is too big");var a=0|this.words[0];t=a===e?0:ae.length)return 1;if(this.length=0;r--){var a=0|this.words[r],n=0|e.words[r];if(a!==n){an&&(t=1);break}}return t},BN.prototype.gtn=function gtn(e){return 1===this.cmpn(e)},BN.prototype.gt=function gt(e){return 1===this.cmp(e)},BN.prototype.gten=function gten(e){return this.cmpn(e)>=0},BN.prototype.gte=function gte(e){return this.cmp(e)>=0},BN.prototype.ltn=function ltn(e){return-1===this.cmpn(e)},BN.prototype.lt=function lt(e){return-1===this.cmp(e)},BN.prototype.lten=function lten(e){return this.cmpn(e)<=0},BN.prototype.lte=function lte(e){return this.cmp(e)<=0},BN.prototype.eqn=function eqn(e){return 0===this.cmpn(e)},BN.prototype.eq=function eq(e){return 0===this.cmp(e)},BN.red=function red(e){return new Red(e)},BN.prototype.toRed=function toRed(e){return assert(!this.red,"Already a number in reduction context"),assert(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},BN.prototype.fromRed=function fromRed(){return assert(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},BN.prototype._forceRed=function _forceRed(e){return this.red=e,this},BN.prototype.forceRed=function forceRed(e){return assert(!this.red,"Already a number in reduction context"),this._forceRed(e)},BN.prototype.redAdd=function redAdd(e){return assert(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},BN.prototype.redIAdd=function redIAdd(e){return assert(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},BN.prototype.redSub=function redSub(e){return assert(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},BN.prototype.redISub=function redISub(e){return assert(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},BN.prototype.redShl=function redShl(e){return assert(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},BN.prototype.redMul=function redMul(e){return assert(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},BN.prototype.redIMul=function redIMul(e){return assert(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},BN.prototype.redSqr=function redSqr(){return assert(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},BN.prototype.redISqr=function redISqr(){return assert(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},BN.prototype.redSqrt=function redSqrt(){return assert(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},BN.prototype.redInvm=function redInvm(){return assert(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},BN.prototype.redNeg=function redNeg(){return assert(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},BN.prototype.redPow=function redPow(e){return assert(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var d={k256:null,p224:null,p192:null,p25519:null};function MPrime(e,t){this.name=e,this.p=new BN(t,16),this.n=this.p.bitLength(),this.k=new BN(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function K256(){MPrime.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function P224(){MPrime.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function P192(){MPrime.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function P25519(){MPrime.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function Red(e){if("string"==typeof e){var t=BN._prime(e);this.m=t.p,this.prime=t}else assert(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function Mont(e){Red.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new BN(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)}MPrime.prototype._tmp=function _tmp(){var e=new BN(null);return e.words=new Array(Math.ceil(this.n/13)),e},MPrime.prototype.ireduce=function ireduce(e){var t,r=e;do{this.split(r,this.tmp),t=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(t>this.n);var a=t0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},MPrime.prototype.split=function split(e,t){e.iushrn(this.n,0,t)},MPrime.prototype.imulK=function imulK(e){return e.imul(this.k)},inherits(K256,MPrime),K256.prototype.split=function split(e,t){for(var r=4194303,a=Math.min(e.length,9),n=0;n>>22,o=s}o>>>=22,e.words[n-10]=o,0===o&&e.length>10?e.length-=10:e.length-=9},K256.prototype.imulK=function imulK(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,r=0;r>>=26,e.words[r]=n,t=a}return 0!==t&&(e.words[e.length++]=t),e},BN._prime=function prime(e){if(d[e])return d[e];var prime;if("k256"===e)prime=new K256;else if("p224"===e)prime=new P224;else if("p192"===e)prime=new P192;else{if("p25519"!==e)throw new Error("Unknown prime "+e);prime=new P25519}return d[e]=prime,prime},Red.prototype._verify1=function _verify1(e){assert(0===e.negative,"red works only with positives"),assert(e.red,"red works only with red numbers")},Red.prototype._verify2=function _verify2(e,t){assert(0==(e.negative|t.negative),"red works only with positives"),assert(e.red&&e.red===t.red,"red works only with red numbers")},Red.prototype.imod=function imod(e){return this.prime?this.prime.ireduce(e)._forceRed(this):e.umod(this.m)._forceRed(this)},Red.prototype.neg=function neg(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},Red.prototype.add=function add(e,t){this._verify2(e,t);var r=e.add(t);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},Red.prototype.iadd=function iadd(e,t){this._verify2(e,t);var r=e.iadd(t);return r.cmp(this.m)>=0&&r.isub(this.m),r},Red.prototype.sub=function sub(e,t){this._verify2(e,t);var r=e.sub(t);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},Red.prototype.isub=function isub(e,t){this._verify2(e,t);var r=e.isub(t);return r.cmpn(0)<0&&r.iadd(this.m),r},Red.prototype.shl=function shl(e,t){return this._verify1(e),this.imod(e.ushln(t))},Red.prototype.imul=function imul(e,t){return this._verify2(e,t),this.imod(e.imul(t))},Red.prototype.mul=function mul(e,t){return this._verify2(e,t),this.imod(e.mul(t))},Red.prototype.isqr=function isqr(e){return this.imul(e,e.clone())},Red.prototype.sqr=function sqr(e){return this.mul(e,e)},Red.prototype.sqrt=function sqrt(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(assert(t%2==1),3===t){var r=this.m.add(new BN(1)).iushrn(2);return this.pow(e,r)}for(var a=this.m.subn(1),n=0;!a.isZero()&&0===a.andln(1);)n++,a.iushrn(1);assert(!a.isZero());var o=new BN(1).toRed(this),s=o.redNeg(),c=this.m.subn(1).iushrn(1),d=this.m.bitLength();for(d=new BN(2*d*d).toRed(this);0!==this.pow(d,c).cmp(s);)d.redIAdd(s);for(var u=this.pow(d,a),h=this.pow(e,a.addn(1).iushrn(1)),l=this.pow(e,a),b=n;0!==l.cmp(o);){for(var g=l,p=0;0!==g.cmp(o);p++)g=g.redSqr();assert(p=0;a--){for(var d=t.words[a],u=c-1;u>=0;u--){var h=d>>u&1;n!==r[0]&&(n=this.sqr(n)),0!==h||0!==o?(o<<=1,o|=h,(4===++s||0===a&&0===u)&&(n=this.mul(n,r[o]),s=0,o=0)):s=0}c=26}return n},Red.prototype.convertTo=function convertTo(e){var t=e.umod(this.m);return t===e?t.clone():t},Red.prototype.convertFrom=function convertFrom(e){var t=e.clone();return t.red=null,t},BN.mont=function mont(e){return new Mont(e)},inherits(Mont,Red),Mont.prototype.convertTo=function convertTo(e){return this.imod(e.ushln(this.shift))},Mont.prototype.convertFrom=function convertFrom(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},Mont.prototype.imul=function imul(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var r=e.imul(t),a=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(a).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},Mont.prototype.mul=function mul(e,t){if(e.isZero()||t.isZero())return new BN(0)._forceRed(this);var r=e.mul(t),a=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(a).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},Mont.prototype.invm=function invm(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(e=r.nmd(e),this)},function(e,t,r){"use strict";var a=r(4).Buffer,n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.computeIntrinsicsFeeMarketTx=t.computeIntrinsicsAccessListTx=t.computeIntrinsicsLegacyTx=t.computeFromAddress=t.publicKeyConvert=t.ecdsaRecover=t.isValidSigRecovery=void 0;const o=r(8),s=r(46),c=r(47),d=n(r(349));function copyOrFill(e,t,r,a){if(e.byteLength>a)throw new Error("Invalid signature");const n=a-e.byteLength,o=r+n;let s=r;for(;s1===e||0===e;function _ecdsaRecover(e,r,a,n,s){if(!t.isValidSigRecovery(s))throw new Error("Invalid signature v value");const c=o.keccak(e),u=r.slice(0,64);copyOrFill(a,u,0,32),copyOrFill(n,u,32,32);const h=r.slice(0,33);if(0!==d.default.ecdsaRecover(h,u,s,c))throw new Error("Invalid Signature");return h}t.ecdsaRecover=(e,t,r,a,n,c)=>{let d,u;const h=2*a+35;if(r===h||r===h+1){const t=[0===(l=a)?o.BUFFER_EMPTY:o.uintToBuffer(l),o.BUFFER_EMPTY,o.BUFFER_EMPTY],n=s.encodeRange(t,0,3);d=s.digest([e.output,n.output],e.length+n.length),u=r-h}else d=s.digest([e.output],e.length),u=r-27;var l;return _ecdsaRecover(d,t,n,c,u)};t.publicKeyConvert=(e,t)=>{const r=e.slice(0,65);if(0!==d.default.publicKeyConvert(r,t))throw new Error("Invalid Signature");return r};const u=a.allocUnsafe(65);t.computeFromAddress=(e,r,a,n,s)=>{const d=t.ecdsaRecover(e,u,r,s,a,n),h=t.publicKeyConvert(u,d);return c.Address.from(o.keccak(h.slice(1)).slice(-20))};t.computeIntrinsicsLegacyTx=(e,r,a)=>{const n=s.encodeRange(r,0,6),c=s.encodeRange(r,6,3),d=s.digest([n.output,c.output],n.length+c.length);return{from:t.computeFromAddress(n,e.toNumber(),r[7],r[8],a),hash:o.Data.from(o.keccak(d),32),serialized:d,encodedData:n,encodedSignature:c}};t.computeIntrinsicsAccessListTx=(e,r)=>{const n=r[0],d=s.encodeRange(r,1,8),h=s.encodeRange(r,9,3),l=a.concat([n,s.digest([d.output,h.output],d.length+h.length)]),b=_ecdsaRecover(a.concat([n,s.digest([d.output],d.length)]),u,r[10],r[11],e.toNumber()),g=t.publicKeyConvert(u,b);return{from:c.Address.from(o.keccak(g.slice(1)).slice(-20)),hash:o.Data.from(o.keccak(l),32),serialized:l,encodedData:d,encodedSignature:h}};t.computeIntrinsicsFeeMarketTx=(e,r)=>{const n=r[0],d=s.encodeRange(r,1,9),h=s.encodeRange(r,10,3),l=a.concat([n,s.digest([d.output,h.output],d.length+h.length)]),b=_ecdsaRecover(a.concat([n,s.digest([d.output],d.length)]),u,r[11],r[12],e.toNumber()),g=t.publicKeyConvert(u,b);return{from:c.Address.from(o.keccak(g.slice(1)).slice(-20)),hash:o.Data.from(o.keccak(l),32),serialized:l,encodedData:d,encodedSignature:h}}},function(e,t,r){!function(e,t){"use strict";function assert(e,t){if(!e)throw new Error(t||"Assertion failed")}function inherits(e,t){e.super_=t;var TempCtor=function(){};TempCtor.prototype=t.prototype,e.prototype=new TempCtor,e.prototype.constructor=e}function BN(e,t,r){if(BN.isBN(e))return e;this.negative=0,this.words=null,this.length=0,this.red=null,null!==e&&("le"!==t&&"be"!==t||(r=t,t=10),this._init(e||0,t||10,r||"be"))}var a;"object"==typeof e?e.exports=BN:t.BN=BN,BN.BN=BN,BN.wordSize=26;try{a="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:r(17).Buffer}catch(e){}function parseHex4Bits(e,t){var r=e.charCodeAt(t);return r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:r-48&15}function parseHexByte(e,t,r){var a=parseHex4Bits(e,r);return r-1>=t&&(a|=parseHex4Bits(e,r-1)<<4),a}function parseBase(e,t,r,a){for(var n=0,o=Math.min(e.length,r),s=t;s=49?c-49+10:c>=17?c-17+10:c}return n}BN.isBN=function isBN(e){return e instanceof BN||null!==e&&"object"==typeof e&&e.constructor.wordSize===BN.wordSize&&Array.isArray(e.words)},BN.max=function max(e,t){return e.cmp(t)>0?e:t},BN.min=function min(e,t){return e.cmp(t)<0?e:t},BN.prototype._init=function init(e,t,r){if("number"==typeof e)return this._initNumber(e,t,r);if("object"==typeof e)return this._initArray(e,t,r);"hex"===t&&(t=16),assert(t===(0|t)&&t>=2&&t<=36);var a=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&(a++,this.negative=1),a=0;a-=3)o=e[a]|e[a-1]<<8|e[a-2]<<16,this.words[n]|=o<>>26-s&67108863,(s+=24)>=26&&(s-=26,n++);else if("le"===r)for(a=0,n=0;a>>26-s&67108863,(s+=24)>=26&&(s-=26,n++);return this.strip()},BN.prototype._parseHex=function _parseHex(e,t,r){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var a=0;a=t;a-=2)n=parseHexByte(e,t,a)<=18?(o-=18,s+=1,this.words[s]|=n>>>26):o+=8;else for(a=(e.length-t)%2==0?t+1:t;a=18?(o-=18,s+=1,this.words[s]|=n>>>26):o+=8;this.strip()},BN.prototype._parseBase=function _parseBase(e,t,r){this.words=[0],this.length=1;for(var a=0,n=1;n<=67108863;n*=t)a++;a--,n=n/t|0;for(var o=e.length-r,s=o%a,c=Math.min(o,o-s)+r,d=0,u=r;u1&&0===this.words[this.length-1];)this.length--;return this._normSign()},BN.prototype._normSign=function _normSign(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},BN.prototype.inspect=function inspect(){return(this.red?""};var n=["","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"],o=[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],s=[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 smallMulTo(e,t,r){r.negative=t.negative^e.negative;var a=e.length+t.length|0;r.length=a,a=a-1|0;var n=0|e.words[0],o=0|t.words[0],s=n*o,c=67108863&s,d=s/67108864|0;r.words[0]=c;for(var u=1;u>>26,l=67108863&d,b=Math.min(u,t.length-1),g=Math.max(0,u-e.length+1);g<=b;g++){var p=u-g|0;h+=(s=(n=0|e.words[p])*(o=0|t.words[g])+l)/67108864|0,l=67108863&s}r.words[u]=0|l,d=0|h}return 0!==d?r.words[u]=0|d:r.length--,r.strip()}BN.prototype.toString=function toString(e,t){var r;if(t=0|t||1,16===(e=e||10)||"hex"===e){r="";for(var a=0,c=0,d=0;d>>24-a&16777215)||d!==this.length-1?n[6-h.length]+h+r:h+r,(a+=2)>=26&&(a-=26,d--)}for(0!==c&&(r=c.toString(16)+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(e===(0|e)&&e>=2&&e<=36){var l=o[e],b=s[e];r="";var g=this.clone();for(g.negative=0;!g.isZero();){var p=g.modn(b).toString(e);r=(g=g.idivn(b)).isZero()?p+r:n[l-p.length]+p+r}for(this.isZero()&&(r="0"+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}assert(!1,"Base should be between 2 and 36")},BN.prototype.toNumber=function toNumber(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&assert(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},BN.prototype.toJSON=function toJSON(){return this.toString(16)},BN.prototype.toBuffer=function toBuffer(e,t){return assert(void 0!==a),this.toArrayLike(a,e,t)},BN.prototype.toArray=function toArray(e,t){return this.toArrayLike(Array,e,t)},BN.prototype.toArrayLike=function toArrayLike(e,t,r){var a=this.byteLength(),n=r||Math.max(1,a);assert(a<=n,"byte array longer than desired length"),assert(n>0,"Requested array length <= 0"),this.strip();var o,s,c="le"===t,d=new e(n),u=this.clone();if(c){for(s=0;!u.isZero();s++)o=u.andln(255),u.iushrn(8),d[s]=o;for(;s=4096&&(r+=13,t>>>=13),t>=64&&(r+=7,t>>>=7),t>=8&&(r+=4,t>>>=4),t>=2&&(r+=2,t>>>=2),r+t},BN.prototype._zeroBits=function _zeroBits(e){if(0===e)return 26;var t=e,r=0;return 0==(8191&t)&&(r+=13,t>>>=13),0==(127&t)&&(r+=7,t>>>=7),0==(15&t)&&(r+=4,t>>>=4),0==(3&t)&&(r+=2,t>>>=2),0==(1&t)&&r++,r},BN.prototype.bitLength=function bitLength(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},BN.prototype.zeroBits=function zeroBits(){if(this.isZero())return 0;for(var e=0,t=0;te.length?this.clone().ior(e):e.clone().ior(this)},BN.prototype.uor=function uor(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},BN.prototype.iuand=function iuand(e){var t;t=this.length>e.length?e:this;for(var r=0;re.length?this.clone().iand(e):e.clone().iand(this)},BN.prototype.uand=function uand(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},BN.prototype.iuxor=function iuxor(e){var t,r;this.length>e.length?(t=this,r=e):(t=e,r=this);for(var a=0;ae.length?this.clone().ixor(e):e.clone().ixor(this)},BN.prototype.uxor=function uxor(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},BN.prototype.inotn=function inotn(e){assert("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),r=e%26;this._expand(t),r>0&&t--;for(var a=0;a0&&(this.words[a]=~this.words[a]&67108863>>26-r),this.strip()},BN.prototype.notn=function notn(e){return this.clone().inotn(e)},BN.prototype.setn=function setn(e,t){assert("number"==typeof e&&e>=0);var r=e/26|0,a=e%26;return this._expand(r+1),this.words[r]=t?this.words[r]|1<e.length?(r=this,a=e):(r=e,a=this);for(var n=0,o=0;o>>26;for(;0!==n&&o>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;oe.length?this.clone().iadd(e):e.clone().iadd(this)},BN.prototype.isub=function isub(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var r,a,n=this.cmp(e);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,a=e):(r=e,a=this);for(var o=0,s=0;s>26,this.words[s]=67108863&t;for(;0!==o&&s>26,this.words[s]=67108863&t;if(0===o&&s>>13,g=0|s[1],p=8191&g,B=g>>>13,m=0|s[2],I=8191&m,y=m>>>13,v=0|s[3],x=8191&v,C=v>>>13,Q=0|s[4],w=8191&Q,_=Q>>>13,k=0|s[5],N=8191&k,D=k>>>13,U=0|s[6],G=8191&U,T=U>>>13,L=0|s[7],P=8191&L,q=L>>>13,O=0|s[8],H=8191&O,Y=O>>>13,j=0|s[9],J=8191&j,z=j>>>13,W=0|c[0],V=8191&W,X=W>>>13,$=0|c[1],et=8191&$,tt=$>>>13,rt=0|c[2],at=8191&rt,it=rt>>>13,nt=0|c[3],ot=8191&nt,At=nt>>>13,st=0|c[4],ct=8191&st,dt=st>>>13,ut=0|c[5],ht=8191&ut,bt=ut>>>13,pt=0|c[6],Bt=8191&pt,mt=pt>>>13,It=0|c[7],Et=8191&It,yt=It>>>13,vt=0|c[8],xt=8191&vt,Ct=vt>>>13,Qt=0|c[9],wt=8191&Qt,Mt=Qt>>>13;r.negative=e.negative^t.negative,r.length=19;var _t=(u+(a=Math.imul(l,V))|0)+((8191&(n=(n=Math.imul(l,X))+Math.imul(b,V)|0))<<13)|0;u=((o=Math.imul(b,X))+(n>>>13)|0)+(_t>>>26)|0,_t&=67108863,a=Math.imul(p,V),n=(n=Math.imul(p,X))+Math.imul(B,V)|0,o=Math.imul(B,X);var kt=(u+(a=a+Math.imul(l,et)|0)|0)+((8191&(n=(n=n+Math.imul(l,tt)|0)+Math.imul(b,et)|0))<<13)|0;u=((o=o+Math.imul(b,tt)|0)+(n>>>13)|0)+(kt>>>26)|0,kt&=67108863,a=Math.imul(I,V),n=(n=Math.imul(I,X))+Math.imul(y,V)|0,o=Math.imul(y,X),a=a+Math.imul(p,et)|0,n=(n=n+Math.imul(p,tt)|0)+Math.imul(B,et)|0,o=o+Math.imul(B,tt)|0;var St=(u+(a=a+Math.imul(l,at)|0)|0)+((8191&(n=(n=n+Math.imul(l,it)|0)+Math.imul(b,at)|0))<<13)|0;u=((o=o+Math.imul(b,it)|0)+(n>>>13)|0)+(St>>>26)|0,St&=67108863,a=Math.imul(x,V),n=(n=Math.imul(x,X))+Math.imul(C,V)|0,o=Math.imul(C,X),a=a+Math.imul(I,et)|0,n=(n=n+Math.imul(I,tt)|0)+Math.imul(y,et)|0,o=o+Math.imul(y,tt)|0,a=a+Math.imul(p,at)|0,n=(n=n+Math.imul(p,it)|0)+Math.imul(B,at)|0,o=o+Math.imul(B,it)|0;var Nt=(u+(a=a+Math.imul(l,ot)|0)|0)+((8191&(n=(n=n+Math.imul(l,At)|0)+Math.imul(b,ot)|0))<<13)|0;u=((o=o+Math.imul(b,At)|0)+(n>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,a=Math.imul(w,V),n=(n=Math.imul(w,X))+Math.imul(_,V)|0,o=Math.imul(_,X),a=a+Math.imul(x,et)|0,n=(n=n+Math.imul(x,tt)|0)+Math.imul(C,et)|0,o=o+Math.imul(C,tt)|0,a=a+Math.imul(I,at)|0,n=(n=n+Math.imul(I,it)|0)+Math.imul(y,at)|0,o=o+Math.imul(y,it)|0,a=a+Math.imul(p,ot)|0,n=(n=n+Math.imul(p,At)|0)+Math.imul(B,ot)|0,o=o+Math.imul(B,At)|0;var Dt=(u+(a=a+Math.imul(l,ct)|0)|0)+((8191&(n=(n=n+Math.imul(l,dt)|0)+Math.imul(b,ct)|0))<<13)|0;u=((o=o+Math.imul(b,dt)|0)+(n>>>13)|0)+(Dt>>>26)|0,Dt&=67108863,a=Math.imul(N,V),n=(n=Math.imul(N,X))+Math.imul(D,V)|0,o=Math.imul(D,X),a=a+Math.imul(w,et)|0,n=(n=n+Math.imul(w,tt)|0)+Math.imul(_,et)|0,o=o+Math.imul(_,tt)|0,a=a+Math.imul(x,at)|0,n=(n=n+Math.imul(x,it)|0)+Math.imul(C,at)|0,o=o+Math.imul(C,it)|0,a=a+Math.imul(I,ot)|0,n=(n=n+Math.imul(I,At)|0)+Math.imul(y,ot)|0,o=o+Math.imul(y,At)|0,a=a+Math.imul(p,ct)|0,n=(n=n+Math.imul(p,dt)|0)+Math.imul(B,ct)|0,o=o+Math.imul(B,dt)|0;var Rt=(u+(a=a+Math.imul(l,ht)|0)|0)+((8191&(n=(n=n+Math.imul(l,bt)|0)+Math.imul(b,ht)|0))<<13)|0;u=((o=o+Math.imul(b,bt)|0)+(n>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,a=Math.imul(G,V),n=(n=Math.imul(G,X))+Math.imul(T,V)|0,o=Math.imul(T,X),a=a+Math.imul(N,et)|0,n=(n=n+Math.imul(N,tt)|0)+Math.imul(D,et)|0,o=o+Math.imul(D,tt)|0,a=a+Math.imul(w,at)|0,n=(n=n+Math.imul(w,it)|0)+Math.imul(_,at)|0,o=o+Math.imul(_,it)|0,a=a+Math.imul(x,ot)|0,n=(n=n+Math.imul(x,At)|0)+Math.imul(C,ot)|0,o=o+Math.imul(C,At)|0,a=a+Math.imul(I,ct)|0,n=(n=n+Math.imul(I,dt)|0)+Math.imul(y,ct)|0,o=o+Math.imul(y,dt)|0,a=a+Math.imul(p,ht)|0,n=(n=n+Math.imul(p,bt)|0)+Math.imul(B,ht)|0,o=o+Math.imul(B,bt)|0;var Ft=(u+(a=a+Math.imul(l,Bt)|0)|0)+((8191&(n=(n=n+Math.imul(l,mt)|0)+Math.imul(b,Bt)|0))<<13)|0;u=((o=o+Math.imul(b,mt)|0)+(n>>>13)|0)+(Ft>>>26)|0,Ft&=67108863,a=Math.imul(P,V),n=(n=Math.imul(P,X))+Math.imul(q,V)|0,o=Math.imul(q,X),a=a+Math.imul(G,et)|0,n=(n=n+Math.imul(G,tt)|0)+Math.imul(T,et)|0,o=o+Math.imul(T,tt)|0,a=a+Math.imul(N,at)|0,n=(n=n+Math.imul(N,it)|0)+Math.imul(D,at)|0,o=o+Math.imul(D,it)|0,a=a+Math.imul(w,ot)|0,n=(n=n+Math.imul(w,At)|0)+Math.imul(_,ot)|0,o=o+Math.imul(_,At)|0,a=a+Math.imul(x,ct)|0,n=(n=n+Math.imul(x,dt)|0)+Math.imul(C,ct)|0,o=o+Math.imul(C,dt)|0,a=a+Math.imul(I,ht)|0,n=(n=n+Math.imul(I,bt)|0)+Math.imul(y,ht)|0,o=o+Math.imul(y,bt)|0,a=a+Math.imul(p,Bt)|0,n=(n=n+Math.imul(p,mt)|0)+Math.imul(B,Bt)|0,o=o+Math.imul(B,mt)|0;var Ut=(u+(a=a+Math.imul(l,Et)|0)|0)+((8191&(n=(n=n+Math.imul(l,yt)|0)+Math.imul(b,Et)|0))<<13)|0;u=((o=o+Math.imul(b,yt)|0)+(n>>>13)|0)+(Ut>>>26)|0,Ut&=67108863,a=Math.imul(H,V),n=(n=Math.imul(H,X))+Math.imul(Y,V)|0,o=Math.imul(Y,X),a=a+Math.imul(P,et)|0,n=(n=n+Math.imul(P,tt)|0)+Math.imul(q,et)|0,o=o+Math.imul(q,tt)|0,a=a+Math.imul(G,at)|0,n=(n=n+Math.imul(G,it)|0)+Math.imul(T,at)|0,o=o+Math.imul(T,it)|0,a=a+Math.imul(N,ot)|0,n=(n=n+Math.imul(N,At)|0)+Math.imul(D,ot)|0,o=o+Math.imul(D,At)|0,a=a+Math.imul(w,ct)|0,n=(n=n+Math.imul(w,dt)|0)+Math.imul(_,ct)|0,o=o+Math.imul(_,dt)|0,a=a+Math.imul(x,ht)|0,n=(n=n+Math.imul(x,bt)|0)+Math.imul(C,ht)|0,o=o+Math.imul(C,bt)|0,a=a+Math.imul(I,Bt)|0,n=(n=n+Math.imul(I,mt)|0)+Math.imul(y,Bt)|0,o=o+Math.imul(y,mt)|0,a=a+Math.imul(p,Et)|0,n=(n=n+Math.imul(p,yt)|0)+Math.imul(B,Et)|0,o=o+Math.imul(B,yt)|0;var Gt=(u+(a=a+Math.imul(l,xt)|0)|0)+((8191&(n=(n=n+Math.imul(l,Ct)|0)+Math.imul(b,xt)|0))<<13)|0;u=((o=o+Math.imul(b,Ct)|0)+(n>>>13)|0)+(Gt>>>26)|0,Gt&=67108863,a=Math.imul(J,V),n=(n=Math.imul(J,X))+Math.imul(z,V)|0,o=Math.imul(z,X),a=a+Math.imul(H,et)|0,n=(n=n+Math.imul(H,tt)|0)+Math.imul(Y,et)|0,o=o+Math.imul(Y,tt)|0,a=a+Math.imul(P,at)|0,n=(n=n+Math.imul(P,it)|0)+Math.imul(q,at)|0,o=o+Math.imul(q,it)|0,a=a+Math.imul(G,ot)|0,n=(n=n+Math.imul(G,At)|0)+Math.imul(T,ot)|0,o=o+Math.imul(T,At)|0,a=a+Math.imul(N,ct)|0,n=(n=n+Math.imul(N,dt)|0)+Math.imul(D,ct)|0,o=o+Math.imul(D,dt)|0,a=a+Math.imul(w,ht)|0,n=(n=n+Math.imul(w,bt)|0)+Math.imul(_,ht)|0,o=o+Math.imul(_,bt)|0,a=a+Math.imul(x,Bt)|0,n=(n=n+Math.imul(x,mt)|0)+Math.imul(C,Bt)|0,o=o+Math.imul(C,mt)|0,a=a+Math.imul(I,Et)|0,n=(n=n+Math.imul(I,yt)|0)+Math.imul(y,Et)|0,o=o+Math.imul(y,yt)|0,a=a+Math.imul(p,xt)|0,n=(n=n+Math.imul(p,Ct)|0)+Math.imul(B,xt)|0,o=o+Math.imul(B,Ct)|0;var Tt=(u+(a=a+Math.imul(l,wt)|0)|0)+((8191&(n=(n=n+Math.imul(l,Mt)|0)+Math.imul(b,wt)|0))<<13)|0;u=((o=o+Math.imul(b,Mt)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,a=Math.imul(J,et),n=(n=Math.imul(J,tt))+Math.imul(z,et)|0,o=Math.imul(z,tt),a=a+Math.imul(H,at)|0,n=(n=n+Math.imul(H,it)|0)+Math.imul(Y,at)|0,o=o+Math.imul(Y,it)|0,a=a+Math.imul(P,ot)|0,n=(n=n+Math.imul(P,At)|0)+Math.imul(q,ot)|0,o=o+Math.imul(q,At)|0,a=a+Math.imul(G,ct)|0,n=(n=n+Math.imul(G,dt)|0)+Math.imul(T,ct)|0,o=o+Math.imul(T,dt)|0,a=a+Math.imul(N,ht)|0,n=(n=n+Math.imul(N,bt)|0)+Math.imul(D,ht)|0,o=o+Math.imul(D,bt)|0,a=a+Math.imul(w,Bt)|0,n=(n=n+Math.imul(w,mt)|0)+Math.imul(_,Bt)|0,o=o+Math.imul(_,mt)|0,a=a+Math.imul(x,Et)|0,n=(n=n+Math.imul(x,yt)|0)+Math.imul(C,Et)|0,o=o+Math.imul(C,yt)|0,a=a+Math.imul(I,xt)|0,n=(n=n+Math.imul(I,Ct)|0)+Math.imul(y,xt)|0,o=o+Math.imul(y,Ct)|0;var Lt=(u+(a=a+Math.imul(p,wt)|0)|0)+((8191&(n=(n=n+Math.imul(p,Mt)|0)+Math.imul(B,wt)|0))<<13)|0;u=((o=o+Math.imul(B,Mt)|0)+(n>>>13)|0)+(Lt>>>26)|0,Lt&=67108863,a=Math.imul(J,at),n=(n=Math.imul(J,it))+Math.imul(z,at)|0,o=Math.imul(z,it),a=a+Math.imul(H,ot)|0,n=(n=n+Math.imul(H,At)|0)+Math.imul(Y,ot)|0,o=o+Math.imul(Y,At)|0,a=a+Math.imul(P,ct)|0,n=(n=n+Math.imul(P,dt)|0)+Math.imul(q,ct)|0,o=o+Math.imul(q,dt)|0,a=a+Math.imul(G,ht)|0,n=(n=n+Math.imul(G,bt)|0)+Math.imul(T,ht)|0,o=o+Math.imul(T,bt)|0,a=a+Math.imul(N,Bt)|0,n=(n=n+Math.imul(N,mt)|0)+Math.imul(D,Bt)|0,o=o+Math.imul(D,mt)|0,a=a+Math.imul(w,Et)|0,n=(n=n+Math.imul(w,yt)|0)+Math.imul(_,Et)|0,o=o+Math.imul(_,yt)|0,a=a+Math.imul(x,xt)|0,n=(n=n+Math.imul(x,Ct)|0)+Math.imul(C,xt)|0,o=o+Math.imul(C,Ct)|0;var Pt=(u+(a=a+Math.imul(I,wt)|0)|0)+((8191&(n=(n=n+Math.imul(I,Mt)|0)+Math.imul(y,wt)|0))<<13)|0;u=((o=o+Math.imul(y,Mt)|0)+(n>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,a=Math.imul(J,ot),n=(n=Math.imul(J,At))+Math.imul(z,ot)|0,o=Math.imul(z,At),a=a+Math.imul(H,ct)|0,n=(n=n+Math.imul(H,dt)|0)+Math.imul(Y,ct)|0,o=o+Math.imul(Y,dt)|0,a=a+Math.imul(P,ht)|0,n=(n=n+Math.imul(P,bt)|0)+Math.imul(q,ht)|0,o=o+Math.imul(q,bt)|0,a=a+Math.imul(G,Bt)|0,n=(n=n+Math.imul(G,mt)|0)+Math.imul(T,Bt)|0,o=o+Math.imul(T,mt)|0,a=a+Math.imul(N,Et)|0,n=(n=n+Math.imul(N,yt)|0)+Math.imul(D,Et)|0,o=o+Math.imul(D,yt)|0,a=a+Math.imul(w,xt)|0,n=(n=n+Math.imul(w,Ct)|0)+Math.imul(_,xt)|0,o=o+Math.imul(_,Ct)|0;var qt=(u+(a=a+Math.imul(x,wt)|0)|0)+((8191&(n=(n=n+Math.imul(x,Mt)|0)+Math.imul(C,wt)|0))<<13)|0;u=((o=o+Math.imul(C,Mt)|0)+(n>>>13)|0)+(qt>>>26)|0,qt&=67108863,a=Math.imul(J,ct),n=(n=Math.imul(J,dt))+Math.imul(z,ct)|0,o=Math.imul(z,dt),a=a+Math.imul(H,ht)|0,n=(n=n+Math.imul(H,bt)|0)+Math.imul(Y,ht)|0,o=o+Math.imul(Y,bt)|0,a=a+Math.imul(P,Bt)|0,n=(n=n+Math.imul(P,mt)|0)+Math.imul(q,Bt)|0,o=o+Math.imul(q,mt)|0,a=a+Math.imul(G,Et)|0,n=(n=n+Math.imul(G,yt)|0)+Math.imul(T,Et)|0,o=o+Math.imul(T,yt)|0,a=a+Math.imul(N,xt)|0,n=(n=n+Math.imul(N,Ct)|0)+Math.imul(D,xt)|0,o=o+Math.imul(D,Ct)|0;var Ot=(u+(a=a+Math.imul(w,wt)|0)|0)+((8191&(n=(n=n+Math.imul(w,Mt)|0)+Math.imul(_,wt)|0))<<13)|0;u=((o=o+Math.imul(_,Mt)|0)+(n>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,a=Math.imul(J,ht),n=(n=Math.imul(J,bt))+Math.imul(z,ht)|0,o=Math.imul(z,bt),a=a+Math.imul(H,Bt)|0,n=(n=n+Math.imul(H,mt)|0)+Math.imul(Y,Bt)|0,o=o+Math.imul(Y,mt)|0,a=a+Math.imul(P,Et)|0,n=(n=n+Math.imul(P,yt)|0)+Math.imul(q,Et)|0,o=o+Math.imul(q,yt)|0,a=a+Math.imul(G,xt)|0,n=(n=n+Math.imul(G,Ct)|0)+Math.imul(T,xt)|0,o=o+Math.imul(T,Ct)|0;var Ht=(u+(a=a+Math.imul(N,wt)|0)|0)+((8191&(n=(n=n+Math.imul(N,Mt)|0)+Math.imul(D,wt)|0))<<13)|0;u=((o=o+Math.imul(D,Mt)|0)+(n>>>13)|0)+(Ht>>>26)|0,Ht&=67108863,a=Math.imul(J,Bt),n=(n=Math.imul(J,mt))+Math.imul(z,Bt)|0,o=Math.imul(z,mt),a=a+Math.imul(H,Et)|0,n=(n=n+Math.imul(H,yt)|0)+Math.imul(Y,Et)|0,o=o+Math.imul(Y,yt)|0,a=a+Math.imul(P,xt)|0,n=(n=n+Math.imul(P,Ct)|0)+Math.imul(q,xt)|0,o=o+Math.imul(q,Ct)|0;var Yt=(u+(a=a+Math.imul(G,wt)|0)|0)+((8191&(n=(n=n+Math.imul(G,Mt)|0)+Math.imul(T,wt)|0))<<13)|0;u=((o=o+Math.imul(T,Mt)|0)+(n>>>13)|0)+(Yt>>>26)|0,Yt&=67108863,a=Math.imul(J,Et),n=(n=Math.imul(J,yt))+Math.imul(z,Et)|0,o=Math.imul(z,yt),a=a+Math.imul(H,xt)|0,n=(n=n+Math.imul(H,Ct)|0)+Math.imul(Y,xt)|0,o=o+Math.imul(Y,Ct)|0;var jt=(u+(a=a+Math.imul(P,wt)|0)|0)+((8191&(n=(n=n+Math.imul(P,Mt)|0)+Math.imul(q,wt)|0))<<13)|0;u=((o=o+Math.imul(q,Mt)|0)+(n>>>13)|0)+(jt>>>26)|0,jt&=67108863,a=Math.imul(J,xt),n=(n=Math.imul(J,Ct))+Math.imul(z,xt)|0,o=Math.imul(z,Ct);var Jt=(u+(a=a+Math.imul(H,wt)|0)|0)+((8191&(n=(n=n+Math.imul(H,Mt)|0)+Math.imul(Y,wt)|0))<<13)|0;u=((o=o+Math.imul(Y,Mt)|0)+(n>>>13)|0)+(Jt>>>26)|0,Jt&=67108863;var Kt=(u+(a=Math.imul(J,wt))|0)+((8191&(n=(n=Math.imul(J,Mt))+Math.imul(z,wt)|0))<<13)|0;return u=((o=Math.imul(z,Mt))+(n>>>13)|0)+(Kt>>>26)|0,Kt&=67108863,d[0]=_t,d[1]=kt,d[2]=St,d[3]=Nt,d[4]=Dt,d[5]=Rt,d[6]=Ft,d[7]=Ut,d[8]=Gt,d[9]=Tt,d[10]=Lt,d[11]=Pt,d[12]=qt,d[13]=Ot,d[14]=Ht,d[15]=Yt,d[16]=jt,d[17]=Jt,d[18]=Kt,0!==u&&(d[19]=u,r.length++),r};function jumboMulTo(e,t,r){return(new FFTM).mulp(e,t,r)}function FFTM(e,t){this.x=e,this.y=t}Math.imul||(c=smallMulTo),BN.prototype.mulTo=function mulTo(e,t){var r=this.length+e.length;return 10===this.length&&10===e.length?c(this,e,t):r<63?smallMulTo(this,e,t):r<1024?function bigMulTo(e,t,r){r.negative=t.negative^e.negative,r.length=e.length+t.length;for(var a=0,n=0,o=0;o>>26)|0)>>>26,s&=67108863}r.words[o]=c,a=s,s=n}return 0!==a?r.words[o]=a:r.length--,r.strip()}(this,e,t):jumboMulTo(this,e,t)},FFTM.prototype.makeRBT=function makeRBT(e){for(var t=new Array(e),r=BN.prototype._countBits(e)-1,a=0;a>=1;return a},FFTM.prototype.permute=function permute(e,t,r,a,n,o){for(var s=0;s>>=1)n++;return 1<>>=13,r[2*o+1]=8191&n,n>>>=13;for(o=2*t;o>=26,t+=a/67108864|0,t+=n>>>26,this.words[r]=67108863&n}return 0!==t&&(this.words[r]=t,this.length++),this},BN.prototype.muln=function muln(e){return this.clone().imuln(e)},BN.prototype.sqr=function sqr(){return this.mul(this)},BN.prototype.isqr=function isqr(){return this.imul(this.clone())},BN.prototype.pow=function pow(e){var t=function toBitArray(e){for(var t=new Array(e.bitLength()),r=0;r>>n}return t}(e);if(0===t.length)return new BN(1);for(var r=this,a=0;a=0);var t,r=e%26,a=(e-r)/26,n=67108863>>>26-r<<26-r;if(0!==r){var o=0;for(t=0;t>>26-r}o&&(this.words[t]=o,this.length++)}if(0!==a){for(t=this.length-1;t>=0;t--)this.words[t+a]=this.words[t];for(t=0;t=0),a=t?(t-t%26)/26:0;var n=e%26,o=Math.min((e-n)/26,this.length),s=67108863^67108863>>>n<o)for(this.length-=o,d=0;d=0&&(0!==u||d>=a);d--){var h=0|this.words[d];this.words[d]=u<<26-n|h>>>n,u=h&s}return c&&0!==u&&(c.words[c.length++]=u),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},BN.prototype.ishrn=function ishrn(e,t,r){return assert(0===this.negative),this.iushrn(e,t,r)},BN.prototype.shln=function shln(e){return this.clone().ishln(e)},BN.prototype.ushln=function ushln(e){return this.clone().iushln(e)},BN.prototype.shrn=function shrn(e){return this.clone().ishrn(e)},BN.prototype.ushrn=function ushrn(e){return this.clone().iushrn(e)},BN.prototype.testn=function testn(e){assert("number"==typeof e&&e>=0);var t=e%26,r=(e-t)/26,a=1<=0);var t=e%26,r=(e-t)/26;if(assert(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==t&&r++,this.length=Math.min(r,this.length),0!==t){var a=67108863^67108863>>>t<=67108864;t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},BN.prototype.isubn=function isubn(e){if(assert("number"==typeof e),assert(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t>26)-(c/67108864|0),this.words[a+r]=67108863&n}for(;a>26,this.words[a+r]=67108863&n;if(0===s)return this.strip();for(assert(-1===s),s=0,a=0;a>26,this.words[a]=67108863&n;return this.negative=1,this.strip()},BN.prototype._wordDiv=function _wordDiv(e,t){var r=(this.length,e.length),a=this.clone(),n=e,o=0|n.words[n.length-1];0!==(r=26-this._countBits(o))&&(n=n.ushln(r),a.iushln(r),o=0|n.words[n.length-1]);var s,c=a.length-n.length;if("mod"!==t){(s=new BN(null)).length=c+1,s.words=new Array(s.length);for(var d=0;d=0;h--){var l=67108864*(0|a.words[n.length+h])+(0|a.words[n.length+h-1]);for(l=Math.min(l/o|0,67108863),a._ishlnsubmul(n,l,h);0!==a.negative;)l--,a.negative=0,a._ishlnsubmul(n,1,h),a.isZero()||(a.negative^=1);s&&(s.words[h]=l)}return s&&s.strip(),a.strip(),"div"!==t&&0!==r&&a.iushrn(r),{div:s||null,mod:a}},BN.prototype.divmod=function divmod(e,t,r){return assert(!e.isZero()),this.isZero()?{div:new BN(0),mod:new BN(0)}:0!==this.negative&&0===e.negative?(o=this.neg().divmod(e,t),"mod"!==t&&(a=o.div.neg()),"div"!==t&&(n=o.mod.neg(),r&&0!==n.negative&&n.iadd(e)),{div:a,mod:n}):0===this.negative&&0!==e.negative?(o=this.divmod(e.neg(),t),"mod"!==t&&(a=o.div.neg()),{div:a,mod:o.mod}):0!=(this.negative&e.negative)?(o=this.neg().divmod(e.neg(),t),"div"!==t&&(n=o.mod.neg(),r&&0!==n.negative&&n.isub(e)),{div:o.div,mod:n}):e.length>this.length||this.cmp(e)<0?{div:new BN(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new BN(this.modn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new BN(this.modn(e.words[0]))}:this._wordDiv(e,t);var a,n,o},BN.prototype.div=function div(e){return this.divmod(e,"div",!1).div},BN.prototype.mod=function mod(e){return this.divmod(e,"mod",!1).mod},BN.prototype.umod=function umod(e){return this.divmod(e,"mod",!0).mod},BN.prototype.divRound=function divRound(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var r=0!==t.div.negative?t.mod.isub(e):t.mod,a=e.ushrn(1),n=e.andln(1),o=r.cmp(a);return o<0||1===n&&0===o?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},BN.prototype.modn=function modn(e){assert(e<=67108863);for(var t=(1<<26)%e,r=0,a=this.length-1;a>=0;a--)r=(t*r+(0|this.words[a]))%e;return r},BN.prototype.idivn=function idivn(e){assert(e<=67108863);for(var t=0,r=this.length-1;r>=0;r--){var a=(0|this.words[r])+67108864*t;this.words[r]=a/e|0,t=a%e}return this.strip()},BN.prototype.divn=function divn(e){return this.clone().idivn(e)},BN.prototype.egcd=function egcd(e){assert(0===e.negative),assert(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var a=new BN(1),n=new BN(0),o=new BN(0),s=new BN(1),c=0;t.isEven()&&r.isEven();)t.iushrn(1),r.iushrn(1),++c;for(var d=r.clone(),u=t.clone();!t.isZero();){for(var h=0,l=1;0==(t.words[0]&l)&&h<26;++h,l<<=1);if(h>0)for(t.iushrn(h);h-- >0;)(a.isOdd()||n.isOdd())&&(a.iadd(d),n.isub(u)),a.iushrn(1),n.iushrn(1);for(var b=0,g=1;0==(r.words[0]&g)&&b<26;++b,g<<=1);if(b>0)for(r.iushrn(b);b-- >0;)(o.isOdd()||s.isOdd())&&(o.iadd(d),s.isub(u)),o.iushrn(1),s.iushrn(1);t.cmp(r)>=0?(t.isub(r),a.isub(o),n.isub(s)):(r.isub(t),o.isub(a),s.isub(n))}return{a:o,b:s,gcd:r.iushln(c)}},BN.prototype._invmp=function _invmp(e){assert(0===e.negative),assert(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var a,n=new BN(1),o=new BN(0),s=r.clone();t.cmpn(1)>0&&r.cmpn(1)>0;){for(var c=0,d=1;0==(t.words[0]&d)&&c<26;++c,d<<=1);if(c>0)for(t.iushrn(c);c-- >0;)n.isOdd()&&n.iadd(s),n.iushrn(1);for(var u=0,h=1;0==(r.words[0]&h)&&u<26;++u,h<<=1);if(u>0)for(r.iushrn(u);u-- >0;)o.isOdd()&&o.iadd(s),o.iushrn(1);t.cmp(r)>=0?(t.isub(r),n.isub(o)):(r.isub(t),o.isub(n))}return(a=0===t.cmpn(1)?n:o).cmpn(0)<0&&a.iadd(e),a},BN.prototype.gcd=function gcd(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),r=e.clone();t.negative=0,r.negative=0;for(var a=0;t.isEven()&&r.isEven();a++)t.iushrn(1),r.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=t.cmp(r);if(n<0){var o=t;t=r,r=o}else if(0===n||0===r.cmpn(1))break;t.isub(r)}return r.iushln(a)},BN.prototype.invm=function invm(e){return this.egcd(e).a.umod(e)},BN.prototype.isEven=function isEven(){return 0==(1&this.words[0])},BN.prototype.isOdd=function isOdd(){return 1==(1&this.words[0])},BN.prototype.andln=function andln(e){return this.words[0]&e},BN.prototype.bincn=function bincn(e){assert("number"==typeof e);var t=e%26,r=(e-t)/26,a=1<>>26,s&=67108863,this.words[o]=s}return 0!==n&&(this.words[o]=n,this.length++),this},BN.prototype.isZero=function isZero(){return 1===this.length&&0===this.words[0]},BN.prototype.cmpn=function cmpn(e){var t,r=e<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this.strip(),this.length>1)t=1;else{r&&(e=-e),assert(e<=67108863,"Number is too big");var a=0|this.words[0];t=a===e?0:ae.length)return 1;if(this.length=0;r--){var a=0|this.words[r],n=0|e.words[r];if(a!==n){an&&(t=1);break}}return t},BN.prototype.gtn=function gtn(e){return 1===this.cmpn(e)},BN.prototype.gt=function gt(e){return 1===this.cmp(e)},BN.prototype.gten=function gten(e){return this.cmpn(e)>=0},BN.prototype.gte=function gte(e){return this.cmp(e)>=0},BN.prototype.ltn=function ltn(e){return-1===this.cmpn(e)},BN.prototype.lt=function lt(e){return-1===this.cmp(e)},BN.prototype.lten=function lten(e){return this.cmpn(e)<=0},BN.prototype.lte=function lte(e){return this.cmp(e)<=0},BN.prototype.eqn=function eqn(e){return 0===this.cmpn(e)},BN.prototype.eq=function eq(e){return 0===this.cmp(e)},BN.red=function red(e){return new Red(e)},BN.prototype.toRed=function toRed(e){return assert(!this.red,"Already a number in reduction context"),assert(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},BN.prototype.fromRed=function fromRed(){return assert(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},BN.prototype._forceRed=function _forceRed(e){return this.red=e,this},BN.prototype.forceRed=function forceRed(e){return assert(!this.red,"Already a number in reduction context"),this._forceRed(e)},BN.prototype.redAdd=function redAdd(e){return assert(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},BN.prototype.redIAdd=function redIAdd(e){return assert(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},BN.prototype.redSub=function redSub(e){return assert(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},BN.prototype.redISub=function redISub(e){return assert(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},BN.prototype.redShl=function redShl(e){return assert(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},BN.prototype.redMul=function redMul(e){return assert(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},BN.prototype.redIMul=function redIMul(e){return assert(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},BN.prototype.redSqr=function redSqr(){return assert(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},BN.prototype.redISqr=function redISqr(){return assert(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},BN.prototype.redSqrt=function redSqrt(){return assert(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},BN.prototype.redInvm=function redInvm(){return assert(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},BN.prototype.redNeg=function redNeg(){return assert(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},BN.prototype.redPow=function redPow(e){return assert(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var d={k256:null,p224:null,p192:null,p25519:null};function MPrime(e,t){this.name=e,this.p=new BN(t,16),this.n=this.p.bitLength(),this.k=new BN(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function K256(){MPrime.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function P224(){MPrime.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function P192(){MPrime.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function P25519(){MPrime.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function Red(e){if("string"==typeof e){var t=BN._prime(e);this.m=t.p,this.prime=t}else assert(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function Mont(e){Red.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new BN(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)}MPrime.prototype._tmp=function _tmp(){var e=new BN(null);return e.words=new Array(Math.ceil(this.n/13)),e},MPrime.prototype.ireduce=function ireduce(e){var t,r=e;do{this.split(r,this.tmp),t=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(t>this.n);var a=t0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},MPrime.prototype.split=function split(e,t){e.iushrn(this.n,0,t)},MPrime.prototype.imulK=function imulK(e){return e.imul(this.k)},inherits(K256,MPrime),K256.prototype.split=function split(e,t){for(var r=4194303,a=Math.min(e.length,9),n=0;n>>22,o=s}o>>>=22,e.words[n-10]=o,0===o&&e.length>10?e.length-=10:e.length-=9},K256.prototype.imulK=function imulK(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,r=0;r>>=26,e.words[r]=n,t=a}return 0!==t&&(e.words[e.length++]=t),e},BN._prime=function prime(e){if(d[e])return d[e];var prime;if("k256"===e)prime=new K256;else if("p224"===e)prime=new P224;else if("p192"===e)prime=new P192;else{if("p25519"!==e)throw new Error("Unknown prime "+e);prime=new P25519}return d[e]=prime,prime},Red.prototype._verify1=function _verify1(e){assert(0===e.negative,"red works only with positives"),assert(e.red,"red works only with red numbers")},Red.prototype._verify2=function _verify2(e,t){assert(0==(e.negative|t.negative),"red works only with positives"),assert(e.red&&e.red===t.red,"red works only with red numbers")},Red.prototype.imod=function imod(e){return this.prime?this.prime.ireduce(e)._forceRed(this):e.umod(this.m)._forceRed(this)},Red.prototype.neg=function neg(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},Red.prototype.add=function add(e,t){this._verify2(e,t);var r=e.add(t);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},Red.prototype.iadd=function iadd(e,t){this._verify2(e,t);var r=e.iadd(t);return r.cmp(this.m)>=0&&r.isub(this.m),r},Red.prototype.sub=function sub(e,t){this._verify2(e,t);var r=e.sub(t);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},Red.prototype.isub=function isub(e,t){this._verify2(e,t);var r=e.isub(t);return r.cmpn(0)<0&&r.iadd(this.m),r},Red.prototype.shl=function shl(e,t){return this._verify1(e),this.imod(e.ushln(t))},Red.prototype.imul=function imul(e,t){return this._verify2(e,t),this.imod(e.imul(t))},Red.prototype.mul=function mul(e,t){return this._verify2(e,t),this.imod(e.mul(t))},Red.prototype.isqr=function isqr(e){return this.imul(e,e.clone())},Red.prototype.sqr=function sqr(e){return this.mul(e,e)},Red.prototype.sqrt=function sqrt(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(assert(t%2==1),3===t){var r=this.m.add(new BN(1)).iushrn(2);return this.pow(e,r)}for(var a=this.m.subn(1),n=0;!a.isZero()&&0===a.andln(1);)n++,a.iushrn(1);assert(!a.isZero());var o=new BN(1).toRed(this),s=o.redNeg(),c=this.m.subn(1).iushrn(1),d=this.m.bitLength();for(d=new BN(2*d*d).toRed(this);0!==this.pow(d,c).cmp(s);)d.redIAdd(s);for(var u=this.pow(d,a),h=this.pow(e,a.addn(1).iushrn(1)),l=this.pow(e,a),b=n;0!==l.cmp(o);){for(var g=l,p=0;0!==g.cmp(o);p++)g=g.redSqr();assert(p=0;a--){for(var d=t.words[a],u=c-1;u>=0;u--){var h=d>>u&1;n!==r[0]&&(n=this.sqr(n)),0!==h||0!==o?(o<<=1,o|=h,(4===++s||0===a&&0===u)&&(n=this.mul(n,r[o]),s=0,o=0)):s=0}c=26}return n},Red.prototype.convertTo=function convertTo(e){var t=e.umod(this.m);return t===e?t.clone():t},Red.prototype.convertFrom=function convertFrom(e){var t=e.clone();return t.red=null,t},BN.mont=function mont(e){return new Mont(e)},inherits(Mont,Red),Mont.prototype.convertTo=function convertTo(e){return this.imod(e.ushln(this.shift))},Mont.prototype.convertFrom=function convertFrom(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},Mont.prototype.imul=function imul(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var r=e.imul(t),a=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(a).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},Mont.prototype.mul=function mul(e,t){if(e.isZero()||t.isZero())return new BN(0)._forceRed(this);var r=e.mul(t),a=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(a).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},Mont.prototype.invm=function invm(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(e=r.nmd(e),this)},function(e,t,r){!function(e,t){"use strict";function assert(e,t){if(!e)throw new Error(t||"Assertion failed")}function inherits(e,t){e.super_=t;var TempCtor=function(){};TempCtor.prototype=t.prototype,e.prototype=new TempCtor,e.prototype.constructor=e}function BN(e,t,r){if(BN.isBN(e))return e;this.negative=0,this.words=null,this.length=0,this.red=null,null!==e&&("le"!==t&&"be"!==t||(r=t,t=10),this._init(e||0,t||10,r||"be"))}var a;"object"==typeof e?e.exports=BN:t.BN=BN,BN.BN=BN,BN.wordSize=26;try{a="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:r(17).Buffer}catch(e){}function parseHex4Bits(e,t){var r=e.charCodeAt(t);return r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:r-48&15}function parseHexByte(e,t,r){var a=parseHex4Bits(e,r);return r-1>=t&&(a|=parseHex4Bits(e,r-1)<<4),a}function parseBase(e,t,r,a){for(var n=0,o=Math.min(e.length,r),s=t;s=49?c-49+10:c>=17?c-17+10:c}return n}BN.isBN=function isBN(e){return e instanceof BN||null!==e&&"object"==typeof e&&e.constructor.wordSize===BN.wordSize&&Array.isArray(e.words)},BN.max=function max(e,t){return e.cmp(t)>0?e:t},BN.min=function min(e,t){return e.cmp(t)<0?e:t},BN.prototype._init=function init(e,t,r){if("number"==typeof e)return this._initNumber(e,t,r);if("object"==typeof e)return this._initArray(e,t,r);"hex"===t&&(t=16),assert(t===(0|t)&&t>=2&&t<=36);var a=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&(a++,this.negative=1),a=0;a-=3)o=e[a]|e[a-1]<<8|e[a-2]<<16,this.words[n]|=o<>>26-s&67108863,(s+=24)>=26&&(s-=26,n++);else if("le"===r)for(a=0,n=0;a>>26-s&67108863,(s+=24)>=26&&(s-=26,n++);return this.strip()},BN.prototype._parseHex=function _parseHex(e,t,r){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var a=0;a=t;a-=2)n=parseHexByte(e,t,a)<=18?(o-=18,s+=1,this.words[s]|=n>>>26):o+=8;else for(a=(e.length-t)%2==0?t+1:t;a=18?(o-=18,s+=1,this.words[s]|=n>>>26):o+=8;this.strip()},BN.prototype._parseBase=function _parseBase(e,t,r){this.words=[0],this.length=1;for(var a=0,n=1;n<=67108863;n*=t)a++;a--,n=n/t|0;for(var o=e.length-r,s=o%a,c=Math.min(o,o-s)+r,d=0,u=r;u1&&0===this.words[this.length-1];)this.length--;return this._normSign()},BN.prototype._normSign=function _normSign(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},BN.prototype.inspect=function inspect(){return(this.red?""};var n=["","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"],o=[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],s=[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 smallMulTo(e,t,r){r.negative=t.negative^e.negative;var a=e.length+t.length|0;r.length=a,a=a-1|0;var n=0|e.words[0],o=0|t.words[0],s=n*o,c=67108863&s,d=s/67108864|0;r.words[0]=c;for(var u=1;u>>26,l=67108863&d,b=Math.min(u,t.length-1),g=Math.max(0,u-e.length+1);g<=b;g++){var p=u-g|0;h+=(s=(n=0|e.words[p])*(o=0|t.words[g])+l)/67108864|0,l=67108863&s}r.words[u]=0|l,d=0|h}return 0!==d?r.words[u]=0|d:r.length--,r.strip()}BN.prototype.toString=function toString(e,t){var r;if(t=0|t||1,16===(e=e||10)||"hex"===e){r="";for(var a=0,c=0,d=0;d>>24-a&16777215)||d!==this.length-1?n[6-h.length]+h+r:h+r,(a+=2)>=26&&(a-=26,d--)}for(0!==c&&(r=c.toString(16)+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(e===(0|e)&&e>=2&&e<=36){var l=o[e],b=s[e];r="";var g=this.clone();for(g.negative=0;!g.isZero();){var p=g.modn(b).toString(e);r=(g=g.idivn(b)).isZero()?p+r:n[l-p.length]+p+r}for(this.isZero()&&(r="0"+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}assert(!1,"Base should be between 2 and 36")},BN.prototype.toNumber=function toNumber(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&assert(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},BN.prototype.toJSON=function toJSON(){return this.toString(16)},BN.prototype.toBuffer=function toBuffer(e,t){return assert(void 0!==a),this.toArrayLike(a,e,t)},BN.prototype.toArray=function toArray(e,t){return this.toArrayLike(Array,e,t)},BN.prototype.toArrayLike=function toArrayLike(e,t,r){var a=this.byteLength(),n=r||Math.max(1,a);assert(a<=n,"byte array longer than desired length"),assert(n>0,"Requested array length <= 0"),this.strip();var o,s,c="le"===t,d=new e(n),u=this.clone();if(c){for(s=0;!u.isZero();s++)o=u.andln(255),u.iushrn(8),d[s]=o;for(;s=4096&&(r+=13,t>>>=13),t>=64&&(r+=7,t>>>=7),t>=8&&(r+=4,t>>>=4),t>=2&&(r+=2,t>>>=2),r+t},BN.prototype._zeroBits=function _zeroBits(e){if(0===e)return 26;var t=e,r=0;return 0==(8191&t)&&(r+=13,t>>>=13),0==(127&t)&&(r+=7,t>>>=7),0==(15&t)&&(r+=4,t>>>=4),0==(3&t)&&(r+=2,t>>>=2),0==(1&t)&&r++,r},BN.prototype.bitLength=function bitLength(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},BN.prototype.zeroBits=function zeroBits(){if(this.isZero())return 0;for(var e=0,t=0;te.length?this.clone().ior(e):e.clone().ior(this)},BN.prototype.uor=function uor(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},BN.prototype.iuand=function iuand(e){var t;t=this.length>e.length?e:this;for(var r=0;re.length?this.clone().iand(e):e.clone().iand(this)},BN.prototype.uand=function uand(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},BN.prototype.iuxor=function iuxor(e){var t,r;this.length>e.length?(t=this,r=e):(t=e,r=this);for(var a=0;ae.length?this.clone().ixor(e):e.clone().ixor(this)},BN.prototype.uxor=function uxor(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},BN.prototype.inotn=function inotn(e){assert("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),r=e%26;this._expand(t),r>0&&t--;for(var a=0;a0&&(this.words[a]=~this.words[a]&67108863>>26-r),this.strip()},BN.prototype.notn=function notn(e){return this.clone().inotn(e)},BN.prototype.setn=function setn(e,t){assert("number"==typeof e&&e>=0);var r=e/26|0,a=e%26;return this._expand(r+1),this.words[r]=t?this.words[r]|1<e.length?(r=this,a=e):(r=e,a=this);for(var n=0,o=0;o>>26;for(;0!==n&&o>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;oe.length?this.clone().iadd(e):e.clone().iadd(this)},BN.prototype.isub=function isub(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var r,a,n=this.cmp(e);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,a=e):(r=e,a=this);for(var o=0,s=0;s>26,this.words[s]=67108863&t;for(;0!==o&&s>26,this.words[s]=67108863&t;if(0===o&&s>>13,g=0|s[1],p=8191&g,B=g>>>13,m=0|s[2],I=8191&m,y=m>>>13,v=0|s[3],x=8191&v,C=v>>>13,Q=0|s[4],w=8191&Q,_=Q>>>13,k=0|s[5],N=8191&k,D=k>>>13,U=0|s[6],G=8191&U,T=U>>>13,L=0|s[7],P=8191&L,q=L>>>13,O=0|s[8],H=8191&O,Y=O>>>13,j=0|s[9],J=8191&j,z=j>>>13,W=0|c[0],V=8191&W,X=W>>>13,$=0|c[1],et=8191&$,tt=$>>>13,rt=0|c[2],at=8191&rt,it=rt>>>13,nt=0|c[3],ot=8191&nt,At=nt>>>13,st=0|c[4],ct=8191&st,dt=st>>>13,ut=0|c[5],ht=8191&ut,bt=ut>>>13,pt=0|c[6],Bt=8191&pt,mt=pt>>>13,It=0|c[7],Et=8191&It,yt=It>>>13,vt=0|c[8],xt=8191&vt,Ct=vt>>>13,Qt=0|c[9],wt=8191&Qt,Mt=Qt>>>13;r.negative=e.negative^t.negative,r.length=19;var _t=(u+(a=Math.imul(l,V))|0)+((8191&(n=(n=Math.imul(l,X))+Math.imul(b,V)|0))<<13)|0;u=((o=Math.imul(b,X))+(n>>>13)|0)+(_t>>>26)|0,_t&=67108863,a=Math.imul(p,V),n=(n=Math.imul(p,X))+Math.imul(B,V)|0,o=Math.imul(B,X);var kt=(u+(a=a+Math.imul(l,et)|0)|0)+((8191&(n=(n=n+Math.imul(l,tt)|0)+Math.imul(b,et)|0))<<13)|0;u=((o=o+Math.imul(b,tt)|0)+(n>>>13)|0)+(kt>>>26)|0,kt&=67108863,a=Math.imul(I,V),n=(n=Math.imul(I,X))+Math.imul(y,V)|0,o=Math.imul(y,X),a=a+Math.imul(p,et)|0,n=(n=n+Math.imul(p,tt)|0)+Math.imul(B,et)|0,o=o+Math.imul(B,tt)|0;var St=(u+(a=a+Math.imul(l,at)|0)|0)+((8191&(n=(n=n+Math.imul(l,it)|0)+Math.imul(b,at)|0))<<13)|0;u=((o=o+Math.imul(b,it)|0)+(n>>>13)|0)+(St>>>26)|0,St&=67108863,a=Math.imul(x,V),n=(n=Math.imul(x,X))+Math.imul(C,V)|0,o=Math.imul(C,X),a=a+Math.imul(I,et)|0,n=(n=n+Math.imul(I,tt)|0)+Math.imul(y,et)|0,o=o+Math.imul(y,tt)|0,a=a+Math.imul(p,at)|0,n=(n=n+Math.imul(p,it)|0)+Math.imul(B,at)|0,o=o+Math.imul(B,it)|0;var Nt=(u+(a=a+Math.imul(l,ot)|0)|0)+((8191&(n=(n=n+Math.imul(l,At)|0)+Math.imul(b,ot)|0))<<13)|0;u=((o=o+Math.imul(b,At)|0)+(n>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,a=Math.imul(w,V),n=(n=Math.imul(w,X))+Math.imul(_,V)|0,o=Math.imul(_,X),a=a+Math.imul(x,et)|0,n=(n=n+Math.imul(x,tt)|0)+Math.imul(C,et)|0,o=o+Math.imul(C,tt)|0,a=a+Math.imul(I,at)|0,n=(n=n+Math.imul(I,it)|0)+Math.imul(y,at)|0,o=o+Math.imul(y,it)|0,a=a+Math.imul(p,ot)|0,n=(n=n+Math.imul(p,At)|0)+Math.imul(B,ot)|0,o=o+Math.imul(B,At)|0;var Dt=(u+(a=a+Math.imul(l,ct)|0)|0)+((8191&(n=(n=n+Math.imul(l,dt)|0)+Math.imul(b,ct)|0))<<13)|0;u=((o=o+Math.imul(b,dt)|0)+(n>>>13)|0)+(Dt>>>26)|0,Dt&=67108863,a=Math.imul(N,V),n=(n=Math.imul(N,X))+Math.imul(D,V)|0,o=Math.imul(D,X),a=a+Math.imul(w,et)|0,n=(n=n+Math.imul(w,tt)|0)+Math.imul(_,et)|0,o=o+Math.imul(_,tt)|0,a=a+Math.imul(x,at)|0,n=(n=n+Math.imul(x,it)|0)+Math.imul(C,at)|0,o=o+Math.imul(C,it)|0,a=a+Math.imul(I,ot)|0,n=(n=n+Math.imul(I,At)|0)+Math.imul(y,ot)|0,o=o+Math.imul(y,At)|0,a=a+Math.imul(p,ct)|0,n=(n=n+Math.imul(p,dt)|0)+Math.imul(B,ct)|0,o=o+Math.imul(B,dt)|0;var Rt=(u+(a=a+Math.imul(l,ht)|0)|0)+((8191&(n=(n=n+Math.imul(l,bt)|0)+Math.imul(b,ht)|0))<<13)|0;u=((o=o+Math.imul(b,bt)|0)+(n>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,a=Math.imul(G,V),n=(n=Math.imul(G,X))+Math.imul(T,V)|0,o=Math.imul(T,X),a=a+Math.imul(N,et)|0,n=(n=n+Math.imul(N,tt)|0)+Math.imul(D,et)|0,o=o+Math.imul(D,tt)|0,a=a+Math.imul(w,at)|0,n=(n=n+Math.imul(w,it)|0)+Math.imul(_,at)|0,o=o+Math.imul(_,it)|0,a=a+Math.imul(x,ot)|0,n=(n=n+Math.imul(x,At)|0)+Math.imul(C,ot)|0,o=o+Math.imul(C,At)|0,a=a+Math.imul(I,ct)|0,n=(n=n+Math.imul(I,dt)|0)+Math.imul(y,ct)|0,o=o+Math.imul(y,dt)|0,a=a+Math.imul(p,ht)|0,n=(n=n+Math.imul(p,bt)|0)+Math.imul(B,ht)|0,o=o+Math.imul(B,bt)|0;var Ft=(u+(a=a+Math.imul(l,Bt)|0)|0)+((8191&(n=(n=n+Math.imul(l,mt)|0)+Math.imul(b,Bt)|0))<<13)|0;u=((o=o+Math.imul(b,mt)|0)+(n>>>13)|0)+(Ft>>>26)|0,Ft&=67108863,a=Math.imul(P,V),n=(n=Math.imul(P,X))+Math.imul(q,V)|0,o=Math.imul(q,X),a=a+Math.imul(G,et)|0,n=(n=n+Math.imul(G,tt)|0)+Math.imul(T,et)|0,o=o+Math.imul(T,tt)|0,a=a+Math.imul(N,at)|0,n=(n=n+Math.imul(N,it)|0)+Math.imul(D,at)|0,o=o+Math.imul(D,it)|0,a=a+Math.imul(w,ot)|0,n=(n=n+Math.imul(w,At)|0)+Math.imul(_,ot)|0,o=o+Math.imul(_,At)|0,a=a+Math.imul(x,ct)|0,n=(n=n+Math.imul(x,dt)|0)+Math.imul(C,ct)|0,o=o+Math.imul(C,dt)|0,a=a+Math.imul(I,ht)|0,n=(n=n+Math.imul(I,bt)|0)+Math.imul(y,ht)|0,o=o+Math.imul(y,bt)|0,a=a+Math.imul(p,Bt)|0,n=(n=n+Math.imul(p,mt)|0)+Math.imul(B,Bt)|0,o=o+Math.imul(B,mt)|0;var Ut=(u+(a=a+Math.imul(l,Et)|0)|0)+((8191&(n=(n=n+Math.imul(l,yt)|0)+Math.imul(b,Et)|0))<<13)|0;u=((o=o+Math.imul(b,yt)|0)+(n>>>13)|0)+(Ut>>>26)|0,Ut&=67108863,a=Math.imul(H,V),n=(n=Math.imul(H,X))+Math.imul(Y,V)|0,o=Math.imul(Y,X),a=a+Math.imul(P,et)|0,n=(n=n+Math.imul(P,tt)|0)+Math.imul(q,et)|0,o=o+Math.imul(q,tt)|0,a=a+Math.imul(G,at)|0,n=(n=n+Math.imul(G,it)|0)+Math.imul(T,at)|0,o=o+Math.imul(T,it)|0,a=a+Math.imul(N,ot)|0,n=(n=n+Math.imul(N,At)|0)+Math.imul(D,ot)|0,o=o+Math.imul(D,At)|0,a=a+Math.imul(w,ct)|0,n=(n=n+Math.imul(w,dt)|0)+Math.imul(_,ct)|0,o=o+Math.imul(_,dt)|0,a=a+Math.imul(x,ht)|0,n=(n=n+Math.imul(x,bt)|0)+Math.imul(C,ht)|0,o=o+Math.imul(C,bt)|0,a=a+Math.imul(I,Bt)|0,n=(n=n+Math.imul(I,mt)|0)+Math.imul(y,Bt)|0,o=o+Math.imul(y,mt)|0,a=a+Math.imul(p,Et)|0,n=(n=n+Math.imul(p,yt)|0)+Math.imul(B,Et)|0,o=o+Math.imul(B,yt)|0;var Gt=(u+(a=a+Math.imul(l,xt)|0)|0)+((8191&(n=(n=n+Math.imul(l,Ct)|0)+Math.imul(b,xt)|0))<<13)|0;u=((o=o+Math.imul(b,Ct)|0)+(n>>>13)|0)+(Gt>>>26)|0,Gt&=67108863,a=Math.imul(J,V),n=(n=Math.imul(J,X))+Math.imul(z,V)|0,o=Math.imul(z,X),a=a+Math.imul(H,et)|0,n=(n=n+Math.imul(H,tt)|0)+Math.imul(Y,et)|0,o=o+Math.imul(Y,tt)|0,a=a+Math.imul(P,at)|0,n=(n=n+Math.imul(P,it)|0)+Math.imul(q,at)|0,o=o+Math.imul(q,it)|0,a=a+Math.imul(G,ot)|0,n=(n=n+Math.imul(G,At)|0)+Math.imul(T,ot)|0,o=o+Math.imul(T,At)|0,a=a+Math.imul(N,ct)|0,n=(n=n+Math.imul(N,dt)|0)+Math.imul(D,ct)|0,o=o+Math.imul(D,dt)|0,a=a+Math.imul(w,ht)|0,n=(n=n+Math.imul(w,bt)|0)+Math.imul(_,ht)|0,o=o+Math.imul(_,bt)|0,a=a+Math.imul(x,Bt)|0,n=(n=n+Math.imul(x,mt)|0)+Math.imul(C,Bt)|0,o=o+Math.imul(C,mt)|0,a=a+Math.imul(I,Et)|0,n=(n=n+Math.imul(I,yt)|0)+Math.imul(y,Et)|0,o=o+Math.imul(y,yt)|0,a=a+Math.imul(p,xt)|0,n=(n=n+Math.imul(p,Ct)|0)+Math.imul(B,xt)|0,o=o+Math.imul(B,Ct)|0;var Tt=(u+(a=a+Math.imul(l,wt)|0)|0)+((8191&(n=(n=n+Math.imul(l,Mt)|0)+Math.imul(b,wt)|0))<<13)|0;u=((o=o+Math.imul(b,Mt)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,a=Math.imul(J,et),n=(n=Math.imul(J,tt))+Math.imul(z,et)|0,o=Math.imul(z,tt),a=a+Math.imul(H,at)|0,n=(n=n+Math.imul(H,it)|0)+Math.imul(Y,at)|0,o=o+Math.imul(Y,it)|0,a=a+Math.imul(P,ot)|0,n=(n=n+Math.imul(P,At)|0)+Math.imul(q,ot)|0,o=o+Math.imul(q,At)|0,a=a+Math.imul(G,ct)|0,n=(n=n+Math.imul(G,dt)|0)+Math.imul(T,ct)|0,o=o+Math.imul(T,dt)|0,a=a+Math.imul(N,ht)|0,n=(n=n+Math.imul(N,bt)|0)+Math.imul(D,ht)|0,o=o+Math.imul(D,bt)|0,a=a+Math.imul(w,Bt)|0,n=(n=n+Math.imul(w,mt)|0)+Math.imul(_,Bt)|0,o=o+Math.imul(_,mt)|0,a=a+Math.imul(x,Et)|0,n=(n=n+Math.imul(x,yt)|0)+Math.imul(C,Et)|0,o=o+Math.imul(C,yt)|0,a=a+Math.imul(I,xt)|0,n=(n=n+Math.imul(I,Ct)|0)+Math.imul(y,xt)|0,o=o+Math.imul(y,Ct)|0;var Lt=(u+(a=a+Math.imul(p,wt)|0)|0)+((8191&(n=(n=n+Math.imul(p,Mt)|0)+Math.imul(B,wt)|0))<<13)|0;u=((o=o+Math.imul(B,Mt)|0)+(n>>>13)|0)+(Lt>>>26)|0,Lt&=67108863,a=Math.imul(J,at),n=(n=Math.imul(J,it))+Math.imul(z,at)|0,o=Math.imul(z,it),a=a+Math.imul(H,ot)|0,n=(n=n+Math.imul(H,At)|0)+Math.imul(Y,ot)|0,o=o+Math.imul(Y,At)|0,a=a+Math.imul(P,ct)|0,n=(n=n+Math.imul(P,dt)|0)+Math.imul(q,ct)|0,o=o+Math.imul(q,dt)|0,a=a+Math.imul(G,ht)|0,n=(n=n+Math.imul(G,bt)|0)+Math.imul(T,ht)|0,o=o+Math.imul(T,bt)|0,a=a+Math.imul(N,Bt)|0,n=(n=n+Math.imul(N,mt)|0)+Math.imul(D,Bt)|0,o=o+Math.imul(D,mt)|0,a=a+Math.imul(w,Et)|0,n=(n=n+Math.imul(w,yt)|0)+Math.imul(_,Et)|0,o=o+Math.imul(_,yt)|0,a=a+Math.imul(x,xt)|0,n=(n=n+Math.imul(x,Ct)|0)+Math.imul(C,xt)|0,o=o+Math.imul(C,Ct)|0;var Pt=(u+(a=a+Math.imul(I,wt)|0)|0)+((8191&(n=(n=n+Math.imul(I,Mt)|0)+Math.imul(y,wt)|0))<<13)|0;u=((o=o+Math.imul(y,Mt)|0)+(n>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,a=Math.imul(J,ot),n=(n=Math.imul(J,At))+Math.imul(z,ot)|0,o=Math.imul(z,At),a=a+Math.imul(H,ct)|0,n=(n=n+Math.imul(H,dt)|0)+Math.imul(Y,ct)|0,o=o+Math.imul(Y,dt)|0,a=a+Math.imul(P,ht)|0,n=(n=n+Math.imul(P,bt)|0)+Math.imul(q,ht)|0,o=o+Math.imul(q,bt)|0,a=a+Math.imul(G,Bt)|0,n=(n=n+Math.imul(G,mt)|0)+Math.imul(T,Bt)|0,o=o+Math.imul(T,mt)|0,a=a+Math.imul(N,Et)|0,n=(n=n+Math.imul(N,yt)|0)+Math.imul(D,Et)|0,o=o+Math.imul(D,yt)|0,a=a+Math.imul(w,xt)|0,n=(n=n+Math.imul(w,Ct)|0)+Math.imul(_,xt)|0,o=o+Math.imul(_,Ct)|0;var qt=(u+(a=a+Math.imul(x,wt)|0)|0)+((8191&(n=(n=n+Math.imul(x,Mt)|0)+Math.imul(C,wt)|0))<<13)|0;u=((o=o+Math.imul(C,Mt)|0)+(n>>>13)|0)+(qt>>>26)|0,qt&=67108863,a=Math.imul(J,ct),n=(n=Math.imul(J,dt))+Math.imul(z,ct)|0,o=Math.imul(z,dt),a=a+Math.imul(H,ht)|0,n=(n=n+Math.imul(H,bt)|0)+Math.imul(Y,ht)|0,o=o+Math.imul(Y,bt)|0,a=a+Math.imul(P,Bt)|0,n=(n=n+Math.imul(P,mt)|0)+Math.imul(q,Bt)|0,o=o+Math.imul(q,mt)|0,a=a+Math.imul(G,Et)|0,n=(n=n+Math.imul(G,yt)|0)+Math.imul(T,Et)|0,o=o+Math.imul(T,yt)|0,a=a+Math.imul(N,xt)|0,n=(n=n+Math.imul(N,Ct)|0)+Math.imul(D,xt)|0,o=o+Math.imul(D,Ct)|0;var Ot=(u+(a=a+Math.imul(w,wt)|0)|0)+((8191&(n=(n=n+Math.imul(w,Mt)|0)+Math.imul(_,wt)|0))<<13)|0;u=((o=o+Math.imul(_,Mt)|0)+(n>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,a=Math.imul(J,ht),n=(n=Math.imul(J,bt))+Math.imul(z,ht)|0,o=Math.imul(z,bt),a=a+Math.imul(H,Bt)|0,n=(n=n+Math.imul(H,mt)|0)+Math.imul(Y,Bt)|0,o=o+Math.imul(Y,mt)|0,a=a+Math.imul(P,Et)|0,n=(n=n+Math.imul(P,yt)|0)+Math.imul(q,Et)|0,o=o+Math.imul(q,yt)|0,a=a+Math.imul(G,xt)|0,n=(n=n+Math.imul(G,Ct)|0)+Math.imul(T,xt)|0,o=o+Math.imul(T,Ct)|0;var Ht=(u+(a=a+Math.imul(N,wt)|0)|0)+((8191&(n=(n=n+Math.imul(N,Mt)|0)+Math.imul(D,wt)|0))<<13)|0;u=((o=o+Math.imul(D,Mt)|0)+(n>>>13)|0)+(Ht>>>26)|0,Ht&=67108863,a=Math.imul(J,Bt),n=(n=Math.imul(J,mt))+Math.imul(z,Bt)|0,o=Math.imul(z,mt),a=a+Math.imul(H,Et)|0,n=(n=n+Math.imul(H,yt)|0)+Math.imul(Y,Et)|0,o=o+Math.imul(Y,yt)|0,a=a+Math.imul(P,xt)|0,n=(n=n+Math.imul(P,Ct)|0)+Math.imul(q,xt)|0,o=o+Math.imul(q,Ct)|0;var Yt=(u+(a=a+Math.imul(G,wt)|0)|0)+((8191&(n=(n=n+Math.imul(G,Mt)|0)+Math.imul(T,wt)|0))<<13)|0;u=((o=o+Math.imul(T,Mt)|0)+(n>>>13)|0)+(Yt>>>26)|0,Yt&=67108863,a=Math.imul(J,Et),n=(n=Math.imul(J,yt))+Math.imul(z,Et)|0,o=Math.imul(z,yt),a=a+Math.imul(H,xt)|0,n=(n=n+Math.imul(H,Ct)|0)+Math.imul(Y,xt)|0,o=o+Math.imul(Y,Ct)|0;var jt=(u+(a=a+Math.imul(P,wt)|0)|0)+((8191&(n=(n=n+Math.imul(P,Mt)|0)+Math.imul(q,wt)|0))<<13)|0;u=((o=o+Math.imul(q,Mt)|0)+(n>>>13)|0)+(jt>>>26)|0,jt&=67108863,a=Math.imul(J,xt),n=(n=Math.imul(J,Ct))+Math.imul(z,xt)|0,o=Math.imul(z,Ct);var Jt=(u+(a=a+Math.imul(H,wt)|0)|0)+((8191&(n=(n=n+Math.imul(H,Mt)|0)+Math.imul(Y,wt)|0))<<13)|0;u=((o=o+Math.imul(Y,Mt)|0)+(n>>>13)|0)+(Jt>>>26)|0,Jt&=67108863;var Kt=(u+(a=Math.imul(J,wt))|0)+((8191&(n=(n=Math.imul(J,Mt))+Math.imul(z,wt)|0))<<13)|0;return u=((o=Math.imul(z,Mt))+(n>>>13)|0)+(Kt>>>26)|0,Kt&=67108863,d[0]=_t,d[1]=kt,d[2]=St,d[3]=Nt,d[4]=Dt,d[5]=Rt,d[6]=Ft,d[7]=Ut,d[8]=Gt,d[9]=Tt,d[10]=Lt,d[11]=Pt,d[12]=qt,d[13]=Ot,d[14]=Ht,d[15]=Yt,d[16]=jt,d[17]=Jt,d[18]=Kt,0!==u&&(d[19]=u,r.length++),r};function jumboMulTo(e,t,r){return(new FFTM).mulp(e,t,r)}function FFTM(e,t){this.x=e,this.y=t}Math.imul||(c=smallMulTo),BN.prototype.mulTo=function mulTo(e,t){var r=this.length+e.length;return 10===this.length&&10===e.length?c(this,e,t):r<63?smallMulTo(this,e,t):r<1024?function bigMulTo(e,t,r){r.negative=t.negative^e.negative,r.length=e.length+t.length;for(var a=0,n=0,o=0;o>>26)|0)>>>26,s&=67108863}r.words[o]=c,a=s,s=n}return 0!==a?r.words[o]=a:r.length--,r.strip()}(this,e,t):jumboMulTo(this,e,t)},FFTM.prototype.makeRBT=function makeRBT(e){for(var t=new Array(e),r=BN.prototype._countBits(e)-1,a=0;a>=1;return a},FFTM.prototype.permute=function permute(e,t,r,a,n,o){for(var s=0;s>>=1)n++;return 1<>>=13,r[2*o+1]=8191&n,n>>>=13;for(o=2*t;o>=26,t+=a/67108864|0,t+=n>>>26,this.words[r]=67108863&n}return 0!==t&&(this.words[r]=t,this.length++),this},BN.prototype.muln=function muln(e){return this.clone().imuln(e)},BN.prototype.sqr=function sqr(){return this.mul(this)},BN.prototype.isqr=function isqr(){return this.imul(this.clone())},BN.prototype.pow=function pow(e){var t=function toBitArray(e){for(var t=new Array(e.bitLength()),r=0;r>>n}return t}(e);if(0===t.length)return new BN(1);for(var r=this,a=0;a=0);var t,r=e%26,a=(e-r)/26,n=67108863>>>26-r<<26-r;if(0!==r){var o=0;for(t=0;t>>26-r}o&&(this.words[t]=o,this.length++)}if(0!==a){for(t=this.length-1;t>=0;t--)this.words[t+a]=this.words[t];for(t=0;t=0),a=t?(t-t%26)/26:0;var n=e%26,o=Math.min((e-n)/26,this.length),s=67108863^67108863>>>n<o)for(this.length-=o,d=0;d=0&&(0!==u||d>=a);d--){var h=0|this.words[d];this.words[d]=u<<26-n|h>>>n,u=h&s}return c&&0!==u&&(c.words[c.length++]=u),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},BN.prototype.ishrn=function ishrn(e,t,r){return assert(0===this.negative),this.iushrn(e,t,r)},BN.prototype.shln=function shln(e){return this.clone().ishln(e)},BN.prototype.ushln=function ushln(e){return this.clone().iushln(e)},BN.prototype.shrn=function shrn(e){return this.clone().ishrn(e)},BN.prototype.ushrn=function ushrn(e){return this.clone().iushrn(e)},BN.prototype.testn=function testn(e){assert("number"==typeof e&&e>=0);var t=e%26,r=(e-t)/26,a=1<=0);var t=e%26,r=(e-t)/26;if(assert(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==t&&r++,this.length=Math.min(r,this.length),0!==t){var a=67108863^67108863>>>t<=67108864;t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},BN.prototype.isubn=function isubn(e){if(assert("number"==typeof e),assert(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t>26)-(c/67108864|0),this.words[a+r]=67108863&n}for(;a>26,this.words[a+r]=67108863&n;if(0===s)return this.strip();for(assert(-1===s),s=0,a=0;a>26,this.words[a]=67108863&n;return this.negative=1,this.strip()},BN.prototype._wordDiv=function _wordDiv(e,t){var r=(this.length,e.length),a=this.clone(),n=e,o=0|n.words[n.length-1];0!==(r=26-this._countBits(o))&&(n=n.ushln(r),a.iushln(r),o=0|n.words[n.length-1]);var s,c=a.length-n.length;if("mod"!==t){(s=new BN(null)).length=c+1,s.words=new Array(s.length);for(var d=0;d=0;h--){var l=67108864*(0|a.words[n.length+h])+(0|a.words[n.length+h-1]);for(l=Math.min(l/o|0,67108863),a._ishlnsubmul(n,l,h);0!==a.negative;)l--,a.negative=0,a._ishlnsubmul(n,1,h),a.isZero()||(a.negative^=1);s&&(s.words[h]=l)}return s&&s.strip(),a.strip(),"div"!==t&&0!==r&&a.iushrn(r),{div:s||null,mod:a}},BN.prototype.divmod=function divmod(e,t,r){return assert(!e.isZero()),this.isZero()?{div:new BN(0),mod:new BN(0)}:0!==this.negative&&0===e.negative?(o=this.neg().divmod(e,t),"mod"!==t&&(a=o.div.neg()),"div"!==t&&(n=o.mod.neg(),r&&0!==n.negative&&n.iadd(e)),{div:a,mod:n}):0===this.negative&&0!==e.negative?(o=this.divmod(e.neg(),t),"mod"!==t&&(a=o.div.neg()),{div:a,mod:o.mod}):0!=(this.negative&e.negative)?(o=this.neg().divmod(e.neg(),t),"div"!==t&&(n=o.mod.neg(),r&&0!==n.negative&&n.isub(e)),{div:o.div,mod:n}):e.length>this.length||this.cmp(e)<0?{div:new BN(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new BN(this.modn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new BN(this.modn(e.words[0]))}:this._wordDiv(e,t);var a,n,o},BN.prototype.div=function div(e){return this.divmod(e,"div",!1).div},BN.prototype.mod=function mod(e){return this.divmod(e,"mod",!1).mod},BN.prototype.umod=function umod(e){return this.divmod(e,"mod",!0).mod},BN.prototype.divRound=function divRound(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var r=0!==t.div.negative?t.mod.isub(e):t.mod,a=e.ushrn(1),n=e.andln(1),o=r.cmp(a);return o<0||1===n&&0===o?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},BN.prototype.modn=function modn(e){assert(e<=67108863);for(var t=(1<<26)%e,r=0,a=this.length-1;a>=0;a--)r=(t*r+(0|this.words[a]))%e;return r},BN.prototype.idivn=function idivn(e){assert(e<=67108863);for(var t=0,r=this.length-1;r>=0;r--){var a=(0|this.words[r])+67108864*t;this.words[r]=a/e|0,t=a%e}return this.strip()},BN.prototype.divn=function divn(e){return this.clone().idivn(e)},BN.prototype.egcd=function egcd(e){assert(0===e.negative),assert(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var a=new BN(1),n=new BN(0),o=new BN(0),s=new BN(1),c=0;t.isEven()&&r.isEven();)t.iushrn(1),r.iushrn(1),++c;for(var d=r.clone(),u=t.clone();!t.isZero();){for(var h=0,l=1;0==(t.words[0]&l)&&h<26;++h,l<<=1);if(h>0)for(t.iushrn(h);h-- >0;)(a.isOdd()||n.isOdd())&&(a.iadd(d),n.isub(u)),a.iushrn(1),n.iushrn(1);for(var b=0,g=1;0==(r.words[0]&g)&&b<26;++b,g<<=1);if(b>0)for(r.iushrn(b);b-- >0;)(o.isOdd()||s.isOdd())&&(o.iadd(d),s.isub(u)),o.iushrn(1),s.iushrn(1);t.cmp(r)>=0?(t.isub(r),a.isub(o),n.isub(s)):(r.isub(t),o.isub(a),s.isub(n))}return{a:o,b:s,gcd:r.iushln(c)}},BN.prototype._invmp=function _invmp(e){assert(0===e.negative),assert(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var a,n=new BN(1),o=new BN(0),s=r.clone();t.cmpn(1)>0&&r.cmpn(1)>0;){for(var c=0,d=1;0==(t.words[0]&d)&&c<26;++c,d<<=1);if(c>0)for(t.iushrn(c);c-- >0;)n.isOdd()&&n.iadd(s),n.iushrn(1);for(var u=0,h=1;0==(r.words[0]&h)&&u<26;++u,h<<=1);if(u>0)for(r.iushrn(u);u-- >0;)o.isOdd()&&o.iadd(s),o.iushrn(1);t.cmp(r)>=0?(t.isub(r),n.isub(o)):(r.isub(t),o.isub(n))}return(a=0===t.cmpn(1)?n:o).cmpn(0)<0&&a.iadd(e),a},BN.prototype.gcd=function gcd(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),r=e.clone();t.negative=0,r.negative=0;for(var a=0;t.isEven()&&r.isEven();a++)t.iushrn(1),r.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=t.cmp(r);if(n<0){var o=t;t=r,r=o}else if(0===n||0===r.cmpn(1))break;t.isub(r)}return r.iushln(a)},BN.prototype.invm=function invm(e){return this.egcd(e).a.umod(e)},BN.prototype.isEven=function isEven(){return 0==(1&this.words[0])},BN.prototype.isOdd=function isOdd(){return 1==(1&this.words[0])},BN.prototype.andln=function andln(e){return this.words[0]&e},BN.prototype.bincn=function bincn(e){assert("number"==typeof e);var t=e%26,r=(e-t)/26,a=1<>>26,s&=67108863,this.words[o]=s}return 0!==n&&(this.words[o]=n,this.length++),this},BN.prototype.isZero=function isZero(){return 1===this.length&&0===this.words[0]},BN.prototype.cmpn=function cmpn(e){var t,r=e<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this.strip(),this.length>1)t=1;else{r&&(e=-e),assert(e<=67108863,"Number is too big");var a=0|this.words[0];t=a===e?0:ae.length)return 1;if(this.length=0;r--){var a=0|this.words[r],n=0|e.words[r];if(a!==n){an&&(t=1);break}}return t},BN.prototype.gtn=function gtn(e){return 1===this.cmpn(e)},BN.prototype.gt=function gt(e){return 1===this.cmp(e)},BN.prototype.gten=function gten(e){return this.cmpn(e)>=0},BN.prototype.gte=function gte(e){return this.cmp(e)>=0},BN.prototype.ltn=function ltn(e){return-1===this.cmpn(e)},BN.prototype.lt=function lt(e){return-1===this.cmp(e)},BN.prototype.lten=function lten(e){return this.cmpn(e)<=0},BN.prototype.lte=function lte(e){return this.cmp(e)<=0},BN.prototype.eqn=function eqn(e){return 0===this.cmpn(e)},BN.prototype.eq=function eq(e){return 0===this.cmp(e)},BN.red=function red(e){return new Red(e)},BN.prototype.toRed=function toRed(e){return assert(!this.red,"Already a number in reduction context"),assert(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},BN.prototype.fromRed=function fromRed(){return assert(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},BN.prototype._forceRed=function _forceRed(e){return this.red=e,this},BN.prototype.forceRed=function forceRed(e){return assert(!this.red,"Already a number in reduction context"),this._forceRed(e)},BN.prototype.redAdd=function redAdd(e){return assert(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},BN.prototype.redIAdd=function redIAdd(e){return assert(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},BN.prototype.redSub=function redSub(e){return assert(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},BN.prototype.redISub=function redISub(e){return assert(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},BN.prototype.redShl=function redShl(e){return assert(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},BN.prototype.redMul=function redMul(e){return assert(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},BN.prototype.redIMul=function redIMul(e){return assert(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},BN.prototype.redSqr=function redSqr(){return assert(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},BN.prototype.redISqr=function redISqr(){return assert(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},BN.prototype.redSqrt=function redSqrt(){return assert(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},BN.prototype.redInvm=function redInvm(){return assert(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},BN.prototype.redNeg=function redNeg(){return assert(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},BN.prototype.redPow=function redPow(e){return assert(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var d={k256:null,p224:null,p192:null,p25519:null};function MPrime(e,t){this.name=e,this.p=new BN(t,16),this.n=this.p.bitLength(),this.k=new BN(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function K256(){MPrime.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function P224(){MPrime.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function P192(){MPrime.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function P25519(){MPrime.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function Red(e){if("string"==typeof e){var t=BN._prime(e);this.m=t.p,this.prime=t}else assert(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function Mont(e){Red.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new BN(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)}MPrime.prototype._tmp=function _tmp(){var e=new BN(null);return e.words=new Array(Math.ceil(this.n/13)),e},MPrime.prototype.ireduce=function ireduce(e){var t,r=e;do{this.split(r,this.tmp),t=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(t>this.n);var a=t0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},MPrime.prototype.split=function split(e,t){e.iushrn(this.n,0,t)},MPrime.prototype.imulK=function imulK(e){return e.imul(this.k)},inherits(K256,MPrime),K256.prototype.split=function split(e,t){for(var r=4194303,a=Math.min(e.length,9),n=0;n>>22,o=s}o>>>=22,e.words[n-10]=o,0===o&&e.length>10?e.length-=10:e.length-=9},K256.prototype.imulK=function imulK(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,r=0;r>>=26,e.words[r]=n,t=a}return 0!==t&&(e.words[e.length++]=t),e},BN._prime=function prime(e){if(d[e])return d[e];var prime;if("k256"===e)prime=new K256;else if("p224"===e)prime=new P224;else if("p192"===e)prime=new P192;else{if("p25519"!==e)throw new Error("Unknown prime "+e);prime=new P25519}return d[e]=prime,prime},Red.prototype._verify1=function _verify1(e){assert(0===e.negative,"red works only with positives"),assert(e.red,"red works only with red numbers")},Red.prototype._verify2=function _verify2(e,t){assert(0==(e.negative|t.negative),"red works only with positives"),assert(e.red&&e.red===t.red,"red works only with red numbers")},Red.prototype.imod=function imod(e){return this.prime?this.prime.ireduce(e)._forceRed(this):e.umod(this.m)._forceRed(this)},Red.prototype.neg=function neg(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},Red.prototype.add=function add(e,t){this._verify2(e,t);var r=e.add(t);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},Red.prototype.iadd=function iadd(e,t){this._verify2(e,t);var r=e.iadd(t);return r.cmp(this.m)>=0&&r.isub(this.m),r},Red.prototype.sub=function sub(e,t){this._verify2(e,t);var r=e.sub(t);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},Red.prototype.isub=function isub(e,t){this._verify2(e,t);var r=e.isub(t);return r.cmpn(0)<0&&r.iadd(this.m),r},Red.prototype.shl=function shl(e,t){return this._verify1(e),this.imod(e.ushln(t))},Red.prototype.imul=function imul(e,t){return this._verify2(e,t),this.imod(e.imul(t))},Red.prototype.mul=function mul(e,t){return this._verify2(e,t),this.imod(e.mul(t))},Red.prototype.isqr=function isqr(e){return this.imul(e,e.clone())},Red.prototype.sqr=function sqr(e){return this.mul(e,e)},Red.prototype.sqrt=function sqrt(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(assert(t%2==1),3===t){var r=this.m.add(new BN(1)).iushrn(2);return this.pow(e,r)}for(var a=this.m.subn(1),n=0;!a.isZero()&&0===a.andln(1);)n++,a.iushrn(1);assert(!a.isZero());var o=new BN(1).toRed(this),s=o.redNeg(),c=this.m.subn(1).iushrn(1),d=this.m.bitLength();for(d=new BN(2*d*d).toRed(this);0!==this.pow(d,c).cmp(s);)d.redIAdd(s);for(var u=this.pow(d,a),h=this.pow(e,a.addn(1).iushrn(1)),l=this.pow(e,a),b=n;0!==l.cmp(o);){for(var g=l,p=0;0!==g.cmp(o);p++)g=g.redSqr();assert(p=0;a--){for(var d=t.words[a],u=c-1;u>=0;u--){var h=d>>u&1;n!==r[0]&&(n=this.sqr(n)),0!==h||0!==o?(o<<=1,o|=h,(4===++s||0===a&&0===u)&&(n=this.mul(n,r[o]),s=0,o=0)):s=0}c=26}return n},Red.prototype.convertTo=function convertTo(e){var t=e.umod(this.m);return t===e?t.clone():t},Red.prototype.convertFrom=function convertFrom(e){var t=e.clone();return t.red=null,t},BN.mont=function mont(e){return new Mont(e)},inherits(Mont,Red),Mont.prototype.convertTo=function convertTo(e){return this.imod(e.ushln(this.shift))},Mont.prototype.convertFrom=function convertFrom(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},Mont.prototype.imul=function imul(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var r=e.imul(t),a=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(a).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},Mont.prototype.mul=function mul(e,t){if(e.isZero()||t.isZero())return new BN(0)._forceRed(this);var r=e.mul(t),a=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(a).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},Mont.prototype.invm=function invm(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(e=r.nmd(e),this)},function(e,t,r){!function(e,t){"use strict";function assert(e,t){if(!e)throw new Error(t||"Assertion failed")}function inherits(e,t){e.super_=t;var TempCtor=function(){};TempCtor.prototype=t.prototype,e.prototype=new TempCtor,e.prototype.constructor=e}function BN(e,t,r){if(BN.isBN(e))return e;this.negative=0,this.words=null,this.length=0,this.red=null,null!==e&&("le"!==t&&"be"!==t||(r=t,t=10),this._init(e||0,t||10,r||"be"))}var a;"object"==typeof e?e.exports=BN:t.BN=BN,BN.BN=BN,BN.wordSize=26;try{a="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:r(17).Buffer}catch(e){}function parseHex4Bits(e,t){var r=e.charCodeAt(t);return r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:r-48&15}function parseHexByte(e,t,r){var a=parseHex4Bits(e,r);return r-1>=t&&(a|=parseHex4Bits(e,r-1)<<4),a}function parseBase(e,t,r,a){for(var n=0,o=Math.min(e.length,r),s=t;s=49?c-49+10:c>=17?c-17+10:c}return n}BN.isBN=function isBN(e){return e instanceof BN||null!==e&&"object"==typeof e&&e.constructor.wordSize===BN.wordSize&&Array.isArray(e.words)},BN.max=function max(e,t){return e.cmp(t)>0?e:t},BN.min=function min(e,t){return e.cmp(t)<0?e:t},BN.prototype._init=function init(e,t,r){if("number"==typeof e)return this._initNumber(e,t,r);if("object"==typeof e)return this._initArray(e,t,r);"hex"===t&&(t=16),assert(t===(0|t)&&t>=2&&t<=36);var a=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&(a++,this.negative=1),a=0;a-=3)o=e[a]|e[a-1]<<8|e[a-2]<<16,this.words[n]|=o<>>26-s&67108863,(s+=24)>=26&&(s-=26,n++);else if("le"===r)for(a=0,n=0;a>>26-s&67108863,(s+=24)>=26&&(s-=26,n++);return this.strip()},BN.prototype._parseHex=function _parseHex(e,t,r){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var a=0;a=t;a-=2)n=parseHexByte(e,t,a)<=18?(o-=18,s+=1,this.words[s]|=n>>>26):o+=8;else for(a=(e.length-t)%2==0?t+1:t;a=18?(o-=18,s+=1,this.words[s]|=n>>>26):o+=8;this.strip()},BN.prototype._parseBase=function _parseBase(e,t,r){this.words=[0],this.length=1;for(var a=0,n=1;n<=67108863;n*=t)a++;a--,n=n/t|0;for(var o=e.length-r,s=o%a,c=Math.min(o,o-s)+r,d=0,u=r;u1&&0===this.words[this.length-1];)this.length--;return this._normSign()},BN.prototype._normSign=function _normSign(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},BN.prototype.inspect=function inspect(){return(this.red?""};var n=["","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"],o=[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],s=[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 smallMulTo(e,t,r){r.negative=t.negative^e.negative;var a=e.length+t.length|0;r.length=a,a=a-1|0;var n=0|e.words[0],o=0|t.words[0],s=n*o,c=67108863&s,d=s/67108864|0;r.words[0]=c;for(var u=1;u>>26,l=67108863&d,b=Math.min(u,t.length-1),g=Math.max(0,u-e.length+1);g<=b;g++){var p=u-g|0;h+=(s=(n=0|e.words[p])*(o=0|t.words[g])+l)/67108864|0,l=67108863&s}r.words[u]=0|l,d=0|h}return 0!==d?r.words[u]=0|d:r.length--,r.strip()}BN.prototype.toString=function toString(e,t){var r;if(t=0|t||1,16===(e=e||10)||"hex"===e){r="";for(var a=0,c=0,d=0;d>>24-a&16777215)||d!==this.length-1?n[6-h.length]+h+r:h+r,(a+=2)>=26&&(a-=26,d--)}for(0!==c&&(r=c.toString(16)+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(e===(0|e)&&e>=2&&e<=36){var l=o[e],b=s[e];r="";var g=this.clone();for(g.negative=0;!g.isZero();){var p=g.modn(b).toString(e);r=(g=g.idivn(b)).isZero()?p+r:n[l-p.length]+p+r}for(this.isZero()&&(r="0"+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}assert(!1,"Base should be between 2 and 36")},BN.prototype.toNumber=function toNumber(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&assert(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},BN.prototype.toJSON=function toJSON(){return this.toString(16)},BN.prototype.toBuffer=function toBuffer(e,t){return assert(void 0!==a),this.toArrayLike(a,e,t)},BN.prototype.toArray=function toArray(e,t){return this.toArrayLike(Array,e,t)},BN.prototype.toArrayLike=function toArrayLike(e,t,r){var a=this.byteLength(),n=r||Math.max(1,a);assert(a<=n,"byte array longer than desired length"),assert(n>0,"Requested array length <= 0"),this.strip();var o,s,c="le"===t,d=new e(n),u=this.clone();if(c){for(s=0;!u.isZero();s++)o=u.andln(255),u.iushrn(8),d[s]=o;for(;s=4096&&(r+=13,t>>>=13),t>=64&&(r+=7,t>>>=7),t>=8&&(r+=4,t>>>=4),t>=2&&(r+=2,t>>>=2),r+t},BN.prototype._zeroBits=function _zeroBits(e){if(0===e)return 26;var t=e,r=0;return 0==(8191&t)&&(r+=13,t>>>=13),0==(127&t)&&(r+=7,t>>>=7),0==(15&t)&&(r+=4,t>>>=4),0==(3&t)&&(r+=2,t>>>=2),0==(1&t)&&r++,r},BN.prototype.bitLength=function bitLength(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},BN.prototype.zeroBits=function zeroBits(){if(this.isZero())return 0;for(var e=0,t=0;te.length?this.clone().ior(e):e.clone().ior(this)},BN.prototype.uor=function uor(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},BN.prototype.iuand=function iuand(e){var t;t=this.length>e.length?e:this;for(var r=0;re.length?this.clone().iand(e):e.clone().iand(this)},BN.prototype.uand=function uand(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},BN.prototype.iuxor=function iuxor(e){var t,r;this.length>e.length?(t=this,r=e):(t=e,r=this);for(var a=0;ae.length?this.clone().ixor(e):e.clone().ixor(this)},BN.prototype.uxor=function uxor(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},BN.prototype.inotn=function inotn(e){assert("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),r=e%26;this._expand(t),r>0&&t--;for(var a=0;a0&&(this.words[a]=~this.words[a]&67108863>>26-r),this.strip()},BN.prototype.notn=function notn(e){return this.clone().inotn(e)},BN.prototype.setn=function setn(e,t){assert("number"==typeof e&&e>=0);var r=e/26|0,a=e%26;return this._expand(r+1),this.words[r]=t?this.words[r]|1<e.length?(r=this,a=e):(r=e,a=this);for(var n=0,o=0;o>>26;for(;0!==n&&o>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;oe.length?this.clone().iadd(e):e.clone().iadd(this)},BN.prototype.isub=function isub(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var r,a,n=this.cmp(e);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,a=e):(r=e,a=this);for(var o=0,s=0;s>26,this.words[s]=67108863&t;for(;0!==o&&s>26,this.words[s]=67108863&t;if(0===o&&s>>13,g=0|s[1],p=8191&g,B=g>>>13,m=0|s[2],I=8191&m,y=m>>>13,v=0|s[3],x=8191&v,C=v>>>13,Q=0|s[4],w=8191&Q,_=Q>>>13,k=0|s[5],N=8191&k,D=k>>>13,U=0|s[6],G=8191&U,T=U>>>13,L=0|s[7],P=8191&L,q=L>>>13,O=0|s[8],H=8191&O,Y=O>>>13,j=0|s[9],J=8191&j,z=j>>>13,W=0|c[0],V=8191&W,X=W>>>13,$=0|c[1],et=8191&$,tt=$>>>13,rt=0|c[2],at=8191&rt,it=rt>>>13,nt=0|c[3],ot=8191&nt,At=nt>>>13,st=0|c[4],ct=8191&st,dt=st>>>13,ut=0|c[5],ht=8191&ut,bt=ut>>>13,pt=0|c[6],Bt=8191&pt,mt=pt>>>13,It=0|c[7],Et=8191&It,yt=It>>>13,vt=0|c[8],xt=8191&vt,Ct=vt>>>13,Qt=0|c[9],wt=8191&Qt,Mt=Qt>>>13;r.negative=e.negative^t.negative,r.length=19;var _t=(u+(a=Math.imul(l,V))|0)+((8191&(n=(n=Math.imul(l,X))+Math.imul(b,V)|0))<<13)|0;u=((o=Math.imul(b,X))+(n>>>13)|0)+(_t>>>26)|0,_t&=67108863,a=Math.imul(p,V),n=(n=Math.imul(p,X))+Math.imul(B,V)|0,o=Math.imul(B,X);var kt=(u+(a=a+Math.imul(l,et)|0)|0)+((8191&(n=(n=n+Math.imul(l,tt)|0)+Math.imul(b,et)|0))<<13)|0;u=((o=o+Math.imul(b,tt)|0)+(n>>>13)|0)+(kt>>>26)|0,kt&=67108863,a=Math.imul(I,V),n=(n=Math.imul(I,X))+Math.imul(y,V)|0,o=Math.imul(y,X),a=a+Math.imul(p,et)|0,n=(n=n+Math.imul(p,tt)|0)+Math.imul(B,et)|0,o=o+Math.imul(B,tt)|0;var St=(u+(a=a+Math.imul(l,at)|0)|0)+((8191&(n=(n=n+Math.imul(l,it)|0)+Math.imul(b,at)|0))<<13)|0;u=((o=o+Math.imul(b,it)|0)+(n>>>13)|0)+(St>>>26)|0,St&=67108863,a=Math.imul(x,V),n=(n=Math.imul(x,X))+Math.imul(C,V)|0,o=Math.imul(C,X),a=a+Math.imul(I,et)|0,n=(n=n+Math.imul(I,tt)|0)+Math.imul(y,et)|0,o=o+Math.imul(y,tt)|0,a=a+Math.imul(p,at)|0,n=(n=n+Math.imul(p,it)|0)+Math.imul(B,at)|0,o=o+Math.imul(B,it)|0;var Nt=(u+(a=a+Math.imul(l,ot)|0)|0)+((8191&(n=(n=n+Math.imul(l,At)|0)+Math.imul(b,ot)|0))<<13)|0;u=((o=o+Math.imul(b,At)|0)+(n>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,a=Math.imul(w,V),n=(n=Math.imul(w,X))+Math.imul(_,V)|0,o=Math.imul(_,X),a=a+Math.imul(x,et)|0,n=(n=n+Math.imul(x,tt)|0)+Math.imul(C,et)|0,o=o+Math.imul(C,tt)|0,a=a+Math.imul(I,at)|0,n=(n=n+Math.imul(I,it)|0)+Math.imul(y,at)|0,o=o+Math.imul(y,it)|0,a=a+Math.imul(p,ot)|0,n=(n=n+Math.imul(p,At)|0)+Math.imul(B,ot)|0,o=o+Math.imul(B,At)|0;var Dt=(u+(a=a+Math.imul(l,ct)|0)|0)+((8191&(n=(n=n+Math.imul(l,dt)|0)+Math.imul(b,ct)|0))<<13)|0;u=((o=o+Math.imul(b,dt)|0)+(n>>>13)|0)+(Dt>>>26)|0,Dt&=67108863,a=Math.imul(N,V),n=(n=Math.imul(N,X))+Math.imul(D,V)|0,o=Math.imul(D,X),a=a+Math.imul(w,et)|0,n=(n=n+Math.imul(w,tt)|0)+Math.imul(_,et)|0,o=o+Math.imul(_,tt)|0,a=a+Math.imul(x,at)|0,n=(n=n+Math.imul(x,it)|0)+Math.imul(C,at)|0,o=o+Math.imul(C,it)|0,a=a+Math.imul(I,ot)|0,n=(n=n+Math.imul(I,At)|0)+Math.imul(y,ot)|0,o=o+Math.imul(y,At)|0,a=a+Math.imul(p,ct)|0,n=(n=n+Math.imul(p,dt)|0)+Math.imul(B,ct)|0,o=o+Math.imul(B,dt)|0;var Rt=(u+(a=a+Math.imul(l,ht)|0)|0)+((8191&(n=(n=n+Math.imul(l,bt)|0)+Math.imul(b,ht)|0))<<13)|0;u=((o=o+Math.imul(b,bt)|0)+(n>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,a=Math.imul(G,V),n=(n=Math.imul(G,X))+Math.imul(T,V)|0,o=Math.imul(T,X),a=a+Math.imul(N,et)|0,n=(n=n+Math.imul(N,tt)|0)+Math.imul(D,et)|0,o=o+Math.imul(D,tt)|0,a=a+Math.imul(w,at)|0,n=(n=n+Math.imul(w,it)|0)+Math.imul(_,at)|0,o=o+Math.imul(_,it)|0,a=a+Math.imul(x,ot)|0,n=(n=n+Math.imul(x,At)|0)+Math.imul(C,ot)|0,o=o+Math.imul(C,At)|0,a=a+Math.imul(I,ct)|0,n=(n=n+Math.imul(I,dt)|0)+Math.imul(y,ct)|0,o=o+Math.imul(y,dt)|0,a=a+Math.imul(p,ht)|0,n=(n=n+Math.imul(p,bt)|0)+Math.imul(B,ht)|0,o=o+Math.imul(B,bt)|0;var Ft=(u+(a=a+Math.imul(l,Bt)|0)|0)+((8191&(n=(n=n+Math.imul(l,mt)|0)+Math.imul(b,Bt)|0))<<13)|0;u=((o=o+Math.imul(b,mt)|0)+(n>>>13)|0)+(Ft>>>26)|0,Ft&=67108863,a=Math.imul(P,V),n=(n=Math.imul(P,X))+Math.imul(q,V)|0,o=Math.imul(q,X),a=a+Math.imul(G,et)|0,n=(n=n+Math.imul(G,tt)|0)+Math.imul(T,et)|0,o=o+Math.imul(T,tt)|0,a=a+Math.imul(N,at)|0,n=(n=n+Math.imul(N,it)|0)+Math.imul(D,at)|0,o=o+Math.imul(D,it)|0,a=a+Math.imul(w,ot)|0,n=(n=n+Math.imul(w,At)|0)+Math.imul(_,ot)|0,o=o+Math.imul(_,At)|0,a=a+Math.imul(x,ct)|0,n=(n=n+Math.imul(x,dt)|0)+Math.imul(C,ct)|0,o=o+Math.imul(C,dt)|0,a=a+Math.imul(I,ht)|0,n=(n=n+Math.imul(I,bt)|0)+Math.imul(y,ht)|0,o=o+Math.imul(y,bt)|0,a=a+Math.imul(p,Bt)|0,n=(n=n+Math.imul(p,mt)|0)+Math.imul(B,Bt)|0,o=o+Math.imul(B,mt)|0;var Ut=(u+(a=a+Math.imul(l,Et)|0)|0)+((8191&(n=(n=n+Math.imul(l,yt)|0)+Math.imul(b,Et)|0))<<13)|0;u=((o=o+Math.imul(b,yt)|0)+(n>>>13)|0)+(Ut>>>26)|0,Ut&=67108863,a=Math.imul(H,V),n=(n=Math.imul(H,X))+Math.imul(Y,V)|0,o=Math.imul(Y,X),a=a+Math.imul(P,et)|0,n=(n=n+Math.imul(P,tt)|0)+Math.imul(q,et)|0,o=o+Math.imul(q,tt)|0,a=a+Math.imul(G,at)|0,n=(n=n+Math.imul(G,it)|0)+Math.imul(T,at)|0,o=o+Math.imul(T,it)|0,a=a+Math.imul(N,ot)|0,n=(n=n+Math.imul(N,At)|0)+Math.imul(D,ot)|0,o=o+Math.imul(D,At)|0,a=a+Math.imul(w,ct)|0,n=(n=n+Math.imul(w,dt)|0)+Math.imul(_,ct)|0,o=o+Math.imul(_,dt)|0,a=a+Math.imul(x,ht)|0,n=(n=n+Math.imul(x,bt)|0)+Math.imul(C,ht)|0,o=o+Math.imul(C,bt)|0,a=a+Math.imul(I,Bt)|0,n=(n=n+Math.imul(I,mt)|0)+Math.imul(y,Bt)|0,o=o+Math.imul(y,mt)|0,a=a+Math.imul(p,Et)|0,n=(n=n+Math.imul(p,yt)|0)+Math.imul(B,Et)|0,o=o+Math.imul(B,yt)|0;var Gt=(u+(a=a+Math.imul(l,xt)|0)|0)+((8191&(n=(n=n+Math.imul(l,Ct)|0)+Math.imul(b,xt)|0))<<13)|0;u=((o=o+Math.imul(b,Ct)|0)+(n>>>13)|0)+(Gt>>>26)|0,Gt&=67108863,a=Math.imul(J,V),n=(n=Math.imul(J,X))+Math.imul(z,V)|0,o=Math.imul(z,X),a=a+Math.imul(H,et)|0,n=(n=n+Math.imul(H,tt)|0)+Math.imul(Y,et)|0,o=o+Math.imul(Y,tt)|0,a=a+Math.imul(P,at)|0,n=(n=n+Math.imul(P,it)|0)+Math.imul(q,at)|0,o=o+Math.imul(q,it)|0,a=a+Math.imul(G,ot)|0,n=(n=n+Math.imul(G,At)|0)+Math.imul(T,ot)|0,o=o+Math.imul(T,At)|0,a=a+Math.imul(N,ct)|0,n=(n=n+Math.imul(N,dt)|0)+Math.imul(D,ct)|0,o=o+Math.imul(D,dt)|0,a=a+Math.imul(w,ht)|0,n=(n=n+Math.imul(w,bt)|0)+Math.imul(_,ht)|0,o=o+Math.imul(_,bt)|0,a=a+Math.imul(x,Bt)|0,n=(n=n+Math.imul(x,mt)|0)+Math.imul(C,Bt)|0,o=o+Math.imul(C,mt)|0,a=a+Math.imul(I,Et)|0,n=(n=n+Math.imul(I,yt)|0)+Math.imul(y,Et)|0,o=o+Math.imul(y,yt)|0,a=a+Math.imul(p,xt)|0,n=(n=n+Math.imul(p,Ct)|0)+Math.imul(B,xt)|0,o=o+Math.imul(B,Ct)|0;var Tt=(u+(a=a+Math.imul(l,wt)|0)|0)+((8191&(n=(n=n+Math.imul(l,Mt)|0)+Math.imul(b,wt)|0))<<13)|0;u=((o=o+Math.imul(b,Mt)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,a=Math.imul(J,et),n=(n=Math.imul(J,tt))+Math.imul(z,et)|0,o=Math.imul(z,tt),a=a+Math.imul(H,at)|0,n=(n=n+Math.imul(H,it)|0)+Math.imul(Y,at)|0,o=o+Math.imul(Y,it)|0,a=a+Math.imul(P,ot)|0,n=(n=n+Math.imul(P,At)|0)+Math.imul(q,ot)|0,o=o+Math.imul(q,At)|0,a=a+Math.imul(G,ct)|0,n=(n=n+Math.imul(G,dt)|0)+Math.imul(T,ct)|0,o=o+Math.imul(T,dt)|0,a=a+Math.imul(N,ht)|0,n=(n=n+Math.imul(N,bt)|0)+Math.imul(D,ht)|0,o=o+Math.imul(D,bt)|0,a=a+Math.imul(w,Bt)|0,n=(n=n+Math.imul(w,mt)|0)+Math.imul(_,Bt)|0,o=o+Math.imul(_,mt)|0,a=a+Math.imul(x,Et)|0,n=(n=n+Math.imul(x,yt)|0)+Math.imul(C,Et)|0,o=o+Math.imul(C,yt)|0,a=a+Math.imul(I,xt)|0,n=(n=n+Math.imul(I,Ct)|0)+Math.imul(y,xt)|0,o=o+Math.imul(y,Ct)|0;var Lt=(u+(a=a+Math.imul(p,wt)|0)|0)+((8191&(n=(n=n+Math.imul(p,Mt)|0)+Math.imul(B,wt)|0))<<13)|0;u=((o=o+Math.imul(B,Mt)|0)+(n>>>13)|0)+(Lt>>>26)|0,Lt&=67108863,a=Math.imul(J,at),n=(n=Math.imul(J,it))+Math.imul(z,at)|0,o=Math.imul(z,it),a=a+Math.imul(H,ot)|0,n=(n=n+Math.imul(H,At)|0)+Math.imul(Y,ot)|0,o=o+Math.imul(Y,At)|0,a=a+Math.imul(P,ct)|0,n=(n=n+Math.imul(P,dt)|0)+Math.imul(q,ct)|0,o=o+Math.imul(q,dt)|0,a=a+Math.imul(G,ht)|0,n=(n=n+Math.imul(G,bt)|0)+Math.imul(T,ht)|0,o=o+Math.imul(T,bt)|0,a=a+Math.imul(N,Bt)|0,n=(n=n+Math.imul(N,mt)|0)+Math.imul(D,Bt)|0,o=o+Math.imul(D,mt)|0,a=a+Math.imul(w,Et)|0,n=(n=n+Math.imul(w,yt)|0)+Math.imul(_,Et)|0,o=o+Math.imul(_,yt)|0,a=a+Math.imul(x,xt)|0,n=(n=n+Math.imul(x,Ct)|0)+Math.imul(C,xt)|0,o=o+Math.imul(C,Ct)|0;var Pt=(u+(a=a+Math.imul(I,wt)|0)|0)+((8191&(n=(n=n+Math.imul(I,Mt)|0)+Math.imul(y,wt)|0))<<13)|0;u=((o=o+Math.imul(y,Mt)|0)+(n>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,a=Math.imul(J,ot),n=(n=Math.imul(J,At))+Math.imul(z,ot)|0,o=Math.imul(z,At),a=a+Math.imul(H,ct)|0,n=(n=n+Math.imul(H,dt)|0)+Math.imul(Y,ct)|0,o=o+Math.imul(Y,dt)|0,a=a+Math.imul(P,ht)|0,n=(n=n+Math.imul(P,bt)|0)+Math.imul(q,ht)|0,o=o+Math.imul(q,bt)|0,a=a+Math.imul(G,Bt)|0,n=(n=n+Math.imul(G,mt)|0)+Math.imul(T,Bt)|0,o=o+Math.imul(T,mt)|0,a=a+Math.imul(N,Et)|0,n=(n=n+Math.imul(N,yt)|0)+Math.imul(D,Et)|0,o=o+Math.imul(D,yt)|0,a=a+Math.imul(w,xt)|0,n=(n=n+Math.imul(w,Ct)|0)+Math.imul(_,xt)|0,o=o+Math.imul(_,Ct)|0;var qt=(u+(a=a+Math.imul(x,wt)|0)|0)+((8191&(n=(n=n+Math.imul(x,Mt)|0)+Math.imul(C,wt)|0))<<13)|0;u=((o=o+Math.imul(C,Mt)|0)+(n>>>13)|0)+(qt>>>26)|0,qt&=67108863,a=Math.imul(J,ct),n=(n=Math.imul(J,dt))+Math.imul(z,ct)|0,o=Math.imul(z,dt),a=a+Math.imul(H,ht)|0,n=(n=n+Math.imul(H,bt)|0)+Math.imul(Y,ht)|0,o=o+Math.imul(Y,bt)|0,a=a+Math.imul(P,Bt)|0,n=(n=n+Math.imul(P,mt)|0)+Math.imul(q,Bt)|0,o=o+Math.imul(q,mt)|0,a=a+Math.imul(G,Et)|0,n=(n=n+Math.imul(G,yt)|0)+Math.imul(T,Et)|0,o=o+Math.imul(T,yt)|0,a=a+Math.imul(N,xt)|0,n=(n=n+Math.imul(N,Ct)|0)+Math.imul(D,xt)|0,o=o+Math.imul(D,Ct)|0;var Ot=(u+(a=a+Math.imul(w,wt)|0)|0)+((8191&(n=(n=n+Math.imul(w,Mt)|0)+Math.imul(_,wt)|0))<<13)|0;u=((o=o+Math.imul(_,Mt)|0)+(n>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,a=Math.imul(J,ht),n=(n=Math.imul(J,bt))+Math.imul(z,ht)|0,o=Math.imul(z,bt),a=a+Math.imul(H,Bt)|0,n=(n=n+Math.imul(H,mt)|0)+Math.imul(Y,Bt)|0,o=o+Math.imul(Y,mt)|0,a=a+Math.imul(P,Et)|0,n=(n=n+Math.imul(P,yt)|0)+Math.imul(q,Et)|0,o=o+Math.imul(q,yt)|0,a=a+Math.imul(G,xt)|0,n=(n=n+Math.imul(G,Ct)|0)+Math.imul(T,xt)|0,o=o+Math.imul(T,Ct)|0;var Ht=(u+(a=a+Math.imul(N,wt)|0)|0)+((8191&(n=(n=n+Math.imul(N,Mt)|0)+Math.imul(D,wt)|0))<<13)|0;u=((o=o+Math.imul(D,Mt)|0)+(n>>>13)|0)+(Ht>>>26)|0,Ht&=67108863,a=Math.imul(J,Bt),n=(n=Math.imul(J,mt))+Math.imul(z,Bt)|0,o=Math.imul(z,mt),a=a+Math.imul(H,Et)|0,n=(n=n+Math.imul(H,yt)|0)+Math.imul(Y,Et)|0,o=o+Math.imul(Y,yt)|0,a=a+Math.imul(P,xt)|0,n=(n=n+Math.imul(P,Ct)|0)+Math.imul(q,xt)|0,o=o+Math.imul(q,Ct)|0;var Yt=(u+(a=a+Math.imul(G,wt)|0)|0)+((8191&(n=(n=n+Math.imul(G,Mt)|0)+Math.imul(T,wt)|0))<<13)|0;u=((o=o+Math.imul(T,Mt)|0)+(n>>>13)|0)+(Yt>>>26)|0,Yt&=67108863,a=Math.imul(J,Et),n=(n=Math.imul(J,yt))+Math.imul(z,Et)|0,o=Math.imul(z,yt),a=a+Math.imul(H,xt)|0,n=(n=n+Math.imul(H,Ct)|0)+Math.imul(Y,xt)|0,o=o+Math.imul(Y,Ct)|0;var jt=(u+(a=a+Math.imul(P,wt)|0)|0)+((8191&(n=(n=n+Math.imul(P,Mt)|0)+Math.imul(q,wt)|0))<<13)|0;u=((o=o+Math.imul(q,Mt)|0)+(n>>>13)|0)+(jt>>>26)|0,jt&=67108863,a=Math.imul(J,xt),n=(n=Math.imul(J,Ct))+Math.imul(z,xt)|0,o=Math.imul(z,Ct);var Jt=(u+(a=a+Math.imul(H,wt)|0)|0)+((8191&(n=(n=n+Math.imul(H,Mt)|0)+Math.imul(Y,wt)|0))<<13)|0;u=((o=o+Math.imul(Y,Mt)|0)+(n>>>13)|0)+(Jt>>>26)|0,Jt&=67108863;var Kt=(u+(a=Math.imul(J,wt))|0)+((8191&(n=(n=Math.imul(J,Mt))+Math.imul(z,wt)|0))<<13)|0;return u=((o=Math.imul(z,Mt))+(n>>>13)|0)+(Kt>>>26)|0,Kt&=67108863,d[0]=_t,d[1]=kt,d[2]=St,d[3]=Nt,d[4]=Dt,d[5]=Rt,d[6]=Ft,d[7]=Ut,d[8]=Gt,d[9]=Tt,d[10]=Lt,d[11]=Pt,d[12]=qt,d[13]=Ot,d[14]=Ht,d[15]=Yt,d[16]=jt,d[17]=Jt,d[18]=Kt,0!==u&&(d[19]=u,r.length++),r};function jumboMulTo(e,t,r){return(new FFTM).mulp(e,t,r)}function FFTM(e,t){this.x=e,this.y=t}Math.imul||(c=smallMulTo),BN.prototype.mulTo=function mulTo(e,t){var r=this.length+e.length;return 10===this.length&&10===e.length?c(this,e,t):r<63?smallMulTo(this,e,t):r<1024?function bigMulTo(e,t,r){r.negative=t.negative^e.negative,r.length=e.length+t.length;for(var a=0,n=0,o=0;o>>26)|0)>>>26,s&=67108863}r.words[o]=c,a=s,s=n}return 0!==a?r.words[o]=a:r.length--,r.strip()}(this,e,t):jumboMulTo(this,e,t)},FFTM.prototype.makeRBT=function makeRBT(e){for(var t=new Array(e),r=BN.prototype._countBits(e)-1,a=0;a>=1;return a},FFTM.prototype.permute=function permute(e,t,r,a,n,o){for(var s=0;s>>=1)n++;return 1<>>=13,r[2*o+1]=8191&n,n>>>=13;for(o=2*t;o>=26,t+=a/67108864|0,t+=n>>>26,this.words[r]=67108863&n}return 0!==t&&(this.words[r]=t,this.length++),this},BN.prototype.muln=function muln(e){return this.clone().imuln(e)},BN.prototype.sqr=function sqr(){return this.mul(this)},BN.prototype.isqr=function isqr(){return this.imul(this.clone())},BN.prototype.pow=function pow(e){var t=function toBitArray(e){for(var t=new Array(e.bitLength()),r=0;r>>n}return t}(e);if(0===t.length)return new BN(1);for(var r=this,a=0;a=0);var t,r=e%26,a=(e-r)/26,n=67108863>>>26-r<<26-r;if(0!==r){var o=0;for(t=0;t>>26-r}o&&(this.words[t]=o,this.length++)}if(0!==a){for(t=this.length-1;t>=0;t--)this.words[t+a]=this.words[t];for(t=0;t=0),a=t?(t-t%26)/26:0;var n=e%26,o=Math.min((e-n)/26,this.length),s=67108863^67108863>>>n<o)for(this.length-=o,d=0;d=0&&(0!==u||d>=a);d--){var h=0|this.words[d];this.words[d]=u<<26-n|h>>>n,u=h&s}return c&&0!==u&&(c.words[c.length++]=u),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},BN.prototype.ishrn=function ishrn(e,t,r){return assert(0===this.negative),this.iushrn(e,t,r)},BN.prototype.shln=function shln(e){return this.clone().ishln(e)},BN.prototype.ushln=function ushln(e){return this.clone().iushln(e)},BN.prototype.shrn=function shrn(e){return this.clone().ishrn(e)},BN.prototype.ushrn=function ushrn(e){return this.clone().iushrn(e)},BN.prototype.testn=function testn(e){assert("number"==typeof e&&e>=0);var t=e%26,r=(e-t)/26,a=1<=0);var t=e%26,r=(e-t)/26;if(assert(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==t&&r++,this.length=Math.min(r,this.length),0!==t){var a=67108863^67108863>>>t<=67108864;t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},BN.prototype.isubn=function isubn(e){if(assert("number"==typeof e),assert(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t>26)-(c/67108864|0),this.words[a+r]=67108863&n}for(;a>26,this.words[a+r]=67108863&n;if(0===s)return this.strip();for(assert(-1===s),s=0,a=0;a>26,this.words[a]=67108863&n;return this.negative=1,this.strip()},BN.prototype._wordDiv=function _wordDiv(e,t){var r=(this.length,e.length),a=this.clone(),n=e,o=0|n.words[n.length-1];0!==(r=26-this._countBits(o))&&(n=n.ushln(r),a.iushln(r),o=0|n.words[n.length-1]);var s,c=a.length-n.length;if("mod"!==t){(s=new BN(null)).length=c+1,s.words=new Array(s.length);for(var d=0;d=0;h--){var l=67108864*(0|a.words[n.length+h])+(0|a.words[n.length+h-1]);for(l=Math.min(l/o|0,67108863),a._ishlnsubmul(n,l,h);0!==a.negative;)l--,a.negative=0,a._ishlnsubmul(n,1,h),a.isZero()||(a.negative^=1);s&&(s.words[h]=l)}return s&&s.strip(),a.strip(),"div"!==t&&0!==r&&a.iushrn(r),{div:s||null,mod:a}},BN.prototype.divmod=function divmod(e,t,r){return assert(!e.isZero()),this.isZero()?{div:new BN(0),mod:new BN(0)}:0!==this.negative&&0===e.negative?(o=this.neg().divmod(e,t),"mod"!==t&&(a=o.div.neg()),"div"!==t&&(n=o.mod.neg(),r&&0!==n.negative&&n.iadd(e)),{div:a,mod:n}):0===this.negative&&0!==e.negative?(o=this.divmod(e.neg(),t),"mod"!==t&&(a=o.div.neg()),{div:a,mod:o.mod}):0!=(this.negative&e.negative)?(o=this.neg().divmod(e.neg(),t),"div"!==t&&(n=o.mod.neg(),r&&0!==n.negative&&n.isub(e)),{div:o.div,mod:n}):e.length>this.length||this.cmp(e)<0?{div:new BN(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new BN(this.modn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new BN(this.modn(e.words[0]))}:this._wordDiv(e,t);var a,n,o},BN.prototype.div=function div(e){return this.divmod(e,"div",!1).div},BN.prototype.mod=function mod(e){return this.divmod(e,"mod",!1).mod},BN.prototype.umod=function umod(e){return this.divmod(e,"mod",!0).mod},BN.prototype.divRound=function divRound(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var r=0!==t.div.negative?t.mod.isub(e):t.mod,a=e.ushrn(1),n=e.andln(1),o=r.cmp(a);return o<0||1===n&&0===o?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},BN.prototype.modn=function modn(e){assert(e<=67108863);for(var t=(1<<26)%e,r=0,a=this.length-1;a>=0;a--)r=(t*r+(0|this.words[a]))%e;return r},BN.prototype.idivn=function idivn(e){assert(e<=67108863);for(var t=0,r=this.length-1;r>=0;r--){var a=(0|this.words[r])+67108864*t;this.words[r]=a/e|0,t=a%e}return this.strip()},BN.prototype.divn=function divn(e){return this.clone().idivn(e)},BN.prototype.egcd=function egcd(e){assert(0===e.negative),assert(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var a=new BN(1),n=new BN(0),o=new BN(0),s=new BN(1),c=0;t.isEven()&&r.isEven();)t.iushrn(1),r.iushrn(1),++c;for(var d=r.clone(),u=t.clone();!t.isZero();){for(var h=0,l=1;0==(t.words[0]&l)&&h<26;++h,l<<=1);if(h>0)for(t.iushrn(h);h-- >0;)(a.isOdd()||n.isOdd())&&(a.iadd(d),n.isub(u)),a.iushrn(1),n.iushrn(1);for(var b=0,g=1;0==(r.words[0]&g)&&b<26;++b,g<<=1);if(b>0)for(r.iushrn(b);b-- >0;)(o.isOdd()||s.isOdd())&&(o.iadd(d),s.isub(u)),o.iushrn(1),s.iushrn(1);t.cmp(r)>=0?(t.isub(r),a.isub(o),n.isub(s)):(r.isub(t),o.isub(a),s.isub(n))}return{a:o,b:s,gcd:r.iushln(c)}},BN.prototype._invmp=function _invmp(e){assert(0===e.negative),assert(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var a,n=new BN(1),o=new BN(0),s=r.clone();t.cmpn(1)>0&&r.cmpn(1)>0;){for(var c=0,d=1;0==(t.words[0]&d)&&c<26;++c,d<<=1);if(c>0)for(t.iushrn(c);c-- >0;)n.isOdd()&&n.iadd(s),n.iushrn(1);for(var u=0,h=1;0==(r.words[0]&h)&&u<26;++u,h<<=1);if(u>0)for(r.iushrn(u);u-- >0;)o.isOdd()&&o.iadd(s),o.iushrn(1);t.cmp(r)>=0?(t.isub(r),n.isub(o)):(r.isub(t),o.isub(n))}return(a=0===t.cmpn(1)?n:o).cmpn(0)<0&&a.iadd(e),a},BN.prototype.gcd=function gcd(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),r=e.clone();t.negative=0,r.negative=0;for(var a=0;t.isEven()&&r.isEven();a++)t.iushrn(1),r.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=t.cmp(r);if(n<0){var o=t;t=r,r=o}else if(0===n||0===r.cmpn(1))break;t.isub(r)}return r.iushln(a)},BN.prototype.invm=function invm(e){return this.egcd(e).a.umod(e)},BN.prototype.isEven=function isEven(){return 0==(1&this.words[0])},BN.prototype.isOdd=function isOdd(){return 1==(1&this.words[0])},BN.prototype.andln=function andln(e){return this.words[0]&e},BN.prototype.bincn=function bincn(e){assert("number"==typeof e);var t=e%26,r=(e-t)/26,a=1<>>26,s&=67108863,this.words[o]=s}return 0!==n&&(this.words[o]=n,this.length++),this},BN.prototype.isZero=function isZero(){return 1===this.length&&0===this.words[0]},BN.prototype.cmpn=function cmpn(e){var t,r=e<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this.strip(),this.length>1)t=1;else{r&&(e=-e),assert(e<=67108863,"Number is too big");var a=0|this.words[0];t=a===e?0:ae.length)return 1;if(this.length=0;r--){var a=0|this.words[r],n=0|e.words[r];if(a!==n){an&&(t=1);break}}return t},BN.prototype.gtn=function gtn(e){return 1===this.cmpn(e)},BN.prototype.gt=function gt(e){return 1===this.cmp(e)},BN.prototype.gten=function gten(e){return this.cmpn(e)>=0},BN.prototype.gte=function gte(e){return this.cmp(e)>=0},BN.prototype.ltn=function ltn(e){return-1===this.cmpn(e)},BN.prototype.lt=function lt(e){return-1===this.cmp(e)},BN.prototype.lten=function lten(e){return this.cmpn(e)<=0},BN.prototype.lte=function lte(e){return this.cmp(e)<=0},BN.prototype.eqn=function eqn(e){return 0===this.cmpn(e)},BN.prototype.eq=function eq(e){return 0===this.cmp(e)},BN.red=function red(e){return new Red(e)},BN.prototype.toRed=function toRed(e){return assert(!this.red,"Already a number in reduction context"),assert(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},BN.prototype.fromRed=function fromRed(){return assert(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},BN.prototype._forceRed=function _forceRed(e){return this.red=e,this},BN.prototype.forceRed=function forceRed(e){return assert(!this.red,"Already a number in reduction context"),this._forceRed(e)},BN.prototype.redAdd=function redAdd(e){return assert(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},BN.prototype.redIAdd=function redIAdd(e){return assert(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},BN.prototype.redSub=function redSub(e){return assert(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},BN.prototype.redISub=function redISub(e){return assert(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},BN.prototype.redShl=function redShl(e){return assert(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},BN.prototype.redMul=function redMul(e){return assert(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},BN.prototype.redIMul=function redIMul(e){return assert(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},BN.prototype.redSqr=function redSqr(){return assert(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},BN.prototype.redISqr=function redISqr(){return assert(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},BN.prototype.redSqrt=function redSqrt(){return assert(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},BN.prototype.redInvm=function redInvm(){return assert(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},BN.prototype.redNeg=function redNeg(){return assert(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},BN.prototype.redPow=function redPow(e){return assert(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var d={k256:null,p224:null,p192:null,p25519:null};function MPrime(e,t){this.name=e,this.p=new BN(t,16),this.n=this.p.bitLength(),this.k=new BN(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function K256(){MPrime.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function P224(){MPrime.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function P192(){MPrime.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function P25519(){MPrime.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function Red(e){if("string"==typeof e){var t=BN._prime(e);this.m=t.p,this.prime=t}else assert(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function Mont(e){Red.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new BN(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)}MPrime.prototype._tmp=function _tmp(){var e=new BN(null);return e.words=new Array(Math.ceil(this.n/13)),e},MPrime.prototype.ireduce=function ireduce(e){var t,r=e;do{this.split(r,this.tmp),t=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(t>this.n);var a=t0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},MPrime.prototype.split=function split(e,t){e.iushrn(this.n,0,t)},MPrime.prototype.imulK=function imulK(e){return e.imul(this.k)},inherits(K256,MPrime),K256.prototype.split=function split(e,t){for(var r=4194303,a=Math.min(e.length,9),n=0;n>>22,o=s}o>>>=22,e.words[n-10]=o,0===o&&e.length>10?e.length-=10:e.length-=9},K256.prototype.imulK=function imulK(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,r=0;r>>=26,e.words[r]=n,t=a}return 0!==t&&(e.words[e.length++]=t),e},BN._prime=function prime(e){if(d[e])return d[e];var prime;if("k256"===e)prime=new K256;else if("p224"===e)prime=new P224;else if("p192"===e)prime=new P192;else{if("p25519"!==e)throw new Error("Unknown prime "+e);prime=new P25519}return d[e]=prime,prime},Red.prototype._verify1=function _verify1(e){assert(0===e.negative,"red works only with positives"),assert(e.red,"red works only with red numbers")},Red.prototype._verify2=function _verify2(e,t){assert(0==(e.negative|t.negative),"red works only with positives"),assert(e.red&&e.red===t.red,"red works only with red numbers")},Red.prototype.imod=function imod(e){return this.prime?this.prime.ireduce(e)._forceRed(this):e.umod(this.m)._forceRed(this)},Red.prototype.neg=function neg(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},Red.prototype.add=function add(e,t){this._verify2(e,t);var r=e.add(t);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},Red.prototype.iadd=function iadd(e,t){this._verify2(e,t);var r=e.iadd(t);return r.cmp(this.m)>=0&&r.isub(this.m),r},Red.prototype.sub=function sub(e,t){this._verify2(e,t);var r=e.sub(t);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},Red.prototype.isub=function isub(e,t){this._verify2(e,t);var r=e.isub(t);return r.cmpn(0)<0&&r.iadd(this.m),r},Red.prototype.shl=function shl(e,t){return this._verify1(e),this.imod(e.ushln(t))},Red.prototype.imul=function imul(e,t){return this._verify2(e,t),this.imod(e.imul(t))},Red.prototype.mul=function mul(e,t){return this._verify2(e,t),this.imod(e.mul(t))},Red.prototype.isqr=function isqr(e){return this.imul(e,e.clone())},Red.prototype.sqr=function sqr(e){return this.mul(e,e)},Red.prototype.sqrt=function sqrt(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(assert(t%2==1),3===t){var r=this.m.add(new BN(1)).iushrn(2);return this.pow(e,r)}for(var a=this.m.subn(1),n=0;!a.isZero()&&0===a.andln(1);)n++,a.iushrn(1);assert(!a.isZero());var o=new BN(1).toRed(this),s=o.redNeg(),c=this.m.subn(1).iushrn(1),d=this.m.bitLength();for(d=new BN(2*d*d).toRed(this);0!==this.pow(d,c).cmp(s);)d.redIAdd(s);for(var u=this.pow(d,a),h=this.pow(e,a.addn(1).iushrn(1)),l=this.pow(e,a),b=n;0!==l.cmp(o);){for(var g=l,p=0;0!==g.cmp(o);p++)g=g.redSqr();assert(p=0;a--){for(var d=t.words[a],u=c-1;u>=0;u--){var h=d>>u&1;n!==r[0]&&(n=this.sqr(n)),0!==h||0!==o?(o<<=1,o|=h,(4===++s||0===a&&0===u)&&(n=this.mul(n,r[o]),s=0,o=0)):s=0}c=26}return n},Red.prototype.convertTo=function convertTo(e){var t=e.umod(this.m);return t===e?t.clone():t},Red.prototype.convertFrom=function convertFrom(e){var t=e.clone();return t.red=null,t},BN.mont=function mont(e){return new Mont(e)},inherits(Mont,Red),Mont.prototype.convertTo=function convertTo(e){return this.imod(e.ushln(this.shift))},Mont.prototype.convertFrom=function convertFrom(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},Mont.prototype.imul=function imul(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var r=e.imul(t),a=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(a).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},Mont.prototype.mul=function mul(e,t){if(e.isZero()||t.isZero())return new BN(0)._forceRed(this);var r=e.mul(t),a=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(a).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},Mont.prototype.invm=function invm(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(e=r.nmd(e),this)},function(e,t,r){"use strict";var a,n=this&&this.__extends||(a=function(e,t){return(a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function __(){this.constructor=e}a(e,t),e.prototype=null===t?Object.create(t):(__.prototype=t.prototype,new __)}),o=this&&this.__awaiter||function(e,t,r,a){return new(r||(r=Promise))((function(n,o){function fulfilled(e){try{step(a.next(e))}catch(e){o(e)}}function rejected(e){try{step(a.throw(e))}catch(e){o(e)}}function step(e){e.done?n(e.value):function adopt(e){return e instanceof r?e:new r((function(t){t(e)}))}(e.value).then(fulfilled,rejected)}step((a=a.apply(e,t||[])).next())}))},s=this&&this.__generator||function(e,t){var r,a,n,o,s={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return o={next:verb(0),throw:verb(1),return:verb(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function verb(o){return function(c){return function step(o){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,a&&(n=2&o[0]?a.return:o[0]?a.throw||((n=a.return)&&n.call(a),0):a.next)&&!(n=n.call(a,o[1])).done)return n;switch(a=0,n&&(o=[2&o[0],n.value]),o[0]){case 0:case 1:n=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,a=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(n=s.trys,(n=n.length>0&&n[n.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!n||o[1]>n[0]&&o[1]0)&&!(a=o.next()).done;)s.push(a.value)}catch(e){n={error:e}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return s},d=this&&this.__spread||function(){for(var e=[],t=0;t0&&n[n.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!n||o[1]>n[0]&&o[1]=e.length&&(e=void 0),{value:e&&e[a++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},h=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var l,b,g=r(166),p=r(5),B=h(r(81)),m=h(r(44)),I=r(1442),y=h(r(650)),v=h(r(652)),x=h(r(107)),C=h(r(27)),Q=h(r(83)),w=r(106),_=r(252),k=h(r(304)),N=r(1467),D=r(1125),U=new Function("try {return this===window;}catch(e){ return false;}");U()||(l=r(683),b=l.init(l.BLS12_381));var G=function(e){function VM(t){var r,a,o,s,c,d;void 0===t&&(t={});var h=e.call(this)||this;if(h._isInitialized=!1,h.DEBUG=!1,h._opts=t,"chain"in t||"hardfork"in t)throw new Error("Chain/hardfork options are not allowed any more on initialization");if(t.common){var b=[1559,2315,2537,2565,2718,2929,2930,3198,3529,3541];try{for(var p=u(t.common.eips()),y=p.next();!y.done;y=p.next()){var v=y.value;if(!b.includes(v))throw new Error(v+" is not supported by the VM")}}catch(e){r={error:e}}finally{try{y&&!y.done&&(a=p.return)&&a.call(p)}finally{if(r)throw r.error}}h._common=t.common}else{h._common=new m.default({chain:"mainnet",supportedHardforks:["chainstart","homestead","dao","tangerineWhistle","spuriousDragon","byzantium","constantinople","petersburg","istanbul","muirGlacier","berlin"]})}if(h._common.on("hardforkChanged",(function(){h._opcodes=w.getOpcodesForHF(h._common)})),h._opcodes=w.getOpcodesForHF(h._common),t.stateManager)h.stateManager=t.stateManager;else{var x=null!==(o=t.state)&&void 0!==o?o:new g.SecureTrie;h.stateManager=new I.DefaultStateManager({trie:x,common:h._common})}if(h.blockchain=null!==(s=t.blockchain)&&void 0!==s?s:new B.default({common:h._common}),h._allowUnlimitedContractSize=null!==(c=t.allowUnlimitedContractSize)&&void 0!==c&&c,h._hardforkByBlockNumber=null!==(d=t.hardforkByBlockNumber)&&void 0!==d&&d,h._common.isActivatedEIP(2537)){if(U())throw new Error("EIP-2537 is currently not supported in browsers");h._mcl=l}return void 0!==n&&n.env.DEBUG&&(h.DEBUG=!0),h._emit=D(h.emit.bind(h)),h}return s(VM,e),VM.create=function(e){return void 0===e&&(e={}),c(this,void 0,void 0,(function(){var t;return d(this,(function(r){switch(r.label){case 0:return[4,(t=new this(e)).init()];case 1:return r.sent(),[2,t]}}))}))},VM.prototype.init=function(){return c(this,void 0,void 0,(function(){var e,t=this;return d(this,(function(r){switch(r.label){case 0:return this._isInitialized?[2]:[4,this.blockchain.initPromise];case 1:return r.sent(),!this._opts.activatePrecompiles||this._opts.stateManager?[3,5]:[4,this.stateManager.checkpoint()];case 2:return r.sent(),[4,Promise.all(Object.keys(_.precompiles).map((function(e){return new p.Address(o.from(e,"hex"))})).map((function(e){return c(t,void 0,void 0,(function(){var t;return d(this,(function(r){switch(r.label){case 0:return t=p.Account.fromAccountData({balance:1}),[4,this.stateManager.putAccount(e,t)];case 1:return r.sent(),[2]}}))}))})))];case 3:return r.sent(),[4,this.stateManager.commit()];case 4:r.sent(),r.label=5;case 5:if(!this._common.isActivatedEIP(2537))return[3,8];if(!U())return[3,6];throw new Error("EIP-2537 is currently not supported in browsers");case 6:return e=this._mcl,[4,b];case 7:r.sent(),e.setMapToMode(e.IRTF),e.verifyOrderG1(1),e.verifyOrderG2(1),r.label=8;case 8:return this._isInitialized=!0,[2]}}))}))},VM.prototype.runBlockchain=function(e,t){return c(this,void 0,void 0,(function(){return d(this,(function(r){switch(r.label){case 0:return[4,this.init()];case 1:return r.sent(),[2,k.default.bind(this)(e,t)]}}))}))},VM.prototype.runBlock=function(e){return c(this,void 0,void 0,(function(){return d(this,(function(t){switch(t.label){case 0:return[4,this.init()];case 1:return t.sent(),[2,C.default.bind(this)(e)]}}))}))},VM.prototype.runTx=function(e){return c(this,void 0,void 0,(function(){return d(this,(function(t){switch(t.label){case 0:return[4,this.init()];case 1:return t.sent(),[2,x.default.bind(this)(e)]}}))}))},VM.prototype.runCall=function(e){return c(this,void 0,void 0,(function(){return d(this,(function(t){switch(t.label){case 0:return[4,this.init()];case 1:return t.sent(),[2,v.default.bind(this)(e)]}}))}))},VM.prototype.runCode=function(e){return c(this,void 0,void 0,(function(){return d(this,(function(t){switch(t.label){case 0:return[4,this.init()];case 1:return t.sent(),[2,y.default.bind(this)(e)]}}))}))},VM.prototype.buildBlock=function(e){return c(this,void 0,void 0,(function(){return d(this,(function(t){switch(t.label){case 0:return[4,this.init()];case 1:return t.sent(),[2,Q.default.bind(this)(e)]}}))}))},VM.prototype.getActiveOpcodes=function(){return w.getOpcodesForHF(this._common)},VM.prototype.copy=function(){return new VM({stateManager:this.stateManager.copy(),blockchain:this.blockchain,common:this._common})},VM}(N);t.default=G},function(e,t,r){"use strict";var a=this&&this.__assign||function(){return(a=Object.assign||function(e){for(var t,r=1,a=arguments.length;r0&&n[n.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!n||o[1]>n[0]&&o[1]=e.length&&(e=void 0),{value:e&&e[a++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},c=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var a,n,o=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(a=o.next()).done;)s.push(a.value)}catch(e){n={error:e}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return s};Object.defineProperty(t,"__esModule",{value:!0}),t.Block=void 0;var d=r(166),u=r(5),h=r(143),l=r(92),b=function(){function Block(e,t,r,a){var n;if(void 0===t&&(t=[]),void 0===r&&(r=[]),void 0===a&&(a={}),this.transactions=[],this.uncleHeaders=[],this.txTrie=new d.BaseTrie,this.header=null!=e?e:l.BlockHeader.fromHeaderData({},a),this.transactions=t,this.uncleHeaders=r,this._common=this.header._common,"poa"===this._common.consensusType()&&r.length>0)throw new Error("Block initialization with uncleHeaders on a PoA network is not allowed");(null===(n=null==a?void 0:a.freeze)||void 0===n||n)&&Object.freeze(this)}return Block.fromBlockData=function(e,t){var r,n,o,c;void 0===e&&(e={});var d=e.header,u=e.transactions,b=e.uncleHeaders,g=l.BlockHeader.fromHeaderData(d,t),p=[];try{for(var B=s(null!=u?u:[]),m=B.next();!m.done;m=B.next()){var I=m.value,y=h.TransactionFactory.fromTxData(I,a(a({},t),{common:g._common}));p.push(y)}}catch(e){r={error:e}}finally{try{m&&!m.done&&(n=B.return)&&n.call(B)}finally{if(r)throw r.error}}var v=[];try{for(var x=s(null!=b?b:[]),C=x.next();!C.done;C=x.next()){var Q=C.value,w=l.BlockHeader.fromHeaderData(Q,a(a({},t),{common:g._common,calcDifficultyFromHeader:void 0}));v.push(w)}}catch(e){o={error:e}}finally{try{C&&!C.done&&(c=x.return)&&c.call(x)}finally{if(o)throw o.error}}return new Block(g,p,v,t)},Block.fromRLPSerializedBlock=function(e,t){var r=u.rlp.decode(e);if(!Array.isArray(r))throw new Error("Invalid serialized block input. Must be array");return Block.fromValuesArray(r,t)},Block.fromValuesArray=function(e,t){var r,n,o,d;if(e.length>3)throw new Error("invalid block. More values than expected were received");var u=c(e,3),b=u[0],g=u[1],p=u[2],B=l.BlockHeader.fromValuesArray(b,t),m=[];try{for(var I=s(g||[]),y=I.next();!y.done;y=I.next()){var v=y.value;m.push(h.TransactionFactory.fromBlockBodyData(v,a(a({},t),{common:B._common})))}}catch(e){r={error:e}}finally{try{y&&!y.done&&(n=I.return)&&n.call(I)}finally{if(r)throw r.error}}var x=[];try{for(var C=s(p||[]),Q=C.next();!Q.done;Q=C.next()){var w=Q.value;x.push(l.BlockHeader.fromValuesArray(w,a(a({},t),{common:B._common,calcDifficultyFromHeader:void 0})))}}catch(e){o={error:e}}finally{try{Q&&!Q.done&&(d=C.return)&&d.call(C)}finally{if(o)throw o.error}}return new Block(B,m,x,t)},Block.genesis=function(e,t){return void 0===e&&(e={}),t=a(a({},t),{initWithGenesisHeader:!0}),Block.fromBlockData(e,t)},Block.prototype.raw=function(){return[this.header.raw(),this.transactions.map((function(e){return e.supports(h.Capability.EIP2718TypedTransaction)?e.serialize():e.raw()})),this.uncleHeaders.map((function(e){return e.raw()}))]},Block.prototype.hash=function(){return this.header.hash()},Block.prototype.isGenesis=function(){return this.header.isGenesis()},Block.prototype.serialize=function(){return u.rlp.encode(this.raw())},Block.prototype.genTxTrie=function(){return n(this,void 0,void 0,(function(){var e,t,r,a,n,s,c;return o(this,(function(o){switch(o.label){case 0:t=(e=this).transactions,r=e.txTrie,a=0,o.label=1;case 1:return a0&&r.push("errors at tx "+a+": "+n.join(", "))})),e?r:0===r.length},Block.prototype.validate=function(e,t){return void 0===t&&(t=!1),n(this,void 0,void 0,(function(){return o(this,(function(r){switch(r.label){case 0:return[4,this.header.validate(e)];case 1:return r.sent(),[4,this.validateUncles(e)];case 2:return r.sent(),[4,this.validateData(t)];case 3:return r.sent(),[2]}}))}))},Block.prototype.validateData=function(e){return void 0===e&&(e=!1),n(this,void 0,void 0,(function(){var t,r;return o(this,(function(a){switch(a.label){case 0:if((t=this.validateTransactions(!0)).length>0)throw r="invalid transactions: "+t.join(" "),this.header._error(r);return e?[3,2]:[4,this.validateTransactionsTrie()];case 1:if(!a.sent())throw new Error("invalid transaction trie");if(!this.validateUnclesHash())throw new Error("invalid uncle hash");a.label=2;case 2:return[2]}}))}))},Block.prototype.validateUnclesHash=function(){var e=u.rlp.encode(this.uncleHeaders.map((function(e){return e.raw()})));return u.keccak256(e).equals(this.header.uncleHash)},Block.prototype.validateUncles=function(e){return n(this,void 0,void 0,(function(){var t;return o(this,(function(r){switch(r.label){case 0:if(this.isGenesis())return[2];if(this.uncleHeaders.length>2)throw new Error("too many uncle headers");if(t=this.uncleHeaders.map((function(e){return e.hash().toString("hex")})),new Set(t).size!==t.length)throw new Error("duplicate uncles");return[4,this._validateUncleHeaders(this.uncleHeaders,e)];case 1:return r.sent(),[2]}}))}))},Block.prototype.canonicalDifficulty=function(e){return this.header.canonicalDifficulty(e.header)},Block.prototype.validateDifficulty=function(e){return this.header.validateDifficulty(e.header)},Block.prototype.validateGasLimit=function(e){return this.header.validateGasLimit(e.header)},Block.prototype.toJSON=function(){return{header:this.header.toJSON(),transactions:this.transactions.map((function(e){return e.toJSON()})),uncleHeaders:this.uncleHeaders.map((function(e){return e.toJSON()}))}},Block.prototype._error=function(e){return this.header._error(e)},Block.prototype._validateUncleHeaders=function(e,t){return n(this,void 0,void 0,(function(){var r,a,n,s,c,d,u,h,l=this;return o(this,(function(o){switch(o.label){case 0:return 0==e.length?[2]:[4,Promise.all(e.map((function(e){return e.validate(t,l.header.number)})))];case 1:o.sent(),r=[],a=this.header.number.clone(),e.map((function(e){e.number.lt(a)&&(a=e.number.clone())})),n={},s={},c=this.header.number.clone().sub(a).addn(1).toNumber(),d=this.header.parentHash,u=0,o.label=2;case 2:return u{var check=function(e){return e&&e.Math==Math&&e};e.exports=check("object"==typeof globalThis&&globalThis)||check("object"==typeof window&&window)||check("object"==typeof self&&self)||check("object"==typeof r.g&&r.g)||function(){return this}()||Function("return this")()},(e,t,r)=>{var a=r(104),n=r(636),o=r(120),s=r(395),c=r(635),d=r(634),u=n("wks"),h=a.Symbol,l=d?h:h&&h.withoutSetter||s;e.exports=function(e){return o(u,e)&&(c||"string"==typeof u[e])||(c&&o(h,e)?u[e]=h[e]:u[e]=l("Symbol."+e)),u[e]}},function(e,t,r){"use strict";var a=this&&this.__createBinding||(Object.create?function(e,t,r,a){void 0===a&&(a=r),Object.defineProperty(e,a,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,a){void 0===a&&(a=r),e[a]=t[r]}),n=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||t.hasOwnProperty(r)||a(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),n(r(220),t),n(r(55),t),n(r(121),t)},function(e,t,r){"use strict";var a=r(0).Buffer,n=this&&this.__assign||function(){return(n=Object.assign||function(e){for(var t,r=1,a=arguments.length;r0&&n[n.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!n||o[1]>n[0]&&o[1]=e.length&&(e=void 0),{value:e&&e[a++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},d=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.generateTxReceipt=void 0;var u=r(49),h=r(5),l=r(54),b=r(143),g=d(r(303)),p=d(r(12)),B=r(121),m=d(r(405)),I=d(r(651)),y=r(252),v=u.debug("vm:tx"),x=u.debug("vm:tx:gas");function _runTx(e){var t,r;return o(this,void 0,void 0,(function(){var o,d,u,l,C,Q,w,_,k,N,D,U,G,T,L,P,q,O,H,Y,j,J,z,W,V,X,$,et,tt,rt,at,it,nt,ot,At,st,ct,dt,ut,ht,bt,pt;return s(this,(function(s){switch(s.label){case 0:if(o=this.stateManager,d=e.tx,!(u=e.block))throw new Error("block required");return[4,this._emit("beforeTx",d)];case 1:if(s.sent(),l=d.getSenderAddress(),this.DEBUG&&v("New tx run hash="+(e.tx.isSigned()?e.tx.hash().toString("hex"):"unsigned")+" sender="+l.toString()),this._common.isActivatedEIP(2929)&&(y.getActivePrecompiles(this._common).forEach((function(e){return o.addWarmedAddress(e.buf)})),o.addWarmedAddress(l.buf),d.to&&o.addWarmedAddress(d.to.buf)),C=d.getBaseFee(),(Q=d.gasLimit.clone()).lt(C))throw new Error("base fee exceeds gas limit");if(Q.isub(C),this.DEBUG&&x("Subtracting base fee ("+C+") from gasLimit (-> "+Q+")"),this._common.isActivatedEIP(1559)&&(w="maxFeePerGas"in d?d.maxFeePerGas:d.gasPrice,_=u.header.baseFeePerGas,w.lt(_)))throw new Error("Transaction's maxFeePerGas ("+w+") is less than the block's baseFeePerGas ("+_+")");return[4,o.getAccount(l)];case 2:if(k=s.sent(),N=k.nonce,D=k.balance,e.skipBalance){if(!e.skipNonce&&!N.eq(d.nonce))throw new Error("the tx doesn't have the correct nonce. account has nonce of: "+N+" tx has nonce of: "+d.nonce)}else{if(U=d.getUpfrontCost(u.header.baseFeePerGas),D.lt(U))throw new Error("sender doesn't have enough funds to send tx. The upfront cost is: "+U+" and the sender's account only has: "+D);if(d.supports(b.Capability.EIP1559FeeMarket)&&(G=d.gasLimit.mul(d.maxFeePerGas),D.lt(G)))throw new Error("sender doesn't have enough funds to send tx. The max cost is: "+G+" and the sender's account only has: "+D)}return d.supports(b.Capability.EIP1559FeeMarket)?(P=u.header.baseFeePerGas,L=h.BN.min(d.maxPriorityFeePerGas,d.maxFeePerGas.sub(P)),T=L.add(P)):(T=d.gasPrice,this._common.isActivatedEIP(1559)&&(P=u.header.baseFeePerGas,L=d.gasPrice.sub(P))),k.nonce.iaddn(1),q=d.gasLimit.mul(T),k.balance.isub(q),[4,o.putAccount(l,k)];case 3:return s.sent(),this.DEBUG&&v("Update fromAccount (caller) nonce (-> "+k.nonce+") and balance(-> "+k.balance+")"),O=new I.default(T,l),H=d.value,Y=d.data,j=d.to,J=new m.default({caller:l,gasLimit:Q,to:j,value:H,data:Y}),z=new p.default(this,O,u),this.DEBUG&&v("Running tx=0x"+(d.isSigned()?d.hash().toString("hex"):"unsigned")+" with caller="+l.toString()+" gasLimit="+Q+" to="+(j?j.toString():"")+" value="+H+" data=0x"+B.short(Y)),[4,z.executeMessage(J)];case 4:return W=s.sent(),this.DEBUG&&(v("-".repeat(100)),v("Received tx results gasUsed="+W.gasUsed+" execResult: [ gasUsed="+W.gasUsed+" exceptionError="+(W.execResult.exceptionError?W.execResult.exceptionError.error:"")+" returnValue="+B.short(W.execResult.returnValue)+" gasRefund="+W.execResult.gasRefund+" ]")),W.bloom=function txLogsBloom(e){var t=new g.default;if(e)for(var r=0;r "+W.gasUsed+")"),V=z._refund,X=this._common.param("gasConfig","maxRefundQuotient"),V.isZero()?this.DEBUG&&v("No tx gasRefund"):($=W.gasUsed.divn(X),V=h.BN.min(V,$),W.gasUsed.isub(V),this.DEBUG&&v("Subtract tx gasRefund ("+V+") from gasUsed (-> "+W.gasUsed+")")),W.amountSpent=W.gasUsed.mul(T),[4,o.getAccount(l)];case 5:return k=s.sent(),et=W.gasUsed.mul(T),tt=q.sub(et),k.balance.iadd(tt),[4,o.putAccount(l,k)];case 6:return s.sent(),this.DEBUG&&v("Refunded txCostDiff ("+tt+") to fromAccount (caller) balance (-> "+k.balance+")"),rt="pow"===this._common.consensusType()?u.header.coinbase:"cliqueSigner"in u.header?u.header.cliqueSigner():h.Address.zero(),[4,o.getAccount(rt)];case 7:return at=s.sent(),this._common.isActivatedEIP(1559)?at.balance.iadd(W.gasUsed.mul(L)):at.balance.iadd(W.amountSpent),[4,o.putAccount(rt,at)];case 8:if(s.sent(),this.DEBUG&&v("tx update miner account ("+rt.toString()+") balance (-> "+at.balance+")"),!W.execResult.selfdestruct)return[3,16];it=Object.keys(W.execResult.selfdestruct),s.label=9;case 9:s.trys.push([9,14,15,16]),nt=c(it),ot=nt.next(),s.label=10;case 10:return ot.done?[3,13]:(At=ot.value,st=new h.Address(a.from(At,"hex")),[4,o.deleteAccount(st)]);case 11:s.sent(),this.DEBUG&&v("tx selfdestruct on address="+st.toString()),s.label=12;case 12:return ot=nt.next(),[3,10];case 13:return[3,16];case 14:return ct=s.sent(),bt={error:ct},[3,16];case 15:try{ot&&!ot.done&&(pt=nt.return)&&pt.call(nt)}finally{if(bt)throw bt.error}return[7];case 16:return[4,o.cleanupTouchedAccounts()];case 17:return s.sent(),o.clearOriginalStorageCache(),dt=(null!==(r=e.blockGasUsed)&&void 0!==r?r:u.header.gasUsed).add(W.gasUsed),ut=W,[4,generateTxReceipt.bind(this)(d,W,dt)];case 18:return ut.receipt=s.sent(),ht=n({transaction:d},W),[4,this._emit("afterTx",ht)];case 19:return s.sent(),this.DEBUG&&v("tx run finished hash="+(e.tx.isSigned()?e.tx.hash().toString("hex"):"unsigned")+" sender="+l.toString()),[2,W]}}))}))}function generateTxReceipt(e,t,r){var c;return o(this,void 0,void 0,(function(){var o,d,u;return s(this,(function(s){switch(s.label){case 0:return o={gasUsed:r.toArrayLike(a),bitvector:t.bloom.bitvector,logs:null!==(c=t.execResult.logs)&&void 0!==c?c:[]},this.DEBUG&&v("Generate tx receipt transactionType="+e.type+" gasUsed="+r.toString()+" bitvector="+B.short(o.bitvector)+" ("+o.bitvector.length+" bytes) logs="+o.logs.length),e.supports(b.Capability.EIP2718TypedTransaction)?[3,4]:this._common.gteHardfork("byzantium")?(d=n({status:t.execResult.exceptionError?0:1},o),[3,3]):[3,1];case 1:return[4,this.stateManager.getStateRoot(!0)];case 2:u=s.sent(),d=n({stateRoot:u},o),s.label=3;case 3:return[3,5];case 4:d=n({status:t.execResult.exceptionError?0:1},o),s.label=5;case 5:return[2,d]}}))}))}t.default=function runTx(e){var t;return o(this,void 0,void 0,(function(){var r,a,n,o,c,d;return s(this,(function(s){switch(s.label){case 0:if(!e.tx)throw new Error("invalid input, tx is required");if(e.block=null!==(t=e.block)&&void 0!==t?t:l.Block.fromBlockData({},{common:e.tx.common}),!0!==e.skipBlockGasLimitValidation&&e.block.header.gasLimit.lt(e.tx.gasLimit))throw new Error("tx has a higher gas limit than the block");if(r=this.stateManager,e.reportAccessList&&!("generateAccessList"in r))throw new Error("reportAccessList needs a StateManager implementing the generateAccessList() method");return this._common.isActivatedEIP(2929)&&r.clearWarmedAccounts(),[4,r.checkpoint()];case 1:return s.sent(),this.DEBUG&&(v("-".repeat(100)),v("tx checkpoint")),e.tx.supports(b.Capability.EIP2718TypedTransaction)&&this._common.isActivatedEIP(2718)?this._common.isActivatedEIP(2930)?[3,3]:[4,r.revert()]:[3,8];case 2:throw s.sent(),new Error("Cannot run transaction: EIP 2930 is not activated.");case 3:return!e.reportAccessList||"generateAccessList"in r?[3,5]:[4,r.revert()];case 4:throw s.sent(),new Error("StateManager needs to implement generateAccessList() when running with reportAccessList option");case 5:return!e.tx.supports(b.Capability.EIP1559FeeMarket)||this._common.isActivatedEIP(1559)?[3,7]:[4,r.revert()];case 6:throw s.sent(),new Error("Cannot run transaction: EIP 1559 is not activated.");case 7:e.tx.AccessListJSON.forEach((function(e){var t=h.toBuffer(e.address);r.addWarmedAddress(t),e.storageKeys.forEach((function(e){r.addWarmedStorage(t,h.toBuffer(e))}))})),s.label=8;case 8:return s.trys.push([8,11,13,14]),[4,_runTx.bind(this)(e)];case 9:return a=s.sent(),[4,r.commit()];case 10:return s.sent(),this.DEBUG&&v("tx checkpoint committed"),this._common.isActivatedEIP(2929)&&e.reportAccessList&&(n=e.tx,o=[n.getSenderAddress()],c=n.to?[n.to]:[],a.accessList=r.generateAccessList(o,c)),[2,a];case 11:return d=s.sent(),[4,r.revert()];case 12:throw s.sent(),this.DEBUG&&v("tx checkpoint reverted"),d;case 13:return this._common.isActivatedEIP(2929)&&r.clearWarmedAccounts(),[7];case 14:return[2]}}))}))},t.generateTxReceipt=generateTxReceipt},(e,t,r)=>{"use strict";var a=r(13),n=r(228),o=n(a("String.prototype.indexOf"));e.exports=function callBoundIntrinsic(e,t){var r=a(e,!!t);return"function"==typeof r&&o(e,".prototype.")>-1?n(r):r}},(e,t,r)=>{"use strict";var a=r(67),n=r(10);function isSurrogatePair(e,t){return 55296==(64512&e.charCodeAt(t))&&(!(t<0||t+1>=e.length)&&56320==(64512&e.charCodeAt(t+1)))}function htonl(e){return(e>>>24|e>>>8&65280|e<<8&16711680|(255&e)<<24)>>>0}function zero2(e){return 1===e.length?"0"+e:e}function zero8(e){return 7===e.length?"0"+e:6===e.length?"00"+e:5===e.length?"000"+e:4===e.length?"0000"+e:3===e.length?"00000"+e:2===e.length?"000000"+e:1===e.length?"0000000"+e:e}t.inherits=n,t.toArray=function toArray(e,t){if(Array.isArray(e))return e.slice();if(!e)return[];var r=[];if("string"==typeof e)if(t){if("hex"===t)for((e=e.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(e="0"+e),n=0;n>6|192,r[a++]=63&o|128):isSurrogatePair(e,n)?(o=65536+((1023&o)<<10)+(1023&e.charCodeAt(++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)}else for(n=0;n>>0}return s},t.split32=function split32(e,t){for(var r=new Array(4*e.length),a=0,n=0;a>>24,r[n+1]=o>>>16&255,r[n+2]=o>>>8&255,r[n+3]=255&o):(r[n+3]=o>>>24,r[n+2]=o>>>16&255,r[n+1]=o>>>8&255,r[n]=255&o)}return r},t.rotr32=function rotr32(e,t){return e>>>t|e<<32-t},t.rotl32=function rotl32(e,t){return e<>>32-t},t.sum32=function sum32(e,t){return e+t>>>0},t.sum32_3=function sum32_3(e,t,r){return e+t+r>>>0},t.sum32_4=function sum32_4(e,t,r,a){return e+t+r+a>>>0},t.sum32_5=function sum32_5(e,t,r,a,n){return e+t+r+a+n>>>0},t.sum64=function sum64(e,t,r,a){var n=e[t],o=a+e[t+1]>>>0,s=(o>>0,e[t+1]=o},t.sum64_hi=function sum64_hi(e,t,r,a){return(t+a>>>0>>0},t.sum64_lo=function sum64_lo(e,t,r,a){return t+a>>>0},t.sum64_4_hi=function sum64_4_hi(e,t,r,a,n,o,s,c){var d=0,u=t;return d+=(u=u+a>>>0)>>0)>>0)>>0},t.sum64_4_lo=function sum64_4_lo(e,t,r,a,n,o,s,c){return t+a+o+c>>>0},t.sum64_5_hi=function sum64_5_hi(e,t,r,a,n,o,s,c,d,u){var h=0,l=t;return h+=(l=l+a>>>0)>>0)>>0)>>0)>>0},t.sum64_5_lo=function sum64_5_lo(e,t,r,a,n,o,s,c,d,u){return t+a+o+c+u>>>0},t.rotr64_hi=function rotr64_hi(e,t,r){return(t<<32-r|e>>>r)>>>0},t.rotr64_lo=function rotr64_lo(e,t,r){return(e<<32-r|t>>>r)>>>0},t.shr64_hi=function shr64_hi(e,t,r){return e>>>r},t.shr64_lo=function shr64_lo(e,t,r){return(e<<32-r|t>>>r)>>>0}},(e,t,r)=>{"use strict";var a=r(157),n=r(21);function isSurrogatePair(e,t){return 55296==(64512&e.charCodeAt(t))&&(!(t<0||t+1>=e.length)&&56320==(64512&e.charCodeAt(t+1)))}function htonl(e){return(e>>>24|e>>>8&65280|e<<8&16711680|(255&e)<<24)>>>0}function zero2(e){return 1===e.length?"0"+e:e}function zero8(e){return 7===e.length?"0"+e:6===e.length?"00"+e:5===e.length?"000"+e:4===e.length?"0000"+e:3===e.length?"00000"+e:2===e.length?"000000"+e:1===e.length?"0000000"+e:e}t.inherits=n,t.toArray=function toArray(e,t){if(Array.isArray(e))return e.slice();if(!e)return[];var r=[];if("string"==typeof e)if(t){if("hex"===t)for((e=e.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(e="0"+e),n=0;n>6|192,r[a++]=63&o|128):isSurrogatePair(e,n)?(o=65536+((1023&o)<<10)+(1023&e.charCodeAt(++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)}else for(n=0;n>>0}return s},t.split32=function split32(e,t){for(var r=new Array(4*e.length),a=0,n=0;a>>24,r[n+1]=o>>>16&255,r[n+2]=o>>>8&255,r[n+3]=255&o):(r[n+3]=o>>>24,r[n+2]=o>>>16&255,r[n+1]=o>>>8&255,r[n]=255&o)}return r},t.rotr32=function rotr32(e,t){return e>>>t|e<<32-t},t.rotl32=function rotl32(e,t){return e<>>32-t},t.sum32=function sum32(e,t){return e+t>>>0},t.sum32_3=function sum32_3(e,t,r){return e+t+r>>>0},t.sum32_4=function sum32_4(e,t,r,a){return e+t+r+a>>>0},t.sum32_5=function sum32_5(e,t,r,a,n){return e+t+r+a+n>>>0},t.sum64=function sum64(e,t,r,a){var n=e[t],o=a+e[t+1]>>>0,s=(o>>0,e[t+1]=o},t.sum64_hi=function sum64_hi(e,t,r,a){return(t+a>>>0>>0},t.sum64_lo=function sum64_lo(e,t,r,a){return t+a>>>0},t.sum64_4_hi=function sum64_4_hi(e,t,r,a,n,o,s,c){var d=0,u=t;return d+=(u=u+a>>>0)>>0)>>0)>>0},t.sum64_4_lo=function sum64_4_lo(e,t,r,a,n,o,s,c){return t+a+o+c>>>0},t.sum64_5_hi=function sum64_5_hi(e,t,r,a,n,o,s,c,d,u){var h=0,l=t;return h+=(l=l+a>>>0)>>0)>>0)>>0)>>0},t.sum64_5_lo=function sum64_5_lo(e,t,r,a,n,o,s,c,d,u){return t+a+o+c+u>>>0},t.rotr64_hi=function rotr64_hi(e,t,r){return(t<<32-r|e>>>r)>>>0},t.rotr64_lo=function rotr64_lo(e,t,r){return(e<<32-r|t>>>r)>>>0},t.shr64_hi=function shr64_hi(e,t,r){return e>>>r},t.shr64_lo=function shr64_lo(e,t,r){return(e<<32-r|t>>>r)>>>0}},(e,t,r)=>{"use strict";var a=r(159),n=r(22);function isSurrogatePair(e,t){return 55296==(64512&e.charCodeAt(t))&&(!(t<0||t+1>=e.length)&&56320==(64512&e.charCodeAt(t+1)))}function htonl(e){return(e>>>24|e>>>8&65280|e<<8&16711680|(255&e)<<24)>>>0}function zero2(e){return 1===e.length?"0"+e:e}function zero8(e){return 7===e.length?"0"+e:6===e.length?"00"+e:5===e.length?"000"+e:4===e.length?"0000"+e:3===e.length?"00000"+e:2===e.length?"000000"+e:1===e.length?"0000000"+e:e}t.inherits=n,t.toArray=function toArray(e,t){if(Array.isArray(e))return e.slice();if(!e)return[];var r=[];if("string"==typeof e)if(t){if("hex"===t)for((e=e.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(e="0"+e),n=0;n>6|192,r[a++]=63&o|128):isSurrogatePair(e,n)?(o=65536+((1023&o)<<10)+(1023&e.charCodeAt(++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)}else for(n=0;n>>0}return s},t.split32=function split32(e,t){for(var r=new Array(4*e.length),a=0,n=0;a>>24,r[n+1]=o>>>16&255,r[n+2]=o>>>8&255,r[n+3]=255&o):(r[n+3]=o>>>24,r[n+2]=o>>>16&255,r[n+1]=o>>>8&255,r[n]=255&o)}return r},t.rotr32=function rotr32(e,t){return e>>>t|e<<32-t},t.rotl32=function rotl32(e,t){return e<>>32-t},t.sum32=function sum32(e,t){return e+t>>>0},t.sum32_3=function sum32_3(e,t,r){return e+t+r>>>0},t.sum32_4=function sum32_4(e,t,r,a){return e+t+r+a>>>0},t.sum32_5=function sum32_5(e,t,r,a,n){return e+t+r+a+n>>>0},t.sum64=function sum64(e,t,r,a){var n=e[t],o=a+e[t+1]>>>0,s=(o>>0,e[t+1]=o},t.sum64_hi=function sum64_hi(e,t,r,a){return(t+a>>>0>>0},t.sum64_lo=function sum64_lo(e,t,r,a){return t+a>>>0},t.sum64_4_hi=function sum64_4_hi(e,t,r,a,n,o,s,c){var d=0,u=t;return d+=(u=u+a>>>0)>>0)>>0)>>0},t.sum64_4_lo=function sum64_4_lo(e,t,r,a,n,o,s,c){return t+a+o+c>>>0},t.sum64_5_hi=function sum64_5_hi(e,t,r,a,n,o,s,c,d,u){var h=0,l=t;return h+=(l=l+a>>>0)>>0)>>0)>>0)>>0},t.sum64_5_lo=function sum64_5_lo(e,t,r,a,n,o,s,c,d,u){return t+a+o+c+u>>>0},t.rotr64_hi=function rotr64_hi(e,t,r){return(t<<32-r|e>>>r)>>>0},t.rotr64_lo=function rotr64_lo(e,t,r){return(e<<32-r|t>>>r)>>>0},t.shr64_hi=function shr64_hi(e,t,r){return e>>>r},t.shr64_lo=function shr64_lo(e,t,r){return(e<<32-r|t>>>r)>>>0}},function(e,t,r){"use strict";var a,n=r(4).Buffer,o=this&&this.__extends||(a=function(e,t){return(a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function __(){this.constructor=e}a(e,t),e.prototype=null===t?Object.create(t):(__.prototype=t.prototype,new __)}),s=this&&this.__assign||function(){return(s=Object.assign||function(e){for(var t,r=1,a=arguments.length;r=e.length&&(e=void 0),{value:e&&e[a++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0}),t.Hardfork=t.Chain=t.CustomChain=void 0;var d,u,h=r(32),l=r(891),b=r(16),g=r(277),p=r(1299),B=r(1312);!function(e){e.PolygonMainnet="polygon-mainnet",e.PolygonMumbai="polygon-mumbai",e.ArbitrumRinkebyTestnet="arbitrum-rinkeby-testnet",e.xDaiChain="x-dai-chain"}(d=t.CustomChain||(t.CustomChain={})),function(e){e[e.Mainnet=1]="Mainnet",e[e.Ropsten=3]="Ropsten",e[e.Rinkeby=4]="Rinkeby",e[e.Kovan=42]="Kovan",e[e.Goerli=5]="Goerli",e[e.Calaveras=123]="Calaveras"}(t.Chain||(t.Chain={})),function(e){e.Chainstart="chainstart",e.Homestead="homestead",e.Dao="dao",e.TangerineWhistle="tangerineWhistle",e.SpuriousDragon="spuriousDragon",e.Byzantium="byzantium",e.Constantinople="constantinople",e.Petersburg="petersburg",e.Istanbul="istanbul",e.MuirGlacier="muirGlacier",e.Berlin="berlin",e.London="london"}(u=t.Hardfork||(t.Hardfork={}));var m=function(e){function Common(t){var r,a,n=e.call(this)||this;return n._supportedHardforks=[],n._eips=[],n._customChains=null!==(r=t.customChains)&&void 0!==r?r:[],n._chainParams=n.setChain(t.chain),n.DEFAULT_HARDFORK=null!==(a=n._chainParams.defaultHardfork)&&void 0!==a?a:u.Istanbul,n._hardfork=n.DEFAULT_HARDFORK,t.supportedHardforks&&(n._supportedHardforks=t.supportedHardforks),t.hardfork&&n.setHardfork(t.hardfork),t.eips&&n.setEIPs(t.eips),n}return o(Common,e),Common.custom=function(e,t){var r;void 0===t&&(t={});var a=null!==(r=t.baseChain)&&void 0!==r?r:"mainnet",n=s({},Common._getChainParams(a));if(n.name="custom-chain","string"!=typeof e)return new Common(s({chain:s(s({},n),e)},t));if(e===d.PolygonMainnet)return Common.custom({name:d.PolygonMainnet,chainId:137,networkId:137});if(e===d.PolygonMumbai)return Common.custom({name:d.PolygonMumbai,chainId:80001,networkId:80001});if(e===d.ArbitrumRinkebyTestnet)return Common.custom({name:d.ArbitrumRinkebyTestnet,chainId:421611,networkId:421611});if(e===d.xDaiChain)return Common.custom({name:d.xDaiChain,chainId:100,networkId:100});throw new Error("Custom chain "+e+" not supported")},Common.forCustomChain=function(e,t,r,a){var n=Common._getChainParams(e);return new Common({chain:s(s({},n),t),hardfork:r,supportedHardforks:a})},Common.isSupportedChainId=function(e){var t=g._getInitializedChains();return Boolean(t.names[e.toString()])},Common._getChainParams=function(e,t){var r=g._getInitializedChains(t);if("number"==typeof e||b.BN.isBN(e)){if(e=e.toString(),r.names[e])return r[r.names[e]];throw new Error("Chain with ID "+e+" not supported")}if(r[e])return r[e];throw new Error("Chain with name "+e+" not supported")},Common.prototype.setChain=function(e){var t,r;if("number"==typeof e||"string"==typeof e||b.BN.isBN(e))this._chainParams=Common._getChainParams(e,this._customChains);else{if("object"!=typeof e)throw new Error("Wrong input format");if(this._customChains.length>0)throw new Error("Chain must be a string, number, or BN when initialized with customChains passed in");try{for(var a=c(["networkId","genesis","hardforks","bootstrapNodes"]),n=a.next();!n.done;n=a.next()){var o=n.value;if(void 0===e[o])throw new Error("Missing required chain parameter: "+o)}}catch(e){t={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(t)throw t.error}}this._chainParams=e}return this._chainParams},Common.prototype.setHardfork=function(e){var t,r;if(!this._isSupportedHardfork(e))throw new Error("Hardfork "+e+" not set as supported in supportedHardforks");var a=!1;try{for(var n=c(p.hardforks),o=n.next();!o.done;o=n.next()){o.value[0]===e&&(this._hardfork!==e&&(this._hardfork=e,this.emit("hardforkChanged",e)),a=!0)}}catch(e){t={error:e}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}if(!a)throw new Error("Hardfork with name "+e+" not supported")},Common.prototype.getHardforkByBlockNumber=function(e){var t,r;e=b.toType(e,b.TypeOutput.BN);var a=u.Chainstart;try{for(var n=c(this.hardforks()),o=n.next();!o.done;o=n.next()){var s=o.value;null!==s.block&&(e.gte(new b.BN(s.block))&&(a=s.name))}}catch(e){t={error:e}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}return a},Common.prototype.setHardforkByBlockNumber=function(e){e=b.toType(e,b.TypeOutput.BN);var t=this.getHardforkByBlockNumber(e);return this.setHardfork(t),t},Common.prototype._chooseHardfork=function(e,t){if(void 0===t&&(t=!0),e){if(t&&!this._isSupportedHardfork(e))throw new Error("Hardfork "+e+" not set as supported in supportedHardforks")}else e=this._hardfork;return e},Common.prototype._getHardfork=function(e){var t,r,a=this.hardforks();try{for(var n=c(a),o=n.next();!o.done;o=n.next()){var s=o.value;if(s.name===e)return s}}catch(e){t={error:e}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}throw new Error("Hardfork "+e+" not defined for chain "+this.chainName())},Common.prototype._isSupportedHardfork=function(e){var t,r;if(!(this._supportedHardforks.length>0))return!0;try{for(var a=c(this._supportedHardforks),n=a.next();!n.done;n=a.next()){if(e===n.value)return!0}}catch(e){t={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(t)throw t.error}}return!1},Common.prototype.setEIPs=function(e){var t,r,a=this;void 0===e&&(e=[]);var _loop_1=function(t){if(!(t in B.EIPs))throw new Error(t+" not supported");var r=n.gteHardfork(B.EIPs[t].minimumHardfork);if(!r)throw new Error(t+" cannot be activated on hardfork "+n.hardfork()+", minimumHardfork: "+r);B.EIPs[t].requiredEIPs&&B.EIPs[t].requiredEIPs.forEach((function(r){if(!e.includes(r)&&!a.isActivatedEIP(r))throw new Error(t+" requires EIP "+r+", but is not included in the EIP list")}))},n=this;try{for(var o=c(e),s=o.next();!s.done;s=o.next()){_loop_1(s.value)}}catch(e){t={error:e}}finally{try{s&&!s.done&&(r=o.return)&&r.call(o)}finally{if(t)throw t.error}}this._eips=e},Common.prototype.param=function(e,t){var r,a,n=null;try{for(var o=c(this._eips),s=o.next();!s.done;s=o.next()){var d=s.value;if(null!==(n=this.paramByEIP(e,t,d)))return n}}catch(e){r={error:e}}finally{try{s&&!s.done&&(a=o.return)&&a.call(o)}finally{if(r)throw r.error}}return this.paramByHardfork(e,t,this._hardfork)},Common.prototype.paramByHardfork=function(e,t,r){var a,n,o,s;r=this._chooseHardfork(r);var d=null;try{for(var u=c(p.hardforks),h=u.next();!h.done;h=u.next()){var l=h.value;if(l[1].hasOwnProperty("eips")){var b=l[1].eips;try{for(var g=(o=void 0,c(b)),B=g.next();!B.done;B=g.next()){var m=B.value,I=this.paramByEIP(e,t,m);d=null!==I?I:d}}catch(e){o={error:e}}finally{try{B&&!B.done&&(s=g.return)&&s.call(g)}finally{if(o)throw o.error}}}else{if(!l[1][e])throw new Error("Topic "+e+" not defined");void 0!==l[1][e][t]&&(d=l[1][e][t].v)}if(l[0]===r)break}}catch(e){a={error:e}}finally{try{h&&!h.done&&(n=u.return)&&n.call(u)}finally{if(a)throw a.error}}return d},Common.prototype.paramByEIP=function(e,t,r){if(!(r in B.EIPs))throw new Error(r+" not supported");var a=B.EIPs[r];if(!(e in a))throw new Error("Topic "+e+" not defined");return void 0===a[e][t]?null:a[e][t].v},Common.prototype.paramByBlock=function(e,t,r){var a=this.activeHardforks(r),n=a[a.length-1].name;return this.paramByHardfork(e,t,n)},Common.prototype.isActivatedEIP=function(e){var t,r;if(this.eips().includes(e))return!0;try{for(var a=c(p.hardforks),n=a.next();!n.done;n=a.next()){var o=n.value[1];if(this.gteHardfork(o.name)&&"eips"in o&&o.eips.includes(e))return!0}}catch(e){t={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(t)throw t.error}}return!1},Common.prototype.hardforkIsActiveOnBlock=function(e,t,r){var a;void 0===r&&(r={}),t=b.toType(t,b.TypeOutput.BN);var n=null!==(a=r.onlySupported)&&void 0!==a&&a;e=this._chooseHardfork(e,n);var o=this.hardforkBlockBN(e);return!(!o||!t.gte(o))},Common.prototype.activeOnBlock=function(e,t){return this.hardforkIsActiveOnBlock(null,e,t)},Common.prototype.hardforkGteHardfork=function(e,t,r){var a,n;void 0===r&&(r={});var o,s=void 0!==r.onlyActive&&r.onlyActive;e=this._chooseHardfork(e,r.onlySupported),o=s?this.activeHardforks(null,r):this.hardforks();var d=-1,u=-1,h=0;try{for(var l=c(o),b=l.next();!b.done;b=l.next()){var g=b.value;g.name===e&&(d=h),g.name===t&&(u=h),h+=1}}catch(e){a={error:e}}finally{try{b&&!b.done&&(n=l.return)&&n.call(l)}finally{if(a)throw a.error}}return d>=u&&-1!==u},Common.prototype.gteHardfork=function(e,t){return this.hardforkGteHardfork(null,e,t)},Common.prototype.hardforkIsActiveOnChain=function(e,t){var r,a,n;void 0===t&&(t={});var o=null!==(n=t.onlySupported)&&void 0!==n&&n;e=this._chooseHardfork(e,o);try{for(var s=c(this.hardforks()),d=s.next();!d.done;d=s.next()){var u=d.value;if(u.name===e&&null!==u.block)return!0}}catch(e){r={error:e}}finally{try{d&&!d.done&&(a=s.return)&&a.call(s)}finally{if(r)throw r.error}}return!1},Common.prototype.activeHardforks=function(e,t){var r,a;void 0===t&&(t={});var n=[],o=this.hardforks();try{for(var s=c(o),d=s.next();!d.done;d=s.next()){var u=d.value;if(null!==u.block){if(null!=e&&e0)return r[r.length-1].name;throw new Error("No (supported) active hardfork found")},Common.prototype.hardforkBlock=function(e){return b.toType(this.hardforkBlockBN(e),b.TypeOutput.Number)},Common.prototype.hardforkBlockBN=function(e){return e=this._chooseHardfork(e,!1),new b.BN(this._getHardfork(e).block)},Common.prototype.isHardforkBlock=function(e,t){return e=b.toType(e,b.TypeOutput.BN),t=this._chooseHardfork(t,!1),this.hardforkBlockBN(t).eq(e)},Common.prototype.nextHardforkBlock=function(e){var t=this.nextHardforkBlockBN(e);return null===t?null:b.toType(t,b.TypeOutput.Number)},Common.prototype.nextHardforkBlockBN=function(e){e=this._chooseHardfork(e,!1);var t=this.hardforkBlockBN(e);return this.hardforks().reduce((function(e,r){var a=new b.BN(r.block);return a.gt(t)&&null===e?a:e}),null)},Common.prototype.isNextHardforkBlock=function(e,t){e=b.toType(e,b.TypeOutput.BN),t=this._chooseHardfork(t,!1);var r=this.nextHardforkBlockBN(t);return null!==r&&r.eq(e)},Common.prototype._calcForkHash=function(e){var t,r,a=n.from(this.genesis().hash.substr(2),"hex"),o=n.alloc(0),s=0;try{for(var d=c(this.hardforks()),u=d.next();!u.done;u=d.next()){var h=u.value,g=h.block;if(0!==g&&null!==g&&g!==s){var p=n.from(g.toString(16).padStart(16,"0"),"hex");o=n.concat([o,p])}if(h.name===e)break;s=g}}catch(e){t={error:e}}finally{try{u&&!u.done&&(r=d.return)&&r.call(d)}finally{if(t)throw t.error}}var B=n.concat([a,o]);return"0x"+b.intToBuffer(l.buf(B)>>>0).toString("hex")},Common.prototype.forkHash=function(e){e=this._chooseHardfork(e,!1);var t=this._getHardfork(e);if(null===t.block){throw new Error("No fork hash calculation possible for non-applied or future hardfork")}return void 0!==t.forkHash?t.forkHash:this._calcForkHash(e)},Common.prototype.hardforkForForkHash=function(e){var t=this.hardforks().filter((function(t){return t.forkHash===e}));return t.length>=1?t[t.length-1]:null},Common.prototype.genesis=function(){return this._chainParams.genesis},Common.prototype.hardforks=function(){return this._chainParams.hardforks},Common.prototype.bootstrapNodes=function(){return this._chainParams.bootstrapNodes},Common.prototype.dnsNetworks=function(){return this._chainParams.dnsNetworks},Common.prototype.hardfork=function(){return this._hardfork},Common.prototype.chainId=function(){return b.toType(this.chainIdBN(),b.TypeOutput.Number)},Common.prototype.chainIdBN=function(){return new b.BN(this._chainParams.chainId)},Common.prototype.chainName=function(){return this._chainParams.name},Common.prototype.networkId=function(){return b.toType(this.networkIdBN(),b.TypeOutput.Number)},Common.prototype.networkIdBN=function(){return new b.BN(this._chainParams.networkId)},Common.prototype.eips=function(){return this._eips},Common.prototype.consensusType=function(){return this._chainParams.consensus.type},Common.prototype.consensusAlgorithm=function(){return this._chainParams.consensus.algorithm},Common.prototype.consensusConfig=function(){return this._chainParams.consensus[this.consensusAlgorithm()]},Common.prototype.copy=function(){return Object.assign(Object.create(Object.getPrototypeOf(this)),this)},Common}(h.EventEmitter);t.default=m},(e,t,r)=>{"use strict";var a=r(161),n=r(241);function isSurrogatePair(e,t){return 55296==(64512&e.charCodeAt(t))&&(!(t<0||t+1>=e.length)&&56320==(64512&e.charCodeAt(t+1)))}function htonl(e){return(e>>>24|e>>>8&65280|e<<8&16711680|(255&e)<<24)>>>0}function zero2(e){return 1===e.length?"0"+e:e}function zero8(e){return 7===e.length?"0"+e:6===e.length?"00"+e:5===e.length?"000"+e:4===e.length?"0000"+e:3===e.length?"00000"+e:2===e.length?"000000"+e:1===e.length?"0000000"+e:e}t.inherits=n,t.toArray=function toArray(e,t){if(Array.isArray(e))return e.slice();if(!e)return[];var r=[];if("string"==typeof e)if(t){if("hex"===t)for((e=e.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(e="0"+e),n=0;n>6|192,r[a++]=63&o|128):isSurrogatePair(e,n)?(o=65536+((1023&o)<<10)+(1023&e.charCodeAt(++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)}else for(n=0;n>>0}return s},t.split32=function split32(e,t){for(var r=new Array(4*e.length),a=0,n=0;a>>24,r[n+1]=o>>>16&255,r[n+2]=o>>>8&255,r[n+3]=255&o):(r[n+3]=o>>>24,r[n+2]=o>>>16&255,r[n+1]=o>>>8&255,r[n]=255&o)}return r},t.rotr32=function rotr32(e,t){return e>>>t|e<<32-t},t.rotl32=function rotl32(e,t){return e<>>32-t},t.sum32=function sum32(e,t){return e+t>>>0},t.sum32_3=function sum32_3(e,t,r){return e+t+r>>>0},t.sum32_4=function sum32_4(e,t,r,a){return e+t+r+a>>>0},t.sum32_5=function sum32_5(e,t,r,a,n){return e+t+r+a+n>>>0},t.sum64=function sum64(e,t,r,a){var n=e[t],o=a+e[t+1]>>>0,s=(o>>0,e[t+1]=o},t.sum64_hi=function sum64_hi(e,t,r,a){return(t+a>>>0>>0},t.sum64_lo=function sum64_lo(e,t,r,a){return t+a>>>0},t.sum64_4_hi=function sum64_4_hi(e,t,r,a,n,o,s,c){var d=0,u=t;return d+=(u=u+a>>>0)>>0)>>0)>>0},t.sum64_4_lo=function sum64_4_lo(e,t,r,a,n,o,s,c){return t+a+o+c>>>0},t.sum64_5_hi=function sum64_5_hi(e,t,r,a,n,o,s,c,d,u){var h=0,l=t;return h+=(l=l+a>>>0)>>0)>>0)>>0)>>0},t.sum64_5_lo=function sum64_5_lo(e,t,r,a,n,o,s,c,d,u){return t+a+o+c+u>>>0},t.rotr64_hi=function rotr64_hi(e,t,r){return(t<<32-r|e>>>r)>>>0},t.rotr64_lo=function rotr64_lo(e,t,r){return(e<<32-r|t>>>r)>>>0},t.shr64_hi=function shr64_hi(e,t,r){return e>>>r},t.shr64_lo=function shr64_lo(e,t,r){return(e<<32-r|t>>>r)>>>0}},(e,t,r)=>{"use strict";var a=r(163),n=r(23);function isSurrogatePair(e,t){return 55296==(64512&e.charCodeAt(t))&&(!(t<0||t+1>=e.length)&&56320==(64512&e.charCodeAt(t+1)))}function htonl(e){return(e>>>24|e>>>8&65280|e<<8&16711680|(255&e)<<24)>>>0}function zero2(e){return 1===e.length?"0"+e:e}function zero8(e){return 7===e.length?"0"+e:6===e.length?"00"+e:5===e.length?"000"+e:4===e.length?"0000"+e:3===e.length?"00000"+e:2===e.length?"000000"+e:1===e.length?"0000000"+e:e}t.inherits=n,t.toArray=function toArray(e,t){if(Array.isArray(e))return e.slice();if(!e)return[];var r=[];if("string"==typeof e)if(t){if("hex"===t)for((e=e.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(e="0"+e),n=0;n>6|192,r[a++]=63&o|128):isSurrogatePair(e,n)?(o=65536+((1023&o)<<10)+(1023&e.charCodeAt(++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)}else for(n=0;n>>0}return s},t.split32=function split32(e,t){for(var r=new Array(4*e.length),a=0,n=0;a>>24,r[n+1]=o>>>16&255,r[n+2]=o>>>8&255,r[n+3]=255&o):(r[n+3]=o>>>24,r[n+2]=o>>>16&255,r[n+1]=o>>>8&255,r[n]=255&o)}return r},t.rotr32=function rotr32(e,t){return e>>>t|e<<32-t},t.rotl32=function rotl32(e,t){return e<>>32-t},t.sum32=function sum32(e,t){return e+t>>>0},t.sum32_3=function sum32_3(e,t,r){return e+t+r>>>0},t.sum32_4=function sum32_4(e,t,r,a){return e+t+r+a>>>0},t.sum32_5=function sum32_5(e,t,r,a,n){return e+t+r+a+n>>>0},t.sum64=function sum64(e,t,r,a){var n=e[t],o=a+e[t+1]>>>0,s=(o>>0,e[t+1]=o},t.sum64_hi=function sum64_hi(e,t,r,a){return(t+a>>>0>>0},t.sum64_lo=function sum64_lo(e,t,r,a){return t+a>>>0},t.sum64_4_hi=function sum64_4_hi(e,t,r,a,n,o,s,c){var d=0,u=t;return d+=(u=u+a>>>0)>>0)>>0)>>0},t.sum64_4_lo=function sum64_4_lo(e,t,r,a,n,o,s,c){return t+a+o+c>>>0},t.sum64_5_hi=function sum64_5_hi(e,t,r,a,n,o,s,c,d,u){var h=0,l=t;return h+=(l=l+a>>>0)>>0)>>0)>>0)>>0},t.sum64_5_lo=function sum64_5_lo(e,t,r,a,n,o,s,c,d,u){return t+a+o+c+u>>>0},t.rotr64_hi=function rotr64_hi(e,t,r){return(t<<32-r|e>>>r)>>>0},t.rotr64_lo=function rotr64_lo(e,t,r){return(e<<32-r|t>>>r)>>>0},t.shr64_hi=function shr64_hi(e,t,r){return e>>>r},t.shr64_lo=function shr64_lo(e,t,r){return(e<<32-r|t>>>r)>>>0}},(e,t,r)=>{"use strict";var a=r(164),n=r(15);function isSurrogatePair(e,t){return 55296==(64512&e.charCodeAt(t))&&(!(t<0||t+1>=e.length)&&56320==(64512&e.charCodeAt(t+1)))}function htonl(e){return(e>>>24|e>>>8&65280|e<<8&16711680|(255&e)<<24)>>>0}function zero2(e){return 1===e.length?"0"+e:e}function zero8(e){return 7===e.length?"0"+e:6===e.length?"00"+e:5===e.length?"000"+e:4===e.length?"0000"+e:3===e.length?"00000"+e:2===e.length?"000000"+e:1===e.length?"0000000"+e:e}t.inherits=n,t.toArray=function toArray(e,t){if(Array.isArray(e))return e.slice();if(!e)return[];var r=[];if("string"==typeof e)if(t){if("hex"===t)for((e=e.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(e="0"+e),n=0;n>6|192,r[a++]=63&o|128):isSurrogatePair(e,n)?(o=65536+((1023&o)<<10)+(1023&e.charCodeAt(++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)}else for(n=0;n>>0}return s},t.split32=function split32(e,t){for(var r=new Array(4*e.length),a=0,n=0;a>>24,r[n+1]=o>>>16&255,r[n+2]=o>>>8&255,r[n+3]=255&o):(r[n+3]=o>>>24,r[n+2]=o>>>16&255,r[n+1]=o>>>8&255,r[n]=255&o)}return r},t.rotr32=function rotr32(e,t){return e>>>t|e<<32-t},t.rotl32=function rotl32(e,t){return e<>>32-t},t.sum32=function sum32(e,t){return e+t>>>0},t.sum32_3=function sum32_3(e,t,r){return e+t+r>>>0},t.sum32_4=function sum32_4(e,t,r,a){return e+t+r+a>>>0},t.sum32_5=function sum32_5(e,t,r,a,n){return e+t+r+a+n>>>0},t.sum64=function sum64(e,t,r,a){var n=e[t],o=a+e[t+1]>>>0,s=(o>>0,e[t+1]=o},t.sum64_hi=function sum64_hi(e,t,r,a){return(t+a>>>0>>0},t.sum64_lo=function sum64_lo(e,t,r,a){return t+a>>>0},t.sum64_4_hi=function sum64_4_hi(e,t,r,a,n,o,s,c){var d=0,u=t;return d+=(u=u+a>>>0)>>0)>>0)>>0},t.sum64_4_lo=function sum64_4_lo(e,t,r,a,n,o,s,c){return t+a+o+c>>>0},t.sum64_5_hi=function sum64_5_hi(e,t,r,a,n,o,s,c,d,u){var h=0,l=t;return h+=(l=l+a>>>0)>>0)>>0)>>0)>>0},t.sum64_5_lo=function sum64_5_lo(e,t,r,a,n,o,s,c,d,u){return t+a+o+c+u>>>0},t.rotr64_hi=function rotr64_hi(e,t,r){return(t<<32-r|e>>>r)>>>0},t.rotr64_lo=function rotr64_lo(e,t,r){return(e<<32-r|t>>>r)>>>0},t.shr64_hi=function shr64_hi(e,t,r){return e>>>r},t.shr64_lo=function shr64_lo(e,t,r){return(e<<32-r|t>>>r)>>>0}},function(e,t,r){"use strict";var a=this&&this.__awaiter||function(e,t,r,a){return new(r||(r=Promise))((function(n,o){function fulfilled(e){try{step(a.next(e))}catch(e){o(e)}}function rejected(e){try{step(a.throw(e))}catch(e){o(e)}}function step(e){e.done?n(e.value):function adopt(e){return e instanceof r?e:new r((function(t){t(e)}))}(e.value).then(fulfilled,rejected)}step((a=a.apply(e,t||[])).next())}))},n=this&&this.__generator||function(e,t){var r,a,n,o,s={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return o={next:verb(0),throw:verb(1),return:verb(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function verb(o){return function(c){return function step(o){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,a&&(n=2&o[0]?a.return:o[0]?a.throw||((n=a.return)&&n.call(a),0):a.next)&&!(n=n.call(a,o[1])).done)return n;switch(a=0,n&&(o=[2&o[0],n.value]),o[0]){case 0:case 1:n=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,a=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(n=s.trys,(n=n.length>0&&n[n.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!n||o[1]>n[0]&&o[1]=e.length&&(e=void 0),{value:e&&e[a++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.Trie=void 0;var c=s(r(371)),d=r(42),u=r(117),h=r(205),l=r(597),b=r(167),g=r(91),p=r(6),B=function(){function Trie(e,t,r){void 0===r&&(r=!1),this.EMPTY_TRIE_ROOT=d.KECCAK256_RLP,this.lock=new c.default(1),this.db=e?new u.DB(e):new u.DB,this._root=this.EMPTY_TRIE_ROOT,this._deleteFromDB=r,t&&this.setRoot(t)}return Object.defineProperty(Trie.prototype,"root",{get:function(){return this._root},set:function(e){this.setRoot(e)},enumerable:!1,configurable:!0}),Trie.prototype.setRoot=function(e){e||(e=this.EMPTY_TRIE_ROOT),p(32===e.length,"Invalid root length. Roots are 32 bytes"),this._root=e},Trie.prototype.checkRoot=function(e){return a(this,void 0,void 0,(function(){return n(this,(function(t){switch(t.label){case 0:return[4,this._lookupNode(e)];case 1:return[2,!!t.sent()]}}))}))},Object.defineProperty(Trie.prototype,"isCheckpoint",{get:function(){return!1},enumerable:!1,configurable:!0}),Trie.prototype.get=function(e){return a(this,void 0,void 0,(function(){var t,r,a,o;return n(this,(function(n){switch(n.label){case 0:return[4,this.findPath(e)];case 1:return t=n.sent(),r=t.node,a=t.remaining,o=null,r&&0===a.length&&(o=r.value),[2,o]}}))}))},Trie.prototype.put=function(e,t){return a(this,void 0,void 0,(function(){var r,a,o;return n(this,(function(n){switch(n.label){case 0:return t&&""!==t.toString()?[3,2]:[4,this.del(e)];case 1:return[2,n.sent()];case 2:return[4,this.lock.wait()];case 3:return n.sent(),this.root.equals(d.KECCAK256_RLP)?[4,this._createInitialNode(e,t)]:[3,5];case 4:return n.sent(),[3,8];case 5:return[4,this.findPath(e)];case 6:return r=n.sent(),a=r.remaining,o=r.stack,[4,this._updateNode(e,t,a,o)];case 7:n.sent(),n.label=8;case 8:return this.lock.signal(),[2]}}))}))},Trie.prototype.del=function(e){return a(this,void 0,void 0,(function(){var t,r,a;return n(this,(function(n){switch(n.label){case 0:return[4,this.lock.wait()];case 1:return n.sent(),[4,this.findPath(e)];case 2:return t=n.sent(),r=t.node,a=t.stack,r?[4,this._deleteNode(e,a)]:[3,4];case 3:n.sent(),n.label=4;case 4:return this.lock.signal(),[2]}}))}))},Trie.prototype.findPath=function(e){return a(this,void 0,void 0,(function(){var t=this;return n(this,(function(r){return[2,new Promise((function(r){return a(t,void 0,void 0,(function(){var t,o,s,c=this;return n(this,(function(d){switch(d.label){case 0:return t=[],o=l.bufferToNibbles(e),s=function(e,s,d,u){return a(c,void 0,void 0,(function(){var e,a;return n(this,(function(n){return null===s||(e=o.slice(l.matchingNibbleLength(d,o)),t.push(s),s instanceof g.BranchNode?0===e.length?r({node:s,remaining:[],stack:t}):(a=e[0],s.getBranch(a)?u.onlyBranchIndex(s,d,a):r({node:null,remaining:e,stack:t})):s instanceof g.LeafNode?l.doKeysMatch(e,s.key)?r({node:s,remaining:[],stack:t}):r({node:null,remaining:e,stack:t}):s instanceof g.ExtensionNode&&(l.matchingNibbleLength(e,s.key)!==s.key.length?r({node:null,remaining:e,stack:t}):u.allChildren(s,d))),[2]}))}))},[4,this.walkTrie(this.root,s)];case 1:return d.sent(),r({node:null,remaining:[],stack:t}),[2]}}))}))}))]}))}))},Trie.prototype.walkTrie=function(e,t){return a(this,void 0,void 0,(function(){return n(this,(function(r){switch(r.label){case 0:return[4,b.WalkController.newWalk(t,this,e)];case 1:return r.sent(),[2]}}))}))},Trie.prototype._walkTrie=function(e,t){return a(this,void 0,void 0,(function(){return n(this,(function(r){switch(r.label){case 0:return[4,this.walkTrie(e,t)];case 1:return r.sent(),[2]}}))}))},Trie.prototype._createInitialNode=function(e,t){return a(this,void 0,void 0,(function(){var r;return n(this,(function(a){switch(a.label){case 0:return r=new g.LeafNode(l.bufferToNibbles(e),t),this.root=r.hash(),[4,this.db.put(this.root,r.serialize())];case 1:return a.sent(),[2]}}))}))},Trie.prototype.lookupNode=function(e){return a(this,void 0,void 0,(function(){var t,r;return n(this,(function(a){switch(a.label){case 0:return g.isRawNode(e)?[2,g.decodeRawNode(e)]:(t=null,r=null,[4,this.db.get(e)]);case 1:return(t=a.sent())&&(r=g.decodeNode(t)),[2,r]}}))}))},Trie.prototype._lookupNode=function(e){return a(this,void 0,void 0,(function(){return n(this,(function(t){return[2,this.lookupNode(e)]}))}))},Trie.prototype._updateNode=function(e,t,r,o){return a(this,void 0,void 0,(function(){var a,s,c,d,u,h,b,p,B,m,I,y,v,x,C,Q;return n(this,(function(n){switch(n.label){case 0:if(a=[],!(s=o.pop()))throw new Error("Stack underflow");if(c=l.bufferToNibbles(e),d=!1,s instanceof g.LeafNode){for(u=0,h=0;h=32||t){var o=d.keccak(n);return a?this._deleteFromDB&&r.push({type:"del",key:o}):r.push({type:"put",key:o,value:n}),o}return e.raw()},Trie.prototype.batch=function(e){return a(this,void 0,void 0,(function(){var t,r,a,s,c,d;return n(this,(function(n){switch(n.label){case 0:n.trys.push([0,7,8,9]),t=o(e),r=t.next(),n.label=1;case 1:if(r.done)return[3,6];if("put"!==(a=r.value).type)return[3,3];if(!a.value)throw new Error("Invalid batch db operation");return[4,this.put(a.key,a.value)];case 2:return n.sent(),[3,5];case 3:return"del"!==a.type?[3,5]:[4,this.del(a.key)];case 4:n.sent(),n.label=5;case 5:return r=t.next(),[3,1];case 6:return[3,9];case 7:return s=n.sent(),c={error:s},[3,9];case 8:try{r&&!r.done&&(d=t.return)&&d.call(t)}finally{if(c)throw c.error}return[7];case 9:return[2]}}))}))},Trie.fromProof=function(e,t){return a(this,void 0,void 0,(function(){var r;return n(this,(function(a){switch(a.label){case 0:return r=e.map((function(e){return{type:"put",key:d.keccak(e),value:e}})),t||(t=new Trie,r[0]&&(t.root=r[0].key)),[4,t.db.batch(r)];case 1:return a.sent(),[2,t]}}))}))},Trie.prove=function(e,t){return a(this,void 0,void 0,(function(){return n(this,(function(r){return[2,this.createProof(e,t)]}))}))},Trie.createProof=function(e,t){return a(this,void 0,void 0,(function(){var r;return n(this,(function(a){switch(a.label){case 0:return[4,e.findPath(t)];case 1:return r=a.sent().stack,[2,r.map((function(e){return e.serialize()}))]}}))}))},Trie.verifyProof=function(e,t,r){return a(this,void 0,void 0,(function(){var a;return n(this,(function(n){switch(n.label){case 0:a=new Trie(null,e),n.label=1;case 1:return n.trys.push([1,3,,4]),[4,Trie.fromProof(r,a)];case 2:return a=n.sent(),[3,4];case 3:throw n.sent(),new Error("Invalid proof nodes given");case 4:return[2,a.get(t)]}}))}))},Trie.prototype.createReadStream=function(){return new h.TrieReadStream(this)},Trie.prototype.copy=function(){return new Trie(this.db.copy()._leveldb,this.root)},Trie.prototype._findDbNodes=function(e){return a(this,void 0,void 0,(function(){var t,r=this;return n(this,(function(o){switch(o.label){case 0:return t=function(t,o,s,c){return a(r,void 0,void 0,(function(){return n(this,(function(r){return g.isRawNode(t)?null!==o&&c.allChildren(o,s):e(t,o,s,c),[2]}))}))},[4,this.walkTrie(this.root,t)];case 1:return o.sent(),[2]}}))}))},Trie.prototype._findValueNodes=function(e){return a(this,void 0,void 0,(function(){var t,r=this;return n(this,(function(o){switch(o.label){case 0:return t=function(t,o,s,c){return a(r,void 0,void 0,(function(){var r;return n(this,(function(a){return r=s,o instanceof g.LeafNode?(r=s.concat(o.key),e(t,o,r,c)):o instanceof g.BranchNode&&o.value?e(t,o,r,c):null!==o&&c.allChildren(o,s),[2]}))}))},[4,this.walkTrie(this.root,t)];case 1:return o.sent(),[2]}}))}))},Trie}();t.Trie=B},function(e,t,r){"use strict";var a=this&&this.__awaiter||function(e,t,r,a){return new(r||(r=Promise))((function(n,o){function fulfilled(e){try{step(a.next(e))}catch(e){o(e)}}function rejected(e){try{step(a.throw(e))}catch(e){o(e)}}function step(e){e.done?n(e.value):function adopt(e){return e instanceof r?e:new r((function(t){t(e)}))}(e.value).then(fulfilled,rejected)}step((a=a.apply(e,t||[])).next())}))},n=this&&this.__generator||function(e,t){var r,a,n,o,s={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return o={next:verb(0),throw:verb(1),return:verb(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function verb(o){return function(c){return function step(o){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,a&&(n=2&o[0]?a.return:o[0]?a.throw||((n=a.return)&&n.call(a),0):a.next)&&!(n=n.call(a,o[1])).done)return n;switch(a=0,n&&(o=[2&o[0],n.value]),o[0]){case 0:case 1:n=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,a=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(n=s.trys,(n=n.length>0&&n[n.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!n||o[1]>n[0]&&o[1]{e.exports=function(e){try{return!!e()}catch(e){return!0}}},e=>{e.exports=function(e){return"object"==typeof e?null!==e:"function"==typeof e}},(e,t,r)=>{var a=r(394),n={}.hasOwnProperty;e.exports=Object.hasOwn||function hasOwn(e,t){return n.call(a(e),t)}},function(e,t,r){"use strict";var a=r(0).Buffer,n=this&&this.__awaiter||function(e,t,r,a){return new(r||(r=Promise))((function(n,o){function fulfilled(e){try{step(a.next(e))}catch(e){o(e)}}function rejected(e){try{step(a.throw(e))}catch(e){o(e)}}function step(e){e.done?n(e.value):function adopt(e){return e instanceof r?e:new r((function(t){t(e)}))}(e.value).then(fulfilled,rejected)}step((a=a.apply(e,t||[])).next())}))},o=this&&this.__generator||function(e,t){var r,a,n,o,s={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return o={next:verb(0),throw:verb(1),return:verb(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function verb(o){return function(c){return function step(o){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,a&&(n=2&o[0]?a.return:o[0]?a.throw||((n=a.return)&&n.call(a),0):a.next)&&!(n=n.call(a,o[1])).done)return n;switch(a=0,n&&(o=[2&o[0],n.value]),o[0]){case 0:case 1:n=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,a=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(n=s.trys,(n=n.length>0&&n[n.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!n||o[1]>n[0]&&o[1]0){var n=t.toNumber(),o=r.toNumber();a.length{"use strict";var a=r(2).Buffer;Object.defineProperty(t,"__esModule",{value:!0}),t.KNOWN_CHAINIDS=t.WEI=t.RPCQUANTITY_ONE=t.RPCQUANTITY_ZERO=t.RPCQUANTITY_EMPTY=t.DATA_EMPTY=t.BUFFER_8_ZERO=t.BUFFER_32_ZERO=t.BUFFER_ZERO=t.BUFFER_EMPTY=t.ACCOUNT_ZERO=t.BUFFER_256_ZERO=void 0;const n=r(724),o=r(725);t.BUFFER_256_ZERO=a.allocUnsafe(256).fill(0),t.ACCOUNT_ZERO=t.BUFFER_256_ZERO.slice(0,20),t.BUFFER_EMPTY=a.allocUnsafe(0),t.BUFFER_ZERO=t.BUFFER_256_ZERO.slice(0,1),t.BUFFER_32_ZERO=t.BUFFER_256_ZERO.slice(0,32),t.BUFFER_8_ZERO=t.BUFFER_256_ZERO.slice(0,8),t.DATA_EMPTY=n.Data.from(t.BUFFER_EMPTY),t.RPCQUANTITY_EMPTY=o.Quantity.from(t.BUFFER_EMPTY,!0),t.RPCQUANTITY_ZERO=o.Quantity.from(t.BUFFER_ZERO),t.RPCQUANTITY_ONE=o.Quantity.from(1n),t.WEI=1000000000000000000n,t.KNOWN_CHAINIDS=new Set([1,3,4,5,42])},(e,t,r)=>{var a=r(11).Buffer,n=r(39).Transform,o=r(427).a;function CipherBase(e){n.call(this),this.hashMode="string"==typeof e,this.hashMode?this[e]=this._finalOrDigest:this.final=this._finalOrDigest,this._final&&(this.__final=this._final,this._final=null),this._decoder=null,this._encoding=null}r(10)(CipherBase,n),CipherBase.prototype.update=function(e,t,r){"string"==typeof e&&(e=a.from(e,t));var n=this._update(e);return this.hashMode?this:(r&&(n=this._toString(n,r)),n)},CipherBase.prototype.setAutoPadding=function(){},CipherBase.prototype.getAuthTag=function(){throw new Error("trying to get auth tag in unsupported state")},CipherBase.prototype.setAuthTag=function(){throw new Error("trying to set auth tag in unsupported state")},CipherBase.prototype.setAAD=function(){throw new Error("trying to set aad in unsupported state")},CipherBase.prototype._transform=function(e,t,r){var a;try{this.hashMode?this._update(e):this.push(this._update(e))}catch(e){a=e}finally{r(a)}},CipherBase.prototype._flush=function(e){var t;try{this.push(this.__final())}catch(e){t=e}e(t)},CipherBase.prototype._finalOrDigest=function(e){var t=this.__final()||a.alloc(0);return e&&(t=this._toString(t,e,!0)),t},CipherBase.prototype._toString=function(e,t,r){if(this._decoder||(this._decoder=new o(t),this._encoding=t),this._encoding!==t)throw new Error("can't switch encodings");var a=this._decoder.write(e);return r&&(a+=this._decoder.end()),a},e.exports=CipherBase},function(e,t,r){"use strict";var a,n,o,s,c,d,u=r(0).Buffer,h=this&&this.__decorate||function(e,t,r,a){var n,o=arguments.length,s=o<3?t:null===a?a=Object.getOwnPropertyDescriptor(t,r):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,r,a);else for(var c=e.length-1;c>=0;c--)(n=e[c])&&(s=(o<3?n(s):o>3?n(t,r,s):n(t,r))||s);return o>3&&s&&Object.defineProperty(t,r,s),s},l=this&&this.__classPrivateFieldSet||function(e,t,r){if(!t.has(e))throw new TypeError("attempted to set private field on non-instance");return t.set(e,r),r},b=this&&this.__classPrivateFieldGet||function(e,t){if(!t.has(e))throw new TypeError("attempted to get private field on non-instance");return t.get(e)},g=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const p=r(14),B=r(88),m=r(18),I=r(5),y=r(569),v=r(8),x=g(r(165)),C=g(r(1367)),Q=r(1368),w=r(1005),_=r(46),k=r(47),N=r(139);async function autofillDefaultTransactionValues(e,t,r,a,n){if(e.gas.isNull()){const a=n.miner.defaultTransactionGasLimit;a===v.RPCQUANTITY_EMPTY?e.gas=await t(r,p.Tag.LATEST):e.gas=a}if("gasPrice"in e&&e.gasPrice.isNull()&&(e.gasPrice=n.miner.defaultGasPrice),"maxFeePerGas"in e&&e.maxFeePerGas.isNull()){const t=a.blocks.latest;e.maxFeePerGas=v.Quantity.from(B.Block.calcNBlocksMaxBaseFee(3,t.header))}}const{version:D}={version:"7.0.0-alpha.1"},U=`Ganache/v${D}/EthereumJS TestRPC/v${D}/ethereum-js`,G=v.Data.from("0x3f"),T={eth:"1.0",net:"1.0",rpc:"1.0",web3:"1.0",evm:"1.0",personal:"1.0"};function assertExceptionalTransactions(e){let t,r=null;const a={};if(e.forEach((e=>{e.execException&&(r?(r=p.VM_EXCEPTIONS,t.push(`${e.hash.toString()}: ${e.execException}\n`),a[e.execException.data.hash]=e.execException.data):(r=p.VM_EXCEPTION,t=[e.execException.message],a[e.execException.data.hash]=e.execException.data))})),r){const e=new Error(r+t.join("\n"));throw e.data=a,e}}class EthereumApi{constructor(e,t,r){var u;a.set(this,(u=0,()=>v.Quantity.from(++u))),n.set(this,new Map),o.set(this,new Map),s.set(this,void 0),c.set(this,void 0),d.set(this,void 0),l(this,s,e),l(this,d,t),l(this,c,r)}async db_putString(e,t,r){return!1}async db_getString(e,t){return""}async db_putHex(e,t,r){return!1}async db_getHex(e,t){return"0x00"}async bzz_hive(){return[]}async bzz_info(){return[]}async evm_mine(e){const t=b(this,c),r=b(this,s).chain.vmErrorsOnRPCResponse;if(null!==e&&"object"==typeof e){let{blocks:a,timestamp:n}=e;null==a&&(a=1);for(let e=0;ev.Quantity.from(t).toBuffer()},await n.putAccount({buf:r},o),await a.mine(N.Capacity.Empty),!0}async evm_increaseTime(e){const t=1e3*("number"==typeof e?e:v.Quantity.from(e).toNumber());return Math.floor(b(this,c).increaseTime(t)/1e3)}async evm_setTime(e){let t;switch(typeof e){case"object":t=e.getTime();break;case"number":t=e;break;default:t=v.Quantity.from(e).toNumber()}return Math.floor(b(this,c).setTime(t)/1e3)}async evm_revert(e){return b(this,c).revert(v.Quantity.from(e))}async evm_snapshot(){return v.Quantity.from(b(this,c).snapshot())}async evm_unlockUnknownAccount(e,t=0){return b(this,d).unlockUnknownAccount(e.toLowerCase(),t)}async evm_lockUnknownAccount(e){const t=e.toLowerCase();if(b(this,d).knownAccounts.has(t))throw new Error("cannot lock known/personal account");return b(this,d).lockAccount(t)}async miner_start(e=1){if(!0===b(this,s).miner.legacyInstamine){const t=await b(this,c).resume(e);null!=t&&b(this,s).chain.vmErrorsOnRPCResponse&&assertExceptionalTransactions(t)}else b(this,c).resume(e);return!0}async miner_stop(){return b(this,c).pause(),!0}async miner_setGasPrice(e){return b(this,s).miner.defaultGasPrice=v.Quantity.from(e),!0}async miner_setEtherbase(e){return b(this,c).coinbase=k.Address.from(e),!0}async miner_setExtra(e){const t=v.Data.from(e),r=t.toBuffer().length;if(r>32)throw new Error(`extra exceeds max length. ${r} > 32`);return b(this,s).miner.extraData=t,!0}async web3_clientVersion(){return U}async web3_sha3(e){return v.Data.from(v.keccak(u.from(e)))}async net_version(){return b(this,s).chain.networkId.toString()}async net_listening(){return!0}async net_peerCount(){return v.RPCQUANTITY_ZERO}async eth_estimateGas(e,t=p.Tag.LATEST){const r=b(this,c),a=r.blocks,n=(await a.get(t)).header,o=b(this,s),generateVM=()=>r.vm.copy();return new Promise(((t,a)=>{const{coinbase:s}=r,c=m.TransactionFactory.fromRpc(e,r.common);null==c.from&&(c.from=s),c.gas.isNull()&&(c.gas=o.miner.callGasLimit);const d=new B.RuntimeBlock(v.Quantity.from((n.number.toBigInt()||0n)+1n),n.parentHash,n.miner,c.gas.toBuffer(),n.gasUsed.toBuffer(),n.timestamp,o.miner.difficulty,n.totalDifficulty,0n),h={tx:c.toVmTransaction(),block:d,skipBalance:!0,skipNonce:!0};C.default(generateVM,h,((e,r)=>{if(e)return a(e);t(v.Quantity.from(r.gasEstimate.toArrayLike(u)))}))}))}async eth_protocolVersion(){return G}async eth_syncing(){return!1}async eth_coinbase(){return b(this,c).coinbase}async eth_getBlockByNumber(e,t=!1){const r=await b(this,c).blocks.get(e).catch((e=>null));return r?r.toJSON(t):null}async eth_getBlockByHash(e,t=!1){const r=await b(this,c).blocks.getByHash(e).catch((e=>null));return r?r.toJSON(t):null}async eth_getBlockTransactionCountByNumber(e){const{blocks:t}=b(this,c),r=t.getEffectiveNumber(e),a=await t.getRawByBlockNumber(r);if(!a)return null;const[,n]=_.decode(a);return v.Quantity.from(n.length)}async eth_getBlockTransactionCountByHash(e){const{blocks:t}=b(this,c),r=await t.getNumberFromHash(e);if(!r)return null;const a=await t.getRawByBlockNumber(v.Quantity.from(r));if(!a)return null;const[,n]=_.decode(a);return v.Quantity.from(n.length)}async eth_getCompilers(){return[]}async eth_getTransactionByBlockHashAndIndex(e,t){const r=b(this,c),a=await r.blocks.getByHash(e).catch((e=>null));if(!a)return null;return a.getTransactions()[parseInt(v.Quantity.from(t).toString(),10)].toJSON(r.common)}async eth_getTransactionByBlockNumberAndIndex(e,t){const r=b(this,c),a=await r.blocks.get(e).catch((e=>null));if(!a)return null;return a.getTransactions()[parseInt(v.Quantity.from(t).toString(),10)].toJSON(r.common)}async eth_getUncleCountByBlockHash(e){return v.RPCQUANTITY_ZERO}async eth_getUncleCountByBlockNumber(e){return v.RPCQUANTITY_ZERO}async eth_getUncleByBlockHashAndIndex(e,t){return null}async eth_getUncleByBlockNumberAndIndex(e,t){return null}async eth_getWork(e){return[]}async eth_submitWork(e,t,r){return!1}async eth_submitHashrate(e,t){return!1}async eth_mining(){return b(this,c).isStarted()}async eth_hashrate(){return v.RPCQUANTITY_ZERO}async eth_gasPrice(){return b(this,s).miner.defaultGasPrice}async eth_accounts(){return b(this,d).addresses}async eth_blockNumber(){return b(this,c).blocks.latest.header.number}async eth_chainId(){return v.Quantity.from(b(this,s).chain.chainId)}async eth_getBalance(e,t=p.Tag.LATEST){return b(this,c).accounts.getBalance(k.Address.from(e),t)}async eth_getCode(e,t=p.Tag.LATEST){const{accounts:r}=b(this,c);return r.getCode(k.Address.from(e),t)}async eth_getStorageAt(e,t,r=p.Tag.LATEST){const a=b(this,c),n=a.blocks.getEffectiveNumber(r),o=await a.blocks.getRawByBlockNumber(n);if(!o)throw new Error("header not found");const[[,,,s]]=_.decode(o),d=a.trie.copy(!1);d.setContext(s,null,n);const h=v.Quantity.from(t).toBuffer(),l=h.length;let g;l<32?(g=u.allocUnsafe(32).fill(0),h.copy(g,32-l)):g=32===l?h:h.slice(-32);const B=k.Address.from(e).toBuffer(),m=await d.get(B),I=_.decode(m)[2];d.setContext(I,B,n);const y=await d.get(g);return v.Data.from(_.decode(y))}async eth_getTransactionByHash(e){const{transactions:t}=b(this,c),r=v.Data.from(e).toBuffer(),a=await t.get(r);if(null===a){const e=t.transactionPool.find(r);return e?e.toJSON(b(this,c).common):null}return a.toJSON(b(this,c).common)}async eth_getTransactionReceipt(e){const{transactions:t,transactionReceipts:r,blocks:a,common:n}=b(this,c),o=v.Data.from(e),d=o.toBuffer(),u=t.get(d),h=r.get(d),l=u.then((e=>e?a.get(e.blockNumber.toBuffer()):null)),[g,p,B]=await Promise.all([u,h,l]);if(g)return p.toJSON(B,g,n);const m=b(this,s);if(m.miner.blockTime<=0&&!0!==m.miner.legacyInstamine&&b(this,c).isStarted()){null!=b(this,c).transactions.transactionPool.find(d)&&m.logging.logger.log(` > Ganache \`eth_getTransactionReceipt\` notice: the transaction with hash\n > \`${o.toString()}\` has not\n > yet been mined. See https://trfl.io/v7-instamine for additional information.`)}return null}async eth_sendTransaction(e){const t=b(this,c),r=m.TransactionFactory.fromRpc(e,t.common);if(null==r.from)throw new Error("from not found; is required");const a=r.from.toString(),n=b(this,d),o=n.knownAccounts.has(a),u=n.unlockedAccounts.has(a);if(!u){throw new Error(o?"authentication needed: password or unlock":"sender account not recognized")}if(await autofillDefaultTransactionValues(r,this.eth_estimateGas.bind(this),e,t,b(this,s)),u){const e=n.unlockedAccounts.get(a);return t.queueTransaction(r,e)}return t.queueTransaction(r)}async eth_signTransaction(e){const t=b(this,c),r=m.TransactionFactory.fromRpc(e,t.common);if(null==r.from)throw new Error("from not found; is required");const a=r.from.toString(),n=b(this,d),o=n.knownAccounts.has(a);if(!n.unlockedAccounts.has(a)){throw new Error(o?"authentication needed: password or unlock":"sender account not recognized")}const s=n.unlockedAccounts.get(a).toBuffer();return r.signAndHash(s),v.Data.from(r.serialized).toString()}async eth_sendRawTransaction(e){const t=b(this,c),r=m.TransactionFactory.fromString(e,t.common);return t.queueTransaction(r)}async eth_sign(e,t){const r=k.Address.from(e).toString().toLowerCase(),a=b(this,d).unlockedAccounts.get(r);if(null==a)throw new Error("cannot sign data; no private key");const n=b(this,s).chain.chainId,o=I.hashPersonalMessage(v.Data.from(t).toBuffer()),{v:c,r:u,s:h}=I.ecsign(o,a.toBuffer(),n);return I.toRpcSig(c,u,h,n)}async eth_signTypedData(e,t){return this.eth_signTypedData_v4(e,t)}async eth_signTypedData_v4(e,t){const r=k.Address.from(e).toString().toLowerCase(),a=b(this,d).unlockedAccounts.get(r);if(null==a)throw new Error("cannot sign data; no private key");if("string"==typeof t)throw new Error("cannot sign data; string sent, expected object");if(!t.types)throw new Error("cannot sign data; types missing");if(!t.types.EIP712Domain)throw new Error("cannot sign data; EIP712Domain definition missing");if(!t.domain)throw new Error("cannot sign data; domain missing");if(!t.primaryType)throw new Error("cannot sign data; primaryType missing");if(!t.message)throw new Error("cannot sign data; message missing");return y.signTypedData_v4(a.toBuffer(),{data:t})}eth_subscribe(e,t){const r=b(this,o);switch(e){case"newHeads":{const e=b(this,a).call(this),t=v.PromiEvent.resolve(e),n=b(this,c).on("block",(r=>{const a=r.header,n={logsBloom:a.logsBloom,miner:a.miner,difficulty:a.difficulty,totalDifficulty:a.totalDifficulty,extraData:a.extraData,gasLimit:a.gasLimit,gasUsed:a.gasUsed,hash:r.hash(),mixHash:r.header.mixHash,nonce:a.nonce,number:a.number,parentHash:a.parentHash,receiptsRoot:a.receiptsRoot,stateRoot:a.stateRoot,timestamp:a.timestamp,transactionsRoot:a.transactionsRoot,sha3Uncles:a.sha3Uncles};void 0!==a.baseFeePerGas&&(n.baseFeePerGas=a.baseFeePerGas),t.emit("message",{type:"eth_subscription",data:{result:JSON.parse(JSON.stringify(n)),subscription:e.toString()}})}));return r.set(e.toString(),n),t}case"logs":{const e=b(this,a).call(this),n=v.PromiEvent.resolve(e),{addresses:o,topics:s}=t?w.parseFilterDetails(t):{addresses:[],topics:[]},d=b(this,c).on("blockLogs",(t=>{const r=JSON.parse(JSON.stringify([...t.filter(o,s)]));n.emit("message",{type:"eth_subscription",data:{result:r,subscription:e.toString()}})}));return r.set(e.toString(),d),n}case"newPendingTransactions":{const e=b(this,a).call(this),t=v.PromiEvent.resolve(e),n=b(this,c).on("pendingTransaction",(r=>{const a=r.hash.toString();t.emit("message",{type:"eth_subscription",data:{result:a,subscription:e.toString()}})}));return r.set(e.toString(),n),t}case"syncing":{const e=b(this,a).call(this),t=v.PromiEvent.resolve(e);return b(this,o).set(e.toString(),(()=>{})),t}default:throw new p.CodedError(`no "${e}" subscription in eth namespace`,v.JsonRpcErrorCode.METHOD_NOT_FOUND)}}async eth_unsubscribe(e){const t=b(this,o),r=t.get(e);return!!r&&(t.delete(e),r(),!0)}async eth_newBlockFilter(){const e={updates:[],unsubscribe:b(this,c).on("block",(t=>{e.updates.push(t.hash())})),filter:null,type:p.FilterTypes.block},t=b(this,a).call(this);return b(this,n).set(t.toString(),e),t}async eth_newPendingTransactionFilter(){const e={updates:[],unsubscribe:b(this,c).on("pendingTransaction",(t=>{e.updates.push(t.hash)})),filter:null,type:p.FilterTypes.pendingTransaction},t=b(this,a).call(this);return b(this,n).set(t.toString(),e),t}async eth_newFilter(e){const t=b(this,c);null==e&&(e={});const{addresses:r,topics:o}=w.parseFilterDetails(e||{}),s={updates:[],unsubscribe:t.on("blockLogs",(a=>{const n=a.blockNumber,{fromBlock:c,toBlock:d}=w.parseFilterRange(e,t);c<=n&&d>=n&&s.updates.push(...a.filter(r,o))})),filter:e,type:p.FilterTypes.log},d=b(this,a).call(this);return b(this,n).set(d.toString(),s),d}async eth_getFilterChanges(e){const t=b(this,n).get(v.Quantity.from(e).toString());if(t){const e=t.updates;return t.updates=[],e}throw new Error("filter not found")}async eth_uninstallFilter(e){const t=v.Quantity.from(e).toString(),r=b(this,n).get(t);return!!r&&(r.unsubscribe(),b(this,n).delete(t))}async eth_getFilterLogs(e){const t=b(this,n).get(v.Quantity.from(e).toString());if(t&&t.type===p.FilterTypes.log)return this.eth_getLogs(t.filter);throw new Error("filter not found")}async eth_getLogs(e){return b(this,c).blockLogs.getLogs(e)}async eth_getTransactionCount(e,t=p.Tag.LATEST){return b(this,c).accounts.getNonce(k.Address.from(e),t)}async eth_call(e,t=p.Tag.LATEST){const r=b(this,c),a=b(this,c).common,n=r.blocks,o=await n.get(t),d=o.header,u=b(this,s);let h,l;h=void 0===e.gasLimit?void 0!==e.gas?v.Quantity.from(e.gas):u.miner.callGasLimit:v.Quantity.from(e.gasLimit),void 0===e.data?void 0!==e.input&&(l=v.Data.from(e.input)):l=v.Data.from(e.data);const g=B.Block.calcNextBaseFee(o);let m;const I=void 0!==e.gasPrice;if(a.isActivatedEIP(1559)){const t=void 0!==e.maxFeePerGas,r=void 0!==e.maxPriorityFeePerGas;if(I&&(t||r))throw new Error("both gasPrice and (maxFeePerGas or maxPriorityFeePerGas) specified");let a=0n,n=0n;if(t&&(a=BigInt(e.maxFeePerGas)),r&&(n=BigInt(e.maxPriorityFeePerGas)),n>0||a>0){const e=a-g,t=e0&&n[n.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!n||o[1]>n[0]&&o[1]=65&&r<=70?r-55:r>=97&&r<=102?r-87:r-48&15}function parseHexByte(e,t,r){var a=parseHex4Bits(e,r);return r-1>=t&&(a|=parseHex4Bits(e,r-1)<<4),a}function parseBase(e,t,r,a){for(var n=0,o=Math.min(e.length,r),s=t;s=49?c-49+10:c>=17?c-17+10:c}return n}BN.isBN=function isBN(e){return e instanceof BN||null!==e&&"object"==typeof e&&e.constructor.wordSize===BN.wordSize&&Array.isArray(e.words)},BN.max=function max(e,t){return e.cmp(t)>0?e:t},BN.min=function min(e,t){return e.cmp(t)<0?e:t},BN.prototype._init=function init(e,t,r){if("number"==typeof e)return this._initNumber(e,t,r);if("object"==typeof e)return this._initArray(e,t,r);"hex"===t&&(t=16),assert(t===(0|t)&&t>=2&&t<=36);var a=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&(a++,this.negative=1),a=0;a-=3)o=e[a]|e[a-1]<<8|e[a-2]<<16,this.words[n]|=o<>>26-s&67108863,(s+=24)>=26&&(s-=26,n++);else if("le"===r)for(a=0,n=0;a>>26-s&67108863,(s+=24)>=26&&(s-=26,n++);return this.strip()},BN.prototype._parseHex=function _parseHex(e,t,r){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var a=0;a=t;a-=2)n=parseHexByte(e,t,a)<=18?(o-=18,s+=1,this.words[s]|=n>>>26):o+=8;else for(a=(e.length-t)%2==0?t+1:t;a=18?(o-=18,s+=1,this.words[s]|=n>>>26):o+=8;this.strip()},BN.prototype._parseBase=function _parseBase(e,t,r){this.words=[0],this.length=1;for(var a=0,n=1;n<=67108863;n*=t)a++;a--,n=n/t|0;for(var o=e.length-r,s=o%a,c=Math.min(o,o-s)+r,d=0,u=r;u1&&0===this.words[this.length-1];)this.length--;return this._normSign()},BN.prototype._normSign=function _normSign(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},BN.prototype.inspect=function inspect(){return(this.red?""};var n=["","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"],o=[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],s=[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 smallMulTo(e,t,r){r.negative=t.negative^e.negative;var a=e.length+t.length|0;r.length=a,a=a-1|0;var n=0|e.words[0],o=0|t.words[0],s=n*o,c=67108863&s,d=s/67108864|0;r.words[0]=c;for(var u=1;u>>26,l=67108863&d,b=Math.min(u,t.length-1),g=Math.max(0,u-e.length+1);g<=b;g++){var p=u-g|0;h+=(s=(n=0|e.words[p])*(o=0|t.words[g])+l)/67108864|0,l=67108863&s}r.words[u]=0|l,d=0|h}return 0!==d?r.words[u]=0|d:r.length--,r.strip()}BN.prototype.toString=function toString(e,t){var r;if(t=0|t||1,16===(e=e||10)||"hex"===e){r="";for(var a=0,c=0,d=0;d>>24-a&16777215)||d!==this.length-1?n[6-h.length]+h+r:h+r,(a+=2)>=26&&(a-=26,d--)}for(0!==c&&(r=c.toString(16)+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(e===(0|e)&&e>=2&&e<=36){var l=o[e],b=s[e];r="";var g=this.clone();for(g.negative=0;!g.isZero();){var p=g.modn(b).toString(e);r=(g=g.idivn(b)).isZero()?p+r:n[l-p.length]+p+r}for(this.isZero()&&(r="0"+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}assert(!1,"Base should be between 2 and 36")},BN.prototype.toNumber=function toNumber(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&assert(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},BN.prototype.toJSON=function toJSON(){return this.toString(16)},BN.prototype.toBuffer=function toBuffer(e,t){return assert(void 0!==a),this.toArrayLike(a,e,t)},BN.prototype.toArray=function toArray(e,t){return this.toArrayLike(Array,e,t)},BN.prototype.toArrayLike=function toArrayLike(e,t,r){var a=this.byteLength(),n=r||Math.max(1,a);assert(a<=n,"byte array longer than desired length"),assert(n>0,"Requested array length <= 0"),this.strip();var o,s,c="le"===t,d=new e(n),u=this.clone();if(c){for(s=0;!u.isZero();s++)o=u.andln(255),u.iushrn(8),d[s]=o;for(;s=4096&&(r+=13,t>>>=13),t>=64&&(r+=7,t>>>=7),t>=8&&(r+=4,t>>>=4),t>=2&&(r+=2,t>>>=2),r+t},BN.prototype._zeroBits=function _zeroBits(e){if(0===e)return 26;var t=e,r=0;return 0==(8191&t)&&(r+=13,t>>>=13),0==(127&t)&&(r+=7,t>>>=7),0==(15&t)&&(r+=4,t>>>=4),0==(3&t)&&(r+=2,t>>>=2),0==(1&t)&&r++,r},BN.prototype.bitLength=function bitLength(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},BN.prototype.zeroBits=function zeroBits(){if(this.isZero())return 0;for(var e=0,t=0;te.length?this.clone().ior(e):e.clone().ior(this)},BN.prototype.uor=function uor(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},BN.prototype.iuand=function iuand(e){var t;t=this.length>e.length?e:this;for(var r=0;re.length?this.clone().iand(e):e.clone().iand(this)},BN.prototype.uand=function uand(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},BN.prototype.iuxor=function iuxor(e){var t,r;this.length>e.length?(t=this,r=e):(t=e,r=this);for(var a=0;ae.length?this.clone().ixor(e):e.clone().ixor(this)},BN.prototype.uxor=function uxor(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},BN.prototype.inotn=function inotn(e){assert("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),r=e%26;this._expand(t),r>0&&t--;for(var a=0;a0&&(this.words[a]=~this.words[a]&67108863>>26-r),this.strip()},BN.prototype.notn=function notn(e){return this.clone().inotn(e)},BN.prototype.setn=function setn(e,t){assert("number"==typeof e&&e>=0);var r=e/26|0,a=e%26;return this._expand(r+1),this.words[r]=t?this.words[r]|1<e.length?(r=this,a=e):(r=e,a=this);for(var n=0,o=0;o>>26;for(;0!==n&&o>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;oe.length?this.clone().iadd(e):e.clone().iadd(this)},BN.prototype.isub=function isub(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var r,a,n=this.cmp(e);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,a=e):(r=e,a=this);for(var o=0,s=0;s>26,this.words[s]=67108863&t;for(;0!==o&&s>26,this.words[s]=67108863&t;if(0===o&&s>>13,g=0|s[1],p=8191&g,B=g>>>13,m=0|s[2],I=8191&m,y=m>>>13,v=0|s[3],x=8191&v,C=v>>>13,Q=0|s[4],w=8191&Q,_=Q>>>13,k=0|s[5],N=8191&k,D=k>>>13,U=0|s[6],G=8191&U,T=U>>>13,L=0|s[7],P=8191&L,q=L>>>13,O=0|s[8],H=8191&O,Y=O>>>13,j=0|s[9],J=8191&j,z=j>>>13,W=0|c[0],V=8191&W,X=W>>>13,$=0|c[1],et=8191&$,tt=$>>>13,rt=0|c[2],at=8191&rt,it=rt>>>13,nt=0|c[3],ot=8191&nt,At=nt>>>13,st=0|c[4],ct=8191&st,dt=st>>>13,ut=0|c[5],ht=8191&ut,bt=ut>>>13,pt=0|c[6],Bt=8191&pt,mt=pt>>>13,It=0|c[7],Et=8191&It,yt=It>>>13,vt=0|c[8],xt=8191&vt,Ct=vt>>>13,Qt=0|c[9],wt=8191&Qt,Mt=Qt>>>13;r.negative=e.negative^t.negative,r.length=19;var _t=(u+(a=Math.imul(l,V))|0)+((8191&(n=(n=Math.imul(l,X))+Math.imul(b,V)|0))<<13)|0;u=((o=Math.imul(b,X))+(n>>>13)|0)+(_t>>>26)|0,_t&=67108863,a=Math.imul(p,V),n=(n=Math.imul(p,X))+Math.imul(B,V)|0,o=Math.imul(B,X);var kt=(u+(a=a+Math.imul(l,et)|0)|0)+((8191&(n=(n=n+Math.imul(l,tt)|0)+Math.imul(b,et)|0))<<13)|0;u=((o=o+Math.imul(b,tt)|0)+(n>>>13)|0)+(kt>>>26)|0,kt&=67108863,a=Math.imul(I,V),n=(n=Math.imul(I,X))+Math.imul(y,V)|0,o=Math.imul(y,X),a=a+Math.imul(p,et)|0,n=(n=n+Math.imul(p,tt)|0)+Math.imul(B,et)|0,o=o+Math.imul(B,tt)|0;var St=(u+(a=a+Math.imul(l,at)|0)|0)+((8191&(n=(n=n+Math.imul(l,it)|0)+Math.imul(b,at)|0))<<13)|0;u=((o=o+Math.imul(b,it)|0)+(n>>>13)|0)+(St>>>26)|0,St&=67108863,a=Math.imul(x,V),n=(n=Math.imul(x,X))+Math.imul(C,V)|0,o=Math.imul(C,X),a=a+Math.imul(I,et)|0,n=(n=n+Math.imul(I,tt)|0)+Math.imul(y,et)|0,o=o+Math.imul(y,tt)|0,a=a+Math.imul(p,at)|0,n=(n=n+Math.imul(p,it)|0)+Math.imul(B,at)|0,o=o+Math.imul(B,it)|0;var Nt=(u+(a=a+Math.imul(l,ot)|0)|0)+((8191&(n=(n=n+Math.imul(l,At)|0)+Math.imul(b,ot)|0))<<13)|0;u=((o=o+Math.imul(b,At)|0)+(n>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,a=Math.imul(w,V),n=(n=Math.imul(w,X))+Math.imul(_,V)|0,o=Math.imul(_,X),a=a+Math.imul(x,et)|0,n=(n=n+Math.imul(x,tt)|0)+Math.imul(C,et)|0,o=o+Math.imul(C,tt)|0,a=a+Math.imul(I,at)|0,n=(n=n+Math.imul(I,it)|0)+Math.imul(y,at)|0,o=o+Math.imul(y,it)|0,a=a+Math.imul(p,ot)|0,n=(n=n+Math.imul(p,At)|0)+Math.imul(B,ot)|0,o=o+Math.imul(B,At)|0;var Dt=(u+(a=a+Math.imul(l,ct)|0)|0)+((8191&(n=(n=n+Math.imul(l,dt)|0)+Math.imul(b,ct)|0))<<13)|0;u=((o=o+Math.imul(b,dt)|0)+(n>>>13)|0)+(Dt>>>26)|0,Dt&=67108863,a=Math.imul(N,V),n=(n=Math.imul(N,X))+Math.imul(D,V)|0,o=Math.imul(D,X),a=a+Math.imul(w,et)|0,n=(n=n+Math.imul(w,tt)|0)+Math.imul(_,et)|0,o=o+Math.imul(_,tt)|0,a=a+Math.imul(x,at)|0,n=(n=n+Math.imul(x,it)|0)+Math.imul(C,at)|0,o=o+Math.imul(C,it)|0,a=a+Math.imul(I,ot)|0,n=(n=n+Math.imul(I,At)|0)+Math.imul(y,ot)|0,o=o+Math.imul(y,At)|0,a=a+Math.imul(p,ct)|0,n=(n=n+Math.imul(p,dt)|0)+Math.imul(B,ct)|0,o=o+Math.imul(B,dt)|0;var Rt=(u+(a=a+Math.imul(l,ht)|0)|0)+((8191&(n=(n=n+Math.imul(l,bt)|0)+Math.imul(b,ht)|0))<<13)|0;u=((o=o+Math.imul(b,bt)|0)+(n>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,a=Math.imul(G,V),n=(n=Math.imul(G,X))+Math.imul(T,V)|0,o=Math.imul(T,X),a=a+Math.imul(N,et)|0,n=(n=n+Math.imul(N,tt)|0)+Math.imul(D,et)|0,o=o+Math.imul(D,tt)|0,a=a+Math.imul(w,at)|0,n=(n=n+Math.imul(w,it)|0)+Math.imul(_,at)|0,o=o+Math.imul(_,it)|0,a=a+Math.imul(x,ot)|0,n=(n=n+Math.imul(x,At)|0)+Math.imul(C,ot)|0,o=o+Math.imul(C,At)|0,a=a+Math.imul(I,ct)|0,n=(n=n+Math.imul(I,dt)|0)+Math.imul(y,ct)|0,o=o+Math.imul(y,dt)|0,a=a+Math.imul(p,ht)|0,n=(n=n+Math.imul(p,bt)|0)+Math.imul(B,ht)|0,o=o+Math.imul(B,bt)|0;var Ft=(u+(a=a+Math.imul(l,Bt)|0)|0)+((8191&(n=(n=n+Math.imul(l,mt)|0)+Math.imul(b,Bt)|0))<<13)|0;u=((o=o+Math.imul(b,mt)|0)+(n>>>13)|0)+(Ft>>>26)|0,Ft&=67108863,a=Math.imul(P,V),n=(n=Math.imul(P,X))+Math.imul(q,V)|0,o=Math.imul(q,X),a=a+Math.imul(G,et)|0,n=(n=n+Math.imul(G,tt)|0)+Math.imul(T,et)|0,o=o+Math.imul(T,tt)|0,a=a+Math.imul(N,at)|0,n=(n=n+Math.imul(N,it)|0)+Math.imul(D,at)|0,o=o+Math.imul(D,it)|0,a=a+Math.imul(w,ot)|0,n=(n=n+Math.imul(w,At)|0)+Math.imul(_,ot)|0,o=o+Math.imul(_,At)|0,a=a+Math.imul(x,ct)|0,n=(n=n+Math.imul(x,dt)|0)+Math.imul(C,ct)|0,o=o+Math.imul(C,dt)|0,a=a+Math.imul(I,ht)|0,n=(n=n+Math.imul(I,bt)|0)+Math.imul(y,ht)|0,o=o+Math.imul(y,bt)|0,a=a+Math.imul(p,Bt)|0,n=(n=n+Math.imul(p,mt)|0)+Math.imul(B,Bt)|0,o=o+Math.imul(B,mt)|0;var Ut=(u+(a=a+Math.imul(l,Et)|0)|0)+((8191&(n=(n=n+Math.imul(l,yt)|0)+Math.imul(b,Et)|0))<<13)|0;u=((o=o+Math.imul(b,yt)|0)+(n>>>13)|0)+(Ut>>>26)|0,Ut&=67108863,a=Math.imul(H,V),n=(n=Math.imul(H,X))+Math.imul(Y,V)|0,o=Math.imul(Y,X),a=a+Math.imul(P,et)|0,n=(n=n+Math.imul(P,tt)|0)+Math.imul(q,et)|0,o=o+Math.imul(q,tt)|0,a=a+Math.imul(G,at)|0,n=(n=n+Math.imul(G,it)|0)+Math.imul(T,at)|0,o=o+Math.imul(T,it)|0,a=a+Math.imul(N,ot)|0,n=(n=n+Math.imul(N,At)|0)+Math.imul(D,ot)|0,o=o+Math.imul(D,At)|0,a=a+Math.imul(w,ct)|0,n=(n=n+Math.imul(w,dt)|0)+Math.imul(_,ct)|0,o=o+Math.imul(_,dt)|0,a=a+Math.imul(x,ht)|0,n=(n=n+Math.imul(x,bt)|0)+Math.imul(C,ht)|0,o=o+Math.imul(C,bt)|0,a=a+Math.imul(I,Bt)|0,n=(n=n+Math.imul(I,mt)|0)+Math.imul(y,Bt)|0,o=o+Math.imul(y,mt)|0,a=a+Math.imul(p,Et)|0,n=(n=n+Math.imul(p,yt)|0)+Math.imul(B,Et)|0,o=o+Math.imul(B,yt)|0;var Gt=(u+(a=a+Math.imul(l,xt)|0)|0)+((8191&(n=(n=n+Math.imul(l,Ct)|0)+Math.imul(b,xt)|0))<<13)|0;u=((o=o+Math.imul(b,Ct)|0)+(n>>>13)|0)+(Gt>>>26)|0,Gt&=67108863,a=Math.imul(J,V),n=(n=Math.imul(J,X))+Math.imul(z,V)|0,o=Math.imul(z,X),a=a+Math.imul(H,et)|0,n=(n=n+Math.imul(H,tt)|0)+Math.imul(Y,et)|0,o=o+Math.imul(Y,tt)|0,a=a+Math.imul(P,at)|0,n=(n=n+Math.imul(P,it)|0)+Math.imul(q,at)|0,o=o+Math.imul(q,it)|0,a=a+Math.imul(G,ot)|0,n=(n=n+Math.imul(G,At)|0)+Math.imul(T,ot)|0,o=o+Math.imul(T,At)|0,a=a+Math.imul(N,ct)|0,n=(n=n+Math.imul(N,dt)|0)+Math.imul(D,ct)|0,o=o+Math.imul(D,dt)|0,a=a+Math.imul(w,ht)|0,n=(n=n+Math.imul(w,bt)|0)+Math.imul(_,ht)|0,o=o+Math.imul(_,bt)|0,a=a+Math.imul(x,Bt)|0,n=(n=n+Math.imul(x,mt)|0)+Math.imul(C,Bt)|0,o=o+Math.imul(C,mt)|0,a=a+Math.imul(I,Et)|0,n=(n=n+Math.imul(I,yt)|0)+Math.imul(y,Et)|0,o=o+Math.imul(y,yt)|0,a=a+Math.imul(p,xt)|0,n=(n=n+Math.imul(p,Ct)|0)+Math.imul(B,xt)|0,o=o+Math.imul(B,Ct)|0;var Tt=(u+(a=a+Math.imul(l,wt)|0)|0)+((8191&(n=(n=n+Math.imul(l,Mt)|0)+Math.imul(b,wt)|0))<<13)|0;u=((o=o+Math.imul(b,Mt)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,a=Math.imul(J,et),n=(n=Math.imul(J,tt))+Math.imul(z,et)|0,o=Math.imul(z,tt),a=a+Math.imul(H,at)|0,n=(n=n+Math.imul(H,it)|0)+Math.imul(Y,at)|0,o=o+Math.imul(Y,it)|0,a=a+Math.imul(P,ot)|0,n=(n=n+Math.imul(P,At)|0)+Math.imul(q,ot)|0,o=o+Math.imul(q,At)|0,a=a+Math.imul(G,ct)|0,n=(n=n+Math.imul(G,dt)|0)+Math.imul(T,ct)|0,o=o+Math.imul(T,dt)|0,a=a+Math.imul(N,ht)|0,n=(n=n+Math.imul(N,bt)|0)+Math.imul(D,ht)|0,o=o+Math.imul(D,bt)|0,a=a+Math.imul(w,Bt)|0,n=(n=n+Math.imul(w,mt)|0)+Math.imul(_,Bt)|0,o=o+Math.imul(_,mt)|0,a=a+Math.imul(x,Et)|0,n=(n=n+Math.imul(x,yt)|0)+Math.imul(C,Et)|0,o=o+Math.imul(C,yt)|0,a=a+Math.imul(I,xt)|0,n=(n=n+Math.imul(I,Ct)|0)+Math.imul(y,xt)|0,o=o+Math.imul(y,Ct)|0;var Lt=(u+(a=a+Math.imul(p,wt)|0)|0)+((8191&(n=(n=n+Math.imul(p,Mt)|0)+Math.imul(B,wt)|0))<<13)|0;u=((o=o+Math.imul(B,Mt)|0)+(n>>>13)|0)+(Lt>>>26)|0,Lt&=67108863,a=Math.imul(J,at),n=(n=Math.imul(J,it))+Math.imul(z,at)|0,o=Math.imul(z,it),a=a+Math.imul(H,ot)|0,n=(n=n+Math.imul(H,At)|0)+Math.imul(Y,ot)|0,o=o+Math.imul(Y,At)|0,a=a+Math.imul(P,ct)|0,n=(n=n+Math.imul(P,dt)|0)+Math.imul(q,ct)|0,o=o+Math.imul(q,dt)|0,a=a+Math.imul(G,ht)|0,n=(n=n+Math.imul(G,bt)|0)+Math.imul(T,ht)|0,o=o+Math.imul(T,bt)|0,a=a+Math.imul(N,Bt)|0,n=(n=n+Math.imul(N,mt)|0)+Math.imul(D,Bt)|0,o=o+Math.imul(D,mt)|0,a=a+Math.imul(w,Et)|0,n=(n=n+Math.imul(w,yt)|0)+Math.imul(_,Et)|0,o=o+Math.imul(_,yt)|0,a=a+Math.imul(x,xt)|0,n=(n=n+Math.imul(x,Ct)|0)+Math.imul(C,xt)|0,o=o+Math.imul(C,Ct)|0;var Pt=(u+(a=a+Math.imul(I,wt)|0)|0)+((8191&(n=(n=n+Math.imul(I,Mt)|0)+Math.imul(y,wt)|0))<<13)|0;u=((o=o+Math.imul(y,Mt)|0)+(n>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,a=Math.imul(J,ot),n=(n=Math.imul(J,At))+Math.imul(z,ot)|0,o=Math.imul(z,At),a=a+Math.imul(H,ct)|0,n=(n=n+Math.imul(H,dt)|0)+Math.imul(Y,ct)|0,o=o+Math.imul(Y,dt)|0,a=a+Math.imul(P,ht)|0,n=(n=n+Math.imul(P,bt)|0)+Math.imul(q,ht)|0,o=o+Math.imul(q,bt)|0,a=a+Math.imul(G,Bt)|0,n=(n=n+Math.imul(G,mt)|0)+Math.imul(T,Bt)|0,o=o+Math.imul(T,mt)|0,a=a+Math.imul(N,Et)|0,n=(n=n+Math.imul(N,yt)|0)+Math.imul(D,Et)|0,o=o+Math.imul(D,yt)|0,a=a+Math.imul(w,xt)|0,n=(n=n+Math.imul(w,Ct)|0)+Math.imul(_,xt)|0,o=o+Math.imul(_,Ct)|0;var qt=(u+(a=a+Math.imul(x,wt)|0)|0)+((8191&(n=(n=n+Math.imul(x,Mt)|0)+Math.imul(C,wt)|0))<<13)|0;u=((o=o+Math.imul(C,Mt)|0)+(n>>>13)|0)+(qt>>>26)|0,qt&=67108863,a=Math.imul(J,ct),n=(n=Math.imul(J,dt))+Math.imul(z,ct)|0,o=Math.imul(z,dt),a=a+Math.imul(H,ht)|0,n=(n=n+Math.imul(H,bt)|0)+Math.imul(Y,ht)|0,o=o+Math.imul(Y,bt)|0,a=a+Math.imul(P,Bt)|0,n=(n=n+Math.imul(P,mt)|0)+Math.imul(q,Bt)|0,o=o+Math.imul(q,mt)|0,a=a+Math.imul(G,Et)|0,n=(n=n+Math.imul(G,yt)|0)+Math.imul(T,Et)|0,o=o+Math.imul(T,yt)|0,a=a+Math.imul(N,xt)|0,n=(n=n+Math.imul(N,Ct)|0)+Math.imul(D,xt)|0,o=o+Math.imul(D,Ct)|0;var Ot=(u+(a=a+Math.imul(w,wt)|0)|0)+((8191&(n=(n=n+Math.imul(w,Mt)|0)+Math.imul(_,wt)|0))<<13)|0;u=((o=o+Math.imul(_,Mt)|0)+(n>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,a=Math.imul(J,ht),n=(n=Math.imul(J,bt))+Math.imul(z,ht)|0,o=Math.imul(z,bt),a=a+Math.imul(H,Bt)|0,n=(n=n+Math.imul(H,mt)|0)+Math.imul(Y,Bt)|0,o=o+Math.imul(Y,mt)|0,a=a+Math.imul(P,Et)|0,n=(n=n+Math.imul(P,yt)|0)+Math.imul(q,Et)|0,o=o+Math.imul(q,yt)|0,a=a+Math.imul(G,xt)|0,n=(n=n+Math.imul(G,Ct)|0)+Math.imul(T,xt)|0,o=o+Math.imul(T,Ct)|0;var Ht=(u+(a=a+Math.imul(N,wt)|0)|0)+((8191&(n=(n=n+Math.imul(N,Mt)|0)+Math.imul(D,wt)|0))<<13)|0;u=((o=o+Math.imul(D,Mt)|0)+(n>>>13)|0)+(Ht>>>26)|0,Ht&=67108863,a=Math.imul(J,Bt),n=(n=Math.imul(J,mt))+Math.imul(z,Bt)|0,o=Math.imul(z,mt),a=a+Math.imul(H,Et)|0,n=(n=n+Math.imul(H,yt)|0)+Math.imul(Y,Et)|0,o=o+Math.imul(Y,yt)|0,a=a+Math.imul(P,xt)|0,n=(n=n+Math.imul(P,Ct)|0)+Math.imul(q,xt)|0,o=o+Math.imul(q,Ct)|0;var Yt=(u+(a=a+Math.imul(G,wt)|0)|0)+((8191&(n=(n=n+Math.imul(G,Mt)|0)+Math.imul(T,wt)|0))<<13)|0;u=((o=o+Math.imul(T,Mt)|0)+(n>>>13)|0)+(Yt>>>26)|0,Yt&=67108863,a=Math.imul(J,Et),n=(n=Math.imul(J,yt))+Math.imul(z,Et)|0,o=Math.imul(z,yt),a=a+Math.imul(H,xt)|0,n=(n=n+Math.imul(H,Ct)|0)+Math.imul(Y,xt)|0,o=o+Math.imul(Y,Ct)|0;var jt=(u+(a=a+Math.imul(P,wt)|0)|0)+((8191&(n=(n=n+Math.imul(P,Mt)|0)+Math.imul(q,wt)|0))<<13)|0;u=((o=o+Math.imul(q,Mt)|0)+(n>>>13)|0)+(jt>>>26)|0,jt&=67108863,a=Math.imul(J,xt),n=(n=Math.imul(J,Ct))+Math.imul(z,xt)|0,o=Math.imul(z,Ct);var Jt=(u+(a=a+Math.imul(H,wt)|0)|0)+((8191&(n=(n=n+Math.imul(H,Mt)|0)+Math.imul(Y,wt)|0))<<13)|0;u=((o=o+Math.imul(Y,Mt)|0)+(n>>>13)|0)+(Jt>>>26)|0,Jt&=67108863;var Kt=(u+(a=Math.imul(J,wt))|0)+((8191&(n=(n=Math.imul(J,Mt))+Math.imul(z,wt)|0))<<13)|0;return u=((o=Math.imul(z,Mt))+(n>>>13)|0)+(Kt>>>26)|0,Kt&=67108863,d[0]=_t,d[1]=kt,d[2]=St,d[3]=Nt,d[4]=Dt,d[5]=Rt,d[6]=Ft,d[7]=Ut,d[8]=Gt,d[9]=Tt,d[10]=Lt,d[11]=Pt,d[12]=qt,d[13]=Ot,d[14]=Ht,d[15]=Yt,d[16]=jt,d[17]=Jt,d[18]=Kt,0!==u&&(d[19]=u,r.length++),r};function jumboMulTo(e,t,r){return(new FFTM).mulp(e,t,r)}function FFTM(e,t){this.x=e,this.y=t}Math.imul||(c=smallMulTo),BN.prototype.mulTo=function mulTo(e,t){var r=this.length+e.length;return 10===this.length&&10===e.length?c(this,e,t):r<63?smallMulTo(this,e,t):r<1024?function bigMulTo(e,t,r){r.negative=t.negative^e.negative,r.length=e.length+t.length;for(var a=0,n=0,o=0;o>>26)|0)>>>26,s&=67108863}r.words[o]=c,a=s,s=n}return 0!==a?r.words[o]=a:r.length--,r.strip()}(this,e,t):jumboMulTo(this,e,t)},FFTM.prototype.makeRBT=function makeRBT(e){for(var t=new Array(e),r=BN.prototype._countBits(e)-1,a=0;a>=1;return a},FFTM.prototype.permute=function permute(e,t,r,a,n,o){for(var s=0;s>>=1)n++;return 1<>>=13,r[2*o+1]=8191&n,n>>>=13;for(o=2*t;o>=26,t+=a/67108864|0,t+=n>>>26,this.words[r]=67108863&n}return 0!==t&&(this.words[r]=t,this.length++),this},BN.prototype.muln=function muln(e){return this.clone().imuln(e)},BN.prototype.sqr=function sqr(){return this.mul(this)},BN.prototype.isqr=function isqr(){return this.imul(this.clone())},BN.prototype.pow=function pow(e){var t=function toBitArray(e){for(var t=new Array(e.bitLength()),r=0;r>>n}return t}(e);if(0===t.length)return new BN(1);for(var r=this,a=0;a=0);var t,r=e%26,a=(e-r)/26,n=67108863>>>26-r<<26-r;if(0!==r){var o=0;for(t=0;t>>26-r}o&&(this.words[t]=o,this.length++)}if(0!==a){for(t=this.length-1;t>=0;t--)this.words[t+a]=this.words[t];for(t=0;t=0),a=t?(t-t%26)/26:0;var n=e%26,o=Math.min((e-n)/26,this.length),s=67108863^67108863>>>n<o)for(this.length-=o,d=0;d=0&&(0!==u||d>=a);d--){var h=0|this.words[d];this.words[d]=u<<26-n|h>>>n,u=h&s}return c&&0!==u&&(c.words[c.length++]=u),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},BN.prototype.ishrn=function ishrn(e,t,r){return assert(0===this.negative),this.iushrn(e,t,r)},BN.prototype.shln=function shln(e){return this.clone().ishln(e)},BN.prototype.ushln=function ushln(e){return this.clone().iushln(e)},BN.prototype.shrn=function shrn(e){return this.clone().ishrn(e)},BN.prototype.ushrn=function ushrn(e){return this.clone().iushrn(e)},BN.prototype.testn=function testn(e){assert("number"==typeof e&&e>=0);var t=e%26,r=(e-t)/26,a=1<=0);var t=e%26,r=(e-t)/26;if(assert(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==t&&r++,this.length=Math.min(r,this.length),0!==t){var a=67108863^67108863>>>t<=67108864;t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},BN.prototype.isubn=function isubn(e){if(assert("number"==typeof e),assert(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t>26)-(c/67108864|0),this.words[a+r]=67108863&n}for(;a>26,this.words[a+r]=67108863&n;if(0===s)return this.strip();for(assert(-1===s),s=0,a=0;a>26,this.words[a]=67108863&n;return this.negative=1,this.strip()},BN.prototype._wordDiv=function _wordDiv(e,t){var r=(this.length,e.length),a=this.clone(),n=e,o=0|n.words[n.length-1];0!==(r=26-this._countBits(o))&&(n=n.ushln(r),a.iushln(r),o=0|n.words[n.length-1]);var s,c=a.length-n.length;if("mod"!==t){(s=new BN(null)).length=c+1,s.words=new Array(s.length);for(var d=0;d=0;h--){var l=67108864*(0|a.words[n.length+h])+(0|a.words[n.length+h-1]);for(l=Math.min(l/o|0,67108863),a._ishlnsubmul(n,l,h);0!==a.negative;)l--,a.negative=0,a._ishlnsubmul(n,1,h),a.isZero()||(a.negative^=1);s&&(s.words[h]=l)}return s&&s.strip(),a.strip(),"div"!==t&&0!==r&&a.iushrn(r),{div:s||null,mod:a}},BN.prototype.divmod=function divmod(e,t,r){return assert(!e.isZero()),this.isZero()?{div:new BN(0),mod:new BN(0)}:0!==this.negative&&0===e.negative?(o=this.neg().divmod(e,t),"mod"!==t&&(a=o.div.neg()),"div"!==t&&(n=o.mod.neg(),r&&0!==n.negative&&n.iadd(e)),{div:a,mod:n}):0===this.negative&&0!==e.negative?(o=this.divmod(e.neg(),t),"mod"!==t&&(a=o.div.neg()),{div:a,mod:o.mod}):0!=(this.negative&e.negative)?(o=this.neg().divmod(e.neg(),t),"div"!==t&&(n=o.mod.neg(),r&&0!==n.negative&&n.isub(e)),{div:o.div,mod:n}):e.length>this.length||this.cmp(e)<0?{div:new BN(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new BN(this.modn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new BN(this.modn(e.words[0]))}:this._wordDiv(e,t);var a,n,o},BN.prototype.div=function div(e){return this.divmod(e,"div",!1).div},BN.prototype.mod=function mod(e){return this.divmod(e,"mod",!1).mod},BN.prototype.umod=function umod(e){return this.divmod(e,"mod",!0).mod},BN.prototype.divRound=function divRound(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var r=0!==t.div.negative?t.mod.isub(e):t.mod,a=e.ushrn(1),n=e.andln(1),o=r.cmp(a);return o<0||1===n&&0===o?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},BN.prototype.modn=function modn(e){assert(e<=67108863);for(var t=(1<<26)%e,r=0,a=this.length-1;a>=0;a--)r=(t*r+(0|this.words[a]))%e;return r},BN.prototype.idivn=function idivn(e){assert(e<=67108863);for(var t=0,r=this.length-1;r>=0;r--){var a=(0|this.words[r])+67108864*t;this.words[r]=a/e|0,t=a%e}return this.strip()},BN.prototype.divn=function divn(e){return this.clone().idivn(e)},BN.prototype.egcd=function egcd(e){assert(0===e.negative),assert(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var a=new BN(1),n=new BN(0),o=new BN(0),s=new BN(1),c=0;t.isEven()&&r.isEven();)t.iushrn(1),r.iushrn(1),++c;for(var d=r.clone(),u=t.clone();!t.isZero();){for(var h=0,l=1;0==(t.words[0]&l)&&h<26;++h,l<<=1);if(h>0)for(t.iushrn(h);h-- >0;)(a.isOdd()||n.isOdd())&&(a.iadd(d),n.isub(u)),a.iushrn(1),n.iushrn(1);for(var b=0,g=1;0==(r.words[0]&g)&&b<26;++b,g<<=1);if(b>0)for(r.iushrn(b);b-- >0;)(o.isOdd()||s.isOdd())&&(o.iadd(d),s.isub(u)),o.iushrn(1),s.iushrn(1);t.cmp(r)>=0?(t.isub(r),a.isub(o),n.isub(s)):(r.isub(t),o.isub(a),s.isub(n))}return{a:o,b:s,gcd:r.iushln(c)}},BN.prototype._invmp=function _invmp(e){assert(0===e.negative),assert(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var a,n=new BN(1),o=new BN(0),s=r.clone();t.cmpn(1)>0&&r.cmpn(1)>0;){for(var c=0,d=1;0==(t.words[0]&d)&&c<26;++c,d<<=1);if(c>0)for(t.iushrn(c);c-- >0;)n.isOdd()&&n.iadd(s),n.iushrn(1);for(var u=0,h=1;0==(r.words[0]&h)&&u<26;++u,h<<=1);if(u>0)for(r.iushrn(u);u-- >0;)o.isOdd()&&o.iadd(s),o.iushrn(1);t.cmp(r)>=0?(t.isub(r),n.isub(o)):(r.isub(t),o.isub(n))}return(a=0===t.cmpn(1)?n:o).cmpn(0)<0&&a.iadd(e),a},BN.prototype.gcd=function gcd(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),r=e.clone();t.negative=0,r.negative=0;for(var a=0;t.isEven()&&r.isEven();a++)t.iushrn(1),r.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=t.cmp(r);if(n<0){var o=t;t=r,r=o}else if(0===n||0===r.cmpn(1))break;t.isub(r)}return r.iushln(a)},BN.prototype.invm=function invm(e){return this.egcd(e).a.umod(e)},BN.prototype.isEven=function isEven(){return 0==(1&this.words[0])},BN.prototype.isOdd=function isOdd(){return 1==(1&this.words[0])},BN.prototype.andln=function andln(e){return this.words[0]&e},BN.prototype.bincn=function bincn(e){assert("number"==typeof e);var t=e%26,r=(e-t)/26,a=1<>>26,s&=67108863,this.words[o]=s}return 0!==n&&(this.words[o]=n,this.length++),this},BN.prototype.isZero=function isZero(){return 1===this.length&&0===this.words[0]},BN.prototype.cmpn=function cmpn(e){var t,r=e<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this.strip(),this.length>1)t=1;else{r&&(e=-e),assert(e<=67108863,"Number is too big");var a=0|this.words[0];t=a===e?0:ae.length)return 1;if(this.length=0;r--){var a=0|this.words[r],n=0|e.words[r];if(a!==n){an&&(t=1);break}}return t},BN.prototype.gtn=function gtn(e){return 1===this.cmpn(e)},BN.prototype.gt=function gt(e){return 1===this.cmp(e)},BN.prototype.gten=function gten(e){return this.cmpn(e)>=0},BN.prototype.gte=function gte(e){return this.cmp(e)>=0},BN.prototype.ltn=function ltn(e){return-1===this.cmpn(e)},BN.prototype.lt=function lt(e){return-1===this.cmp(e)},BN.prototype.lten=function lten(e){return this.cmpn(e)<=0},BN.prototype.lte=function lte(e){return this.cmp(e)<=0},BN.prototype.eqn=function eqn(e){return 0===this.cmpn(e)},BN.prototype.eq=function eq(e){return 0===this.cmp(e)},BN.red=function red(e){return new Red(e)},BN.prototype.toRed=function toRed(e){return assert(!this.red,"Already a number in reduction context"),assert(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},BN.prototype.fromRed=function fromRed(){return assert(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},BN.prototype._forceRed=function _forceRed(e){return this.red=e,this},BN.prototype.forceRed=function forceRed(e){return assert(!this.red,"Already a number in reduction context"),this._forceRed(e)},BN.prototype.redAdd=function redAdd(e){return assert(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},BN.prototype.redIAdd=function redIAdd(e){return assert(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},BN.prototype.redSub=function redSub(e){return assert(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},BN.prototype.redISub=function redISub(e){return assert(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},BN.prototype.redShl=function redShl(e){return assert(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},BN.prototype.redMul=function redMul(e){return assert(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},BN.prototype.redIMul=function redIMul(e){return assert(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},BN.prototype.redSqr=function redSqr(){return assert(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},BN.prototype.redISqr=function redISqr(){return assert(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},BN.prototype.redSqrt=function redSqrt(){return assert(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},BN.prototype.redInvm=function redInvm(){return assert(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},BN.prototype.redNeg=function redNeg(){return assert(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},BN.prototype.redPow=function redPow(e){return assert(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var d={k256:null,p224:null,p192:null,p25519:null};function MPrime(e,t){this.name=e,this.p=new BN(t,16),this.n=this.p.bitLength(),this.k=new BN(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function K256(){MPrime.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function P224(){MPrime.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function P192(){MPrime.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function P25519(){MPrime.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function Red(e){if("string"==typeof e){var t=BN._prime(e);this.m=t.p,this.prime=t}else assert(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function Mont(e){Red.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new BN(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)}MPrime.prototype._tmp=function _tmp(){var e=new BN(null);return e.words=new Array(Math.ceil(this.n/13)),e},MPrime.prototype.ireduce=function ireduce(e){var t,r=e;do{this.split(r,this.tmp),t=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(t>this.n);var a=t0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},MPrime.prototype.split=function split(e,t){e.iushrn(this.n,0,t)},MPrime.prototype.imulK=function imulK(e){return e.imul(this.k)},inherits(K256,MPrime),K256.prototype.split=function split(e,t){for(var r=4194303,a=Math.min(e.length,9),n=0;n>>22,o=s}o>>>=22,e.words[n-10]=o,0===o&&e.length>10?e.length-=10:e.length-=9},K256.prototype.imulK=function imulK(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,r=0;r>>=26,e.words[r]=n,t=a}return 0!==t&&(e.words[e.length++]=t),e},BN._prime=function prime(e){if(d[e])return d[e];var prime;if("k256"===e)prime=new K256;else if("p224"===e)prime=new P224;else if("p192"===e)prime=new P192;else{if("p25519"!==e)throw new Error("Unknown prime "+e);prime=new P25519}return d[e]=prime,prime},Red.prototype._verify1=function _verify1(e){assert(0===e.negative,"red works only with positives"),assert(e.red,"red works only with red numbers")},Red.prototype._verify2=function _verify2(e,t){assert(0==(e.negative|t.negative),"red works only with positives"),assert(e.red&&e.red===t.red,"red works only with red numbers")},Red.prototype.imod=function imod(e){return this.prime?this.prime.ireduce(e)._forceRed(this):e.umod(this.m)._forceRed(this)},Red.prototype.neg=function neg(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},Red.prototype.add=function add(e,t){this._verify2(e,t);var r=e.add(t);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},Red.prototype.iadd=function iadd(e,t){this._verify2(e,t);var r=e.iadd(t);return r.cmp(this.m)>=0&&r.isub(this.m),r},Red.prototype.sub=function sub(e,t){this._verify2(e,t);var r=e.sub(t);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},Red.prototype.isub=function isub(e,t){this._verify2(e,t);var r=e.isub(t);return r.cmpn(0)<0&&r.iadd(this.m),r},Red.prototype.shl=function shl(e,t){return this._verify1(e),this.imod(e.ushln(t))},Red.prototype.imul=function imul(e,t){return this._verify2(e,t),this.imod(e.imul(t))},Red.prototype.mul=function mul(e,t){return this._verify2(e,t),this.imod(e.mul(t))},Red.prototype.isqr=function isqr(e){return this.imul(e,e.clone())},Red.prototype.sqr=function sqr(e){return this.mul(e,e)},Red.prototype.sqrt=function sqrt(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(assert(t%2==1),3===t){var r=this.m.add(new BN(1)).iushrn(2);return this.pow(e,r)}for(var a=this.m.subn(1),n=0;!a.isZero()&&0===a.andln(1);)n++,a.iushrn(1);assert(!a.isZero());var o=new BN(1).toRed(this),s=o.redNeg(),c=this.m.subn(1).iushrn(1),d=this.m.bitLength();for(d=new BN(2*d*d).toRed(this);0!==this.pow(d,c).cmp(s);)d.redIAdd(s);for(var u=this.pow(d,a),h=this.pow(e,a.addn(1).iushrn(1)),l=this.pow(e,a),b=n;0!==l.cmp(o);){for(var g=l,p=0;0!==g.cmp(o);p++)g=g.redSqr();assert(p=0;a--){for(var d=t.words[a],u=c-1;u>=0;u--){var h=d>>u&1;n!==r[0]&&(n=this.sqr(n)),0!==h||0!==o?(o<<=1,o|=h,(4===++s||0===a&&0===u)&&(n=this.mul(n,r[o]),s=0,o=0)):s=0}c=26}return n},Red.prototype.convertTo=function convertTo(e){var t=e.umod(this.m);return t===e?t.clone():t},Red.prototype.convertFrom=function convertFrom(e){var t=e.clone();return t.red=null,t},BN.mont=function mont(e){return new Mont(e)},inherits(Mont,Red),Mont.prototype.convertTo=function convertTo(e){return this.imod(e.ushln(this.shift))},Mont.prototype.convertFrom=function convertFrom(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},Mont.prototype.imul=function imul(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var r=e.imul(t),a=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(a).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},Mont.prototype.mul=function mul(e,t){if(e.isZero()||t.isZero())return new BN(0)._forceRed(this);var r=e.mul(t),a=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(a).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},Mont.prototype.invm=function invm(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(e=r.nmd(e),this)},function(e,t,r){!function(e,t){"use strict";function assert(e,t){if(!e)throw new Error(t||"Assertion failed")}function inherits(e,t){e.super_=t;var TempCtor=function(){};TempCtor.prototype=t.prototype,e.prototype=new TempCtor,e.prototype.constructor=e}function BN(e,t,r){if(BN.isBN(e))return e;this.negative=0,this.words=null,this.length=0,this.red=null,null!==e&&("le"!==t&&"be"!==t||(r=t,t=10),this._init(e||0,t||10,r||"be"))}var a;"object"==typeof e?e.exports=BN:t.BN=BN,BN.BN=BN,BN.wordSize=26;try{a="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:r(17).Buffer}catch(e){}function parseHex4Bits(e,t){var r=e.charCodeAt(t);return r>=48&&r<=57?r-48:r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:void assert(!1,"Invalid character in "+e)}function parseHexByte(e,t,r){var a=parseHex4Bits(e,r);return r-1>=t&&(a|=parseHex4Bits(e,r-1)<<4),a}function parseBase(e,t,r,a){for(var n=0,o=0,s=Math.min(e.length,r),c=t;c=49?d-49+10:d>=17?d-17+10:d,assert(d>=0&&o0?e:t},BN.min=function min(e,t){return e.cmp(t)<0?e:t},BN.prototype._init=function init(e,t,r){if("number"==typeof e)return this._initNumber(e,t,r);if("object"==typeof e)return this._initArray(e,t,r);"hex"===t&&(t=16),assert(t===(0|t)&&t>=2&&t<=36);var a=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&(a++,this.negative=1),a=0;a-=3)o=e[a]|e[a-1]<<8|e[a-2]<<16,this.words[n]|=o<>>26-s&67108863,(s+=24)>=26&&(s-=26,n++);else if("le"===r)for(a=0,n=0;a>>26-s&67108863,(s+=24)>=26&&(s-=26,n++);return this._strip()},BN.prototype._parseHex=function _parseHex(e,t,r){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var a=0;a=t;a-=2)n=parseHexByte(e,t,a)<=18?(o-=18,s+=1,this.words[s]|=n>>>26):o+=8;else for(a=(e.length-t)%2==0?t+1:t;a=18?(o-=18,s+=1,this.words[s]|=n>>>26):o+=8;this._strip()},BN.prototype._parseBase=function _parseBase(e,t,r){this.words=[0],this.length=1;for(var a=0,n=1;n<=67108863;n*=t)a++;a--,n=n/t|0;for(var o=e.length-r,s=o%a,c=Math.min(o,o-s)+r,d=0,u=r;u1&&0===this.words[this.length-1];)this.length--;return this._normSign()},BN.prototype._normSign=function _normSign(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for)try{BN.prototype[Symbol.for("nodejs.util.inspect.custom")]=inspect}catch(e){BN.prototype.inspect=inspect}else BN.prototype.inspect=inspect;function inspect(){return(this.red?""}var n=["","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"],o=[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],s=[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];BN.prototype.toString=function toString(e,t){var r;if(t=0|t||1,16===(e=e||10)||"hex"===e){r="";for(var a=0,c=0,d=0;d>>24-a&16777215)||d!==this.length-1?n[6-h.length]+h+r:h+r,(a+=2)>=26&&(a-=26,d--)}for(0!==c&&(r=c.toString(16)+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(e===(0|e)&&e>=2&&e<=36){var l=o[e],b=s[e];r="";var g=this.clone();for(g.negative=0;!g.isZero();){var p=g.modrn(b).toString(e);r=(g=g.idivn(b)).isZero()?p+r:n[l-p.length]+p+r}for(this.isZero()&&(r="0"+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}assert(!1,"Base should be between 2 and 36")},BN.prototype.toNumber=function toNumber(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&assert(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},BN.prototype.toJSON=function toJSON(){return this.toString(16,2)},a&&(BN.prototype.toBuffer=function toBuffer(e,t){return this.toArrayLike(a,e,t)}),BN.prototype.toArray=function toArray(e,t){return this.toArrayLike(Array,e,t)};function smallMulTo(e,t,r){r.negative=t.negative^e.negative;var a=e.length+t.length|0;r.length=a,a=a-1|0;var n=0|e.words[0],o=0|t.words[0],s=n*o,c=67108863&s,d=s/67108864|0;r.words[0]=c;for(var u=1;u>>26,l=67108863&d,b=Math.min(u,t.length-1),g=Math.max(0,u-e.length+1);g<=b;g++){var p=u-g|0;h+=(s=(n=0|e.words[p])*(o=0|t.words[g])+l)/67108864|0,l=67108863&s}r.words[u]=0|l,d=0|h}return 0!==d?r.words[u]=0|d:r.length--,r._strip()}BN.prototype.toArrayLike=function toArrayLike(e,t,r){this._strip();var a=this.byteLength(),n=r||Math.max(1,a);assert(a<=n,"byte array longer than desired length"),assert(n>0,"Requested array length <= 0");var o=function allocate(e,t){return e.allocUnsafe?e.allocUnsafe(t):new e(t)}(e,n);return this["_toArrayLike"+("le"===t?"LE":"BE")](o,a),o},BN.prototype._toArrayLikeLE=function _toArrayLikeLE(e,t){for(var r=0,a=0,n=0,o=0;n>8&255),r>16&255),6===o?(r>24&255),a=0,o=0):(a=s>>>24,o+=2)}if(r=0&&(e[r--]=s>>8&255),r>=0&&(e[r--]=s>>16&255),6===o?(r>=0&&(e[r--]=s>>24&255),a=0,o=0):(a=s>>>24,o+=2)}if(r>=0)for(e[r--]=a;r>=0;)e[r--]=0},Math.clz32?BN.prototype._countBits=function _countBits(e){return 32-Math.clz32(e)}:BN.prototype._countBits=function _countBits(e){var t=e,r=0;return t>=4096&&(r+=13,t>>>=13),t>=64&&(r+=7,t>>>=7),t>=8&&(r+=4,t>>>=4),t>=2&&(r+=2,t>>>=2),r+t},BN.prototype._zeroBits=function _zeroBits(e){if(0===e)return 26;var t=e,r=0;return 0==(8191&t)&&(r+=13,t>>>=13),0==(127&t)&&(r+=7,t>>>=7),0==(15&t)&&(r+=4,t>>>=4),0==(3&t)&&(r+=2,t>>>=2),0==(1&t)&&r++,r},BN.prototype.bitLength=function bitLength(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},BN.prototype.zeroBits=function zeroBits(){if(this.isZero())return 0;for(var e=0,t=0;te.length?this.clone().ior(e):e.clone().ior(this)},BN.prototype.uor=function uor(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},BN.prototype.iuand=function iuand(e){var t;t=this.length>e.length?e:this;for(var r=0;re.length?this.clone().iand(e):e.clone().iand(this)},BN.prototype.uand=function uand(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},BN.prototype.iuxor=function iuxor(e){var t,r;this.length>e.length?(t=this,r=e):(t=e,r=this);for(var a=0;ae.length?this.clone().ixor(e):e.clone().ixor(this)},BN.prototype.uxor=function uxor(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},BN.prototype.inotn=function inotn(e){assert("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),r=e%26;this._expand(t),r>0&&t--;for(var a=0;a0&&(this.words[a]=~this.words[a]&67108863>>26-r),this._strip()},BN.prototype.notn=function notn(e){return this.clone().inotn(e)},BN.prototype.setn=function setn(e,t){assert("number"==typeof e&&e>=0);var r=e/26|0,a=e%26;return this._expand(r+1),this.words[r]=t?this.words[r]|1<e.length?(r=this,a=e):(r=e,a=this);for(var n=0,o=0;o>>26;for(;0!==n&&o>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;oe.length?this.clone().iadd(e):e.clone().iadd(this)},BN.prototype.isub=function isub(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var r,a,n=this.cmp(e);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,a=e):(r=e,a=this);for(var o=0,s=0;s>26,this.words[s]=67108863&t;for(;0!==o&&s>26,this.words[s]=67108863&t;if(0===o&&s>>13,g=0|s[1],p=8191&g,B=g>>>13,m=0|s[2],I=8191&m,y=m>>>13,v=0|s[3],x=8191&v,C=v>>>13,Q=0|s[4],w=8191&Q,_=Q>>>13,k=0|s[5],N=8191&k,D=k>>>13,U=0|s[6],G=8191&U,T=U>>>13,L=0|s[7],P=8191&L,q=L>>>13,O=0|s[8],H=8191&O,Y=O>>>13,j=0|s[9],J=8191&j,z=j>>>13,W=0|c[0],V=8191&W,X=W>>>13,$=0|c[1],et=8191&$,tt=$>>>13,rt=0|c[2],at=8191&rt,it=rt>>>13,nt=0|c[3],ot=8191&nt,At=nt>>>13,st=0|c[4],ct=8191&st,dt=st>>>13,ut=0|c[5],ht=8191&ut,bt=ut>>>13,pt=0|c[6],Bt=8191&pt,mt=pt>>>13,It=0|c[7],Et=8191&It,yt=It>>>13,vt=0|c[8],xt=8191&vt,Ct=vt>>>13,Qt=0|c[9],wt=8191&Qt,Mt=Qt>>>13;r.negative=e.negative^t.negative,r.length=19;var _t=(u+(a=Math.imul(l,V))|0)+((8191&(n=(n=Math.imul(l,X))+Math.imul(b,V)|0))<<13)|0;u=((o=Math.imul(b,X))+(n>>>13)|0)+(_t>>>26)|0,_t&=67108863,a=Math.imul(p,V),n=(n=Math.imul(p,X))+Math.imul(B,V)|0,o=Math.imul(B,X);var kt=(u+(a=a+Math.imul(l,et)|0)|0)+((8191&(n=(n=n+Math.imul(l,tt)|0)+Math.imul(b,et)|0))<<13)|0;u=((o=o+Math.imul(b,tt)|0)+(n>>>13)|0)+(kt>>>26)|0,kt&=67108863,a=Math.imul(I,V),n=(n=Math.imul(I,X))+Math.imul(y,V)|0,o=Math.imul(y,X),a=a+Math.imul(p,et)|0,n=(n=n+Math.imul(p,tt)|0)+Math.imul(B,et)|0,o=o+Math.imul(B,tt)|0;var St=(u+(a=a+Math.imul(l,at)|0)|0)+((8191&(n=(n=n+Math.imul(l,it)|0)+Math.imul(b,at)|0))<<13)|0;u=((o=o+Math.imul(b,it)|0)+(n>>>13)|0)+(St>>>26)|0,St&=67108863,a=Math.imul(x,V),n=(n=Math.imul(x,X))+Math.imul(C,V)|0,o=Math.imul(C,X),a=a+Math.imul(I,et)|0,n=(n=n+Math.imul(I,tt)|0)+Math.imul(y,et)|0,o=o+Math.imul(y,tt)|0,a=a+Math.imul(p,at)|0,n=(n=n+Math.imul(p,it)|0)+Math.imul(B,at)|0,o=o+Math.imul(B,it)|0;var Nt=(u+(a=a+Math.imul(l,ot)|0)|0)+((8191&(n=(n=n+Math.imul(l,At)|0)+Math.imul(b,ot)|0))<<13)|0;u=((o=o+Math.imul(b,At)|0)+(n>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,a=Math.imul(w,V),n=(n=Math.imul(w,X))+Math.imul(_,V)|0,o=Math.imul(_,X),a=a+Math.imul(x,et)|0,n=(n=n+Math.imul(x,tt)|0)+Math.imul(C,et)|0,o=o+Math.imul(C,tt)|0,a=a+Math.imul(I,at)|0,n=(n=n+Math.imul(I,it)|0)+Math.imul(y,at)|0,o=o+Math.imul(y,it)|0,a=a+Math.imul(p,ot)|0,n=(n=n+Math.imul(p,At)|0)+Math.imul(B,ot)|0,o=o+Math.imul(B,At)|0;var Dt=(u+(a=a+Math.imul(l,ct)|0)|0)+((8191&(n=(n=n+Math.imul(l,dt)|0)+Math.imul(b,ct)|0))<<13)|0;u=((o=o+Math.imul(b,dt)|0)+(n>>>13)|0)+(Dt>>>26)|0,Dt&=67108863,a=Math.imul(N,V),n=(n=Math.imul(N,X))+Math.imul(D,V)|0,o=Math.imul(D,X),a=a+Math.imul(w,et)|0,n=(n=n+Math.imul(w,tt)|0)+Math.imul(_,et)|0,o=o+Math.imul(_,tt)|0,a=a+Math.imul(x,at)|0,n=(n=n+Math.imul(x,it)|0)+Math.imul(C,at)|0,o=o+Math.imul(C,it)|0,a=a+Math.imul(I,ot)|0,n=(n=n+Math.imul(I,At)|0)+Math.imul(y,ot)|0,o=o+Math.imul(y,At)|0,a=a+Math.imul(p,ct)|0,n=(n=n+Math.imul(p,dt)|0)+Math.imul(B,ct)|0,o=o+Math.imul(B,dt)|0;var Rt=(u+(a=a+Math.imul(l,ht)|0)|0)+((8191&(n=(n=n+Math.imul(l,bt)|0)+Math.imul(b,ht)|0))<<13)|0;u=((o=o+Math.imul(b,bt)|0)+(n>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,a=Math.imul(G,V),n=(n=Math.imul(G,X))+Math.imul(T,V)|0,o=Math.imul(T,X),a=a+Math.imul(N,et)|0,n=(n=n+Math.imul(N,tt)|0)+Math.imul(D,et)|0,o=o+Math.imul(D,tt)|0,a=a+Math.imul(w,at)|0,n=(n=n+Math.imul(w,it)|0)+Math.imul(_,at)|0,o=o+Math.imul(_,it)|0,a=a+Math.imul(x,ot)|0,n=(n=n+Math.imul(x,At)|0)+Math.imul(C,ot)|0,o=o+Math.imul(C,At)|0,a=a+Math.imul(I,ct)|0,n=(n=n+Math.imul(I,dt)|0)+Math.imul(y,ct)|0,o=o+Math.imul(y,dt)|0,a=a+Math.imul(p,ht)|0,n=(n=n+Math.imul(p,bt)|0)+Math.imul(B,ht)|0,o=o+Math.imul(B,bt)|0;var Ft=(u+(a=a+Math.imul(l,Bt)|0)|0)+((8191&(n=(n=n+Math.imul(l,mt)|0)+Math.imul(b,Bt)|0))<<13)|0;u=((o=o+Math.imul(b,mt)|0)+(n>>>13)|0)+(Ft>>>26)|0,Ft&=67108863,a=Math.imul(P,V),n=(n=Math.imul(P,X))+Math.imul(q,V)|0,o=Math.imul(q,X),a=a+Math.imul(G,et)|0,n=(n=n+Math.imul(G,tt)|0)+Math.imul(T,et)|0,o=o+Math.imul(T,tt)|0,a=a+Math.imul(N,at)|0,n=(n=n+Math.imul(N,it)|0)+Math.imul(D,at)|0,o=o+Math.imul(D,it)|0,a=a+Math.imul(w,ot)|0,n=(n=n+Math.imul(w,At)|0)+Math.imul(_,ot)|0,o=o+Math.imul(_,At)|0,a=a+Math.imul(x,ct)|0,n=(n=n+Math.imul(x,dt)|0)+Math.imul(C,ct)|0,o=o+Math.imul(C,dt)|0,a=a+Math.imul(I,ht)|0,n=(n=n+Math.imul(I,bt)|0)+Math.imul(y,ht)|0,o=o+Math.imul(y,bt)|0,a=a+Math.imul(p,Bt)|0,n=(n=n+Math.imul(p,mt)|0)+Math.imul(B,Bt)|0,o=o+Math.imul(B,mt)|0;var Ut=(u+(a=a+Math.imul(l,Et)|0)|0)+((8191&(n=(n=n+Math.imul(l,yt)|0)+Math.imul(b,Et)|0))<<13)|0;u=((o=o+Math.imul(b,yt)|0)+(n>>>13)|0)+(Ut>>>26)|0,Ut&=67108863,a=Math.imul(H,V),n=(n=Math.imul(H,X))+Math.imul(Y,V)|0,o=Math.imul(Y,X),a=a+Math.imul(P,et)|0,n=(n=n+Math.imul(P,tt)|0)+Math.imul(q,et)|0,o=o+Math.imul(q,tt)|0,a=a+Math.imul(G,at)|0,n=(n=n+Math.imul(G,it)|0)+Math.imul(T,at)|0,o=o+Math.imul(T,it)|0,a=a+Math.imul(N,ot)|0,n=(n=n+Math.imul(N,At)|0)+Math.imul(D,ot)|0,o=o+Math.imul(D,At)|0,a=a+Math.imul(w,ct)|0,n=(n=n+Math.imul(w,dt)|0)+Math.imul(_,ct)|0,o=o+Math.imul(_,dt)|0,a=a+Math.imul(x,ht)|0,n=(n=n+Math.imul(x,bt)|0)+Math.imul(C,ht)|0,o=o+Math.imul(C,bt)|0,a=a+Math.imul(I,Bt)|0,n=(n=n+Math.imul(I,mt)|0)+Math.imul(y,Bt)|0,o=o+Math.imul(y,mt)|0,a=a+Math.imul(p,Et)|0,n=(n=n+Math.imul(p,yt)|0)+Math.imul(B,Et)|0,o=o+Math.imul(B,yt)|0;var Gt=(u+(a=a+Math.imul(l,xt)|0)|0)+((8191&(n=(n=n+Math.imul(l,Ct)|0)+Math.imul(b,xt)|0))<<13)|0;u=((o=o+Math.imul(b,Ct)|0)+(n>>>13)|0)+(Gt>>>26)|0,Gt&=67108863,a=Math.imul(J,V),n=(n=Math.imul(J,X))+Math.imul(z,V)|0,o=Math.imul(z,X),a=a+Math.imul(H,et)|0,n=(n=n+Math.imul(H,tt)|0)+Math.imul(Y,et)|0,o=o+Math.imul(Y,tt)|0,a=a+Math.imul(P,at)|0,n=(n=n+Math.imul(P,it)|0)+Math.imul(q,at)|0,o=o+Math.imul(q,it)|0,a=a+Math.imul(G,ot)|0,n=(n=n+Math.imul(G,At)|0)+Math.imul(T,ot)|0,o=o+Math.imul(T,At)|0,a=a+Math.imul(N,ct)|0,n=(n=n+Math.imul(N,dt)|0)+Math.imul(D,ct)|0,o=o+Math.imul(D,dt)|0,a=a+Math.imul(w,ht)|0,n=(n=n+Math.imul(w,bt)|0)+Math.imul(_,ht)|0,o=o+Math.imul(_,bt)|0,a=a+Math.imul(x,Bt)|0,n=(n=n+Math.imul(x,mt)|0)+Math.imul(C,Bt)|0,o=o+Math.imul(C,mt)|0,a=a+Math.imul(I,Et)|0,n=(n=n+Math.imul(I,yt)|0)+Math.imul(y,Et)|0,o=o+Math.imul(y,yt)|0,a=a+Math.imul(p,xt)|0,n=(n=n+Math.imul(p,Ct)|0)+Math.imul(B,xt)|0,o=o+Math.imul(B,Ct)|0;var Tt=(u+(a=a+Math.imul(l,wt)|0)|0)+((8191&(n=(n=n+Math.imul(l,Mt)|0)+Math.imul(b,wt)|0))<<13)|0;u=((o=o+Math.imul(b,Mt)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,a=Math.imul(J,et),n=(n=Math.imul(J,tt))+Math.imul(z,et)|0,o=Math.imul(z,tt),a=a+Math.imul(H,at)|0,n=(n=n+Math.imul(H,it)|0)+Math.imul(Y,at)|0,o=o+Math.imul(Y,it)|0,a=a+Math.imul(P,ot)|0,n=(n=n+Math.imul(P,At)|0)+Math.imul(q,ot)|0,o=o+Math.imul(q,At)|0,a=a+Math.imul(G,ct)|0,n=(n=n+Math.imul(G,dt)|0)+Math.imul(T,ct)|0,o=o+Math.imul(T,dt)|0,a=a+Math.imul(N,ht)|0,n=(n=n+Math.imul(N,bt)|0)+Math.imul(D,ht)|0,o=o+Math.imul(D,bt)|0,a=a+Math.imul(w,Bt)|0,n=(n=n+Math.imul(w,mt)|0)+Math.imul(_,Bt)|0,o=o+Math.imul(_,mt)|0,a=a+Math.imul(x,Et)|0,n=(n=n+Math.imul(x,yt)|0)+Math.imul(C,Et)|0,o=o+Math.imul(C,yt)|0,a=a+Math.imul(I,xt)|0,n=(n=n+Math.imul(I,Ct)|0)+Math.imul(y,xt)|0,o=o+Math.imul(y,Ct)|0;var Lt=(u+(a=a+Math.imul(p,wt)|0)|0)+((8191&(n=(n=n+Math.imul(p,Mt)|0)+Math.imul(B,wt)|0))<<13)|0;u=((o=o+Math.imul(B,Mt)|0)+(n>>>13)|0)+(Lt>>>26)|0,Lt&=67108863,a=Math.imul(J,at),n=(n=Math.imul(J,it))+Math.imul(z,at)|0,o=Math.imul(z,it),a=a+Math.imul(H,ot)|0,n=(n=n+Math.imul(H,At)|0)+Math.imul(Y,ot)|0,o=o+Math.imul(Y,At)|0,a=a+Math.imul(P,ct)|0,n=(n=n+Math.imul(P,dt)|0)+Math.imul(q,ct)|0,o=o+Math.imul(q,dt)|0,a=a+Math.imul(G,ht)|0,n=(n=n+Math.imul(G,bt)|0)+Math.imul(T,ht)|0,o=o+Math.imul(T,bt)|0,a=a+Math.imul(N,Bt)|0,n=(n=n+Math.imul(N,mt)|0)+Math.imul(D,Bt)|0,o=o+Math.imul(D,mt)|0,a=a+Math.imul(w,Et)|0,n=(n=n+Math.imul(w,yt)|0)+Math.imul(_,Et)|0,o=o+Math.imul(_,yt)|0,a=a+Math.imul(x,xt)|0,n=(n=n+Math.imul(x,Ct)|0)+Math.imul(C,xt)|0,o=o+Math.imul(C,Ct)|0;var Pt=(u+(a=a+Math.imul(I,wt)|0)|0)+((8191&(n=(n=n+Math.imul(I,Mt)|0)+Math.imul(y,wt)|0))<<13)|0;u=((o=o+Math.imul(y,Mt)|0)+(n>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,a=Math.imul(J,ot),n=(n=Math.imul(J,At))+Math.imul(z,ot)|0,o=Math.imul(z,At),a=a+Math.imul(H,ct)|0,n=(n=n+Math.imul(H,dt)|0)+Math.imul(Y,ct)|0,o=o+Math.imul(Y,dt)|0,a=a+Math.imul(P,ht)|0,n=(n=n+Math.imul(P,bt)|0)+Math.imul(q,ht)|0,o=o+Math.imul(q,bt)|0,a=a+Math.imul(G,Bt)|0,n=(n=n+Math.imul(G,mt)|0)+Math.imul(T,Bt)|0,o=o+Math.imul(T,mt)|0,a=a+Math.imul(N,Et)|0,n=(n=n+Math.imul(N,yt)|0)+Math.imul(D,Et)|0,o=o+Math.imul(D,yt)|0,a=a+Math.imul(w,xt)|0,n=(n=n+Math.imul(w,Ct)|0)+Math.imul(_,xt)|0,o=o+Math.imul(_,Ct)|0;var qt=(u+(a=a+Math.imul(x,wt)|0)|0)+((8191&(n=(n=n+Math.imul(x,Mt)|0)+Math.imul(C,wt)|0))<<13)|0;u=((o=o+Math.imul(C,Mt)|0)+(n>>>13)|0)+(qt>>>26)|0,qt&=67108863,a=Math.imul(J,ct),n=(n=Math.imul(J,dt))+Math.imul(z,ct)|0,o=Math.imul(z,dt),a=a+Math.imul(H,ht)|0,n=(n=n+Math.imul(H,bt)|0)+Math.imul(Y,ht)|0,o=o+Math.imul(Y,bt)|0,a=a+Math.imul(P,Bt)|0,n=(n=n+Math.imul(P,mt)|0)+Math.imul(q,Bt)|0,o=o+Math.imul(q,mt)|0,a=a+Math.imul(G,Et)|0,n=(n=n+Math.imul(G,yt)|0)+Math.imul(T,Et)|0,o=o+Math.imul(T,yt)|0,a=a+Math.imul(N,xt)|0,n=(n=n+Math.imul(N,Ct)|0)+Math.imul(D,xt)|0,o=o+Math.imul(D,Ct)|0;var Ot=(u+(a=a+Math.imul(w,wt)|0)|0)+((8191&(n=(n=n+Math.imul(w,Mt)|0)+Math.imul(_,wt)|0))<<13)|0;u=((o=o+Math.imul(_,Mt)|0)+(n>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,a=Math.imul(J,ht),n=(n=Math.imul(J,bt))+Math.imul(z,ht)|0,o=Math.imul(z,bt),a=a+Math.imul(H,Bt)|0,n=(n=n+Math.imul(H,mt)|0)+Math.imul(Y,Bt)|0,o=o+Math.imul(Y,mt)|0,a=a+Math.imul(P,Et)|0,n=(n=n+Math.imul(P,yt)|0)+Math.imul(q,Et)|0,o=o+Math.imul(q,yt)|0,a=a+Math.imul(G,xt)|0,n=(n=n+Math.imul(G,Ct)|0)+Math.imul(T,xt)|0,o=o+Math.imul(T,Ct)|0;var Ht=(u+(a=a+Math.imul(N,wt)|0)|0)+((8191&(n=(n=n+Math.imul(N,Mt)|0)+Math.imul(D,wt)|0))<<13)|0;u=((o=o+Math.imul(D,Mt)|0)+(n>>>13)|0)+(Ht>>>26)|0,Ht&=67108863,a=Math.imul(J,Bt),n=(n=Math.imul(J,mt))+Math.imul(z,Bt)|0,o=Math.imul(z,mt),a=a+Math.imul(H,Et)|0,n=(n=n+Math.imul(H,yt)|0)+Math.imul(Y,Et)|0,o=o+Math.imul(Y,yt)|0,a=a+Math.imul(P,xt)|0,n=(n=n+Math.imul(P,Ct)|0)+Math.imul(q,xt)|0,o=o+Math.imul(q,Ct)|0;var Yt=(u+(a=a+Math.imul(G,wt)|0)|0)+((8191&(n=(n=n+Math.imul(G,Mt)|0)+Math.imul(T,wt)|0))<<13)|0;u=((o=o+Math.imul(T,Mt)|0)+(n>>>13)|0)+(Yt>>>26)|0,Yt&=67108863,a=Math.imul(J,Et),n=(n=Math.imul(J,yt))+Math.imul(z,Et)|0,o=Math.imul(z,yt),a=a+Math.imul(H,xt)|0,n=(n=n+Math.imul(H,Ct)|0)+Math.imul(Y,xt)|0,o=o+Math.imul(Y,Ct)|0;var jt=(u+(a=a+Math.imul(P,wt)|0)|0)+((8191&(n=(n=n+Math.imul(P,Mt)|0)+Math.imul(q,wt)|0))<<13)|0;u=((o=o+Math.imul(q,Mt)|0)+(n>>>13)|0)+(jt>>>26)|0,jt&=67108863,a=Math.imul(J,xt),n=(n=Math.imul(J,Ct))+Math.imul(z,xt)|0,o=Math.imul(z,Ct);var Jt=(u+(a=a+Math.imul(H,wt)|0)|0)+((8191&(n=(n=n+Math.imul(H,Mt)|0)+Math.imul(Y,wt)|0))<<13)|0;u=((o=o+Math.imul(Y,Mt)|0)+(n>>>13)|0)+(Jt>>>26)|0,Jt&=67108863;var Kt=(u+(a=Math.imul(J,wt))|0)+((8191&(n=(n=Math.imul(J,Mt))+Math.imul(z,wt)|0))<<13)|0;return u=((o=Math.imul(z,Mt))+(n>>>13)|0)+(Kt>>>26)|0,Kt&=67108863,d[0]=_t,d[1]=kt,d[2]=St,d[3]=Nt,d[4]=Dt,d[5]=Rt,d[6]=Ft,d[7]=Ut,d[8]=Gt,d[9]=Tt,d[10]=Lt,d[11]=Pt,d[12]=qt,d[13]=Ot,d[14]=Ht,d[15]=Yt,d[16]=jt,d[17]=Jt,d[18]=Kt,0!==u&&(d[19]=u,r.length++),r};function bigMulTo(e,t,r){r.negative=t.negative^e.negative,r.length=e.length+t.length;for(var a=0,n=0,o=0;o>>26)|0)>>>26,s&=67108863}r.words[o]=c,a=s,s=n}return 0!==a?r.words[o]=a:r.length--,r._strip()}function jumboMulTo(e,t,r){return bigMulTo(e,t,r)}function FFTM(e,t){this.x=e,this.y=t}Math.imul||(c=smallMulTo),BN.prototype.mulTo=function mulTo(e,t){var r=this.length+e.length;return 10===this.length&&10===e.length?c(this,e,t):r<63?smallMulTo(this,e,t):r<1024?bigMulTo(this,e,t):jumboMulTo(this,e,t)},FFTM.prototype.makeRBT=function makeRBT(e){for(var t=new Array(e),r=BN.prototype._countBits(e)-1,a=0;a>=1;return a},FFTM.prototype.permute=function permute(e,t,r,a,n,o){for(var s=0;s>>=1)n++;return 1<>>=13,r[2*o+1]=8191&n,n>>>=13;for(o=2*t;o>=26,r+=n/67108864|0,r+=o>>>26,this.words[a]=67108863&o}return 0!==r&&(this.words[a]=r,this.length++),t?this.ineg():this},BN.prototype.muln=function muln(e){return this.clone().imuln(e)},BN.prototype.sqr=function sqr(){return this.mul(this)},BN.prototype.isqr=function isqr(){return this.imul(this.clone())},BN.prototype.pow=function pow(e){var t=function toBitArray(e){for(var t=new Array(e.bitLength()),r=0;r>>n&1}return t}(e);if(0===t.length)return new BN(1);for(var r=this,a=0;a=0);var t,r=e%26,a=(e-r)/26,n=67108863>>>26-r<<26-r;if(0!==r){var o=0;for(t=0;t>>26-r}o&&(this.words[t]=o,this.length++)}if(0!==a){for(t=this.length-1;t>=0;t--)this.words[t+a]=this.words[t];for(t=0;t=0),a=t?(t-t%26)/26:0;var n=e%26,o=Math.min((e-n)/26,this.length),s=67108863^67108863>>>n<o)for(this.length-=o,d=0;d=0&&(0!==u||d>=a);d--){var h=0|this.words[d];this.words[d]=u<<26-n|h>>>n,u=h&s}return c&&0!==u&&(c.words[c.length++]=u),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},BN.prototype.ishrn=function ishrn(e,t,r){return assert(0===this.negative),this.iushrn(e,t,r)},BN.prototype.shln=function shln(e){return this.clone().ishln(e)},BN.prototype.ushln=function ushln(e){return this.clone().iushln(e)},BN.prototype.shrn=function shrn(e){return this.clone().ishrn(e)},BN.prototype.ushrn=function ushrn(e){return this.clone().iushrn(e)},BN.prototype.testn=function testn(e){assert("number"==typeof e&&e>=0);var t=e%26,r=(e-t)/26,a=1<=0);var t=e%26,r=(e-t)/26;if(assert(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==t&&r++,this.length=Math.min(r,this.length),0!==t){var a=67108863^67108863>>>t<=67108864;t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},BN.prototype.isubn=function isubn(e){if(assert("number"==typeof e),assert(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t>26)-(c/67108864|0),this.words[a+r]=67108863&n}for(;a>26,this.words[a+r]=67108863&n;if(0===s)return this._strip();for(assert(-1===s),s=0,a=0;a>26,this.words[a]=67108863&n;return this.negative=1,this._strip()},BN.prototype._wordDiv=function _wordDiv(e,t){var r=(this.length,e.length),a=this.clone(),n=e,o=0|n.words[n.length-1];0!==(r=26-this._countBits(o))&&(n=n.ushln(r),a.iushln(r),o=0|n.words[n.length-1]);var s,c=a.length-n.length;if("mod"!==t){(s=new BN(null)).length=c+1,s.words=new Array(s.length);for(var d=0;d=0;h--){var l=67108864*(0|a.words[n.length+h])+(0|a.words[n.length+h-1]);for(l=Math.min(l/o|0,67108863),a._ishlnsubmul(n,l,h);0!==a.negative;)l--,a.negative=0,a._ishlnsubmul(n,1,h),a.isZero()||(a.negative^=1);s&&(s.words[h]=l)}return s&&s._strip(),a._strip(),"div"!==t&&0!==r&&a.iushrn(r),{div:s||null,mod:a}},BN.prototype.divmod=function divmod(e,t,r){return assert(!e.isZero()),this.isZero()?{div:new BN(0),mod:new BN(0)}:0!==this.negative&&0===e.negative?(o=this.neg().divmod(e,t),"mod"!==t&&(a=o.div.neg()),"div"!==t&&(n=o.mod.neg(),r&&0!==n.negative&&n.iadd(e)),{div:a,mod:n}):0===this.negative&&0!==e.negative?(o=this.divmod(e.neg(),t),"mod"!==t&&(a=o.div.neg()),{div:a,mod:o.mod}):0!=(this.negative&e.negative)?(o=this.neg().divmod(e.neg(),t),"div"!==t&&(n=o.mod.neg(),r&&0!==n.negative&&n.isub(e)),{div:o.div,mod:n}):e.length>this.length||this.cmp(e)<0?{div:new BN(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new BN(this.modrn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new BN(this.modrn(e.words[0]))}:this._wordDiv(e,t);var a,n,o},BN.prototype.div=function div(e){return this.divmod(e,"div",!1).div},BN.prototype.mod=function mod(e){return this.divmod(e,"mod",!1).mod},BN.prototype.umod=function umod(e){return this.divmod(e,"mod",!0).mod},BN.prototype.divRound=function divRound(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var r=0!==t.div.negative?t.mod.isub(e):t.mod,a=e.ushrn(1),n=e.andln(1),o=r.cmp(a);return o<0||1===n&&0===o?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},BN.prototype.modrn=function modrn(e){var t=e<0;t&&(e=-e),assert(e<=67108863);for(var r=(1<<26)%e,a=0,n=this.length-1;n>=0;n--)a=(r*a+(0|this.words[n]))%e;return t?-a:a},BN.prototype.modn=function modn(e){return this.modrn(e)},BN.prototype.idivn=function idivn(e){var t=e<0;t&&(e=-e),assert(e<=67108863);for(var r=0,a=this.length-1;a>=0;a--){var n=(0|this.words[a])+67108864*r;this.words[a]=n/e|0,r=n%e}return this._strip(),t?this.ineg():this},BN.prototype.divn=function divn(e){return this.clone().idivn(e)},BN.prototype.egcd=function egcd(e){assert(0===e.negative),assert(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var a=new BN(1),n=new BN(0),o=new BN(0),s=new BN(1),c=0;t.isEven()&&r.isEven();)t.iushrn(1),r.iushrn(1),++c;for(var d=r.clone(),u=t.clone();!t.isZero();){for(var h=0,l=1;0==(t.words[0]&l)&&h<26;++h,l<<=1);if(h>0)for(t.iushrn(h);h-- >0;)(a.isOdd()||n.isOdd())&&(a.iadd(d),n.isub(u)),a.iushrn(1),n.iushrn(1);for(var b=0,g=1;0==(r.words[0]&g)&&b<26;++b,g<<=1);if(b>0)for(r.iushrn(b);b-- >0;)(o.isOdd()||s.isOdd())&&(o.iadd(d),s.isub(u)),o.iushrn(1),s.iushrn(1);t.cmp(r)>=0?(t.isub(r),a.isub(o),n.isub(s)):(r.isub(t),o.isub(a),s.isub(n))}return{a:o,b:s,gcd:r.iushln(c)}},BN.prototype._invmp=function _invmp(e){assert(0===e.negative),assert(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var a,n=new BN(1),o=new BN(0),s=r.clone();t.cmpn(1)>0&&r.cmpn(1)>0;){for(var c=0,d=1;0==(t.words[0]&d)&&c<26;++c,d<<=1);if(c>0)for(t.iushrn(c);c-- >0;)n.isOdd()&&n.iadd(s),n.iushrn(1);for(var u=0,h=1;0==(r.words[0]&h)&&u<26;++u,h<<=1);if(u>0)for(r.iushrn(u);u-- >0;)o.isOdd()&&o.iadd(s),o.iushrn(1);t.cmp(r)>=0?(t.isub(r),n.isub(o)):(r.isub(t),o.isub(n))}return(a=0===t.cmpn(1)?n:o).cmpn(0)<0&&a.iadd(e),a},BN.prototype.gcd=function gcd(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),r=e.clone();t.negative=0,r.negative=0;for(var a=0;t.isEven()&&r.isEven();a++)t.iushrn(1),r.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=t.cmp(r);if(n<0){var o=t;t=r,r=o}else if(0===n||0===r.cmpn(1))break;t.isub(r)}return r.iushln(a)},BN.prototype.invm=function invm(e){return this.egcd(e).a.umod(e)},BN.prototype.isEven=function isEven(){return 0==(1&this.words[0])},BN.prototype.isOdd=function isOdd(){return 1==(1&this.words[0])},BN.prototype.andln=function andln(e){return this.words[0]&e},BN.prototype.bincn=function bincn(e){assert("number"==typeof e);var t=e%26,r=(e-t)/26,a=1<>>26,s&=67108863,this.words[o]=s}return 0!==n&&(this.words[o]=n,this.length++),this},BN.prototype.isZero=function isZero(){return 1===this.length&&0===this.words[0]},BN.prototype.cmpn=function cmpn(e){var t,r=e<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this._strip(),this.length>1)t=1;else{r&&(e=-e),assert(e<=67108863,"Number is too big");var a=0|this.words[0];t=a===e?0:ae.length)return 1;if(this.length=0;r--){var a=0|this.words[r],n=0|e.words[r];if(a!==n){an&&(t=1);break}}return t},BN.prototype.gtn=function gtn(e){return 1===this.cmpn(e)},BN.prototype.gt=function gt(e){return 1===this.cmp(e)},BN.prototype.gten=function gten(e){return this.cmpn(e)>=0},BN.prototype.gte=function gte(e){return this.cmp(e)>=0},BN.prototype.ltn=function ltn(e){return-1===this.cmpn(e)},BN.prototype.lt=function lt(e){return-1===this.cmp(e)},BN.prototype.lten=function lten(e){return this.cmpn(e)<=0},BN.prototype.lte=function lte(e){return this.cmp(e)<=0},BN.prototype.eqn=function eqn(e){return 0===this.cmpn(e)},BN.prototype.eq=function eq(e){return 0===this.cmp(e)},BN.red=function red(e){return new Red(e)},BN.prototype.toRed=function toRed(e){return assert(!this.red,"Already a number in reduction context"),assert(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},BN.prototype.fromRed=function fromRed(){return assert(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},BN.prototype._forceRed=function _forceRed(e){return this.red=e,this},BN.prototype.forceRed=function forceRed(e){return assert(!this.red,"Already a number in reduction context"),this._forceRed(e)},BN.prototype.redAdd=function redAdd(e){return assert(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},BN.prototype.redIAdd=function redIAdd(e){return assert(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},BN.prototype.redSub=function redSub(e){return assert(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},BN.prototype.redISub=function redISub(e){return assert(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},BN.prototype.redShl=function redShl(e){return assert(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},BN.prototype.redMul=function redMul(e){return assert(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},BN.prototype.redIMul=function redIMul(e){return assert(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},BN.prototype.redSqr=function redSqr(){return assert(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},BN.prototype.redISqr=function redISqr(){return assert(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},BN.prototype.redSqrt=function redSqrt(){return assert(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},BN.prototype.redInvm=function redInvm(){return assert(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},BN.prototype.redNeg=function redNeg(){return assert(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},BN.prototype.redPow=function redPow(e){return assert(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var d={k256:null,p224:null,p192:null,p25519:null};function MPrime(e,t){this.name=e,this.p=new BN(t,16),this.n=this.p.bitLength(),this.k=new BN(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function K256(){MPrime.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function P224(){MPrime.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function P192(){MPrime.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function P25519(){MPrime.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function Red(e){if("string"==typeof e){var t=BN._prime(e);this.m=t.p,this.prime=t}else assert(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function Mont(e){Red.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new BN(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)}MPrime.prototype._tmp=function _tmp(){var e=new BN(null);return e.words=new Array(Math.ceil(this.n/13)),e},MPrime.prototype.ireduce=function ireduce(e){var t,r=e;do{this.split(r,this.tmp),t=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(t>this.n);var a=t0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},MPrime.prototype.split=function split(e,t){e.iushrn(this.n,0,t)},MPrime.prototype.imulK=function imulK(e){return e.imul(this.k)},inherits(K256,MPrime),K256.prototype.split=function split(e,t){for(var r=4194303,a=Math.min(e.length,9),n=0;n>>22,o=s}o>>>=22,e.words[n-10]=o,0===o&&e.length>10?e.length-=10:e.length-=9},K256.prototype.imulK=function imulK(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,r=0;r>>=26,e.words[r]=n,t=a}return 0!==t&&(e.words[e.length++]=t),e},BN._prime=function prime(e){if(d[e])return d[e];var prime;if("k256"===e)prime=new K256;else if("p224"===e)prime=new P224;else if("p192"===e)prime=new P192;else{if("p25519"!==e)throw new Error("Unknown prime "+e);prime=new P25519}return d[e]=prime,prime},Red.prototype._verify1=function _verify1(e){assert(0===e.negative,"red works only with positives"),assert(e.red,"red works only with red numbers")},Red.prototype._verify2=function _verify2(e,t){assert(0==(e.negative|t.negative),"red works only with positives"),assert(e.red&&e.red===t.red,"red works only with red numbers")},Red.prototype.imod=function imod(e){return this.prime?this.prime.ireduce(e)._forceRed(this):(move(e,e.umod(this.m)._forceRed(this)),e)},Red.prototype.neg=function neg(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},Red.prototype.add=function add(e,t){this._verify2(e,t);var r=e.add(t);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},Red.prototype.iadd=function iadd(e,t){this._verify2(e,t);var r=e.iadd(t);return r.cmp(this.m)>=0&&r.isub(this.m),r},Red.prototype.sub=function sub(e,t){this._verify2(e,t);var r=e.sub(t);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},Red.prototype.isub=function isub(e,t){this._verify2(e,t);var r=e.isub(t);return r.cmpn(0)<0&&r.iadd(this.m),r},Red.prototype.shl=function shl(e,t){return this._verify1(e),this.imod(e.ushln(t))},Red.prototype.imul=function imul(e,t){return this._verify2(e,t),this.imod(e.imul(t))},Red.prototype.mul=function mul(e,t){return this._verify2(e,t),this.imod(e.mul(t))},Red.prototype.isqr=function isqr(e){return this.imul(e,e.clone())},Red.prototype.sqr=function sqr(e){return this.mul(e,e)},Red.prototype.sqrt=function sqrt(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(assert(t%2==1),3===t){var r=this.m.add(new BN(1)).iushrn(2);return this.pow(e,r)}for(var a=this.m.subn(1),n=0;!a.isZero()&&0===a.andln(1);)n++,a.iushrn(1);assert(!a.isZero());var o=new BN(1).toRed(this),s=o.redNeg(),c=this.m.subn(1).iushrn(1),d=this.m.bitLength();for(d=new BN(2*d*d).toRed(this);0!==this.pow(d,c).cmp(s);)d.redIAdd(s);for(var u=this.pow(d,a),h=this.pow(e,a.addn(1).iushrn(1)),l=this.pow(e,a),b=n;0!==l.cmp(o);){for(var g=l,p=0;0!==g.cmp(o);p++)g=g.redSqr();assert(p=0;a--){for(var d=t.words[a],u=c-1;u>=0;u--){var h=d>>u&1;n!==r[0]&&(n=this.sqr(n)),0!==h||0!==o?(o<<=1,o|=h,(4===++s||0===a&&0===u)&&(n=this.mul(n,r[o]),s=0,o=0)):s=0}c=26}return n},Red.prototype.convertTo=function convertTo(e){var t=e.umod(this.m);return t===e?t.clone():t},Red.prototype.convertFrom=function convertFrom(e){var t=e.clone();return t.red=null,t},BN.mont=function mont(e){return new Mont(e)},inherits(Mont,Red),Mont.prototype.convertTo=function convertTo(e){return this.imod(e.ushln(this.shift))},Mont.prototype.convertFrom=function convertFrom(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},Mont.prototype.imul=function imul(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var r=e.imul(t),a=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(a).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},Mont.prototype.mul=function mul(e,t){if(e.isZero()||t.isZero())return new BN(0)._forceRed(this);var r=e.mul(t),a=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(a).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},Mont.prototype.invm=function invm(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(e=r.nmd(e),this)},function(e,t,r){"use strict";var a=r(3).Buffer,n=this&&this.__createBinding||(Object.create?function(e,t,r,a){void 0===a&&(a=r),Object.defineProperty(e,a,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,a){void 0===a&&(a=r),e[a]=t[r]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),s=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.hasOwnProperty.call(e,r)&&n(t,e,r);return o(t,e),t},c=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.defineProperties=void 0;var d=c(r(6)),u=s(r(87)),h=s(r(180)),l=r(71);t.defineProperties=function(e,t,r){if(e.raw=[],e._fields=[],e.toJSON=function(t){if(void 0===t&&(t=!1),t){var r={};return e._fields.forEach((function(t){r[t]="0x"+e[t].toString("hex")})),r}return l.baToJSON(e.raw)},e.serialize=function serialize(){return h.encode(e.raw)},t.forEach((function(t,r){function getter(){return e.raw[r]}function setter(n){"00"!==(n=l.toBuffer(n)).toString("hex")||t.allowZero||(n=a.allocUnsafe(0)),t.allowLess&&t.length?(n=l.unpadBuffer(n),d.default(t.length>=n.length,"The field "+t.name+" must not have more "+t.length+" bytes")):t.allowZero&&0===n.length||!t.length||d.default(t.length===n.length,"The field "+t.name+" must have byte length of "+t.length),e.raw[r]=n}e._fields.push(t.name),Object.defineProperty(e,t.name,{enumerable:!0,configurable:!0,get:getter,set:setter}),t.default&&(e[t.name]=t.default),t.alias&&Object.defineProperty(e,t.alias,{enumerable:!1,configurable:!0,set:setter,get:getter})})),r)if("string"==typeof r&&(r=a.from(u.stripHexPrefix(r),"hex")),a.isBuffer(r)&&(r=h.decode(r)),Array.isArray(r)){if(r.length>e._fields.length)throw new Error("wrong number of fields in data");r.forEach((function(t,r){e[e._fields[r]]=l.toBuffer(t)}))}else{if("object"!=typeof r)throw new Error("invalid data");var n=Object.keys(r);t.forEach((function(t){-1!==n.indexOf(t.name)&&(e[t.name]=r[t.name]),-1!==n.indexOf(t.alias)&&(e[t.alias]=r[t.alias])}))}}},function(e,t,r){"use strict";var a=this&&this.__createBinding||(Object.create?function(e,t,r,a){void 0===a&&(a=r),Object.defineProperty(e,a,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,a){void 0===a&&(a=r),e[a]=t[r]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.hasOwnProperty.call(e,r)&&a(t,e,r);return n(t,e),t},s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.rlp=t.BN=void 0;var c=s(r(127));t.BN=c.default;var d=o(r(180));t.rlp=d},function(e,t,r){!function(e,t){"use strict";function assert(e,t){if(!e)throw new Error(t||"Assertion failed")}function inherits(e,t){e.super_=t;var TempCtor=function(){};TempCtor.prototype=t.prototype,e.prototype=new TempCtor,e.prototype.constructor=e}function BN(e,t,r){if(BN.isBN(e))return e;this.negative=0,this.words=null,this.length=0,this.red=null,null!==e&&("le"!==t&&"be"!==t||(r=t,t=10),this._init(e||0,t||10,r||"be"))}var a;"object"==typeof e?e.exports=BN:t.BN=BN,BN.BN=BN,BN.wordSize=26;try{a="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:r(17).Buffer}catch(e){}function parseHex4Bits(e,t){var r=e.charCodeAt(t);return r>=48&&r<=57?r-48:r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:void assert(!1,"Invalid character in "+e)}function parseHexByte(e,t,r){var a=parseHex4Bits(e,r);return r-1>=t&&(a|=parseHex4Bits(e,r-1)<<4),a}function parseBase(e,t,r,a){for(var n=0,o=0,s=Math.min(e.length,r),c=t;c=49?d-49+10:d>=17?d-17+10:d,assert(d>=0&&o0?e:t},BN.min=function min(e,t){return e.cmp(t)<0?e:t},BN.prototype._init=function init(e,t,r){if("number"==typeof e)return this._initNumber(e,t,r);if("object"==typeof e)return this._initArray(e,t,r);"hex"===t&&(t=16),assert(t===(0|t)&&t>=2&&t<=36);var a=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&(a++,this.negative=1),a=0;a-=3)o=e[a]|e[a-1]<<8|e[a-2]<<16,this.words[n]|=o<>>26-s&67108863,(s+=24)>=26&&(s-=26,n++);else if("le"===r)for(a=0,n=0;a>>26-s&67108863,(s+=24)>=26&&(s-=26,n++);return this._strip()},BN.prototype._parseHex=function _parseHex(e,t,r){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var a=0;a=t;a-=2)n=parseHexByte(e,t,a)<=18?(o-=18,s+=1,this.words[s]|=n>>>26):o+=8;else for(a=(e.length-t)%2==0?t+1:t;a=18?(o-=18,s+=1,this.words[s]|=n>>>26):o+=8;this._strip()},BN.prototype._parseBase=function _parseBase(e,t,r){this.words=[0],this.length=1;for(var a=0,n=1;n<=67108863;n*=t)a++;a--,n=n/t|0;for(var o=e.length-r,s=o%a,c=Math.min(o,o-s)+r,d=0,u=r;u1&&0===this.words[this.length-1];)this.length--;return this._normSign()},BN.prototype._normSign=function _normSign(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for)try{BN.prototype[Symbol.for("nodejs.util.inspect.custom")]=inspect}catch(e){BN.prototype.inspect=inspect}else BN.prototype.inspect=inspect;function inspect(){return(this.red?""}var n=["","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"],o=[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],s=[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];BN.prototype.toString=function toString(e,t){var r;if(t=0|t||1,16===(e=e||10)||"hex"===e){r="";for(var a=0,c=0,d=0;d>>24-a&16777215)||d!==this.length-1?n[6-h.length]+h+r:h+r,(a+=2)>=26&&(a-=26,d--)}for(0!==c&&(r=c.toString(16)+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(e===(0|e)&&e>=2&&e<=36){var l=o[e],b=s[e];r="";var g=this.clone();for(g.negative=0;!g.isZero();){var p=g.modrn(b).toString(e);r=(g=g.idivn(b)).isZero()?p+r:n[l-p.length]+p+r}for(this.isZero()&&(r="0"+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}assert(!1,"Base should be between 2 and 36")},BN.prototype.toNumber=function toNumber(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&assert(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},BN.prototype.toJSON=function toJSON(){return this.toString(16,2)},a&&(BN.prototype.toBuffer=function toBuffer(e,t){return this.toArrayLike(a,e,t)}),BN.prototype.toArray=function toArray(e,t){return this.toArrayLike(Array,e,t)};function smallMulTo(e,t,r){r.negative=t.negative^e.negative;var a=e.length+t.length|0;r.length=a,a=a-1|0;var n=0|e.words[0],o=0|t.words[0],s=n*o,c=67108863&s,d=s/67108864|0;r.words[0]=c;for(var u=1;u>>26,l=67108863&d,b=Math.min(u,t.length-1),g=Math.max(0,u-e.length+1);g<=b;g++){var p=u-g|0;h+=(s=(n=0|e.words[p])*(o=0|t.words[g])+l)/67108864|0,l=67108863&s}r.words[u]=0|l,d=0|h}return 0!==d?r.words[u]=0|d:r.length--,r._strip()}BN.prototype.toArrayLike=function toArrayLike(e,t,r){this._strip();var a=this.byteLength(),n=r||Math.max(1,a);assert(a<=n,"byte array longer than desired length"),assert(n>0,"Requested array length <= 0");var o=function allocate(e,t){return e.allocUnsafe?e.allocUnsafe(t):new e(t)}(e,n);return this["_toArrayLike"+("le"===t?"LE":"BE")](o,a),o},BN.prototype._toArrayLikeLE=function _toArrayLikeLE(e,t){for(var r=0,a=0,n=0,o=0;n>8&255),r>16&255),6===o?(r>24&255),a=0,o=0):(a=s>>>24,o+=2)}if(r=0&&(e[r--]=s>>8&255),r>=0&&(e[r--]=s>>16&255),6===o?(r>=0&&(e[r--]=s>>24&255),a=0,o=0):(a=s>>>24,o+=2)}if(r>=0)for(e[r--]=a;r>=0;)e[r--]=0},Math.clz32?BN.prototype._countBits=function _countBits(e){return 32-Math.clz32(e)}:BN.prototype._countBits=function _countBits(e){var t=e,r=0;return t>=4096&&(r+=13,t>>>=13),t>=64&&(r+=7,t>>>=7),t>=8&&(r+=4,t>>>=4),t>=2&&(r+=2,t>>>=2),r+t},BN.prototype._zeroBits=function _zeroBits(e){if(0===e)return 26;var t=e,r=0;return 0==(8191&t)&&(r+=13,t>>>=13),0==(127&t)&&(r+=7,t>>>=7),0==(15&t)&&(r+=4,t>>>=4),0==(3&t)&&(r+=2,t>>>=2),0==(1&t)&&r++,r},BN.prototype.bitLength=function bitLength(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},BN.prototype.zeroBits=function zeroBits(){if(this.isZero())return 0;for(var e=0,t=0;te.length?this.clone().ior(e):e.clone().ior(this)},BN.prototype.uor=function uor(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},BN.prototype.iuand=function iuand(e){var t;t=this.length>e.length?e:this;for(var r=0;re.length?this.clone().iand(e):e.clone().iand(this)},BN.prototype.uand=function uand(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},BN.prototype.iuxor=function iuxor(e){var t,r;this.length>e.length?(t=this,r=e):(t=e,r=this);for(var a=0;ae.length?this.clone().ixor(e):e.clone().ixor(this)},BN.prototype.uxor=function uxor(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},BN.prototype.inotn=function inotn(e){assert("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),r=e%26;this._expand(t),r>0&&t--;for(var a=0;a0&&(this.words[a]=~this.words[a]&67108863>>26-r),this._strip()},BN.prototype.notn=function notn(e){return this.clone().inotn(e)},BN.prototype.setn=function setn(e,t){assert("number"==typeof e&&e>=0);var r=e/26|0,a=e%26;return this._expand(r+1),this.words[r]=t?this.words[r]|1<e.length?(r=this,a=e):(r=e,a=this);for(var n=0,o=0;o>>26;for(;0!==n&&o>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;oe.length?this.clone().iadd(e):e.clone().iadd(this)},BN.prototype.isub=function isub(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var r,a,n=this.cmp(e);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,a=e):(r=e,a=this);for(var o=0,s=0;s>26,this.words[s]=67108863&t;for(;0!==o&&s>26,this.words[s]=67108863&t;if(0===o&&s>>13,g=0|s[1],p=8191&g,B=g>>>13,m=0|s[2],I=8191&m,y=m>>>13,v=0|s[3],x=8191&v,C=v>>>13,Q=0|s[4],w=8191&Q,_=Q>>>13,k=0|s[5],N=8191&k,D=k>>>13,U=0|s[6],G=8191&U,T=U>>>13,L=0|s[7],P=8191&L,q=L>>>13,O=0|s[8],H=8191&O,Y=O>>>13,j=0|s[9],J=8191&j,z=j>>>13,W=0|c[0],V=8191&W,X=W>>>13,$=0|c[1],et=8191&$,tt=$>>>13,rt=0|c[2],at=8191&rt,it=rt>>>13,nt=0|c[3],ot=8191&nt,At=nt>>>13,st=0|c[4],ct=8191&st,dt=st>>>13,ut=0|c[5],ht=8191&ut,bt=ut>>>13,pt=0|c[6],Bt=8191&pt,mt=pt>>>13,It=0|c[7],Et=8191&It,yt=It>>>13,vt=0|c[8],xt=8191&vt,Ct=vt>>>13,Qt=0|c[9],wt=8191&Qt,Mt=Qt>>>13;r.negative=e.negative^t.negative,r.length=19;var _t=(u+(a=Math.imul(l,V))|0)+((8191&(n=(n=Math.imul(l,X))+Math.imul(b,V)|0))<<13)|0;u=((o=Math.imul(b,X))+(n>>>13)|0)+(_t>>>26)|0,_t&=67108863,a=Math.imul(p,V),n=(n=Math.imul(p,X))+Math.imul(B,V)|0,o=Math.imul(B,X);var kt=(u+(a=a+Math.imul(l,et)|0)|0)+((8191&(n=(n=n+Math.imul(l,tt)|0)+Math.imul(b,et)|0))<<13)|0;u=((o=o+Math.imul(b,tt)|0)+(n>>>13)|0)+(kt>>>26)|0,kt&=67108863,a=Math.imul(I,V),n=(n=Math.imul(I,X))+Math.imul(y,V)|0,o=Math.imul(y,X),a=a+Math.imul(p,et)|0,n=(n=n+Math.imul(p,tt)|0)+Math.imul(B,et)|0,o=o+Math.imul(B,tt)|0;var St=(u+(a=a+Math.imul(l,at)|0)|0)+((8191&(n=(n=n+Math.imul(l,it)|0)+Math.imul(b,at)|0))<<13)|0;u=((o=o+Math.imul(b,it)|0)+(n>>>13)|0)+(St>>>26)|0,St&=67108863,a=Math.imul(x,V),n=(n=Math.imul(x,X))+Math.imul(C,V)|0,o=Math.imul(C,X),a=a+Math.imul(I,et)|0,n=(n=n+Math.imul(I,tt)|0)+Math.imul(y,et)|0,o=o+Math.imul(y,tt)|0,a=a+Math.imul(p,at)|0,n=(n=n+Math.imul(p,it)|0)+Math.imul(B,at)|0,o=o+Math.imul(B,it)|0;var Nt=(u+(a=a+Math.imul(l,ot)|0)|0)+((8191&(n=(n=n+Math.imul(l,At)|0)+Math.imul(b,ot)|0))<<13)|0;u=((o=o+Math.imul(b,At)|0)+(n>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,a=Math.imul(w,V),n=(n=Math.imul(w,X))+Math.imul(_,V)|0,o=Math.imul(_,X),a=a+Math.imul(x,et)|0,n=(n=n+Math.imul(x,tt)|0)+Math.imul(C,et)|0,o=o+Math.imul(C,tt)|0,a=a+Math.imul(I,at)|0,n=(n=n+Math.imul(I,it)|0)+Math.imul(y,at)|0,o=o+Math.imul(y,it)|0,a=a+Math.imul(p,ot)|0,n=(n=n+Math.imul(p,At)|0)+Math.imul(B,ot)|0,o=o+Math.imul(B,At)|0;var Dt=(u+(a=a+Math.imul(l,ct)|0)|0)+((8191&(n=(n=n+Math.imul(l,dt)|0)+Math.imul(b,ct)|0))<<13)|0;u=((o=o+Math.imul(b,dt)|0)+(n>>>13)|0)+(Dt>>>26)|0,Dt&=67108863,a=Math.imul(N,V),n=(n=Math.imul(N,X))+Math.imul(D,V)|0,o=Math.imul(D,X),a=a+Math.imul(w,et)|0,n=(n=n+Math.imul(w,tt)|0)+Math.imul(_,et)|0,o=o+Math.imul(_,tt)|0,a=a+Math.imul(x,at)|0,n=(n=n+Math.imul(x,it)|0)+Math.imul(C,at)|0,o=o+Math.imul(C,it)|0,a=a+Math.imul(I,ot)|0,n=(n=n+Math.imul(I,At)|0)+Math.imul(y,ot)|0,o=o+Math.imul(y,At)|0,a=a+Math.imul(p,ct)|0,n=(n=n+Math.imul(p,dt)|0)+Math.imul(B,ct)|0,o=o+Math.imul(B,dt)|0;var Rt=(u+(a=a+Math.imul(l,ht)|0)|0)+((8191&(n=(n=n+Math.imul(l,bt)|0)+Math.imul(b,ht)|0))<<13)|0;u=((o=o+Math.imul(b,bt)|0)+(n>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,a=Math.imul(G,V),n=(n=Math.imul(G,X))+Math.imul(T,V)|0,o=Math.imul(T,X),a=a+Math.imul(N,et)|0,n=(n=n+Math.imul(N,tt)|0)+Math.imul(D,et)|0,o=o+Math.imul(D,tt)|0,a=a+Math.imul(w,at)|0,n=(n=n+Math.imul(w,it)|0)+Math.imul(_,at)|0,o=o+Math.imul(_,it)|0,a=a+Math.imul(x,ot)|0,n=(n=n+Math.imul(x,At)|0)+Math.imul(C,ot)|0,o=o+Math.imul(C,At)|0,a=a+Math.imul(I,ct)|0,n=(n=n+Math.imul(I,dt)|0)+Math.imul(y,ct)|0,o=o+Math.imul(y,dt)|0,a=a+Math.imul(p,ht)|0,n=(n=n+Math.imul(p,bt)|0)+Math.imul(B,ht)|0,o=o+Math.imul(B,bt)|0;var Ft=(u+(a=a+Math.imul(l,Bt)|0)|0)+((8191&(n=(n=n+Math.imul(l,mt)|0)+Math.imul(b,Bt)|0))<<13)|0;u=((o=o+Math.imul(b,mt)|0)+(n>>>13)|0)+(Ft>>>26)|0,Ft&=67108863,a=Math.imul(P,V),n=(n=Math.imul(P,X))+Math.imul(q,V)|0,o=Math.imul(q,X),a=a+Math.imul(G,et)|0,n=(n=n+Math.imul(G,tt)|0)+Math.imul(T,et)|0,o=o+Math.imul(T,tt)|0,a=a+Math.imul(N,at)|0,n=(n=n+Math.imul(N,it)|0)+Math.imul(D,at)|0,o=o+Math.imul(D,it)|0,a=a+Math.imul(w,ot)|0,n=(n=n+Math.imul(w,At)|0)+Math.imul(_,ot)|0,o=o+Math.imul(_,At)|0,a=a+Math.imul(x,ct)|0,n=(n=n+Math.imul(x,dt)|0)+Math.imul(C,ct)|0,o=o+Math.imul(C,dt)|0,a=a+Math.imul(I,ht)|0,n=(n=n+Math.imul(I,bt)|0)+Math.imul(y,ht)|0,o=o+Math.imul(y,bt)|0,a=a+Math.imul(p,Bt)|0,n=(n=n+Math.imul(p,mt)|0)+Math.imul(B,Bt)|0,o=o+Math.imul(B,mt)|0;var Ut=(u+(a=a+Math.imul(l,Et)|0)|0)+((8191&(n=(n=n+Math.imul(l,yt)|0)+Math.imul(b,Et)|0))<<13)|0;u=((o=o+Math.imul(b,yt)|0)+(n>>>13)|0)+(Ut>>>26)|0,Ut&=67108863,a=Math.imul(H,V),n=(n=Math.imul(H,X))+Math.imul(Y,V)|0,o=Math.imul(Y,X),a=a+Math.imul(P,et)|0,n=(n=n+Math.imul(P,tt)|0)+Math.imul(q,et)|0,o=o+Math.imul(q,tt)|0,a=a+Math.imul(G,at)|0,n=(n=n+Math.imul(G,it)|0)+Math.imul(T,at)|0,o=o+Math.imul(T,it)|0,a=a+Math.imul(N,ot)|0,n=(n=n+Math.imul(N,At)|0)+Math.imul(D,ot)|0,o=o+Math.imul(D,At)|0,a=a+Math.imul(w,ct)|0,n=(n=n+Math.imul(w,dt)|0)+Math.imul(_,ct)|0,o=o+Math.imul(_,dt)|0,a=a+Math.imul(x,ht)|0,n=(n=n+Math.imul(x,bt)|0)+Math.imul(C,ht)|0,o=o+Math.imul(C,bt)|0,a=a+Math.imul(I,Bt)|0,n=(n=n+Math.imul(I,mt)|0)+Math.imul(y,Bt)|0,o=o+Math.imul(y,mt)|0,a=a+Math.imul(p,Et)|0,n=(n=n+Math.imul(p,yt)|0)+Math.imul(B,Et)|0,o=o+Math.imul(B,yt)|0;var Gt=(u+(a=a+Math.imul(l,xt)|0)|0)+((8191&(n=(n=n+Math.imul(l,Ct)|0)+Math.imul(b,xt)|0))<<13)|0;u=((o=o+Math.imul(b,Ct)|0)+(n>>>13)|0)+(Gt>>>26)|0,Gt&=67108863,a=Math.imul(J,V),n=(n=Math.imul(J,X))+Math.imul(z,V)|0,o=Math.imul(z,X),a=a+Math.imul(H,et)|0,n=(n=n+Math.imul(H,tt)|0)+Math.imul(Y,et)|0,o=o+Math.imul(Y,tt)|0,a=a+Math.imul(P,at)|0,n=(n=n+Math.imul(P,it)|0)+Math.imul(q,at)|0,o=o+Math.imul(q,it)|0,a=a+Math.imul(G,ot)|0,n=(n=n+Math.imul(G,At)|0)+Math.imul(T,ot)|0,o=o+Math.imul(T,At)|0,a=a+Math.imul(N,ct)|0,n=(n=n+Math.imul(N,dt)|0)+Math.imul(D,ct)|0,o=o+Math.imul(D,dt)|0,a=a+Math.imul(w,ht)|0,n=(n=n+Math.imul(w,bt)|0)+Math.imul(_,ht)|0,o=o+Math.imul(_,bt)|0,a=a+Math.imul(x,Bt)|0,n=(n=n+Math.imul(x,mt)|0)+Math.imul(C,Bt)|0,o=o+Math.imul(C,mt)|0,a=a+Math.imul(I,Et)|0,n=(n=n+Math.imul(I,yt)|0)+Math.imul(y,Et)|0,o=o+Math.imul(y,yt)|0,a=a+Math.imul(p,xt)|0,n=(n=n+Math.imul(p,Ct)|0)+Math.imul(B,xt)|0,o=o+Math.imul(B,Ct)|0;var Tt=(u+(a=a+Math.imul(l,wt)|0)|0)+((8191&(n=(n=n+Math.imul(l,Mt)|0)+Math.imul(b,wt)|0))<<13)|0;u=((o=o+Math.imul(b,Mt)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,a=Math.imul(J,et),n=(n=Math.imul(J,tt))+Math.imul(z,et)|0,o=Math.imul(z,tt),a=a+Math.imul(H,at)|0,n=(n=n+Math.imul(H,it)|0)+Math.imul(Y,at)|0,o=o+Math.imul(Y,it)|0,a=a+Math.imul(P,ot)|0,n=(n=n+Math.imul(P,At)|0)+Math.imul(q,ot)|0,o=o+Math.imul(q,At)|0,a=a+Math.imul(G,ct)|0,n=(n=n+Math.imul(G,dt)|0)+Math.imul(T,ct)|0,o=o+Math.imul(T,dt)|0,a=a+Math.imul(N,ht)|0,n=(n=n+Math.imul(N,bt)|0)+Math.imul(D,ht)|0,o=o+Math.imul(D,bt)|0,a=a+Math.imul(w,Bt)|0,n=(n=n+Math.imul(w,mt)|0)+Math.imul(_,Bt)|0,o=o+Math.imul(_,mt)|0,a=a+Math.imul(x,Et)|0,n=(n=n+Math.imul(x,yt)|0)+Math.imul(C,Et)|0,o=o+Math.imul(C,yt)|0,a=a+Math.imul(I,xt)|0,n=(n=n+Math.imul(I,Ct)|0)+Math.imul(y,xt)|0,o=o+Math.imul(y,Ct)|0;var Lt=(u+(a=a+Math.imul(p,wt)|0)|0)+((8191&(n=(n=n+Math.imul(p,Mt)|0)+Math.imul(B,wt)|0))<<13)|0;u=((o=o+Math.imul(B,Mt)|0)+(n>>>13)|0)+(Lt>>>26)|0,Lt&=67108863,a=Math.imul(J,at),n=(n=Math.imul(J,it))+Math.imul(z,at)|0,o=Math.imul(z,it),a=a+Math.imul(H,ot)|0,n=(n=n+Math.imul(H,At)|0)+Math.imul(Y,ot)|0,o=o+Math.imul(Y,At)|0,a=a+Math.imul(P,ct)|0,n=(n=n+Math.imul(P,dt)|0)+Math.imul(q,ct)|0,o=o+Math.imul(q,dt)|0,a=a+Math.imul(G,ht)|0,n=(n=n+Math.imul(G,bt)|0)+Math.imul(T,ht)|0,o=o+Math.imul(T,bt)|0,a=a+Math.imul(N,Bt)|0,n=(n=n+Math.imul(N,mt)|0)+Math.imul(D,Bt)|0,o=o+Math.imul(D,mt)|0,a=a+Math.imul(w,Et)|0,n=(n=n+Math.imul(w,yt)|0)+Math.imul(_,Et)|0,o=o+Math.imul(_,yt)|0,a=a+Math.imul(x,xt)|0,n=(n=n+Math.imul(x,Ct)|0)+Math.imul(C,xt)|0,o=o+Math.imul(C,Ct)|0;var Pt=(u+(a=a+Math.imul(I,wt)|0)|0)+((8191&(n=(n=n+Math.imul(I,Mt)|0)+Math.imul(y,wt)|0))<<13)|0;u=((o=o+Math.imul(y,Mt)|0)+(n>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,a=Math.imul(J,ot),n=(n=Math.imul(J,At))+Math.imul(z,ot)|0,o=Math.imul(z,At),a=a+Math.imul(H,ct)|0,n=(n=n+Math.imul(H,dt)|0)+Math.imul(Y,ct)|0,o=o+Math.imul(Y,dt)|0,a=a+Math.imul(P,ht)|0,n=(n=n+Math.imul(P,bt)|0)+Math.imul(q,ht)|0,o=o+Math.imul(q,bt)|0,a=a+Math.imul(G,Bt)|0,n=(n=n+Math.imul(G,mt)|0)+Math.imul(T,Bt)|0,o=o+Math.imul(T,mt)|0,a=a+Math.imul(N,Et)|0,n=(n=n+Math.imul(N,yt)|0)+Math.imul(D,Et)|0,o=o+Math.imul(D,yt)|0,a=a+Math.imul(w,xt)|0,n=(n=n+Math.imul(w,Ct)|0)+Math.imul(_,xt)|0,o=o+Math.imul(_,Ct)|0;var qt=(u+(a=a+Math.imul(x,wt)|0)|0)+((8191&(n=(n=n+Math.imul(x,Mt)|0)+Math.imul(C,wt)|0))<<13)|0;u=((o=o+Math.imul(C,Mt)|0)+(n>>>13)|0)+(qt>>>26)|0,qt&=67108863,a=Math.imul(J,ct),n=(n=Math.imul(J,dt))+Math.imul(z,ct)|0,o=Math.imul(z,dt),a=a+Math.imul(H,ht)|0,n=(n=n+Math.imul(H,bt)|0)+Math.imul(Y,ht)|0,o=o+Math.imul(Y,bt)|0,a=a+Math.imul(P,Bt)|0,n=(n=n+Math.imul(P,mt)|0)+Math.imul(q,Bt)|0,o=o+Math.imul(q,mt)|0,a=a+Math.imul(G,Et)|0,n=(n=n+Math.imul(G,yt)|0)+Math.imul(T,Et)|0,o=o+Math.imul(T,yt)|0,a=a+Math.imul(N,xt)|0,n=(n=n+Math.imul(N,Ct)|0)+Math.imul(D,xt)|0,o=o+Math.imul(D,Ct)|0;var Ot=(u+(a=a+Math.imul(w,wt)|0)|0)+((8191&(n=(n=n+Math.imul(w,Mt)|0)+Math.imul(_,wt)|0))<<13)|0;u=((o=o+Math.imul(_,Mt)|0)+(n>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,a=Math.imul(J,ht),n=(n=Math.imul(J,bt))+Math.imul(z,ht)|0,o=Math.imul(z,bt),a=a+Math.imul(H,Bt)|0,n=(n=n+Math.imul(H,mt)|0)+Math.imul(Y,Bt)|0,o=o+Math.imul(Y,mt)|0,a=a+Math.imul(P,Et)|0,n=(n=n+Math.imul(P,yt)|0)+Math.imul(q,Et)|0,o=o+Math.imul(q,yt)|0,a=a+Math.imul(G,xt)|0,n=(n=n+Math.imul(G,Ct)|0)+Math.imul(T,xt)|0,o=o+Math.imul(T,Ct)|0;var Ht=(u+(a=a+Math.imul(N,wt)|0)|0)+((8191&(n=(n=n+Math.imul(N,Mt)|0)+Math.imul(D,wt)|0))<<13)|0;u=((o=o+Math.imul(D,Mt)|0)+(n>>>13)|0)+(Ht>>>26)|0,Ht&=67108863,a=Math.imul(J,Bt),n=(n=Math.imul(J,mt))+Math.imul(z,Bt)|0,o=Math.imul(z,mt),a=a+Math.imul(H,Et)|0,n=(n=n+Math.imul(H,yt)|0)+Math.imul(Y,Et)|0,o=o+Math.imul(Y,yt)|0,a=a+Math.imul(P,xt)|0,n=(n=n+Math.imul(P,Ct)|0)+Math.imul(q,xt)|0,o=o+Math.imul(q,Ct)|0;var Yt=(u+(a=a+Math.imul(G,wt)|0)|0)+((8191&(n=(n=n+Math.imul(G,Mt)|0)+Math.imul(T,wt)|0))<<13)|0;u=((o=o+Math.imul(T,Mt)|0)+(n>>>13)|0)+(Yt>>>26)|0,Yt&=67108863,a=Math.imul(J,Et),n=(n=Math.imul(J,yt))+Math.imul(z,Et)|0,o=Math.imul(z,yt),a=a+Math.imul(H,xt)|0,n=(n=n+Math.imul(H,Ct)|0)+Math.imul(Y,xt)|0,o=o+Math.imul(Y,Ct)|0;var jt=(u+(a=a+Math.imul(P,wt)|0)|0)+((8191&(n=(n=n+Math.imul(P,Mt)|0)+Math.imul(q,wt)|0))<<13)|0;u=((o=o+Math.imul(q,Mt)|0)+(n>>>13)|0)+(jt>>>26)|0,jt&=67108863,a=Math.imul(J,xt),n=(n=Math.imul(J,Ct))+Math.imul(z,xt)|0,o=Math.imul(z,Ct);var Jt=(u+(a=a+Math.imul(H,wt)|0)|0)+((8191&(n=(n=n+Math.imul(H,Mt)|0)+Math.imul(Y,wt)|0))<<13)|0;u=((o=o+Math.imul(Y,Mt)|0)+(n>>>13)|0)+(Jt>>>26)|0,Jt&=67108863;var Kt=(u+(a=Math.imul(J,wt))|0)+((8191&(n=(n=Math.imul(J,Mt))+Math.imul(z,wt)|0))<<13)|0;return u=((o=Math.imul(z,Mt))+(n>>>13)|0)+(Kt>>>26)|0,Kt&=67108863,d[0]=_t,d[1]=kt,d[2]=St,d[3]=Nt,d[4]=Dt,d[5]=Rt,d[6]=Ft,d[7]=Ut,d[8]=Gt,d[9]=Tt,d[10]=Lt,d[11]=Pt,d[12]=qt,d[13]=Ot,d[14]=Ht,d[15]=Yt,d[16]=jt,d[17]=Jt,d[18]=Kt,0!==u&&(d[19]=u,r.length++),r};function bigMulTo(e,t,r){r.negative=t.negative^e.negative,r.length=e.length+t.length;for(var a=0,n=0,o=0;o>>26)|0)>>>26,s&=67108863}r.words[o]=c,a=s,s=n}return 0!==a?r.words[o]=a:r.length--,r._strip()}function jumboMulTo(e,t,r){return bigMulTo(e,t,r)}function FFTM(e,t){this.x=e,this.y=t}Math.imul||(c=smallMulTo),BN.prototype.mulTo=function mulTo(e,t){var r=this.length+e.length;return 10===this.length&&10===e.length?c(this,e,t):r<63?smallMulTo(this,e,t):r<1024?bigMulTo(this,e,t):jumboMulTo(this,e,t)},FFTM.prototype.makeRBT=function makeRBT(e){for(var t=new Array(e),r=BN.prototype._countBits(e)-1,a=0;a>=1;return a},FFTM.prototype.permute=function permute(e,t,r,a,n,o){for(var s=0;s>>=1)n++;return 1<>>=13,r[2*o+1]=8191&n,n>>>=13;for(o=2*t;o>=26,r+=n/67108864|0,r+=o>>>26,this.words[a]=67108863&o}return 0!==r&&(this.words[a]=r,this.length++),t?this.ineg():this},BN.prototype.muln=function muln(e){return this.clone().imuln(e)},BN.prototype.sqr=function sqr(){return this.mul(this)},BN.prototype.isqr=function isqr(){return this.imul(this.clone())},BN.prototype.pow=function pow(e){var t=function toBitArray(e){for(var t=new Array(e.bitLength()),r=0;r>>n&1}return t}(e);if(0===t.length)return new BN(1);for(var r=this,a=0;a=0);var t,r=e%26,a=(e-r)/26,n=67108863>>>26-r<<26-r;if(0!==r){var o=0;for(t=0;t>>26-r}o&&(this.words[t]=o,this.length++)}if(0!==a){for(t=this.length-1;t>=0;t--)this.words[t+a]=this.words[t];for(t=0;t=0),a=t?(t-t%26)/26:0;var n=e%26,o=Math.min((e-n)/26,this.length),s=67108863^67108863>>>n<o)for(this.length-=o,d=0;d=0&&(0!==u||d>=a);d--){var h=0|this.words[d];this.words[d]=u<<26-n|h>>>n,u=h&s}return c&&0!==u&&(c.words[c.length++]=u),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},BN.prototype.ishrn=function ishrn(e,t,r){return assert(0===this.negative),this.iushrn(e,t,r)},BN.prototype.shln=function shln(e){return this.clone().ishln(e)},BN.prototype.ushln=function ushln(e){return this.clone().iushln(e)},BN.prototype.shrn=function shrn(e){return this.clone().ishrn(e)},BN.prototype.ushrn=function ushrn(e){return this.clone().iushrn(e)},BN.prototype.testn=function testn(e){assert("number"==typeof e&&e>=0);var t=e%26,r=(e-t)/26,a=1<=0);var t=e%26,r=(e-t)/26;if(assert(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==t&&r++,this.length=Math.min(r,this.length),0!==t){var a=67108863^67108863>>>t<=67108864;t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},BN.prototype.isubn=function isubn(e){if(assert("number"==typeof e),assert(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t>26)-(c/67108864|0),this.words[a+r]=67108863&n}for(;a>26,this.words[a+r]=67108863&n;if(0===s)return this._strip();for(assert(-1===s),s=0,a=0;a>26,this.words[a]=67108863&n;return this.negative=1,this._strip()},BN.prototype._wordDiv=function _wordDiv(e,t){var r=(this.length,e.length),a=this.clone(),n=e,o=0|n.words[n.length-1];0!==(r=26-this._countBits(o))&&(n=n.ushln(r),a.iushln(r),o=0|n.words[n.length-1]);var s,c=a.length-n.length;if("mod"!==t){(s=new BN(null)).length=c+1,s.words=new Array(s.length);for(var d=0;d=0;h--){var l=67108864*(0|a.words[n.length+h])+(0|a.words[n.length+h-1]);for(l=Math.min(l/o|0,67108863),a._ishlnsubmul(n,l,h);0!==a.negative;)l--,a.negative=0,a._ishlnsubmul(n,1,h),a.isZero()||(a.negative^=1);s&&(s.words[h]=l)}return s&&s._strip(),a._strip(),"div"!==t&&0!==r&&a.iushrn(r),{div:s||null,mod:a}},BN.prototype.divmod=function divmod(e,t,r){return assert(!e.isZero()),this.isZero()?{div:new BN(0),mod:new BN(0)}:0!==this.negative&&0===e.negative?(o=this.neg().divmod(e,t),"mod"!==t&&(a=o.div.neg()),"div"!==t&&(n=o.mod.neg(),r&&0!==n.negative&&n.iadd(e)),{div:a,mod:n}):0===this.negative&&0!==e.negative?(o=this.divmod(e.neg(),t),"mod"!==t&&(a=o.div.neg()),{div:a,mod:o.mod}):0!=(this.negative&e.negative)?(o=this.neg().divmod(e.neg(),t),"div"!==t&&(n=o.mod.neg(),r&&0!==n.negative&&n.isub(e)),{div:o.div,mod:n}):e.length>this.length||this.cmp(e)<0?{div:new BN(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new BN(this.modrn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new BN(this.modrn(e.words[0]))}:this._wordDiv(e,t);var a,n,o},BN.prototype.div=function div(e){return this.divmod(e,"div",!1).div},BN.prototype.mod=function mod(e){return this.divmod(e,"mod",!1).mod},BN.prototype.umod=function umod(e){return this.divmod(e,"mod",!0).mod},BN.prototype.divRound=function divRound(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var r=0!==t.div.negative?t.mod.isub(e):t.mod,a=e.ushrn(1),n=e.andln(1),o=r.cmp(a);return o<0||1===n&&0===o?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},BN.prototype.modrn=function modrn(e){var t=e<0;t&&(e=-e),assert(e<=67108863);for(var r=(1<<26)%e,a=0,n=this.length-1;n>=0;n--)a=(r*a+(0|this.words[n]))%e;return t?-a:a},BN.prototype.modn=function modn(e){return this.modrn(e)},BN.prototype.idivn=function idivn(e){var t=e<0;t&&(e=-e),assert(e<=67108863);for(var r=0,a=this.length-1;a>=0;a--){var n=(0|this.words[a])+67108864*r;this.words[a]=n/e|0,r=n%e}return this._strip(),t?this.ineg():this},BN.prototype.divn=function divn(e){return this.clone().idivn(e)},BN.prototype.egcd=function egcd(e){assert(0===e.negative),assert(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var a=new BN(1),n=new BN(0),o=new BN(0),s=new BN(1),c=0;t.isEven()&&r.isEven();)t.iushrn(1),r.iushrn(1),++c;for(var d=r.clone(),u=t.clone();!t.isZero();){for(var h=0,l=1;0==(t.words[0]&l)&&h<26;++h,l<<=1);if(h>0)for(t.iushrn(h);h-- >0;)(a.isOdd()||n.isOdd())&&(a.iadd(d),n.isub(u)),a.iushrn(1),n.iushrn(1);for(var b=0,g=1;0==(r.words[0]&g)&&b<26;++b,g<<=1);if(b>0)for(r.iushrn(b);b-- >0;)(o.isOdd()||s.isOdd())&&(o.iadd(d),s.isub(u)),o.iushrn(1),s.iushrn(1);t.cmp(r)>=0?(t.isub(r),a.isub(o),n.isub(s)):(r.isub(t),o.isub(a),s.isub(n))}return{a:o,b:s,gcd:r.iushln(c)}},BN.prototype._invmp=function _invmp(e){assert(0===e.negative),assert(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var a,n=new BN(1),o=new BN(0),s=r.clone();t.cmpn(1)>0&&r.cmpn(1)>0;){for(var c=0,d=1;0==(t.words[0]&d)&&c<26;++c,d<<=1);if(c>0)for(t.iushrn(c);c-- >0;)n.isOdd()&&n.iadd(s),n.iushrn(1);for(var u=0,h=1;0==(r.words[0]&h)&&u<26;++u,h<<=1);if(u>0)for(r.iushrn(u);u-- >0;)o.isOdd()&&o.iadd(s),o.iushrn(1);t.cmp(r)>=0?(t.isub(r),n.isub(o)):(r.isub(t),o.isub(n))}return(a=0===t.cmpn(1)?n:o).cmpn(0)<0&&a.iadd(e),a},BN.prototype.gcd=function gcd(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),r=e.clone();t.negative=0,r.negative=0;for(var a=0;t.isEven()&&r.isEven();a++)t.iushrn(1),r.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=t.cmp(r);if(n<0){var o=t;t=r,r=o}else if(0===n||0===r.cmpn(1))break;t.isub(r)}return r.iushln(a)},BN.prototype.invm=function invm(e){return this.egcd(e).a.umod(e)},BN.prototype.isEven=function isEven(){return 0==(1&this.words[0])},BN.prototype.isOdd=function isOdd(){return 1==(1&this.words[0])},BN.prototype.andln=function andln(e){return this.words[0]&e},BN.prototype.bincn=function bincn(e){assert("number"==typeof e);var t=e%26,r=(e-t)/26,a=1<>>26,s&=67108863,this.words[o]=s}return 0!==n&&(this.words[o]=n,this.length++),this},BN.prototype.isZero=function isZero(){return 1===this.length&&0===this.words[0]},BN.prototype.cmpn=function cmpn(e){var t,r=e<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this._strip(),this.length>1)t=1;else{r&&(e=-e),assert(e<=67108863,"Number is too big");var a=0|this.words[0];t=a===e?0:ae.length)return 1;if(this.length=0;r--){var a=0|this.words[r],n=0|e.words[r];if(a!==n){an&&(t=1);break}}return t},BN.prototype.gtn=function gtn(e){return 1===this.cmpn(e)},BN.prototype.gt=function gt(e){return 1===this.cmp(e)},BN.prototype.gten=function gten(e){return this.cmpn(e)>=0},BN.prototype.gte=function gte(e){return this.cmp(e)>=0},BN.prototype.ltn=function ltn(e){return-1===this.cmpn(e)},BN.prototype.lt=function lt(e){return-1===this.cmp(e)},BN.prototype.lten=function lten(e){return this.cmpn(e)<=0},BN.prototype.lte=function lte(e){return this.cmp(e)<=0},BN.prototype.eqn=function eqn(e){return 0===this.cmpn(e)},BN.prototype.eq=function eq(e){return 0===this.cmp(e)},BN.red=function red(e){return new Red(e)},BN.prototype.toRed=function toRed(e){return assert(!this.red,"Already a number in reduction context"),assert(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},BN.prototype.fromRed=function fromRed(){return assert(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},BN.prototype._forceRed=function _forceRed(e){return this.red=e,this},BN.prototype.forceRed=function forceRed(e){return assert(!this.red,"Already a number in reduction context"),this._forceRed(e)},BN.prototype.redAdd=function redAdd(e){return assert(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},BN.prototype.redIAdd=function redIAdd(e){return assert(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},BN.prototype.redSub=function redSub(e){return assert(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},BN.prototype.redISub=function redISub(e){return assert(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},BN.prototype.redShl=function redShl(e){return assert(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},BN.prototype.redMul=function redMul(e){return assert(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},BN.prototype.redIMul=function redIMul(e){return assert(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},BN.prototype.redSqr=function redSqr(){return assert(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},BN.prototype.redISqr=function redISqr(){return assert(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},BN.prototype.redSqrt=function redSqrt(){return assert(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},BN.prototype.redInvm=function redInvm(){return assert(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},BN.prototype.redNeg=function redNeg(){return assert(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},BN.prototype.redPow=function redPow(e){return assert(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var d={k256:null,p224:null,p192:null,p25519:null};function MPrime(e,t){this.name=e,this.p=new BN(t,16),this.n=this.p.bitLength(),this.k=new BN(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function K256(){MPrime.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function P224(){MPrime.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function P192(){MPrime.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function P25519(){MPrime.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function Red(e){if("string"==typeof e){var t=BN._prime(e);this.m=t.p,this.prime=t}else assert(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function Mont(e){Red.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new BN(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)}MPrime.prototype._tmp=function _tmp(){var e=new BN(null);return e.words=new Array(Math.ceil(this.n/13)),e},MPrime.prototype.ireduce=function ireduce(e){var t,r=e;do{this.split(r,this.tmp),t=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(t>this.n);var a=t0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},MPrime.prototype.split=function split(e,t){e.iushrn(this.n,0,t)},MPrime.prototype.imulK=function imulK(e){return e.imul(this.k)},inherits(K256,MPrime),K256.prototype.split=function split(e,t){for(var r=4194303,a=Math.min(e.length,9),n=0;n>>22,o=s}o>>>=22,e.words[n-10]=o,0===o&&e.length>10?e.length-=10:e.length-=9},K256.prototype.imulK=function imulK(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,r=0;r>>=26,e.words[r]=n,t=a}return 0!==t&&(e.words[e.length++]=t),e},BN._prime=function prime(e){if(d[e])return d[e];var prime;if("k256"===e)prime=new K256;else if("p224"===e)prime=new P224;else if("p192"===e)prime=new P192;else{if("p25519"!==e)throw new Error("Unknown prime "+e);prime=new P25519}return d[e]=prime,prime},Red.prototype._verify1=function _verify1(e){assert(0===e.negative,"red works only with positives"),assert(e.red,"red works only with red numbers")},Red.prototype._verify2=function _verify2(e,t){assert(0==(e.negative|t.negative),"red works only with positives"),assert(e.red&&e.red===t.red,"red works only with red numbers")},Red.prototype.imod=function imod(e){return this.prime?this.prime.ireduce(e)._forceRed(this):(move(e,e.umod(this.m)._forceRed(this)),e)},Red.prototype.neg=function neg(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},Red.prototype.add=function add(e,t){this._verify2(e,t);var r=e.add(t);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},Red.prototype.iadd=function iadd(e,t){this._verify2(e,t);var r=e.iadd(t);return r.cmp(this.m)>=0&&r.isub(this.m),r},Red.prototype.sub=function sub(e,t){this._verify2(e,t);var r=e.sub(t);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},Red.prototype.isub=function isub(e,t){this._verify2(e,t);var r=e.isub(t);return r.cmpn(0)<0&&r.iadd(this.m),r},Red.prototype.shl=function shl(e,t){return this._verify1(e),this.imod(e.ushln(t))},Red.prototype.imul=function imul(e,t){return this._verify2(e,t),this.imod(e.imul(t))},Red.prototype.mul=function mul(e,t){return this._verify2(e,t),this.imod(e.mul(t))},Red.prototype.isqr=function isqr(e){return this.imul(e,e.clone())},Red.prototype.sqr=function sqr(e){return this.mul(e,e)},Red.prototype.sqrt=function sqrt(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(assert(t%2==1),3===t){var r=this.m.add(new BN(1)).iushrn(2);return this.pow(e,r)}for(var a=this.m.subn(1),n=0;!a.isZero()&&0===a.andln(1);)n++,a.iushrn(1);assert(!a.isZero());var o=new BN(1).toRed(this),s=o.redNeg(),c=this.m.subn(1).iushrn(1),d=this.m.bitLength();for(d=new BN(2*d*d).toRed(this);0!==this.pow(d,c).cmp(s);)d.redIAdd(s);for(var u=this.pow(d,a),h=this.pow(e,a.addn(1).iushrn(1)),l=this.pow(e,a),b=n;0!==l.cmp(o);){for(var g=l,p=0;0!==g.cmp(o);p++)g=g.redSqr();assert(p=0;a--){for(var d=t.words[a],u=c-1;u>=0;u--){var h=d>>u&1;n!==r[0]&&(n=this.sqr(n)),0!==h||0!==o?(o<<=1,o|=h,(4===++s||0===a&&0===u)&&(n=this.mul(n,r[o]),s=0,o=0)):s=0}c=26}return n},Red.prototype.convertTo=function convertTo(e){var t=e.umod(this.m);return t===e?t.clone():t},Red.prototype.convertFrom=function convertFrom(e){var t=e.clone();return t.red=null,t},BN.mont=function mont(e){return new Mont(e)},inherits(Mont,Red),Mont.prototype.convertTo=function convertTo(e){return this.imod(e.ushln(this.shift))},Mont.prototype.convertFrom=function convertFrom(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},Mont.prototype.imul=function imul(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var r=e.imul(t),a=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(a).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},Mont.prototype.mul=function mul(e,t){if(e.isZero()||t.isZero())return new BN(0)._forceRed(this);var r=e.mul(t),a=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(a).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},Mont.prototype.invm=function invm(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(e=r.nmd(e),this)},function(e,t,r){"use strict";var a=r(4).Buffer,n=this&&this.__createBinding||(Object.create?function(e,t,r,a){void 0===a&&(a=r),Object.defineProperty(e,a,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,a){void 0===a&&(a=r),e[a]=t[r]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),s=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.hasOwnProperty.call(e,r)&&n(t,e,r);return o(t,e),t},c=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.defineProperties=void 0;var d=c(r(6)),u=s(r(186)),h=s(r(343)),l=r(73);t.defineProperties=function(e,t,r){if(e.raw=[],e._fields=[],e.toJSON=function(t){if(void 0===t&&(t=!1),t){var r={};return e._fields.forEach((function(t){r[t]="0x"+e[t].toString("hex")})),r}return l.baToJSON(e.raw)},e.serialize=function serialize(){return h.encode(e.raw)},t.forEach((function(t,r){function getter(){return e.raw[r]}function setter(n){"00"!==(n=l.toBuffer(n)).toString("hex")||t.allowZero||(n=a.allocUnsafe(0)),t.allowLess&&t.length?(n=l.unpadBuffer(n),d.default(t.length>=n.length,"The field "+t.name+" must not have more "+t.length+" bytes")):t.allowZero&&0===n.length||!t.length||d.default(t.length===n.length,"The field "+t.name+" must have byte length of "+t.length),e.raw[r]=n}e._fields.push(t.name),Object.defineProperty(e,t.name,{enumerable:!0,configurable:!0,get:getter,set:setter}),t.default&&(e[t.name]=t.default),t.alias&&Object.defineProperty(e,t.alias,{enumerable:!1,configurable:!0,set:setter,get:getter})})),r)if("string"==typeof r&&(r=a.from(u.stripHexPrefix(r),"hex")),a.isBuffer(r)&&(r=h.decode(r)),Array.isArray(r)){if(r.length>e._fields.length)throw new Error("wrong number of fields in data");r.forEach((function(t,r){e[e._fields[r]]=l.toBuffer(t)}))}else{if("object"!=typeof r)throw new Error("invalid data");var n=Object.keys(r);t.forEach((function(t){-1!==n.indexOf(t.name)&&(e[t.name]=r[t.name]),-1!==n.indexOf(t.alias)&&(e[t.alias]=r[t.alias])}))}}},function(e,t,r){"use strict";var a=this&&this.__createBinding||(Object.create?function(e,t,r,a){void 0===a&&(a=r),Object.defineProperty(e,a,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,a){void 0===a&&(a=r),e[a]=t[r]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.hasOwnProperty.call(e,r)&&a(t,e,r);return n(t,e),t},s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.rlp=t.BN=void 0;var c=s(r(130));t.BN=c.default;var d=o(r(343));t.rlp=d},function(e,t,r){"use strict";var a=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],a=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&a>=e.length&&(e=void 0),{value:e&&e[a++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},n=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var a,n,o=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(a=o.next()).done;)s.push(a.value)}catch(e){n={error:e}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return s},o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.BaseTransaction=void 0;var s=o(r(112)),c=r(16),d=r(191),u=function(){function BaseTransaction(e){this.activeCapabilities=[],this.DEFAULT_CHAIN="mainnet",this.DEFAULT_HARDFORK="istanbul";var t=e.nonce,r=e.gasLimit,a=e.to,n=e.value,o=e.data,s=e.v,d=e.r,u=e.s,h=e.type;this._type=new c.BN(c.toBuffer(h)).toNumber();var l=c.toBuffer(""===a?"0x":a),b=c.toBuffer(""===s?"0x":s),g=c.toBuffer(""===d?"0x":d),p=c.toBuffer(""===u?"0x":u);this.nonce=new c.BN(c.toBuffer(""===t?"0x":t)),this.gasLimit=new c.BN(c.toBuffer(""===r?"0x":r)),this.to=l.length>0?new c.Address(l):void 0,this.value=new c.BN(c.toBuffer(""===n?"0x":n)),this.data=c.toBuffer(""===o?"0x":o),this.v=b.length>0?new c.BN(b):void 0,this.r=g.length>0?new c.BN(g):void 0,this.s=p.length>0?new c.BN(p):void 0,this._validateCannotExceedMaxInteger({nonce:this.nonce,gasLimit:this.gasLimit,value:this.value,r:this.r,s:this.s})}return Object.defineProperty(BaseTransaction.prototype,"transactionType",{get:function(){return this.type},enumerable:!1,configurable:!0}),Object.defineProperty(BaseTransaction.prototype,"type",{get:function(){return this._type},enumerable:!1,configurable:!0}),BaseTransaction.prototype.supports=function(e){return this.activeCapabilities.includes(e)},BaseTransaction.prototype.validate=function(e){void 0===e&&(e=!1);var t=[];return this.getBaseFee().gt(this.gasLimit)&&t.push("gasLimit is too low. given "+this.gasLimit+", need at least "+this.getBaseFee()),this.isSigned()&&!this.verifySignature()&&t.push("Invalid Signature"),e?t:0===t.length},BaseTransaction.prototype.getBaseFee=function(){var e=this.getDataFee().addn(this.common.param("gasPrices","tx"));return this.common.gteHardfork("homestead")&&this.toCreationAddress()&&e.iaddn(this.common.param("gasPrices","txCreation")),e},BaseTransaction.prototype.getDataFee=function(){for(var e=this.common.param("gasPrices","txDataZero"),t=this.common.param("gasPrices","txDataNonZero"),r=0,a=0;a-1&&this.activeCapabilities.splice(h,1)}return u},BaseTransaction.prototype._getCommon=function(e,t){var r;if(t){var a=new c.BN(c.toBuffer(t));if(e){if(!e.chainIdBN().eq(a))throw new Error("The chain ID does not match the chain ID of Common");return e.copy()}return s.default.isSupportedChainId(a)?new s.default({chain:a,hardfork:this.DEFAULT_HARDFORK}):s.default.forCustomChain(this.DEFAULT_CHAIN,{name:"custom-chain",networkId:a,chainId:a},this.DEFAULT_HARDFORK)}return null!==(r=null==e?void 0:e.copy())&&void 0!==r?r:new s.default({chain:this.DEFAULT_CHAIN,hardfork:this.DEFAULT_HARDFORK})},BaseTransaction.prototype._validateCannotExceedMaxInteger=function(e,t){var r,o;void 0===t&&(t=53);try{for(var s=a(Object.entries(e)),d=s.next();!d.done;d=s.next()){var u=n(d.value,2),h=u[0],l=u[1];if(53===t){if(null==l?void 0:l.gt(c.MAX_INTEGER))throw new Error(h+" cannot exceed MAX_INTEGER, given "+l)}else{if(256!==t)throw new Error("unimplemented bits value");if(null==l?void 0:l.gte(c.TWO_POW256))throw new Error(h+" must be less than 2^256, given "+l)}}}catch(e){r={error:e}}finally{try{d&&!d.done&&(o=s.return)&&o.call(s)}finally{if(r)throw r.error}}},BaseTransaction}();t.BaseTransaction=u},function(e,t,r){!function(e,t){"use strict";function assert(e,t){if(!e)throw new Error(t||"Assertion failed")}function inherits(e,t){e.super_=t;var TempCtor=function(){};TempCtor.prototype=t.prototype,e.prototype=new TempCtor,e.prototype.constructor=e}function BN(e,t,r){if(BN.isBN(e))return e;this.negative=0,this.words=null,this.length=0,this.red=null,null!==e&&("le"!==t&&"be"!==t||(r=t,t=10),this._init(e||0,t||10,r||"be"))}var a;"object"==typeof e?e.exports=BN:t.BN=BN,BN.BN=BN,BN.wordSize=26;try{a="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:r(17).Buffer}catch(e){}function parseHex4Bits(e,t){var r=e.charCodeAt(t);return r>=48&&r<=57?r-48:r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:void assert(!1,"Invalid character in "+e)}function parseHexByte(e,t,r){var a=parseHex4Bits(e,r);return r-1>=t&&(a|=parseHex4Bits(e,r-1)<<4),a}function parseBase(e,t,r,a){for(var n=0,o=0,s=Math.min(e.length,r),c=t;c=49?d-49+10:d>=17?d-17+10:d,assert(d>=0&&o0?e:t},BN.min=function min(e,t){return e.cmp(t)<0?e:t},BN.prototype._init=function init(e,t,r){if("number"==typeof e)return this._initNumber(e,t,r);if("object"==typeof e)return this._initArray(e,t,r);"hex"===t&&(t=16),assert(t===(0|t)&&t>=2&&t<=36);var a=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&(a++,this.negative=1),a=0;a-=3)o=e[a]|e[a-1]<<8|e[a-2]<<16,this.words[n]|=o<>>26-s&67108863,(s+=24)>=26&&(s-=26,n++);else if("le"===r)for(a=0,n=0;a>>26-s&67108863,(s+=24)>=26&&(s-=26,n++);return this._strip()},BN.prototype._parseHex=function _parseHex(e,t,r){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var a=0;a=t;a-=2)n=parseHexByte(e,t,a)<=18?(o-=18,s+=1,this.words[s]|=n>>>26):o+=8;else for(a=(e.length-t)%2==0?t+1:t;a=18?(o-=18,s+=1,this.words[s]|=n>>>26):o+=8;this._strip()},BN.prototype._parseBase=function _parseBase(e,t,r){this.words=[0],this.length=1;for(var a=0,n=1;n<=67108863;n*=t)a++;a--,n=n/t|0;for(var o=e.length-r,s=o%a,c=Math.min(o,o-s)+r,d=0,u=r;u1&&0===this.words[this.length-1];)this.length--;return this._normSign()},BN.prototype._normSign=function _normSign(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for)try{BN.prototype[Symbol.for("nodejs.util.inspect.custom")]=inspect}catch(e){BN.prototype.inspect=inspect}else BN.prototype.inspect=inspect;function inspect(){return(this.red?""}var n=["","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"],o=[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],s=[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];BN.prototype.toString=function toString(e,t){var r;if(t=0|t||1,16===(e=e||10)||"hex"===e){r="";for(var a=0,c=0,d=0;d>>24-a&16777215)||d!==this.length-1?n[6-h.length]+h+r:h+r,(a+=2)>=26&&(a-=26,d--)}for(0!==c&&(r=c.toString(16)+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(e===(0|e)&&e>=2&&e<=36){var l=o[e],b=s[e];r="";var g=this.clone();for(g.negative=0;!g.isZero();){var p=g.modrn(b).toString(e);r=(g=g.idivn(b)).isZero()?p+r:n[l-p.length]+p+r}for(this.isZero()&&(r="0"+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}assert(!1,"Base should be between 2 and 36")},BN.prototype.toNumber=function toNumber(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&assert(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},BN.prototype.toJSON=function toJSON(){return this.toString(16,2)},a&&(BN.prototype.toBuffer=function toBuffer(e,t){return this.toArrayLike(a,e,t)}),BN.prototype.toArray=function toArray(e,t){return this.toArrayLike(Array,e,t)};function smallMulTo(e,t,r){r.negative=t.negative^e.negative;var a=e.length+t.length|0;r.length=a,a=a-1|0;var n=0|e.words[0],o=0|t.words[0],s=n*o,c=67108863&s,d=s/67108864|0;r.words[0]=c;for(var u=1;u>>26,l=67108863&d,b=Math.min(u,t.length-1),g=Math.max(0,u-e.length+1);g<=b;g++){var p=u-g|0;h+=(s=(n=0|e.words[p])*(o=0|t.words[g])+l)/67108864|0,l=67108863&s}r.words[u]=0|l,d=0|h}return 0!==d?r.words[u]=0|d:r.length--,r._strip()}BN.prototype.toArrayLike=function toArrayLike(e,t,r){this._strip();var a=this.byteLength(),n=r||Math.max(1,a);assert(a<=n,"byte array longer than desired length"),assert(n>0,"Requested array length <= 0");var o=function allocate(e,t){return e.allocUnsafe?e.allocUnsafe(t):new e(t)}(e,n);return this["_toArrayLike"+("le"===t?"LE":"BE")](o,a),o},BN.prototype._toArrayLikeLE=function _toArrayLikeLE(e,t){for(var r=0,a=0,n=0,o=0;n>8&255),r>16&255),6===o?(r>24&255),a=0,o=0):(a=s>>>24,o+=2)}if(r=0&&(e[r--]=s>>8&255),r>=0&&(e[r--]=s>>16&255),6===o?(r>=0&&(e[r--]=s>>24&255),a=0,o=0):(a=s>>>24,o+=2)}if(r>=0)for(e[r--]=a;r>=0;)e[r--]=0},Math.clz32?BN.prototype._countBits=function _countBits(e){return 32-Math.clz32(e)}:BN.prototype._countBits=function _countBits(e){var t=e,r=0;return t>=4096&&(r+=13,t>>>=13),t>=64&&(r+=7,t>>>=7),t>=8&&(r+=4,t>>>=4),t>=2&&(r+=2,t>>>=2),r+t},BN.prototype._zeroBits=function _zeroBits(e){if(0===e)return 26;var t=e,r=0;return 0==(8191&t)&&(r+=13,t>>>=13),0==(127&t)&&(r+=7,t>>>=7),0==(15&t)&&(r+=4,t>>>=4),0==(3&t)&&(r+=2,t>>>=2),0==(1&t)&&r++,r},BN.prototype.bitLength=function bitLength(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},BN.prototype.zeroBits=function zeroBits(){if(this.isZero())return 0;for(var e=0,t=0;te.length?this.clone().ior(e):e.clone().ior(this)},BN.prototype.uor=function uor(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},BN.prototype.iuand=function iuand(e){var t;t=this.length>e.length?e:this;for(var r=0;re.length?this.clone().iand(e):e.clone().iand(this)},BN.prototype.uand=function uand(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},BN.prototype.iuxor=function iuxor(e){var t,r;this.length>e.length?(t=this,r=e):(t=e,r=this);for(var a=0;ae.length?this.clone().ixor(e):e.clone().ixor(this)},BN.prototype.uxor=function uxor(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},BN.prototype.inotn=function inotn(e){assert("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),r=e%26;this._expand(t),r>0&&t--;for(var a=0;a0&&(this.words[a]=~this.words[a]&67108863>>26-r),this._strip()},BN.prototype.notn=function notn(e){return this.clone().inotn(e)},BN.prototype.setn=function setn(e,t){assert("number"==typeof e&&e>=0);var r=e/26|0,a=e%26;return this._expand(r+1),this.words[r]=t?this.words[r]|1<e.length?(r=this,a=e):(r=e,a=this);for(var n=0,o=0;o>>26;for(;0!==n&&o>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;oe.length?this.clone().iadd(e):e.clone().iadd(this)},BN.prototype.isub=function isub(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var r,a,n=this.cmp(e);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,a=e):(r=e,a=this);for(var o=0,s=0;s>26,this.words[s]=67108863&t;for(;0!==o&&s>26,this.words[s]=67108863&t;if(0===o&&s>>13,g=0|s[1],p=8191&g,B=g>>>13,m=0|s[2],I=8191&m,y=m>>>13,v=0|s[3],x=8191&v,C=v>>>13,Q=0|s[4],w=8191&Q,_=Q>>>13,k=0|s[5],N=8191&k,D=k>>>13,U=0|s[6],G=8191&U,T=U>>>13,L=0|s[7],P=8191&L,q=L>>>13,O=0|s[8],H=8191&O,Y=O>>>13,j=0|s[9],J=8191&j,z=j>>>13,W=0|c[0],V=8191&W,X=W>>>13,$=0|c[1],et=8191&$,tt=$>>>13,rt=0|c[2],at=8191&rt,it=rt>>>13,nt=0|c[3],ot=8191&nt,At=nt>>>13,st=0|c[4],ct=8191&st,dt=st>>>13,ut=0|c[5],ht=8191&ut,bt=ut>>>13,pt=0|c[6],Bt=8191&pt,mt=pt>>>13,It=0|c[7],Et=8191&It,yt=It>>>13,vt=0|c[8],xt=8191&vt,Ct=vt>>>13,Qt=0|c[9],wt=8191&Qt,Mt=Qt>>>13;r.negative=e.negative^t.negative,r.length=19;var _t=(u+(a=Math.imul(l,V))|0)+((8191&(n=(n=Math.imul(l,X))+Math.imul(b,V)|0))<<13)|0;u=((o=Math.imul(b,X))+(n>>>13)|0)+(_t>>>26)|0,_t&=67108863,a=Math.imul(p,V),n=(n=Math.imul(p,X))+Math.imul(B,V)|0,o=Math.imul(B,X);var kt=(u+(a=a+Math.imul(l,et)|0)|0)+((8191&(n=(n=n+Math.imul(l,tt)|0)+Math.imul(b,et)|0))<<13)|0;u=((o=o+Math.imul(b,tt)|0)+(n>>>13)|0)+(kt>>>26)|0,kt&=67108863,a=Math.imul(I,V),n=(n=Math.imul(I,X))+Math.imul(y,V)|0,o=Math.imul(y,X),a=a+Math.imul(p,et)|0,n=(n=n+Math.imul(p,tt)|0)+Math.imul(B,et)|0,o=o+Math.imul(B,tt)|0;var St=(u+(a=a+Math.imul(l,at)|0)|0)+((8191&(n=(n=n+Math.imul(l,it)|0)+Math.imul(b,at)|0))<<13)|0;u=((o=o+Math.imul(b,it)|0)+(n>>>13)|0)+(St>>>26)|0,St&=67108863,a=Math.imul(x,V),n=(n=Math.imul(x,X))+Math.imul(C,V)|0,o=Math.imul(C,X),a=a+Math.imul(I,et)|0,n=(n=n+Math.imul(I,tt)|0)+Math.imul(y,et)|0,o=o+Math.imul(y,tt)|0,a=a+Math.imul(p,at)|0,n=(n=n+Math.imul(p,it)|0)+Math.imul(B,at)|0,o=o+Math.imul(B,it)|0;var Nt=(u+(a=a+Math.imul(l,ot)|0)|0)+((8191&(n=(n=n+Math.imul(l,At)|0)+Math.imul(b,ot)|0))<<13)|0;u=((o=o+Math.imul(b,At)|0)+(n>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,a=Math.imul(w,V),n=(n=Math.imul(w,X))+Math.imul(_,V)|0,o=Math.imul(_,X),a=a+Math.imul(x,et)|0,n=(n=n+Math.imul(x,tt)|0)+Math.imul(C,et)|0,o=o+Math.imul(C,tt)|0,a=a+Math.imul(I,at)|0,n=(n=n+Math.imul(I,it)|0)+Math.imul(y,at)|0,o=o+Math.imul(y,it)|0,a=a+Math.imul(p,ot)|0,n=(n=n+Math.imul(p,At)|0)+Math.imul(B,ot)|0,o=o+Math.imul(B,At)|0;var Dt=(u+(a=a+Math.imul(l,ct)|0)|0)+((8191&(n=(n=n+Math.imul(l,dt)|0)+Math.imul(b,ct)|0))<<13)|0;u=((o=o+Math.imul(b,dt)|0)+(n>>>13)|0)+(Dt>>>26)|0,Dt&=67108863,a=Math.imul(N,V),n=(n=Math.imul(N,X))+Math.imul(D,V)|0,o=Math.imul(D,X),a=a+Math.imul(w,et)|0,n=(n=n+Math.imul(w,tt)|0)+Math.imul(_,et)|0,o=o+Math.imul(_,tt)|0,a=a+Math.imul(x,at)|0,n=(n=n+Math.imul(x,it)|0)+Math.imul(C,at)|0,o=o+Math.imul(C,it)|0,a=a+Math.imul(I,ot)|0,n=(n=n+Math.imul(I,At)|0)+Math.imul(y,ot)|0,o=o+Math.imul(y,At)|0,a=a+Math.imul(p,ct)|0,n=(n=n+Math.imul(p,dt)|0)+Math.imul(B,ct)|0,o=o+Math.imul(B,dt)|0;var Rt=(u+(a=a+Math.imul(l,ht)|0)|0)+((8191&(n=(n=n+Math.imul(l,bt)|0)+Math.imul(b,ht)|0))<<13)|0;u=((o=o+Math.imul(b,bt)|0)+(n>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,a=Math.imul(G,V),n=(n=Math.imul(G,X))+Math.imul(T,V)|0,o=Math.imul(T,X),a=a+Math.imul(N,et)|0,n=(n=n+Math.imul(N,tt)|0)+Math.imul(D,et)|0,o=o+Math.imul(D,tt)|0,a=a+Math.imul(w,at)|0,n=(n=n+Math.imul(w,it)|0)+Math.imul(_,at)|0,o=o+Math.imul(_,it)|0,a=a+Math.imul(x,ot)|0,n=(n=n+Math.imul(x,At)|0)+Math.imul(C,ot)|0,o=o+Math.imul(C,At)|0,a=a+Math.imul(I,ct)|0,n=(n=n+Math.imul(I,dt)|0)+Math.imul(y,ct)|0,o=o+Math.imul(y,dt)|0,a=a+Math.imul(p,ht)|0,n=(n=n+Math.imul(p,bt)|0)+Math.imul(B,ht)|0,o=o+Math.imul(B,bt)|0;var Ft=(u+(a=a+Math.imul(l,Bt)|0)|0)+((8191&(n=(n=n+Math.imul(l,mt)|0)+Math.imul(b,Bt)|0))<<13)|0;u=((o=o+Math.imul(b,mt)|0)+(n>>>13)|0)+(Ft>>>26)|0,Ft&=67108863,a=Math.imul(P,V),n=(n=Math.imul(P,X))+Math.imul(q,V)|0,o=Math.imul(q,X),a=a+Math.imul(G,et)|0,n=(n=n+Math.imul(G,tt)|0)+Math.imul(T,et)|0,o=o+Math.imul(T,tt)|0,a=a+Math.imul(N,at)|0,n=(n=n+Math.imul(N,it)|0)+Math.imul(D,at)|0,o=o+Math.imul(D,it)|0,a=a+Math.imul(w,ot)|0,n=(n=n+Math.imul(w,At)|0)+Math.imul(_,ot)|0,o=o+Math.imul(_,At)|0,a=a+Math.imul(x,ct)|0,n=(n=n+Math.imul(x,dt)|0)+Math.imul(C,ct)|0,o=o+Math.imul(C,dt)|0,a=a+Math.imul(I,ht)|0,n=(n=n+Math.imul(I,bt)|0)+Math.imul(y,ht)|0,o=o+Math.imul(y,bt)|0,a=a+Math.imul(p,Bt)|0,n=(n=n+Math.imul(p,mt)|0)+Math.imul(B,Bt)|0,o=o+Math.imul(B,mt)|0;var Ut=(u+(a=a+Math.imul(l,Et)|0)|0)+((8191&(n=(n=n+Math.imul(l,yt)|0)+Math.imul(b,Et)|0))<<13)|0;u=((o=o+Math.imul(b,yt)|0)+(n>>>13)|0)+(Ut>>>26)|0,Ut&=67108863,a=Math.imul(H,V),n=(n=Math.imul(H,X))+Math.imul(Y,V)|0,o=Math.imul(Y,X),a=a+Math.imul(P,et)|0,n=(n=n+Math.imul(P,tt)|0)+Math.imul(q,et)|0,o=o+Math.imul(q,tt)|0,a=a+Math.imul(G,at)|0,n=(n=n+Math.imul(G,it)|0)+Math.imul(T,at)|0,o=o+Math.imul(T,it)|0,a=a+Math.imul(N,ot)|0,n=(n=n+Math.imul(N,At)|0)+Math.imul(D,ot)|0,o=o+Math.imul(D,At)|0,a=a+Math.imul(w,ct)|0,n=(n=n+Math.imul(w,dt)|0)+Math.imul(_,ct)|0,o=o+Math.imul(_,dt)|0,a=a+Math.imul(x,ht)|0,n=(n=n+Math.imul(x,bt)|0)+Math.imul(C,ht)|0,o=o+Math.imul(C,bt)|0,a=a+Math.imul(I,Bt)|0,n=(n=n+Math.imul(I,mt)|0)+Math.imul(y,Bt)|0,o=o+Math.imul(y,mt)|0,a=a+Math.imul(p,Et)|0,n=(n=n+Math.imul(p,yt)|0)+Math.imul(B,Et)|0,o=o+Math.imul(B,yt)|0;var Gt=(u+(a=a+Math.imul(l,xt)|0)|0)+((8191&(n=(n=n+Math.imul(l,Ct)|0)+Math.imul(b,xt)|0))<<13)|0;u=((o=o+Math.imul(b,Ct)|0)+(n>>>13)|0)+(Gt>>>26)|0,Gt&=67108863,a=Math.imul(J,V),n=(n=Math.imul(J,X))+Math.imul(z,V)|0,o=Math.imul(z,X),a=a+Math.imul(H,et)|0,n=(n=n+Math.imul(H,tt)|0)+Math.imul(Y,et)|0,o=o+Math.imul(Y,tt)|0,a=a+Math.imul(P,at)|0,n=(n=n+Math.imul(P,it)|0)+Math.imul(q,at)|0,o=o+Math.imul(q,it)|0,a=a+Math.imul(G,ot)|0,n=(n=n+Math.imul(G,At)|0)+Math.imul(T,ot)|0,o=o+Math.imul(T,At)|0,a=a+Math.imul(N,ct)|0,n=(n=n+Math.imul(N,dt)|0)+Math.imul(D,ct)|0,o=o+Math.imul(D,dt)|0,a=a+Math.imul(w,ht)|0,n=(n=n+Math.imul(w,bt)|0)+Math.imul(_,ht)|0,o=o+Math.imul(_,bt)|0,a=a+Math.imul(x,Bt)|0,n=(n=n+Math.imul(x,mt)|0)+Math.imul(C,Bt)|0,o=o+Math.imul(C,mt)|0,a=a+Math.imul(I,Et)|0,n=(n=n+Math.imul(I,yt)|0)+Math.imul(y,Et)|0,o=o+Math.imul(y,yt)|0,a=a+Math.imul(p,xt)|0,n=(n=n+Math.imul(p,Ct)|0)+Math.imul(B,xt)|0,o=o+Math.imul(B,Ct)|0;var Tt=(u+(a=a+Math.imul(l,wt)|0)|0)+((8191&(n=(n=n+Math.imul(l,Mt)|0)+Math.imul(b,wt)|0))<<13)|0;u=((o=o+Math.imul(b,Mt)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,a=Math.imul(J,et),n=(n=Math.imul(J,tt))+Math.imul(z,et)|0,o=Math.imul(z,tt),a=a+Math.imul(H,at)|0,n=(n=n+Math.imul(H,it)|0)+Math.imul(Y,at)|0,o=o+Math.imul(Y,it)|0,a=a+Math.imul(P,ot)|0,n=(n=n+Math.imul(P,At)|0)+Math.imul(q,ot)|0,o=o+Math.imul(q,At)|0,a=a+Math.imul(G,ct)|0,n=(n=n+Math.imul(G,dt)|0)+Math.imul(T,ct)|0,o=o+Math.imul(T,dt)|0,a=a+Math.imul(N,ht)|0,n=(n=n+Math.imul(N,bt)|0)+Math.imul(D,ht)|0,o=o+Math.imul(D,bt)|0,a=a+Math.imul(w,Bt)|0,n=(n=n+Math.imul(w,mt)|0)+Math.imul(_,Bt)|0,o=o+Math.imul(_,mt)|0,a=a+Math.imul(x,Et)|0,n=(n=n+Math.imul(x,yt)|0)+Math.imul(C,Et)|0,o=o+Math.imul(C,yt)|0,a=a+Math.imul(I,xt)|0,n=(n=n+Math.imul(I,Ct)|0)+Math.imul(y,xt)|0,o=o+Math.imul(y,Ct)|0;var Lt=(u+(a=a+Math.imul(p,wt)|0)|0)+((8191&(n=(n=n+Math.imul(p,Mt)|0)+Math.imul(B,wt)|0))<<13)|0;u=((o=o+Math.imul(B,Mt)|0)+(n>>>13)|0)+(Lt>>>26)|0,Lt&=67108863,a=Math.imul(J,at),n=(n=Math.imul(J,it))+Math.imul(z,at)|0,o=Math.imul(z,it),a=a+Math.imul(H,ot)|0,n=(n=n+Math.imul(H,At)|0)+Math.imul(Y,ot)|0,o=o+Math.imul(Y,At)|0,a=a+Math.imul(P,ct)|0,n=(n=n+Math.imul(P,dt)|0)+Math.imul(q,ct)|0,o=o+Math.imul(q,dt)|0,a=a+Math.imul(G,ht)|0,n=(n=n+Math.imul(G,bt)|0)+Math.imul(T,ht)|0,o=o+Math.imul(T,bt)|0,a=a+Math.imul(N,Bt)|0,n=(n=n+Math.imul(N,mt)|0)+Math.imul(D,Bt)|0,o=o+Math.imul(D,mt)|0,a=a+Math.imul(w,Et)|0,n=(n=n+Math.imul(w,yt)|0)+Math.imul(_,Et)|0,o=o+Math.imul(_,yt)|0,a=a+Math.imul(x,xt)|0,n=(n=n+Math.imul(x,Ct)|0)+Math.imul(C,xt)|0,o=o+Math.imul(C,Ct)|0;var Pt=(u+(a=a+Math.imul(I,wt)|0)|0)+((8191&(n=(n=n+Math.imul(I,Mt)|0)+Math.imul(y,wt)|0))<<13)|0;u=((o=o+Math.imul(y,Mt)|0)+(n>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,a=Math.imul(J,ot),n=(n=Math.imul(J,At))+Math.imul(z,ot)|0,o=Math.imul(z,At),a=a+Math.imul(H,ct)|0,n=(n=n+Math.imul(H,dt)|0)+Math.imul(Y,ct)|0,o=o+Math.imul(Y,dt)|0,a=a+Math.imul(P,ht)|0,n=(n=n+Math.imul(P,bt)|0)+Math.imul(q,ht)|0,o=o+Math.imul(q,bt)|0,a=a+Math.imul(G,Bt)|0,n=(n=n+Math.imul(G,mt)|0)+Math.imul(T,Bt)|0,o=o+Math.imul(T,mt)|0,a=a+Math.imul(N,Et)|0,n=(n=n+Math.imul(N,yt)|0)+Math.imul(D,Et)|0,o=o+Math.imul(D,yt)|0,a=a+Math.imul(w,xt)|0,n=(n=n+Math.imul(w,Ct)|0)+Math.imul(_,xt)|0,o=o+Math.imul(_,Ct)|0;var qt=(u+(a=a+Math.imul(x,wt)|0)|0)+((8191&(n=(n=n+Math.imul(x,Mt)|0)+Math.imul(C,wt)|0))<<13)|0;u=((o=o+Math.imul(C,Mt)|0)+(n>>>13)|0)+(qt>>>26)|0,qt&=67108863,a=Math.imul(J,ct),n=(n=Math.imul(J,dt))+Math.imul(z,ct)|0,o=Math.imul(z,dt),a=a+Math.imul(H,ht)|0,n=(n=n+Math.imul(H,bt)|0)+Math.imul(Y,ht)|0,o=o+Math.imul(Y,bt)|0,a=a+Math.imul(P,Bt)|0,n=(n=n+Math.imul(P,mt)|0)+Math.imul(q,Bt)|0,o=o+Math.imul(q,mt)|0,a=a+Math.imul(G,Et)|0,n=(n=n+Math.imul(G,yt)|0)+Math.imul(T,Et)|0,o=o+Math.imul(T,yt)|0,a=a+Math.imul(N,xt)|0,n=(n=n+Math.imul(N,Ct)|0)+Math.imul(D,xt)|0,o=o+Math.imul(D,Ct)|0;var Ot=(u+(a=a+Math.imul(w,wt)|0)|0)+((8191&(n=(n=n+Math.imul(w,Mt)|0)+Math.imul(_,wt)|0))<<13)|0;u=((o=o+Math.imul(_,Mt)|0)+(n>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,a=Math.imul(J,ht),n=(n=Math.imul(J,bt))+Math.imul(z,ht)|0,o=Math.imul(z,bt),a=a+Math.imul(H,Bt)|0,n=(n=n+Math.imul(H,mt)|0)+Math.imul(Y,Bt)|0,o=o+Math.imul(Y,mt)|0,a=a+Math.imul(P,Et)|0,n=(n=n+Math.imul(P,yt)|0)+Math.imul(q,Et)|0,o=o+Math.imul(q,yt)|0,a=a+Math.imul(G,xt)|0,n=(n=n+Math.imul(G,Ct)|0)+Math.imul(T,xt)|0,o=o+Math.imul(T,Ct)|0;var Ht=(u+(a=a+Math.imul(N,wt)|0)|0)+((8191&(n=(n=n+Math.imul(N,Mt)|0)+Math.imul(D,wt)|0))<<13)|0;u=((o=o+Math.imul(D,Mt)|0)+(n>>>13)|0)+(Ht>>>26)|0,Ht&=67108863,a=Math.imul(J,Bt),n=(n=Math.imul(J,mt))+Math.imul(z,Bt)|0,o=Math.imul(z,mt),a=a+Math.imul(H,Et)|0,n=(n=n+Math.imul(H,yt)|0)+Math.imul(Y,Et)|0,o=o+Math.imul(Y,yt)|0,a=a+Math.imul(P,xt)|0,n=(n=n+Math.imul(P,Ct)|0)+Math.imul(q,xt)|0,o=o+Math.imul(q,Ct)|0;var Yt=(u+(a=a+Math.imul(G,wt)|0)|0)+((8191&(n=(n=n+Math.imul(G,Mt)|0)+Math.imul(T,wt)|0))<<13)|0;u=((o=o+Math.imul(T,Mt)|0)+(n>>>13)|0)+(Yt>>>26)|0,Yt&=67108863,a=Math.imul(J,Et),n=(n=Math.imul(J,yt))+Math.imul(z,Et)|0,o=Math.imul(z,yt),a=a+Math.imul(H,xt)|0,n=(n=n+Math.imul(H,Ct)|0)+Math.imul(Y,xt)|0,o=o+Math.imul(Y,Ct)|0;var jt=(u+(a=a+Math.imul(P,wt)|0)|0)+((8191&(n=(n=n+Math.imul(P,Mt)|0)+Math.imul(q,wt)|0))<<13)|0;u=((o=o+Math.imul(q,Mt)|0)+(n>>>13)|0)+(jt>>>26)|0,jt&=67108863,a=Math.imul(J,xt),n=(n=Math.imul(J,Ct))+Math.imul(z,xt)|0,o=Math.imul(z,Ct);var Jt=(u+(a=a+Math.imul(H,wt)|0)|0)+((8191&(n=(n=n+Math.imul(H,Mt)|0)+Math.imul(Y,wt)|0))<<13)|0;u=((o=o+Math.imul(Y,Mt)|0)+(n>>>13)|0)+(Jt>>>26)|0,Jt&=67108863;var Kt=(u+(a=Math.imul(J,wt))|0)+((8191&(n=(n=Math.imul(J,Mt))+Math.imul(z,wt)|0))<<13)|0;return u=((o=Math.imul(z,Mt))+(n>>>13)|0)+(Kt>>>26)|0,Kt&=67108863,d[0]=_t,d[1]=kt,d[2]=St,d[3]=Nt,d[4]=Dt,d[5]=Rt,d[6]=Ft,d[7]=Ut,d[8]=Gt,d[9]=Tt,d[10]=Lt,d[11]=Pt,d[12]=qt,d[13]=Ot,d[14]=Ht,d[15]=Yt,d[16]=jt,d[17]=Jt,d[18]=Kt,0!==u&&(d[19]=u,r.length++),r};function bigMulTo(e,t,r){r.negative=t.negative^e.negative,r.length=e.length+t.length;for(var a=0,n=0,o=0;o>>26)|0)>>>26,s&=67108863}r.words[o]=c,a=s,s=n}return 0!==a?r.words[o]=a:r.length--,r._strip()}function jumboMulTo(e,t,r){return bigMulTo(e,t,r)}function FFTM(e,t){this.x=e,this.y=t}Math.imul||(c=smallMulTo),BN.prototype.mulTo=function mulTo(e,t){var r=this.length+e.length;return 10===this.length&&10===e.length?c(this,e,t):r<63?smallMulTo(this,e,t):r<1024?bigMulTo(this,e,t):jumboMulTo(this,e,t)},FFTM.prototype.makeRBT=function makeRBT(e){for(var t=new Array(e),r=BN.prototype._countBits(e)-1,a=0;a>=1;return a},FFTM.prototype.permute=function permute(e,t,r,a,n,o){for(var s=0;s>>=1)n++;return 1<>>=13,r[2*o+1]=8191&n,n>>>=13;for(o=2*t;o>=26,r+=n/67108864|0,r+=o>>>26,this.words[a]=67108863&o}return 0!==r&&(this.words[a]=r,this.length++),t?this.ineg():this},BN.prototype.muln=function muln(e){return this.clone().imuln(e)},BN.prototype.sqr=function sqr(){return this.mul(this)},BN.prototype.isqr=function isqr(){return this.imul(this.clone())},BN.prototype.pow=function pow(e){var t=function toBitArray(e){for(var t=new Array(e.bitLength()),r=0;r>>n&1}return t}(e);if(0===t.length)return new BN(1);for(var r=this,a=0;a=0);var t,r=e%26,a=(e-r)/26,n=67108863>>>26-r<<26-r;if(0!==r){var o=0;for(t=0;t>>26-r}o&&(this.words[t]=o,this.length++)}if(0!==a){for(t=this.length-1;t>=0;t--)this.words[t+a]=this.words[t];for(t=0;t=0),a=t?(t-t%26)/26:0;var n=e%26,o=Math.min((e-n)/26,this.length),s=67108863^67108863>>>n<o)for(this.length-=o,d=0;d=0&&(0!==u||d>=a);d--){var h=0|this.words[d];this.words[d]=u<<26-n|h>>>n,u=h&s}return c&&0!==u&&(c.words[c.length++]=u),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},BN.prototype.ishrn=function ishrn(e,t,r){return assert(0===this.negative),this.iushrn(e,t,r)},BN.prototype.shln=function shln(e){return this.clone().ishln(e)},BN.prototype.ushln=function ushln(e){return this.clone().iushln(e)},BN.prototype.shrn=function shrn(e){return this.clone().ishrn(e)},BN.prototype.ushrn=function ushrn(e){return this.clone().iushrn(e)},BN.prototype.testn=function testn(e){assert("number"==typeof e&&e>=0);var t=e%26,r=(e-t)/26,a=1<=0);var t=e%26,r=(e-t)/26;if(assert(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==t&&r++,this.length=Math.min(r,this.length),0!==t){var a=67108863^67108863>>>t<=67108864;t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},BN.prototype.isubn=function isubn(e){if(assert("number"==typeof e),assert(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t>26)-(c/67108864|0),this.words[a+r]=67108863&n}for(;a>26,this.words[a+r]=67108863&n;if(0===s)return this._strip();for(assert(-1===s),s=0,a=0;a>26,this.words[a]=67108863&n;return this.negative=1,this._strip()},BN.prototype._wordDiv=function _wordDiv(e,t){var r=(this.length,e.length),a=this.clone(),n=e,o=0|n.words[n.length-1];0!==(r=26-this._countBits(o))&&(n=n.ushln(r),a.iushln(r),o=0|n.words[n.length-1]);var s,c=a.length-n.length;if("mod"!==t){(s=new BN(null)).length=c+1,s.words=new Array(s.length);for(var d=0;d=0;h--){var l=67108864*(0|a.words[n.length+h])+(0|a.words[n.length+h-1]);for(l=Math.min(l/o|0,67108863),a._ishlnsubmul(n,l,h);0!==a.negative;)l--,a.negative=0,a._ishlnsubmul(n,1,h),a.isZero()||(a.negative^=1);s&&(s.words[h]=l)}return s&&s._strip(),a._strip(),"div"!==t&&0!==r&&a.iushrn(r),{div:s||null,mod:a}},BN.prototype.divmod=function divmod(e,t,r){return assert(!e.isZero()),this.isZero()?{div:new BN(0),mod:new BN(0)}:0!==this.negative&&0===e.negative?(o=this.neg().divmod(e,t),"mod"!==t&&(a=o.div.neg()),"div"!==t&&(n=o.mod.neg(),r&&0!==n.negative&&n.iadd(e)),{div:a,mod:n}):0===this.negative&&0!==e.negative?(o=this.divmod(e.neg(),t),"mod"!==t&&(a=o.div.neg()),{div:a,mod:o.mod}):0!=(this.negative&e.negative)?(o=this.neg().divmod(e.neg(),t),"div"!==t&&(n=o.mod.neg(),r&&0!==n.negative&&n.isub(e)),{div:o.div,mod:n}):e.length>this.length||this.cmp(e)<0?{div:new BN(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new BN(this.modrn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new BN(this.modrn(e.words[0]))}:this._wordDiv(e,t);var a,n,o},BN.prototype.div=function div(e){return this.divmod(e,"div",!1).div},BN.prototype.mod=function mod(e){return this.divmod(e,"mod",!1).mod},BN.prototype.umod=function umod(e){return this.divmod(e,"mod",!0).mod},BN.prototype.divRound=function divRound(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var r=0!==t.div.negative?t.mod.isub(e):t.mod,a=e.ushrn(1),n=e.andln(1),o=r.cmp(a);return o<0||1===n&&0===o?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},BN.prototype.modrn=function modrn(e){var t=e<0;t&&(e=-e),assert(e<=67108863);for(var r=(1<<26)%e,a=0,n=this.length-1;n>=0;n--)a=(r*a+(0|this.words[n]))%e;return t?-a:a},BN.prototype.modn=function modn(e){return this.modrn(e)},BN.prototype.idivn=function idivn(e){var t=e<0;t&&(e=-e),assert(e<=67108863);for(var r=0,a=this.length-1;a>=0;a--){var n=(0|this.words[a])+67108864*r;this.words[a]=n/e|0,r=n%e}return this._strip(),t?this.ineg():this},BN.prototype.divn=function divn(e){return this.clone().idivn(e)},BN.prototype.egcd=function egcd(e){assert(0===e.negative),assert(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var a=new BN(1),n=new BN(0),o=new BN(0),s=new BN(1),c=0;t.isEven()&&r.isEven();)t.iushrn(1),r.iushrn(1),++c;for(var d=r.clone(),u=t.clone();!t.isZero();){for(var h=0,l=1;0==(t.words[0]&l)&&h<26;++h,l<<=1);if(h>0)for(t.iushrn(h);h-- >0;)(a.isOdd()||n.isOdd())&&(a.iadd(d),n.isub(u)),a.iushrn(1),n.iushrn(1);for(var b=0,g=1;0==(r.words[0]&g)&&b<26;++b,g<<=1);if(b>0)for(r.iushrn(b);b-- >0;)(o.isOdd()||s.isOdd())&&(o.iadd(d),s.isub(u)),o.iushrn(1),s.iushrn(1);t.cmp(r)>=0?(t.isub(r),a.isub(o),n.isub(s)):(r.isub(t),o.isub(a),s.isub(n))}return{a:o,b:s,gcd:r.iushln(c)}},BN.prototype._invmp=function _invmp(e){assert(0===e.negative),assert(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var a,n=new BN(1),o=new BN(0),s=r.clone();t.cmpn(1)>0&&r.cmpn(1)>0;){for(var c=0,d=1;0==(t.words[0]&d)&&c<26;++c,d<<=1);if(c>0)for(t.iushrn(c);c-- >0;)n.isOdd()&&n.iadd(s),n.iushrn(1);for(var u=0,h=1;0==(r.words[0]&h)&&u<26;++u,h<<=1);if(u>0)for(r.iushrn(u);u-- >0;)o.isOdd()&&o.iadd(s),o.iushrn(1);t.cmp(r)>=0?(t.isub(r),n.isub(o)):(r.isub(t),o.isub(n))}return(a=0===t.cmpn(1)?n:o).cmpn(0)<0&&a.iadd(e),a},BN.prototype.gcd=function gcd(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),r=e.clone();t.negative=0,r.negative=0;for(var a=0;t.isEven()&&r.isEven();a++)t.iushrn(1),r.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=t.cmp(r);if(n<0){var o=t;t=r,r=o}else if(0===n||0===r.cmpn(1))break;t.isub(r)}return r.iushln(a)},BN.prototype.invm=function invm(e){return this.egcd(e).a.umod(e)},BN.prototype.isEven=function isEven(){return 0==(1&this.words[0])},BN.prototype.isOdd=function isOdd(){return 1==(1&this.words[0])},BN.prototype.andln=function andln(e){return this.words[0]&e},BN.prototype.bincn=function bincn(e){assert("number"==typeof e);var t=e%26,r=(e-t)/26,a=1<>>26,s&=67108863,this.words[o]=s}return 0!==n&&(this.words[o]=n,this.length++),this},BN.prototype.isZero=function isZero(){return 1===this.length&&0===this.words[0]},BN.prototype.cmpn=function cmpn(e){var t,r=e<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this._strip(),this.length>1)t=1;else{r&&(e=-e),assert(e<=67108863,"Number is too big");var a=0|this.words[0];t=a===e?0:ae.length)return 1;if(this.length=0;r--){var a=0|this.words[r],n=0|e.words[r];if(a!==n){an&&(t=1);break}}return t},BN.prototype.gtn=function gtn(e){return 1===this.cmpn(e)},BN.prototype.gt=function gt(e){return 1===this.cmp(e)},BN.prototype.gten=function gten(e){return this.cmpn(e)>=0},BN.prototype.gte=function gte(e){return this.cmp(e)>=0},BN.prototype.ltn=function ltn(e){return-1===this.cmpn(e)},BN.prototype.lt=function lt(e){return-1===this.cmp(e)},BN.prototype.lten=function lten(e){return this.cmpn(e)<=0},BN.prototype.lte=function lte(e){return this.cmp(e)<=0},BN.prototype.eqn=function eqn(e){return 0===this.cmpn(e)},BN.prototype.eq=function eq(e){return 0===this.cmp(e)},BN.red=function red(e){return new Red(e)},BN.prototype.toRed=function toRed(e){return assert(!this.red,"Already a number in reduction context"),assert(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},BN.prototype.fromRed=function fromRed(){return assert(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},BN.prototype._forceRed=function _forceRed(e){return this.red=e,this},BN.prototype.forceRed=function forceRed(e){return assert(!this.red,"Already a number in reduction context"),this._forceRed(e)},BN.prototype.redAdd=function redAdd(e){return assert(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},BN.prototype.redIAdd=function redIAdd(e){return assert(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},BN.prototype.redSub=function redSub(e){return assert(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},BN.prototype.redISub=function redISub(e){return assert(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},BN.prototype.redShl=function redShl(e){return assert(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},BN.prototype.redMul=function redMul(e){return assert(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},BN.prototype.redIMul=function redIMul(e){return assert(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},BN.prototype.redSqr=function redSqr(){return assert(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},BN.prototype.redISqr=function redISqr(){return assert(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},BN.prototype.redSqrt=function redSqrt(){return assert(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},BN.prototype.redInvm=function redInvm(){return assert(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},BN.prototype.redNeg=function redNeg(){return assert(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},BN.prototype.redPow=function redPow(e){return assert(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var d={k256:null,p224:null,p192:null,p25519:null};function MPrime(e,t){this.name=e,this.p=new BN(t,16),this.n=this.p.bitLength(),this.k=new BN(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function K256(){MPrime.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function P224(){MPrime.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function P192(){MPrime.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function P25519(){MPrime.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function Red(e){if("string"==typeof e){var t=BN._prime(e);this.m=t.p,this.prime=t}else assert(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function Mont(e){Red.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new BN(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)}MPrime.prototype._tmp=function _tmp(){var e=new BN(null);return e.words=new Array(Math.ceil(this.n/13)),e},MPrime.prototype.ireduce=function ireduce(e){var t,r=e;do{this.split(r,this.tmp),t=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(t>this.n);var a=t0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},MPrime.prototype.split=function split(e,t){e.iushrn(this.n,0,t)},MPrime.prototype.imulK=function imulK(e){return e.imul(this.k)},inherits(K256,MPrime),K256.prototype.split=function split(e,t){for(var r=4194303,a=Math.min(e.length,9),n=0;n>>22,o=s}o>>>=22,e.words[n-10]=o,0===o&&e.length>10?e.length-=10:e.length-=9},K256.prototype.imulK=function imulK(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,r=0;r>>=26,e.words[r]=n,t=a}return 0!==t&&(e.words[e.length++]=t),e},BN._prime=function prime(e){if(d[e])return d[e];var prime;if("k256"===e)prime=new K256;else if("p224"===e)prime=new P224;else if("p192"===e)prime=new P192;else{if("p25519"!==e)throw new Error("Unknown prime "+e);prime=new P25519}return d[e]=prime,prime},Red.prototype._verify1=function _verify1(e){assert(0===e.negative,"red works only with positives"),assert(e.red,"red works only with red numbers")},Red.prototype._verify2=function _verify2(e,t){assert(0==(e.negative|t.negative),"red works only with positives"),assert(e.red&&e.red===t.red,"red works only with red numbers")},Red.prototype.imod=function imod(e){return this.prime?this.prime.ireduce(e)._forceRed(this):(move(e,e.umod(this.m)._forceRed(this)),e)},Red.prototype.neg=function neg(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},Red.prototype.add=function add(e,t){this._verify2(e,t);var r=e.add(t);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},Red.prototype.iadd=function iadd(e,t){this._verify2(e,t);var r=e.iadd(t);return r.cmp(this.m)>=0&&r.isub(this.m),r},Red.prototype.sub=function sub(e,t){this._verify2(e,t);var r=e.sub(t);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},Red.prototype.isub=function isub(e,t){this._verify2(e,t);var r=e.isub(t);return r.cmpn(0)<0&&r.iadd(this.m),r},Red.prototype.shl=function shl(e,t){return this._verify1(e),this.imod(e.ushln(t))},Red.prototype.imul=function imul(e,t){return this._verify2(e,t),this.imod(e.imul(t))},Red.prototype.mul=function mul(e,t){return this._verify2(e,t),this.imod(e.mul(t))},Red.prototype.isqr=function isqr(e){return this.imul(e,e.clone())},Red.prototype.sqr=function sqr(e){return this.mul(e,e)},Red.prototype.sqrt=function sqrt(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(assert(t%2==1),3===t){var r=this.m.add(new BN(1)).iushrn(2);return this.pow(e,r)}for(var a=this.m.subn(1),n=0;!a.isZero()&&0===a.andln(1);)n++,a.iushrn(1);assert(!a.isZero());var o=new BN(1).toRed(this),s=o.redNeg(),c=this.m.subn(1).iushrn(1),d=this.m.bitLength();for(d=new BN(2*d*d).toRed(this);0!==this.pow(d,c).cmp(s);)d.redIAdd(s);for(var u=this.pow(d,a),h=this.pow(e,a.addn(1).iushrn(1)),l=this.pow(e,a),b=n;0!==l.cmp(o);){for(var g=l,p=0;0!==g.cmp(o);p++)g=g.redSqr();assert(p=0;a--){for(var d=t.words[a],u=c-1;u>=0;u--){var h=d>>u&1;n!==r[0]&&(n=this.sqr(n)),0!==h||0!==o?(o<<=1,o|=h,(4===++s||0===a&&0===u)&&(n=this.mul(n,r[o]),s=0,o=0)):s=0}c=26}return n},Red.prototype.convertTo=function convertTo(e){var t=e.umod(this.m);return t===e?t.clone():t},Red.prototype.convertFrom=function convertFrom(e){var t=e.clone();return t.red=null,t},BN.mont=function mont(e){return new Mont(e)},inherits(Mont,Red),Mont.prototype.convertTo=function convertTo(e){return this.imod(e.ushln(this.shift))},Mont.prototype.convertFrom=function convertFrom(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},Mont.prototype.imul=function imul(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var r=e.imul(t),a=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(a).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},Mont.prototype.mul=function mul(e,t){if(e.isZero()||t.isZero())return new BN(0)._forceRed(this);var r=e.mul(t),a=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(a).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},Mont.prototype.invm=function invm(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(e=r.nmd(e),this)},function(e,t,r){"use strict";var a=r(2).Buffer,n=this&&this.__createBinding||(Object.create?function(e,t,r,a){void 0===a&&(a=r),Object.defineProperty(e,a,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,a){void 0===a&&(a=r),e[a]=t[r]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),s=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.hasOwnProperty.call(e,r)&&n(t,e,r);return o(t,e),t},c=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.defineProperties=void 0;var d=c(r(6)),u=s(r(195)),h=s(r(354)),l=r(76);t.defineProperties=function(e,t,r){if(e.raw=[],e._fields=[],e.toJSON=function(t){if(void 0===t&&(t=!1),t){var r={};return e._fields.forEach((function(t){r[t]="0x"+e[t].toString("hex")})),r}return l.baToJSON(e.raw)},e.serialize=function serialize(){return h.encode(e.raw)},t.forEach((function(t,r){function getter(){return e.raw[r]}function setter(n){"00"!==(n=l.toBuffer(n)).toString("hex")||t.allowZero||(n=a.allocUnsafe(0)),t.allowLess&&t.length?(n=l.unpadBuffer(n),d.default(t.length>=n.length,"The field "+t.name+" must not have more "+t.length+" bytes")):t.allowZero&&0===n.length||!t.length||d.default(t.length===n.length,"The field "+t.name+" must have byte length of "+t.length),e.raw[r]=n}e._fields.push(t.name),Object.defineProperty(e,t.name,{enumerable:!0,configurable:!0,get:getter,set:setter}),t.default&&(e[t.name]=t.default),t.alias&&Object.defineProperty(e,t.alias,{enumerable:!1,configurable:!0,set:setter,get:getter})})),r)if("string"==typeof r&&(r=a.from(u.stripHexPrefix(r),"hex")),a.isBuffer(r)&&(r=h.decode(r)),Array.isArray(r)){if(r.length>e._fields.length)throw new Error("wrong number of fields in data");r.forEach((function(t,r){e[e._fields[r]]=l.toBuffer(t)}))}else{if("object"!=typeof r)throw new Error("invalid data");var n=Object.keys(r);t.forEach((function(t){-1!==n.indexOf(t.name)&&(e[t.name]=r[t.name]),-1!==n.indexOf(t.alias)&&(e[t.alias]=r[t.alias])}))}}},function(e,t,r){"use strict";var a=this&&this.__createBinding||(Object.create?function(e,t,r,a){void 0===a&&(a=r),Object.defineProperty(e,a,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,a){void 0===a&&(a=r),e[a]=t[r]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.hasOwnProperty.call(e,r)&&a(t,e,r);return n(t,e),t},s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.rlp=t.BN=void 0;var c=s(r(134));t.BN=c.default;var d=o(r(354));t.rlp=d},function(e,t,r){"use strict";var a=r(0).Buffer,n=this&&this.__createBinding||(Object.create?function(e,t,r,a){void 0===a&&(a=r),Object.defineProperty(e,a,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,a){void 0===a&&(a=r),e[a]=t[r]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),s=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.hasOwnProperty.call(e,r)&&n(t,e,r);return o(t,e),t},c=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.defineProperties=void 0;var d=c(r(6)),u=s(r(62)),h=s(r(41)),l=r(78);t.defineProperties=function(e,t,r){if(e.raw=[],e._fields=[],e.toJSON=function(t){if(void 0===t&&(t=!1),t){var r={};return e._fields.forEach((function(t){r[t]="0x"+e[t].toString("hex")})),r}return l.baToJSON(e.raw)},e.serialize=function serialize(){return h.encode(e.raw)},t.forEach((function(t,r){function getter(){return e.raw[r]}function setter(n){"00"!==(n=l.toBuffer(n)).toString("hex")||t.allowZero||(n=a.allocUnsafe(0)),t.allowLess&&t.length?(n=l.unpadBuffer(n),d.default(t.length>=n.length,"The field "+t.name+" must not have more "+t.length+" bytes")):t.allowZero&&0===n.length||!t.length||d.default(t.length===n.length,"The field "+t.name+" must have byte length of "+t.length),e.raw[r]=n}e._fields.push(t.name),Object.defineProperty(e,t.name,{enumerable:!0,configurable:!0,get:getter,set:setter}),t.default&&(e[t.name]=t.default),t.alias&&Object.defineProperty(e,t.alias,{enumerable:!1,configurable:!0,set:setter,get:getter})})),r)if("string"==typeof r&&(r=a.from(u.stripHexPrefix(r),"hex")),a.isBuffer(r)&&(r=h.decode(r)),Array.isArray(r)){if(r.length>e._fields.length)throw new Error("wrong number of fields in data");r.forEach((function(t,r){e[e._fields[r]]=l.toBuffer(t)}))}else{if("object"!=typeof r)throw new Error("invalid data");var n=Object.keys(r);t.forEach((function(t){-1!==n.indexOf(t.name)&&(e[t.name]=r[t.name]),-1!==n.indexOf(t.alias)&&(e[t.alias]=r[t.alias])}))}}},function(e,t,r){"use strict";var a=this&&this.__createBinding||(Object.create?function(e,t,r,a){void 0===a&&(a=r),Object.defineProperty(e,a,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,a){void 0===a&&(a=r),e[a]=t[r]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.hasOwnProperty.call(e,r)&&a(t,e,r);return n(t,e),t},s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.rlp=t.BN=void 0;var c=s(r(48));t.BN=c.default;var d=o(r(41));t.rlp=d},function(e,t,r){"use strict";var a,n,o,s,c,d,u,h,l,b,g,p,B,m,I,y,v,x,C,Q,w,_,k=r(0).Buffer,N=this&&this.__classPrivateFieldSet||function(e,t,r){if(!t.has(e))throw new TypeError("attempted to set private field on non-instance");return t.set(e,r),r},D=this&&this.__classPrivateFieldGet||function(e,t){if(!t.has(e))throw new TypeError("attempted to get private field on non-instance");return t.get(e)},U=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.Capacity=void 0;const G=r(14),T=r(8),L=r(46),P=r(166),q=U(r(178)),O=U(r(1382)),H=r(18),Y=r(1021);var j;!function(e){e[e.FillBlock=-1]="FillBlock",e[e.Empty=0]="Empty",e[e.Single=1]="Single"}(j=t.Capacity||(t.Capacity={}));const updateBloom=(e,t)=>{let r=256;for(;--r;)e[r]|=t[r]},sortByPrice=(e,t,r)=>e[t].effectiveGasPrice>e[r].effectiveGasPrice,refresher=(e,t)=>e.updateEffectiveGasPrice(t);class Miner extends q.default.Typed{constructor(e,t,r,U){super(),a.set(this,0n),n.set(this,new Set),o.set(this,void 0),s.set(this,!1),c.set(this,!1),d.set(this,void 0),u.set(this,void 0),h.set(this,void 0),l.set(this,!1),b.set(this,void 0),g.set(this,void 0),p.set(this,void 0),B.set(this,void 0),m.set(this,new T.Heap(sortByPrice,refresher)),I.set(this,(async(e,t=j.FillBlock,r=!1)=>{const{block:a,transactions:n}=await D(this,y).call(this,e,t,r);if(D(this,o)&&(D(this,Q).call(this),N(this,o,!1),!r&&D(this,m).length>0)){const e=D(this,B).call(this,a);await D(this,I).call(this,e,t)}return n})),y.set(this,(async(e,t,r)=>{let n;const o=D(this,p),{pending:c,inProgress:d}=D(this,b),h=D(this,g);let l=!0;const I=D(this,m),y=D(this,g).legacyInstamine,Q=new Map;let _;do{l=!1,N(this,s,!0),_=[];const b=new P.BaseTrie(null,null),g=new P.BaseTrie(null,null);if(t===j.Empty){await o.stateManager.checkpoint(),await o.stateManager.commit();const t=e.finalize(b.root,g.root,T.BUFFER_256_ZERO,o.stateManager._trie.root,0n,h.extraData,[],Q);return this.emit("block",t),D(this,C).call(this),{block:t.block,transactions:[]}}let p=0,m=h.blockGasLimit.toBigInt(),U=0n;const q=k.allocUnsafe(256).fill(0),Y=[];await o.stateManager.checkpoint();const J=G.TraceDataFactory(),stepListener=(e,t)=>{if("SSTORE"===e.opcode.name){const t=J.from(e.stack[e.stack.length-1].toArrayLike(k)).toBuffer(),r=T.keccak(t);Q.set(r.toString(),{key:t,hashedKey:r})}t()};let z;for(o.on("step",stepListener);z=I.peek();){const r=z.from.toString();if(z.calculateIntrinsicGas()>m){z.locked=!1,D(this,x).call(this,r);continue}N(this,a,z.effectiveGasPrice.toBigInt()),await o.stateManager.checkpoint(),o.stateManager._trie.blockNumber=T.Quantity.from(e.header.number.toArrayLike(k));const n=await D(this,v).call(this,z,e,r,c);if(null!==n){const e=T.Quantity.from(n.gasUsed.toArrayLike(k)).toBigInt();if(m>=e){await o.stateManager.commit(),_[p]=z,m-=e,U+=e;const a=L.encode(0===p?T.BUFFER_EMPTY:T.uintToBuffer(p));Y.push(b.put(a,z.serialized));const s=z.fillFromResult(n,U);Y.push(g.put(a,s)),updateBloom(q,n.bloom.bitvector),p++;const u=c.get(r);if(l=u.removeBest(),d.add(z),z.once("finalized").then((()=>{d.delete(z)})),m<=H.Params.TRANSACTION_GAS||p===t){l=l?O.default(I,u):D(this,x).call(this,r);break}l=l?O.default(I,u):D(this,x).call(this,r)}else await o.stateManager.revert(),z.locked=!1,l=I.removeBest()}else await o.stateManager.revert()}await Promise.all(Y),await o.stateManager.commit(),o.removeListener("step",stepListener);const W=e.finalize(b.root,g.root,q,o.stateManager._trie.root,U,h.extraData,_,Q);n=W.block;const V=this.emit("block",W);if(!0===y&&await V,r){N(this,a,0n),D(this,C).call(this);break}N(this,a,0n),D(this,w).call(this),0!==I.length?(e=D(this,B).call(this,n),void 0!==D(this,u)&&I.refresh(D(this,u))):D(this,C).call(this)}while(l);return{block:n,transactions:_}})),v.set(this,(async(e,t,r,a)=>{const n={},o=D(this,p);this.emit("ganache:vm:tx:before",{context:n});const stepListener=e=>{D(this,l)&&this.emit("ganache:vm:tx:step",Y.makeStepEvent(n,e))};o.on("step",stepListener);try{return await o.runTx({tx:e.toVmTransaction(),block:t})}catch(t){const n=t.message,o=a.get(r);o.removeBest()?O.default(D(this,m),o):D(this,x).call(this,r);const s={execResult:{runState:{programCounter:0},exceptionError:{error:n},returnValue:T.BUFFER_EMPTY}},c=new G.RuntimeError(e.hash,s,G.RETURN_TYPES.TRANSACTION_HASH);return e.finalize("rejected",c),null}finally{o.removeListener("step",stepListener),this.emit("ganache:vm:tx:after",{context:n})}})),x.set(this,(e=>(D(this,n).delete(e),D(this,m).removeBest()))),C.set(this,(()=>{D(this,n).clear(),D(this,m).clear(),N(this,s,!1)})),Q.set(this,(()=>{const{pending:e}=D(this,b),t=D(this,n),r=D(this,m);for(let a of e){const e=a[1].peek();if(e&&!e.locked){const a=e.from.toString();t.add(a),e.updateEffectiveGasPrice(D(this,u)),r.push(e),e.locked=!0}}})),w.set(this,(()=>{const{pending:e}=D(this,b),t=D(this,n),r=D(this,m);for(let n of e){const e=n[1].peek();if(e&&!e.locked){const n=e.effectiveGasPrice.toBigInt();if(D(this,a)>n)continue;const o=e.from.toString();if(t.has(o))continue;t.add(o),e.updateEffectiveGasPrice(D(this,u)),r.push(e),e.locked=!0}}})),_.set(this,(e=>{const t=e.header.baseFeePerGas;N(this,u,void 0===t?void 0:T.Quantity.from(t.buf))})),N(this,p,r),N(this,g,e),N(this,b,t),N(this,B,(e=>{const t=U(e);return D(this,_).call(this,t),t})),D(this,m).init([])}async pause(){D(this,c)||(N(this,c,!0),N(this,d,new Promise((e=>{N(this,h,e)})))),D(this,s)&&await this.once("idle")}resume(){D(this,c)&&(N(this,c,!1),D(this,h).call(this))}async mine(e,t=j.FillBlock,r=!1){if(D(this,c)&&await D(this,d),D(this,s))return N(this,o,!0),void D(this,w).call(this);{D(this,_).call(this,e),D(this,Q).call(this);const a=await D(this,I).call(this,e,t,r);return this.emit("idle"),a}}toggleStepEvent(e){N(this,l,e)}}t.default=Miner,a=new WeakMap,n=new WeakMap,o=new WeakMap,s=new WeakMap,c=new WeakMap,d=new WeakMap,u=new WeakMap,h=new WeakMap,l=new WeakMap,b=new WeakMap,g=new WeakMap,p=new WeakMap,B=new WeakMap,m=new WeakMap,I=new WeakMap,y=new WeakMap,v=new WeakMap,x=new WeakMap,C=new WeakMap,Q=new WeakMap,w=new WeakMap,_=new WeakMap},function(e,t,r){"use strict";var a=r(0).Buffer,n=this&&this.__createBinding||(Object.create?function(e,t,r,a){void 0===a&&(a=r),Object.defineProperty(e,a,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,a){void 0===a&&(a=r),e[a]=t[r]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),s=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.hasOwnProperty.call(e,r)&&n(t,e,r);return o(t,e),t},c=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.defineProperties=void 0;var d=c(r(6)),u=s(r(62)),h=s(r(41)),l=r(79);t.defineProperties=function(e,t,r){if(e.raw=[],e._fields=[],e.toJSON=function(t){if(void 0===t&&(t=!1),t){var r={};return e._fields.forEach((function(t){r[t]="0x"+e[t].toString("hex")})),r}return l.baToJSON(e.raw)},e.serialize=function serialize(){return h.encode(e.raw)},t.forEach((function(t,r){function getter(){return e.raw[r]}function setter(n){"00"!==(n=l.toBuffer(n)).toString("hex")||t.allowZero||(n=a.allocUnsafe(0)),t.allowLess&&t.length?(n=l.unpadBuffer(n),d.default(t.length>=n.length,"The field "+t.name+" must not have more "+t.length+" bytes")):t.allowZero&&0===n.length||!t.length||d.default(t.length===n.length,"The field "+t.name+" must have byte length of "+t.length),e.raw[r]=n}e._fields.push(t.name),Object.defineProperty(e,t.name,{enumerable:!0,configurable:!0,get:getter,set:setter}),t.default&&(e[t.name]=t.default),t.alias&&Object.defineProperty(e,t.alias,{enumerable:!1,configurable:!0,set:setter,get:getter})})),r)if("string"==typeof r&&(r=a.from(u.stripHexPrefix(r),"hex")),a.isBuffer(r)&&(r=h.decode(r)),Array.isArray(r)){if(r.length>e._fields.length)throw new Error("wrong number of fields in data");r.forEach((function(t,r){e[e._fields[r]]=l.toBuffer(t)}))}else{if("object"!=typeof r)throw new Error("invalid data");var n=Object.keys(r);t.forEach((function(t){-1!==n.indexOf(t.name)&&(e[t.name]=r[t.name]),-1!==n.indexOf(t.alias)&&(e[t.alias]=r[t.alias])}))}}},function(e,t,r){"use strict";var a=this&&this.__createBinding||(Object.create?function(e,t,r,a){void 0===a&&(a=r),Object.defineProperty(e,a,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,a){void 0===a&&(a=r),e[a]=t[r]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.hasOwnProperty.call(e,r)&&a(t,e,r);return n(t,e),t},s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.rlp=t.BN=void 0;var c=s(r(48));t.BN=c.default;var d=o(r(41));t.rlp=d},function(e,t,r){"use strict";var a,n=r(0).Buffer,o=this&&this.__extends||(a=function(e,t){return(a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function __(){this.constructor=e}a(e,t),e.prototype=null===t?Object.create(t):(__.prototype=t.prototype,new __)}),s=this&&this.__awaiter||function(e,t,r,a){return new(r||(r=Promise))((function(n,o){function fulfilled(e){try{step(a.next(e))}catch(e){o(e)}}function rejected(e){try{step(a.throw(e))}catch(e){o(e)}}function step(e){e.done?n(e.value):function adopt(e){return e instanceof r?e:new r((function(t){t(e)}))}(e.value).then(fulfilled,rejected)}step((a=a.apply(e,t||[])).next())}))},c=this&&this.__generator||function(e,t){var r,a,n,o,s={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return o={next:verb(0),throw:verb(1),return:verb(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function verb(o){return function(c){return function step(o){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,a&&(n=2&o[0]?a.return:o[0]?a.throw||((n=a.return)&&n.call(a),0):a.next)&&!(n=n.call(a,o[1])).done)return n;switch(a=0,n&&(o=[2&o[0],n.value]),o[0]){case 0:case 1:n=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,a=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(n=s.trys,(n=n.length>0&&n[n.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!n||o[1]>n[0]&&o[1]=e.length&&(e=void 0),{value:e&&e[a++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0}),t.CheckpointDB=void 0;var u=r(117),h=function(e){function CheckpointDB(t){var r=e.call(this,t)||this;return r.checkpoints=[],r}return o(CheckpointDB,e),Object.defineProperty(CheckpointDB.prototype,"isCheckpoint",{get:function(){return this.checkpoints.length>0},enumerable:!1,configurable:!0}),CheckpointDB.prototype.checkpoint=function(e){this.checkpoints.push({keyValueMap:new Map,root:e})},CheckpointDB.prototype.commit=function(){return s(this,void 0,void 0,(function(){var e,t,r;return c(this,(function(a){switch(a.label){case 0:return e=this.checkpoints.pop().keyValueMap,this.isCheckpoint?[3,2]:(t=[],e.forEach((function(e,r){null===e?t.push({type:"del",key:n.from(r,"binary")}):t.push({type:"put",key:n.from(r,"binary"),value:e})})),[4,this.batch(t)]);case 1:return a.sent(),[3,3];case 2:r=this.checkpoints[this.checkpoints.length-1].keyValueMap,e.forEach((function(e,t){return r.set(t,e)})),a.label=3;case 3:return[2]}}))}))},CheckpointDB.prototype.revert=function(){return s(this,void 0,void 0,(function(){return c(this,(function(e){return[2,this.checkpoints.pop().root]}))}))},CheckpointDB.prototype.get=function(t){return s(this,void 0,void 0,(function(){var r,a,n;return c(this,(function(o){switch(o.label){case 0:for(r=this.checkpoints.length-1;r>=0;r--)if(void 0!==(a=this.checkpoints[r].keyValueMap.get(t.toString("binary"))))return[2,a];return[4,e.prototype.get.call(this,t)];case 1:return n=o.sent(),this.isCheckpoint&&this.checkpoints[this.checkpoints.length-1].keyValueMap.set(t.toString("binary"),n),[2,n]}}))}))},CheckpointDB.prototype.put=function(t,r){return s(this,void 0,void 0,(function(){return c(this,(function(a){switch(a.label){case 0:return this.isCheckpoint?(this.checkpoints[this.checkpoints.length-1].keyValueMap.set(t.toString("binary"),r),[3,3]):[3,1];case 1:return[4,e.prototype.put.call(this,t,r)];case 2:a.sent(),a.label=3;case 3:return[2]}}))}))},CheckpointDB.prototype.del=function(e){return s(this,void 0,void 0,(function(){return c(this,(function(t){switch(t.label){case 0:return this.isCheckpoint?(this.checkpoints[this.checkpoints.length-1].keyValueMap.set(e.toString("binary"),null),[3,3]):[3,1];case 1:return[4,this._leveldb.del(e,u.ENCODING_OPTS)];case 2:t.sent(),t.label=3;case 3:return[2]}}))}))},CheckpointDB.prototype.batch=function(t){return s(this,void 0,void 0,(function(){var r,a,n,o,s,u;return c(this,(function(c){switch(c.label){case 0:if(!this.isCheckpoint)return[3,11];c.label=1;case 1:c.trys.push([1,8,9,10]),r=d(t),a=r.next(),c.label=2;case 2:return a.done?[3,7]:"put"!==(n=a.value).type?[3,4]:[4,this.put(n.key,n.value)];case 3:return c.sent(),[3,6];case 4:return"del"!==n.type?[3,6]:[4,this.del(n.key)];case 5:c.sent(),c.label=6;case 6:return a=r.next(),[3,2];case 7:return[3,10];case 8:return o=c.sent(),s={error:o},[3,10];case 9:try{a&&!a.done&&(u=r.return)&&u.call(r)}finally{if(s)throw s.error}return[7];case 10:return[3,13];case 11:return[4,e.prototype.batch.call(this,t)];case 12:c.sent(),c.label=13;case 13:return[2]}}))}))},CheckpointDB}(u.DB);t.CheckpointDB=h},function(e,t,r){"use strict";var a=this&&this.__createBinding||(Object.create?function(e,t,r,a){void 0===a&&(a=r),Object.defineProperty(e,a,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,a){void 0===a&&(a=r),e[a]=t[r]}),n=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||t.hasOwnProperty(r)||a(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0});var o=r(211);Object.defineProperty(t,"Transaction",{enumerable:!0,get:function(){return o.default}});var s=r(213);Object.defineProperty(t,"AccessListEIP2930Transaction",{enumerable:!0,get:function(){return s.default}});var c=r(1437);Object.defineProperty(t,"TransactionFactory",{enumerable:!0,get:function(){return c.default}});var d=r(214);Object.defineProperty(t,"FeeMarketEIP1559Transaction",{enumerable:!0,get:function(){return d.default}}),n(r(212),t)},function(e,t,r){"use strict";var a=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],a=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&a>=e.length&&(e=void 0),{value:e&&e[a++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},n=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var a,n,o=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(a=o.next()).done;)s.push(a.value)}catch(e){n={error:e}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return s},o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.BaseTransaction=void 0;var s=o(r(44)),c=r(5),d=r(212),u=function(){function BaseTransaction(e){this.activeCapabilities=[],this.DEFAULT_CHAIN="mainnet",this.DEFAULT_HARDFORK="istanbul";var t=e.nonce,r=e.gasLimit,a=e.to,n=e.value,o=e.data,s=e.v,d=e.r,u=e.s,h=e.type;this._type=new c.BN(c.toBuffer(h)).toNumber();var l=c.toBuffer(""===a?"0x":a),b=c.toBuffer(""===s?"0x":s),g=c.toBuffer(""===d?"0x":d),p=c.toBuffer(""===u?"0x":u);this.nonce=new c.BN(c.toBuffer(""===t?"0x":t)),this.gasLimit=new c.BN(c.toBuffer(""===r?"0x":r)),this.to=l.length>0?new c.Address(l):void 0,this.value=new c.BN(c.toBuffer(""===n?"0x":n)),this.data=c.toBuffer(""===o?"0x":o),this.v=b.length>0?new c.BN(b):void 0,this.r=g.length>0?new c.BN(g):void 0,this.s=p.length>0?new c.BN(p):void 0,this._validateCannotExceedMaxInteger({nonce:this.nonce,gasLimit:this.gasLimit,value:this.value,r:this.r,s:this.s})}return Object.defineProperty(BaseTransaction.prototype,"transactionType",{get:function(){return this.type},enumerable:!1,configurable:!0}),Object.defineProperty(BaseTransaction.prototype,"type",{get:function(){return this._type},enumerable:!1,configurable:!0}),BaseTransaction.prototype.supports=function(e){return this.activeCapabilities.includes(e)},BaseTransaction.prototype.validate=function(e){void 0===e&&(e=!1);var t=[];return this.getBaseFee().gt(this.gasLimit)&&t.push("gasLimit is too low. given "+this.gasLimit+", need at least "+this.getBaseFee()),this.isSigned()&&!this.verifySignature()&&t.push("Invalid Signature"),e?t:0===t.length},BaseTransaction.prototype.getBaseFee=function(){var e=this.getDataFee().addn(this.common.param("gasPrices","tx"));return this.common.gteHardfork("homestead")&&this.toCreationAddress()&&e.iaddn(this.common.param("gasPrices","txCreation")),e},BaseTransaction.prototype.getDataFee=function(){for(var e=this.common.param("gasPrices","txDataZero"),t=this.common.param("gasPrices","txDataNonZero"),r=0,a=0;a-1&&this.activeCapabilities.splice(h,1)}return u},BaseTransaction.prototype._getCommon=function(e,t){var r;if(t){var a=new c.BN(c.toBuffer(t));if(e){if(!e.chainIdBN().eq(a))throw new Error("The chain ID does not match the chain ID of Common");return e.copy()}return s.default.isSupportedChainId(a)?new s.default({chain:a,hardfork:this.DEFAULT_HARDFORK}):s.default.forCustomChain(this.DEFAULT_CHAIN,{name:"custom-chain",networkId:a,chainId:a},this.DEFAULT_HARDFORK)}return null!==(r=null==e?void 0:e.copy())&&void 0!==r?r:new s.default({chain:this.DEFAULT_CHAIN,hardfork:this.DEFAULT_HARDFORK})},BaseTransaction.prototype._validateCannotExceedMaxInteger=function(e,t){var r,o;void 0===t&&(t=53);try{for(var s=a(Object.entries(e)),d=s.next();!d.done;d=s.next()){var u=n(d.value,2),h=u[0],l=u[1];if(53===t){if(null==l?void 0:l.gt(c.MAX_INTEGER))throw new Error(h+" cannot exceed MAX_INTEGER, given "+l)}else{if(256!==t)throw new Error("unimplemented bits value");if(null==l?void 0:l.gte(c.TWO_POW256))throw new Error(h+" must be less than 2^256, given "+l)}}}catch(e){r={error:e}}finally{try{d&&!d.done&&(o=s.return)&&o.call(s)}finally{if(r)throw r.error}}},BaseTransaction}();t.BaseTransaction=u},(e,t,r)=>{var a=r(118);e.exports=!a((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]}))},function(e,t,r){"use strict";var a=r(0).Buffer,n=this&&this.__assign||function(){return(n=Object.assign||function(e){for(var t,r=1,a=arguments.length;r0&&n[n.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!n||o[1]>n[0]&&o[1] "+this._gasLeft+")"),this._gasLeft.ltn(0)&&(this._gasLeft=new u.BN(0),trap(h.ERROR.OUT_OF_GAS))},EEI.prototype.refundGas=function(e,t){this._evm._vm.DEBUG&&b((t?t+": ":"")+"refund "+e+" gas (-> "+this._evm._refund+")"),this._evm._refund.iadd(e)},EEI.prototype.subRefund=function(e,t){this._evm._vm.DEBUG&&b((t?t+": ":"")+"sub gas refund "+e+" (-> "+this._evm._refund+")"),this._evm._refund.isub(e),this._evm._refund.ltn(0)&&(this._evm._refund=new u.BN(0),trap(h.ERROR.REFUND_EXHAUSTED))},EEI.prototype.getAddress=function(){return this._env.address},EEI.prototype.getExternalBalance=function(e){return o(this,void 0,void 0,(function(){return s(this,(function(t){switch(t.label){case 0:return e.equals(this._env.address)?[2,this._env.contract.balance]:[4,this._state.getAccount(e)];case 1:return[2,t.sent().balance]}}))}))},EEI.prototype.getSelfBalance=function(){return this._env.contract.balance},EEI.prototype.getCaller=function(){return new u.BN(this._env.caller.buf)},EEI.prototype.getCallValue=function(){return new u.BN(this._env.callValue)},EEI.prototype.getCallData=function(){return this._env.callData},EEI.prototype.getCallDataSize=function(){return new u.BN(this._env.callData.length)},EEI.prototype.getCodeSize=function(){return new u.BN(this._env.code.length)},EEI.prototype.getCode=function(){return this._env.code},EEI.prototype.isStatic=function(){return this._env.isStatic},EEI.prototype.getExternalCodeSize=function(e){return o(this,void 0,void 0,(function(){var t,r;return s(this,(function(a){switch(a.label){case 0:return t=new u.Address(addressToBuffer(e)),[4,this._state.getContractCode(t)];case 1:return r=a.sent(),[2,new u.BN(r.length)]}}))}))},EEI.prototype.getExternalCode=function(e){return o(this,void 0,void 0,(function(){var t;return s(this,(function(r){return t=new u.Address(addressToBuffer(e)),[2,this._state.getContractCode(t)]}))}))},EEI.prototype.getReturnDataSize=function(){return new u.BN(this._lastReturned.length)},EEI.prototype.getReturnData=function(){return this._lastReturned},EEI.prototype.getTxGasPrice=function(){return this._env.gasPrice},EEI.prototype.getTxOrigin=function(){return new u.BN(this._env.origin.buf)},EEI.prototype.getBlockNumber=function(){return this._env.block.header.number},EEI.prototype.getBlockCoinbase=function(){var e;return e="clique"===this._common.consensusAlgorithm()?"cliqueSigner"in this._env.block.header?this._env.block.header.cliqueSigner():u.Address.zero():this._env.block.header.coinbase,new u.BN(e.toBuffer())},EEI.prototype.getBlockTimestamp=function(){return this._env.block.header.timestamp},EEI.prototype.getBlockDifficulty=function(){return this._env.block.header.difficulty},EEI.prototype.getBlockGasLimit=function(){return this._env.block.header.gasLimit},EEI.prototype.getChainId=function(){return this._common.chainIdBN()},EEI.prototype.getBlockBaseFee=function(){var e=this._env.block.header.baseFeePerGas;if(void 0===e)throw new Error("Block has no Base Fee");return e},EEI.prototype.getBlockHash=function(e){return o(this,void 0,void 0,(function(){var t;return s(this,(function(r){switch(r.label){case 0:return[4,this._env.blockchain.getBlock(e)];case 1:return t=r.sent(),[2,new u.BN(t.hash())]}}))}))},EEI.prototype.storageStore=function(e,t){return o(this,void 0,void 0,(function(){var r;return s(this,(function(a){switch(a.label){case 0:return[4,this._state.putContractStorage(this._env.address,e,t)];case 1:return a.sent(),[4,this._state.getAccount(this._env.address)];case 2:return r=a.sent(),this._env.contract=r,[2]}}))}))},EEI.prototype.storageLoad=function(e){return o(this,void 0,void 0,(function(){return s(this,(function(t){return[2,this._state.getContractStorage(this._env.address,e)]}))}))},EEI.prototype.getGasLeft=function(){return this._gasLeft.clone()},EEI.prototype.finish=function(e){this._result.returnValue=e,trap(h.ERROR.STOP)},EEI.prototype.revert=function(e){this._result.returnValue=e,trap(h.ERROR.REVERT)},EEI.prototype.selfDestruct=function(e){return o(this,void 0,void 0,(function(){return s(this,(function(t){return[2,this._selfDestruct(e)]}))}))},EEI.prototype._selfDestruct=function(e){return o(this,void 0,void 0,(function(){var t,r;return s(this,(function(a){switch(a.label){case 0:return this._result.selfdestruct[this._env.address.buf.toString("hex")]||this.refundGas(new u.BN(this._common.param("gasPrices","selfdestructRefund"))),this._result.selfdestruct[this._env.address.buf.toString("hex")]=e.buf,[4,this._state.getAccount(e)];case 1:return(t=a.sent()).balance.iadd(this._env.contract.balance),[4,this._state.putAccount(e,t)];case 2:return a.sent(),[4,this._state.getAccount(this._env.address)];case 3:return(r=a.sent()).balance=new u.BN(0),[4,this._state.putAccount(this._env.address,r)];case 4:return a.sent(),trap(h.ERROR.STOP),[2]}}))}))},EEI.prototype.log=function(e,t,r){(t<0||t>4)&&trap(h.ERROR.OUT_OF_RANGE),r.length!==t&&trap(h.ERROR.INTERNAL_ERROR);var a=[this._env.address.buf,r,e];this._result.logs.push(a)},EEI.prototype.call=function(e,t,r,a){return o(this,void 0,void 0,(function(){var n;return s(this,(function(o){return n=new l.default({caller:this._env.address,gasLimit:e,to:t,value:r,data:a,isStatic:this._env.isStatic,depth:this._env.depth+1}),[2,this._baseCall(n)]}))}))},EEI.prototype.callCode=function(e,t,r,a){return o(this,void 0,void 0,(function(){var n;return s(this,(function(o){return n=new l.default({caller:this._env.address,gasLimit:e,to:this._env.address,codeAddress:t,value:r,data:a,isStatic:this._env.isStatic,depth:this._env.depth+1}),[2,this._baseCall(n)]}))}))},EEI.prototype.callStatic=function(e,t,r,a){return o(this,void 0,void 0,(function(){var n;return s(this,(function(o){return n=new l.default({caller:this._env.address,gasLimit:e,to:t,value:r,data:a,isStatic:!0,depth:this._env.depth+1}),[2,this._baseCall(n)]}))}))},EEI.prototype.callDelegate=function(e,t,r,a){return o(this,void 0,void 0,(function(){var n;return s(this,(function(o){return n=new l.default({caller:this._env.caller,gasLimit:e,to:this._env.address,codeAddress:t,value:r,data:a,isStatic:this._env.isStatic,delegatecall:!0,depth:this._env.depth+1}),[2,this._baseCall(n)]}))}))},EEI.prototype._baseCall=function(e){return o(this,void 0,void 0,(function(){var t,r,o;return s(this,(function(s){switch(s.label){case 0:return t=n({},this._result.selfdestruct),e.selfdestruct=t,this._lastReturned=a.alloc(0),this._env.depth>=this._common.param("vm","stackLimit")||!0!==e.delegatecall&&this._env.contract.balance.lt(e.value)?[2,new u.BN(0)]:[4,this._evm.executeMessage(e)];case 1:return(r=s.sent()).execResult.logs&&(this._result.logs=this._result.logs.concat(r.execResult.logs)),this.useGas(r.gasUsed,"CALL, STATICCALL, DELEGATECALL, CALLCODE"),!r.execResult.returnValue||r.execResult.exceptionError&&r.execResult.exceptionError.error!==h.ERROR.REVERT||(this._lastReturned=r.execResult.returnValue),r.execResult.exceptionError?[3,3]:(Object.assign(this._result.selfdestruct,t),[4,this._state.getAccount(this._env.address)]);case 2:o=s.sent(),this._env.contract=o,s.label=3;case 3:return[2,this._getReturnCode(r)]}}))}))},EEI.prototype.create=function(e,t,r,c){return void 0===c&&(c=null),o(this,void 0,void 0,(function(){var o,d,b,g;return s(this,(function(s){switch(s.label){case 0:return o=n({},this._result.selfdestruct),d=new l.default({caller:this._env.address,gasLimit:e,value:t,data:r,salt:c,depth:this._env.depth+1,selfdestruct:o}),this._lastReturned=a.alloc(0),this._env.depth>=this._common.param("vm","stackLimit")||!0!==d.delegatecall&&this._env.contract.balance.lt(d.value)?[2,new u.BN(0)]:(this._env.contract.nonce.iaddn(1),[4,this._state.putAccount(this._env.address,this._env.contract)]);case 1:return s.sent(),[4,this._evm.executeMessage(d)];case 2:return(b=s.sent()).execResult.logs&&(this._result.logs=this._result.logs.concat(b.execResult.logs)),this.useGas(b.gasUsed,"CREATE"),b.execResult.exceptionError&&b.execResult.exceptionError.error===h.ERROR.REVERT&&(this._lastReturned=b.execResult.returnValue),b.execResult.exceptionError&&b.execResult.exceptionError.error!==h.ERROR.CODESTORE_OUT_OF_GAS?[3,4]:(Object.assign(this._result.selfdestruct,o),[4,this._state.getAccount(this._env.address)]);case 3:if(g=s.sent(),this._env.contract=g,b.createdAddress)return[2,new u.BN(b.createdAddress.buf)];s.label=4;case 4:return[2,this._getReturnCode(b)]}}))}))},EEI.prototype.create2=function(e,t,r,a){return o(this,void 0,void 0,(function(){return s(this,(function(n){return[2,this.create(e,t,r,a)]}))}))},EEI.prototype.isAccountEmpty=function(e){return o(this,void 0,void 0,(function(){return s(this,(function(t){return[2,this._state.accountIsEmpty(e)]}))}))},EEI.prototype.accountExists=function(e){return o(this,void 0,void 0,(function(){return s(this,(function(t){return[2,this._state.accountExists(e)]}))}))},EEI.prototype._getReturnCode=function(e){return e.execResult.exceptionError?new u.BN(0):new u.BN(1)},EEI}();t.default=p},(e,t,r)=>{"use strict";var a=r(0).Buffer;Object.defineProperty(t,"__esModule",{value:!0}),t.BLS12_381_ToFp2Point=t.BLS12_381_ToFpPoint=t.BLS12_381_ToFrPoint=t.BLS12_381_FromG2Point=t.BLS12_381_ToG2Point=t.BLS12_381_FromG1Point=t.BLS12_381_ToG1Point=void 0;var n=r(5),o=r(30),s=new n.BN("1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab",16);function BLS12_381_ToFp2Point(e,t,r){if(new n.BN(e).gte(s))throw new o.VmError(o.ERROR.BLS_12_381_FP_NOT_IN_FIELD);if(new n.BN(t).gte(s))throw new o.VmError(o.ERROR.BLS_12_381_FP_NOT_IN_FIELD);var a=new r.Fp,c=new r.Fp,d=new r.Fp2;return a.setStr(e.slice(16).toString("hex"),16),c.setStr(t.slice(16).toString("hex"),16),d.set_a(a),d.set_b(c),d}t.BLS12_381_ToG1Point=function BLS12_381_ToG1Point(e,t){var r=e.slice(16,64).toString("hex"),a=e.slice(80,128).toString("hex"),n="0".repeat(96);if(r==a&&r==n)return new t.G1;var s=new t.Fp,c=new t.Fp,d=new t.Fp;s.setStr(r,16),c.setStr(a,16),d.setStr("1",16);var u=new t.G1;if(u.setX(s),u.setY(c),u.setZ(d),!u.isValidOrder())throw new o.VmError(o.ERROR.BLS_12_381_POINT_NOT_ON_CURVE);if(!u.isValid())throw new o.VmError(o.ERROR.BLS_12_381_POINT_NOT_ON_CURVE);return u},t.BLS12_381_FromG1Point=function BLS12_381_FromG1Point(e){var t=e.getStr(16),r=t.match(/"?[0-9a-f]+"?/g);if("0"==t)return a.alloc(128,0);var o=n.padToEven(r[1]),s=n.padToEven(r[2]),c=a.concat([a.alloc(64-o.length/2,0),a.from(o,"hex")]),d=a.concat([a.alloc(64-s.length/2,0),a.from(s,"hex")]);return a.concat([c,d])},t.BLS12_381_ToG2Point=function BLS12_381_ToG2Point(e,t){var r=e.slice(0,64),n=e.slice(64,128),s=e.slice(128,192),c=e.slice(192,256),d=a.alloc(64,0);if(r.equals(n)&&r.equals(s)&&r.equals(c)&&r.equals(d))return new t.G2;var u=BLS12_381_ToFp2Point(r,n,t),h=BLS12_381_ToFp2Point(s,c,t),l=new t.Fp;l.setStr("1",16);var b=new t.Fp;b.setStr("0",16);var g=new t.Fp2;g.set_a(l),g.set_b(b);var p=new t.G2;if(p.setX(u),p.setY(h),p.setZ(g),!p.isValidOrder())throw new o.VmError(o.ERROR.BLS_12_381_POINT_NOT_ON_CURVE);if(!p.isValid())throw new o.VmError(o.ERROR.BLS_12_381_POINT_NOT_ON_CURVE);return p},t.BLS12_381_FromG2Point=function BLS12_381_FromG2Point(e){var t=e.getStr(16);if("0"==t)return a.alloc(256,0);var r=t.match(/"?[0-9a-f]+"?/g),o=n.padToEven(r[1]),s=n.padToEven(r[2]),c=n.padToEven(r[3]),d=n.padToEven(r[4]),u=a.concat([a.alloc(64-o.length/2,0),a.from(o,"hex")]),h=a.concat([a.alloc(64-s.length/2,0),a.from(s,"hex")]),l=a.concat([a.alloc(64-c.length/2,0),a.from(c,"hex")]),b=a.concat([a.alloc(64-d.length/2,0),a.from(d,"hex")]);return a.concat([u,h,l,b])},t.BLS12_381_ToFrPoint=function BLS12_381_ToFrPoint(e,t){var r=t.fromHexStr(e.toString("hex")),a=new t.Fr;return a.setBigEndianMod(r),a},t.BLS12_381_ToFpPoint=function BLS12_381_ToFpPoint(e,t){if(new n.BN(e).gte(s))throw new o.VmError(o.ERROR.BLS_12_381_FP_NOT_IN_FIELD);var r=new t.Fp;return r.setBigEndianMod(t.fromHexStr(e.toString("hex"))),r},t.BLS12_381_ToFp2Point=BLS12_381_ToFp2Point},function(e,t,r){"use strict";var a=this&&this.__createBinding||(Object.create?function(e,t,r,a){void 0===a&&(a=r),Object.defineProperty(e,a,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,a){void 0===a&&(a=r),e[a]=t[r]}),n=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||t.hasOwnProperty(r)||a(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),n(r(1475),t),n(r(149),t),n(r(306),t)},(e,t,r)=>{"use strict";var a=r(0).Buffer;Object.defineProperty(t,"__esModule",{value:!0}),t.handlers=void 0;const n=r(5),o=r(306),s=r(1476),c=r(1477),d=r(686),u=r(28);t.handlers=new Map([[0,function(){o.trap(u.ERROR.STOP)}],[1,function(e){const[t,r]=e.stack.popN(2),a=t.add(r).mod(n.TWO_POW256);e.stack.push(a)}],[2,function(e){const[t,r]=e.stack.popN(2),a=t.mul(r).mod(n.TWO_POW256);e.stack.push(a)}],[3,function(e){const[t,r]=e.stack.popN(2),a=t.sub(r).toTwos(256);e.stack.push(a)}],[4,function(e){const[t,r]=e.stack.popN(2);let a;a=r.isZero()?new n.BN(r):t.div(r),e.stack.push(a)}],[5,function(e){let t,[r,a]=e.stack.popN(2);a.isZero()?t=new n.BN(a):(r=r.fromTwos(256),a=a.fromTwos(256),t=r.div(a).toTwos(256)),e.stack.push(t)}],[6,function(e){const[t,r]=e.stack.popN(2);let a;a=r.isZero()?new n.BN(r):t.mod(r),e.stack.push(a)}],[7,function(e){let t,[r,a]=e.stack.popN(2);a.isZero()?t=new n.BN(a):(r=r.fromTwos(256),a=a.fromTwos(256),t=r.abs().mod(a.abs()),r.isNeg()&&(t=t.ineg()),t=t.toTwos(256)),e.stack.push(t)}],[8,function(e){const[t,r,a]=e.stack.popN(3);let o;o=a.isZero()?new n.BN(a):t.add(r).mod(a),e.stack.push(o)}],[9,function(e){const[t,r,a]=e.stack.popN(3);let o;o=a.isZero()?new n.BN(a):t.mul(r).mod(a),e.stack.push(o)}],[10,function(e){const[t,r]=e.stack.popN(2);if(r.isZero())return void e.stack.push(new n.BN(1));const a=r.byteLength();(a<1||a>32)&&o.trap(u.ERROR.OUT_OF_RANGE);const s=e._common.param("gasPrices","expByte"),c=new n.BN(a).muln(s);if(e.eei.useGas(c,"EXP opcode"),t.isZero())return void e.stack.push(new n.BN(0));const d=n.BN.red(n.TWO_POW256),h=t.toRed(d).redPow(r);e.stack.push(h.fromRed())}],[11,function(e){let[t,r]=e.stack.popN(2);if(t.ltn(31)){const e=t.muln(8).iaddn(7).toNumber(),a=new n.BN(1).ishln(e).isubn(1);r=r.testn(e)?r.or(a.notn(256)):r.and(a)}else r=new n.BN(r);e.stack.push(r)}],[16,function(e){const[t,r]=e.stack.popN(2),a=new n.BN(t.lt(r)?1:0);e.stack.push(a)}],[17,function(e){const[t,r]=e.stack.popN(2),a=new n.BN(t.gt(r)?1:0);e.stack.push(a)}],[18,function(e){const[t,r]=e.stack.popN(2),a=new n.BN(t.fromTwos(256).lt(r.fromTwos(256))?1:0);e.stack.push(a)}],[19,function(e){const[t,r]=e.stack.popN(2),a=new n.BN(t.fromTwos(256).gt(r.fromTwos(256))?1:0);e.stack.push(a)}],[20,function(e){const[t,r]=e.stack.popN(2),a=new n.BN(t.eq(r)?1:0);e.stack.push(a)}],[21,function(e){const t=e.stack.pop(),r=new n.BN(t.isZero()?1:0);e.stack.push(r)}],[22,function(e){const[t,r]=e.stack.popN(2),a=t.and(r);e.stack.push(a)}],[23,function(e){const[t,r]=e.stack.popN(2),a=t.or(r);e.stack.push(a)}],[24,function(e){const[t,r]=e.stack.popN(2),a=t.xor(r);e.stack.push(a)}],[25,function(e){const t=e.stack.pop().notn(256);e.stack.push(t)}],[26,function(e){const[t,r]=e.stack.popN(2);if(t.gten(32))return void e.stack.push(new n.BN(0));const a=new n.BN(r.shrn(8*(31-t.toNumber())).andln(255));e.stack.push(a)}],[27,function(e){const[t,r]=e.stack.popN(2);if(t.gten(256))return void e.stack.push(new n.BN(0));const a=r.shln(t.toNumber()).iand(n.MAX_INTEGER);e.stack.push(a)}],[28,function(e){const[t,r]=e.stack.popN(2);if(t.gten(256))return void e.stack.push(new n.BN(0));const a=r.shrn(t.toNumber());e.stack.push(a)}],[29,function(e){const[t,r]=e.stack.popN(2);let a;const o=r.testn(255);if(t.gten(256))return a=o?new n.BN(n.MAX_INTEGER):new n.BN(0),void e.stack.push(a);const s=r.shrn(t.toNumber());if(o){const e=255-t.toNumber(),r=n.MAX_INTEGER.shrn(e).shln(e);a=s.ior(r)}else a=s;e.stack.push(a)}],[32,function(e){const[t,r]=e.stack.popN(2);o.subMemUsage(e,t,r);let s=a.alloc(0);r.isZero()||(s=e.memory.read(t.toNumber(),r.toNumber())),e.eei.useGas(new n.BN(e._common.param("gasPrices","sha3Word")).imul(o.divCeil(r,new n.BN(32))),"SHA3 opcode");const c=new n.BN(n.keccak256(s));e.stack.push(c)}],[48,function(e){const t=new n.BN(e.eei.getAddress().buf);e.stack.push(t)}],[49,async function(e){const t=e.stack.pop(),r=new n.Address(o.addressToBuffer(t));d.accessAddressEIP2929(e,r);const a=await e.eei.getExternalBalance(r);e.stack.push(a)}],[50,function(e){e.stack.push(e.eei.getTxOrigin())}],[51,function(e){e.stack.push(e.eei.getCaller())}],[52,function(e){e.stack.push(e.eei.getCallValue())}],[53,function(e){const t=e.stack.pop();if(t.gt(e.eei.getCallDataSize()))return void e.stack.push(new n.BN(0));const r=t.toNumber();let o=e.eei.getCallData().slice(r,r+32);o=o.length?o:a.from([0]);const s=new n.BN(n.setLengthRight(o,32));e.stack.push(s)}],[54,function(e){const t=e.eei.getCallDataSize();e.stack.push(t)}],[55,function(e){const[t,r,a]=e.stack.popN(3);if(o.subMemUsage(e,t,a),!a.eqn(0)){e.eei.useGas(new n.BN(e._common.param("gasPrices","copy")).imul(o.divCeil(a,new n.BN(32))),"CALLDATACOPY opcode");const s=o.getDataSlice(e.eei.getCallData(),r,a),c=t.toNumber(),d=a.toNumber();e.memory.extend(c,d),e.memory.write(c,d,s)}}],[56,function(e){e.stack.push(e.eei.getCodeSize())}],[57,function(e){const[t,r,a]=e.stack.popN(3);if(o.subMemUsage(e,t,a),!a.eqn(0)){e.eei.useGas(new n.BN(e._common.param("gasPrices","copy")).imul(o.divCeil(a,new n.BN(32))),"CODECOPY opcode");const s=o.getDataSlice(e.eei.getCode(),r,a),c=t.toNumber(),d=a.toNumber();e.memory.extend(c,d),e.memory.write(c,d,s)}}],[59,async function(e){const t=e.stack.pop(),r=new n.Address(o.addressToBuffer(t));d.accessAddressEIP2929(e,r);const a=await e.eei.getExternalCodeSize(t);e.stack.push(a)}],[60,async function(e){const[t,r,a,s]=e.stack.popN(4);o.subMemUsage(e,r,s);const c=new n.Address(o.addressToBuffer(t));if(d.accessAddressEIP2929(e,c),!s.eqn(0)){e.eei.useGas(new n.BN(e._common.param("gasPrices","copy")).imul(o.divCeil(s,new n.BN(32))),"EXTCODECOPY opcode");const c=await e.eei.getExternalCode(t),d=o.getDataSlice(c,a,s),u=r.toNumber(),h=s.toNumber();e.memory.extend(u,h),e.memory.write(u,h,d)}}],[63,async function(e){const t=e.stack.pop(),r=new n.Address(o.addressToBuffer(t));d.accessAddressEIP2929(e,r);if(await e.eei.isAccountEmpty(r))return void e.stack.push(new n.BN(0));const a=await e.eei.getExternalCode(t);0!==a.length?e.stack.push(new n.BN(n.keccak256(a))):e.stack.push(new n.BN(n.KECCAK256_NULL))}],[61,function(e){e.stack.push(e.eei.getReturnDataSize())}],[62,function(e){const[t,r,a]=e.stack.popN(3);if(r.add(a).gt(e.eei.getReturnDataSize())&&o.trap(u.ERROR.OUT_OF_GAS),o.subMemUsage(e,t,a),!a.eqn(0)){e.eei.useGas(new n.BN(e._common.param("gasPrices","copy")).mul(o.divCeil(a,new n.BN(32))),"RETURNDATACOPY opcode");const s=o.getDataSlice(e.eei.getReturnData(),r,a),c=t.toNumber(),d=a.toNumber();e.memory.extend(c,d),e.memory.write(c,d,s)}}],[58,function(e){e.stack.push(e.eei.getTxGasPrice())}],[64,async function(e){const t=e.stack.pop(),r=e.eei.getBlockNumber().sub(t);if(r.gtn(256)||r.lten(0))return void e.stack.push(new n.BN(0));const a=await e.eei.getBlockHash(t);e.stack.push(a)}],[65,function(e){e.stack.push(e.eei.getBlockCoinbase())}],[66,function(e){e.stack.push(e.eei.getBlockTimestamp())}],[67,function(e){e.stack.push(e.eei.getBlockNumber())}],[68,function(e){e.stack.push(e.eei.getBlockDifficulty())}],[69,function(e){e.stack.push(e.eei.getBlockGasLimit())}],[70,function(e){e.stack.push(e.eei.getChainId())}],[71,function(e){e.stack.push(e.eei.getSelfBalance())}],[72,function(e){e.stack.push(e.eei.getBlockBaseFee())}],[80,function(e){e.stack.pop()}],[81,function(e){const t=e.stack.pop();o.subMemUsage(e,t,new n.BN(32));const r=e.memory.read(t.toNumber(),32);e.stack.push(new n.BN(r))}],[82,function(e){const[t,r]=e.stack.popN(2),s=r.toArrayLike(a,"be",32);o.subMemUsage(e,t,new n.BN(32));const c=t.toNumber();e.memory.extend(c,32),e.memory.write(c,32,s)}],[83,function(e){const[t,r]=e.stack.popN(2),s=a.from([r.andln(255)]);o.subMemUsage(e,t,new n.BN(1));const c=t.toNumber();e.memory.extend(c,1),e.memory.write(c,1,s)}],[84,async function(e){const t=e.stack.pop().toArrayLike(a,"be",32);d.accessStorageEIP2929(e,t,!1);const r=await e.eei.storageLoad(t),o=r.length?new n.BN(r):new n.BN(0);e.stack.push(o)}],[85,async function(e){e.eei.isStatic()&&o.trap(u.ERROR.STATIC_STATE_CHANGE);const[t,r]=e.stack.popN(2),n=t.toArrayLike(a,"be",32);let h;h=r.isZero()?a.from([]):r.toArrayLike(a,"be");const l=await o.getContractStorage(e,e.eei.getAddress(),n);"constantinople"===e._common.hardfork()?s.updateSstoreGasEIP1283(e,l,o.setLengthLeftStorage(h)):e._common.gteHardfork("istanbul")?c.updateSstoreGasEIP2200(e,l,o.setLengthLeftStorage(h),n):o.updateSstoreGas(e,l,o.setLengthLeftStorage(h),n),d.accessStorageEIP2929(e,n,!0),await e.eei.storageStore(n,h)}],[86,function(e){const t=e.stack.pop();t.gt(e.eei.getCodeSize())&&o.trap(u.ERROR.INVALID_JUMP+" at "+o.describeLocation(e));const r=t.toNumber();o.jumpIsValid(e,r)||o.trap(u.ERROR.INVALID_JUMP+" at "+o.describeLocation(e)),e.programCounter=r}],[87,function(e){const[t,r]=e.stack.popN(2);if(!r.isZero()){t.gt(e.eei.getCodeSize())&&o.trap(u.ERROR.INVALID_JUMP+" at "+o.describeLocation(e));const r=t.toNumber();o.jumpIsValid(e,r)||o.trap(u.ERROR.INVALID_JUMP+" at "+o.describeLocation(e)),e.programCounter=r}}],[88,function(e){e.stack.push(new n.BN(e.programCounter-1))}],[89,function(e){e.stack.push(e.memoryWordCount.muln(32))}],[90,function(e){e.stack.push(new n.BN(e.eei.getGasLeft()))}],[91,function(){}],[92,function(e){o.trap(u.ERROR.INVALID_BEGINSUB+" at "+o.describeLocation(e))}],[93,function(e){e.returnStack.length<1&&o.trap(u.ERROR.INVALID_RETURNSUB);const t=e.returnStack.pop();e.programCounter=t.toNumber()}],[94,function(e){const t=e.stack.pop();t.gt(e.eei.getCodeSize())&&o.trap(u.ERROR.INVALID_JUMPSUB+" at "+o.describeLocation(e));const r=t.toNumber();o.jumpSubIsValid(e,r)||o.trap(u.ERROR.INVALID_JUMPSUB+" at "+o.describeLocation(e)),e.returnStack.push(new n.BN(e.programCounter)),e.programCounter=r+1}],[96,function(e){const t=e.opCode-95,r=new n.BN(e.eei.getCode().slice(e.programCounter,e.programCounter+t));e.programCounter+=t,e.stack.push(r)}],[128,function(e){const t=e.opCode-127;e.stack.dup(t)}],[144,function(e){const t=e.opCode-143;e.stack.swap(t)}],[160,function(e){e.eei.isStatic()&&o.trap(u.ERROR.STATIC_STATE_CHANGE);const[t,r]=e.stack.popN(2),s=e.opCode-160;(s<0||s>4)&&o.trap(u.ERROR.OUT_OF_RANGE);const c=e.stack.popN(s).map((function(e){return e.toArrayLike(a,"be",32)}));o.subMemUsage(e,t,r);let d=a.alloc(0);r.isZero()||(d=e.memory.read(t.toNumber(),r.toNumber())),e.eei.useGas(new n.BN(e._common.param("gasPrices","logTopic")).imuln(s).iadd(r.muln(e._common.param("gasPrices","logData"))),"LOG opcode"),e.eei.log(d,s,c)}],[240,async function(e){e.eei.isStatic()&&o.trap(u.ERROR.STATIC_STATE_CHANGE);const[t,r,s]=e.stack.popN(3);d.accessAddressEIP2929(e,e.eei.getAddress(),!1),o.subMemUsage(e,r,s);let c=new n.BN(e.eei.getGasLeft());c=o.maxCallGas(c,e.eei.getGasLeft(),e);let h=a.alloc(0);s.isZero()||(h=e.memory.read(r.toNumber(),s.toNumber()));const l=await e.eei.create(c,t,h);e.stack.push(l)}],[245,async function(e){e.eei.isStatic()&&o.trap(u.ERROR.STATIC_STATE_CHANGE);const[t,r,s,c]=e.stack.popN(4);o.subMemUsage(e,r,s),d.accessAddressEIP2929(e,e.eei.getAddress(),!1),e.eei.useGas(new n.BN(e._common.param("gasPrices","sha3Word")).imul(o.divCeil(s,new n.BN(32))),"CREATE2 opcode");let h=new n.BN(e.eei.getGasLeft());h=o.maxCallGas(h,e.eei.getGasLeft(),e);let l=a.alloc(0);s.isZero()||(l=e.memory.read(r.toNumber(),s.toNumber()));const b=await e.eei.create2(h,t,l,c.toArrayLike(a,"be",32));e.stack.push(b)}],[241,async function(e){const[t,r,s,c,h,l,b]=e.stack.popN(7),g=new n.Address(o.addressToBuffer(r));e.eei.isStatic()&&!s.isZero()&&o.trap(u.ERROR.STATIC_STATE_CHANGE),o.subMemUsage(e,c,h),o.subMemUsage(e,l,b),d.accessAddressEIP2929(e,g),s.isZero()||e.eei.useGas(new n.BN(e._common.param("gasPrices","callValueTransfer")),"CALL opcode -> callValueTransfer");let p=a.alloc(0);h.isZero()||(p=e.memory.read(c.toNumber(),h.toNumber())),e._common.gteHardfork("spuriousDragon")?await e.eei.isAccountEmpty(g)&&!s.isZero()&&e.eei.useGas(new n.BN(e._common.param("gasPrices","callNewAccount")),"CALL opcode -> callNewAccount (>= SpuriousDragon)"):await e.eei.accountExists(g)||e.eei.useGas(new n.BN(e._common.param("gasPrices","callNewAccount")),"CALL opcode -> callNewAccount (< SpuriousDragon)");const B=o.maxCallGas(t,e.eei.getGasLeft(),e);B.gt(e.eei.getGasLeft())&&o.trap(u.ERROR.OUT_OF_GAS),s.isZero()||(e.eei._gasLeft.iaddn(e._common.param("gasPrices","callStipend")),B.iaddn(e._common.param("gasPrices","callStipend")));const m=await e.eei.call(B,g,s,p);o.writeCallOutput(e,l,b),e.stack.push(m)}],[242,async function(e){const[t,r,s,c,h,l,b]=e.stack.popN(7),g=new n.Address(o.addressToBuffer(r));o.subMemUsage(e,c,h),o.subMemUsage(e,l,b),d.accessAddressEIP2929(e,g),s.isZero()||e.eei.useGas(new n.BN(e._common.param("gasPrices","callValueTransfer")),"CALLCODE opcode -> callValueTransfer");const p=o.maxCallGas(t,e.eei.getGasLeft(),e);p.gt(e.eei.getGasLeft())&&o.trap(u.ERROR.OUT_OF_GAS),s.isZero()||(e.eei._gasLeft.iaddn(e._common.param("gasPrices","callStipend")),p.iaddn(e._common.param("gasPrices","callStipend")));let B=a.alloc(0);h.isZero()||(B=e.memory.read(c.toNumber(),h.toNumber()));const m=await e.eei.callCode(p,g,s,B);o.writeCallOutput(e,l,b),e.stack.push(m)}],[244,async function(e){const t=e.eei.getCallValue(),[r,s,c,h,l,b]=e.stack.popN(6),g=new n.Address(o.addressToBuffer(s));o.subMemUsage(e,c,h),o.subMemUsage(e,l,b),d.accessAddressEIP2929(e,g);const p=o.maxCallGas(r,e.eei.getGasLeft(),e);p.gt(e.eei.getGasLeft())&&o.trap(u.ERROR.OUT_OF_GAS);let B=a.alloc(0);h.isZero()||(B=e.memory.read(c.toNumber(),h.toNumber()));const m=await e.eei.callDelegate(p,g,t,B);o.writeCallOutput(e,l,b),e.stack.push(m)}],[250,async function(e){const t=new n.BN(0),[r,s,c,u,h,l]=e.stack.popN(6),b=new n.Address(o.addressToBuffer(s));o.subMemUsage(e,c,u),o.subMemUsage(e,h,l),d.accessAddressEIP2929(e,b);const g=o.maxCallGas(r,e.eei.getGasLeft(),e);let p=a.alloc(0);u.isZero()||(p=e.memory.read(c.toNumber(),u.toNumber()));const B=await e.eei.callStatic(g,b,t,p);o.writeCallOutput(e,h,l),e.stack.push(B)}],[243,function(e){const[t,r]=e.stack.popN(2);o.subMemUsage(e,t,r);let n=a.alloc(0);r.isZero()||(n=e.memory.read(t.toNumber(),r.toNumber())),e.eei.finish(n)}],[253,function(e){const[t,r]=e.stack.popN(2);o.subMemUsage(e,t,r);let n=a.alloc(0);r.isZero()||(n=e.memory.read(t.toNumber(),r.toNumber())),e.eei.revert(n)}],[255,async function(e){const t=e.stack.pop();e.eei.isStatic()&&o.trap(u.ERROR.STATIC_STATE_CHANGE);const r=new n.Address(o.addressToBuffer(t));let a=!1;if(e._common.gteHardfork("spuriousDragon")){if((await e.eei.getExternalBalance(e.eei.getAddress())).gtn(0)){await e.eei.isAccountEmpty(r)&&(a=!0)}}else if(e._common.gteHardfork("tangerineWhistle")){await e.stateManager.accountExists(r)||(a=!0)}return a&&e.eei.useGas(new n.BN(e._common.param("gasPrices","callNewAccount")),"SELFDESTRUCT opcode -> callNewAccount"),d.accessAddressEIP2929(e,r,!0,!0),e.eei.selfDestruct(r)}]]);const h=t.handlers.get(96);for(let e=97;e<=127;e++)t.handlers.set(e,h);const l=t.handlers.get(128);for(let e=129;e<=143;e++)t.handlers.set(e,l);const b=t.handlers.get(144);for(let e=145;e<=159;e++)t.handlers.set(e,b);const g=t.handlers.get(160);for(let e=161;e<=164;e++)t.handlers.set(e,g)},(e,t,r)=>{"use strict";var a=r(0).Buffer;Object.defineProperty(t,"__esModule",{value:!0}),t.BLS12_381_ToFp2Point=t.BLS12_381_ToFpPoint=t.BLS12_381_ToFrPoint=t.BLS12_381_FromG2Point=t.BLS12_381_ToG2Point=t.BLS12_381_FromG1Point=t.BLS12_381_ToG1Point=void 0;const n=r(5),o=r(28),s=new n.BN("1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab",16);function BLS12_381_ToFp2Point(e,t,r){if(new n.BN(e).gte(s))throw new o.VmError(o.ERROR.BLS_12_381_FP_NOT_IN_FIELD);if(new n.BN(t).gte(s))throw new o.VmError(o.ERROR.BLS_12_381_FP_NOT_IN_FIELD);const a=new r.Fp,c=new r.Fp,d=new r.Fp2;return a.setStr(e.slice(16).toString("hex"),16),c.setStr(t.slice(16).toString("hex"),16),d.set_a(a),d.set_b(c),d}t.BLS12_381_ToG1Point=function BLS12_381_ToG1Point(e,t){const r=e.slice(16,64).toString("hex"),a=e.slice(80,128).toString("hex"),n="0".repeat(96);if(r==a&&r==n)return new t.G1;const s=new t.Fp,c=new t.Fp,d=new t.Fp;s.setStr(r,16),c.setStr(a,16),d.setStr("1",16);const u=new t.G1;if(u.setX(s),u.setY(c),u.setZ(d),!u.isValidOrder())throw new o.VmError(o.ERROR.BLS_12_381_POINT_NOT_ON_CURVE);if(!u.isValid())throw new o.VmError(o.ERROR.BLS_12_381_POINT_NOT_ON_CURVE);return u},t.BLS12_381_FromG1Point=function BLS12_381_FromG1Point(e){const t=e.getStr(16),r=t.match(/"?[0-9a-f]+"?/g);if("0"==t)return a.alloc(128,0);const o=n.padToEven(r[1]),s=n.padToEven(r[2]),c=a.concat([a.alloc(64-o.length/2,0),a.from(o,"hex")]),d=a.concat([a.alloc(64-s.length/2,0),a.from(s,"hex")]);return a.concat([c,d])},t.BLS12_381_ToG2Point=function BLS12_381_ToG2Point(e,t){const r=e.slice(0,64),n=e.slice(64,128),s=e.slice(128,192),c=e.slice(192,256),d=a.alloc(64,0);if(r.equals(n)&&r.equals(s)&&r.equals(c)&&r.equals(d))return new t.G2;const u=BLS12_381_ToFp2Point(r,n,t),h=BLS12_381_ToFp2Point(s,c,t),l=new t.Fp;l.setStr("1",16);const b=new t.Fp;b.setStr("0",16);const g=new t.Fp2;g.set_a(l),g.set_b(b);const p=new t.G2;if(p.setX(u),p.setY(h),p.setZ(g),!p.isValidOrder())throw new o.VmError(o.ERROR.BLS_12_381_POINT_NOT_ON_CURVE);if(!p.isValid())throw new o.VmError(o.ERROR.BLS_12_381_POINT_NOT_ON_CURVE);return p},t.BLS12_381_FromG2Point=function BLS12_381_FromG2Point(e){const t=e.getStr(16);if("0"==t)return a.alloc(256,0);const r=t.match(/"?[0-9a-f]+"?/g),o=n.padToEven(r[1]),s=n.padToEven(r[2]),c=n.padToEven(r[3]),d=n.padToEven(r[4]),u=a.concat([a.alloc(64-o.length/2,0),a.from(o,"hex")]),h=a.concat([a.alloc(64-s.length/2,0),a.from(s,"hex")]),l=a.concat([a.alloc(64-c.length/2,0),a.from(c,"hex")]),b=a.concat([a.alloc(64-d.length/2,0),a.from(d,"hex")]);return a.concat([u,h,l,b])},t.BLS12_381_ToFrPoint=function BLS12_381_ToFrPoint(e,t){const r=t.fromHexStr(e.toString("hex")),a=new t.Fr;return a.setBigEndianMod(r),a},t.BLS12_381_ToFpPoint=function BLS12_381_ToFpPoint(e,t){if(new n.BN(e).gte(s))throw new o.VmError(o.ERROR.BLS_12_381_FP_NOT_IN_FIELD);const r=new t.Fp;return r.setBigEndianMod(t.fromHexStr(e.toString("hex"))),r},t.BLS12_381_ToFp2Point=BLS12_381_ToFp2Point},function(e,t,r){"use strict";var a=r(0).Buffer,n=this&&this.__createBinding||(Object.create?function(e,t,r,a){void 0===a&&(a=r),Object.defineProperty(e,a,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,a){void 0===a&&(a=r),e[a]=t[r]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),s=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&n(t,e,r);return o(t,e),t},c=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.ForkTrie=void 0;const d=r(47),u=r(8),h=r(1157),l=c(r(386)),b=s(r(1496)),g=r(46),p=r(14),B=r(5),m=new WeakMap,I={keyEncoding:"binary",valueEncoding:"binary"};async function commit(){const{keyValueMap:e}=this.checkpoints.pop();if(this.isCheckpoint){const t=this.checkpoints[this.checkpoints.length-1].keyValueMap;e.forEach(((e,r)=>t.set(r,e)))}else{const t=[];e.forEach((function(e,r){null===e?t.push({type:"del",key:a.from(r,"binary")}):t.push({type:"put",key:a.from(r,"binary"),value:e})})),await this.batch(t)}}class ForkTrie extends h.GanacheTrie{constructor(e,t,r){super(e,t,r),this.address=null,this.blockNumber=null,this.accountFromFallback=async(e,t)=>{const{fallback:r}=this.blockchain,a=this.blockchain.fallback.selectValidForkBlockNumber(t),n=r.request("eth_getCode",[e,a]),o=[r.request("eth_getTransactionCount",[e,a]),r.request("eth_getBalance",[e,a]),null],s=new p.Account(e);try{const e=await n;if("0x"!==e){const t=u.Data.from(e).toBuffer();s.codeHash=u.keccak(t),s.codeHash.equals(B.KECCAK256_NULL)||(o[2]=this.db.put(s.codeHash,t))}}catch(e){throw Promise.all(o).catch((e=>{})),e}const[c,d]=await Promise.all(o);return s.nonce="0x0"===c?u.RPCQUANTITY_EMPTY:u.Quantity.from(c,!0),s.balance="0x0"===d?u.RPCQUANTITY_EMPTY:u.Quantity.from(d),s.serialize()},this.storageFromFallback=async(e,t,r)=>{const n=await this.blockchain.fallback.request("eth_getStorageAt",[`0x${e.toString("hex")}`,`0x${t.toString("hex")}`,this.blockchain.fallback.selectValidForkBlockNumber(r)]);if(!n)return null;const o=n.replace(/^0x(00)*/,""),s=a.from(o,"hex");return g.encode(s)},this.db.commit=commit.bind(this.db),this.accounts=r.accounts,this.blockNumber=this.blockchain.fallback.blockNumber,m.has(e)?this.metadata=m.get(e):(this.metadata=l.default(e,"f",I),m.set(e,this.metadata))}set root(e){this._root=e}get root(){return this._root}setContext(e,t,r){this._root=e,this.address=t,this.blockNumber=r}async put(e,t){return super.put(e,t)}createDelKey(e){const t=this.blockNumber.toBuffer();return b.encode([t,this.address,e])}async keyWasDeleted(e){return new Promise(((t,r)=>{const a=null===this.address?u.BUFFER_EMPTY:this.address;let n=!1;const o=this.metadata.createKeyStream({lte:this.createDelKey(e),reverse:!0}).on("data",(t=>{const r=b.decode(t),s=r[1],c=r[2];s.equals(a)&&c.equals(e)&&(n=!0,o.destroy())})).on("close",(()=>t(n))).on("error",r)}))}async del(e){await this.lock.wait();const t=u.keccak(e),r=this.createDelKey(e),a=this.metadata.put(r,u.BUFFER_ZERO),{node:n,stack:o}=await this.findPath(t);n&&await this._deleteNode(t,o),await a,this.lock.signal()}async get(e){const t=await super.get(e);return null!=t?t:await this.keyWasDeleted(e)?null:null===this.address?this.accountFromFallback(d.Address.from(e),this.blockNumber):this.storageFromFallback(this.address,e,this.blockNumber)}copy(){const e=this.db.copy(),t=new ForkTrie(e._leveldb,this.root,this.blockchain);return t.accounts=this.accounts,t.address=this.address,t.blockNumber=this.blockNumber,t}}t.ForkTrie=ForkTrie},function(e,t,r){"use strict";var a=r(0).Buffer,n=this&&this.__createBinding||(Object.create?function(e,t,r,a){void 0===a&&(a=r),Object.defineProperty(e,a,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,a){void 0===a&&(a=r),e[a]=t[r]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),s=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&n(t,e,r);return o(t,e),t},c=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.HttpHandler=void 0;const d=r(14),u=s(r(1498)),h=s(r(1499)),l=r(307),b=c(r(1162)),{JSONRPC_PREFIX:g}=l.BaseHandler;class HttpHandler extends l.BaseHandler{constructor(e,t){super(e,t),this.url=e.fork.url,this.headers.accept=this.headers["content-type"]="application/json","http:"===this.url.protocol?(this._request=u.default.request,this.agent=new u.Agent({keepAlive:!0,scheduling:"fifo"})):(this._request=h.default.request,this.agent=new h.Agent({keepAlive:!0,scheduling:"fifo"}))}handleLengthedResponse(e,t){let r=a.allocUnsafe(t),n=0;return new Promise(((t,a)=>{e.on("data",(function data(e){const t=e.length;e.copy(r,n,0,t),n+=t})),e.on("end",(function end(){n!==r.length?a(new Error("content-length mismatch")):t(r)}))}))}handleChunkedResponse(e){let t;return new Promise((r=>{e.on("data",(e=>{const r=e;t=t?a.concat([t,r],t.length+r.length):a.concat([r],r.length)})),e.on("end",(()=>{r(t)}))}))}async request(e,t){const r=JSON.stringify({method:e,params:t}),{protocol:a,hostname:n,port:o,pathname:s,search:c}=this.url,u={protocol:a,host:n,port:o,path:s+c,headers:this.headers,method:"POST",agent:this.agent,signal:this.abortSignal};return await this.queueRequest(r,(()=>{if(this.abortSignal.aborted)return Promise.reject(new d.AbortError);const e=b.default(),t=`${g}${this.id++},${r.slice(1)}`;this.headers["content-length"]=t.length;const a=this._request(u);return a.on("response",(t=>{const{headers:r}=t;let a;if("transfer-encoding"in r)a=this.handleChunkedResponse(t);else{const e=r["content-length"]/1;a=isNaN(e)||e<=0?this.handleChunkedResponse(t):this.handleLengthedResponse(t,e)}a.then((t=>{try{e.resolve({response:JSON.parse(t),raw:t})}catch{const r=t.toString();let a;a=r.length>340?r.slice(0,320)+"…":r;let n=`Invalid JSON response from fork provider:\n\n ${a}`;(r.startsWith("invalid project id")||r.startsWith("project id required in the url"))&&this.url.host.endsWith("infura.io")&&(n+=`\n\nThe provided fork url, ${this.url}, may be an invalid or incorrect Infura endpoint.`,n+="\nVisit https://infura.io/docs/ethereum for Infura documentation."),e.reject(new Error(n))}}))})),a.setTimeout(5e3,a.abort.bind(a,null)),a.on("error",e.reject),a.write(t),a.end(),e.promise.finally((()=>this.requestCache.delete(r)))}))}close(){return Promise.resolve()}}t.HttpHandler=HttpHandler},function(e,t,r){"use strict";var a,n,o,s,c,d,u,h,l,b=r(1),g=this&&this.__classPrivateFieldSet||function(e,t,r){if(!t.has(e))throw new TypeError("attempted to set private field on non-instance");return t.set(e,r),r},p=this&&this.__classPrivateFieldGet||function(e,t){if(!t.has(e))throw new TypeError("attempted to get private field on non-instance");return t.get(e)},B=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.Server=t._DefaultServerOptions=t.ServerStatus=void 0;const m=r(1173);B(r(1174)).default.shim();const I=B(r(1220)),y=r(1512),v=r(94),x=B(r(720)),C=B(r(255)),Q=B(r(230)),w=B(r(1223));var _;!function(e){e[e.unknown=0]="unknown",e[e.ready=1]="ready",e[e.opening=2]="opening",e[e.open=4]="open",e[e.openingOrOpen=6]="openingOrOpen",e[e.closing=8]="closing",e[e.closed=16]="closed",e[e.closingOrClosed=24]="closingOrClosed"}(_=t.ServerStatus||(t.ServerStatus={})),t._DefaultServerOptions=m.serverDefaults;class Server extends w.default{constructor(e={flavor:v.DefaultFlavor}){super(),a.set(this,void 0),n.set(this,void 0),o.set(this,_.unknown),s.set(this,null),c.set(this,null),d.set(this,null),u.set(this,void 0),h.set(this,null),l.set(this,void 0),g(this,a,m.serverOptionsConfig.normalize(e)),g(this,n,e),g(this,o,_.ready);const t=x.default.initialize(p(this,n)),r=g(this,u,t.connector);g(this,l,Promise.all([t.promise,this.initialize(r)]))}get provider(){return p(this,u).provider}get status(){return p(this,o)}async initialize(e){const t=g(this,s,y.App());p(this,a).server.ws&&g(this,h,new C.default(t,e,p(this,a).server)),g(this,c,new Q.default(t,e,p(this,a).server)),await e.once("ready")}listen(e,t,r){let a=null;"function"==typeof t&&(r=t,a=null);const n="function"==typeof r,c=p(this,o);if(c===_.closing){const e=new Error("Cannot start server while it is closing.");return n?b.nextTick(r,e):Promise.reject(e)}if(0!=(c&_.openingOrOpen)){const t=new Error(`Server is already open, or is opening, on port: ${e}.`);return n?b.nextTick(r,t):Promise.reject(t)}g(this,o,_.opening);const u=Promise.allSettled([p(this,l),new Promise((t=>{a?p(this,s).listen(a,e,1,t):p(this,s).listen(e,1,t)})).then((t=>{if(!t){g(this,o,_.closed);throw new Error(`listen EADDRINUSE: address already in use ${a||"127.0.0.1"}:${e}.`)}g(this,o,_.open),g(this,d,t)}))]).then((async e=>{const t=[];if("rejected"===e[0].status&&t.push(e[0].reason),"rejected"===e[1].status&&t.push(e[1].reason),0!==t.length){g(this,o,_.unknown);try{await this.close()}catch(e){t.push(e)}throw t.length>1?new I.default(t):t[0]}this.emit("open")}));if(!n)return u;u.then((()=>r(null))).catch(r)}async close(){if(p(this,o)===_.opening)throw new Error("Cannot close server while it is opening.");if(0!=(p(this,o)&_.closingOrClosed))throw new Error("Server is already closing or closed.");g(this,o,_.closing);const e=p(this,d);g(this,d,null),null!==e&&y.us_listen_socket_close(e),null!==p(this,h)&&p(this,h).close(),null!==p(this,c)&&p(this,c).close(),null!==p(this,u)&&await p(this,u).close(),g(this,o,_.closed),g(this,s,null),await this.emit("close")}}t.Server=Server,a=new WeakMap,n=new WeakMap,o=new WeakMap,s=new WeakMap,c=new WeakMap,d=new WeakMap,u=new WeakMap,h=new WeakMap,l=new WeakMap,t.default=Server},function(e,t,r){"use strict";var a=this&&this.__createBinding||(Object.create?function(e,t,r,a){void 0===a&&(a=r),Object.defineProperty(e,a,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,a){void 0===a&&(a=r),e[a]=t[r]}),n=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||a(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),n(r(1224),t),n(r(1225),t),n(r(1226),t)},(e,t,r)=>{"use strict";var a=r(1),n=Object.keys||function(e){var t=[];for(var r in e)t.push(r);return t};e.exports=Duplex;var o=r(313),s=r(314);r(10)(Duplex,o);for(var c=n(s.prototype),d=0;d{"use strict";var a=r(1),n=65536,o=4294967295;var s=r(11).Buffer,c=r.g.crypto||r.g.msCrypto;c&&c.getRandomValues?e.exports=function randomBytes(e,t){if(e>o)throw new RangeError("requested too many random bytes");var r=s.allocUnsafe(e);if(e>0)if(e>n)for(var d=0;d{function assert(e,t){if(!e)throw new Error(t||"Assertion failed")}e.exports=assert,assert.equal=function assertEqual(e,t,r){if(e!=t)throw new Error(r||"Assertion failed: "+e+" != "+t)}},function(e,t,r){"use strict";var a=this&&this.__awaiter||function(e,t,r,a){return new(r||(r=Promise))((function(n,o){function fulfilled(e){try{step(a.next(e))}catch(e){o(e)}}function rejected(e){try{step(a.throw(e))}catch(e){o(e)}}function step(e){e.done?n(e.value):function adopt(e){return e instanceof r?e:new r((function(t){t(e)}))}(e.value).then(fulfilled,rejected)}step((a=a.apply(e,t||[])).next())}))},n=this&&this.__generator||function(e,t){var r,a,n,o,s={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return o={next:verb(0),throw:verb(1),return:verb(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function verb(o){return function(c){return function step(o){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,a&&(n=2&o[0]?a.return:o[0]?a.throw||((n=a.return)&&n.call(a),0):a.next)&&!(n=n.call(a,o[1])).done)return n;switch(a=0,n&&(o=[2&o[0],n.value]),o[0]){case 0:case 1:n=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,a=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(n=s.trys,(n=n.length>0&&n[n.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!n||o[1]>n[0]&&o[1]{function assert(e,t){if(!e)throw new Error(t||"Assertion failed")}e.exports=assert,assert.equal=function assertEqual(e,t,r){if(e!=t)throw new Error(r||"Assertion failed: "+e+" != "+t)}},(e,t,r)=>{"use strict";var a=r(1),n=r(4).Buffer;Object.defineProperty(t,"__esModule",{value:!0}),t.RuntimeTransaction=t.hasPartialSignature=t.toValidLengthAddress=void 0;const o=r(14),s=r(8),c=r(46),d=r(521),u=r(239),h=r(47);t.toValidLengthAddress=(e,t)=>{const r=s.Data.from(e).toBuffer();if(r.byteLength!==h.Address.ByteLength)throw new Error(`The field ${t} must have byte length of ${h.Address.ByteLength}`);return h.Address.from(r)};t.hasPartialSignature=e=>null!=e.v||null!=e.r||null!=e.s;const l=s.RPCQUANTITY_ONE.toBuffer();class RuntimeTransaction extends d.BaseTransaction{constructor(e,r,n){let o;super(r,n),this.locked=!1,this.validateAndSetSignature=e=>{if(t.hasPartialSignature(e)){if(null==e.v||null==e.r||null==e.s)throw new Error("Transaction signature is incomplete; v, r, and s are required.");if(null==e.nonce)throw new Error("Signed transaction is incomplete; nonce is required.");this.v=s.Quantity.from(e.v,!0),this.r=s.Quantity.from(e.r,!0),this.s=s.Quantity.from(e.s,!0);const r=this.toEthRawTransaction(this.v.toBuffer(),this.r.toBuffer(),this.s.toBuffer());if(this.raw=r,!this.from){const{from:a,serialized:n,hash:o,encodedData:s,encodedSignature:c}=this.computeIntrinsics(this.v,r,this.common.chainId());if(null!==e.from){const r=t.toValidLengthAddress(e.from,"from");if(!a.toBuffer().equals(r.toBuffer()))throw new Error("Transaction is signed and contains a `from` field, but the signature doesn't match.")}this.from=a,this.serialized=n,this.hash=o,this.encodedData=s,this.encodedSignature=c}}else null!=e.from&&(this.from=t.toValidLengthAddress(e.from,"from"))},this.finalized=new Promise((e=>{o=(...t)=>a.nextTick(e,...t)})),this.finalizer=o,Array.isArray(e)||(this.nonce=s.Quantity.from(e.nonce,!0),this.gas=s.Quantity.from(null==e.gas?e.gasLimit:e.gas),this.to=null==e.to?s.RPCQUANTITY_EMPTY:t.toValidLengthAddress(e.to,"to"),this.value=s.Quantity.from(e.value),this.data=s.Data.from(null==e.data?e.input:e.data))}serializeForDb(e,t,r){const a=[this.raw,[this.from.toBuffer(),this.hash.toBuffer(),e.toBuffer(),t.toBuffer(),r.toBuffer(),this.effectiveGasPrice.toBuffer()]];return c.encode(a)}fillFromResult(e,t){const r=e.execResult;let a;r.exceptionError?(a=s.BUFFER_ZERO,this.execException=new o.RuntimeError(this.hash,e,o.RETURN_TYPES.TRANSACTION_HASH)):a=l;return(this.receipt=u.TransactionReceipt.fromValues(a,s.Quantity.from(t).toBuffer(),e.bloom.bitvector,this.logs=r.logs||[],e.gasUsed.toArrayLike(n),e.createdAddress?e.createdAddress.buf:null,this.type)).serialize(!1)}getReceipt(){return this.receipt}getLogs(){return this.logs}once(e){return this.finalized}finalize(e,t=null){this.finalizer({status:e,error:t})}}t.RuntimeTransaction=RuntimeTransaction},e=>{function assert(e,t){if(!e)throw new Error(t||"Assertion failed")}e.exports=assert,assert.equal=function assertEqual(e,t,r){if(e!=t)throw new Error(r||"Assertion failed: "+e+" != "+t)}},function(e,t,r){"use strict";var a=this&&this.__awaiter||function(e,t,r,a){return new(r||(r=Promise))((function(n,o){function fulfilled(e){try{step(a.next(e))}catch(e){o(e)}}function rejected(e){try{step(a.throw(e))}catch(e){o(e)}}function step(e){e.done?n(e.value):function adopt(e){return e instanceof r?e:new r((function(t){t(e)}))}(e.value).then(fulfilled,rejected)}step((a=a.apply(e,t||[])).next())}))},n=this&&this.__generator||function(e,t){var r,a,n,o,s={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return o={next:verb(0),throw:verb(1),return:verb(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function verb(o){return function(c){return function step(o){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,a&&(n=2&o[0]?a.return:o[0]?a.throw||((n=a.return)&&n.call(a),0):a.next)&&!(n=n.call(a,o[1])).done)return n;switch(a=0,n&&(o=[2&o[0],n.value]),o[0]){case 0:case 1:n=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,a=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(n=s.trys,(n=n.length>0&&n[n.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!n||o[1]>n[0]&&o[1]{function assert(e,t){if(!e)throw new Error(t||"Assertion failed")}e.exports=assert,assert.equal=function assertEqual(e,t,r){if(e!=t)throw new Error(r||"Assertion failed: "+e+" != "+t)}},e=>{function assert(e,t){if(!e)throw new Error(t||"Assertion failed")}e.exports=assert,assert.equal=function assertEqual(e,t,r){if(e!=t)throw new Error(r||"Assertion failed: "+e+" != "+t)}},function(e,t,r){"use strict";var a,n,o,s,c,d=r(0).Buffer,u=this&&this.__classPrivateFieldSet||function(e,t,r){if(!t.has(e))throw new TypeError("attempted to set private field on non-instance");return t.set(e,r),r},h=this&&this.__classPrivateFieldGet||function(e,t){if(!t.has(e))throw new TypeError("attempted to get private field on non-instance");return t.get(e)},l=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const b=r(14),g=r(8),p=r(5),B=l(r(349)),m=r(1355),I=l(r(999)),y=r(1004),v=l(r(50)),x=l(r(554)),C=r(350),Q=r(47),w={dklen:32,n:1024,p:8,r:1},_="aes-128-ctr",scrypt=(...e)=>new Promise(((t,r)=>{v.default.scrypt.call(v.default,...e,((e,a)=>{if(!e)return t(a);r(e)}))})),k=d.allocUnsafe(65),uncompressedPublicKeyToAddress=e=>{switch(B.default.publicKeyConvert(k,e)){case 0:return Q.Address.from(g.keccak(k.slice(1)).slice(-20));case 1:throw new Error("Public Key could not be parsed");case 2:throw new Error("Public Key serialization error")}},asUUID=e=>`${e.toString("hex",0,4)}-${e.toString("hex",4,6)}-${e.toString("hex",6,8)}-${e.toString("hex",8,10)}-${e.toString("hex",10)}`;class Wallet{constructor(e){this.knownAccounts=new Set,this.encryptedKeyFiles=new Map,this.unlockedAccounts=new Map,this.lockTimers=new Map,a.set(this,void 0),n.set(this,void 0),o.set(this,(e=>{const t=d.allocUnsafe(e),r=h(this,n);for(let a=0;a{const t=e.defaultBalance.toString().split(".",2),r=BigInt(t[0]),n=t[1]||"0",o=BigInt(n),s=10n**BigInt(n.length),c=g.WEI*r+o*(g.WEI/s),d=g.Quantity.from(c);let u,l,b=e.accounts;if(b&&0!==(l=b.length)){const t=h(this,a),r=e.hdPath;u=Array(l);for(let e=0;e(this.lockTimers.delete(e),this.unlockedAccounts.delete(e),!0))),u(this,a,I.default.fromMasterSeed(m.mnemonicToSeedSync(e.mnemonic,null))),u(this,n,y.alea("ganache "+e.mnemonic));const t=this.initialAccounts=h(this,s).call(this,e),r=t.length,l=this.knownAccounts,b=this.unlockedAccounts,p=e.unlockedAccounts;if(p){const e=p.length;for(let a=0;a{t.addresses[r]=r,t.private_keys[r]=e})),C.writeFileSync(e.accountKeysPath,JSON.stringify(t))}}async encrypt(e,t){const r=h(this,o).call(this,64),a=r.slice(0,32),n=r.slice(32,48),s=r.slice(48),c=await scrypt(t,a,w.dklen,{...w,N:w.n}),u=v.default.createCipheriv(_,c.slice(0,16),n),l=d.concat([u.update(e.toBuffer()),u.final()]),b=x.default("keccak256").update(d.concat([c.slice(16,32),l])).digest();return{crypto:{cipher:_,ciphertext:g.Data.from(l),cipherparams:{iv:g.Data.from(n)},kdf:"scrypt",kdfParams:{...w,salt:g.Data.from(a)},mac:g.Data.from(b)},id:asUUID(s),version:3}}async decrypt(e,t){const r=e.crypto;if(r.cipher!==_)throw new Error(`keyfile cypher must be "${_}"`);if("scrypt"!==r.kdf)throw new Error('keyfile kdf must be "script"');const a=r.kdfParams,n=a.salt,o=r.mac,s=r.ciphertext.toBuffer();let c,u;if(null!=t)try{c=await scrypt(t,n.toBuffer(),a.dklen,{...a,N:a.n}),u=x.default("keccak256").update(d.concat([c.slice(16,32),s])).digest()}catch{u=null}if(!u||!o.toBuffer().equals(u))throw new Error("could not decrypt key with given password");return v.default.createDecipheriv(r.cipher,c.slice(0,16),r.cipherparams.iv.toBuffer()).update(s)}static createAccount(e,t,r){const a=new b.Account(r);return a.privateKey=t,a.balance=e,a}static createAccountFromPrivateKey(e){const t=Q.Address.from(p.privateToAddress(e.toBuffer())),r=new b.Account(t);return r.privateKey=e,r}createRandomAccount(){const e=h(this,o).call(this,128),t=I.default.fromMasterSeed(e),r=uncompressedPublicKeyToAddress(t.publicKey),a=g.Data.from(t.privateKey);return Wallet.createAccount(g.RPCQUANTITY_ZERO,a,r)}async unlockAccount(e,t,r){const a=this.encryptedKeyFiles.get(e);if(null==a)return!1;const n=await this.decrypt(a,t),o=this.lockTimers.get(e);o&&clearTimeout(o);const s=1e3*r|0;if(s>0){const t=setTimeout(h(this,c),s,e);g.unref(t),this.lockTimers.set(e,t)}return this.unlockedAccounts.set(e,g.Data.from(n)),!0}async unlockUnknownAccount(e,t){if(this.unlockedAccounts.has(e))return!1;if(this.knownAccounts.has(e))throw new Error("cannot unlock known/personal account");const r=1e3*t|0;if(r>0){const t=setTimeout(h(this,c),r,e);g.unref(t),this.lockTimers.set(e,t)}return this.unlockedAccounts.set(e,null),!0}lockAccount(e){return!!this.unlockedAccounts.has(e)&&(clearTimeout(this.lockTimers.get(e)),h(this,c).call(this,e))}}t.default=Wallet,a=new WeakMap,n=new WeakMap,o=new WeakMap,s=new WeakMap,c=new WeakMap},(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var a=r(90);Object.defineProperty(t,"CheckpointTrie",{enumerable:!0,get:function(){return a.CheckpointTrie}});var n=r(101);Object.defineProperty(t,"SecureTrie",{enumerable:!0,get:function(){return n.SecureTrie}});var o=r(116);Object.defineProperty(t,"BaseTrie",{enumerable:!0,get:function(){return o.Trie}});var s=r(167);Object.defineProperty(t,"WalkController",{enumerable:!0,get:function(){return s.WalkController}})},function(e,t,r){"use strict";var a=this&&this.__awaiter||function(e,t,r,a){return new(r||(r=Promise))((function(n,o){function fulfilled(e){try{step(a.next(e))}catch(e){o(e)}}function rejected(e){try{step(a.throw(e))}catch(e){o(e)}}function step(e){e.done?n(e.value):function adopt(e){return e instanceof r?e:new r((function(t){t(e)}))}(e.value).then(fulfilled,rejected)}step((a=a.apply(e,t||[])).next())}))},n=this&&this.__generator||function(e,t){var r,a,n,o,s={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return o={next:verb(0),throw:verb(1),return:verb(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function verb(o){return function(c){return function step(o){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,a&&(n=2&o[0]?a.return:o[0]?a.throw||((n=a.return)&&n.call(a),0):a.next)&&!(n=n.call(a,o[1])).done)return n;switch(a=0,n&&(o=[2&o[0],n.value]),o[0]){case 0:case 1:n=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,a=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(n=s.trys,(n=n.length>0&&n[n.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!n||o[1]>n[0]&&o[1]=e.length&&(e=void 0),{value:e&&e[a++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0}),t.WalkController=void 0;var s=r(1380),c=r(91),d=function(){function WalkController(e,t,r){this.onNode=e,this.taskExecutor=new s.PrioritizedTaskExecutor(r),this.trie=t,this.resolve=function(){}}return WalkController.newWalk=function(e,t,r,o){return a(this,void 0,void 0,(function(){return n(this,(function(a){switch(a.label){case 0:return[4,new WalkController(e,t,null!=o?o:500).startWalk(r)];case 1:return a.sent(),[2]}}))}))},WalkController.prototype.startWalk=function(e){return a(this,void 0,void 0,(function(){var t=this;return n(this,(function(r){switch(r.label){case 0:return[4,new Promise((function(r){return a(t,void 0,void 0,(function(){var t;return n(this,(function(a){switch(a.label){case 0:return this.resolve=r,[4,this.trie._lookupNode(e)];case 1:return t=a.sent(),this.processNode(e,t,[]),[2]}}))}))}))];case 1:return[2,r.sent()]}}))}))},WalkController.prototype.allChildren=function(e,t){var r,a,n;if((void 0===t&&(t=[]),!(e instanceof c.LeafNode))&&(e instanceof c.ExtensionNode?n=[[e.key,e.value]]:e instanceof c.BranchNode&&(n=e.getChildren().map((function(e){return[[e[0]],e[1]]}))),n))try{for(var s=o(n),d=s.next();!d.done;d=s.next()){var u=d.value,h=u[0],l=u[1],b=t.concat(h),g=b.length;this.pushNodeToQueue(l,b,g)}}catch(e){r={error:e}}finally{try{d&&!d.done&&(a=s.return)&&a.call(s)}finally{if(r)throw r.error}}},WalkController.prototype.pushNodeToQueue=function(e,t,r){var o=this;void 0===t&&(t=[]),this.taskExecutor.executeOrQueue(null!=r?r:t.length,(function(r){return a(o,void 0,void 0,(function(){var a;return n(this,(function(n){switch(n.label){case 0:return[4,this.trie._lookupNode(e)];case 1:return a=n.sent(),r(),this.processNode(e,a,t),[2]}}))}))}))},WalkController.prototype.onlyBranchIndex=function(e,t,r,a){if(void 0===t&&(t=[]),!(e instanceof c.BranchNode))throw new Error("Expected branch node");var n=e.getBranch(r);if(!n)throw new Error("Could not get branch of childIndex");var o=t.slice();o.push(r);var s=null!=a?a:o.length;this.pushNodeToQueue(n,o,s)},WalkController.prototype.processNode=function(e,t,r){void 0===r&&(r=[]),this.onNode(e,t,r,this),this.taskExecutor.finished()&&this.resolve()},WalkController}();t.WalkController=d},(e,t,r)=>{e=r.nmd(e);var a="__lodash_hash_undefined__",n=9007199254740991,o="[object Arguments]",s="[object Boolean]",c="[object Date]",d="[object Function]",u="[object GeneratorFunction]",h="[object Map]",l="[object Number]",b="[object Object]",g="[object Promise]",p="[object RegExp]",B="[object Set]",m="[object String]",I="[object Symbol]",y="[object WeakMap]",v="[object ArrayBuffer]",x="[object DataView]",C="[object Float32Array]",Q="[object Float64Array]",w="[object Int8Array]",_="[object Int16Array]",k="[object Int32Array]",N="[object Uint8Array]",D="[object Uint8ClampedArray]",U="[object Uint16Array]",G="[object Uint32Array]",T=/\w*$/,L=/^\[object .+?Constructor\]$/,P=/^(?:0|[1-9]\d*)$/,q={};q[o]=q["[object Array]"]=q[v]=q[x]=q[s]=q[c]=q[C]=q[Q]=q[w]=q[_]=q[k]=q[h]=q[l]=q[b]=q[p]=q[B]=q[m]=q[I]=q[N]=q[D]=q[U]=q[G]=!0,q["[object Error]"]=q[d]=q[y]=!1;var O="object"==typeof r.g&&r.g&&r.g.Object===Object&&r.g,H="object"==typeof self&&self&&self.Object===Object&&self,Y=O||H||Function("return this")(),j=t&&!t.nodeType&&t,J=j&&e&&!e.nodeType&&e,z=J&&J.exports===j;function addMapEntry(e,t){return e.set(t[0],t[1]),e}function addSetEntry(e,t){return e.add(t),e}function arrayReduce(e,t,r,a){var n=-1,o=e?e.length:0;for(a&&o&&(r=e[++n]);++n-1},ListCache.prototype.set=function listCacheSet(e,t){var r=this.__data__,a=assocIndexOf(r,e);return a<0?r.push([e,t]):r[a][1]=t,this},MapCache.prototype.clear=function mapCacheClear(){this.__data__={hash:new Hash,map:new(It||ListCache),string:new Hash}},MapCache.prototype.delete=function mapCacheDelete(e){return getMapData(this,e).delete(e)},MapCache.prototype.get=function mapCacheGet(e){return getMapData(this,e).get(e)},MapCache.prototype.has=function mapCacheHas(e){return getMapData(this,e).has(e)},MapCache.prototype.set=function mapCacheSet(e,t){return getMapData(this,e).set(e,t),this},Stack.prototype.clear=function stackClear(){this.__data__=new ListCache},Stack.prototype.delete=function stackDelete(e){return this.__data__.delete(e)},Stack.prototype.get=function stackGet(e){return this.__data__.get(e)},Stack.prototype.has=function stackHas(e){return this.__data__.has(e)},Stack.prototype.set=function stackSet(e,t){var r=this.__data__;if(r instanceof ListCache){var a=r.__data__;if(!It||a.length<199)return a.push([e,t]),this;r=this.__data__=new MapCache(a)}return r.set(e,t),this};var Nt=bt?overArg(bt,Object):function stubArray(){return[]},Dt=function baseGetTag(e){return it.call(e)};function isIndex(e,t){return!!(t=null==t?n:t)&&("number"==typeof e||P.test(e))&&e>-1&&e%1==0&&e-1&&e%1==0&&e<=n}(e.length)&&!isFunction(e)}var Ft=pt||function stubFalse(){return!1};function isFunction(e){var t=isObject(e)?it.call(e):"";return t==d||t==u}function isObject(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function keys(e){return isArrayLike(e)?arrayLikeKeys(e):function baseKeys(e){if(!isPrototype(e))return Bt(e);var t=[];for(var r in Object(e))at.call(e,r)&&"constructor"!=r&&t.push(r);return t}(e)}e.exports=function cloneDeep(e){return baseClone(e,!0,!0)}},(e,t,r)=>{var a=r(145),n=r(216),o=r(396);e.exports=a?function(e,t,r){return n.f(e,t,o(1,r))}:function(e,t,r){return e[t]=r,e}},(e,t,r)=>{e=r.nmd(e);var a=r(661),n=r(1116),o=t&&!t.nodeType&&t,s=o&&e&&!e.nodeType&&e,c=s&&s.exports===o?a.Buffer:void 0,d=(c?c.isBuffer:void 0)||n;e.exports=d},(e,t,r)=>{e=r.nmd(e);var a=r(662),n=t&&!t.nodeType&&t,o=n&&e&&!e.nodeType&&e,s=o&&o.exports===n&&a.process,c=function(){try{var e=o&&o.require&&o.require("util").types;return e||s&&s.binding&&s.binding("util")}catch(e){}}();e.exports=c},function(e,t,r){"use strict";var a,n,o,s=r(0).Buffer,c=this&&this.__classPrivateFieldSet||function(e,t,r){if(!t.has(e))throw new TypeError("attempted to set private field on non-instance");return t.set(e,r),r},d=this&&this.__classPrivateFieldGet||function(e,t){if(!t.has(e))throw new TypeError("attempted to get private field on non-instance");return t.get(e)},u=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const h=u(r(173)),l=r(14),b=r(8),g=r(88),p=r(47),B=r(18),m=s.from([]);class BlockManager extends h.default{constructor(e,t,r,s){super(s,g.Block,t),a.set(this,void 0),n.set(this,void 0),o.set(this,void 0),this.fromFallback=async e=>{const t=d(this,a).fallback;let r;if("string"==typeof e)r=e;else{if(e.toBigInt()>t.blockNumber.toBigInt())return null;r=e.toString()}const o=await t.request("eth_getBlockByNumber",[r,!0]);return null==o?null:BlockManager.rawFromJSON(o,d(this,n))},c(this,a,e),c(this,n,t),c(this,o,r)}static async initialize(e,t,r,a){const n=new BlockManager(e,t,r,a);return await n.updateTaggedBlocks(),n}static rawFromJSON(e,t){const r=[b.Data.from(e.parentHash).toBuffer(),b.Data.from(e.sha3Uncles).toBuffer(),p.Address.from(e.miner).toBuffer(),b.Data.from(e.stateRoot).toBuffer(),b.Data.from(e.transactionsRoot).toBuffer(),b.Data.from(e.receiptsRoot).toBuffer(),b.Data.from(e.logsBloom).toBuffer(),b.Quantity.from(e.difficulty).toBuffer(),b.Quantity.from(e.number).toBuffer(),b.Quantity.from(e.gasLimit).toBuffer(),b.Quantity.from(e.gasUsed).toBuffer(),b.Quantity.from(e.timestamp).toBuffer(),b.Data.from(e.extraData).toBuffer(),b.Data.from(e.mixHash).toBuffer(),b.Data.from(e.nonce).toBuffer()];void 0!==e.baseFeePerGas&&(r[15]=b.Data.from(e.baseFeePerGas).toBuffer());const a=b.Quantity.from(e.totalDifficulty).toBuffer(),n=[],o=[];return e.transactions.forEach(((r,a)=>{const s=[b.Quantity.from(r.from).toBuffer(),b.Quantity.from(r.hash).toBuffer()],c=[...s,b.Data.from(e.hash).toBuffer(),b.Quantity.from(e.number).toBuffer(),a],d=B.TransactionFactory.fromRpc(r,t,c),u=d.toEthRawTransaction(d.v.toBuffer(),d.r.toBuffer(),d.s.toBuffer());n.push(u),o.push(s)})),g.serialize([r,n,[],a,o]).serialized}getBlockByTag(e){switch(l.Tag.normalize(e)){case l.Tag.LATEST:return this.latest;case void 0:case null:break;case l.Tag.PENDING:return this.latest;case l.Tag.EARLIEST:return this.earliest;default:throw new Error(`Invalid block Tag: ${e}`)}}getEffectiveNumber(e=l.Tag.LATEST){if("string"==typeof e){const t=this.getBlockByTag(e);if(t)return t.header.number}return b.Quantity.from(e)}async getNumberFromHash(e){return d(this,o).get(b.Data.from(e).toBuffer()).catch((e=>{if(404===e.status)return null;throw e}))}async getByHash(e){const t=await this.getNumberFromHash(e);if(null===t){if(d(this,a).fallback){const t=d(this,a).fallback,r=await t.request("eth_getBlockByHash",[b.Data.from(e),!0]);return r&&BigInt(r.number)<=t.blockNumber.toBigInt()?new g.Block(BlockManager.rawFromJSON(r,d(this,n)),d(this,n)):null}return null}return this.get(t)}async getRawByBlockNumber(e){const t=d(this,a).fallback,r=e.toBuffer();return this.getRaw(r).then((r=>null==r&&t?this.fromFallback(e):r))}async get(e){if("string"==typeof e){const t=this.getBlockByTag(e);if(t)return t}const t=await this.getRawByBlockNumber(b.Quantity.from(e));if(t)return new g.Block(t,d(this,n));throw new Error("header not found")}async putBlock(e,t,r){let a=e;m.equals(a)&&(a=s.from([0]));const n=t.toBuffer();await Promise.all([d(this,o).put(n,a),super.set(a,r)])}updateTaggedBlocks(){return new Promise(((e,t)=>{this.base.createValueStream({limit:1}).on("data",(e=>{this.earliest=new g.Block(e,d(this,n))})).on("error",(e=>{t(e)})).on("end",(()=>{e(void 0)})),this.base.createValueStream({reverse:!0,limit:1}).on("data",(e=>{this.latest=new g.Block(e,d(this,n))})).on("error",(e=>{t(e)})).on("end",(()=>{e(void 0)}))}))}}t.default=BlockManager,a=new WeakMap,n=new WeakMap,o=new WeakMap},function(e,t,r){"use strict";var a,n,o=this&&this.__classPrivateFieldSet||function(e,t,r){if(!t.has(e))throw new TypeError("attempted to set private field on non-instance");return t.set(e,r),r},s=this&&this.__classPrivateFieldGet||function(e,t){if(!t.has(e))throw new TypeError("attempted to get private field on non-instance");return t.get(e)};Object.defineProperty(t,"__esModule",{value:!0});const c=r(8);t.default=class Manager{constructor(e,t,r){a.set(this,void 0),n.set(this,void 0),o(this,a,t),o(this,n,r),this.base=e}getRaw(e){return"string"==typeof e&&(e=c.Data.from(e).toBuffer()),0===e.length&&(e=c.BUFFER_ZERO),this.base.get(e).catch((e=>{if(404===e.status)return null;throw e}))}async get(e){const t=await this.getRaw(e);return t?new(s(this,a))(t,s(this,n)):null}set(e,t){return this.base.put(e,t)}del(e){return this.base.del(e)}},a=new WeakMap,n=new WeakMap},function(e,t,r){"use strict";var a,n,o,s,c,d,u=r(0).Buffer,h=this&&this.__classPrivateFieldSet||function(e,t,r){if(!t.has(e))throw new TypeError("attempted to set private field on non-instance");return t.set(e,r),r},l=this&&this.__classPrivateFieldGet||function(e,t){if(!t.has(e))throw new TypeError("attempted to get private field on non-instance");return t.get(e)},b=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.TriageOption=void 0;const g=b(r(178)),p=r(8),B=r(8),m=r(14);function shouldReplace(e,t,r,a){if(e.nonce.toBigInt()!==t)return!1;const n=e.effectiveGasPrice.toBigInt(),o=n+n*a/100n;if(!e.locked&&r>o)return!0;throw new m.CodedError(m.UNDERPRICED,B.JsonRpcErrorCode.TRANSACTION_REJECTED)}function byNonce(e,t,r){return(e[r].nonce.toBigInt()||0n)>(e[t].nonce.toBigInt()||0n)}var I;!function(e){e[e.FutureQueue=0]="FutureQueue",e[e.Executable=1]="Executable",e[e.ReplacesPendingExecutable=2]="ReplacesPendingExecutable",e[e.ReplacesFutureTransaction=3]="ReplacesFutureTransaction"}(I=t.TriageOption||(t.TriageOption={}));class TransactionPool extends g.default.Typed{constructor(e,t,r=new Map){super(),a.set(this,void 0),n.set(this,10n),o.set(this,void 0),this.executables={inProgress:new Set,pending:new Map},s.set(this,void 0),c.set(this,new Map),this.drain=()=>{this.emit("drain")},d.set(this,(e=>{if(e.gas>l(this,a).blockGasLimit)return new m.CodedError(m.GAS_LIMIT,B.JsonRpcErrorCode.INVALID_INPUT);const t=e.calculateIntrinsicGas();return-1n===t||e.gas.toBigInt()y&&(y=n)}void 0===h?(h=y+1n,e.nonce=B.Quantity.from(h),C=I.Executable):h===y+1n&&(C=I.Executable)}else{g||(g=l(this,o).accounts.getNonce(a),l(this,c).set(b,g),g.then((()=>{l(this,c).delete(b)})));const t=await g,r=t?t.toBigInt():0n;if(void 0===h)h=r||0n,e.nonce=B.Quantity.from(h),C=I.Executable;else{if(h{"use strict";var a=r(415);e.exports=a.call(Function.call,Object.prototype.hasOwnProperty)},(e,t,r)=>{var a=r(11).Buffer;function Hash(e,t){this._block=a.alloc(e),this._finalSize=t,this._blockSize=e,this._len=0}Hash.prototype.update=function(e,t){"string"==typeof e&&(t=t||"utf8",e=a.from(e,t));for(var r=this._block,n=this._blockSize,o=e.length,s=this._len,c=0;c=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 a=(4294967295&r)>>>0,n=(r-a)/4294967296;this._block.writeUInt32BE(n,this._blockSize-8),this._block.writeUInt32BE(a,this._blockSize-4)}this._update(this._block);var o=this._hash();return e?o.toString(e):o},Hash.prototype._update=function(){throw new Error("_update must be implemented by subclass")},e.exports=Hash},function(e,t,r){"use strict";var a,n,o=this&&this.__classPrivateFieldSet||function(e,t,r){if(!t.has(e))throw new TypeError("attempted to set private field on non-instance");return t.set(e,r),r},s=this&&this.__classPrivateFieldGet||function(e,t){if(!t.has(e))throw new TypeError("attempted to get private field on non-instance");return t.get(e)},c=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.Connector=t.Provider=void 0;const d=c(r(178)),u=r(8),h=c(r(179)),l=r(14);t.Provider=h.default;class Connector extends d.default.Typed{constructor(e=null,t){super(),a.set(this,void 0),n.set(this,((e,t)=>{const r=e.method;if("eth_subscribe"===r&&function isHttp(e){return"uWS.HttpRequest"===e.constructor.name||"HttpRequest"===e.constructor.name}(t))return Promise.reject(new l.CodedError("notifications not supported",u.JsonRpcErrorCode.METHOD_NOT_SUPPORTED));const n=e.params;return s(this,a)._requestRaw({method:r,params:n})})),o(this,a,new h.default(e,t))}get provider(){return s(this,a)}async connect(){await s(this,a).initialize(),await this.emit("ready")}parse(e){try{return JSON.parse(e)}catch(e){throw new l.CodedError(e.message,u.JsonRpcErrorCode.PARSE_ERROR)}}handle(e,t){if(Array.isArray(e)){const r=e.map((e=>s(this,n).call(this,e,t).then((({value:e})=>e)).catch((e=>e))));return Promise.resolve({value:Promise.all(r)})}return s(this,n).call(this,e,t)}format(e,t){if(Array.isArray(t))return JSON.stringify(t.map(((t,r)=>{const a=e[r];return a instanceof Error?u.makeError(t.id,a):u.makeResponse(t.id,a)})));{const r=u.makeResponse(t.id,e);return JSON.stringify(r)}}formatError(e,t){const r=u.makeError(t&&t.id?t.id:null,e);return JSON.stringify(r)}close(){return s(this,a).disconnect()}}t.Connector=Connector,a=new WeakMap,n=new WeakMap},e=>{"use strict";const t=new WeakMap,r=new WeakMap,a=new WeakMap,n=Symbol("anyProducer"),o=Promise.resolve(),s=Symbol("listenerAdded"),c=Symbol("listenerRemoved");function assertEventName(e){if("string"!=typeof e&&"symbol"!=typeof e)throw new TypeError("eventName must be a string or a symbol")}function assertListener(e){if("function"!=typeof e)throw new TypeError("listener must be a function")}function getListeners(e,t){const a=r.get(e);return a.has(t)||a.set(t,new Set),a.get(t)}function getEventProducers(e,t){const r="string"==typeof t||"symbol"==typeof t?t:n,o=a.get(e);return o.has(r)||o.set(r,new Set),o.get(r)}function iterator(e,t){t=Array.isArray(t)?t:[t];let r=!1,flush=()=>{},a=[];const n={enqueue(e){a.push(e),flush()},finish(){r=!0,flush()}};for(const r of t)getEventProducers(e,r).add(n);return{async next(){return a?0===a.length?r?(a=void 0,this.next()):(await new Promise((e=>{flush=e})),this.next()):{done:!1,value:await a.shift()}:{done:!0}},async return(r){a=void 0;for(const r of t)getEventProducers(e,r).delete(n);return flush(),arguments.length>0?{done:!0,value:await r}:{done:!0}},[Symbol.asyncIterator](){return this}}}function defaultMethodNamesOrAssert(e){if(void 0===e)return d;if(!Array.isArray(e))throw new TypeError("`methodNames` must be an array of strings");for(const t of e)if(!d.includes(t)){if("string"!=typeof t)throw new TypeError("`methodNames` element must be a string");throw new Error(`${t} is not Emittery method`)}return e}const isListenerSymbol=e=>e===s||e===c;class Emittery{static mixin(e,t){return t=defaultMethodNamesOrAssert(t),r=>{if("function"!=typeof r)throw new TypeError("`target` must be function");for(const e of t)if(void 0!==r.prototype[e])throw new Error(`The property \`${e}\` already exists on \`target\``);Object.defineProperty(r.prototype,e,{enumerable:!1,get:function getEmitteryProperty(){return Object.defineProperty(this,e,{enumerable:!1,value:new Emittery}),this[e]}});const emitteryMethodCaller=t=>function(...r){return this[e][t](...r)};for(const e of t)Object.defineProperty(r.prototype,e,{enumerable:!1,value:emitteryMethodCaller(e)});return r}}constructor(){t.set(this,new Set),r.set(this,new Map),a.set(this,new Map)}on(e,t){assertListener(t),e=Array.isArray(e)?e:[e];for(const r of e)assertEventName(r),getListeners(this,r).add(t),isListenerSymbol(r)||this.emit(s,{eventName:r,listener:t});return this.off.bind(this,e,t)}off(e,t){assertListener(t),e=Array.isArray(e)?e:[e];for(const r of e)assertEventName(r),getListeners(this,r).delete(t),isListenerSymbol(r)||this.emit(c,{eventName:r,listener:t})}once(e){return new Promise((t=>{const r=this.on(e,(e=>{r(),t(e)}))}))}events(e){e=Array.isArray(e)?e:[e];for(const t of e)assertEventName(t);return iterator(this,e)}async emit(e,r){assertEventName(e),function enqueueProducers(e,t,r){const o=a.get(e);if(o.has(t))for(const e of o.get(t))e.enqueue(r);if(o.has(n)){const e=Promise.all([t,r]);for(const t of o.get(n))t.enqueue(e)}}(this,e,r);const s=getListeners(this,e),c=t.get(this),d=[...s],u=isListenerSymbol(e)?[]:[...c];await o,await Promise.all([...d.map((async e=>{if(s.has(e))return e(r)})),...u.map((async t=>{if(c.has(t))return t(e,r)}))])}async emitSerial(e,r){assertEventName(e);const a=getListeners(this,e),n=t.get(this),s=[...a],c=[...n];await o;for(const e of s)a.has(e)&&await e(r);for(const t of c)n.has(t)&&await t(e,r)}onAny(e){return assertListener(e),t.get(this).add(e),this.emit(s,{listener:e}),this.offAny.bind(this,e)}anyEvent(){return iterator(this)}offAny(e){assertListener(e),this.emit(c,{listener:e}),t.get(this).delete(e)}clearListeners(e){e=Array.isArray(e)?e:[e];for(const n of e)if("string"==typeof n||"symbol"==typeof n){getListeners(this,n).clear();const e=getEventProducers(this,n);for(const t of e)t.finish();e.clear()}else{t.get(this).clear();for(const e of r.get(this).values())e.clear();for(const e of a.get(this).values()){for(const t of e)t.finish();e.clear()}}}listenerCount(e){e=Array.isArray(e)?e:[e];let n=0;for(const o of e)if("string"!=typeof o){void 0!==o&&assertEventName(o),n+=t.get(this).size;for(const e of r.get(this).values())n+=e.size;for(const e of a.get(this).values())n+=e.size}else n+=t.get(this).size+getListeners(this,o).size+getEventProducers(this,o).size+getEventProducers(this).size;return n}bindMethods(e,t){if("object"!=typeof e||null===e)throw new TypeError("`target` must be an object");t=defaultMethodNamesOrAssert(t);for(const r of t){if(void 0!==e[r])throw new Error(`The property \`${r}\` already exists on \`target\``);Object.defineProperty(e,r,{enumerable:!1,value:this[r].bind(this)})}}}const d=Object.getOwnPropertyNames(Emittery.prototype).filter((e=>"constructor"!==e));Emittery.Typed=class extends Emittery{},Object.defineProperty(Emittery.Typed,"Typed",{enumerable:!1,value:void 0}),Object.defineProperty(Emittery,"listenerAdded",{value:s,writable:!1,enumerable:!0,configurable:!1}),Object.defineProperty(Emittery,"listenerRemoved",{value:c,writable:!1,enumerable:!0,configurable:!1}),e.exports=Emittery},function(e,t,r){"use strict";var a,n,o,s,c,d,u,h,l,b=this&&this.__classPrivateFieldSet||function(e,t,r){if(!t.has(e))throw new TypeError("attempted to set private field on non-instance");return t.set(e,r),r},g=this&&this.__classPrivateFieldGet||function(e,t){if(!t.has(e))throw new TypeError("attempted to get private field on non-instance");return t.get(e)},p=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const B=p(r(178)),m=p(r(124)),I=r(8),y=r(206),v=p(r(168)),x=p(r(165)),C=p(r(65)),Q=r(227),w=r(47);class EthereumProvider extends B.default.Typed{constructor(e={},t){super(),a.set(this,void 0),n.set(this,void 0),o.set(this,void 0),s.set(this,void 0),c.set(this,void 0),this.removeListener=this.off,d.set(this,((e,t)=>{let r,a,n;if("string"==typeof e)r=e,a=t,n=this.request({method:r,params:a});else{if("function"!=typeof t)throw new Error("No callback provided to provider's send function. As of web3 1.0, provider.send is no longer synchronous and must be passed a callback as its final argument.");if(Array.isArray(e)){const r=t;g(this,h).call(this,e).then((({error:e,result:t})=>{r(e,t)}))}else{const r=t;g(this,l).call(this,e).then((({error:e,result:t})=>{r(e,t)}))}}return n})),u.set(this,((e,t)=>{const r=g(this,a);r.logging.verbose?r.logging.logger.log(` > ${e}: ${null==t?t:JSON.stringify(t,null,2).split("\n").join("\n > ")}`):r.logging.logger.log(e)})),this.disconnect=async()=>{await g(this,c).stop(),this.emit("disconnect")},h.set(this,(e=>Promise.all(e.map(g(this,l))).then((e=>{let t=null;const r=[];return e.forEach((({error:e,result:a},n)=>{r.push(a),e&&(null==t&&(t=new Error("Batch error:")),t.errors[n]=e)})),{error:t,result:r}})))),l.set(this,(async e=>{const t=e.method,r=e.params;try{const a=await this.request({method:t,params:r});return{error:null,result:I.makeResponse(e.id,JSON.parse(JSON.stringify(a)))}}catch(t){let r;return I.hasOwn(t,"result")&&(r=t.result,delete t.result),{error:t,result:I.makeError(e.id,t,r)}}})),b(this,o,t);const r=b(this,a,y.EthereumOptionsConfig.normalize(e)),p=b(this,s,new x.default(r.wallet)),v=p.initialAccounts,_=r.fork.url||r.fork.provider?new Q.Fork(r,v):null,k=function parseCoinbase(e,t){switch(typeof e){case"object":return e;case"number":const r=t[e];if(r)return r.address;throw new Error(`invalid coinbase address index: ${e}`);case"string":return w.Address.from(e);default:throw new Error(`coinbase address must be string or number, received: ${e}`)}}(r.miner.coinbase,v),N=new C.default(r,k,_);b(this,c,N),N.on("ganache:vm:tx:before",(e=>{this.emit("ganache:vm:tx:before",e)})),N.on("ganache:vm:tx:step",(e=>{this.emit("ganache:vm:tx:step",e)})),N.on("ganache:vm:tx:after",(e=>{this.emit("ganache:vm:tx:after",e)})),function hookEventSystem(e,t){let r=0;e.on(B.default.listenerAdded,(({eventName:e})=>{"ganache:vm:tx:step"!==e&&void 0!==e||(0===r&&t(!0),r++)})),e.on(B.default.listenerRemoved,(({eventName:e})=>{"ganache:vm:tx:step"!==e&&void 0!==e||(r--,0===r&&t(!1))}))}(this,(e=>{N.toggleStepEvent(e)})),b(this,n,new m.default(r,p,N))}async initialize(){await g(this,c).initialize(g(this,s).initialAccounts),this.emit("connect")}getOptions(){return v.default(g(this,a))}getInitialAccounts(){const e={},t=g(this,s),r=g(this,s).unlockedAccounts;return t.initialAccounts.forEach((t=>{const a=t.address.toString();e[a]={secretKey:t.privateKey.toString(),balance:t.balance.toBigInt(),unlocked:r.has(a)}})),e}send(e,t){return g(this,d).call(this,e,t)}sendAsync(e,t){g(this,d).call(this,e,t)}async request(e){const t=await this._requestRaw(e),r=await t.value;return JSON.parse(JSON.stringify(r))}async _requestRaw({method:e,params:t}){g(this,u).call(this,e,t);const r=(await g(this,o).execute(g(this,n),e,t)).value;r instanceof I.PromiEvent&&r.on("message",(e=>{this.emit("message",e),this.emit("data",{jsonrpc:"2.0",method:"eth_subscription",params:e.data})}));return{value:r.catch((e=>{throw g(this,a).chain.vmErrorsOnRPCResponse&&I.hasOwn(e,"result")&&(e.result=JSON.parse(JSON.stringify(e.result))),e}))}}}t.default=EthereumProvider,a=new WeakMap,n=new WeakMap,o=new WeakMap,s=new WeakMap,c=new WeakMap,d=new WeakMap,u=new WeakMap,h=new WeakMap,l=new WeakMap},(e,t,r)=>{"use strict";var a=r(3).Buffer;Object.defineProperty(t,"__esModule",{value:!0}),t.getLength=t.decode=t.encode=void 0;var n=r(477);function safeParseInt(e,t){if("00"===e.slice(0,2))throw new Error("invalid RLP: extra zeros");return parseInt(e,t)}function encodeLength(e,t){if(e<56)return a.from([e+t]);var r=intToHex(e),n=intToHex(t+55+r.length/2);return a.from(n+r,"hex")}function _decode(e){var t,r,n,o,s,c=[],d=e[0];if(d<=127)return{data:e.slice(0,1),remainder:e.slice(1)};if(d<=183){if(t=d-127,n=128===d?a.from([]):e.slice(1,t),2===t&&n[0]<128)throw new Error("invalid rlp encoding: byte must be less 0x80");return{data:n,remainder:e.slice(t)}}if(d<=191){if(r=d-182,e.length-1e.length)throw new Error("invalid rlp: total length is larger than the data");if(0===(o=e.slice(r,u)).length)throw new Error("invalid rlp, List has a invalid length");for(;o.length;)s=_decode(o),c.push(s.data),o=s.remainder;return{data:c,remainder:e.slice(u)}}function isHexPrefixed(e){return"0x"===e.slice(0,2)}function intToHex(e){if(e<0)throw new Error("Invalid integer as argument, must be unsigned!");var t=e.toString(16);return t.length%2?"0"+t:t}function toBuffer(e){if(!a.isBuffer(e)){if("string"==typeof e)return isHexPrefixed(e)?a.from(function padToEven(e){return e.length%2?"0"+e:e}(function stripHexPrefix(e){return"string"!=typeof e?e:isHexPrefixed(e)?e.slice(2):e}(e)),"hex"):a.from(e);if("number"==typeof e||"bigint"==typeof e)return e?function intToBuffer(e){var t=intToHex(e);return a.from(t,"hex")}(e):a.from([]);if(null==e)return a.from([]);if(e instanceof Uint8Array)return a.from(e);if(n.isBN(e))return a.from(e.toArray());throw new Error("invalid type")}return e}t.encode=function encode(e){if(Array.isArray(e)){for(var t=[],r=0;r{"use strict";var a=r(3).Buffer;Object.defineProperty(t,"__esModule",{value:!0}),t.importPublic=t.privateToPublic=t.privateToAddress=t.publicToAddress=t.pubToAddress=t.isValidPublic=t.isValidPrivate=t.isPrecompiled=t.generateAddress2=t.generateAddress=t.isValidChecksumAddress=t.toChecksumAddress=t.isZeroAddress=t.isValidAddress=t.zeroAddress=void 0;var n=r(6),o=r(87),s=r(332),c=r(126),d=r(70),u=r(274);t.zeroAddress=function(){var e=d.zeros(20);return d.bufferToHex(e)},t.isValidAddress=function(e){return/^0x[0-9a-fA-F]{40}$/.test(e)},t.isZeroAddress=function(e){return t.zeroAddress()===d.addHexPrefix(e)},t.toChecksumAddress=function(e,t){e=o.stripHexPrefix(e).toLowerCase();for(var r=void 0!==t?t.toString()+"0x":"",a=u.keccak(r+e).toString("hex"),n="0x",s=0;s=8?n+=e[s].toUpperCase():n+=e[s];return n},t.isValidChecksumAddress=function(e,r){return t.isValidAddress(e)&&t.toChecksumAddress(e,r)===e},t.generateAddress=function(e,t){e=d.toBuffer(e);var r=new c(t);return r.isZero()?u.rlphash([e,null]).slice(-20):u.rlphash([e,a.from(r.toArray())]).slice(-20)},t.generateAddress2=function(e,t,r){var o=d.toBuffer(e),s=d.toBuffer(t),c=d.toBuffer(r);return n(20===o.length),n(32===s.length),u.keccak256(a.concat([a.from("ff","hex"),o,s,u.keccak256(c)])).slice(-20)},t.isPrecompiled=function(e){var t=d.unpad(e);return 1===t.length&&t[0]>=1&&t[0]<=8},t.isValidPrivate=function(e){return s.privateKeyVerify(e)},t.isValidPublic=function(e,t){return void 0===t&&(t=!1),64===e.length?s.publicKeyVerify(a.concat([a.from([4]),e])):!!t&&s.publicKeyVerify(e)},t.pubToAddress=function(e,t){return void 0===t&&(t=!1),e=d.toBuffer(e),t&&64!==e.length&&(e=s.publicKeyConvert(e,!1).slice(1)),n(64===e.length),u.keccak(e).slice(-20)},t.publicToAddress=t.pubToAddress,t.privateToAddress=function(e){return t.publicToAddress(t.privateToPublic(e))},t.privateToPublic=function(e){return e=d.toBuffer(e),s.publicKeyCreate(e,!1).slice(1)},t.importPublic=function(e){return 64!==(e=d.toBuffer(e)).length&&(e=s.publicKeyConvert(e,!1).slice(1)),e}},(e,t,r)=>{"use strict";var a=r(1),n=Object.keys||function(e){var t=[];for(var r in e)t.push(r);return t};e.exports=Duplex;var o=r(489),s=r(492);r(21)(Duplex,o);for(var c=n(s.prototype),d=0;d{var a=r(56).Buffer;function Hash(e,t){this._block=a.alloc(e),this._finalSize=t,this._blockSize=e,this._len=0}Hash.prototype.update=function(e,t){"string"==typeof e&&(t=t||"utf8",e=a.from(e,t));for(var r=this._block,n=this._blockSize,o=e.length,s=this._len,c=0;c=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 a=(4294967295&r)>>>0,n=(r-a)/4294967296;this._block.writeUInt32BE(n,this._blockSize-8),this._block.writeUInt32BE(a,this._blockSize-4)}this._update(this._block);var o=this._hash();return e?o.toString(e):o},Hash.prototype._update=function(){throw new Error("_update must be implemented by subclass")},e.exports=Hash},function(e,t,r){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.KECCAK256_RLP=t.KECCAK256_RLP_S=t.KECCAK256_RLP_ARRAY=t.KECCAK256_RLP_ARRAY_S=t.KECCAK256_NULL=t.KECCAK256_NULL_S=t.TWO_POW256=t.MAX_INTEGER=void 0;var n=r(3).Buffer,o=a(r(127));t.MAX_INTEGER=new o.default("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",16),t.TWO_POW256=new o.default("10000000000000000000000000000000000000000000000000000000000000000",16),t.KECCAK256_NULL_S="c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470",t.KECCAK256_NULL=n.from(t.KECCAK256_NULL_S,"hex"),t.KECCAK256_RLP_ARRAY_S="1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",t.KECCAK256_RLP_ARRAY=n.from(t.KECCAK256_RLP_ARRAY_S,"hex"),t.KECCAK256_RLP_S="56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",t.KECCAK256_RLP=n.from(t.KECCAK256_RLP_S,"hex")},function(e,t,r){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.KECCAK256_RLP=t.KECCAK256_RLP_S=t.KECCAK256_RLP_ARRAY=t.KECCAK256_RLP_ARRAY_S=t.KECCAK256_NULL=t.KECCAK256_NULL_S=t.TWO_POW256=t.MAX_INTEGER=void 0;var n=r(4).Buffer,o=a(r(130));t.MAX_INTEGER=new o.default("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",16),t.TWO_POW256=new o.default("10000000000000000000000000000000000000000000000000000000000000000",16),t.KECCAK256_NULL_S="c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470",t.KECCAK256_NULL=n.from(t.KECCAK256_NULL_S,"hex"),t.KECCAK256_RLP_ARRAY_S="1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",t.KECCAK256_RLP_ARRAY=n.from(t.KECCAK256_RLP_ARRAY_S,"hex"),t.KECCAK256_RLP_S="56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",t.KECCAK256_RLP=n.from(t.KECCAK256_RLP_S,"hex")},(e,t,r)=>{"use strict";var a=r(4).Buffer,n=r(509),o=r(868);function padToEven(e){var t=e;if("string"!=typeof t)throw new Error("[ethjs-util] while padding to even, value must be string, is currently "+typeof t+", while padToEven.");return t.length%2&&(t="0"+t),t}function intToHex(e){return"0x"+e.toString(16)}e.exports={arrayContainsArray:function arrayContainsArray(e,t,r){if(!0!==Array.isArray(e))throw new Error("[ethjs-util] method arrayContainsArray requires input 'superset' to be an array got type '"+typeof e+"'");if(!0!==Array.isArray(t))throw new Error("[ethjs-util] method arrayContainsArray requires input 'subset' to be an array got type '"+typeof t+"'");return t[Boolean(r)?"some":"every"]((function(t){return e.indexOf(t)>=0}))},intToBuffer:function intToBuffer(e){var t=intToHex(e);return new a(padToEven(t.slice(2)),"hex")},getBinarySize:function getBinarySize(e){if("string"!=typeof e)throw new Error("[ethjs-util] while getting binary size, method getBinarySize requires input 'str' to be type String, got '"+typeof e+"'.");return a.byteLength(e,"utf8")},isHexPrefixed:n,stripHexPrefix:o,padToEven,intToHex,fromAscii:function fromAscii(e){for(var t="",r=0;r{"use strict";var a=r(1),n=Object.keys||function(e){var t=[];for(var r in e)t.push(r);return t};e.exports=Duplex;var o=r(511),s=r(514);r(22)(Duplex,o);for(var c=n(s.prototype),d=0;d{var a=r(58).Buffer;function Hash(e,t){this._block=a.alloc(e),this._finalSize=t,this._blockSize=e,this._len=0}Hash.prototype.update=function(e,t){"string"==typeof e&&(t=t||"utf8",e=a.from(e,t));for(var r=this._block,n=this._blockSize,o=e.length,s=this._len,c=0;c=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 a=(4294967295&r)>>>0,n=(r-a)/4294967296;this._block.writeUInt32BE(n,this._blockSize-8),this._block.writeUInt32BE(a,this._blockSize-4)}this._update(this._block);var o=this._hash();return e?o.toString(e):o},Hash.prototype._update=function(){throw new Error("_update must be implemented by subclass")},e.exports=Hash},function(e,t,r){"use strict";var a=this&&this.__createBinding||(Object.create?function(e,t,r,a){void 0===a&&(a=r),Object.defineProperty(e,a,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,a){void 0===a&&(a=r),e[a]=t[r]}),n=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||t.hasOwnProperty(r)||a(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0});var o=r(190);Object.defineProperty(t,"Transaction",{enumerable:!0,get:function(){return o.default}});var s=r(192);Object.defineProperty(t,"AccessListEIP2930Transaction",{enumerable:!0,get:function(){return s.default}});var c=r(1324);Object.defineProperty(t,"TransactionFactory",{enumerable:!0,get:function(){return c.default}});var d=r(193);Object.defineProperty(t,"FeeMarketEIP1559Transaction",{enumerable:!0,get:function(){return d.default}}),n(r(191),t)},function(e,t,r){"use strict";var a,n=r(4).Buffer,o=this&&this.__extends||(a=function(e,t){return(a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function __(){this.constructor=e}a(e,t),e.prototype=null===t?Object.create(t):(__.prototype=t.prototype,new __)}),s=this&&this.__assign||function(){return(s=Object.assign||function(e){for(var t,r=1,a=arguments.length;r0)&&!(a=o.next()).done;)s.push(a.value)}catch(e){n={error:e}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return s};Object.defineProperty(t,"__esModule",{value:!0});var d=r(16),u=r(191),h=r(133),l=function(e){function Transaction(t,r){var a;void 0===r&&(r={});var n=e.call(this,s(s({},t),{type:0}))||this;if(n.common=n._validateTxV(n.v,r.common),n.gasPrice=new d.BN(d.toBuffer(""===t.gasPrice?"0x":t.gasPrice)),n._validateCannotExceedMaxInteger({gasPrice:n.gasPrice}),n.common.gteHardfork("spuriousDragon"))if(n.isSigned()){var o=n.v,c=n.common.chainIdBN().muln(2);(o.eq(c.addn(35))||o.eq(c.addn(36)))&&n.activeCapabilities.push(u.Capability.EIP155ReplayProtection)}else n.activeCapabilities.push(u.Capability.EIP155ReplayProtection);return(null===(a=null==r?void 0:r.freeze)||void 0===a||a)&&Object.freeze(n),n}return o(Transaction,e),Transaction.fromTxData=function(e,t){return void 0===t&&(t={}),new Transaction(e,t)},Transaction.fromSerializedTx=function(e,t){void 0===t&&(t={});var r=d.rlp.decode(e);if(!Array.isArray(r))throw new Error("Invalid serialized tx input. Must be array");return this.fromValuesArray(r,t)},Transaction.fromRlpSerializedTx=function(e,t){return void 0===t&&(t={}),Transaction.fromSerializedTx(e,t)},Transaction.fromValuesArray=function(e,t){if(void 0===t&&(t={}),6!==e.length&&9!==e.length)throw new Error("Invalid transaction. Only expecting 6 values (for unsigned tx) or 9 values (for signed tx).");var r=c(e,9);return new Transaction({nonce:r[0],gasPrice:r[1],gasLimit:r[2],to:r[3],value:r[4],data:r[5],v:r[6],r:r[7],s:r[8]},t)},Transaction.prototype.raw=function(){return[d.bnToUnpaddedBuffer(this.nonce),d.bnToUnpaddedBuffer(this.gasPrice),d.bnToUnpaddedBuffer(this.gasLimit),void 0!==this.to?this.to.buf:n.from([]),d.bnToUnpaddedBuffer(this.value),this.data,void 0!==this.v?d.bnToUnpaddedBuffer(this.v):n.from([]),void 0!==this.r?d.bnToUnpaddedBuffer(this.r):n.from([]),void 0!==this.s?d.bnToUnpaddedBuffer(this.s):n.from([])]},Transaction.prototype.serialize=function(){return d.rlp.encode(this.raw())},Transaction.prototype._getMessageToSign=function(){var e=[d.bnToUnpaddedBuffer(this.nonce),d.bnToUnpaddedBuffer(this.gasPrice),d.bnToUnpaddedBuffer(this.gasLimit),void 0!==this.to?this.to.buf:n.from([]),d.bnToUnpaddedBuffer(this.value),this.data];return this.supports(u.Capability.EIP155ReplayProtection)&&(e.push(d.toBuffer(this.common.chainIdBN())),e.push(d.unpadBuffer(d.toBuffer(0))),e.push(d.unpadBuffer(d.toBuffer(0)))),e},Transaction.prototype.getMessageToSign=function(e){void 0===e&&(e=!0);var t=this._getMessageToSign();return e?d.rlphash(t):t},Transaction.prototype.getUpfrontCost=function(){return this.gasLimit.mul(this.gasPrice).add(this.value)},Transaction.prototype.hash=function(){return d.rlphash(this.raw())},Transaction.prototype.getMessageToVerifySignature=function(){if(!this.isSigned())throw Error("This transaction is not signed");var e=this._getMessageToSign();return d.rlphash(e)},Transaction.prototype.getSenderPublicKey=function(){var e,t=this.getMessageToVerifySignature();if(this.common.gteHardfork("homestead")&&(null===(e=this.s)||void 0===e?void 0:e.gt(u.N_DIV_2)))throw new Error("Invalid Signature: s-values greater than secp256k1n/2 are considered invalid");var r=this,a=r.v,n=r.r,o=r.s;try{return d.ecrecover(t,a,d.bnToUnpaddedBuffer(n),d.bnToUnpaddedBuffer(o),this.supports(u.Capability.EIP155ReplayProtection)?this.common.chainIdBN():void 0)}catch(e){throw new Error("Invalid Signature")}},Transaction.prototype._processSignature=function(e,t,r){var a=new d.BN(e);this.supports(u.Capability.EIP155ReplayProtection)&&a.iadd(this.common.chainIdBN().muln(2).addn(8));var n={common:this.common};return Transaction.fromTxData({nonce:this.nonce,gasPrice:this.gasPrice,gasLimit:this.gasLimit,to:this.to,value:this.value,data:this.data,v:a,r:new d.BN(t),s:new d.BN(r)},n)},Transaction.prototype.toJSON=function(){return{nonce:d.bnToHex(this.nonce),gasPrice:d.bnToHex(this.gasPrice),gasLimit:d.bnToHex(this.gasLimit),to:void 0!==this.to?this.to.toString():void 0,value:d.bnToHex(this.value),data:"0x"+this.data.toString("hex"),v:void 0!==this.v?d.bnToHex(this.v):void 0,r:void 0!==this.r?d.bnToHex(this.r):void 0,s:void 0!==this.s?d.bnToHex(this.s):void 0}},Transaction.prototype._validateTxV=function(e,t){var r;if(void 0!==e&&!e.eqn(0)&&(!t||t.gteHardfork("spuriousDragon"))&&!e.eqn(27)&&!e.eqn(28))if(t){var a=t.chainIdBN().muln(2);if(!(e.eq(a.addn(35))||e.eq(a.addn(36))))throw new Error("Incompatible EIP155-based V "+e.toString()+" and chain id "+t.chainIdBN().toString()+". See the Common parameter of the Transaction constructor to set the chain id.")}else{var n=void 0;n=e.subn(35).isEven()?35:36,r=e.subn(n).divn(2)}return this._getCommon(t,r)},Transaction.prototype._unsignedTxImplementsEIP155=function(){return this.common.gteHardfork("spuriousDragon")},Transaction.prototype._signedTxImplementsEIP155=function(){if(!this.isSigned())throw Error("This transaction is not signed");var e=this.common.gteHardfork("spuriousDragon"),t=this.v,r=this.common.chainIdBN().muln(2);return(t.eq(r.addn(35))||t.eq(r.addn(36)))&&e},Transaction}(h.BaseTransaction);t.default=l},(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.N_DIV_2=t.isAccessList=t.isAccessListBuffer=t.Capability=void 0;var a=r(16);function isAccessListBuffer(e){if(0===e.length)return!0;var t=e[0];return!!Array.isArray(t)}!function(e){e[e.EIP155ReplayProtection=155]="EIP155ReplayProtection",e[e.EIP1559FeeMarket=1559]="EIP1559FeeMarket",e[e.EIP2718TypedTransaction=2718]="EIP2718TypedTransaction",e[e.EIP2930AccessLists=2930]="EIP2930AccessLists"}(t.Capability||(t.Capability={})),t.isAccessListBuffer=isAccessListBuffer,t.isAccessList=function isAccessList(e){return!isAccessListBuffer(e)},t.N_DIV_2=new a.BN("7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0",16)},function(e,t,r){"use strict";var a,n=r(4).Buffer,o=this&&this.__extends||(a=function(e,t){return(a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function __(){this.constructor=e}a(e,t),e.prototype=null===t?Object.create(t):(__.prototype=t.prototype,new __)}),s=this&&this.__assign||function(){return(s=Object.assign||function(e){for(var t,r=1,a=arguments.length;r0)&&!(a=o.next()).done;)s.push(a.value)}catch(e){n={error:e}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return s};Object.defineProperty(t,"__esModule",{value:!0});var d=r(16),u=r(133),h=r(191),l=r(892),b=n.from(1..toString(16).padStart(2,"0"),"hex"),g=function(e){function AccessListEIP2930Transaction(t,r){var a,n;void 0===r&&(r={});var o=e.call(this,s(s({},t),{type:1}))||this;o.DEFAULT_HARDFORK="berlin";var c=t.chainId,u=t.accessList,b=t.gasPrice;if(o.common=o._getCommon(r.common,c),o.chainId=o.common.chainIdBN(),!o.common.isActivatedEIP(2930))throw new Error("EIP-2930 not enabled on Common");o.activeCapabilities=o.activeCapabilities.concat([2718,2930]);var g=l.AccessLists.getAccessListData(null!=u?u:[]);if(o.accessList=g.accessList,o.AccessListJSON=g.AccessListJSON,l.AccessLists.verifyAccessList(o.accessList),o.gasPrice=new d.BN(d.toBuffer(""===b?"0x":b)),o._validateCannotExceedMaxInteger({gasPrice:o.gasPrice}),o.v&&!o.v.eqn(0)&&!o.v.eqn(1))throw new Error("The y-parity of the transaction should either be 0 or 1");if(o.common.gteHardfork("homestead")&&(null===(a=o.s)||void 0===a?void 0:a.gt(h.N_DIV_2)))throw new Error("Invalid Signature: s-values greater than secp256k1n/2 are considered invalid");return(null===(n=null==r?void 0:r.freeze)||void 0===n||n)&&Object.freeze(o),o}return o(AccessListEIP2930Transaction,e),Object.defineProperty(AccessListEIP2930Transaction.prototype,"senderR",{get:function(){return this.r},enumerable:!1,configurable:!0}),Object.defineProperty(AccessListEIP2930Transaction.prototype,"senderS",{get:function(){return this.s},enumerable:!1,configurable:!0}),Object.defineProperty(AccessListEIP2930Transaction.prototype,"yParity",{get:function(){return this.v},enumerable:!1,configurable:!0}),AccessListEIP2930Transaction.fromTxData=function(e,t){return void 0===t&&(t={}),new AccessListEIP2930Transaction(e,t)},AccessListEIP2930Transaction.fromSerializedTx=function(e,t){if(void 0===t&&(t={}),!e.slice(0,1).equals(b))throw new Error("Invalid serialized tx input: not an EIP-2930 transaction (wrong tx type, expected: 1, received: "+e.slice(0,1).toString("hex"));var r=d.rlp.decode(e.slice(1));if(!Array.isArray(r))throw new Error("Invalid serialized tx input: must be array");return AccessListEIP2930Transaction.fromValuesArray(r,t)},AccessListEIP2930Transaction.fromRlpSerializedTx=function(e,t){return void 0===t&&(t={}),AccessListEIP2930Transaction.fromSerializedTx(e,t)},AccessListEIP2930Transaction.fromValuesArray=function(e,t){if(void 0===t&&(t={}),8!==e.length&&11!==e.length)throw new Error("Invalid EIP-2930 transaction. Only expecting 8 values (for unsigned tx) or 11 values (for signed tx).");var r=c(e,11),a=r[0],n=r[1],o=r[2],s=r[3],u=r[4],h=r[5],l=r[6],b=r[7],g=r[8],p=r[9],B=r[10];return new AccessListEIP2930Transaction({chainId:new d.BN(a),nonce:n,gasPrice:o,gasLimit:s,to:u,value:h,data:l,accessList:null!=b?b:[],v:void 0!==g?new d.BN(g):void 0,r:p,s:B},t)},AccessListEIP2930Transaction.prototype.getDataFee=function(){var t=e.prototype.getDataFee.call(this);return t.iaddn(l.AccessLists.getDataFeeEIP2930(this.accessList,this.common)),t},AccessListEIP2930Transaction.prototype.getUpfrontCost=function(){return this.gasLimit.mul(this.gasPrice).add(this.value)},AccessListEIP2930Transaction.prototype.raw=function(){return[d.bnToUnpaddedBuffer(this.chainId),d.bnToUnpaddedBuffer(this.nonce),d.bnToUnpaddedBuffer(this.gasPrice),d.bnToUnpaddedBuffer(this.gasLimit),void 0!==this.to?this.to.buf:n.from([]),d.bnToUnpaddedBuffer(this.value),this.data,this.accessList,void 0!==this.v?d.bnToUnpaddedBuffer(this.v):n.from([]),void 0!==this.r?d.bnToUnpaddedBuffer(this.r):n.from([]),void 0!==this.s?d.bnToUnpaddedBuffer(this.s):n.from([])]},AccessListEIP2930Transaction.prototype.serialize=function(){var e=this.raw();return n.concat([b,d.rlp.encode(e)])},AccessListEIP2930Transaction.prototype.getMessageToSign=function(e){void 0===e&&(e=!0);var t=this.raw().slice(0,8),r=n.concat([b,d.rlp.encode(t)]);return e?d.keccak256(r):r},AccessListEIP2930Transaction.prototype.hash=function(){if(!this.isSigned())throw new Error("Cannot call hash method if transaction is not signed");return d.keccak256(this.serialize())},AccessListEIP2930Transaction.prototype.getMessageToVerifySignature=function(){return this.getMessageToSign()},AccessListEIP2930Transaction.prototype.getSenderPublicKey=function(){var e;if(!this.isSigned())throw new Error("Cannot call this method if transaction is not signed");var t=this.getMessageToVerifySignature();if(this.common.gteHardfork("homestead")&&(null===(e=this.s)||void 0===e?void 0:e.gt(h.N_DIV_2)))throw new Error("Invalid Signature: s-values greater than secp256k1n/2 are considered invalid");var r=this,a=r.yParity,n=r.r,o=r.s;try{return d.ecrecover(t,a.addn(27),d.bnToUnpaddedBuffer(n),d.bnToUnpaddedBuffer(o))}catch(e){throw new Error("Invalid Signature")}},AccessListEIP2930Transaction.prototype._processSignature=function(e,t,r){var a={common:this.common};return AccessListEIP2930Transaction.fromTxData({chainId:this.chainId,nonce:this.nonce,gasPrice:this.gasPrice,gasLimit:this.gasLimit,to:this.to,value:this.value,data:this.data,accessList:this.accessList,v:new d.BN(e-27),r:new d.BN(t),s:new d.BN(r)},a)},AccessListEIP2930Transaction.prototype.toJSON=function(){var e=l.AccessLists.getAccessListJSON(this.accessList);return{chainId:d.bnToHex(this.chainId),nonce:d.bnToHex(this.nonce),gasPrice:d.bnToHex(this.gasPrice),gasLimit:d.bnToHex(this.gasLimit),to:void 0!==this.to?this.to.toString():void 0,value:d.bnToHex(this.value),data:"0x"+this.data.toString("hex"),accessList:e,v:void 0!==this.v?d.bnToHex(this.v):void 0,r:void 0!==this.r?d.bnToHex(this.r):void 0,s:void 0!==this.s?d.bnToHex(this.s):void 0}},AccessListEIP2930Transaction}(u.BaseTransaction);t.default=g},function(e,t,r){"use strict";var a,n=r(4).Buffer,o=this&&this.__extends||(a=function(e,t){return(a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function __(){this.constructor=e}a(e,t),e.prototype=null===t?Object.create(t):(__.prototype=t.prototype,new __)}),s=this&&this.__assign||function(){return(s=Object.assign||function(e){for(var t,r=1,a=arguments.length;r0)&&!(a=o.next()).done;)s.push(a.value)}catch(e){n={error:e}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return s};Object.defineProperty(t,"__esModule",{value:!0});var d=r(16),u=r(133),h=r(191),l=r(892),b=n.from(2..toString(16).padStart(2,"0"),"hex"),g=function(e){function FeeMarketEIP1559Transaction(t,r){var a,n;void 0===r&&(r={});var o=e.call(this,s(s({},t),{type:2}))||this;o.DEFAULT_HARDFORK="london";var c=t.chainId,u=t.accessList,b=t.maxFeePerGas,g=t.maxPriorityFeePerGas;if(o.common=o._getCommon(r.common,c),o.chainId=o.common.chainIdBN(),!o.common.isActivatedEIP(1559))throw new Error("EIP-1559 not enabled on Common");o.activeCapabilities=o.activeCapabilities.concat([1559,2718,2930]);var p=l.AccessLists.getAccessListData(null!=u?u:[]);if(o.accessList=p.accessList,o.AccessListJSON=p.AccessListJSON,l.AccessLists.verifyAccessList(o.accessList),o.maxFeePerGas=new d.BN(d.toBuffer(""===b?"0x":b)),o.maxPriorityFeePerGas=new d.BN(d.toBuffer(""===g?"0x":g)),o._validateCannotExceedMaxInteger({maxFeePerGas:o.maxFeePerGas,maxPriorityFeePerGas:o.maxPriorityFeePerGas},256),o.maxFeePerGas.lt(o.maxPriorityFeePerGas))throw new Error("maxFeePerGas cannot be less than maxPriorityFeePerGas (The total must be the larger of the two)");if(o.v&&!o.v.eqn(0)&&!o.v.eqn(1))throw new Error("The y-parity of the transaction should either be 0 or 1");if(o.common.gteHardfork("homestead")&&(null===(a=o.s)||void 0===a?void 0:a.gt(h.N_DIV_2)))throw new Error("Invalid Signature: s-values greater than secp256k1n/2 are considered invalid");return(null===(n=null==r?void 0:r.freeze)||void 0===n||n)&&Object.freeze(o),o}return o(FeeMarketEIP1559Transaction,e),Object.defineProperty(FeeMarketEIP1559Transaction.prototype,"senderR",{get:function(){return this.r},enumerable:!1,configurable:!0}),Object.defineProperty(FeeMarketEIP1559Transaction.prototype,"senderS",{get:function(){return this.s},enumerable:!1,configurable:!0}),Object.defineProperty(FeeMarketEIP1559Transaction.prototype,"yParity",{get:function(){return this.v},enumerable:!1,configurable:!0}),FeeMarketEIP1559Transaction.fromTxData=function(e,t){return void 0===t&&(t={}),new FeeMarketEIP1559Transaction(e,t)},FeeMarketEIP1559Transaction.fromSerializedTx=function(e,t){if(void 0===t&&(t={}),!e.slice(0,1).equals(b))throw new Error("Invalid serialized tx input: not an EIP-1559 transaction (wrong tx type, expected: 2, received: "+e.slice(0,1).toString("hex"));var r=d.rlp.decode(e.slice(1));if(!Array.isArray(r))throw new Error("Invalid serialized tx input: must be array");return FeeMarketEIP1559Transaction.fromValuesArray(r,t)},FeeMarketEIP1559Transaction.fromRlpSerializedTx=function(e,t){return void 0===t&&(t={}),FeeMarketEIP1559Transaction.fromSerializedTx(e,t)},FeeMarketEIP1559Transaction.fromValuesArray=function(e,t){if(void 0===t&&(t={}),9!==e.length&&12!==e.length)throw new Error("Invalid EIP-1559 transaction. Only expecting 9 values (for unsigned tx) or 12 values (for signed tx).");var r=c(e,12),a=r[0],n=r[1],o=r[2],s=r[3],u=r[4],h=r[5],l=r[6],b=r[7],g=r[8],p=r[9],B=r[10],m=r[11];return new FeeMarketEIP1559Transaction({chainId:new d.BN(a),nonce:n,maxPriorityFeePerGas:o,maxFeePerGas:s,gasLimit:u,to:h,value:l,data:b,accessList:null!=g?g:[],v:void 0!==p?new d.BN(p):void 0,r:B,s:m},t)},FeeMarketEIP1559Transaction.prototype.getDataFee=function(){var t=e.prototype.getDataFee.call(this);return t.iaddn(l.AccessLists.getDataFeeEIP2930(this.accessList,this.common)),t},FeeMarketEIP1559Transaction.prototype.getUpfrontCost=function(e){void 0===e&&(e=new d.BN(0));var t=d.BN.min(this.maxPriorityFeePerGas,this.maxFeePerGas.sub(e)).add(e);return this.gasLimit.mul(t).add(this.value)},FeeMarketEIP1559Transaction.prototype.raw=function(){return[d.bnToUnpaddedBuffer(this.chainId),d.bnToUnpaddedBuffer(this.nonce),d.bnToUnpaddedBuffer(this.maxPriorityFeePerGas),d.bnToUnpaddedBuffer(this.maxFeePerGas),d.bnToUnpaddedBuffer(this.gasLimit),void 0!==this.to?this.to.buf:n.from([]),d.bnToUnpaddedBuffer(this.value),this.data,this.accessList,void 0!==this.v?d.bnToUnpaddedBuffer(this.v):n.from([]),void 0!==this.r?d.bnToUnpaddedBuffer(this.r):n.from([]),void 0!==this.s?d.bnToUnpaddedBuffer(this.s):n.from([])]},FeeMarketEIP1559Transaction.prototype.serialize=function(){var e=this.raw();return n.concat([b,d.rlp.encode(e)])},FeeMarketEIP1559Transaction.prototype.getMessageToSign=function(e){void 0===e&&(e=!0);var t=this.raw().slice(0,9),r=n.concat([b,d.rlp.encode(t)]);return e?d.keccak256(r):r},FeeMarketEIP1559Transaction.prototype.hash=function(){if(!this.isSigned())throw new Error("Cannot call hash method if transaction is not signed");return d.keccak256(this.serialize())},FeeMarketEIP1559Transaction.prototype.getMessageToVerifySignature=function(){return this.getMessageToSign()},FeeMarketEIP1559Transaction.prototype.getSenderPublicKey=function(){var e;if(!this.isSigned())throw new Error("Cannot call this method if transaction is not signed");var t=this.getMessageToVerifySignature();if(this.common.gteHardfork("homestead")&&(null===(e=this.s)||void 0===e?void 0:e.gt(h.N_DIV_2)))throw new Error("Invalid Signature: s-values greater than secp256k1n/2 are considered invalid");var r=this,a=r.v,n=r.r,o=r.s;try{return d.ecrecover(t,a.addn(27),d.bnToUnpaddedBuffer(n),d.bnToUnpaddedBuffer(o))}catch(e){throw new Error("Invalid Signature")}},FeeMarketEIP1559Transaction.prototype._processSignature=function(e,t,r){var a={common:this.common};return FeeMarketEIP1559Transaction.fromTxData({chainId:this.chainId,nonce:this.nonce,maxPriorityFeePerGas:this.maxPriorityFeePerGas,maxFeePerGas:this.maxFeePerGas,gasLimit:this.gasLimit,to:this.to,value:this.value,data:this.data,accessList:this.accessList,v:new d.BN(e-27),r:new d.BN(t),s:new d.BN(r)},a)},FeeMarketEIP1559Transaction.prototype.toJSON=function(){var e=l.AccessLists.getAccessListJSON(this.accessList);return{chainId:d.bnToHex(this.chainId),nonce:d.bnToHex(this.nonce),maxPriorityFeePerGas:d.bnToHex(this.maxPriorityFeePerGas),maxFeePerGas:d.bnToHex(this.maxFeePerGas),gasLimit:d.bnToHex(this.gasLimit),to:void 0!==this.to?this.to.toString():void 0,value:d.bnToHex(this.value),data:"0x"+this.data.toString("hex"),accessList:e,v:void 0!==this.v?d.bnToHex(this.v):void 0,r:void 0!==this.r?d.bnToHex(this.r):void 0,s:void 0!==this.s?d.bnToHex(this.s):void 0}},FeeMarketEIP1559Transaction}(u.BaseTransaction);t.default=g},function(e,t,r){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.KECCAK256_RLP=t.KECCAK256_RLP_S=t.KECCAK256_RLP_ARRAY=t.KECCAK256_RLP_ARRAY_S=t.KECCAK256_NULL=t.KECCAK256_NULL_S=t.TWO_POW256=t.MAX_INTEGER=void 0;var n=r(2).Buffer,o=a(r(134));t.MAX_INTEGER=new o.default("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",16),t.TWO_POW256=new o.default("10000000000000000000000000000000000000000000000000000000000000000",16),t.KECCAK256_NULL_S="c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470",t.KECCAK256_NULL=n.from(t.KECCAK256_NULL_S,"hex"),t.KECCAK256_RLP_ARRAY_S="1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",t.KECCAK256_RLP_ARRAY=n.from(t.KECCAK256_RLP_ARRAY_S,"hex"),t.KECCAK256_RLP_S="56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",t.KECCAK256_RLP=n.from(t.KECCAK256_RLP_S,"hex")},(e,t,r)=>{"use strict";var a=r(2).Buffer,n=r(536),o=r(935);function padToEven(e){var t=e;if("string"!=typeof t)throw new Error("[ethjs-util] while padding to even, value must be string, is currently "+typeof t+", while padToEven.");return t.length%2&&(t="0"+t),t}function intToHex(e){return"0x"+e.toString(16)}e.exports={arrayContainsArray:function arrayContainsArray(e,t,r){if(!0!==Array.isArray(e))throw new Error("[ethjs-util] method arrayContainsArray requires input 'superset' to be an array got type '"+typeof e+"'");if(!0!==Array.isArray(t))throw new Error("[ethjs-util] method arrayContainsArray requires input 'subset' to be an array got type '"+typeof t+"'");return t[Boolean(r)?"some":"every"]((function(t){return e.indexOf(t)>=0}))},intToBuffer:function intToBuffer(e){var t=intToHex(e);return new a(padToEven(t.slice(2)),"hex")},getBinarySize:function getBinarySize(e){if("string"!=typeof e)throw new Error("[ethjs-util] while getting binary size, method getBinarySize requires input 'str' to be type String, got '"+typeof e+"'.");return a.byteLength(e,"utf8")},isHexPrefixed:n,stripHexPrefix:o,padToEven,intToHex,fromAscii:function fromAscii(e){for(var t="",r=0;r{"use strict";var a=r(1),n=Object.keys||function(e){var t=[];for(var r in e)t.push(r);return t};e.exports=Duplex;var o=r(538),s=r(541);r(23)(Duplex,o);for(var c=n(s.prototype),d=0;d{var a=r(60).Buffer;function Hash(e,t){this._block=a.alloc(e),this._finalSize=t,this._blockSize=e,this._len=0}Hash.prototype.update=function(e,t){"string"==typeof e&&(t=t||"utf8",e=a.from(e,t));for(var r=this._block,n=this._blockSize,o=e.length,s=this._len,c=0;c=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 a=(4294967295&r)>>>0,n=(r-a)/4294967296;this._block.writeUInt32BE(n,this._blockSize-8),this._block.writeUInt32BE(a,this._blockSize-4)}this._update(this._block);var o=this._hash();return e?o.toString(e):o},Hash.prototype._update=function(){throw new Error("_update must be implemented by subclass")},e.exports=Hash},function(e,t,r){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.KECCAK256_RLP=t.KECCAK256_RLP_S=t.KECCAK256_RLP_ARRAY=t.KECCAK256_RLP_ARRAY_S=t.KECCAK256_NULL=t.KECCAK256_NULL_S=t.TWO_POW256=t.MAX_INTEGER=void 0;var n=r(0).Buffer,o=a(r(48));t.MAX_INTEGER=new o.default("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",16),t.TWO_POW256=new o.default("10000000000000000000000000000000000000000000000000000000000000000",16),t.KECCAK256_NULL_S="c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470",t.KECCAK256_NULL=n.from(t.KECCAK256_NULL_S,"hex"),t.KECCAK256_RLP_ARRAY_S="1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",t.KECCAK256_RLP_ARRAY=n.from(t.KECCAK256_RLP_ARRAY_S,"hex"),t.KECCAK256_RLP_S="56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",t.KECCAK256_RLP=n.from(t.KECCAK256_RLP_S,"hex")},(e,t,r)=>{"use strict";var a=r(15),n=r(555),o=r(563),s=r(564),c=r(992);function Hash(e){c.call(this,"digest"),this._hash=e}a(Hash,c),Hash.prototype._update=function(e){this._hash.update(e)},Hash.prototype._final=function(){return this._hash.digest()},e.exports=function createHash(e){return"md5"===(e=e.toLowerCase())?new n:"rmd160"===e||"ripemd160"===e?new o:new Hash(s(e))}},(e,t,r)=>{"use strict";var a=r(1),n=Object.keys||function(e){var t=[];for(var r in e)t.push(r);return t};e.exports=Duplex;var o=r(557),s=r(560);r(15)(Duplex,o);for(var c=n(s.prototype),d=0;d{var a=r(19).Buffer;function Hash(e,t){this._block=a.alloc(e),this._finalSize=t,this._blockSize=e,this._len=0}Hash.prototype.update=function(e,t){"string"==typeof e&&(t=t||"utf8",e=a.from(e,t));for(var r=this._block,n=this._blockSize,o=e.length,s=this._len,c=0;c=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 a=(4294967295&r)>>>0,n=(r-a)/4294967296;this._block.writeUInt32BE(n,this._blockSize-8),this._block.writeUInt32BE(a,this._blockSize-4)}this._update(this._block);var o=this._hash();return e?o.toString(e):o},Hash.prototype._update=function(){throw new Error("_update must be implemented by subclass")},e.exports=Hash},function(e,t,r){!function(e,t){"use strict";function assert(e,t){if(!e)throw new Error(t||"Assertion failed")}function inherits(e,t){e.super_=t;var TempCtor=function(){};TempCtor.prototype=t.prototype,e.prototype=new TempCtor,e.prototype.constructor=e}function BN(e,t,r){if(BN.isBN(e))return e;this.negative=0,this.words=null,this.length=0,this.red=null,null!==e&&("le"!==t&&"be"!==t||(r=t,t=10),this._init(e||0,t||10,r||"be"))}var a;"object"==typeof e?e.exports=BN:t.BN=BN,BN.BN=BN,BN.wordSize=26;try{a="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:r(17).Buffer}catch(e){}function parseHex4Bits(e,t){var r=e.charCodeAt(t);return r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:r-48&15}function parseHexByte(e,t,r){var a=parseHex4Bits(e,r);return r-1>=t&&(a|=parseHex4Bits(e,r-1)<<4),a}function parseBase(e,t,r,a){for(var n=0,o=Math.min(e.length,r),s=t;s=49?c-49+10:c>=17?c-17+10:c}return n}BN.isBN=function isBN(e){return e instanceof BN||null!==e&&"object"==typeof e&&e.constructor.wordSize===BN.wordSize&&Array.isArray(e.words)},BN.max=function max(e,t){return e.cmp(t)>0?e:t},BN.min=function min(e,t){return e.cmp(t)<0?e:t},BN.prototype._init=function init(e,t,r){if("number"==typeof e)return this._initNumber(e,t,r);if("object"==typeof e)return this._initArray(e,t,r);"hex"===t&&(t=16),assert(t===(0|t)&&t>=2&&t<=36);var a=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&(a++,this.negative=1),a=0;a-=3)o=e[a]|e[a-1]<<8|e[a-2]<<16,this.words[n]|=o<>>26-s&67108863,(s+=24)>=26&&(s-=26,n++);else if("le"===r)for(a=0,n=0;a>>26-s&67108863,(s+=24)>=26&&(s-=26,n++);return this.strip()},BN.prototype._parseHex=function _parseHex(e,t,r){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var a=0;a=t;a-=2)n=parseHexByte(e,t,a)<=18?(o-=18,s+=1,this.words[s]|=n>>>26):o+=8;else for(a=(e.length-t)%2==0?t+1:t;a=18?(o-=18,s+=1,this.words[s]|=n>>>26):o+=8;this.strip()},BN.prototype._parseBase=function _parseBase(e,t,r){this.words=[0],this.length=1;for(var a=0,n=1;n<=67108863;n*=t)a++;a--,n=n/t|0;for(var o=e.length-r,s=o%a,c=Math.min(o,o-s)+r,d=0,u=r;u1&&0===this.words[this.length-1];)this.length--;return this._normSign()},BN.prototype._normSign=function _normSign(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},BN.prototype.inspect=function inspect(){return(this.red?""};var n=["","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"],o=[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],s=[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 smallMulTo(e,t,r){r.negative=t.negative^e.negative;var a=e.length+t.length|0;r.length=a,a=a-1|0;var n=0|e.words[0],o=0|t.words[0],s=n*o,c=67108863&s,d=s/67108864|0;r.words[0]=c;for(var u=1;u>>26,l=67108863&d,b=Math.min(u,t.length-1),g=Math.max(0,u-e.length+1);g<=b;g++){var p=u-g|0;h+=(s=(n=0|e.words[p])*(o=0|t.words[g])+l)/67108864|0,l=67108863&s}r.words[u]=0|l,d=0|h}return 0!==d?r.words[u]=0|d:r.length--,r.strip()}BN.prototype.toString=function toString(e,t){var r;if(t=0|t||1,16===(e=e||10)||"hex"===e){r="";for(var a=0,c=0,d=0;d>>24-a&16777215)||d!==this.length-1?n[6-h.length]+h+r:h+r,(a+=2)>=26&&(a-=26,d--)}for(0!==c&&(r=c.toString(16)+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(e===(0|e)&&e>=2&&e<=36){var l=o[e],b=s[e];r="";var g=this.clone();for(g.negative=0;!g.isZero();){var p=g.modn(b).toString(e);r=(g=g.idivn(b)).isZero()?p+r:n[l-p.length]+p+r}for(this.isZero()&&(r="0"+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}assert(!1,"Base should be between 2 and 36")},BN.prototype.toNumber=function toNumber(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&assert(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},BN.prototype.toJSON=function toJSON(){return this.toString(16)},BN.prototype.toBuffer=function toBuffer(e,t){return assert(void 0!==a),this.toArrayLike(a,e,t)},BN.prototype.toArray=function toArray(e,t){return this.toArrayLike(Array,e,t)},BN.prototype.toArrayLike=function toArrayLike(e,t,r){var a=this.byteLength(),n=r||Math.max(1,a);assert(a<=n,"byte array longer than desired length"),assert(n>0,"Requested array length <= 0"),this.strip();var o,s,c="le"===t,d=new e(n),u=this.clone();if(c){for(s=0;!u.isZero();s++)o=u.andln(255),u.iushrn(8),d[s]=o;for(;s=4096&&(r+=13,t>>>=13),t>=64&&(r+=7,t>>>=7),t>=8&&(r+=4,t>>>=4),t>=2&&(r+=2,t>>>=2),r+t},BN.prototype._zeroBits=function _zeroBits(e){if(0===e)return 26;var t=e,r=0;return 0==(8191&t)&&(r+=13,t>>>=13),0==(127&t)&&(r+=7,t>>>=7),0==(15&t)&&(r+=4,t>>>=4),0==(3&t)&&(r+=2,t>>>=2),0==(1&t)&&r++,r},BN.prototype.bitLength=function bitLength(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},BN.prototype.zeroBits=function zeroBits(){if(this.isZero())return 0;for(var e=0,t=0;te.length?this.clone().ior(e):e.clone().ior(this)},BN.prototype.uor=function uor(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},BN.prototype.iuand=function iuand(e){var t;t=this.length>e.length?e:this;for(var r=0;re.length?this.clone().iand(e):e.clone().iand(this)},BN.prototype.uand=function uand(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},BN.prototype.iuxor=function iuxor(e){var t,r;this.length>e.length?(t=this,r=e):(t=e,r=this);for(var a=0;ae.length?this.clone().ixor(e):e.clone().ixor(this)},BN.prototype.uxor=function uxor(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},BN.prototype.inotn=function inotn(e){assert("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),r=e%26;this._expand(t),r>0&&t--;for(var a=0;a0&&(this.words[a]=~this.words[a]&67108863>>26-r),this.strip()},BN.prototype.notn=function notn(e){return this.clone().inotn(e)},BN.prototype.setn=function setn(e,t){assert("number"==typeof e&&e>=0);var r=e/26|0,a=e%26;return this._expand(r+1),this.words[r]=t?this.words[r]|1<e.length?(r=this,a=e):(r=e,a=this);for(var n=0,o=0;o>>26;for(;0!==n&&o>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;oe.length?this.clone().iadd(e):e.clone().iadd(this)},BN.prototype.isub=function isub(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var r,a,n=this.cmp(e);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,a=e):(r=e,a=this);for(var o=0,s=0;s>26,this.words[s]=67108863&t;for(;0!==o&&s>26,this.words[s]=67108863&t;if(0===o&&s>>13,g=0|s[1],p=8191&g,B=g>>>13,m=0|s[2],I=8191&m,y=m>>>13,v=0|s[3],x=8191&v,C=v>>>13,Q=0|s[4],w=8191&Q,_=Q>>>13,k=0|s[5],N=8191&k,D=k>>>13,U=0|s[6],G=8191&U,T=U>>>13,L=0|s[7],P=8191&L,q=L>>>13,O=0|s[8],H=8191&O,Y=O>>>13,j=0|s[9],J=8191&j,z=j>>>13,W=0|c[0],V=8191&W,X=W>>>13,$=0|c[1],et=8191&$,tt=$>>>13,rt=0|c[2],at=8191&rt,it=rt>>>13,nt=0|c[3],ot=8191&nt,At=nt>>>13,st=0|c[4],ct=8191&st,dt=st>>>13,ut=0|c[5],ht=8191&ut,bt=ut>>>13,pt=0|c[6],Bt=8191&pt,mt=pt>>>13,It=0|c[7],Et=8191&It,yt=It>>>13,vt=0|c[8],xt=8191&vt,Ct=vt>>>13,Qt=0|c[9],wt=8191&Qt,Mt=Qt>>>13;r.negative=e.negative^t.negative,r.length=19;var _t=(u+(a=Math.imul(l,V))|0)+((8191&(n=(n=Math.imul(l,X))+Math.imul(b,V)|0))<<13)|0;u=((o=Math.imul(b,X))+(n>>>13)|0)+(_t>>>26)|0,_t&=67108863,a=Math.imul(p,V),n=(n=Math.imul(p,X))+Math.imul(B,V)|0,o=Math.imul(B,X);var kt=(u+(a=a+Math.imul(l,et)|0)|0)+((8191&(n=(n=n+Math.imul(l,tt)|0)+Math.imul(b,et)|0))<<13)|0;u=((o=o+Math.imul(b,tt)|0)+(n>>>13)|0)+(kt>>>26)|0,kt&=67108863,a=Math.imul(I,V),n=(n=Math.imul(I,X))+Math.imul(y,V)|0,o=Math.imul(y,X),a=a+Math.imul(p,et)|0,n=(n=n+Math.imul(p,tt)|0)+Math.imul(B,et)|0,o=o+Math.imul(B,tt)|0;var St=(u+(a=a+Math.imul(l,at)|0)|0)+((8191&(n=(n=n+Math.imul(l,it)|0)+Math.imul(b,at)|0))<<13)|0;u=((o=o+Math.imul(b,it)|0)+(n>>>13)|0)+(St>>>26)|0,St&=67108863,a=Math.imul(x,V),n=(n=Math.imul(x,X))+Math.imul(C,V)|0,o=Math.imul(C,X),a=a+Math.imul(I,et)|0,n=(n=n+Math.imul(I,tt)|0)+Math.imul(y,et)|0,o=o+Math.imul(y,tt)|0,a=a+Math.imul(p,at)|0,n=(n=n+Math.imul(p,it)|0)+Math.imul(B,at)|0,o=o+Math.imul(B,it)|0;var Nt=(u+(a=a+Math.imul(l,ot)|0)|0)+((8191&(n=(n=n+Math.imul(l,At)|0)+Math.imul(b,ot)|0))<<13)|0;u=((o=o+Math.imul(b,At)|0)+(n>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,a=Math.imul(w,V),n=(n=Math.imul(w,X))+Math.imul(_,V)|0,o=Math.imul(_,X),a=a+Math.imul(x,et)|0,n=(n=n+Math.imul(x,tt)|0)+Math.imul(C,et)|0,o=o+Math.imul(C,tt)|0,a=a+Math.imul(I,at)|0,n=(n=n+Math.imul(I,it)|0)+Math.imul(y,at)|0,o=o+Math.imul(y,it)|0,a=a+Math.imul(p,ot)|0,n=(n=n+Math.imul(p,At)|0)+Math.imul(B,ot)|0,o=o+Math.imul(B,At)|0;var Dt=(u+(a=a+Math.imul(l,ct)|0)|0)+((8191&(n=(n=n+Math.imul(l,dt)|0)+Math.imul(b,ct)|0))<<13)|0;u=((o=o+Math.imul(b,dt)|0)+(n>>>13)|0)+(Dt>>>26)|0,Dt&=67108863,a=Math.imul(N,V),n=(n=Math.imul(N,X))+Math.imul(D,V)|0,o=Math.imul(D,X),a=a+Math.imul(w,et)|0,n=(n=n+Math.imul(w,tt)|0)+Math.imul(_,et)|0,o=o+Math.imul(_,tt)|0,a=a+Math.imul(x,at)|0,n=(n=n+Math.imul(x,it)|0)+Math.imul(C,at)|0,o=o+Math.imul(C,it)|0,a=a+Math.imul(I,ot)|0,n=(n=n+Math.imul(I,At)|0)+Math.imul(y,ot)|0,o=o+Math.imul(y,At)|0,a=a+Math.imul(p,ct)|0,n=(n=n+Math.imul(p,dt)|0)+Math.imul(B,ct)|0,o=o+Math.imul(B,dt)|0;var Rt=(u+(a=a+Math.imul(l,ht)|0)|0)+((8191&(n=(n=n+Math.imul(l,bt)|0)+Math.imul(b,ht)|0))<<13)|0;u=((o=o+Math.imul(b,bt)|0)+(n>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,a=Math.imul(G,V),n=(n=Math.imul(G,X))+Math.imul(T,V)|0,o=Math.imul(T,X),a=a+Math.imul(N,et)|0,n=(n=n+Math.imul(N,tt)|0)+Math.imul(D,et)|0,o=o+Math.imul(D,tt)|0,a=a+Math.imul(w,at)|0,n=(n=n+Math.imul(w,it)|0)+Math.imul(_,at)|0,o=o+Math.imul(_,it)|0,a=a+Math.imul(x,ot)|0,n=(n=n+Math.imul(x,At)|0)+Math.imul(C,ot)|0,o=o+Math.imul(C,At)|0,a=a+Math.imul(I,ct)|0,n=(n=n+Math.imul(I,dt)|0)+Math.imul(y,ct)|0,o=o+Math.imul(y,dt)|0,a=a+Math.imul(p,ht)|0,n=(n=n+Math.imul(p,bt)|0)+Math.imul(B,ht)|0,o=o+Math.imul(B,bt)|0;var Ft=(u+(a=a+Math.imul(l,Bt)|0)|0)+((8191&(n=(n=n+Math.imul(l,mt)|0)+Math.imul(b,Bt)|0))<<13)|0;u=((o=o+Math.imul(b,mt)|0)+(n>>>13)|0)+(Ft>>>26)|0,Ft&=67108863,a=Math.imul(P,V),n=(n=Math.imul(P,X))+Math.imul(q,V)|0,o=Math.imul(q,X),a=a+Math.imul(G,et)|0,n=(n=n+Math.imul(G,tt)|0)+Math.imul(T,et)|0,o=o+Math.imul(T,tt)|0,a=a+Math.imul(N,at)|0,n=(n=n+Math.imul(N,it)|0)+Math.imul(D,at)|0,o=o+Math.imul(D,it)|0,a=a+Math.imul(w,ot)|0,n=(n=n+Math.imul(w,At)|0)+Math.imul(_,ot)|0,o=o+Math.imul(_,At)|0,a=a+Math.imul(x,ct)|0,n=(n=n+Math.imul(x,dt)|0)+Math.imul(C,ct)|0,o=o+Math.imul(C,dt)|0,a=a+Math.imul(I,ht)|0,n=(n=n+Math.imul(I,bt)|0)+Math.imul(y,ht)|0,o=o+Math.imul(y,bt)|0,a=a+Math.imul(p,Bt)|0,n=(n=n+Math.imul(p,mt)|0)+Math.imul(B,Bt)|0,o=o+Math.imul(B,mt)|0;var Ut=(u+(a=a+Math.imul(l,Et)|0)|0)+((8191&(n=(n=n+Math.imul(l,yt)|0)+Math.imul(b,Et)|0))<<13)|0;u=((o=o+Math.imul(b,yt)|0)+(n>>>13)|0)+(Ut>>>26)|0,Ut&=67108863,a=Math.imul(H,V),n=(n=Math.imul(H,X))+Math.imul(Y,V)|0,o=Math.imul(Y,X),a=a+Math.imul(P,et)|0,n=(n=n+Math.imul(P,tt)|0)+Math.imul(q,et)|0,o=o+Math.imul(q,tt)|0,a=a+Math.imul(G,at)|0,n=(n=n+Math.imul(G,it)|0)+Math.imul(T,at)|0,o=o+Math.imul(T,it)|0,a=a+Math.imul(N,ot)|0,n=(n=n+Math.imul(N,At)|0)+Math.imul(D,ot)|0,o=o+Math.imul(D,At)|0,a=a+Math.imul(w,ct)|0,n=(n=n+Math.imul(w,dt)|0)+Math.imul(_,ct)|0,o=o+Math.imul(_,dt)|0,a=a+Math.imul(x,ht)|0,n=(n=n+Math.imul(x,bt)|0)+Math.imul(C,ht)|0,o=o+Math.imul(C,bt)|0,a=a+Math.imul(I,Bt)|0,n=(n=n+Math.imul(I,mt)|0)+Math.imul(y,Bt)|0,o=o+Math.imul(y,mt)|0,a=a+Math.imul(p,Et)|0,n=(n=n+Math.imul(p,yt)|0)+Math.imul(B,Et)|0,o=o+Math.imul(B,yt)|0;var Gt=(u+(a=a+Math.imul(l,xt)|0)|0)+((8191&(n=(n=n+Math.imul(l,Ct)|0)+Math.imul(b,xt)|0))<<13)|0;u=((o=o+Math.imul(b,Ct)|0)+(n>>>13)|0)+(Gt>>>26)|0,Gt&=67108863,a=Math.imul(J,V),n=(n=Math.imul(J,X))+Math.imul(z,V)|0,o=Math.imul(z,X),a=a+Math.imul(H,et)|0,n=(n=n+Math.imul(H,tt)|0)+Math.imul(Y,et)|0,o=o+Math.imul(Y,tt)|0,a=a+Math.imul(P,at)|0,n=(n=n+Math.imul(P,it)|0)+Math.imul(q,at)|0,o=o+Math.imul(q,it)|0,a=a+Math.imul(G,ot)|0,n=(n=n+Math.imul(G,At)|0)+Math.imul(T,ot)|0,o=o+Math.imul(T,At)|0,a=a+Math.imul(N,ct)|0,n=(n=n+Math.imul(N,dt)|0)+Math.imul(D,ct)|0,o=o+Math.imul(D,dt)|0,a=a+Math.imul(w,ht)|0,n=(n=n+Math.imul(w,bt)|0)+Math.imul(_,ht)|0,o=o+Math.imul(_,bt)|0,a=a+Math.imul(x,Bt)|0,n=(n=n+Math.imul(x,mt)|0)+Math.imul(C,Bt)|0,o=o+Math.imul(C,mt)|0,a=a+Math.imul(I,Et)|0,n=(n=n+Math.imul(I,yt)|0)+Math.imul(y,Et)|0,o=o+Math.imul(y,yt)|0,a=a+Math.imul(p,xt)|0,n=(n=n+Math.imul(p,Ct)|0)+Math.imul(B,xt)|0,o=o+Math.imul(B,Ct)|0;var Tt=(u+(a=a+Math.imul(l,wt)|0)|0)+((8191&(n=(n=n+Math.imul(l,Mt)|0)+Math.imul(b,wt)|0))<<13)|0;u=((o=o+Math.imul(b,Mt)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,a=Math.imul(J,et),n=(n=Math.imul(J,tt))+Math.imul(z,et)|0,o=Math.imul(z,tt),a=a+Math.imul(H,at)|0,n=(n=n+Math.imul(H,it)|0)+Math.imul(Y,at)|0,o=o+Math.imul(Y,it)|0,a=a+Math.imul(P,ot)|0,n=(n=n+Math.imul(P,At)|0)+Math.imul(q,ot)|0,o=o+Math.imul(q,At)|0,a=a+Math.imul(G,ct)|0,n=(n=n+Math.imul(G,dt)|0)+Math.imul(T,ct)|0,o=o+Math.imul(T,dt)|0,a=a+Math.imul(N,ht)|0,n=(n=n+Math.imul(N,bt)|0)+Math.imul(D,ht)|0,o=o+Math.imul(D,bt)|0,a=a+Math.imul(w,Bt)|0,n=(n=n+Math.imul(w,mt)|0)+Math.imul(_,Bt)|0,o=o+Math.imul(_,mt)|0,a=a+Math.imul(x,Et)|0,n=(n=n+Math.imul(x,yt)|0)+Math.imul(C,Et)|0,o=o+Math.imul(C,yt)|0,a=a+Math.imul(I,xt)|0,n=(n=n+Math.imul(I,Ct)|0)+Math.imul(y,xt)|0,o=o+Math.imul(y,Ct)|0;var Lt=(u+(a=a+Math.imul(p,wt)|0)|0)+((8191&(n=(n=n+Math.imul(p,Mt)|0)+Math.imul(B,wt)|0))<<13)|0;u=((o=o+Math.imul(B,Mt)|0)+(n>>>13)|0)+(Lt>>>26)|0,Lt&=67108863,a=Math.imul(J,at),n=(n=Math.imul(J,it))+Math.imul(z,at)|0,o=Math.imul(z,it),a=a+Math.imul(H,ot)|0,n=(n=n+Math.imul(H,At)|0)+Math.imul(Y,ot)|0,o=o+Math.imul(Y,At)|0,a=a+Math.imul(P,ct)|0,n=(n=n+Math.imul(P,dt)|0)+Math.imul(q,ct)|0,o=o+Math.imul(q,dt)|0,a=a+Math.imul(G,ht)|0,n=(n=n+Math.imul(G,bt)|0)+Math.imul(T,ht)|0,o=o+Math.imul(T,bt)|0,a=a+Math.imul(N,Bt)|0,n=(n=n+Math.imul(N,mt)|0)+Math.imul(D,Bt)|0,o=o+Math.imul(D,mt)|0,a=a+Math.imul(w,Et)|0,n=(n=n+Math.imul(w,yt)|0)+Math.imul(_,Et)|0,o=o+Math.imul(_,yt)|0,a=a+Math.imul(x,xt)|0,n=(n=n+Math.imul(x,Ct)|0)+Math.imul(C,xt)|0,o=o+Math.imul(C,Ct)|0;var Pt=(u+(a=a+Math.imul(I,wt)|0)|0)+((8191&(n=(n=n+Math.imul(I,Mt)|0)+Math.imul(y,wt)|0))<<13)|0;u=((o=o+Math.imul(y,Mt)|0)+(n>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,a=Math.imul(J,ot),n=(n=Math.imul(J,At))+Math.imul(z,ot)|0,o=Math.imul(z,At),a=a+Math.imul(H,ct)|0,n=(n=n+Math.imul(H,dt)|0)+Math.imul(Y,ct)|0,o=o+Math.imul(Y,dt)|0,a=a+Math.imul(P,ht)|0,n=(n=n+Math.imul(P,bt)|0)+Math.imul(q,ht)|0,o=o+Math.imul(q,bt)|0,a=a+Math.imul(G,Bt)|0,n=(n=n+Math.imul(G,mt)|0)+Math.imul(T,Bt)|0,o=o+Math.imul(T,mt)|0,a=a+Math.imul(N,Et)|0,n=(n=n+Math.imul(N,yt)|0)+Math.imul(D,Et)|0,o=o+Math.imul(D,yt)|0,a=a+Math.imul(w,xt)|0,n=(n=n+Math.imul(w,Ct)|0)+Math.imul(_,xt)|0,o=o+Math.imul(_,Ct)|0;var qt=(u+(a=a+Math.imul(x,wt)|0)|0)+((8191&(n=(n=n+Math.imul(x,Mt)|0)+Math.imul(C,wt)|0))<<13)|0;u=((o=o+Math.imul(C,Mt)|0)+(n>>>13)|0)+(qt>>>26)|0,qt&=67108863,a=Math.imul(J,ct),n=(n=Math.imul(J,dt))+Math.imul(z,ct)|0,o=Math.imul(z,dt),a=a+Math.imul(H,ht)|0,n=(n=n+Math.imul(H,bt)|0)+Math.imul(Y,ht)|0,o=o+Math.imul(Y,bt)|0,a=a+Math.imul(P,Bt)|0,n=(n=n+Math.imul(P,mt)|0)+Math.imul(q,Bt)|0,o=o+Math.imul(q,mt)|0,a=a+Math.imul(G,Et)|0,n=(n=n+Math.imul(G,yt)|0)+Math.imul(T,Et)|0,o=o+Math.imul(T,yt)|0,a=a+Math.imul(N,xt)|0,n=(n=n+Math.imul(N,Ct)|0)+Math.imul(D,xt)|0,o=o+Math.imul(D,Ct)|0;var Ot=(u+(a=a+Math.imul(w,wt)|0)|0)+((8191&(n=(n=n+Math.imul(w,Mt)|0)+Math.imul(_,wt)|0))<<13)|0;u=((o=o+Math.imul(_,Mt)|0)+(n>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,a=Math.imul(J,ht),n=(n=Math.imul(J,bt))+Math.imul(z,ht)|0,o=Math.imul(z,bt),a=a+Math.imul(H,Bt)|0,n=(n=n+Math.imul(H,mt)|0)+Math.imul(Y,Bt)|0,o=o+Math.imul(Y,mt)|0,a=a+Math.imul(P,Et)|0,n=(n=n+Math.imul(P,yt)|0)+Math.imul(q,Et)|0,o=o+Math.imul(q,yt)|0,a=a+Math.imul(G,xt)|0,n=(n=n+Math.imul(G,Ct)|0)+Math.imul(T,xt)|0,o=o+Math.imul(T,Ct)|0;var Ht=(u+(a=a+Math.imul(N,wt)|0)|0)+((8191&(n=(n=n+Math.imul(N,Mt)|0)+Math.imul(D,wt)|0))<<13)|0;u=((o=o+Math.imul(D,Mt)|0)+(n>>>13)|0)+(Ht>>>26)|0,Ht&=67108863,a=Math.imul(J,Bt),n=(n=Math.imul(J,mt))+Math.imul(z,Bt)|0,o=Math.imul(z,mt),a=a+Math.imul(H,Et)|0,n=(n=n+Math.imul(H,yt)|0)+Math.imul(Y,Et)|0,o=o+Math.imul(Y,yt)|0,a=a+Math.imul(P,xt)|0,n=(n=n+Math.imul(P,Ct)|0)+Math.imul(q,xt)|0,o=o+Math.imul(q,Ct)|0;var Yt=(u+(a=a+Math.imul(G,wt)|0)|0)+((8191&(n=(n=n+Math.imul(G,Mt)|0)+Math.imul(T,wt)|0))<<13)|0;u=((o=o+Math.imul(T,Mt)|0)+(n>>>13)|0)+(Yt>>>26)|0,Yt&=67108863,a=Math.imul(J,Et),n=(n=Math.imul(J,yt))+Math.imul(z,Et)|0,o=Math.imul(z,yt),a=a+Math.imul(H,xt)|0,n=(n=n+Math.imul(H,Ct)|0)+Math.imul(Y,xt)|0,o=o+Math.imul(Y,Ct)|0;var jt=(u+(a=a+Math.imul(P,wt)|0)|0)+((8191&(n=(n=n+Math.imul(P,Mt)|0)+Math.imul(q,wt)|0))<<13)|0;u=((o=o+Math.imul(q,Mt)|0)+(n>>>13)|0)+(jt>>>26)|0,jt&=67108863,a=Math.imul(J,xt),n=(n=Math.imul(J,Ct))+Math.imul(z,xt)|0,o=Math.imul(z,Ct);var Jt=(u+(a=a+Math.imul(H,wt)|0)|0)+((8191&(n=(n=n+Math.imul(H,Mt)|0)+Math.imul(Y,wt)|0))<<13)|0;u=((o=o+Math.imul(Y,Mt)|0)+(n>>>13)|0)+(Jt>>>26)|0,Jt&=67108863;var Kt=(u+(a=Math.imul(J,wt))|0)+((8191&(n=(n=Math.imul(J,Mt))+Math.imul(z,wt)|0))<<13)|0;return u=((o=Math.imul(z,Mt))+(n>>>13)|0)+(Kt>>>26)|0,Kt&=67108863,d[0]=_t,d[1]=kt,d[2]=St,d[3]=Nt,d[4]=Dt,d[5]=Rt,d[6]=Ft,d[7]=Ut,d[8]=Gt,d[9]=Tt,d[10]=Lt,d[11]=Pt,d[12]=qt,d[13]=Ot,d[14]=Ht,d[15]=Yt,d[16]=jt,d[17]=Jt,d[18]=Kt,0!==u&&(d[19]=u,r.length++),r};function jumboMulTo(e,t,r){return(new FFTM).mulp(e,t,r)}function FFTM(e,t){this.x=e,this.y=t}Math.imul||(c=smallMulTo),BN.prototype.mulTo=function mulTo(e,t){var r=this.length+e.length;return 10===this.length&&10===e.length?c(this,e,t):r<63?smallMulTo(this,e,t):r<1024?function bigMulTo(e,t,r){r.negative=t.negative^e.negative,r.length=e.length+t.length;for(var a=0,n=0,o=0;o>>26)|0)>>>26,s&=67108863}r.words[o]=c,a=s,s=n}return 0!==a?r.words[o]=a:r.length--,r.strip()}(this,e,t):jumboMulTo(this,e,t)},FFTM.prototype.makeRBT=function makeRBT(e){for(var t=new Array(e),r=BN.prototype._countBits(e)-1,a=0;a>=1;return a},FFTM.prototype.permute=function permute(e,t,r,a,n,o){for(var s=0;s>>=1)n++;return 1<>>=13,r[2*o+1]=8191&n,n>>>=13;for(o=2*t;o>=26,t+=a/67108864|0,t+=n>>>26,this.words[r]=67108863&n}return 0!==t&&(this.words[r]=t,this.length++),this},BN.prototype.muln=function muln(e){return this.clone().imuln(e)},BN.prototype.sqr=function sqr(){return this.mul(this)},BN.prototype.isqr=function isqr(){return this.imul(this.clone())},BN.prototype.pow=function pow(e){var t=function toBitArray(e){for(var t=new Array(e.bitLength()),r=0;r>>n}return t}(e);if(0===t.length)return new BN(1);for(var r=this,a=0;a=0);var t,r=e%26,a=(e-r)/26,n=67108863>>>26-r<<26-r;if(0!==r){var o=0;for(t=0;t>>26-r}o&&(this.words[t]=o,this.length++)}if(0!==a){for(t=this.length-1;t>=0;t--)this.words[t+a]=this.words[t];for(t=0;t=0),a=t?(t-t%26)/26:0;var n=e%26,o=Math.min((e-n)/26,this.length),s=67108863^67108863>>>n<o)for(this.length-=o,d=0;d=0&&(0!==u||d>=a);d--){var h=0|this.words[d];this.words[d]=u<<26-n|h>>>n,u=h&s}return c&&0!==u&&(c.words[c.length++]=u),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},BN.prototype.ishrn=function ishrn(e,t,r){return assert(0===this.negative),this.iushrn(e,t,r)},BN.prototype.shln=function shln(e){return this.clone().ishln(e)},BN.prototype.ushln=function ushln(e){return this.clone().iushln(e)},BN.prototype.shrn=function shrn(e){return this.clone().ishrn(e)},BN.prototype.ushrn=function ushrn(e){return this.clone().iushrn(e)},BN.prototype.testn=function testn(e){assert("number"==typeof e&&e>=0);var t=e%26,r=(e-t)/26,a=1<=0);var t=e%26,r=(e-t)/26;if(assert(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==t&&r++,this.length=Math.min(r,this.length),0!==t){var a=67108863^67108863>>>t<=67108864;t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},BN.prototype.isubn=function isubn(e){if(assert("number"==typeof e),assert(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t>26)-(c/67108864|0),this.words[a+r]=67108863&n}for(;a>26,this.words[a+r]=67108863&n;if(0===s)return this.strip();for(assert(-1===s),s=0,a=0;a>26,this.words[a]=67108863&n;return this.negative=1,this.strip()},BN.prototype._wordDiv=function _wordDiv(e,t){var r=(this.length,e.length),a=this.clone(),n=e,o=0|n.words[n.length-1];0!==(r=26-this._countBits(o))&&(n=n.ushln(r),a.iushln(r),o=0|n.words[n.length-1]);var s,c=a.length-n.length;if("mod"!==t){(s=new BN(null)).length=c+1,s.words=new Array(s.length);for(var d=0;d=0;h--){var l=67108864*(0|a.words[n.length+h])+(0|a.words[n.length+h-1]);for(l=Math.min(l/o|0,67108863),a._ishlnsubmul(n,l,h);0!==a.negative;)l--,a.negative=0,a._ishlnsubmul(n,1,h),a.isZero()||(a.negative^=1);s&&(s.words[h]=l)}return s&&s.strip(),a.strip(),"div"!==t&&0!==r&&a.iushrn(r),{div:s||null,mod:a}},BN.prototype.divmod=function divmod(e,t,r){return assert(!e.isZero()),this.isZero()?{div:new BN(0),mod:new BN(0)}:0!==this.negative&&0===e.negative?(o=this.neg().divmod(e,t),"mod"!==t&&(a=o.div.neg()),"div"!==t&&(n=o.mod.neg(),r&&0!==n.negative&&n.iadd(e)),{div:a,mod:n}):0===this.negative&&0!==e.negative?(o=this.divmod(e.neg(),t),"mod"!==t&&(a=o.div.neg()),{div:a,mod:o.mod}):0!=(this.negative&e.negative)?(o=this.neg().divmod(e.neg(),t),"div"!==t&&(n=o.mod.neg(),r&&0!==n.negative&&n.isub(e)),{div:o.div,mod:n}):e.length>this.length||this.cmp(e)<0?{div:new BN(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new BN(this.modn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new BN(this.modn(e.words[0]))}:this._wordDiv(e,t);var a,n,o},BN.prototype.div=function div(e){return this.divmod(e,"div",!1).div},BN.prototype.mod=function mod(e){return this.divmod(e,"mod",!1).mod},BN.prototype.umod=function umod(e){return this.divmod(e,"mod",!0).mod},BN.prototype.divRound=function divRound(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var r=0!==t.div.negative?t.mod.isub(e):t.mod,a=e.ushrn(1),n=e.andln(1),o=r.cmp(a);return o<0||1===n&&0===o?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},BN.prototype.modn=function modn(e){assert(e<=67108863);for(var t=(1<<26)%e,r=0,a=this.length-1;a>=0;a--)r=(t*r+(0|this.words[a]))%e;return r},BN.prototype.idivn=function idivn(e){assert(e<=67108863);for(var t=0,r=this.length-1;r>=0;r--){var a=(0|this.words[r])+67108864*t;this.words[r]=a/e|0,t=a%e}return this.strip()},BN.prototype.divn=function divn(e){return this.clone().idivn(e)},BN.prototype.egcd=function egcd(e){assert(0===e.negative),assert(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var a=new BN(1),n=new BN(0),o=new BN(0),s=new BN(1),c=0;t.isEven()&&r.isEven();)t.iushrn(1),r.iushrn(1),++c;for(var d=r.clone(),u=t.clone();!t.isZero();){for(var h=0,l=1;0==(t.words[0]&l)&&h<26;++h,l<<=1);if(h>0)for(t.iushrn(h);h-- >0;)(a.isOdd()||n.isOdd())&&(a.iadd(d),n.isub(u)),a.iushrn(1),n.iushrn(1);for(var b=0,g=1;0==(r.words[0]&g)&&b<26;++b,g<<=1);if(b>0)for(r.iushrn(b);b-- >0;)(o.isOdd()||s.isOdd())&&(o.iadd(d),s.isub(u)),o.iushrn(1),s.iushrn(1);t.cmp(r)>=0?(t.isub(r),a.isub(o),n.isub(s)):(r.isub(t),o.isub(a),s.isub(n))}return{a:o,b:s,gcd:r.iushln(c)}},BN.prototype._invmp=function _invmp(e){assert(0===e.negative),assert(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var a,n=new BN(1),o=new BN(0),s=r.clone();t.cmpn(1)>0&&r.cmpn(1)>0;){for(var c=0,d=1;0==(t.words[0]&d)&&c<26;++c,d<<=1);if(c>0)for(t.iushrn(c);c-- >0;)n.isOdd()&&n.iadd(s),n.iushrn(1);for(var u=0,h=1;0==(r.words[0]&h)&&u<26;++u,h<<=1);if(u>0)for(r.iushrn(u);u-- >0;)o.isOdd()&&o.iadd(s),o.iushrn(1);t.cmp(r)>=0?(t.isub(r),n.isub(o)):(r.isub(t),o.isub(n))}return(a=0===t.cmpn(1)?n:o).cmpn(0)<0&&a.iadd(e),a},BN.prototype.gcd=function gcd(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),r=e.clone();t.negative=0,r.negative=0;for(var a=0;t.isEven()&&r.isEven();a++)t.iushrn(1),r.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=t.cmp(r);if(n<0){var o=t;t=r,r=o}else if(0===n||0===r.cmpn(1))break;t.isub(r)}return r.iushln(a)},BN.prototype.invm=function invm(e){return this.egcd(e).a.umod(e)},BN.prototype.isEven=function isEven(){return 0==(1&this.words[0])},BN.prototype.isOdd=function isOdd(){return 1==(1&this.words[0])},BN.prototype.andln=function andln(e){return this.words[0]&e},BN.prototype.bincn=function bincn(e){assert("number"==typeof e);var t=e%26,r=(e-t)/26,a=1<>>26,s&=67108863,this.words[o]=s}return 0!==n&&(this.words[o]=n,this.length++),this},BN.prototype.isZero=function isZero(){return 1===this.length&&0===this.words[0]},BN.prototype.cmpn=function cmpn(e){var t,r=e<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this.strip(),this.length>1)t=1;else{r&&(e=-e),assert(e<=67108863,"Number is too big");var a=0|this.words[0];t=a===e?0:ae.length)return 1;if(this.length=0;r--){var a=0|this.words[r],n=0|e.words[r];if(a!==n){an&&(t=1);break}}return t},BN.prototype.gtn=function gtn(e){return 1===this.cmpn(e)},BN.prototype.gt=function gt(e){return 1===this.cmp(e)},BN.prototype.gten=function gten(e){return this.cmpn(e)>=0},BN.prototype.gte=function gte(e){return this.cmp(e)>=0},BN.prototype.ltn=function ltn(e){return-1===this.cmpn(e)},BN.prototype.lt=function lt(e){return-1===this.cmp(e)},BN.prototype.lten=function lten(e){return this.cmpn(e)<=0},BN.prototype.lte=function lte(e){return this.cmp(e)<=0},BN.prototype.eqn=function eqn(e){return 0===this.cmpn(e)},BN.prototype.eq=function eq(e){return 0===this.cmp(e)},BN.red=function red(e){return new Red(e)},BN.prototype.toRed=function toRed(e){return assert(!this.red,"Already a number in reduction context"),assert(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},BN.prototype.fromRed=function fromRed(){return assert(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},BN.prototype._forceRed=function _forceRed(e){return this.red=e,this},BN.prototype.forceRed=function forceRed(e){return assert(!this.red,"Already a number in reduction context"),this._forceRed(e)},BN.prototype.redAdd=function redAdd(e){return assert(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},BN.prototype.redIAdd=function redIAdd(e){return assert(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},BN.prototype.redSub=function redSub(e){return assert(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},BN.prototype.redISub=function redISub(e){return assert(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},BN.prototype.redShl=function redShl(e){return assert(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},BN.prototype.redMul=function redMul(e){return assert(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},BN.prototype.redIMul=function redIMul(e){return assert(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},BN.prototype.redSqr=function redSqr(){return assert(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},BN.prototype.redISqr=function redISqr(){return assert(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},BN.prototype.redSqrt=function redSqrt(){return assert(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},BN.prototype.redInvm=function redInvm(){return assert(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},BN.prototype.redNeg=function redNeg(){return assert(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},BN.prototype.redPow=function redPow(e){return assert(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var d={k256:null,p224:null,p192:null,p25519:null};function MPrime(e,t){this.name=e,this.p=new BN(t,16),this.n=this.p.bitLength(),this.k=new BN(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function K256(){MPrime.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function P224(){MPrime.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function P192(){MPrime.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function P25519(){MPrime.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function Red(e){if("string"==typeof e){var t=BN._prime(e);this.m=t.p,this.prime=t}else assert(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function Mont(e){Red.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new BN(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)}MPrime.prototype._tmp=function _tmp(){var e=new BN(null);return e.words=new Array(Math.ceil(this.n/13)),e},MPrime.prototype.ireduce=function ireduce(e){var t,r=e;do{this.split(r,this.tmp),t=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(t>this.n);var a=t0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},MPrime.prototype.split=function split(e,t){e.iushrn(this.n,0,t)},MPrime.prototype.imulK=function imulK(e){return e.imul(this.k)},inherits(K256,MPrime),K256.prototype.split=function split(e,t){for(var r=4194303,a=Math.min(e.length,9),n=0;n>>22,o=s}o>>>=22,e.words[n-10]=o,0===o&&e.length>10?e.length-=10:e.length-=9},K256.prototype.imulK=function imulK(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,r=0;r>>=26,e.words[r]=n,t=a}return 0!==t&&(e.words[e.length++]=t),e},BN._prime=function prime(e){if(d[e])return d[e];var prime;if("k256"===e)prime=new K256;else if("p224"===e)prime=new P224;else if("p192"===e)prime=new P192;else{if("p25519"!==e)throw new Error("Unknown prime "+e);prime=new P25519}return d[e]=prime,prime},Red.prototype._verify1=function _verify1(e){assert(0===e.negative,"red works only with positives"),assert(e.red,"red works only with red numbers")},Red.prototype._verify2=function _verify2(e,t){assert(0==(e.negative|t.negative),"red works only with positives"),assert(e.red&&e.red===t.red,"red works only with red numbers")},Red.prototype.imod=function imod(e){return this.prime?this.prime.ireduce(e)._forceRed(this):e.umod(this.m)._forceRed(this)},Red.prototype.neg=function neg(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},Red.prototype.add=function add(e,t){this._verify2(e,t);var r=e.add(t);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},Red.prototype.iadd=function iadd(e,t){this._verify2(e,t);var r=e.iadd(t);return r.cmp(this.m)>=0&&r.isub(this.m),r},Red.prototype.sub=function sub(e,t){this._verify2(e,t);var r=e.sub(t);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},Red.prototype.isub=function isub(e,t){this._verify2(e,t);var r=e.isub(t);return r.cmpn(0)<0&&r.iadd(this.m),r},Red.prototype.shl=function shl(e,t){return this._verify1(e),this.imod(e.ushln(t))},Red.prototype.imul=function imul(e,t){return this._verify2(e,t),this.imod(e.imul(t))},Red.prototype.mul=function mul(e,t){return this._verify2(e,t),this.imod(e.mul(t))},Red.prototype.isqr=function isqr(e){return this.imul(e,e.clone())},Red.prototype.sqr=function sqr(e){return this.mul(e,e)},Red.prototype.sqrt=function sqrt(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(assert(t%2==1),3===t){var r=this.m.add(new BN(1)).iushrn(2);return this.pow(e,r)}for(var a=this.m.subn(1),n=0;!a.isZero()&&0===a.andln(1);)n++,a.iushrn(1);assert(!a.isZero());var o=new BN(1).toRed(this),s=o.redNeg(),c=this.m.subn(1).iushrn(1),d=this.m.bitLength();for(d=new BN(2*d*d).toRed(this);0!==this.pow(d,c).cmp(s);)d.redIAdd(s);for(var u=this.pow(d,a),h=this.pow(e,a.addn(1).iushrn(1)),l=this.pow(e,a),b=n;0!==l.cmp(o);){for(var g=l,p=0;0!==g.cmp(o);p++)g=g.redSqr();assert(p=0;a--){for(var d=t.words[a],u=c-1;u>=0;u--){var h=d>>u&1;n!==r[0]&&(n=this.sqr(n)),0!==h||0!==o?(o<<=1,o|=h,(4===++s||0===a&&0===u)&&(n=this.mul(n,r[o]),s=0,o=0)):s=0}c=26}return n},Red.prototype.convertTo=function convertTo(e){var t=e.umod(this.m);return t===e?t.clone():t},Red.prototype.convertFrom=function convertFrom(e){var t=e.clone();return t.red=null,t},BN.mont=function mont(e){return new Mont(e)},inherits(Mont,Red),Mont.prototype.convertTo=function convertTo(e){return this.imod(e.ushln(this.shift))},Mont.prototype.convertFrom=function convertFrom(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},Mont.prototype.imul=function imul(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var r=e.imul(t),a=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(a).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},Mont.prototype.mul=function mul(e,t){if(e.isZero()||t.isZero())return new BN(0)._forceRed(this);var r=e.mul(t),a=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(a).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},Mont.prototype.invm=function invm(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(e=r.nmd(e),this)},function(e,t,r){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.KECCAK256_RLP=t.KECCAK256_RLP_S=t.KECCAK256_RLP_ARRAY=t.KECCAK256_RLP_ARRAY_S=t.KECCAK256_NULL=t.KECCAK256_NULL_S=t.TWO_POW256=t.MAX_INTEGER=void 0;var n=r(0).Buffer,o=a(r(48));t.MAX_INTEGER=new o.default("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",16),t.TWO_POW256=new o.default("10000000000000000000000000000000000000000000000000000000000000000",16),t.KECCAK256_NULL_S="c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470",t.KECCAK256_NULL=n.from(t.KECCAK256_NULL_S,"hex"),t.KECCAK256_RLP_ARRAY_S="1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",t.KECCAK256_RLP_ARRAY=n.from(t.KECCAK256_RLP_ARRAY_S,"hex"),t.KECCAK256_RLP_S="56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",t.KECCAK256_RLP=n.from(t.KECCAK256_RLP_S,"hex")},e=>{e.exports=function extend(){for(var e={},r=0;r0&&n[n.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!n||o[1]>n[0]&&o[1]{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.normalize=void 0;t.normalize=e=>e},(e,t,r)=>{"use strict";var a=r(1),n=Object.keys||function(e){var t=[];for(var r in e)t.push(r);return t};e.exports=Duplex;var o=r(606),s=r(609);r(38)(Duplex,o);for(var c=n(s.prototype),d=0;d{var a=r(43).Buffer;function Hash(e,t){this._block=a.alloc(e),this._finalSize=t,this._blockSize=e,this._len=0}Hash.prototype.update=function(e,t){"string"==typeof e&&(t=t||"utf8",e=a.from(e,t));for(var r=this._block,n=this._blockSize,o=e.length,s=this._len,c=0;c=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 a=(4294967295&r)>>>0,n=(r-a)/4294967296;this._block.writeUInt32BE(n,this._blockSize-8),this._block.writeUInt32BE(a,this._blockSize-4)}this._update(this._block);var o=this._hash();return e?o.toString(e):o},Hash.prototype._update=function(){throw new Error("_update must be implemented by subclass")},e.exports=Hash},function(e,t,r){"use strict";var a,n,o,s,c,d=this&&this.__classPrivateFieldSet||function(e,t,r){if(!t.has(e))throw new TypeError("attempted to set private field on non-instance");return t.set(e,r),r},u=this&&this.__classPrivateFieldGet||function(e,t){if(!t.has(e))throw new TypeError("attempted to get private field on non-instance");return t.get(e)},h=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const l=h(r(178)),b=r(1400),g=h(r(374)),p=h(r(1044)),B=h(r(386)),m=h(r(378));b.setGracefulCleanup();const I={prefix:"ganache_",unsafeCleanup:!0},noop=()=>Promise.resolve();class Database extends l.default{constructor(e,t){super(),a.set(this,void 0),n.set(this,noop),o.set(this,!1),this.directory=null,this.db=null,s.set(this,void 0),this.initialize=async()=>{const e={keyEncoding:"binary",valueEncoding:"binary"},t=u(this,a).db;let r;if(t)d(this,s,m.default(t,e)),r=g.default(u(this,s),{});else{let t=u(this,a).dbPath;if(!t){const e=await b.dir(I);if(t=e.path,d(this,n,e.cleanup),u(this,o))return u(this,c).call(this)}this.directory=t;const h={prefix:""},l=m.default(p.default(t,h),e);d(this,s,l),r=g.default(l)}if(u(this,o))return u(this,c).call(this);const h=r.open();return this.trie=B.default(r,"T",e),this.db=r,await h,u(this,o)?u(this,c).call(this):(this.blocks=B.default(r,"b",e),this.blockIndexes=B.default(r,"i",e),this.blockLogs=B.default(r,"l",e),this.transactions=B.default(r,"t",e),this.transactionReceipts=B.default(r,"r",e),this.storageKeys=B.default(r,"s",e),this.emit("ready"))},c.set(this,(async()=>{const e=this.db;return e&&(await new Promise(((t,r)=>e.close((e=>{e?r(e):t(void 0)})))),await Promise.all([this.blocks.close(),this.blockIndexes.close(),this.blockIndexes.close(),this.transactionReceipts.close(),this.transactions.close(),this.storageKeys.close(),this.trie.close()])),u(this,n).call(this)})),d(this,a,e),this.blockchain=t}batch(e){const t=u(this,s).db,r=this.db.batch(),a=t.put,n=t.del;let o;t.put=r.put.bind(r),t.del=r.del.bind(r);try{const s=e();o=r.write().then((()=>s))}finally{t.put=a,t.del=n}return o}async close(){const e=u(this,o);d(this,o,!0),await u(this,c).call(this),e||this.emit("close")}}t.default=Database,a=new WeakMap,n=new WeakMap,o=new WeakMap,s=new WeakMap,c=new WeakMap},function(e,t,r){"use strict";var a,n=r(0).Buffer,o=this&&this.__extends||(a=function(e,t){return(a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function __(){this.constructor=e}a(e,t),e.prototype=null===t?Object.create(t):(__.prototype=t.prototype,new __)}),s=this&&this.__assign||function(){return(s=Object.assign||function(e){for(var t,r=1,a=arguments.length;r0)&&!(a=o.next()).done;)s.push(a.value)}catch(e){n={error:e}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return s};Object.defineProperty(t,"__esModule",{value:!0});var d=r(5),u=r(212),h=r(144),l=function(e){function Transaction(t,r){var a;void 0===r&&(r={});var n=e.call(this,s(s({},t),{type:0}))||this;if(n.common=n._validateTxV(n.v,r.common),n.gasPrice=new d.BN(d.toBuffer(""===t.gasPrice?"0x":t.gasPrice)),n._validateCannotExceedMaxInteger({gasPrice:n.gasPrice}),n.common.gteHardfork("spuriousDragon"))if(n.isSigned()){var o=n.v,c=n.common.chainIdBN().muln(2);(o.eq(c.addn(35))||o.eq(c.addn(36)))&&n.activeCapabilities.push(u.Capability.EIP155ReplayProtection)}else n.activeCapabilities.push(u.Capability.EIP155ReplayProtection);return(null===(a=null==r?void 0:r.freeze)||void 0===a||a)&&Object.freeze(n),n}return o(Transaction,e),Transaction.fromTxData=function(e,t){return void 0===t&&(t={}),new Transaction(e,t)},Transaction.fromSerializedTx=function(e,t){void 0===t&&(t={});var r=d.rlp.decode(e);if(!Array.isArray(r))throw new Error("Invalid serialized tx input. Must be array");return this.fromValuesArray(r,t)},Transaction.fromRlpSerializedTx=function(e,t){return void 0===t&&(t={}),Transaction.fromSerializedTx(e,t)},Transaction.fromValuesArray=function(e,t){if(void 0===t&&(t={}),6!==e.length&&9!==e.length)throw new Error("Invalid transaction. Only expecting 6 values (for unsigned tx) or 9 values (for signed tx).");var r=c(e,9);return new Transaction({nonce:r[0],gasPrice:r[1],gasLimit:r[2],to:r[3],value:r[4],data:r[5],v:r[6],r:r[7],s:r[8]},t)},Transaction.prototype.raw=function(){return[d.bnToUnpaddedBuffer(this.nonce),d.bnToUnpaddedBuffer(this.gasPrice),d.bnToUnpaddedBuffer(this.gasLimit),void 0!==this.to?this.to.buf:n.from([]),d.bnToUnpaddedBuffer(this.value),this.data,void 0!==this.v?d.bnToUnpaddedBuffer(this.v):n.from([]),void 0!==this.r?d.bnToUnpaddedBuffer(this.r):n.from([]),void 0!==this.s?d.bnToUnpaddedBuffer(this.s):n.from([])]},Transaction.prototype.serialize=function(){return d.rlp.encode(this.raw())},Transaction.prototype._getMessageToSign=function(){var e=[d.bnToUnpaddedBuffer(this.nonce),d.bnToUnpaddedBuffer(this.gasPrice),d.bnToUnpaddedBuffer(this.gasLimit),void 0!==this.to?this.to.buf:n.from([]),d.bnToUnpaddedBuffer(this.value),this.data];return this.supports(u.Capability.EIP155ReplayProtection)&&(e.push(d.toBuffer(this.common.chainIdBN())),e.push(d.unpadBuffer(d.toBuffer(0))),e.push(d.unpadBuffer(d.toBuffer(0)))),e},Transaction.prototype.getMessageToSign=function(e){void 0===e&&(e=!0);var t=this._getMessageToSign();return e?d.rlphash(t):t},Transaction.prototype.getUpfrontCost=function(){return this.gasLimit.mul(this.gasPrice).add(this.value)},Transaction.prototype.hash=function(){return d.rlphash(this.raw())},Transaction.prototype.getMessageToVerifySignature=function(){if(!this.isSigned())throw Error("This transaction is not signed");var e=this._getMessageToSign();return d.rlphash(e)},Transaction.prototype.getSenderPublicKey=function(){var e,t=this.getMessageToVerifySignature();if(this.common.gteHardfork("homestead")&&(null===(e=this.s)||void 0===e?void 0:e.gt(u.N_DIV_2)))throw new Error("Invalid Signature: s-values greater than secp256k1n/2 are considered invalid");var r=this,a=r.v,n=r.r,o=r.s;try{return d.ecrecover(t,a,d.bnToUnpaddedBuffer(n),d.bnToUnpaddedBuffer(o),this.supports(u.Capability.EIP155ReplayProtection)?this.common.chainIdBN():void 0)}catch(e){throw new Error("Invalid Signature")}},Transaction.prototype._processSignature=function(e,t,r){var a=new d.BN(e);this.supports(u.Capability.EIP155ReplayProtection)&&a.iadd(this.common.chainIdBN().muln(2).addn(8));var n={common:this.common};return Transaction.fromTxData({nonce:this.nonce,gasPrice:this.gasPrice,gasLimit:this.gasLimit,to:this.to,value:this.value,data:this.data,v:a,r:new d.BN(t),s:new d.BN(r)},n)},Transaction.prototype.toJSON=function(){return{nonce:d.bnToHex(this.nonce),gasPrice:d.bnToHex(this.gasPrice),gasLimit:d.bnToHex(this.gasLimit),to:void 0!==this.to?this.to.toString():void 0,value:d.bnToHex(this.value),data:"0x"+this.data.toString("hex"),v:void 0!==this.v?d.bnToHex(this.v):void 0,r:void 0!==this.r?d.bnToHex(this.r):void 0,s:void 0!==this.s?d.bnToHex(this.s):void 0}},Transaction.prototype._validateTxV=function(e,t){var r;if(void 0!==e&&!e.eqn(0)&&(!t||t.gteHardfork("spuriousDragon"))&&!e.eqn(27)&&!e.eqn(28))if(t){var a=t.chainIdBN().muln(2);if(!(e.eq(a.addn(35))||e.eq(a.addn(36))))throw new Error("Incompatible EIP155-based V "+e.toString()+" and chain id "+t.chainIdBN().toString()+". See the Common parameter of the Transaction constructor to set the chain id.")}else{var n=void 0;n=e.subn(35).isEven()?35:36,r=e.subn(n).divn(2)}return this._getCommon(t,r)},Transaction.prototype._unsignedTxImplementsEIP155=function(){return this.common.gteHardfork("spuriousDragon")},Transaction.prototype._signedTxImplementsEIP155=function(){if(!this.isSigned())throw Error("This transaction is not signed");var e=this.common.gteHardfork("spuriousDragon"),t=this.v,r=this.common.chainIdBN().muln(2);return(t.eq(r.addn(35))||t.eq(r.addn(36)))&&e},Transaction}(h.BaseTransaction);t.default=l},(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.N_DIV_2=t.isAccessList=t.isAccessListBuffer=t.Capability=void 0;var a=r(5);function isAccessListBuffer(e){if(0===e.length)return!0;var t=e[0];return!!Array.isArray(t)}!function(e){e[e.EIP155ReplayProtection=155]="EIP155ReplayProtection",e[e.EIP1559FeeMarket=1559]="EIP1559FeeMarket",e[e.EIP2718TypedTransaction=2718]="EIP2718TypedTransaction",e[e.EIP2930AccessLists=2930]="EIP2930AccessLists"}(t.Capability||(t.Capability={})),t.isAccessListBuffer=isAccessListBuffer,t.isAccessList=function isAccessList(e){return!isAccessListBuffer(e)},t.N_DIV_2=new a.BN("7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0",16)},function(e,t,r){"use strict";var a,n=r(0).Buffer,o=this&&this.__extends||(a=function(e,t){return(a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function __(){this.constructor=e}a(e,t),e.prototype=null===t?Object.create(t):(__.prototype=t.prototype,new __)}),s=this&&this.__assign||function(){return(s=Object.assign||function(e){for(var t,r=1,a=arguments.length;r0)&&!(a=o.next()).done;)s.push(a.value)}catch(e){n={error:e}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return s};Object.defineProperty(t,"__esModule",{value:!0});var d=r(5),u=r(144),h=r(212),l=r(1062),b=n.from(1..toString(16).padStart(2,"0"),"hex"),g=function(e){function AccessListEIP2930Transaction(t,r){var a,n;void 0===r&&(r={});var o=e.call(this,s(s({},t),{type:1}))||this;o.DEFAULT_HARDFORK="berlin";var c=t.chainId,u=t.accessList,b=t.gasPrice;if(o.common=o._getCommon(r.common,c),o.chainId=o.common.chainIdBN(),!o.common.isActivatedEIP(2930))throw new Error("EIP-2930 not enabled on Common");o.activeCapabilities=o.activeCapabilities.concat([2718,2930]);var g=l.AccessLists.getAccessListData(null!=u?u:[]);if(o.accessList=g.accessList,o.AccessListJSON=g.AccessListJSON,l.AccessLists.verifyAccessList(o.accessList),o.gasPrice=new d.BN(d.toBuffer(""===b?"0x":b)),o._validateCannotExceedMaxInteger({gasPrice:o.gasPrice}),o.v&&!o.v.eqn(0)&&!o.v.eqn(1))throw new Error("The y-parity of the transaction should either be 0 or 1");if(o.common.gteHardfork("homestead")&&(null===(a=o.s)||void 0===a?void 0:a.gt(h.N_DIV_2)))throw new Error("Invalid Signature: s-values greater than secp256k1n/2 are considered invalid");return(null===(n=null==r?void 0:r.freeze)||void 0===n||n)&&Object.freeze(o),o}return o(AccessListEIP2930Transaction,e),Object.defineProperty(AccessListEIP2930Transaction.prototype,"senderR",{get:function(){return this.r},enumerable:!1,configurable:!0}),Object.defineProperty(AccessListEIP2930Transaction.prototype,"senderS",{get:function(){return this.s},enumerable:!1,configurable:!0}),Object.defineProperty(AccessListEIP2930Transaction.prototype,"yParity",{get:function(){return this.v},enumerable:!1,configurable:!0}),AccessListEIP2930Transaction.fromTxData=function(e,t){return void 0===t&&(t={}),new AccessListEIP2930Transaction(e,t)},AccessListEIP2930Transaction.fromSerializedTx=function(e,t){if(void 0===t&&(t={}),!e.slice(0,1).equals(b))throw new Error("Invalid serialized tx input: not an EIP-2930 transaction (wrong tx type, expected: 1, received: "+e.slice(0,1).toString("hex"));var r=d.rlp.decode(e.slice(1));if(!Array.isArray(r))throw new Error("Invalid serialized tx input: must be array");return AccessListEIP2930Transaction.fromValuesArray(r,t)},AccessListEIP2930Transaction.fromRlpSerializedTx=function(e,t){return void 0===t&&(t={}),AccessListEIP2930Transaction.fromSerializedTx(e,t)},AccessListEIP2930Transaction.fromValuesArray=function(e,t){if(void 0===t&&(t={}),8!==e.length&&11!==e.length)throw new Error("Invalid EIP-2930 transaction. Only expecting 8 values (for unsigned tx) or 11 values (for signed tx).");var r=c(e,11),a=r[0],n=r[1],o=r[2],s=r[3],u=r[4],h=r[5],l=r[6],b=r[7],g=r[8],p=r[9],B=r[10];return new AccessListEIP2930Transaction({chainId:new d.BN(a),nonce:n,gasPrice:o,gasLimit:s,to:u,value:h,data:l,accessList:null!=b?b:[],v:void 0!==g?new d.BN(g):void 0,r:p,s:B},t)},AccessListEIP2930Transaction.prototype.getDataFee=function(){var t=e.prototype.getDataFee.call(this);return t.iaddn(l.AccessLists.getDataFeeEIP2930(this.accessList,this.common)),t},AccessListEIP2930Transaction.prototype.getUpfrontCost=function(){return this.gasLimit.mul(this.gasPrice).add(this.value)},AccessListEIP2930Transaction.prototype.raw=function(){return[d.bnToUnpaddedBuffer(this.chainId),d.bnToUnpaddedBuffer(this.nonce),d.bnToUnpaddedBuffer(this.gasPrice),d.bnToUnpaddedBuffer(this.gasLimit),void 0!==this.to?this.to.buf:n.from([]),d.bnToUnpaddedBuffer(this.value),this.data,this.accessList,void 0!==this.v?d.bnToUnpaddedBuffer(this.v):n.from([]),void 0!==this.r?d.bnToUnpaddedBuffer(this.r):n.from([]),void 0!==this.s?d.bnToUnpaddedBuffer(this.s):n.from([])]},AccessListEIP2930Transaction.prototype.serialize=function(){var e=this.raw();return n.concat([b,d.rlp.encode(e)])},AccessListEIP2930Transaction.prototype.getMessageToSign=function(e){void 0===e&&(e=!0);var t=this.raw().slice(0,8),r=n.concat([b,d.rlp.encode(t)]);return e?d.keccak256(r):r},AccessListEIP2930Transaction.prototype.hash=function(){if(!this.isSigned())throw new Error("Cannot call hash method if transaction is not signed");return d.keccak256(this.serialize())},AccessListEIP2930Transaction.prototype.getMessageToVerifySignature=function(){return this.getMessageToSign()},AccessListEIP2930Transaction.prototype.getSenderPublicKey=function(){var e;if(!this.isSigned())throw new Error("Cannot call this method if transaction is not signed");var t=this.getMessageToVerifySignature();if(this.common.gteHardfork("homestead")&&(null===(e=this.s)||void 0===e?void 0:e.gt(h.N_DIV_2)))throw new Error("Invalid Signature: s-values greater than secp256k1n/2 are considered invalid");var r=this,a=r.yParity,n=r.r,o=r.s;try{return d.ecrecover(t,a.addn(27),d.bnToUnpaddedBuffer(n),d.bnToUnpaddedBuffer(o))}catch(e){throw new Error("Invalid Signature")}},AccessListEIP2930Transaction.prototype._processSignature=function(e,t,r){var a={common:this.common};return AccessListEIP2930Transaction.fromTxData({chainId:this.chainId,nonce:this.nonce,gasPrice:this.gasPrice,gasLimit:this.gasLimit,to:this.to,value:this.value,data:this.data,accessList:this.accessList,v:new d.BN(e-27),r:new d.BN(t),s:new d.BN(r)},a)},AccessListEIP2930Transaction.prototype.toJSON=function(){var e=l.AccessLists.getAccessListJSON(this.accessList);return{chainId:d.bnToHex(this.chainId),nonce:d.bnToHex(this.nonce),gasPrice:d.bnToHex(this.gasPrice),gasLimit:d.bnToHex(this.gasLimit),to:void 0!==this.to?this.to.toString():void 0,value:d.bnToHex(this.value),data:"0x"+this.data.toString("hex"),accessList:e,v:void 0!==this.v?d.bnToHex(this.v):void 0,r:void 0!==this.r?d.bnToHex(this.r):void 0,s:void 0!==this.s?d.bnToHex(this.s):void 0}},AccessListEIP2930Transaction}(u.BaseTransaction);t.default=g},function(e,t,r){"use strict";var a,n=r(0).Buffer,o=this&&this.__extends||(a=function(e,t){return(a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function __(){this.constructor=e}a(e,t),e.prototype=null===t?Object.create(t):(__.prototype=t.prototype,new __)}),s=this&&this.__assign||function(){return(s=Object.assign||function(e){for(var t,r=1,a=arguments.length;r0)&&!(a=o.next()).done;)s.push(a.value)}catch(e){n={error:e}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return s};Object.defineProperty(t,"__esModule",{value:!0});var d=r(5),u=r(144),h=r(212),l=r(1062),b=n.from(2..toString(16).padStart(2,"0"),"hex"),g=function(e){function FeeMarketEIP1559Transaction(t,r){var a,n;void 0===r&&(r={});var o=e.call(this,s(s({},t),{type:2}))||this;o.DEFAULT_HARDFORK="london";var c=t.chainId,u=t.accessList,b=t.maxFeePerGas,g=t.maxPriorityFeePerGas;if(o.common=o._getCommon(r.common,c),o.chainId=o.common.chainIdBN(),!o.common.isActivatedEIP(1559))throw new Error("EIP-1559 not enabled on Common");o.activeCapabilities=o.activeCapabilities.concat([1559,2718,2930]);var p=l.AccessLists.getAccessListData(null!=u?u:[]);if(o.accessList=p.accessList,o.AccessListJSON=p.AccessListJSON,l.AccessLists.verifyAccessList(o.accessList),o.maxFeePerGas=new d.BN(d.toBuffer(""===b?"0x":b)),o.maxPriorityFeePerGas=new d.BN(d.toBuffer(""===g?"0x":g)),o._validateCannotExceedMaxInteger({maxFeePerGas:o.maxFeePerGas,maxPriorityFeePerGas:o.maxPriorityFeePerGas},256),o.maxFeePerGas.lt(o.maxPriorityFeePerGas))throw new Error("maxFeePerGas cannot be less than maxPriorityFeePerGas (The total must be the larger of the two)");if(o.v&&!o.v.eqn(0)&&!o.v.eqn(1))throw new Error("The y-parity of the transaction should either be 0 or 1");if(o.common.gteHardfork("homestead")&&(null===(a=o.s)||void 0===a?void 0:a.gt(h.N_DIV_2)))throw new Error("Invalid Signature: s-values greater than secp256k1n/2 are considered invalid");return(null===(n=null==r?void 0:r.freeze)||void 0===n||n)&&Object.freeze(o),o}return o(FeeMarketEIP1559Transaction,e),Object.defineProperty(FeeMarketEIP1559Transaction.prototype,"senderR",{get:function(){return this.r},enumerable:!1,configurable:!0}),Object.defineProperty(FeeMarketEIP1559Transaction.prototype,"senderS",{get:function(){return this.s},enumerable:!1,configurable:!0}),Object.defineProperty(FeeMarketEIP1559Transaction.prototype,"yParity",{get:function(){return this.v},enumerable:!1,configurable:!0}),FeeMarketEIP1559Transaction.fromTxData=function(e,t){return void 0===t&&(t={}),new FeeMarketEIP1559Transaction(e,t)},FeeMarketEIP1559Transaction.fromSerializedTx=function(e,t){if(void 0===t&&(t={}),!e.slice(0,1).equals(b))throw new Error("Invalid serialized tx input: not an EIP-1559 transaction (wrong tx type, expected: 2, received: "+e.slice(0,1).toString("hex"));var r=d.rlp.decode(e.slice(1));if(!Array.isArray(r))throw new Error("Invalid serialized tx input: must be array");return FeeMarketEIP1559Transaction.fromValuesArray(r,t)},FeeMarketEIP1559Transaction.fromRlpSerializedTx=function(e,t){return void 0===t&&(t={}),FeeMarketEIP1559Transaction.fromSerializedTx(e,t)},FeeMarketEIP1559Transaction.fromValuesArray=function(e,t){if(void 0===t&&(t={}),9!==e.length&&12!==e.length)throw new Error("Invalid EIP-1559 transaction. Only expecting 9 values (for unsigned tx) or 12 values (for signed tx).");var r=c(e,12),a=r[0],n=r[1],o=r[2],s=r[3],u=r[4],h=r[5],l=r[6],b=r[7],g=r[8],p=r[9],B=r[10],m=r[11];return new FeeMarketEIP1559Transaction({chainId:new d.BN(a),nonce:n,maxPriorityFeePerGas:o,maxFeePerGas:s,gasLimit:u,to:h,value:l,data:b,accessList:null!=g?g:[],v:void 0!==p?new d.BN(p):void 0,r:B,s:m},t)},FeeMarketEIP1559Transaction.prototype.getDataFee=function(){var t=e.prototype.getDataFee.call(this);return t.iaddn(l.AccessLists.getDataFeeEIP2930(this.accessList,this.common)),t},FeeMarketEIP1559Transaction.prototype.getUpfrontCost=function(e){void 0===e&&(e=new d.BN(0));var t=d.BN.min(this.maxPriorityFeePerGas,this.maxFeePerGas.sub(e)).add(e);return this.gasLimit.mul(t).add(this.value)},FeeMarketEIP1559Transaction.prototype.raw=function(){return[d.bnToUnpaddedBuffer(this.chainId),d.bnToUnpaddedBuffer(this.nonce),d.bnToUnpaddedBuffer(this.maxPriorityFeePerGas),d.bnToUnpaddedBuffer(this.maxFeePerGas),d.bnToUnpaddedBuffer(this.gasLimit),void 0!==this.to?this.to.buf:n.from([]),d.bnToUnpaddedBuffer(this.value),this.data,this.accessList,void 0!==this.v?d.bnToUnpaddedBuffer(this.v):n.from([]),void 0!==this.r?d.bnToUnpaddedBuffer(this.r):n.from([]),void 0!==this.s?d.bnToUnpaddedBuffer(this.s):n.from([])]},FeeMarketEIP1559Transaction.prototype.serialize=function(){var e=this.raw();return n.concat([b,d.rlp.encode(e)])},FeeMarketEIP1559Transaction.prototype.getMessageToSign=function(e){void 0===e&&(e=!0);var t=this.raw().slice(0,9),r=n.concat([b,d.rlp.encode(t)]);return e?d.keccak256(r):r},FeeMarketEIP1559Transaction.prototype.hash=function(){if(!this.isSigned())throw new Error("Cannot call hash method if transaction is not signed");return d.keccak256(this.serialize())},FeeMarketEIP1559Transaction.prototype.getMessageToVerifySignature=function(){return this.getMessageToSign()},FeeMarketEIP1559Transaction.prototype.getSenderPublicKey=function(){var e;if(!this.isSigned())throw new Error("Cannot call this method if transaction is not signed");var t=this.getMessageToVerifySignature();if(this.common.gteHardfork("homestead")&&(null===(e=this.s)||void 0===e?void 0:e.gt(h.N_DIV_2)))throw new Error("Invalid Signature: s-values greater than secp256k1n/2 are considered invalid");var r=this,a=r.v,n=r.r,o=r.s;try{return d.ecrecover(t,a.addn(27),d.bnToUnpaddedBuffer(n),d.bnToUnpaddedBuffer(o))}catch(e){throw new Error("Invalid Signature")}},FeeMarketEIP1559Transaction.prototype._processSignature=function(e,t,r){var a={common:this.common};return FeeMarketEIP1559Transaction.fromTxData({chainId:this.chainId,nonce:this.nonce,maxPriorityFeePerGas:this.maxPriorityFeePerGas,maxFeePerGas:this.maxFeePerGas,gasLimit:this.gasLimit,to:this.to,value:this.value,data:this.data,accessList:this.accessList,v:new d.BN(e-27),r:new d.BN(t),s:new d.BN(r)},a)},FeeMarketEIP1559Transaction.prototype.toJSON=function(){var e=l.AccessLists.getAccessListJSON(this.accessList);return{chainId:d.bnToHex(this.chainId),nonce:d.bnToHex(this.nonce),maxPriorityFeePerGas:d.bnToHex(this.maxPriorityFeePerGas),maxFeePerGas:d.bnToHex(this.maxFeePerGas),gasLimit:d.bnToHex(this.gasLimit),to:void 0!==this.to?this.to.toString():void 0,value:d.bnToHex(this.value),data:"0x"+this.data.toString("hex"),accessList:e,v:void 0!==this.v?d.bnToHex(this.v):void 0,r:void 0!==this.r?d.bnToHex(this.r):void 0,s:void 0!==this.s?d.bnToHex(this.s):void 0}},FeeMarketEIP1559Transaction}(u.BaseTransaction);t.default=g},function(e,t,r){"use strict";var a=r(0).Buffer,n=this&&this.__awaiter||function(e,t,r,a){return new(r||(r=Promise))((function(n,o){function fulfilled(e){try{step(a.next(e))}catch(e){o(e)}}function rejected(e){try{step(a.throw(e))}catch(e){o(e)}}function step(e){e.done?n(e.value):function adopt(e){return e instanceof r?e:new r((function(t){t(e)}))}(e.value).then(fulfilled,rejected)}step((a=a.apply(e,t||[])).next())}))},o=this&&this.__generator||function(e,t){var r,a,n,o,s={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return o={next:verb(0),throw:verb(1),return:verb(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function verb(o){return function(c){return function step(o){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,a&&(n=2&o[0]?a.return:o[0]?a.throw||((n=a.return)&&n.call(a),0):a.next)&&!(n=n.call(a,o[1])).done)return n;switch(a=0,n&&(o=[2&o[0],n.value]),o[0]){case 0:case 1:n=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,a=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(n=s.trys,(n=n.length>0&&n[n.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!n||o[1]>n[0]&&o[1]0)&&!(a=o.next()).done;)s.push(a.value)}catch(e){n={error:e}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return s};Object.defineProperty(t,"__esModule",{value:!0});var c=r(5),d=r(93),u=r(1064),h=function(){function Ethash(e){this.dbOpts={valueEncoding:"json"},this.cacheDB=e,this.cache=[]}return Ethash.prototype.mkcache=function(e,t){var r,a=Math.floor(e/d.params.HASH_BYTES),n=[c.keccak(t,512)];for(r=1;r{var a=r(145),n=r(631),o=r(217),s=r(633),c=Object.defineProperty;t.f=a?c:function defineProperty(e,t,r){if(o(e),t=s(t),o(r),n)try{return c(e,t,r)}catch(e){}if("get"in r||"set"in r)throw TypeError("Accessors not supported");return"value"in r&&(e[t]=r.value),e}},(e,t,r)=>{var a=r(119);e.exports=function(e){if(!a(e))throw TypeError(String(e)+" is not an object");return e}},function(e,t,r){"use strict";var a=r(0).Buffer,n=this&&this.__awaiter||function(e,t,r,a){return new(r||(r=Promise))((function(n,o){function fulfilled(e){try{step(a.next(e))}catch(e){o(e)}}function rejected(e){try{step(a.throw(e))}catch(e){o(e)}}function step(e){e.done?n(e.value):function adopt(e){return e instanceof r?e:new r((function(t){t(e)}))}(e.value).then(fulfilled,rejected)}step((a=a.apply(e,t||[])).next())}))},o=this&&this.__generator||function(e,t){var r,a,n,o,s={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return o={next:verb(0),throw:verb(1),return:verb(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function verb(o){return function(c){return function step(o){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,a&&(n=2&o[0]?a.return:o[0]?a.throw||((n=a.return)&&n.call(a),0):a.next)&&!(n=n.call(a,o[1])).done)return n;switch(a=0,n&&(o=[2&o[0],n.value]),o[0]){case 0:case 1:n=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,a=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(n=s.trys,(n=n.length>0&&n[n.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!n||o[1]>n[0]&&o[1]=e.length&&(e=void 0),{value:e&&e[a++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var c=r(5),d=r(380),u=function(){function Cache(e){this._cache=d(),this._checkpoints=[],this._trie=e}return Cache.prototype.put=function(e,t,r){void 0===r&&(r=!1);var a=!r;this._update(e,t,a,!1)},Cache.prototype.get=function(e){var t=this.lookup(e);return null!=t?t:new c.Account},Cache.prototype.lookup=function(e){var t=e.buf.toString("hex"),r=this._cache.find(t);if(r.node){var a=r.value.val;return c.Account.fromRlpSerializedAccount(a)}},Cache.prototype.keyIsDeleted=function(e){var t=e.buf.toString("hex"),r=this._cache.find(t);return!!r.node&&r.value.deleted},Cache.prototype._lookupAccount=function(e){return n(this,void 0,void 0,(function(){var t;return o(this,(function(r){switch(r.label){case 0:return[4,this._trie.get(e.buf)];case 1:return[2,(t=r.sent())?c.Account.fromRlpSerializedAccount(t):new c.Account]}}))}))},Cache.prototype.getOrLoad=function(e){return n(this,void 0,void 0,(function(){var t;return o(this,(function(r){switch(r.label){case 0:return(t=this.lookup(e))?[3,2]:[4,this._lookupAccount(e)];case 1:t=r.sent(),this._update(e,t,!1,!1),r.label=2;case 2:return[2,t]}}))}))},Cache.prototype.warm=function(e){return n(this,void 0,void 0,(function(){var t,r,n,d,u,h,l,b;return o(this,(function(o){switch(o.label){case 0:o.trys.push([0,5,6,7]),t=s(e),r=t.next(),o.label=1;case 1:return r.done?[3,4]:(n=r.value)?(d=new c.Address(a.from(n,"hex")),[4,this._lookupAccount(d)]):[3,3];case 2:u=o.sent(),this._update(d,u,!1,!1),o.label=3;case 3:return r=t.next(),[3,1];case 4:return[3,7];case 5:return h=o.sent(),l={error:h},[3,7];case 6:try{r&&!r.done&&(b=t.return)&&b.call(t)}finally{if(l)throw l.error}return[7];case 7:return[2]}}))}))},Cache.prototype.flush=function(){return n(this,void 0,void 0,(function(){var e,t,r,n;return o(this,(function(o){switch(o.label){case 0:e=this._cache.begin,t=!0,o.label=1;case 1:return t?e.value&&e.value.modified&&!e.value.deleted?(e.value.modified=!1,r=e.value.val,n=a.from(e.key,"hex"),[4,this._trie.put(n,r)]):[3,3]:[3,7];case 2:return o.sent(),t=e.hasNext,e.next(),[3,6];case 3:return e.value&&e.value.modified&&e.value.deleted?(e.value.modified=!1,e.value.deleted=!0,e.value.val=(new c.Account).serialize(),n=a.from(e.key,"hex"),[4,this._trie.del(n)]):[3,5];case 4:return o.sent(),t=e.hasNext,e.next(),[3,6];case 5:t=e.hasNext,e.next(),o.label=6;case 6:return[3,1];case 7:return[2]}}))}))},Cache.prototype.checkpoint=function(){this._checkpoints.push(this._cache)},Cache.prototype.revert=function(){this._cache=this._checkpoints.pop()},Cache.prototype.commit=function(){this._checkpoints.pop()},Cache.prototype.clear=function(){this._cache=d()},Cache.prototype.del=function(e){this._update(e,new c.Account,!0,!0)},Cache.prototype._update=function(e,t,r,a){var n=e.buf.toString("hex"),o=this._cache.find(n),s=t.serialize();o.node?this._cache=o.update({val:s,modified:r,deleted:a}):this._cache=this._cache.insert(n,{val:s,modified:r,deleted:a})},Cache}();t.default=u},function(e,t,r){"use strict";var a=r(0).Buffer,n=this&&this.__awaiter||function(e,t,r,a){return new(r||(r=Promise))((function(n,o){function fulfilled(e){try{step(a.next(e))}catch(e){o(e)}}function rejected(e){try{step(a.throw(e))}catch(e){o(e)}}function step(e){e.done?n(e.value):function adopt(e){return e instanceof r?e:new r((function(t){t(e)}))}(e.value).then(fulfilled,rejected)}step((a=a.apply(e,t||[])).next())}))},o=this&&this.__generator||function(e,t){var r,a,n,o,s={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return o={next:verb(0),throw:verb(1),return:verb(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function verb(o){return function(c){return function step(o){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,a&&(n=2&o[0]?a.return:o[0]?a.throw||((n=a.return)&&n.call(a),0):a.next)&&!(n=n.call(a,o[1])).done)return n;switch(a=0,n&&(o=[2&o[0],n.value]),o[0]){case 0:case 1:n=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,a=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(n=s.trys,(n=n.length>0&&n[n.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!n||o[1]>n[0]&&o[1]=this._runState.code.length))throw new Error("Internal error: program counter not in range");o.label=1;case 1:return this._runState.programCounter=e.length&&(e=void 0),{value:e&&e[a++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},o=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var a,n,o=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(a=o.next()).done;)s.push(a.value)}catch(e){n={error:e}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return s};Object.defineProperty(t,"__esModule",{value:!0}),t.getOpcodesForHF=t.Opcode=void 0;var s=r(121),c=function c(e){var t=e.code,r=e.name,a=e.fullName,n=e.fee,o=e.isAsync;this.code=t,this.name=r,this.fullName=a,this.fee=n,this.isAsync=o,Object.freeze(this)};t.Opcode=c;var d={0:{name:"STOP",isAsync:!1},1:{name:"ADD",isAsync:!1},2:{name:"MUL",isAsync:!1},3:{name:"SUB",isAsync:!1},4:{name:"DIV",isAsync:!1},5:{name:"SDIV",isAsync:!1},6:{name:"MOD",isAsync:!1},7:{name:"SMOD",isAsync:!1},8:{name:"ADDMOD",isAsync:!1},9:{name:"MULMOD",isAsync:!1},10:{name:"EXP",isAsync:!1},11:{name:"SIGNEXTEND",isAsync:!1},16:{name:"LT",isAsync:!1},17:{name:"GT",isAsync:!1},18:{name:"SLT",isAsync:!1},19:{name:"SGT",isAsync:!1},20:{name:"EQ",isAsync:!1},21:{name:"ISZERO",isAsync:!1},22:{name:"AND",isAsync:!1},23:{name:"OR",isAsync:!1},24:{name:"XOR",isAsync:!1},25:{name:"NOT",isAsync:!1},26:{name:"BYTE",isAsync:!1},32:{name:"SHA3",isAsync:!1},48:{name:"ADDRESS",isAsync:!0},49:{name:"BALANCE",isAsync:!0},50:{name:"ORIGIN",isAsync:!0},51:{name:"CALLER",isAsync:!0},52:{name:"CALLVALUE",isAsync:!0},53:{name:"CALLDATALOAD",isAsync:!0},54:{name:"CALLDATASIZE",isAsync:!0},55:{name:"CALLDATACOPY",isAsync:!0},56:{name:"CODESIZE",isAsync:!1},57:{name:"CODECOPY",isAsync:!1},58:{name:"GASPRICE",isAsync:!1},59:{name:"EXTCODESIZE",isAsync:!0},60:{name:"EXTCODECOPY",isAsync:!0},64:{name:"BLOCKHASH",isAsync:!0},65:{name:"COINBASE",isAsync:!0},66:{name:"TIMESTAMP",isAsync:!0},67:{name:"NUMBER",isAsync:!0},68:{name:"DIFFICULTY",isAsync:!0},69:{name:"GASLIMIT",isAsync:!0},80:{name:"POP",isAsync:!1},81:{name:"MLOAD",isAsync:!1},82:{name:"MSTORE",isAsync:!1},83:{name:"MSTORE8",isAsync:!1},84:{name:"SLOAD",isAsync:!0},85:{name:"SSTORE",isAsync:!0},86:{name:"JUMP",isAsync:!1},87:{name:"JUMPI",isAsync:!1},88:{name:"PC",isAsync:!1},89:{name:"MSIZE",isAsync:!1},90:{name:"GAS",isAsync:!1},91:{name:"JUMPDEST",isAsync:!1},96:{name:"PUSH",isAsync:!1},97:{name:"PUSH",isAsync:!1},98:{name:"PUSH",isAsync:!1},99:{name:"PUSH",isAsync:!1},100:{name:"PUSH",isAsync:!1},101:{name:"PUSH",isAsync:!1},102:{name:"PUSH",isAsync:!1},103:{name:"PUSH",isAsync:!1},104:{name:"PUSH",isAsync:!1},105:{name:"PUSH",isAsync:!1},106:{name:"PUSH",isAsync:!1},107:{name:"PUSH",isAsync:!1},108:{name:"PUSH",isAsync:!1},109:{name:"PUSH",isAsync:!1},110:{name:"PUSH",isAsync:!1},111:{name:"PUSH",isAsync:!1},112:{name:"PUSH",isAsync:!1},113:{name:"PUSH",isAsync:!1},114:{name:"PUSH",isAsync:!1},115:{name:"PUSH",isAsync:!1},116:{name:"PUSH",isAsync:!1},117:{name:"PUSH",isAsync:!1},118:{name:"PUSH",isAsync:!1},119:{name:"PUSH",isAsync:!1},120:{name:"PUSH",isAsync:!1},121:{name:"PUSH",isAsync:!1},122:{name:"PUSH",isAsync:!1},123:{name:"PUSH",isAsync:!1},124:{name:"PUSH",isAsync:!1},125:{name:"PUSH",isAsync:!1},126:{name:"PUSH",isAsync:!1},127:{name:"PUSH",isAsync:!1},128:{name:"DUP",isAsync:!1},129:{name:"DUP",isAsync:!1},130:{name:"DUP",isAsync:!1},131:{name:"DUP",isAsync:!1},132:{name:"DUP",isAsync:!1},133:{name:"DUP",isAsync:!1},134:{name:"DUP",isAsync:!1},135:{name:"DUP",isAsync:!1},136:{name:"DUP",isAsync:!1},137:{name:"DUP",isAsync:!1},138:{name:"DUP",isAsync:!1},139:{name:"DUP",isAsync:!1},140:{name:"DUP",isAsync:!1},141:{name:"DUP",isAsync:!1},142:{name:"DUP",isAsync:!1},143:{name:"DUP",isAsync:!1},144:{name:"SWAP",isAsync:!1},145:{name:"SWAP",isAsync:!1},146:{name:"SWAP",isAsync:!1},147:{name:"SWAP",isAsync:!1},148:{name:"SWAP",isAsync:!1},149:{name:"SWAP",isAsync:!1},150:{name:"SWAP",isAsync:!1},151:{name:"SWAP",isAsync:!1},152:{name:"SWAP",isAsync:!1},153:{name:"SWAP",isAsync:!1},154:{name:"SWAP",isAsync:!1},155:{name:"SWAP",isAsync:!1},156:{name:"SWAP",isAsync:!1},157:{name:"SWAP",isAsync:!1},158:{name:"SWAP",isAsync:!1},159:{name:"SWAP",isAsync:!1},160:{name:"LOG",isAsync:!1},161:{name:"LOG",isAsync:!1},162:{name:"LOG",isAsync:!1},163:{name:"LOG",isAsync:!1},164:{name:"LOG",isAsync:!1},240:{name:"CREATE",isAsync:!0},241:{name:"CALL",isAsync:!0},242:{name:"CALLCODE",isAsync:!0},243:{name:"RETURN",isAsync:!1},254:{name:"INVALID",isAsync:!1},255:{name:"SELFDESTRUCT",isAsync:!0}},u=[{hardforkName:"homestead",opcodes:{244:{name:"DELEGATECALL",isAsync:!0}}},{hardforkName:"tangerineWhistle",opcodes:{84:{name:"SLOAD",isAsync:!0},241:{name:"CALL",isAsync:!0},242:{name:"CALLCODE",isAsync:!0},59:{name:"EXTCODESIZE",isAsync:!0},60:{name:"EXTCODECOPY",isAsync:!0},244:{name:"DELEGATECALL",isAsync:!0},255:{name:"SELFDESTRUCT",isAsync:!0},49:{name:"BALANCE",isAsync:!0}}},{hardforkName:"byzantium",opcodes:{253:{name:"REVERT",isAsync:!1},250:{name:"STATICCALL",isAsync:!0},61:{name:"RETURNDATASIZE",isAsync:!0},62:{name:"RETURNDATACOPY",isAsync:!0}}},{hardforkName:"constantinople",opcodes:{27:{name:"SHL",isAsync:!1},28:{name:"SHR",isAsync:!1},29:{name:"SAR",isAsync:!1},63:{name:"EXTCODEHASH",isAsync:!0},245:{name:"CREATE2",isAsync:!0}}},{hardforkName:"istanbul",opcodes:{70:{name:"CHAINID",isAsync:!1},71:{name:"SELFBALANCE",isAsync:!1}}}],h=[{eip:2315,opcodes:{92:{name:"BEGINSUB",isAsync:!1},93:{name:"RETURNSUB",isAsync:!1},94:{name:"JUMPSUB",isAsync:!1}}},{eip:3198,opcodes:{72:{name:"BASEFEE",isAsync:!1}}}];t.getOpcodesForHF=function getOpcodesForHF(e){for(var t,r,l=a({},d),b=0;b{var a=r(0).Buffer;const n=r(649),o=n.cwrap("ec_add","string",["string"]),s=n.cwrap("ec_mul","string",["string"]),c=n.cwrap("ec_pairing","string",["string"]);e.exports={add:function bn128add(e){return a.from(o(e.toString("hex")),"hex")},mul:function bn128mul(e){return a.from(s(e.toString("hex")),"hex")},pairing:function bn128pairing(e){return a.from(c(e.toString("hex")),"hex")}}},(e,t,r)=>{"use strict";var a=r(66),n=r(410),o=n(a("String.prototype.indexOf"));e.exports=function callBoundIntrinsic(e,t){var r=a(e,!!t);return"function"==typeof r&&o(e,".prototype.")>-1?n(r):r}},function(e,t,r){"use strict";var a,n=this&&this.__classPrivateFieldSet||function(e,t,r){if(!t.has(e))throw new TypeError("attempted to set private field on non-instance");return t.set(e,r),r},o=this&&this.__classPrivateFieldGet||function(e,t){if(!t.has(e))throw new TypeError("attempted to get private field on non-instance");return t.get(e)},s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const c=r(14),d=s(r(173)),u=r(8),h=r(1005);class BlockLogManager extends d.default{constructor(e,t){super(e,c.BlockLogs),a.set(this,void 0),n(this,a,t)}async get(e){const t=await super.get(e);if(t)t.blockNumber=u.Quantity.from(e);else if(o(this,a).fallback){const t=u.Quantity.from(e),r=await o(this,a).fallback.request("eth_getLogs",[{fromBlock:t,toBlock:t}]);return c.BlockLogs.fromJSON(r)}return t}async getLogs(e){const t=o(this,a);if("blockHash"in e){const{addresses:r,topics:a}=h.parseFilterDetails(e),n=await t.blocks.getNumberFromHash(e.blockHash);if(!n)return[];const o=await this.get(n);return o?[...o.filter(r,a)]:[]}{const{addresses:r,topics:a,fromBlock:n,toBlockNumber:o}=h.parseFilter(e,t),s=[this.get(n.toBuffer())],c=n.toNumber();if(c!==o)for(let e=c+1,t=o+1;e{const t=[];return e.forEach((e=>{e&&t.push(...e.filter(r,a))})),t}))}}}t.default=BlockLogManager,a=new WeakMap},function(e,t,r){"use strict";var a,n,o,s,c,d=this&&this.__classPrivateFieldSet||function(e,t,r){if(!t.has(e))throw new TypeError("attempted to set private field on non-instance");return t.set(e,r),r},u=this&&this.__classPrivateFieldGet||function(e,t){if(!t.has(e))throw new TypeError("attempted to get private field on non-instance");return t.get(e)},h=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const l=h(r(173)),b=h(r(174)),g=h(r(225)),p=r(8),B=r(18);class TransactionManager extends l.default{constructor(e,t,r,h){super(h,B.TransactionFactory,t),a.set(this,new g.default),n.set(this,!1),o.set(this,void 0),s.set(this,void 0),c.set(this,void 0),this.fromFallback=async e=>{const{fallback:t}=u(this,c),r=await t.request("eth_getTransactionByHash",[p.Data.from(e).toString()]);if(null==r)return null;const a=p.Data.from(r.blockHash,32),n=p.Quantity.from(r.blockNumber),o=p.Quantity.from(r.transactionIndex),s=[p.Data.from(r.from,20).toBuffer(),p.Data.from(r.hash,32).toBuffer(),a.toBuffer(),n.toBuffer(),o.toBuffer(),p.Quantity.from(r.gasPrice).toBuffer()];return B.TransactionFactory.fromRpc(r,t.common,s).serializeForDb(a,n,o)},this.resume=()=>{u(this,n)&&(d(this,n,!1),u(this,s).call(this))},d(this,c,r),this.transactionPool=new b.default(e,r)}async getRaw(e){return super.getRaw(e).then((t=>null==t&&u(this,c).fallback?this.fromFallback(e):t))}async get(e){const t=await super.get(e);return t?t.tx:null}async add(e,t){u(this,n)&&await u(this,o);const r=this.transactionPool.prepareTransaction(e,t),s=await u(this,a).add(r);return s&&this.transactionPool.drain(),s}clear(){u(this,a).clear(!1),this.transactionPool.clear()}async pause(){u(this,n)||(d(this,n,!0),d(this,o,new Promise((e=>{d(this,s,e)})))),u(this,a).isBusy()&&await u(this,a).emit("idle")}}t.default=TransactionManager,a=new WeakMap,n=new WeakMap,o=new WeakMap,s=new WeakMap,c=new WeakMap},function(e,t,r){"use strict";var a,n,o,s=this&&this.__decorate||function(e,t,r,a){var n,o=arguments.length,s=o<3?t:null===a?a=Object.getOwnPropertyDescriptor(t,r):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,r,a);else for(var c=e.length-1;c>=0;c--)(n=e[c])&&(s=(o<3?n(s):o>3?n(t,r,s):n(t,r))||s);return o>3&&s&&Object.defineProperty(t,r,s),s},c=this&&this.__classPrivateFieldGet||function(e,t){if(!t.has(e))throw new TypeError("attempted to get private field on non-instance");return t.get(e)},d=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const u=d(r(1155)),h=d(r(1470));let l=class PromiseQueue{constructor(){a.set(this,[]),n.set(this,((e,t)=>{t===e[0]?(e.shift(),t.resolve(t.value),c(this,o).call(this,e)):t.resolved=!0})),o.set(this,(e=>{let t=e[0];for(;t&&t.resolved;)e.shift(),t.resolve(t.value),t=e[0];0===e.length&&this.emit("idle")}))}isBusy(){return 0!==c(this,a).length}add(e){const t=c(this,a),r=new h.default(e,t,c(this,n));return t.push(r),r.promise}clear(e){const t=c(this,a).splice(0);t.forEach((r=>{r.queue=t,r.value=e}))}};a=new WeakMap,n=new WeakMap,o=new WeakMap,l=s([u.default.mixin(Symbol.for("emittery"),["emit","once"])],l),t.default=l},function(e,t,r){"use strict";var a,n=this&&this.__classPrivateFieldSet||function(e,t,r){if(!t.has(e))throw new TypeError("attempted to set private field on non-instance");return t.set(e,r),r},o=this&&this.__classPrivateFieldGet||function(e,t){if(!t.has(e))throw new TypeError("attempted to get private field on non-instance");return t.get(e)},s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const c=s(r(173)),d=r(8),u=r(18),h=r(47);class TransactionReceiptManager extends c.default{constructor(e,t){super(e,u.TransactionReceipt),a.set(this,void 0),n(this,a,t)}async get(e){const t=await super.get(e);if(t)return t;if(o(this,a).fallback){const t=await o(this,a).fallback.request("eth_getTransactionReceipt",["string"==typeof e?e:d.Data.from(e)]);if(!t)return null;const r="0x1"===t.status?d.RPCQUANTITY_ONE.toBuffer():d.BUFFER_ZERO,n=d.Quantity.from(t.cumulativeGasUsed).toBuffer(),s=d.Data.from(t.logsBloom,256).toBuffer(),c=t.logs.map((e=>[h.Address.from(e.address).toBuffer(),e.topics.map((e=>d.Data.from(e).toBuffer())),Array.isArray(e.data)?e.data.map((e=>d.Data.from(e).toBuffer())):d.Data.from(e.data).toBuffer()])),l=d.Quantity.from(t.gasUsed).toBuffer(),b=null==t.contractAddress?d.BUFFER_EMPTY:h.Address.from(t.contractAddress).toBuffer();return u.TransactionReceipt.fromValues(r,n,s,c,l,b)}}}t.default=TransactionReceiptManager,a=new WeakMap},function(e,t,r){"use strict";var a,n,o,s,c,d,u,h,l=this&&this.__classPrivateFieldSet||function(e,t,r){if(!t.has(e))throw new TypeError("attempted to set private field on non-instance");return t.set(e,r),r},b=this&&this.__classPrivateFieldGet||function(e,t){if(!t.has(e))throw new TypeError("attempted to get private field on non-instance");return t.get(e)},g=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.Fork=void 0;const p=r(8),B=g(r(1158)),m=g(r(44)),I=r(152),y=r(692),v=r(14),x=r(88),C=g(r(172)),Q=r(1501);async function fetchChainId(e){const t=await e.request("eth_chainId",[]);return parseInt(t,16)}async function fetchNetworkId(e){const t=await e.request("net_version",[]);return parseInt(t,10)}function fetchBlock(e,t){return e.request("eth_getBlockByNumber",[t,!0])}t.Fork=class Fork{constructor(e,t){a.set(this,new B.default),n.set(this,void 0),o.set(this,void 0),s.set(this,void 0),c.set(this,void 0),d.set(this,(async()=>{const[e,t]=await Promise.all([fetchChainId(this),fetchNetworkId(this)]);this.common=m.default.forCustomChain(p.KNOWN_CHAINIDS.has(e)?e:1,{name:"ganache-fork",defaultHardfork:b(this,c),networkId:t,chainId:e,comment:"Local test network fork"}),this.common.on=()=>{}})),u.set(this,(async()=>{const e=b(this,o);if(e.blockNumber===v.Tag.LATEST){const t=await fetchBlock(this,v.Tag.LATEST);return e.blockNumber=parseInt(t.number,16),this.blockNumber=p.Quantity.from(e.blockNumber),this.stateRoot=p.Data.from(t.stateRoot),await b(this,h).call(this,this.blockNumber),t}if("number"==typeof e.blockNumber){const r=p.Quantity.from(e.blockNumber),[a]=await Promise.all([fetchBlock(this,r).then((async e=>(this.stateRoot=e.stateRoot,await b(this,h).call(this,r),e))),(t=this,t.request("eth_blockNumber",[])).then((t=>{const a=parseInt(t,16);if(e.blockNumber>a)throw new Error(`\`fork.blockNumber\` (${e.blockNumber}) must not be greater than the current block number (${a})`);this.blockNumber=r}))]);return a}throw new Error(`Invalid value for \`fork.blockNumber\` option: "${e.blockNumber}". Must be a positive integer or the string "latest".`);var t})),h.set(this,(e=>Promise.all(b(this,s).map((async t=>{const r=await async function fetchNonce(e,t,r){const a=await e.request("eth_getTransactionCount",[t,r]);return p.Quantity.from(a)}(this,t.address,e);t.nonce=r})))));const r=l(this,o,e.fork);l(this,c,e.chain.hardfork),l(this,s,t);const{url:g}=r;if(g){const{protocol:t}=g;switch(t){case"ws:":case"wss:":l(this,n,new y.WsHandler(e,b(this,a).signal));break;case"http:":case"https:":l(this,n,new I.HttpHandler(e,b(this,a).signal));break;default:throw new Error(`Unsupported protocol: ${t}`)}}else r.provider&&l(this,n,new Q.ProviderHandler(e,b(this,a).signal))}async initialize(){const[e]=await Promise.all([b(this,u).call(this),b(this,d).call(this)]);this.block=new x.Block(C.default.rawFromJSON(e,this.common),this.common)}request(e,t){return b(this,n).request(e,t)}abort(){return b(this,a).abort()}close(){return b(this,n).close()}selectValidForkBlockNumber(e){return e.toBigInt(){"use strict";var a=r(415),n=r(13),o=n("%Function.prototype.apply%"),s=n("%Function.prototype.call%"),c=n("%Reflect.apply%",!0)||a.call(s,o),d=n("%Object.getOwnPropertyDescriptor%",!0),u=n("%Object.defineProperty%",!0),h=n("%Math.max%");if(u)try{u({},"a",{value:1})}catch(e){u=null}e.exports=function callBind(e){var t=c(a,s,arguments);if(d&&u){var r=d(t,"length");r.configurable&&u(t,"length",{value:1+h(0,e.length-(arguments.length-1))})}return t};var l=function applyBind(){return c(a,o,arguments)};u?u(e.exports,"apply",{value:l}):e.exports.apply=l},e=>{"use strict";e.exports=function IsPropertyKey(e){return"string"==typeof e||"symbol"==typeof e}},function(e,t,r){"use strict";var a,n,o,s=r(2).Buffer,c=this&&this.__classPrivateFieldSet||function(e,t,r){if(!t.has(e))throw new TypeError("attempted to set private field on non-instance");return t.set(e,r),r},d=this&&this.__classPrivateFieldGet||function(e,t){if(!t.has(e))throw new TypeError("attempted to get private field on non-instance");return t.get(e)},u=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const h=u(r(1514)),l=u(r(1515)),noop=()=>{};function prepareCORSResponseHeaders(e,t){const r=t.getHeader("origin"),a=t.getHeader("access-control-request-headers");return t=>{""!==r&&("OPTIONS"===e&&(t.writeHeader("Access-Control-Allow-Methods","POST"),""!==a&&t.writeHeader("Access-Control-Allow-Headers",a),t.writeHeader("Access-Control-Max-Age","600")),t.writeHeader("Access-Control-Allow-Credentials","true"),t.writeHeader("Access-Control-Allow-Origin",r))}}function sendResponse(e,t,r,a,n=noop){e.cork((()=>{e.writeStatus(t),n(e),r&&e.writeHeader("Content-Type",r),e.end(a)}))}t.default=class HttpServer{constructor(e,t,r){a.set(this,void 0),n.set(this,((e,t)=>{const r=prepareCORSResponseHeaders("POST",t);let n,o=!1;e.onAborted((()=>{o=!0})),e.onData(((c,u)=>{const b=s.from(c);if(u){const c=d(this,a);let u;try{const e=n?s.concat([n,b],n.length+b.length):b;u=c.parse(e)}catch(t){return void sendResponse(e,l.default.BAD_REQUEST,h.default.PLAIN,"400 Bad Request: "+t.message,r)}c.handle(u,t).then((({value:e})=>e)).then((t=>{if(o)return;const a=c.format(t,u);sendResponse(e,l.default.OK,h.default.JSON,a,r)})).catch((t=>{if(o)return;const a=c.formatError(t,u);sendResponse(e,l.default.OK,h.default.JSON,a,r)}))}else n=n?s.concat([n,b],n.length+b.length):s.concat([b],b.length)}))})),o.set(this,((e,t)=>{const r=prepareCORSResponseHeaders("OPTIONS",t);sendResponse(e,l.default.NO_CONTENT,void 0,"",r)})),c(this,a,t),e.post(r.rpcEndpoint,d(this,n)).options(r.rpcEndpoint,d(this,o)),e.get("/418",(e=>{sendResponse(e,l.default.IM_A_TEAPOT,h.default.PLAIN,"418 I'm a teapot")})),e.any("/*",((e,t)=>{const r=t.getHeader("connection");r&&"upgrade"===r.toLowerCase()?sendResponse(e,l.default.BAD_REQUEST,h.default.PLAIN,"400 Bad Request"):sendResponse(e,l.default.NOT_FOUND,h.default.PLAIN,"404 Not Found")}))}close(){}},a=new WeakMap,n=new WeakMap,o=new WeakMap},e=>{"use strict";var t={};function createErrorType(e,r,a){a||(a=Error);var n=function(e){function NodeError(t,a,n){return e.call(this,function getMessage(e,t,a){return"string"==typeof r?r:r(e,t,a)}(t,a,n))||this}return function _inheritsLoose(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}(NodeError,e),NodeError}(a);n.prototype.name=a.name,n.prototype.code=e,t[e]=n}function oneOf(e,t){if(Array.isArray(e)){var r=e.length;return e=e.map((function(e){return String(e)})),r>2?"one of ".concat(t," ").concat(e.slice(0,r-1).join(", "),", or ")+e[r-1]:2===r?"one of ".concat(t," ").concat(e[0]," or ").concat(e[1]):"of ".concat(t," ").concat(e[0])}return"of ".concat(t," ").concat(String(e))}createErrorType("ERR_INVALID_OPT_VALUE",(function(e,t){return'The value "'+t+'" is invalid for option "'+e+'"'}),TypeError),createErrorType("ERR_INVALID_ARG_TYPE",(function(e,t,r){var a,n;if("string"==typeof t&&function startsWith(e,t,r){return e.substr(!r||r<0?0:+r,t.length)===t}(t,"not ")?(a="must not be",t=t.replace(/^not /,"")):a="must be",function endsWith(e,t,r){return(void 0===r||r>e.length)&&(r=e.length),e.substring(r-t.length,r)===t}(e," argument"))n="The ".concat(e," ").concat(a," ").concat(oneOf(t,"type"));else{var o=function includes(e,t,r){return"number"!=typeof r&&(r=0),!(r+t.length>e.length)&&-1!==e.indexOf(t,r)}(e,".")?"property":"argument";n='The "'.concat(e,'" ').concat(o," ").concat(a," ").concat(oneOf(t,"type"))}return n+=". Received type ".concat(typeof r)}),TypeError),createErrorType("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),createErrorType("ERR_METHOD_NOT_IMPLEMENTED",(function(e){return"The "+e+" method is not implemented"})),createErrorType("ERR_STREAM_PREMATURE_CLOSE","Premature close"),createErrorType("ERR_STREAM_DESTROYED",(function(e){return"Cannot call "+e+" after a stream was destroyed"})),createErrorType("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),createErrorType("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),createErrorType("ERR_STREAM_WRITE_AFTER_END","write after end"),createErrorType("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),createErrorType("ERR_UNKNOWN_ENCODING",(function(e){return"Unknown encoding: "+e}),TypeError),createErrorType("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),e.exports.a=t},(e,t,r)=>{var a=r(2).Buffer;e.exports=function xor(e,t){for(var r=Math.min(e.length,t.length),n=new a(r),o=0;o{"use strict";var a=r(10),n=r(320),o=r(321),s=r(322),c=r(123);function Hash(e){c.call(this,"digest"),this._hash=e}a(Hash,c),Hash.prototype._update=function(e){this._hash.update(e)},Hash.prototype._final=function(){return this._hash.digest()},e.exports=function createHash(e){return"md5"===(e=e.toLowerCase())?new n:"rmd160"===e||"ripemd160"===e?new o:new Hash(s(e))}},function(e,t,r){"use strict";var a=this&&this.__createBinding||(Object.create?function(e,t,r,a){void 0===a&&(a=r),Object.defineProperty(e,a,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,a){void 0===a&&(a=r),e[a]=t[r]}),n=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||a(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),n(r(177),t)},e=>{"use strict";var t={};function createErrorType(e,r,a){a||(a=Error);var n=function(e){function NodeError(t,a,n){return e.call(this,function getMessage(e,t,a){return"string"==typeof r?r:r(e,t,a)}(t,a,n))||this}return function _inheritsLoose(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}(NodeError,e),NodeError}(a);n.prototype.name=a.name,n.prototype.code=e,t[e]=n}function oneOf(e,t){if(Array.isArray(e)){var r=e.length;return e=e.map((function(e){return String(e)})),r>2?"one of ".concat(t," ").concat(e.slice(0,r-1).join(", "),", or ")+e[r-1]:2===r?"one of ".concat(t," ").concat(e[0]," or ").concat(e[1]):"of ".concat(t," ").concat(e[0])}return"of ".concat(t," ").concat(String(e))}createErrorType("ERR_INVALID_OPT_VALUE",(function(e,t){return'The value "'+t+'" is invalid for option "'+e+'"'}),TypeError),createErrorType("ERR_INVALID_ARG_TYPE",(function(e,t,r){var a,n;if("string"==typeof t&&function startsWith(e,t,r){return e.substr(!r||r<0?0:+r,t.length)===t}(t,"not ")?(a="must not be",t=t.replace(/^not /,"")):a="must be",function endsWith(e,t,r){return(void 0===r||r>e.length)&&(r=e.length),e.substring(r-t.length,r)===t}(e," argument"))n="The ".concat(e," ").concat(a," ").concat(oneOf(t,"type"));else{var o=function includes(e,t,r){return"number"!=typeof r&&(r=0),!(r+t.length>e.length)&&-1!==e.indexOf(t,r)}(e,".")?"property":"argument";n='The "'.concat(e,'" ').concat(o," ").concat(a," ").concat(oneOf(t,"type"))}return n+=". Received type ".concat(typeof r)}),TypeError),createErrorType("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),createErrorType("ERR_METHOD_NOT_IMPLEMENTED",(function(e){return"The "+e+" method is not implemented"})),createErrorType("ERR_STREAM_PREMATURE_CLOSE","Premature close"),createErrorType("ERR_STREAM_DESTROYED",(function(e){return"Cannot call "+e+" after a stream was destroyed"})),createErrorType("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),createErrorType("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),createErrorType("ERR_STREAM_WRITE_AFTER_END","write after end"),createErrorType("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),createErrorType("ERR_UNKNOWN_ENCODING",(function(e){return"Unknown encoding: "+e}),TypeError),createErrorType("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),e.exports.a=t},function(e,t,r){"use strict";var a=r(3).Buffer,n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.toType=t.TypeOutput=t.bnToRlp=t.bnToUnpaddedBuffer=t.bnToHex=void 0;var o,s=n(r(127)),c=r(87),d=r(71);function bnToUnpaddedBuffer(e){return d.unpadBuffer(e.toArrayLike(a))}t.bnToHex=function bnToHex(e){return"0x"+e.toString(16)},t.bnToUnpaddedBuffer=bnToUnpaddedBuffer,t.bnToRlp=function bnToRlp(e){return bnToUnpaddedBuffer(e)},function(e){e[e.Number=0]="Number",e[e.BN=1]="BN",e[e.Buffer=2]="Buffer",e[e.PrefixedHexString=3]="PrefixedHexString"}(o=t.TypeOutput||(t.TypeOutput={})),t.toType=function toType(e,t){if("string"==typeof e&&!c.isHexString(e))throw new Error("A string must be provided with a 0x-prefix, given: "+e);if("number"==typeof e&&!Number.isSafeInteger(e))throw new Error("The provided number is greater than MAX_SAFE_INTEGER (please use an alternative input type)");if(e=d.toBuffer(e),t===o.Buffer)return e;if(t===o.BN)return new s.default(e);if(t===o.Number){var r=new s.default(e),a=new s.default(Number.MAX_SAFE_INTEGER.toString());if(r.gt(a))throw new Error("The provided number is greater than MAX_SAFE_INTEGER (please use an alternative output type)");return r.toNumber()}return"0x"+e.toString("hex")}},e=>{"use strict";var t={};function createErrorType(e,r,a){a||(a=Error);var n=function(e){function NodeError(t,a,n){return e.call(this,function getMessage(e,t,a){return"string"==typeof r?r:r(e,t,a)}(t,a,n))||this}return function _inheritsLoose(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}(NodeError,e),NodeError}(a);n.prototype.name=a.name,n.prototype.code=e,t[e]=n}function oneOf(e,t){if(Array.isArray(e)){var r=e.length;return e=e.map((function(e){return String(e)})),r>2?"one of ".concat(t," ").concat(e.slice(0,r-1).join(", "),", or ")+e[r-1]:2===r?"one of ".concat(t," ").concat(e[0]," or ").concat(e[1]):"of ".concat(t," ").concat(e[0])}return"of ".concat(t," ").concat(String(e))}createErrorType("ERR_INVALID_OPT_VALUE",(function(e,t){return'The value "'+t+'" is invalid for option "'+e+'"'}),TypeError),createErrorType("ERR_INVALID_ARG_TYPE",(function(e,t,r){var a,n;if("string"==typeof t&&function startsWith(e,t,r){return e.substr(!r||r<0?0:+r,t.length)===t}(t,"not ")?(a="must not be",t=t.replace(/^not /,"")):a="must be",function endsWith(e,t,r){return(void 0===r||r>e.length)&&(r=e.length),e.substring(r-t.length,r)===t}(e," argument"))n="The ".concat(e," ").concat(a," ").concat(oneOf(t,"type"));else{var o=function includes(e,t,r){return"number"!=typeof r&&(r=0),!(r+t.length>e.length)&&-1!==e.indexOf(t,r)}(e,".")?"property":"argument";n='The "'.concat(e,'" ').concat(o," ").concat(a," ").concat(oneOf(t,"type"))}return n+=". Received type ".concat(typeof r)}),TypeError),createErrorType("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),createErrorType("ERR_METHOD_NOT_IMPLEMENTED",(function(e){return"The "+e+" method is not implemented"})),createErrorType("ERR_STREAM_PREMATURE_CLOSE","Premature close"),createErrorType("ERR_STREAM_DESTROYED",(function(e){return"Cannot call "+e+" after a stream was destroyed"})),createErrorType("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),createErrorType("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),createErrorType("ERR_STREAM_WRITE_AFTER_END","write after end"),createErrorType("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),createErrorType("ERR_UNKNOWN_ENCODING",(function(e){return"Unknown encoding: "+e}),TypeError),createErrorType("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),e.exports.a=t},function(e,t,r){"use strict";var a=r(4).Buffer,n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.toType=t.TypeOutput=t.bnToRlp=t.bnToUnpaddedBuffer=t.bnToHex=void 0;var o,s=n(r(130)),c=r(186),d=r(73);function bnToUnpaddedBuffer(e){return d.unpadBuffer(e.toArrayLike(a))}t.bnToHex=function bnToHex(e){return"0x"+e.toString(16)},t.bnToUnpaddedBuffer=bnToUnpaddedBuffer,t.bnToRlp=function bnToRlp(e){return bnToUnpaddedBuffer(e)},function(e){e[e.Number=0]="Number",e[e.BN=1]="BN",e[e.Buffer=2]="Buffer",e[e.PrefixedHexString=3]="PrefixedHexString"}(o=t.TypeOutput||(t.TypeOutput={})),t.toType=function toType(e,t){if("string"==typeof e&&!c.isHexString(e))throw new Error("A string must be provided with a 0x-prefix, given: "+e);if("number"==typeof e&&!Number.isSafeInteger(e))throw new Error("The provided number is greater than MAX_SAFE_INTEGER (please use an alternative input type)");if(e=d.toBuffer(e),t===o.Buffer)return e;if(t===o.BN)return new s.default(e);if(t===o.Number){var r=new s.default(e),a=new s.default(Number.MAX_SAFE_INTEGER.toString());if(r.gt(a))throw new Error("The provided number is greater than MAX_SAFE_INTEGER (please use an alternative output type)");return r.toNumber()}return"0x"+e.toString("hex")}},function(e,t,r){"use strict";var a,n,o=r(4).Buffer,s=this&&this.__classPrivateFieldGet||function(e,t){if(!t.has(e))throw new TypeError("attempted to get private field on non-instance");return t.get(e)},c=this&&this.__classPrivateFieldSet||function(e,t,r){if(!t.has(e))throw new TypeError("attempted to set private field on non-instance");return t.set(e,r),r};Object.defineProperty(t,"__esModule",{value:!0}),t.TransactionReceipt=void 0;const d=r(14),u=r(46),h=r(8),l=r(8),b=[l.RPCQUANTITY_ZERO,l.RPCQUANTITY_ONE];class TransactionReceipt{constructor(e){if(a.set(this,void 0),n.set(this,((e,t,r,n,o,s=null,d=null)=>{this.raw=[e,t,r,n],this.contractAddress=s,c(this,a,o),this.txType=d})),e){const t=u.decode(e);s(this,n).call(this,t[0],t[1],t[2],t[3],t[4],t[5])}}static fromValues(e,t,r,a,o,c,d=null){const u=new TransactionReceipt;return s(u,n).call(u,e,t,r,a,o,c,d),u}serialize(e){if(null==this.encoded&&(this.encoded=u.encodeRange(this.raw,0,4)),e){const e=[s(this,a),this.contractAddress],t=u.encodeRange(e,0,2);return u.digest([this.encoded.output,t.output],this.encoded.length+t.length)}{const e=u.digest([this.encoded.output],this.encoded.length);return this.txType?o.concat([this.txType.toBuffer(),e]):e}}toJSON(e,t,r){const n=this.raw,o=0===this.contractAddress.length?null:h.Data.from(this.contractAddress),c=e.hash(),u=e.header.number,l=d.BlockLogs.create(c),g=t.hash,p=t.index;l.blockNumber=u,n[3].forEach((e=>l.append(p,g,e)));const B=[...l.toJSON()];e.header.baseFeePerGas&&t.updateEffectiveGasPrice(e.header.baseFeePerGas);const m={transactionHash:g,transactionIndex:p,blockNumber:u,blockHash:c,from:t.from,to:o?null:t.to,cumulativeGasUsed:h.Quantity.from(n[1]),gasUsed:h.Quantity.from(s(this,a)),contractAddress:o,logs:B,logsBloom:h.Data.from(n[2],256),status:b[n[0][0]],effectiveGasPrice:t.effectiveGasPrice};return t.type&&r.isActivatedEIP(2718)&&(m.type=t.type),m}}t.TransactionReceipt=TransactionReceipt,a=new WeakMap,n=new WeakMap},(e,t,r)=>{"use strict";var a=r(1);function assertPath(e){if("string"!=typeof e)throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}function normalizeStringPosix(e,t){for(var r,a="",n=0,o=-1,s=0,c=0;c<=e.length;++c){if(c2){var d=a.lastIndexOf("/");if(d!==a.length-1){-1===d?(a="",n=0):n=(a=a.slice(0,d)).length-1-a.lastIndexOf("/"),o=c,s=0;continue}}else if(2===a.length||1===a.length){a="",n=0,o=c,s=0;continue}t&&(a.length>0?a+="/..":a="..",n=2)}else a.length>0?a+="/"+e.slice(o+1,c):a=e.slice(o+1,c),n=c-o-1;o=c,s=0}else 46===r&&-1!==s?++s:s=-1}return a}var n={resolve:function resolve(){for(var e,t="",r=!1,n=arguments.length-1;n>=-1&&!r;n--){var o;n>=0?o=arguments[n]:(void 0===e&&(e=a.cwd()),o=e),assertPath(o),0!==o.length&&(t=o+"/"+t,r=47===o.charCodeAt(0))}return t=normalizeStringPosix(t,!r),r?t.length>0?"/"+t:"/":t.length>0?t:"."},normalize:function normalize(e){if(assertPath(e),0===e.length)return".";var t=47===e.charCodeAt(0),r=47===e.charCodeAt(e.length-1);return 0!==(e=normalizeStringPosix(e,!t)).length||t||(e="."),e.length>0&&r&&(e+="/"),t?"/"+e:e},isAbsolute:function isAbsolute(e){return assertPath(e),e.length>0&&47===e.charCodeAt(0)},join:function join(){if(0===arguments.length)return".";for(var e,t=0;t0&&(void 0===e?e=r:e+="/"+r)}return void 0===e?".":n.normalize(e)},relative:function relative(e,t){if(assertPath(e),assertPath(t),e===t)return"";if((e=n.resolve(e))===(t=n.resolve(t)))return"";for(var r=1;rd){if(47===t.charCodeAt(s+h))return t.slice(s+h+1);if(0===h)return t.slice(s+h)}else o>d&&(47===e.charCodeAt(r+h)?u=h:0===h&&(u=0));break}var l=e.charCodeAt(r+h);if(l!==t.charCodeAt(s+h))break;47===l&&(u=h)}var b="";for(h=r+u+1;h<=a;++h)h!==a&&47!==e.charCodeAt(h)||(0===b.length?b+="..":b+="/..");return b.length>0?b+t.slice(s+u):(s+=u,47===t.charCodeAt(s)&&++s,t.slice(s))},_makeLong:function _makeLong(e){return e},dirname:function dirname(e){if(assertPath(e),0===e.length)return".";for(var t=e.charCodeAt(0),r=47===t,a=-1,n=!0,o=e.length-1;o>=1;--o)if(47===(t=e.charCodeAt(o))){if(!n){a=o;break}}else n=!1;return-1===a?r?"/":".":r&&1===a?"//":e.slice(0,a)},basename:function basename(e,t){if(void 0!==t&&"string"!=typeof t)throw new TypeError('"ext" argument must be a string');assertPath(e);var r,a=0,n=-1,o=!0;if(void 0!==t&&t.length>0&&t.length<=e.length){if(t.length===e.length&&t===e)return"";var s=t.length-1,c=-1;for(r=e.length-1;r>=0;--r){var d=e.charCodeAt(r);if(47===d){if(!o){a=r+1;break}}else-1===c&&(o=!1,c=r+1),s>=0&&(d===t.charCodeAt(s)?-1==--s&&(n=r):(s=-1,n=c))}return a===n?n=c:-1===n&&(n=e.length),e.slice(a,n)}for(r=e.length-1;r>=0;--r)if(47===e.charCodeAt(r)){if(!o){a=r+1;break}}else-1===n&&(o=!1,n=r+1);return-1===n?"":e.slice(a,n)},extname:function extname(e){assertPath(e);for(var t=-1,r=0,a=-1,n=!0,o=0,s=e.length-1;s>=0;--s){var c=e.charCodeAt(s);if(47!==c)-1===a&&(n=!1,a=s+1),46===c?-1===t?t=s:1!==o&&(o=1):-1!==t&&(o=-1);else if(!n){r=s+1;break}}return-1===t||-1===a||0===o||1===o&&t===a-1&&t===r+1?"":e.slice(t,a)},format:function format(e){if(null===e||"object"!=typeof e)throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof e);return function _format(e,t){var r=t.dir||t.root,a=t.base||(t.name||"")+(t.ext||"");return r?r===t.root?r+a:r+e+a:a}("/",e)},parse:function parse(e){assertPath(e);var t={root:"",dir:"",base:"",ext:"",name:""};if(0===e.length)return t;var r,a=e.charCodeAt(0),n=47===a;n?(t.root="/",r=1):r=0;for(var o=-1,s=0,c=-1,d=!0,u=e.length-1,h=0;u>=r;--u)if(47!==(a=e.charCodeAt(u)))-1===c&&(d=!1,c=u+1),46===a?-1===o?o=u:1!==h&&(h=1):-1!==o&&(h=-1);else if(!d){s=u+1;break}return-1===o||-1===c||0===h||1===h&&o===c-1&&o===s+1?-1!==c&&(t.base=t.name=0===s&&n?e.slice(1,c):e.slice(s,c)):(0===s&&n?(t.name=e.slice(1,o),t.base=e.slice(1,c)):(t.name=e.slice(s,o),t.base=e.slice(s,c)),t.ext=e.slice(o,c)),s>0?t.dir=e.slice(0,s-1):n&&(t.dir="/"),t},sep:"/",delimiter:":",win32:null,posix:null};n.posix=n,e.exports=n},e=>{"function"==typeof Object.create?e.exports=function inherits(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:e.exports=function inherits(e,t){if(t){e.super_=t;var TempCtor=function(){};TempCtor.prototype=t.prototype,e.prototype=new TempCtor,e.prototype.constructor=e}}},e=>{"use strict";var t={};function createErrorType(e,r,a){a||(a=Error);var n=function(e){function NodeError(t,a,n){return e.call(this,function getMessage(e,t,a){return"string"==typeof r?r:r(e,t,a)}(t,a,n))||this}return function _inheritsLoose(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}(NodeError,e),NodeError}(a);n.prototype.name=a.name,n.prototype.code=e,t[e]=n}function oneOf(e,t){if(Array.isArray(e)){var r=e.length;return e=e.map((function(e){return String(e)})),r>2?"one of ".concat(t," ").concat(e.slice(0,r-1).join(", "),", or ")+e[r-1]:2===r?"one of ".concat(t," ").concat(e[0]," or ").concat(e[1]):"of ".concat(t," ").concat(e[0])}return"of ".concat(t," ").concat(String(e))}createErrorType("ERR_INVALID_OPT_VALUE",(function(e,t){return'The value "'+t+'" is invalid for option "'+e+'"'}),TypeError),createErrorType("ERR_INVALID_ARG_TYPE",(function(e,t,r){var a,n;if("string"==typeof t&&function startsWith(e,t,r){return e.substr(!r||r<0?0:+r,t.length)===t}(t,"not ")?(a="must not be",t=t.replace(/^not /,"")):a="must be",function endsWith(e,t,r){return(void 0===r||r>e.length)&&(r=e.length),e.substring(r-t.length,r)===t}(e," argument"))n="The ".concat(e," ").concat(a," ").concat(oneOf(t,"type"));else{var o=function includes(e,t,r){return"number"!=typeof r&&(r=0),!(r+t.length>e.length)&&-1!==e.indexOf(t,r)}(e,".")?"property":"argument";n='The "'.concat(e,'" ').concat(o," ").concat(a," ").concat(oneOf(t,"type"))}return n+=". Received type ".concat(typeof r)}),TypeError),createErrorType("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),createErrorType("ERR_METHOD_NOT_IMPLEMENTED",(function(e){return"The "+e+" method is not implemented"})),createErrorType("ERR_STREAM_PREMATURE_CLOSE","Premature close"),createErrorType("ERR_STREAM_DESTROYED",(function(e){return"Cannot call "+e+" after a stream was destroyed"})),createErrorType("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),createErrorType("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),createErrorType("ERR_STREAM_WRITE_AFTER_END","write after end"),createErrorType("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),createErrorType("ERR_UNKNOWN_ENCODING",(function(e){return"Unknown encoding: "+e}),TypeError),createErrorType("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),e.exports.a=t},function(e,t,r){"use strict";var a=r(2).Buffer,n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.toType=t.TypeOutput=t.bnToRlp=t.bnToUnpaddedBuffer=t.bnToHex=void 0;var o,s=n(r(134)),c=r(195),d=r(76);function bnToUnpaddedBuffer(e){return d.unpadBuffer(e.toArrayLike(a))}t.bnToHex=function bnToHex(e){return"0x"+e.toString(16)},t.bnToUnpaddedBuffer=bnToUnpaddedBuffer,t.bnToRlp=function bnToRlp(e){return bnToUnpaddedBuffer(e)},function(e){e[e.Number=0]="Number",e[e.BN=1]="BN",e[e.Buffer=2]="Buffer",e[e.PrefixedHexString=3]="PrefixedHexString"}(o=t.TypeOutput||(t.TypeOutput={})),t.toType=function toType(e,t){if("string"==typeof e&&!c.isHexString(e))throw new Error("A string must be provided with a 0x-prefix, given: "+e);if("number"==typeof e&&!Number.isSafeInteger(e))throw new Error("The provided number is greater than MAX_SAFE_INTEGER (please use an alternative input type)");if(e=d.toBuffer(e),t===o.Buffer)return e;if(t===o.BN)return new s.default(e);if(t===o.Number){var r=new s.default(e),a=new s.default(Number.MAX_SAFE_INTEGER.toString());if(r.gt(a))throw new Error("The provided number is greater than MAX_SAFE_INTEGER (please use an alternative output type)");return r.toNumber()}return"0x"+e.toString("hex")}},(e,t,r)=>{(t=e.exports=r(557)).Stream=t,t.Readable=t,t.Writable=r(560),t.Duplex=r(200),t.Transform=r(562),t.PassThrough=r(986),t.finished=r(368),t.pipeline=r(987)},e=>{"use strict";var t={};function createErrorType(e,r,a){a||(a=Error);var n=function(e){function NodeError(t,a,n){return e.call(this,function getMessage(e,t,a){return"string"==typeof r?r:r(e,t,a)}(t,a,n))||this}return function _inheritsLoose(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}(NodeError,e),NodeError}(a);n.prototype.name=a.name,n.prototype.code=e,t[e]=n}function oneOf(e,t){if(Array.isArray(e)){var r=e.length;return e=e.map((function(e){return String(e)})),r>2?"one of ".concat(t," ").concat(e.slice(0,r-1).join(", "),", or ")+e[r-1]:2===r?"one of ".concat(t," ").concat(e[0]," or ").concat(e[1]):"of ".concat(t," ").concat(e[0])}return"of ".concat(t," ").concat(String(e))}createErrorType("ERR_INVALID_OPT_VALUE",(function(e,t){return'The value "'+t+'" is invalid for option "'+e+'"'}),TypeError),createErrorType("ERR_INVALID_ARG_TYPE",(function(e,t,r){var a,n;if("string"==typeof t&&function startsWith(e,t,r){return e.substr(!r||r<0?0:+r,t.length)===t}(t,"not ")?(a="must not be",t=t.replace(/^not /,"")):a="must be",function endsWith(e,t,r){return(void 0===r||r>e.length)&&(r=e.length),e.substring(r-t.length,r)===t}(e," argument"))n="The ".concat(e," ").concat(a," ").concat(oneOf(t,"type"));else{var o=function includes(e,t,r){return"number"!=typeof r&&(r=0),!(r+t.length>e.length)&&-1!==e.indexOf(t,r)}(e,".")?"property":"argument";n='The "'.concat(e,'" ').concat(o," ").concat(a," ").concat(oneOf(t,"type"))}return n+=". Received type ".concat(typeof r)}),TypeError),createErrorType("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),createErrorType("ERR_METHOD_NOT_IMPLEMENTED",(function(e){return"The "+e+" method is not implemented"})),createErrorType("ERR_STREAM_PREMATURE_CLOSE","Premature close"),createErrorType("ERR_STREAM_DESTROYED",(function(e){return"Cannot call "+e+" after a stream was destroyed"})),createErrorType("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),createErrorType("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),createErrorType("ERR_STREAM_WRITE_AFTER_END","write after end"),createErrorType("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),createErrorType("ERR_UNKNOWN_ENCODING",(function(e){return"Unknown encoding: "+e}),TypeError),createErrorType("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),e.exports.a=t},function(e,t,r){"use strict";var a=r(0).Buffer,n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.toType=t.TypeOutput=t.bnToRlp=t.bnToUnpaddedBuffer=t.bnToHex=void 0;var o,s=n(r(48)),c=r(62),d=r(78);function bnToUnpaddedBuffer(e){return d.unpadBuffer(e.toArrayLike(a))}t.bnToHex=function bnToHex(e){return"0x"+e.toString(16)},t.bnToUnpaddedBuffer=bnToUnpaddedBuffer,t.bnToRlp=function bnToRlp(e){return bnToUnpaddedBuffer(e)},function(e){e[e.Number=0]="Number",e[e.BN=1]="BN",e[e.Buffer=2]="Buffer",e[e.PrefixedHexString=3]="PrefixedHexString"}(o=t.TypeOutput||(t.TypeOutput={})),t.toType=function toType(e,t){if("string"==typeof e&&!c.isHexString(e))throw new Error("A string must be provided with a 0x-prefix, given: "+e);if("number"==typeof e&&!Number.isSafeInteger(e))throw new Error("The provided number is greater than MAX_SAFE_INTEGER (please use an alternative input type)");if(e=d.toBuffer(e),t===o.Buffer)return e;if(t===o.BN)return new s.default(e);if(t===o.Number){var r=new s.default(e),a=new s.default(Number.MAX_SAFE_INTEGER.toString());if(r.gt(a))throw new Error("The provided number is greater than MAX_SAFE_INTEGER (please use an alternative output type)");return r.toNumber()}return"0x"+e.toString("hex")}},function(e,t){"use strict";var r=this&&this.__awaiter||function(e,t,r,a){return new(r||(r=Promise))((function(n,o){function fulfilled(e){try{step(a.next(e))}catch(e){o(e)}}function rejected(e){try{step(a.throw(e))}catch(e){o(e)}}function step(e){e.done?n(e.value):new r((function(t){t(e.value)})).then(fulfilled,rejected)}step((a=a.apply(e,t||[])).next())}))},a=this&&this.__generator||function(e,t){var r,a,n,o={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return{next:verb(0),throw:verb(1),return:verb(2)};function verb(s){return function(c){return function step(s){if(r)throw new TypeError("Generator is already executing.");for(;o;)try{if(r=1,a&&(n=a[2&s[0]?"return":s[0]?"throw":"next"])&&!(n=n.call(a,s[1])).done)return n;switch(a=0,n&&(s=[0,n.value]),s[0]){case 0:case 1:n=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,a=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!(n=o.trys,(n=n.length>0&&n[n.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!n||s[1]>n[0]&&s[1]0?(this.permits-=1,[2,Promise.resolve(!0)]):[2,new Promise((function(t){return e.promiseResolverQueue.push(t)}))]}))}))},Semaphore.prototype.acquire=function(){return r(this,void 0,void 0,(function(){return a(this,(function(e){return[2,this.wait()]}))}))},Semaphore.prototype.waitFor=function(e){return r(this,void 0,void 0,(function(){var t,r,n=this;return a(this,(function(a){return this.permits>0?(this.permits-=1,[2,Promise.resolve(!0)]):(t=function(e){},r=new Promise((function(e){t=e})),this.promiseResolverQueue.push(t),setTimeout((function(){var e=n.promiseResolverQueue.indexOf(t);-1!==e&&n.promiseResolverQueue.splice(e,1),t(!1)}),e),[2,r])}))}))},Semaphore.prototype.tryAcquire=function(){return this.permits>0&&(this.permits-=1,!0)},Semaphore.prototype.drainPermits=function(){if(this.permits>0){var e=this.permits;return this.permits=0,e}return 0},Semaphore.prototype.signal=function(){if(this.permits+=1,this.permits>1&&this.promiseResolverQueue.length>0)throw new Error("this.permits should never be > 0 when there is someone waiting.");if(1===this.permits&&this.promiseResolverQueue.length>0){this.permits-=1;var e=this.promiseResolverQueue.shift();e&&e(!0)}},Semaphore.prototype.release=function(){this.signal()},Semaphore.prototype.execute=function(e){return r(this,void 0,void 0,(function(){return a(this,(function(t){switch(t.label){case 0:return[4,this.wait()];case 1:t.sent(),t.label=2;case 2:return t.trys.push([2,,4,5]),[4,e()];case 3:return[2,t.sent()];case 4:return this.signal(),[7];case 5:return[2]}}))}))},Semaphore}();t.default=n},function(e,t,r){"use strict";var a=r(0).Buffer,n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.toType=t.TypeOutput=t.bnToRlp=t.bnToUnpaddedBuffer=t.bnToHex=void 0;var o,s=n(r(48)),c=r(62),d=r(79);function bnToUnpaddedBuffer(e){return d.unpadBuffer(e.toArrayLike(a))}t.bnToHex=function bnToHex(e){return"0x"+e.toString(16)},t.bnToUnpaddedBuffer=bnToUnpaddedBuffer,t.bnToRlp=function bnToRlp(e){return bnToUnpaddedBuffer(e)},function(e){e[e.Number=0]="Number",e[e.BN=1]="BN",e[e.Buffer=2]="Buffer",e[e.PrefixedHexString=3]="PrefixedHexString"}(o=t.TypeOutput||(t.TypeOutput={})),t.toType=function toType(e,t){if("string"==typeof e&&!c.isHexString(e))throw new Error("A string must be provided with a 0x-prefix, given: "+e);if("number"==typeof e&&!Number.isSafeInteger(e))throw new Error("The provided number is greater than MAX_SAFE_INTEGER (please use an alternative input type)");if(e=d.toBuffer(e),t===o.Buffer)return e;if(t===o.BN)return new s.default(e);if(t===o.Number){var r=new s.default(e),a=new s.default(Number.MAX_SAFE_INTEGER.toString());if(r.gt(a))throw new Error("The provided number is greater than MAX_SAFE_INTEGER (please use an alternative output type)");return r.toNumber()}return"0x"+e.toString("hex")}},e=>{"use strict";var t={};function createErrorType(e,r,a){a||(a=Error);var n=function(e){function NodeError(t,a,n){return e.call(this,function getMessage(e,t,a){return"string"==typeof r?r:r(e,t,a)}(t,a,n))||this}return function _inheritsLoose(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}(NodeError,e),NodeError}(a);n.prototype.name=a.name,n.prototype.code=e,t[e]=n}function oneOf(e,t){if(Array.isArray(e)){var r=e.length;return e=e.map((function(e){return String(e)})),r>2?"one of ".concat(t," ").concat(e.slice(0,r-1).join(", "),", or ")+e[r-1]:2===r?"one of ".concat(t," ").concat(e[0]," or ").concat(e[1]):"of ".concat(t," ").concat(e[0])}return"of ".concat(t," ").concat(String(e))}createErrorType("ERR_INVALID_OPT_VALUE",(function(e,t){return'The value "'+t+'" is invalid for option "'+e+'"'}),TypeError),createErrorType("ERR_INVALID_ARG_TYPE",(function(e,t,r){var a,n;if("string"==typeof t&&function startsWith(e,t,r){return e.substr(!r||r<0?0:+r,t.length)===t}(t,"not ")?(a="must not be",t=t.replace(/^not /,"")):a="must be",function endsWith(e,t,r){return(void 0===r||r>e.length)&&(r=e.length),e.substring(r-t.length,r)===t}(e," argument"))n="The ".concat(e," ").concat(a," ").concat(oneOf(t,"type"));else{var o=function includes(e,t,r){return"number"!=typeof r&&(r=0),!(r+t.length>e.length)&&-1!==e.indexOf(t,r)}(e,".")?"property":"argument";n='The "'.concat(e,'" ').concat(o," ").concat(a," ").concat(oneOf(t,"type"))}return n+=". Received type ".concat(typeof r)}),TypeError),createErrorType("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),createErrorType("ERR_METHOD_NOT_IMPLEMENTED",(function(e){return"The "+e+" method is not implemented"})),createErrorType("ERR_STREAM_PREMATURE_CLOSE","Premature close"),createErrorType("ERR_STREAM_DESTROYED",(function(e){return"Cannot call "+e+" after a stream was destroyed"})),createErrorType("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),createErrorType("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),createErrorType("ERR_STREAM_WRITE_AFTER_END","write after end"),createErrorType("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),createErrorType("ERR_UNKNOWN_ENCODING",(function(e){return"Unknown encoding: "+e}),TypeError),createErrorType("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),e.exports.a=t},(e,t,r)=>{var a=r(630),n=r(389);e.exports=function(e){return a(n(e))}},e=>{e.exports={}},function(e,t,r){"use strict";var a,n,o=r(0).Buffer,s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.getActivePrecompiles=t.ripemdPrecompileAddress=t.getPrecompile=t.precompiles=void 0;var c,d=r(5),u=s(r(1454)),h=s(r(1458)),l=s(r(1459)),b=s(r(1460)),g=s(r(1461)),p=s(r(1462)),B=s(r(1463)),m=s(r(1464)),I=s(r(1465)),y=s(r(294)),v=s(r(295)),x=s(r(296)),C=s(r(297)),Q=s(r(298)),w=s(r(299)),_=s(r(300)),k=s(r(301)),N=s(r(302));!function(e){e[e.EIP=0]="EIP",e[e.Hardfork=1]="Hardfork"}(c||(c={}));var D="0000000000000000000000000000000000000003";t.ripemdPrecompileAddress=D;var U=((a={"0000000000000000000000000000000000000001":u.default,"0000000000000000000000000000000000000002":h.default})[D]=l.default,a["0000000000000000000000000000000000000004"]=b.default,a["0000000000000000000000000000000000000005"]=g.default,a["0000000000000000000000000000000000000006"]=p.default,a["0000000000000000000000000000000000000007"]=B.default,a["0000000000000000000000000000000000000008"]=m.default,a["0000000000000000000000000000000000000009"]=I.default,a["000000000000000000000000000000000000000a"]=y.default,a["000000000000000000000000000000000000000b"]=v.default,a["000000000000000000000000000000000000000c"]=x.default,a["000000000000000000000000000000000000000d"]=C.default,a["000000000000000000000000000000000000000e"]=Q.default,a["000000000000000000000000000000000000000f"]=w.default,a["0000000000000000000000000000000000000010"]=_.default,a["0000000000000000000000000000000000000011"]=k.default,a["0000000000000000000000000000000000000012"]=N.default,a);t.precompiles=U;var G=((n={"0000000000000000000000000000000000000001":{type:c.Hardfork,param:"chainstart"},"0000000000000000000000000000000000000002":{type:c.Hardfork,param:"chainstart"}})[D]={type:c.Hardfork,param:"chainstart"},n["0000000000000000000000000000000000000004"]={type:c.Hardfork,param:"chainstart"},n["0000000000000000000000000000000000000005"]={type:c.Hardfork,param:"byzantium"},n["0000000000000000000000000000000000000006"]={type:c.Hardfork,param:"byzantium"},n["0000000000000000000000000000000000000007"]={type:c.Hardfork,param:"byzantium"},n["0000000000000000000000000000000000000008"]={type:c.Hardfork,param:"byzantium"},n["0000000000000000000000000000000000000009"]={type:c.Hardfork,param:"istanbul"},n["000000000000000000000000000000000000000a"]={type:c.EIP,param:2537},n["000000000000000000000000000000000000000b"]={type:c.EIP,param:2537},n["000000000000000000000000000000000000000c"]={type:c.EIP,param:2537},n["000000000000000000000000000000000000000d"]={type:c.EIP,param:2537},n["000000000000000000000000000000000000000f"]={type:c.EIP,param:2537},n["000000000000000000000000000000000000000e"]={type:c.EIP,param:2537},n["0000000000000000000000000000000000000010"]={type:c.EIP,param:2537},n["0000000000000000000000000000000000000011"]={type:c.EIP,param:2537},n["0000000000000000000000000000000000000012"]={type:c.EIP,param:2537},n);function getPrecompile(e,t){var r=e.buf.toString("hex");if(U[r]){var a=G[r];if(a.type==c.Hardfork&&t.gteHardfork(a.param)||a.type==c.EIP&&t.eips().includes(a.param))return U[r]}return U[""]}t.getPrecompile=getPrecompile,t.getActivePrecompiles=function getActivePrecompiles(e){var t=[];for(var r in U){var a=new d.Address(o.from(r,"hex"));getPrecompile(a,e)&&t.push(a)}return t}},(e,t,r)=>{"use strict";var a=r(411);e.exports=a.call(Function.call,Object.prototype.hasOwnProperty)},(e,t,r)=>{"use strict";var a=r(1134);e.exports=function Type(e){return"symbol"==typeof e?"Symbol":"bigint"==typeof e?"BigInt":a(e)}},function(e,t,r){"use strict";var a,n=r(2).Buffer,o=this&&this.__classPrivateFieldGet||function(e,t){if(!t.has(e))throw new TypeError("attempted to get private field on non-instance");return t.get(e)},s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.MAX_PAYLOAD_SIZE=void 0;const c=s(r(1513));t.MAX_PAYLOAD_SIZE=15728640;t.default=class WebsocketServer{constructor(e,r,s){a.set(this,new Map);const c=o(this,a),d=s.wsBinary,u="auto"===d;e.ws(s.rpcEndpoint,{maxPayloadLength:t.MAX_PAYLOAD_SIZE,idleTimeout:120,open:e=>{e.closed=!1,c.set(e,new Set)},message:async(e,t,a)=>{let o;const s=u?a:d;try{o=r.parse(n.from(t))}catch(t){const a=r.formatError(t,o);return void e.send(a,s)}let h;try{const{value:t}=await r.handle(o,e);if(e.closed)return;const n=t,s=await n;if(e.closed)return;if(h=r.format(s,o),"function"==typeof n.on){const t=n;t.on("message",(t=>{const r=JSON.stringify({jsonrpc:"2.0",method:t.type,params:t.data});e.send(r,a)})),c.get(e).add(t.dispose)}}catch(t){if(e.closed)return;h=r.formatError(t,o)}e.send(h,s)},drain:e=>{},close:e=>{e.closed=!0,c.get(e).forEach((e=>e())),c.delete(e)}})}close(){o(this,a).forEach(((e,t)=>t.end(c.default.CLOSE_NORMAL,"Server closed by client")))}},a=new WeakMap},function(e,t,r){"use strict";var a,n=this&&this.__classPrivateFieldSet||function(e,t,r){if(!t.has(e))throw new TypeError("attempted to set private field on non-instance");return t.set(e,r),r},o=this&&this.__classPrivateFieldGet||function(e,t){if(!t.has(e))throw new TypeError("attempted to get private field on non-instance");return t.get(e)};Object.defineProperty(t,"__esModule",{value:!0}),t.Executor=void 0;const s=r(723);t.Executor=class Executor{constructor(e){a.set(this,void 0),n(this,a,e)}execute(e,t,r){if("string"==typeof t&&(s.hasOwn(e.__proto__,t)&&"constructor"!==t||s.hasOwn(e,t))){const n=e[t];if("function"==typeof n)return o(this,a).queue(n,e,r)}throw new Error(`The method ${t} does not exist/is not available`)}},a=new WeakMap},function(e,t){"use strict";var r,a,n=this&&this.__classPrivateFieldSet||function(e,t,r){if(!t.has(e))throw new TypeError("attempted to set private field on non-instance");return t.set(e,r),r},o=this&&this.__classPrivateFieldGet||function(e,t){if(!t.has(e))throw new TypeError("attempted to get private field on non-instance");return t.get(e)};Object.defineProperty(t,"__esModule",{value:!0}),t.RequestCoordinator=void 0;const noop=()=>{};t.RequestCoordinator=class RequestCoordinator{constructor(e){this.pending=[],this.runningTasks=0,r.set(this,!0),this.pause=()=>{n(this,r,!0)},this.resume=()=>{n(this,r,!1),o(this,a).call(this)},a.set(this,(()=>{for(;!this.paused&&this.pending.length>0&&(!this.limit||this.runningTasks{this.runningTasks--,o(this,a).call(this)}))}})),this.queue=(e,t,r)=>new Promise(((n,s)=>{this.pending.push((async()=>{try{const a=Reflect.apply(e,t,r||[]);return n({value:a}),a}catch(e){s(e)}})),o(this,a).call(this)})),this.limit=e}get paused(){return o(this,r)}},r=new WeakMap,a=new WeakMap},(e,t,r)=>{"use strict";var a=r(231).a.ERR_STREAM_PREMATURE_CLOSE;function noop(){}e.exports=function eos(e,t,r){if("function"==typeof t)return eos(e,null,t);t||(t={}),r=function once(e){var t=!1;return function(){if(!t){t=!0;for(var r=arguments.length,a=new Array(r),n=0;n{var a=r(11).Buffer,n=r(320);e.exports=function EVP_BytesToKey(e,t,r,o){if(a.isBuffer(e)||(e=a.from(e,"binary")),t&&(a.isBuffer(t)||(t=a.from(t,"binary")),8!==t.length))throw new RangeError("salt should be Buffer with 8 byte length");for(var s=r/8,c=a.alloc(s),d=a.alloc(o||0),u=a.alloc(0);s>0||o>0;){var h=new n;h.update(u),h.update(e),t&&h.update(t),u=h.digest();var l=0;if(s>0){var b=c.length-s;l=Math.min(s,u.length),u.copy(c,b,0,l),s-=l}if(l0){var g=d.length-o,p=Math.min(o,u.length-l);u.copy(d,g,l,l+p),o-=p}}return u.fill(0),{key:c,iv:d}}},(e,t,r)=>{(t=e.exports=r(313)).Stream=t,t.Readable=t,t.Writable=r(314),t.Duplex=r(155),t.Transform=r(315),t.PassThrough=r(428),t.finished=r(258),t.pipeline=r(429)},(e,t,r)=>{"use strict";var a=r(26),n=r(68),o=n.getNAF,s=n.getJSF,c=n.assert;function BaseCurve(e,t){this.type=e,this.p=new a(t.p,16),this.red=t.prime?a.red(t.prime):a.mont(this.p),this.zero=new a(0).toRed(this.red),this.one=new a(1).toRed(this.red),this.two=new a(2).toRed(this.red),this.n=t.n&&new a(t.n,16),this.g=t.g&&this.pointFromJSON(t.g,t.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))}function BasePoint(e,t){this.curve=e,this.type=t,this.precomputed=null}e.exports=BaseCurve,BaseCurve.prototype.point=function point(){throw new Error("Not implemented")},BaseCurve.prototype.validate=function validate(){throw new Error("Not implemented")},BaseCurve.prototype._fixedNafMul=function _fixedNafMul(e,t){c(e.precomputed);var r=e._getDoubles(),a=o(t,1,this._bitLength),n=(1<=s;h--)d=(d<<1)+a[h];u.push(d)}for(var l=this.jpoint(null,null,null),b=this.jpoint(null,null,null),g=n;g>0;g--){for(s=0;s=0;u--){for(var h=0;u>=0&&0===s[u];u--)h++;if(u>=0&&h++,d=d.dblp(h),u<0)break;var l=s[u];c(0!==l),d="affine"===e.type?l>0?d.mixedAdd(n[l-1>>1]):d.mixedAdd(n[-l-1>>1].neg()):l>0?d.add(n[l-1>>1]):d.add(n[-l-1>>1].neg())}return"affine"===e.type?d.toP():d},BaseCurve.prototype._wnafMulAdd=function _wnafMulAdd(e,t,r,a,n){var c,d,u,h=this._wnafT1,l=this._wnafT2,b=this._wnafT3,g=0;for(c=0;c=1;c-=2){var B=c-1,m=c;if(1===h[B]&&1===h[m]){var I=[t[B],null,null,t[m]];0===t[B].y.cmp(t[m].y)?(I[1]=t[B].add(t[m]),I[2]=t[B].toJ().mixedAdd(t[m].neg())):0===t[B].y.cmp(t[m].y.redNeg())?(I[1]=t[B].toJ().mixedAdd(t[m]),I[2]=t[B].add(t[m].neg())):(I[1]=t[B].toJ().mixedAdd(t[m]),I[2]=t[B].toJ().mixedAdd(t[m].neg()));var y=[-3,-1,-5,-7,0,7,5,1,3],v=s(r[B],r[m]);for(g=Math.max(v[0].length,g),b[B]=new Array(g),b[m]=new Array(g),d=0;d=0;c--){for(var _=0;c>=0;){var k=!0;for(d=0;d=0&&_++,Q=Q.dblp(_),c<0)break;for(d=0;d0?u=l[d][N-1>>1]:N<0&&(u=l[d][-N-1>>1].neg()),Q="affine"===u.type?Q.mixedAdd(u):Q.add(u))}}for(c=0;c=Math.ceil((e.bitLength()+1)/t.step)},BasePoint.prototype._getDoubles=function _getDoubles(e,t){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var r=[this],a=this,n=0;n{"use strict";var a=r(109),n=r(67);function BlockHash(){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}t.BlockHash=BlockHash,BlockHash.prototype.update=function update(e,t){if(e=a.toArray(e,t),this.pending?this.pending=this.pending.concat(e):this.pending=e,this.pendingTotal+=e.length,this.pending.length>=this._delta8){var r=(e=this.pending).length%this._delta8;this.pending=e.slice(e.length-r,e.length),0===this.pending.length&&(this.pending=null),e=a.join32(e,0,e.length-r,this.endian);for(var n=0;n>>24&255,a[n++]=e>>>16&255,a[n++]=e>>>8&255,a[n++]=255&e}else for(a[n++]=255&e,a[n++]=e>>>8&255,a[n++]=e>>>16&255,a[n++]=e>>>24&255,a[n++]=0,a[n++]=0,a[n++]=0,a[n++]=0,o=8;o{var a=r(1254),n=r(1255),o=r(776),s=r(317),c=r(746),d=r(11).Buffer;function parseKeys(e){var t;"object"!=typeof e||d.isBuffer(e)||(t=e.passphrase,e=e.key),"string"==typeof e&&(e=d.from(e));var r,u,h=o(e,t),l=h.tag,b=h.data;switch(l){case"CERTIFICATE":u=a.certificate.decode(b,"der").tbsCertificate.subjectPublicKeyInfo;case"PUBLIC KEY":switch(u||(u=a.PublicKey.decode(b,"der")),r=u.algorithm.algorithm.join(".")){case"1.2.840.113549.1.1.1":return a.RSAPublicKey.decode(u.subjectPublicKey.data,"der");case"1.2.840.10045.2.1":return u.subjectPrivateKey=u.subjectPublicKey,{type:"ec",data:u};case"1.2.840.10040.4.1":return u.algorithm.params.pub_key=a.DSAparam.decode(u.subjectPublicKey.data,"der"),{type:"dsa",data:u.algorithm.params};default:throw new Error("unknown key id "+r)}case"ENCRYPTED PRIVATE KEY":b=function decrypt(e,t){var r=e.algorithm.decrypt.kde.kdeparams.salt,a=parseInt(e.algorithm.decrypt.kde.kdeparams.iters.toString(),10),o=n[e.algorithm.decrypt.cipher.algo.join(".")],u=e.algorithm.decrypt.cipher.iv,h=e.subjectPrivateKey,l=parseInt(o.split("-")[1],10)/8,b=c.pbkdf2Sync(t,r,a,l,"sha1"),g=s.createDecipheriv(o,b,u),p=[];return p.push(g.update(h)),p.push(g.final()),d.concat(p)}(b=a.EncryptedPrivateKey.decode(b,"der"),t);case"PRIVATE KEY":switch(r=(u=a.PrivateKey.decode(b,"der")).algorithm.algorithm.join(".")){case"1.2.840.113549.1.1.1":return a.RSAPrivateKey.decode(u.subjectPrivateKey,"der");case"1.2.840.10045.2.1":return{curve:u.algorithm.curve,privateKey:a.ECPrivateKey.decode(u.subjectPrivateKey,"der").privateKey};case"1.2.840.10040.4.1":return u.algorithm.params.priv_key=a.DSAparam.decode(u.subjectPrivateKey,"der"),{type:"dsa",params:u.algorithm.params};default:throw new Error("unknown key id "+r)}case"RSA PUBLIC KEY":return a.RSAPublicKey.decode(b,"der");case"RSA PRIVATE KEY":return a.RSAPrivateKey.decode(b,"der");case"DSA PRIVATE KEY":return{type:"dsa",params:a.DSAPrivateKey.decode(b,"der")};case"EC PRIVATE KEY":return{curve:(b=a.ECPrivateKey.decode(b,"der")).parameters.value,privateKey:b.privateKey};default:throw new Error("unknown key type "+l)}}e.exports=parseKeys,parseKeys.signature=a.signature},(e,t,r)=>{"use strict";const a=r(10),n=r(461).a,o=r(330).Buffer;function DecoderBuffer(e,t){n.call(this,t),o.isBuffer(e)?(this.base=e,this.offset=0,this.length=e.length):this.error("Input not Buffer")}function EncoderBuffer(e,t){if(Array.isArray(e))this.length=0,this.value=e.map((function(e){return EncoderBuffer.isEncoderBuffer(e)||(e=new EncoderBuffer(e,t)),this.length+=e.length,e}),this);else if("number"==typeof e){if(!(0<=e&&e<=255))return t.error("non-byte EncoderBuffer value");this.value=e,this.length=1}else if("string"==typeof e)this.value=e,this.length=o.byteLength(e);else{if(!o.isBuffer(e))return t.error("Unsupported type: "+typeof e);this.value=e,this.length=e.length}}a(DecoderBuffer,n),t.a=DecoderBuffer,DecoderBuffer.isDecoderBuffer=function isDecoderBuffer(e){if(e instanceof DecoderBuffer)return!0;return"object"==typeof e&&o.isBuffer(e.base)&&"DecoderBuffer"===e.constructor.name&&"number"==typeof e.offset&&"number"==typeof e.length&&"function"==typeof e.save&&"function"==typeof e.restore&&"function"==typeof e.isEmpty&&"function"==typeof e.readUInt8&&"function"==typeof e.skip&&"function"==typeof e.raw},DecoderBuffer.prototype.save=function save(){return{offset:this.offset,reporter:n.prototype.save.call(this)}},DecoderBuffer.prototype.restore=function restore(e){const t=new DecoderBuffer(this.base);return t.offset=e.offset,t.length=this.offset,this.offset=e.offset,n.prototype.restore.call(this,e.reporter),t},DecoderBuffer.prototype.isEmpty=function isEmpty(){return this.offset===this.length},DecoderBuffer.prototype.readUInt8=function readUInt8(e){return this.offset+1<=this.length?this.base.readUInt8(this.offset++,!0):this.error(e||"DecoderBuffer overrun")},DecoderBuffer.prototype.skip=function skip(e,t){if(!(this.offset+e<=this.length))return this.error(t||"DecoderBuffer overrun");const r=new DecoderBuffer(this.base);return r._reporterState=this._reporterState,r.offset=this.offset,r.length=this.offset+e,this.offset+=e,r},DecoderBuffer.prototype.raw=function raw(e){return this.base.slice(e?e.offset:this.offset,this.length)},t.b=EncoderBuffer,EncoderBuffer.isEncoderBuffer=function isEncoderBuffer(e){if(e instanceof EncoderBuffer)return!0;return"object"==typeof e&&"EncoderBuffer"===e.constructor.name&&"number"==typeof e.length&&"function"==typeof e.join},EncoderBuffer.prototype.join=function join(e,t){return e||(e=o.alloc(this.length)),t||(t=0),0===this.length||(Array.isArray(this.value)?this.value.forEach((function(r){r.join(e,t),t+=r.length})):("number"==typeof this.value?e[t]=this.value:"string"==typeof this.value?e.write(this.value,t):o.isBuffer(this.value)&&this.value.copy(e,t),t+=this.length)),e}},(e,t)=>{"use strict";function reverse(e){const t={};return Object.keys(e).forEach((function(r){(0|r)==r&&(r|=0);const a=e[r];t[a]=r})),t}t.tagClass={0:"universal",1:"application",2:"context",3:"private"},t.tagClassByName=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=reverse(t.tag)},function(e,t,r){"use strict";var a,n=this&&this.__decorate||function(e,t,r,a){var n,o=arguments.length,s=o<3?t:null===a?a=Object.getOwnPropertyDescriptor(t,r):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,r,a);else for(var c=e.length-1;c>=0;c--)(n=e[c])&&(s=(o<3?n(s):o>3?n(t,r,s):n(t,r))||s);return o>3&&s&&Object.defineProperty(t,r,s),s},o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const s=o(r(783)),c=["clearListeners","once","on","emit","onAny"];let d=a=class PromiEvent extends Promise{constructor(e){super(e),this.dispose=()=>{if(!this.clearListeners)throw new Error("PromiEvent already disposed");this.clearListeners();const fn=()=>{throw new Error("PromiEvent bound after dispose")};c.filter((e=>"emit"!==e)).forEach((e=>{Object.defineProperty(this,e,{enumerable:!1,value:fn})}))}}catch(e){const t=new a(((r,a)=>{this.onAny(((e,r)=>t.emit(e,r)));super.catch(e).then(r,a)}));return t}static resolve(e){return new a((t=>{t(e)}))}};d=a=n([s.default.mixin(Symbol.for("emittery"),c)],d),t.default=d},(e,t,r)=>{"use strict";var a=r(95),n=r(69),o=n.getNAF,s=n.getJSF,c=n.assert;function BaseCurve(e,t){this.type=e,this.p=new a(t.p,16),this.red=t.prime?a.red(t.prime):a.mont(this.p),this.zero=new a(0).toRed(this.red),this.one=new a(1).toRed(this.red),this.two=new a(2).toRed(this.red),this.n=t.n&&new a(t.n,16),this.g=t.g&&this.pointFromJSON(t.g,t.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))}function BasePoint(e,t){this.curve=e,this.type=t,this.precomputed=null}e.exports=BaseCurve,BaseCurve.prototype.point=function point(){throw new Error("Not implemented")},BaseCurve.prototype.validate=function validate(){throw new Error("Not implemented")},BaseCurve.prototype._fixedNafMul=function _fixedNafMul(e,t){c(e.precomputed);var r=e._getDoubles(),a=o(t,1,this._bitLength),n=(1<=s;h--)d=(d<<1)+a[h];u.push(d)}for(var l=this.jpoint(null,null,null),b=this.jpoint(null,null,null),g=n;g>0;g--){for(s=0;s=0;u--){for(var h=0;u>=0&&0===s[u];u--)h++;if(u>=0&&h++,d=d.dblp(h),u<0)break;var l=s[u];c(0!==l),d="affine"===e.type?l>0?d.mixedAdd(n[l-1>>1]):d.mixedAdd(n[-l-1>>1].neg()):l>0?d.add(n[l-1>>1]):d.add(n[-l-1>>1].neg())}return"affine"===e.type?d.toP():d},BaseCurve.prototype._wnafMulAdd=function _wnafMulAdd(e,t,r,a,n){var c,d,u,h=this._wnafT1,l=this._wnafT2,b=this._wnafT3,g=0;for(c=0;c=1;c-=2){var B=c-1,m=c;if(1===h[B]&&1===h[m]){var I=[t[B],null,null,t[m]];0===t[B].y.cmp(t[m].y)?(I[1]=t[B].add(t[m]),I[2]=t[B].toJ().mixedAdd(t[m].neg())):0===t[B].y.cmp(t[m].y.redNeg())?(I[1]=t[B].toJ().mixedAdd(t[m]),I[2]=t[B].add(t[m].neg())):(I[1]=t[B].toJ().mixedAdd(t[m]),I[2]=t[B].toJ().mixedAdd(t[m].neg()));var y=[-3,-1,-5,-7,0,7,5,1,3],v=s(r[B],r[m]);for(g=Math.max(v[0].length,g),b[B]=new Array(g),b[m]=new Array(g),d=0;d=0;c--){for(var _=0;c>=0;){var k=!0;for(d=0;d=0&&_++,Q=Q.dblp(_),c<0)break;for(d=0;d0?u=l[d][N-1>>1]:N<0&&(u=l[d][-N-1>>1].neg()),Q="affine"===u.type?Q.mixedAdd(u):Q.add(u))}}for(c=0;c=Math.ceil((e.bitLength()+1)/t.step)},BasePoint.prototype._getDoubles=function _getDoubles(e,t){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var r=[this],a=this,n=0;n{"use strict";var a=r(110),n=r(157);function BlockHash(){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}t.BlockHash=BlockHash,BlockHash.prototype.update=function update(e,t){if(e=a.toArray(e,t),this.pending?this.pending=this.pending.concat(e):this.pending=e,this.pendingTotal+=e.length,this.pending.length>=this._delta8){var r=(e=this.pending).length%this._delta8;this.pending=e.slice(e.length-r,e.length),0===this.pending.length&&(this.pending=null),e=a.join32(e,0,e.length-r,this.endian);for(var n=0;n>>24&255,a[n++]=e>>>16&255,a[n++]=e>>>8&255,a[n++]=255&e}else for(a[n++]=255&e,a[n++]=e>>>8&255,a[n++]=e>>>16&255,a[n++]=e>>>24&255,a[n++]=0,a[n++]=0,a[n++]=0,a[n++]=0,o=8;o{"use strict";var a=r(478);e.exports=function hasToStringTagShams(){return a()&&!!Symbol.toStringTag}},(e,t,r)=>{"use strict";var a=r(271),n=r(272),o=n(a("String.prototype.indexOf"));e.exports=function callBoundIntrinsic(e,t){var r=a(e,!!t);return"function"==typeof r&&o(e,".prototype.")>-1?n(r):r}},(e,t,r)=>{"use strict";var a,n=SyntaxError,o=Function,s=TypeError,getEvalledConstructor=function(e){try{return o('"use strict"; return ('+e+").constructor;")()}catch(e){}},c=Object.getOwnPropertyDescriptor;if(c)try{c({},"")}catch(e){c=null}var throwTypeError=function(){throw new s},d=c?function(){try{return throwTypeError}catch(e){try{return c(arguments,"callee").get}catch(e){return throwTypeError}}}():throwTypeError,u=r(479)(),h=Object.getPrototypeOf||function(e){return e.__proto__},l={},b="undefined"==typeof Uint8Array?a:h(Uint8Array),g={"%AggregateError%":"undefined"==typeof AggregateError?a:AggregateError,"%Array%":Array,"%ArrayBuffer%":"undefined"==typeof ArrayBuffer?a:ArrayBuffer,"%ArrayIteratorPrototype%":u?h([][Symbol.iterator]()):a,"%AsyncFromSyncIteratorPrototype%":a,"%AsyncFunction%":l,"%AsyncGenerator%":l,"%AsyncGeneratorFunction%":l,"%AsyncIteratorPrototype%":l,"%Atomics%":"undefined"==typeof Atomics?a:Atomics,"%BigInt%":"undefined"==typeof BigInt?a:BigInt,"%Boolean%":Boolean,"%DataView%":"undefined"==typeof DataView?a:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":"undefined"==typeof Float32Array?a:Float32Array,"%Float64Array%":"undefined"==typeof Float64Array?a:Float64Array,"%FinalizationRegistry%":"undefined"==typeof FinalizationRegistry?a:FinalizationRegistry,"%Function%":o,"%GeneratorFunction%":l,"%Int8Array%":"undefined"==typeof Int8Array?a:Int8Array,"%Int16Array%":"undefined"==typeof Int16Array?a:Int16Array,"%Int32Array%":"undefined"==typeof Int32Array?a:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":u?h(h([][Symbol.iterator]())):a,"%JSON%":"object"==typeof JSON?JSON:a,"%Map%":"undefined"==typeof Map?a:Map,"%MapIteratorPrototype%":"undefined"!=typeof Map&&u?h((new Map)[Symbol.iterator]()):a,"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":"undefined"==typeof Promise?a:Promise,"%Proxy%":"undefined"==typeof Proxy?a:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":"undefined"==typeof Reflect?a:Reflect,"%RegExp%":RegExp,"%Set%":"undefined"==typeof Set?a:Set,"%SetIteratorPrototype%":"undefined"!=typeof Set&&u?h((new Set)[Symbol.iterator]()):a,"%SharedArrayBuffer%":"undefined"==typeof SharedArrayBuffer?a:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":u?h(""[Symbol.iterator]()):a,"%Symbol%":u?Symbol:a,"%SyntaxError%":n,"%ThrowTypeError%":d,"%TypedArray%":b,"%TypeError%":s,"%Uint8Array%":"undefined"==typeof Uint8Array?a:Uint8Array,"%Uint8ClampedArray%":"undefined"==typeof Uint8ClampedArray?a:Uint8ClampedArray,"%Uint16Array%":"undefined"==typeof Uint16Array?a:Uint16Array,"%Uint32Array%":"undefined"==typeof Uint32Array?a:Uint32Array,"%URIError%":URIError,"%WeakMap%":"undefined"==typeof WeakMap?a:WeakMap,"%WeakRef%":"undefined"==typeof WeakRef?a:WeakRef,"%WeakSet%":"undefined"==typeof WeakSet?a:WeakSet},p=function doEval(e){var t;if("%AsyncFunction%"===e)t=getEvalledConstructor("async function () {}");else if("%GeneratorFunction%"===e)t=getEvalledConstructor("function* () {}");else if("%AsyncGeneratorFunction%"===e)t=getEvalledConstructor("async function* () {}");else if("%AsyncGenerator%"===e){var r=doEval("%AsyncGeneratorFunction%");r&&(t=r.prototype)}else if("%AsyncIteratorPrototype%"===e){var a=doEval("%AsyncGenerator%");a&&(t=h(a.prototype))}return g[e]=t,t},B={"%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"]},m=r(336),I=r(811),y=m.call(Function.call,Array.prototype.concat),v=m.call(Function.apply,Array.prototype.splice),x=m.call(Function.call,String.prototype.replace),C=m.call(Function.call,String.prototype.slice),Q=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,w=/\\(\\)?/g,_=function stringToPath(e){var t=C(e,0,1),r=C(e,-1);if("%"===t&&"%"!==r)throw new n("invalid intrinsic syntax, expected closing `%`");if("%"===r&&"%"!==t)throw new n("invalid intrinsic syntax, expected opening `%`");var a=[];return x(e,Q,(function(e,t,r,n){a[a.length]=r?x(n,w,"$1"):t||e})),a},k=function getBaseIntrinsic(e,t){var r,a=e;if(I(B,a)&&(a="%"+(r=B[a])[0]+"%"),I(g,a)){var o=g[a];if(o===l&&(o=p(a)),void 0===o&&!t)throw new s("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:r,name:a,value:o}}throw new n("intrinsic "+e+" does not exist!")};e.exports=function GetIntrinsic(e,t){if("string"!=typeof e||0===e.length)throw new s("intrinsic name must be a non-empty string");if(arguments.length>1&&"boolean"!=typeof t)throw new s('"allowMissing" argument must be a boolean');var r=_(e),a=r.length>0?r[0]:"",o=k("%"+a+"%",t),d=o.name,u=o.value,h=!1,l=o.alias;l&&(a=l[0],v(r,y([0,1],l)));for(var b=1,p=!0;b=r.length){var Q=c(u,B);u=(p=!!Q)&&"get"in Q&&!("originalValue"in Q.get)?Q.get:u[B]}else p=I(u,B),u=u[B];p&&!h&&(g[d]=u)}}return u}},(e,t,r)=>{"use strict";var a=r(336),n=r(271),o=n("%Function.prototype.apply%"),s=n("%Function.prototype.call%"),c=n("%Reflect.apply%",!0)||a.call(s,o),d=n("%Object.getOwnPropertyDescriptor%",!0),u=n("%Object.defineProperty%",!0),h=n("%Math.max%");if(u)try{u({},"a",{value:1})}catch(e){u=null}e.exports=function callBind(e){var t=c(a,s,arguments);if(d&&u){var r=d(t,"length");r.configurable&&u(t,"length",{value:1+h(0,e.length-(arguments.length-1))})}return t};var l=function applyBind(){return c(a,o,arguments)};u?u(e.exports,"apply",{value:l}):e.exports.apply=l},(e,t,r)=>{"use strict";var a=r(820),n="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),o=Object.prototype.toString,s=Array.prototype.concat,c=Object.defineProperty,d=c&&function(){var e={};try{for(var t in c(e,"x",{enumerable:!1,value:e}),e)return!1;return e.x===e}catch(e){return!1}}(),defineProperty=function(e,t,r,a){var n;(!(t in e)||"function"==typeof(n=a)&&"[object Function]"===o.call(n)&&a())&&(d?c(e,t,{configurable:!0,enumerable:!1,value:r,writable:!0}):e[t]=r)},defineProperties=function(e,t){var r=arguments.length>2?arguments[2]:{},o=a(t);n&&(o=s.call(o,Object.getOwnPropertySymbols(t)));for(var c=0;c{"use strict";var a=r(3).Buffer;Object.defineProperty(t,"__esModule",{value:!0}),t.rlphash=t.ripemd160=t.sha256=t.keccak256=t.keccak=void 0;var n=r(826),o=n.keccak224,s=n.keccak384,c=n.keccak256,d=n.keccak512,u=r(487),h=r(87),l=r(180),b=r(70);t.keccak=function(e,t){switch(void 0===t&&(t=256),e="string"!=typeof e||h.isHexString(e)?b.toBuffer(e):a.from(e,"utf8"),t||(t=256),t){case 224:return o(e);case 256:return c(e);case 384:return s(e);case 512:return d(e);default:throw new Error("Invald algorithm: keccak"+t)}},t.keccak256=function(e){return t.keccak(e)},t.sha256=function(e){return e=b.toBuffer(e),u("sha256").update(e).digest()},t.ripemd160=function(e,t){e=b.toBuffer(e);var r=u("rmd160").update(e).digest();return!0===t?b.setLength(r,32):r},t.rlphash=function(e){return t.keccak(l.encode(e))}},(e,t,r)=>{"use strict";var a=r(96),n=r(72),o=n.getNAF,s=n.getJSF,c=n.assert;function BaseCurve(e,t){this.type=e,this.p=new a(t.p,16),this.red=t.prime?a.red(t.prime):a.mont(this.p),this.zero=new a(0).toRed(this.red),this.one=new a(1).toRed(this.red),this.two=new a(2).toRed(this.red),this.n=t.n&&new a(t.n,16),this.g=t.g&&this.pointFromJSON(t.g,t.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))}function BasePoint(e,t){this.curve=e,this.type=t,this.precomputed=null}e.exports=BaseCurve,BaseCurve.prototype.point=function point(){throw new Error("Not implemented")},BaseCurve.prototype.validate=function validate(){throw new Error("Not implemented")},BaseCurve.prototype._fixedNafMul=function _fixedNafMul(e,t){c(e.precomputed);var r=e._getDoubles(),a=o(t,1,this._bitLength),n=(1<=s;h--)d=(d<<1)+a[h];u.push(d)}for(var l=this.jpoint(null,null,null),b=this.jpoint(null,null,null),g=n;g>0;g--){for(s=0;s=0;u--){for(var h=0;u>=0&&0===s[u];u--)h++;if(u>=0&&h++,d=d.dblp(h),u<0)break;var l=s[u];c(0!==l),d="affine"===e.type?l>0?d.mixedAdd(n[l-1>>1]):d.mixedAdd(n[-l-1>>1].neg()):l>0?d.add(n[l-1>>1]):d.add(n[-l-1>>1].neg())}return"affine"===e.type?d.toP():d},BaseCurve.prototype._wnafMulAdd=function _wnafMulAdd(e,t,r,a,n){var c,d,u,h=this._wnafT1,l=this._wnafT2,b=this._wnafT3,g=0;for(c=0;c=1;c-=2){var B=c-1,m=c;if(1===h[B]&&1===h[m]){var I=[t[B],null,null,t[m]];0===t[B].y.cmp(t[m].y)?(I[1]=t[B].add(t[m]),I[2]=t[B].toJ().mixedAdd(t[m].neg())):0===t[B].y.cmp(t[m].y.redNeg())?(I[1]=t[B].toJ().mixedAdd(t[m]),I[2]=t[B].add(t[m].neg())):(I[1]=t[B].toJ().mixedAdd(t[m]),I[2]=t[B].toJ().mixedAdd(t[m].neg()));var y=[-3,-1,-5,-7,0,7,5,1,3],v=s(r[B],r[m]);for(g=Math.max(v[0].length,g),b[B]=new Array(g),b[m]=new Array(g),d=0;d=0;c--){for(var _=0;c>=0;){var k=!0;for(d=0;d=0&&_++,Q=Q.dblp(_),c<0)break;for(d=0;d0?u=l[d][N-1>>1]:N<0&&(u=l[d][-N-1>>1].neg()),Q="affine"===u.type?Q.mixedAdd(u):Q.add(u))}}for(c=0;c=Math.ceil((e.bitLength()+1)/t.step)},BasePoint.prototype._getDoubles=function _getDoubles(e,t){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var r=[this],a=this,n=0;n{"use strict";var a=r(111),n=r(159);function BlockHash(){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}t.BlockHash=BlockHash,BlockHash.prototype.update=function update(e,t){if(e=a.toArray(e,t),this.pending?this.pending=this.pending.concat(e):this.pending=e,this.pendingTotal+=e.length,this.pending.length>=this._delta8){var r=(e=this.pending).length%this._delta8;this.pending=e.slice(e.length-r,e.length),0===this.pending.length&&(this.pending=null),e=a.join32(e,0,e.length-r,this.endian);for(var n=0;n>>24&255,a[n++]=e>>>16&255,a[n++]=e>>>8&255,a[n++]=255&e}else for(a[n++]=255&e,a[n++]=e>>>8&255,a[n++]=e>>>16&255,a[n++]=e>>>24&255,a[n++]=0,a[n++]=0,a[n++]=0,a[n++]=0,o=8;o=e.length&&(e=void 0),{value:e&&e[a++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.chains=t._getInitializedChains=void 0;var o=n(r(1293)),s=n(r(1294)),c=n(r(1295)),d=n(r(1296)),u=n(r(1297)),h=n(r(1298));function _getInitializedChains(e){var t,r,n={1:"mainnet",3:"ropsten",4:"rinkeby",42:"kovan",5:"goerli",123:"calaveras"},l={mainnet:o.default,ropsten:s.default,rinkeby:c.default,kovan:d.default,goerli:u.default,calaveras:h.default};if(e)try{for(var b=a(e),g=b.next();!g.done;g=b.next()){var p=g.value,B=p.name;n[p.chainId.toString()]=B,l[B]=p}}catch(e){t={error:e}}finally{try{g&&!g.done&&(r=b.return)&&r.call(b)}finally{if(t)throw t.error}}return l.names=n,l}t._getInitializedChains=_getInitializedChains,t.chains=_getInitializedChains()},(e,t,r)=>{"use strict";var a=r(98),n=r(74),o=n.getNAF,s=n.getJSF,c=n.assert;function BaseCurve(e,t){this.type=e,this.p=new a(t.p,16),this.red=t.prime?a.red(t.prime):a.mont(this.p),this.zero=new a(0).toRed(this.red),this.one=new a(1).toRed(this.red),this.two=new a(2).toRed(this.red),this.n=t.n&&new a(t.n,16),this.g=t.g&&this.pointFromJSON(t.g,t.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))}function BasePoint(e,t){this.curve=e,this.type=t,this.precomputed=null}e.exports=BaseCurve,BaseCurve.prototype.point=function point(){throw new Error("Not implemented")},BaseCurve.prototype.validate=function validate(){throw new Error("Not implemented")},BaseCurve.prototype._fixedNafMul=function _fixedNafMul(e,t){c(e.precomputed);var r=e._getDoubles(),a=o(t,1,this._bitLength),n=(1<=s;h--)d=(d<<1)+a[h];u.push(d)}for(var l=this.jpoint(null,null,null),b=this.jpoint(null,null,null),g=n;g>0;g--){for(s=0;s=0;u--){for(var h=0;u>=0&&0===s[u];u--)h++;if(u>=0&&h++,d=d.dblp(h),u<0)break;var l=s[u];c(0!==l),d="affine"===e.type?l>0?d.mixedAdd(n[l-1>>1]):d.mixedAdd(n[-l-1>>1].neg()):l>0?d.add(n[l-1>>1]):d.add(n[-l-1>>1].neg())}return"affine"===e.type?d.toP():d},BaseCurve.prototype._wnafMulAdd=function _wnafMulAdd(e,t,r,a,n){var c,d,u,h=this._wnafT1,l=this._wnafT2,b=this._wnafT3,g=0;for(c=0;c=1;c-=2){var B=c-1,m=c;if(1===h[B]&&1===h[m]){var I=[t[B],null,null,t[m]];0===t[B].y.cmp(t[m].y)?(I[1]=t[B].add(t[m]),I[2]=t[B].toJ().mixedAdd(t[m].neg())):0===t[B].y.cmp(t[m].y.redNeg())?(I[1]=t[B].toJ().mixedAdd(t[m]),I[2]=t[B].add(t[m].neg())):(I[1]=t[B].toJ().mixedAdd(t[m]),I[2]=t[B].toJ().mixedAdd(t[m].neg()));var y=[-3,-1,-5,-7,0,7,5,1,3],v=s(r[B],r[m]);for(g=Math.max(v[0].length,g),b[B]=new Array(g),b[m]=new Array(g),d=0;d=0;c--){for(var _=0;c>=0;){var k=!0;for(d=0;d=0&&_++,Q=Q.dblp(_),c<0)break;for(d=0;d0?u=l[d][N-1>>1]:N<0&&(u=l[d][-N-1>>1].neg()),Q="affine"===u.type?Q.mixedAdd(u):Q.add(u))}}for(c=0;c=Math.ceil((e.bitLength()+1)/t.step)},BasePoint.prototype._getDoubles=function _getDoubles(e,t){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var r=[this],a=this,n=0;n{"use strict";var a=r(113),n=r(161);function BlockHash(){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}t.BlockHash=BlockHash,BlockHash.prototype.update=function update(e,t){if(e=a.toArray(e,t),this.pending?this.pending=this.pending.concat(e):this.pending=e,this.pendingTotal+=e.length,this.pending.length>=this._delta8){var r=(e=this.pending).length%this._delta8;this.pending=e.slice(e.length-r,e.length),0===this.pending.length&&(this.pending=null),e=a.join32(e,0,e.length-r,this.endian);for(var n=0;n>>24&255,a[n++]=e>>>16&255,a[n++]=e>>>8&255,a[n++]=255&e}else for(a[n++]=255&e,a[n++]=e>>>8&255,a[n++]=e>>>16&255,a[n++]=e>>>24&255,a[n++]=0,a[n++]=0,a[n++]=0,a[n++]=0,o=8;o{"use strict";var a=r(99),n=r(75),o=n.getNAF,s=n.getJSF,c=n.assert;function BaseCurve(e,t){this.type=e,this.p=new a(t.p,16),this.red=t.prime?a.red(t.prime):a.mont(this.p),this.zero=new a(0).toRed(this.red),this.one=new a(1).toRed(this.red),this.two=new a(2).toRed(this.red),this.n=t.n&&new a(t.n,16),this.g=t.g&&this.pointFromJSON(t.g,t.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))}function BasePoint(e,t){this.curve=e,this.type=t,this.precomputed=null}e.exports=BaseCurve,BaseCurve.prototype.point=function point(){throw new Error("Not implemented")},BaseCurve.prototype.validate=function validate(){throw new Error("Not implemented")},BaseCurve.prototype._fixedNafMul=function _fixedNafMul(e,t){c(e.precomputed);var r=e._getDoubles(),a=o(t,1,this._bitLength),n=(1<=s;h--)d=(d<<1)+a[h];u.push(d)}for(var l=this.jpoint(null,null,null),b=this.jpoint(null,null,null),g=n;g>0;g--){for(s=0;s=0;u--){for(var h=0;u>=0&&0===s[u];u--)h++;if(u>=0&&h++,d=d.dblp(h),u<0)break;var l=s[u];c(0!==l),d="affine"===e.type?l>0?d.mixedAdd(n[l-1>>1]):d.mixedAdd(n[-l-1>>1].neg()):l>0?d.add(n[l-1>>1]):d.add(n[-l-1>>1].neg())}return"affine"===e.type?d.toP():d},BaseCurve.prototype._wnafMulAdd=function _wnafMulAdd(e,t,r,a,n){var c,d,u,h=this._wnafT1,l=this._wnafT2,b=this._wnafT3,g=0;for(c=0;c=1;c-=2){var B=c-1,m=c;if(1===h[B]&&1===h[m]){var I=[t[B],null,null,t[m]];0===t[B].y.cmp(t[m].y)?(I[1]=t[B].add(t[m]),I[2]=t[B].toJ().mixedAdd(t[m].neg())):0===t[B].y.cmp(t[m].y.redNeg())?(I[1]=t[B].toJ().mixedAdd(t[m]),I[2]=t[B].add(t[m].neg())):(I[1]=t[B].toJ().mixedAdd(t[m]),I[2]=t[B].toJ().mixedAdd(t[m].neg()));var y=[-3,-1,-5,-7,0,7,5,1,3],v=s(r[B],r[m]);for(g=Math.max(v[0].length,g),b[B]=new Array(g),b[m]=new Array(g),d=0;d=0;c--){for(var _=0;c>=0;){var k=!0;for(d=0;d=0&&_++,Q=Q.dblp(_),c<0)break;for(d=0;d0?u=l[d][N-1>>1]:N<0&&(u=l[d][-N-1>>1].neg()),Q="affine"===u.type?Q.mixedAdd(u):Q.add(u))}}for(c=0;c=Math.ceil((e.bitLength()+1)/t.step)},BasePoint.prototype._getDoubles=function _getDoubles(e,t){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var r=[this],a=this,n=0;n{"use strict";var a=r(114),n=r(163);function BlockHash(){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}t.BlockHash=BlockHash,BlockHash.prototype.update=function update(e,t){if(e=a.toArray(e,t),this.pending?this.pending=this.pending.concat(e):this.pending=e,this.pendingTotal+=e.length,this.pending.length>=this._delta8){var r=(e=this.pending).length%this._delta8;this.pending=e.slice(e.length-r,e.length),0===this.pending.length&&(this.pending=null),e=a.join32(e,0,e.length-r,this.endian);for(var n=0;n>>24&255,a[n++]=e>>>16&255,a[n++]=e>>>8&255,a[n++]=255&e}else for(a[n++]=255&e,a[n++]=e>>>8&255,a[n++]=e>>>16&255,a[n++]=e>>>24&255,a[n++]=0,a[n++]=0,a[n++]=0,a[n++]=0,o=8;o{"use strict";var a=r(100),n=r(77),o=n.getNAF,s=n.getJSF,c=n.assert;function BaseCurve(e,t){this.type=e,this.p=new a(t.p,16),this.red=t.prime?a.red(t.prime):a.mont(this.p),this.zero=new a(0).toRed(this.red),this.one=new a(1).toRed(this.red),this.two=new a(2).toRed(this.red),this.n=t.n&&new a(t.n,16),this.g=t.g&&this.pointFromJSON(t.g,t.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))}function BasePoint(e,t){this.curve=e,this.type=t,this.precomputed=null}e.exports=BaseCurve,BaseCurve.prototype.point=function point(){throw new Error("Not implemented")},BaseCurve.prototype.validate=function validate(){throw new Error("Not implemented")},BaseCurve.prototype._fixedNafMul=function _fixedNafMul(e,t){c(e.precomputed);var r=e._getDoubles(),a=o(t,1,this._bitLength),n=(1<=s;h--)d=(d<<1)+a[h];u.push(d)}for(var l=this.jpoint(null,null,null),b=this.jpoint(null,null,null),g=n;g>0;g--){for(s=0;s=0;u--){for(var h=0;u>=0&&0===s[u];u--)h++;if(u>=0&&h++,d=d.dblp(h),u<0)break;var l=s[u];c(0!==l),d="affine"===e.type?l>0?d.mixedAdd(n[l-1>>1]):d.mixedAdd(n[-l-1>>1].neg()):l>0?d.add(n[l-1>>1]):d.add(n[-l-1>>1].neg())}return"affine"===e.type?d.toP():d},BaseCurve.prototype._wnafMulAdd=function _wnafMulAdd(e,t,r,a,n){var c,d,u,h=this._wnafT1,l=this._wnafT2,b=this._wnafT3,g=0;for(c=0;c=1;c-=2){var B=c-1,m=c;if(1===h[B]&&1===h[m]){var I=[t[B],null,null,t[m]];0===t[B].y.cmp(t[m].y)?(I[1]=t[B].add(t[m]),I[2]=t[B].toJ().mixedAdd(t[m].neg())):0===t[B].y.cmp(t[m].y.redNeg())?(I[1]=t[B].toJ().mixedAdd(t[m]),I[2]=t[B].add(t[m].neg())):(I[1]=t[B].toJ().mixedAdd(t[m]),I[2]=t[B].toJ().mixedAdd(t[m].neg()));var y=[-3,-1,-5,-7,0,7,5,1,3],v=s(r[B],r[m]);for(g=Math.max(v[0].length,g),b[B]=new Array(g),b[m]=new Array(g),d=0;d=0;c--){for(var _=0;c>=0;){var k=!0;for(d=0;d=0&&_++,Q=Q.dblp(_),c<0)break;for(d=0;d0?u=l[d][N-1>>1]:N<0&&(u=l[d][-N-1>>1].neg()),Q="affine"===u.type?Q.mixedAdd(u):Q.add(u))}}for(c=0;c=Math.ceil((e.bitLength()+1)/t.step)},BasePoint.prototype._getDoubles=function _getDoubles(e,t){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var r=[this],a=this,n=0;n{"use strict";var a=r(115),n=r(164);function BlockHash(){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}t.BlockHash=BlockHash,BlockHash.prototype.update=function update(e,t){if(e=a.toArray(e,t),this.pending?this.pending=this.pending.concat(e):this.pending=e,this.pendingTotal+=e.length,this.pending.length>=this._delta8){var r=(e=this.pending).length%this._delta8;this.pending=e.slice(e.length-r,e.length),0===this.pending.length&&(this.pending=null),e=a.join32(e,0,e.length-r,this.endian);for(var n=0;n>>24&255,a[n++]=e>>>16&255,a[n++]=e>>>8&255,a[n++]=255&e}else for(a[n++]=255&e,a[n++]=e>>>8&255,a[n++]=e>>>16&255,a[n++]=e>>>24&255,a[n++]=0,a[n++]=0,a[n++]=0,a[n++]=0,o=8;o{"use strict";var a=r(204),n=r(1010);e.exports=function supports(){var e=a.apply(null,arguments);return n(e,{bufferKeys:e.bufferKeys||!1,snapshots:e.snapshots||!1,permanence:e.permanence||!1,seek:e.seek||!1,clear:e.clear||!1,status:e.status||!1,createIfMissing:e.createIfMissing||!1,errorIfExists:e.errorIfExists||!1,deferredOpen:e.deferredOpen||!1,openCallback:e.openCallback||!1,promises:e.promises||!1,streams:e.streams||!1,encodings:e.encodings||!1,additionalMethods:a(e.additionalMethods)})}},(e,t,r)=>{var a=e.exports.all=[{errno:-2,code:"ENOENT",description:"no such file or directory"},{errno:-1,code:"UNKNOWN",description:"unknown error"},{errno:0,code:"OK",description:"success"},{errno:1,code:"EOF",description:"end of file"},{errno:2,code:"EADDRINFO",description:"getaddrinfo error"},{errno:3,code:"EACCES",description:"permission denied"},{errno:4,code:"EAGAIN",description:"resource temporarily unavailable"},{errno:5,code:"EADDRINUSE",description:"address already in use"},{errno:6,code:"EADDRNOTAVAIL",description:"address not available"},{errno:7,code:"EAFNOSUPPORT",description:"address family not supported"},{errno:8,code:"EALREADY",description:"connection already in progress"},{errno:9,code:"EBADF",description:"bad file descriptor"},{errno:10,code:"EBUSY",description:"resource busy or locked"},{errno:11,code:"ECONNABORTED",description:"software caused connection abort"},{errno:12,code:"ECONNREFUSED",description:"connection refused"},{errno:13,code:"ECONNRESET",description:"connection reset by peer"},{errno:14,code:"EDESTADDRREQ",description:"destination address required"},{errno:15,code:"EFAULT",description:"bad address in system call argument"},{errno:16,code:"EHOSTUNREACH",description:"host is unreachable"},{errno:17,code:"EINTR",description:"interrupted system call"},{errno:18,code:"EINVAL",description:"invalid argument"},{errno:19,code:"EISCONN",description:"socket is already connected"},{errno:20,code:"EMFILE",description:"too many open files"},{errno:21,code:"EMSGSIZE",description:"message too long"},{errno:22,code:"ENETDOWN",description:"network is down"},{errno:23,code:"ENETUNREACH",description:"network is unreachable"},{errno:24,code:"ENFILE",description:"file table overflow"},{errno:25,code:"ENOBUFS",description:"no buffer space available"},{errno:26,code:"ENOMEM",description:"not enough memory"},{errno:27,code:"ENOTDIR",description:"not a directory"},{errno:28,code:"EISDIR",description:"illegal operation on a directory"},{errno:29,code:"ENONET",description:"machine is not on the network"},{errno:31,code:"ENOTCONN",description:"socket is not connected"},{errno:32,code:"ENOTSOCK",description:"socket operation on non-socket"},{errno:33,code:"ENOTSUP",description:"operation not supported on socket"},{errno:34,code:"ENOENT",description:"no such file or directory"},{errno:35,code:"ENOSYS",description:"function not implemented"},{errno:36,code:"EPIPE",description:"broken pipe"},{errno:37,code:"EPROTO",description:"protocol error"},{errno:38,code:"EPROTONOSUPPORT",description:"protocol not supported"},{errno:39,code:"EPROTOTYPE",description:"protocol wrong type for socket"},{errno:40,code:"ETIMEDOUT",description:"connection timed out"},{errno:41,code:"ECHARSET",description:"invalid Unicode character"},{errno:42,code:"EAIFAMNOSUPPORT",description:"address family for hostname not supported"},{errno:44,code:"EAISERVICE",description:"servname not supported for ai_socktype"},{errno:45,code:"EAISOCKTYPE",description:"ai_socktype not supported"},{errno:46,code:"ESHUTDOWN",description:"cannot send after transport endpoint shutdown"},{errno:47,code:"EEXIST",description:"file already exists"},{errno:48,code:"ESRCH",description:"no such process"},{errno:49,code:"ENAMETOOLONG",description:"name too long"},{errno:50,code:"EPERM",description:"operation not permitted"},{errno:51,code:"ELOOP",description:"too many symbolic links encountered"},{errno:52,code:"EXDEV",description:"cross-device link not permitted"},{errno:53,code:"ENOTEMPTY",description:"directory not empty"},{errno:54,code:"ENOSPC",description:"no space left on device"},{errno:55,code:"EIO",description:"i/o error"},{errno:56,code:"EROFS",description:"read-only file system"},{errno:57,code:"ENODEV",description:"no such device"},{errno:58,code:"ESPIPE",description:"invalid seek"},{errno:59,code:"ECANCELED",description:"operation canceled"}];e.exports.errno={},e.exports.code={},a.forEach((function(t){e.exports.errno[t.errno]=t,e.exports.code[t.code]=t})),e.exports.custom=r(1015)(e.exports),e.exports.create=e.exports.custom.createError},(e,t,r)=>{var a=r(0).Buffer;function isDef(e){return void 0!==e&&""!==e}function has(e,t){return Object.hasOwnProperty.call(e,t)}function hasKey(e,t){return Object.hasOwnProperty.call(e,t)&&t}t.compare=function(e,t){if(a.isBuffer(e)){for(var r=Math.min(e.length,t.length),n=0;nt?1:0};var n=t.lowerBoundKey=function(e){return hasKey(e,"gt")||hasKey(e,"gte")||hasKey(e,"min")||(e.reverse?hasKey(e,"end"):hasKey(e,"start"))||void 0},o=t.lowerBound=function(e,t){var r=n(e);return r?e[r]:t},s=t.lowerBoundInclusive=function(e){return!has(e,"gt")},c=t.upperBoundInclusive=function(e){return!has(e,"lt")},d=t.lowerBoundExclusive=function(e){return!s(e)},u=t.upperBoundExclusive=function(e){return!c(e)},h=t.upperBoundKey=function(e){return hasKey(e,"lt")||hasKey(e,"lte")||hasKey(e,"max")||(e.reverse?hasKey(e,"start"):hasKey(e,"end"))||void 0},l=t.upperBound=function(e,t){var r=h(e);return r?e[r]:t};function id(e){return e}t.start=function(e,t){return e.reverse?l(e,t):o(e,t)},t.end=function(e,t){return e.reverse?o(e,t):l(e,t)},t.startInclusive=function(e){return e.reverse?c(e):s(e)},t.endInclusive=function(e){return e.reverse?s(e):c(e)},t.toLtgt=function(e,r,a,n,o){r=r||{},a=a||id;var s=arguments.length>3,c=t.lowerBoundKey(e),d=t.upperBoundKey(e);return c?"gt"===c?r.gt=a(e.gt,!1):r.gte=a(e[c],!1):s&&(r.gte=a(n,!1)),d?"lt"===d?r.lt=a(e.lt,!0):r.lte=a(e[d],!0):s&&(r.lte=a(o,!0)),null!=e.reverse&&(r.reverse=!!e.reverse),has(r,"max")&&delete r.max,has(r,"min")&&delete r.min,has(r,"start")&&delete r.start,has(r,"end")&&delete r.end,r},t.contains=function(e,r,a){a=a||t.compare;var n=o(e);if(isDef(n)&&((s=a(r,n))<0||0===s&&d(e)))return!1;var s,c=l(e);if(isDef(c)&&((s=a(r,c))>0||0===s&&u(e)))return!1;return!0},t.filter=function(e,r){return function(a){return t.contains(e,a,r)}}},function(e,t,r){"use strict";var a,n,o=this&&this.__classPrivateFieldSet||function(e,t,r){if(!t.has(e))throw new TypeError("attempted to set private field on non-instance");return t.set(e,r),r},s=this&&this.__classPrivateFieldGet||function(e,t){if(!t.has(e))throw new TypeError("attempted to get private field on non-instance");return t.get(e)};Object.defineProperty(t,"__esModule",{value:!0}),t.OptionsConfig=void 0;const c=r(8),checkForConflicts=(e,t,r,a)=>{if(a)for(const n of a)if(r.has(n))throw new Error(`Values for both "${t}.${e}" and "${t}.${n}" cannot be specified; they are mutually exclusive.`)};t.OptionsConfig=class OptionsConfig{constructor(e){a.set(this,void 0),n.set(this,void 0),o(this,a,e),o(this,n,Object.keys(e))}normalize(e){const t=s(this,a),r={};return s(this,n).forEach((a=>{!function fill(e,t,r,a){const n=e[a],o=r[a]=r[a]||{},s=t.flavor,d=new Set,u=Object.keys(n);if(c.hasOwn(t,a)){const e=t[a];for(let r=0,h=u.length;r{var a=r(2).Buffer;function isDef(e){return void 0!==e&&""!==e}function has(e,t){return Object.hasOwnProperty.call(e,t)}function hasKey(e,t){return Object.hasOwnProperty.call(e,t)&&t}t.compare=function(e,t){if(a.isBuffer(e)){for(var r=Math.min(e.length,t.length),n=0;nt?1:0};var n=t.lowerBoundKey=function(e){return hasKey(e,"gt")||hasKey(e,"gte")||hasKey(e,"min")||(e.reverse?hasKey(e,"end"):hasKey(e,"start"))||void 0},o=t.lowerBound=function(e,t){var r=n(e);return r?e[r]:t},s=t.lowerBoundInclusive=function(e){return!has(e,"gt")},c=t.upperBoundInclusive=function(e){return!has(e,"lt")},d=t.lowerBoundExclusive=function(e){return!s(e)},u=t.upperBoundExclusive=function(e){return!c(e)},h=t.upperBoundKey=function(e){return hasKey(e,"lt")||hasKey(e,"lte")||hasKey(e,"max")||(e.reverse?hasKey(e,"start"):hasKey(e,"end"))||void 0},l=t.upperBound=function(e,t){var r=h(e);return r?e[r]:t};function id(e){return e}t.start=function(e,t){return e.reverse?l(e,t):o(e,t)},t.end=function(e,t){return e.reverse?o(e,t):l(e,t)},t.startInclusive=function(e){return e.reverse?c(e):s(e)},t.endInclusive=function(e){return e.reverse?s(e):c(e)},t.toLtgt=function(e,r,a,n,o){r=r||{},a=a||id;var s=arguments.length>3,c=t.lowerBoundKey(e),d=t.upperBoundKey(e);return c?"gt"===c?r.gt=a(e.gt,!1):r.gte=a(e[c],!1):s&&(r.gte=a(n,!1)),d?"lt"===d?r.lt=a(e.lt,!0):r.lte=a(e[d],!0):s&&(r.lte=a(o,!0)),null!=e.reverse&&(r.reverse=!!e.reverse),has(r,"max")&&delete r.max,has(r,"min")&&delete r.min,has(r,"start")&&delete r.start,has(r,"end")&&delete r.end,r},t.contains=function(e,r,a){a=a||t.compare;var n=o(e);if(isDef(n)&&((s=a(r,n))<0||0===s&&d(e)))return!1;var s,c=l(e);if(isDef(c)&&((s=a(r,c))>0||0===s&&u(e)))return!1;return!0},t.filter=function(e,r){return function(a){return t.contains(e,a,r)}}},function(e,t,r){"use strict";var a=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],a=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&a>=e.length&&(e=void 0),{value:e&&e[a++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.chains=t._getInitializedChains=void 0;var o=n(r(1406)),s=n(r(1407)),c=n(r(1408)),d=n(r(1409)),u=n(r(1410)),h=n(r(1411));function _getInitializedChains(e){var t,r,n={1:"mainnet",3:"ropsten",4:"rinkeby",42:"kovan",5:"goerli",123:"calaveras"},l={mainnet:o.default,ropsten:s.default,rinkeby:c.default,kovan:d.default,goerli:u.default,calaveras:h.default};if(e)try{for(var b=a(e),g=b.next();!g.done;g=b.next()){var p=g.value,B=p.name;n[p.chainId.toString()]=B,l[B]=p}}catch(e){t={error:e}}finally{try{g&&!g.done&&(r=b.return)&&r.call(b)}finally{if(t)throw t.error}}return l.names=n,l}t._getInitializedChains=_getInitializedChains,t.chains=_getInitializedChains()},(e,t,r)=>{var a,n,o,s=r(1071),c=r(104),d=r(119),u=r(169),h=r(120),l=r(390),b=r(397),g=r(292),p="Object already initialized",B=c.WeakMap;if(s||l.state){var m=l.state||(l.state=new B),I=m.get,y=m.has,v=m.set;a=function(e,t){if(y.call(m,e))throw new TypeError(p);return t.facade=e,v.call(m,e,t),t},n=function(e){return I.call(m,e)||{}},o=function(e){return y.call(m,e)}}else{var x=b("state");g[x]=!0,a=function(e,t){if(h(e,x))throw new TypeError(p);return t.facade=e,u(e,x,t),t},n=function(e){return h(e,x)?e[x]:{}},o=function(e){return h(e,x)}}e.exports={set:a,get:n,has:o,enforce:function(e){return o(e)?n(e):a(e,{})},getterFor:function(e){return function(t){var r;if(!d(t)||(r=n(t)).type!==e)throw TypeError("Incompatible receiver, "+e+" required");return r}}}},(e,t,r)=>{var a=r(392),n=r(104),aFunction=function(e){return"function"==typeof e?e:void 0};e.exports=function(e,t){return arguments.length<2?aFunction(a[e])||aFunction(n[e]):a[e]&&a[e][t]||n[e]&&n[e][t]}},e=>{e.exports={}},(e,t,r)=>{var a=r(1079);e.exports=function(e,t,r){if(a(e),void 0===t)return e;switch(r){case 0:return function(){return e.call(t)};case 1:return function(r){return e.call(t,r)};case 2:return function(r,a){return e.call(t,r,a)};case 3:return function(r,a,n){return e.call(t,r,a,n)}}return function(){return e.apply(t,arguments)}}},function(e,t,r){"use strict";var a=r(0).Buffer,n=this&&this.__awaiter||function(e,t,r,a){return new(r||(r=Promise))((function(n,o){function fulfilled(e){try{step(a.next(e))}catch(e){o(e)}}function rejected(e){try{step(a.throw(e))}catch(e){o(e)}}function step(e){e.done?n(e.value):function adopt(e){return e instanceof r?e:new r((function(t){t(e)}))}(e.value).then(fulfilled,rejected)}step((a=a.apply(e,t||[])).next())}))},o=this&&this.__generator||function(e,t){var r,a,n,o,s={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return o={next:verb(0),throw:verb(1),return:verb(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function verb(o){return function(c){return function step(o){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,a&&(n=2&o[0]?a.return:o[0]?a.throw||((n=a.return)&&n.call(a),0):a.next)&&!(n=n.call(a,o[1])).done)return n;switch(a=0,n&&(o=[2&o[0],n.value]),o[0]){case 0:case 1:n=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,a=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(n=s.trys,(n=n.length>0&&n[n.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!n||o[1]>n[0]&&o[1]0&&n[n.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!n||o[1]>n[0]&&o[1]0&&n[n.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!n||o[1]>n[0]&&o[1]0&&n[n.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!n||o[1]>n[0]&&o[1]0&&n[n.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!n||o[1]>n[0]&&o[1]0&&n[n.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!n||o[1]>n[0]&&o[1]0&&n[n.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!n||o[1]>n[0]&&o[1]0&&n[n.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!n||o[1]>n[0]&&o[1]0&&n[n.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!n||o[1]>n[0]&&o[1]>3,d=1<>3,u=1<0&&n[n.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!n||o[1]>n[0]&&o[1]{"use strict";var a=r(0).Buffer;Object.defineProperty(t,"__esModule",{value:!0}),t.updateSstoreGas=t.writeCallOutput=t.subMemUsage=t.maxCallGas=t.jumpSubIsValid=t.jumpIsValid=t.getFullname=t.getDataSlice=t.getContractStorage=t.short=t.divCeil=t.describeLocation=t.addressToBuffer=t.trap=t.setLengthLeftStorage=void 0;const n=r(5),o=r(28),s=r(686),c=new n.BN(1).shln(160).subn(1);function setLengthLeftStorage(e){return e.equals(a.alloc(e.length,0))?a.alloc(0):n.setLengthLeft(e,32)}function divCeil(e,t){const r=e.div(t);return e.mod(t).isZero()?r:r.isNeg()?r.isubn(1):r.iaddn(1)}function getDataSlice(e,t,r){const a=new n.BN(e.length);t.gt(a)&&(t=a);let o=t.add(r);return o.gt(a)&&(o=a),e=e.slice(t.toNumber(),o.toNumber()),e=n.setLengthRight(e,r.toNumber())}t.setLengthLeftStorage=setLengthLeftStorage,t.trap=function trap(e){throw new o.VmError(e)},t.addressToBuffer=function addressToBuffer(e){return a.isBuffer(e)?e:e.and(c).toArrayLike(a,"be",20)},t.describeLocation=function describeLocation(e){return`${n.keccak256(e.eei.getCode()).toString("hex")}/${e.eei.getAddress().buf.toString("hex")}:${e.programCounter-1}`},t.divCeil=divCeil,t.short=function short(e){const t=e.toString("hex");return t.length<=50?t:t.slice(0,50)+"..."},t.getContractStorage=async function getContractStorage(e,t,r){const a=setLengthLeftStorage(await e.stateManager.getContractStorage(t,r));if("constantinople"===e._common.hardfork()||e._common.gteHardfork("istanbul")){return{current:a,original:setLengthLeftStorage(await e.stateManager.getOriginalContractStorage(t,r))}}return a},t.getDataSlice=getDataSlice,t.getFullname=function getFullname(e,t){switch(t){case"LOG":t+=e-160;break;case"PUSH":t+=e-95;break;case"DUP":t+=e-127;break;case"SWAP":t+=e-143}return t},t.jumpIsValid=function jumpIsValid(e,t){return-1!==e.validJumps.indexOf(t)},t.jumpSubIsValid=function jumpSubIsValid(e,t){return-1!==e.validJumpSubs.indexOf(t)},t.maxCallGas=function maxCallGas(e,t,r){if(r._common.gteHardfork("tangerineWhistle")){const r=t.sub(t.divn(64));return e.gt(r)?r:e}return e},t.subMemUsage=function subMemUsage(e,t,r){if(r.isZero())return;const a=divCeil(t.add(r),new n.BN(32));if(a.lte(e.memoryWordCount))return;const o=a,s=new n.BN(e._common.param("gasPrices","memory")),c=new n.BN(e._common.param("gasPrices","quadCoeffDiv")),d=o.mul(s).add(o.mul(o).div(c));d.gt(e.highestMemCost)&&(e.eei.useGas(d.sub(e.highestMemCost),"subMemUsage"),e.highestMemCost=d),e.memoryWordCount=a},t.writeCallOutput=function writeCallOutput(e,t,r){const a=e.eei.getReturnData();if(a.length>0){const o=t.toNumber();let s=r.toNumber();a.lengthe.length+t.length}),n){const e={"user-agent":o};d&&(e.origin=d),n.password=n.username="";const t=n.host.endsWith(".infura.io");BaseHandler.setAuthHeaders(r,e),BaseHandler.setUserHeaders(r,e,!t),this.headers=e}}static setAuthHeaders(e,t){if(null!=e.username||null!=e.password){if(null!=e.jwt)throw new Error("Authentication via both username/password (Basic) and JWT (Bearer) is not possible");t.authorization=`Basic ${a.from(`${e.username||""}:${e.password||""}`).toString("base64")}`}else e.jwt&&(t.authorization=`Bearer ${e.jwt}`)}static setUserHeaders(e,t,r){const a=e.headers;if(a)for(let e=0,n=a.length;e{if(this.abortSignal.aborted)return Promise.reject(new d.AbortError);if(o.hasOwn(t,"result"))return this.valueCache.set(e,r),t.result;if(o.hasOwn(t,"error")&&null!=t.error){const{error:e}=t;throw new d.CodedError(e.message,e.code)}throw new Error(`Invalid response from fork provider: \`${JSON.stringify(t)}\``)}));return this.requestCache.set(e,a),await a}}t.BaseHandler=BaseHandler,BaseHandler.JSONRPC_PREFIX='{"jsonrpc":"2.0","id":'},(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.normalize=void 0;t.normalize=e=>e},(e,t,r)=>{"use strict";var a=r(1176),n="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),o=Object.prototype.toString,s=Array.prototype.concat,c=Object.defineProperty,d=c&&function(){var e={};try{for(var t in c(e,"x",{enumerable:!1,value:e}),e)return!1;return e.x===e}catch(e){return!1}}(),defineProperty=function(e,t,r,a){var n;(!(t in e)||"function"==typeof(n=a)&&"[object Function]"===o.call(n)&&a())&&(d?c(e,t,{configurable:!0,enumerable:!1,value:r,writable:!0}):e[t]=r)},defineProperties=function(e,t){var r=arguments.length>2?arguments[2]:{},o=a(t);n&&(o=s.call(o,Object.getOwnPropertySymbols(t)));for(var c=0;c{"use strict";e.exports=function requirePromise(){if("function"!=typeof Promise)throw new TypeError("`Promise.allSettled` requires a global `Promise` be available.")}},(e,t,r)=>{"use strict";var a=r(417);e.exports=function hasToStringTagShams(){return a()&&!!Symbol.toStringTag}},function(e,t,r){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.provider=t.server=t._DefaultServerOptions=t.ServerStatus=t.Server=void 0;const n=a(r(720)),o=a(r(153));var s=r(153);Object.defineProperty(t,"Server",{enumerable:!0,get:function(){return s.Server}}),Object.defineProperty(t,"ServerStatus",{enumerable:!0,get:function(){return s.ServerStatus}}),Object.defineProperty(t,"_DefaultServerOptions",{enumerable:!0,get:function(){return s._DefaultServerOptions}});const c={server:e=>new o.default(e),provider:e=>n.default.initialize(e).connector.provider};t.server=c.server,t.provider=c.provider,t.default=c},(e,t,r)=>{"use strict";var a,n=r(1);e.exports=Readable,Readable.ReadableState=ReadableState;r(32).EventEmitter;var o=function EElistenerCount(e,t){return e.listeners(t).length},s=r(729),c=r(2).Buffer,d=r.g.Uint8Array||function(){};var u,h=r(85);u=h&&h.debuglog?h.debuglog("stream"):function debug(){};var l,b,g,p=r(730),B=r(425),m=r(426).getHighWaterMark,I=r(231).a,y=I.ERR_INVALID_ARG_TYPE,v=I.ERR_STREAM_PUSH_AFTER_EOF,x=I.ERR_METHOD_NOT_IMPLEMENTED,C=I.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;r(10)(Readable,s);var Q=B.errorOrDestroy,w=["error","close","destroy","pause","resume"];function ReadableState(e,t,n){a=a||r(155),e=e||{},"boolean"!=typeof n&&(n=t instanceof a),this.objectMode=!!e.objectMode,n&&(this.objectMode=this.objectMode||!!e.readableObjectMode),this.highWaterMark=m(this,e,"readableHighWaterMark",n),this.buffer=new p,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&&(l||(l=r(427).a),this.decoder=new l(e.encoding),this.encoding=e.encoding)}function Readable(e){if(a=a||r(155),!(this instanceof Readable))return new Readable(e);var t=this instanceof a;this._readableState=new ReadableState(e,this,t),this.readable=!0,e&&("function"==typeof e.read&&(this._read=e.read),"function"==typeof e.destroy&&(this._destroy=e.destroy)),s.call(this)}function readableAddChunk(e,t,r,a,n){u("readableAddChunk",t);var o,s=e._readableState;if(null===t)s.reading=!1,function onEofChunk(e,t){if(u("onEofChunk"),t.ended)return;if(t.decoder){var r=t.decoder.end();r&&r.length&&(t.buffer.push(r),t.length+=t.objectMode?1:r.length)}t.ended=!0,t.sync?emitReadable(e):(t.needReadable=!1,t.emittedReadable||(t.emittedReadable=!0,emitReadable_(e)))}(e,s);else if(n||(o=function chunkInvalid(e,t){var r;(function _isUint8Array(e){return c.isBuffer(e)||e instanceof d})(t)||"string"==typeof t||void 0===t||e.objectMode||(r=new y("chunk",["string","Buffer","Uint8Array"],t));return r}(s,t)),o)Q(e,o);else if(s.objectMode||t&&t.length>0)if("string"==typeof t||s.objectMode||Object.getPrototypeOf(t)===c.prototype||(t=function _uint8ArrayToBuffer(e){return c.from(e)}(t)),a)s.endEmitted?Q(e,new C):addChunk(e,s,t,!0);else if(s.ended)Q(e,new v);else{if(s.destroyed)return!1;s.reading=!1,s.decoder&&!r?(t=s.decoder.write(t),s.objectMode||0!==t.length?addChunk(e,s,t,!1):maybeReadMore(e,s)):addChunk(e,s,t,!1)}else a||(s.reading=!1,maybeReadMore(e,s));return!s.ended&&(s.lengtht.highWaterMark&&(t.highWaterMark=function computeNewHighWaterMark(e){return e>=_?e=_:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function emitReadable(e){var t=e._readableState;u("emitReadable",t.needReadable,t.emittedReadable),t.needReadable=!1,t.emittedReadable||(u("emitReadable",t.flowing),t.emittedReadable=!0,n.nextTick(emitReadable_,e))}function emitReadable_(e){var t=e._readableState;u("emitReadable_",t.destroyed,t.length,t.ended),t.destroyed||!t.length&&!t.ended||(e.emit("readable"),t.emittedReadable=!1),t.needReadable=!t.flowing&&!t.ended&&t.length<=t.highWaterMark,flow(e)}function maybeReadMore(e,t){t.readingMore||(t.readingMore=!0,n.nextTick(maybeReadMore_,e,t))}function maybeReadMore_(e,t){for(;!t.reading&&!t.ended&&(t.length0,t.resumeScheduled&&!t.paused?t.flowing=!0:e.listenerCount("data")>0&&e.resume()}function nReadingNextTick(e){u("readable nexttick read 0"),e.read(0)}function resume_(e,t){u("resume",t.reading),t.reading||e.read(0),t.resumeScheduled=!1,e.emit("resume"),flow(e),t.flowing&&!t.reading&&e.read(0)}function flow(e){var t=e._readableState;for(u("flow",t.flowing);t.flowing&&null!==e.read(););}function fromList(e,t){return 0===t.length?null:(t.objectMode?r=t.buffer.shift():!e||e>=t.length?(r=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.first():t.buffer.concat(t.length),t.buffer.clear()):r=t.buffer.consume(e,t.decoder),r);var r}function endReadable(e){var t=e._readableState;u("endReadable",t.endEmitted),t.endEmitted||(t.ended=!0,n.nextTick(endReadableNT,t,e))}function endReadableNT(e,t){if(u("endReadableNT",e.endEmitted,e.length),!e.endEmitted&&0===e.length&&(e.endEmitted=!0,t.readable=!1,t.emit("end"),e.autoDestroy)){var r=t._writableState;(!r||r.autoDestroy&&r.finished)&&t.destroy()}}function indexOf(e,t){for(var r=0,a=e.length;r=t.highWaterMark:t.length>0)||t.ended))return u("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?endReadable(this):emitReadable(this),null;if(0===(e=howMuchToRead(e,t))&&t.ended)return 0===t.length&&endReadable(this),null;var a,n=t.needReadable;return u("need readable",n),(0===t.length||t.length-e0?fromList(e,t):null)?(t.needReadable=t.length<=t.highWaterMark,e=0):(t.length-=e,t.awaitDrain=0),0===t.length&&(t.ended||(t.needReadable=!0),r!==e&&t.ended&&endReadable(this)),null!==a&&this.emit("data",a),a},Readable.prototype._read=function(e){Q(this,new x("_read()"))},Readable.prototype.pipe=function(e,t){var r=this,a=this._readableState;switch(a.pipesCount){case 0:a.pipes=e;break;case 1:a.pipes=[a.pipes,e];break;default:a.pipes.push(e)}a.pipesCount+=1,u("pipe count=%d opts=%j",a.pipesCount,t);var s=(!t||!1!==t.end)&&e!==n.stdout&&e!==n.stderr?onend:unpipe;function onunpipe(t,n){u("onunpipe"),t===r&&n&&!1===n.hasUnpiped&&(n.hasUnpiped=!0,function cleanup(){u("cleanup"),e.removeListener("close",onclose),e.removeListener("finish",onfinish),e.removeListener("drain",c),e.removeListener("error",onerror),e.removeListener("unpipe",onunpipe),r.removeListener("end",onend),r.removeListener("end",unpipe),r.removeListener("data",ondata),d=!0,!a.awaitDrain||e._writableState&&!e._writableState.needDrain||c()}())}function onend(){u("onend"),e.end()}a.endEmitted?n.nextTick(s):r.once("end",s),e.on("unpipe",onunpipe);var c=function pipeOnDrain(e){return function pipeOnDrainFunctionResult(){var t=e._readableState;u("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&o(e,"data")&&(t.flowing=!0,flow(e))}}(r);e.on("drain",c);var d=!1;function ondata(t){u("ondata");var n=e.write(t);u("dest.write",n),!1===n&&((1===a.pipesCount&&a.pipes===e||a.pipesCount>1&&-1!==indexOf(a.pipes,e))&&!d&&(u("false write response, pause",a.awaitDrain),a.awaitDrain++),r.pause())}function onerror(t){u("onerror",t),unpipe(),e.removeListener("error",onerror),0===o(e,"error")&&Q(e,t)}function onclose(){e.removeListener("finish",onfinish),unpipe()}function onfinish(){u("onfinish"),e.removeListener("close",onclose),unpipe()}function unpipe(){u("unpipe"),r.unpipe(e)}return r.on("data",ondata),function prependListener(e,t,r){if("function"==typeof e.prependListener)return e.prependListener(t,r);e._events&&e._events[t]?Array.isArray(e._events[t])?e._events[t].unshift(r):e._events[t]=[r,e._events[t]]:e.on(t,r)}(e,"error",onerror),e.once("close",onclose),e.once("finish",onfinish),e.emit("pipe",r),a.flowing||(u("pipe resume"),r.resume()),e},Readable.prototype.unpipe=function(e){var t=this._readableState,r={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes||(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,r)),this;if(!e){var a=t.pipes,n=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var o=0;o0,!1!==a.flowing&&this.resume()):"readable"===e&&(a.endEmitted||a.readableListening||(a.readableListening=a.needReadable=!0,a.flowing=!1,a.emittedReadable=!1,u("on readable",a.length,a.reading),a.length?emitReadable(this):a.reading||n.nextTick(nReadingNextTick,this))),r},Readable.prototype.addListener=Readable.prototype.on,Readable.prototype.removeListener=function(e,t){var r=s.prototype.removeListener.call(this,e,t);return"readable"===e&&n.nextTick(updateReadableListening,this),r},Readable.prototype.removeAllListeners=function(e){var t=s.prototype.removeAllListeners.apply(this,arguments);return"readable"!==e&&void 0!==e||n.nextTick(updateReadableListening,this),t},Readable.prototype.resume=function(){var e=this._readableState;return e.flowing||(u("resume"),e.flowing=!e.readableListening,function resume(e,t){t.resumeScheduled||(t.resumeScheduled=!0,n.nextTick(resume_,e,t))}(this,e)),e.paused=!1,this},Readable.prototype.pause=function(){return u("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(u("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},Readable.prototype.wrap=function(e){var t=this,r=this._readableState,a=!1;for(var n in e.on("end",(function(){if(u("wrapped end"),r.decoder&&!r.ended){var e=r.decoder.end();e&&e.length&&t.push(e)}t.push(null)})),e.on("data",(function(n){(u("wrapped data"),r.decoder&&(n=r.decoder.write(n)),r.objectMode&&null==n)||(r.objectMode||n&&n.length)&&(t.push(n)||(a=!0,e.pause()))})),e)void 0===this[n]&&"function"==typeof e[n]&&(this[n]=function methodWrap(t){return function methodWrapReturnFunction(){return e[t].apply(e,arguments)}}(n));for(var o=0;o{"use strict";var a,n=r(1);function CorkedRequest(e){var t=this;this.next=null,this.entry=null,this.finish=function(){!function onCorkedFinish(e,t,r){var a=e.entry;e.entry=null;for(;a;){var n=a.callback;t.pendingcb--,n(r),a=a.next}t.corkedRequestsFree.next=e}(t,e)}}e.exports=Writable,Writable.WritableState=WritableState;var o={deprecate:r(731)},s=r(729),c=r(2).Buffer,d=r.g.Uint8Array||function(){};var u,h=r(425),l=r(426).getHighWaterMark,b=r(231).a,g=b.ERR_INVALID_ARG_TYPE,p=b.ERR_METHOD_NOT_IMPLEMENTED,B=b.ERR_MULTIPLE_CALLBACK,m=b.ERR_STREAM_CANNOT_PIPE,I=b.ERR_STREAM_DESTROYED,y=b.ERR_STREAM_NULL_VALUES,v=b.ERR_STREAM_WRITE_AFTER_END,x=b.ERR_UNKNOWN_ENCODING,C=h.errorOrDestroy;function nop(){}function WritableState(e,t,o){a=a||r(155),e=e||{},"boolean"!=typeof o&&(o=t instanceof a),this.objectMode=!!e.objectMode,o&&(this.objectMode=this.objectMode||!!e.writableObjectMode),this.highWaterMark=l(this,e,"writableHighWaterMark",o),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var s=!1===e.decodeStrings;this.decodeStrings=!s,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 onwrite(e,t){var r=e._writableState,a=r.sync,o=r.writecb;if("function"!=typeof o)throw new B;if(function onwriteStateUpdate(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}(r),t)!function onwriteError(e,t,r,a,o){--t.pendingcb,r?(n.nextTick(o,a),n.nextTick(finishMaybe,e,t),e._writableState.errorEmitted=!0,C(e,a)):(o(a),e._writableState.errorEmitted=!0,C(e,a),finishMaybe(e,t))}(e,r,a,t,o);else{var s=needFinish(r)||e.destroyed;s||r.corked||r.bufferProcessing||!r.bufferedRequest||clearBuffer(e,r),a?n.nextTick(afterWrite,e,r,s,o):afterWrite(e,r,s,o)}}(t,e)},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 CorkedRequest(this)}function Writable(e){var t=this instanceof(a=a||r(155));if(!t&&!u.call(Writable,this))return new Writable(e);this._writableState=new WritableState(e,this,t),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),s.call(this)}function doWrite(e,t,r,a,n,o,s){t.writelen=a,t.writecb=s,t.writing=!0,t.sync=!0,t.destroyed?t.onwrite(new I("write")):r?e._writev(n,t.onwrite):e._write(n,o,t.onwrite),t.sync=!1}function afterWrite(e,t,r,a){r||function onwriteDrain(e,t){0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}(e,t),t.pendingcb--,a(),finishMaybe(e,t)}function clearBuffer(e,t){t.bufferProcessing=!0;var r=t.bufferedRequest;if(e._writev&&r&&r.next){var a=t.bufferedRequestCount,n=new Array(a),o=t.corkedRequestsFree;o.entry=r;for(var s=0,c=!0;r;)n[s]=r,r.isBuf||(c=!1),r=r.next,s+=1;n.allBuffers=c,doWrite(e,t,!0,t.length,n,"",o.finish),t.pendingcb++,t.lastBufferedRequest=null,o.next?(t.corkedRequestsFree=o.next,o.next=null):t.corkedRequestsFree=new CorkedRequest(t),t.bufferedRequestCount=0}else{for(;r;){var d=r.chunk,u=r.encoding,h=r.callback;if(doWrite(e,t,!1,t.objectMode?1:d.length,d,u,h),r=r.next,t.bufferedRequestCount--,t.writing)break}null===r&&(t.lastBufferedRequest=null)}t.bufferedRequest=r,t.bufferProcessing=!1}function needFinish(e){return e.ending&&0===e.length&&null===e.bufferedRequest&&!e.finished&&!e.writing}function callFinal(e,t){e._final((function(r){t.pendingcb--,r&&C(e,r),t.prefinished=!0,e.emit("prefinish"),finishMaybe(e,t)}))}function finishMaybe(e,t){var r=needFinish(t);if(r&&(function prefinish(e,t){t.prefinished||t.finalCalled||("function"!=typeof e._final||t.destroyed?(t.prefinished=!0,e.emit("prefinish")):(t.pendingcb++,t.finalCalled=!0,n.nextTick(callFinal,e,t)))}(e,t),0===t.pendingcb&&(t.finished=!0,e.emit("finish"),t.autoDestroy))){var a=e._readableState;(!a||a.autoDestroy&&a.endEmitted)&&e.destroy()}return r}r(10)(Writable,s),WritableState.prototype.getBuffer=function getBuffer(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},function(){try{Object.defineProperty(WritableState.prototype,"buffer",{get:o.deprecate((function writableStateBufferGetter(){return this.getBuffer()}),"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(e){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(u=Function.prototype[Symbol.hasInstance],Object.defineProperty(Writable,Symbol.hasInstance,{value:function value(e){return!!u.call(this,e)||this===Writable&&(e&&e._writableState instanceof WritableState)}})):u=function realHasInstance(e){return e instanceof this},Writable.prototype.pipe=function(){C(this,new m)},Writable.prototype.write=function(e,t,r){var a=this._writableState,o=!1,s=!a.objectMode&&function _isUint8Array(e){return c.isBuffer(e)||e instanceof d}(e);return s&&!c.isBuffer(e)&&(e=function _uint8ArrayToBuffer(e){return c.from(e)}(e)),"function"==typeof t&&(r=t,t=null),s?t="buffer":t||(t=a.defaultEncoding),"function"!=typeof r&&(r=nop),a.ending?function writeAfterEnd(e,t){var r=new v;C(e,r),n.nextTick(t,r)}(this,r):(s||function validChunk(e,t,r,a){var o;return null===r?o=new y:"string"==typeof r||t.objectMode||(o=new g("chunk",["string","Buffer"],r)),!o||(C(e,o),n.nextTick(a,o),!1)}(this,a,e,r))&&(a.pendingcb++,o=function writeOrBuffer(e,t,r,a,n,o){if(!r){var s=function decodeChunk(e,t,r){e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=c.from(t,r));return t}(t,a,n);a!==s&&(r=!0,n="buffer",a=s)}var d=t.objectMode?1:a.length;t.length+=d;var u=t.length-1))throw new x(e);return this._writableState.defaultEncoding=e,this},Object.defineProperty(Writable.prototype,"writableBuffer",{enumerable:!1,get:function get(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(Writable.prototype,"writableHighWaterMark",{enumerable:!1,get:function get(){return this._writableState.highWaterMark}}),Writable.prototype._write=function(e,t,r){r(new p("_write()"))},Writable.prototype._writev=null,Writable.prototype.end=function(e,t,r){var a=this._writableState;return"function"==typeof e?(r=e,e=null,t=null):"function"==typeof t&&(r=t,t=null),null!=e&&this.write(e,t),a.corked&&(a.corked=1,this.uncork()),a.ending||function endWritable(e,t,r){t.ending=!0,finishMaybe(e,t),r&&(t.finished?n.nextTick(r):e.once("finish",r));t.ended=!0,e.writable=!1}(this,a,r),this},Object.defineProperty(Writable.prototype,"writableLength",{enumerable:!1,get:function get(){return this._writableState.length}}),Object.defineProperty(Writable.prototype,"destroyed",{enumerable:!1,get:function get(){return void 0!==this._writableState&&this._writableState.destroyed},set:function set(e){this._writableState&&(this._writableState.destroyed=e)}}),Writable.prototype.destroy=h.destroy,Writable.prototype._undestroy=h.undestroy,Writable.prototype._destroy=function(e,t){t(e)}},(e,t,r)=>{"use strict";e.exports=Transform;var a=r(231).a,n=a.ERR_METHOD_NOT_IMPLEMENTED,o=a.ERR_MULTIPLE_CALLBACK,s=a.ERR_TRANSFORM_ALREADY_TRANSFORMING,c=a.ERR_TRANSFORM_WITH_LENGTH_0,d=r(155);function afterTransform(e,t){var r=this._transformState;r.transforming=!1;var a=r.writecb;if(null===a)return this.emit("error",new o);r.writechunk=null,r.writecb=null,null!=t&&this.push(t),a(e);var n=this._readableState;n.reading=!1,(n.needReadable||n.length=l;)e/=2,t/=2,r>>>=1;return(e+r)/t};return prng.int32=function(){return 0|g.g(4)},prng.quick=function(){return g.g(4)/4294967296},prng.double=prng,mixkey(tostring(g.S),o),(t.pass||r||function(e,t,r,a){return a&&(a.S&©(a,g),e.state=function(){return copy(g,{})}),r?(s.random=e,t):e})(prng,b,"global"in t?t.global:this==s,t.state)}function ARC4(e){var t,r=e.length,a=this,n=0,o=a.i=a.j=0,s=a.S=[];for(r||(e=[r++]);n{var a=r(1235),n=r(1242),o=r(738);t.createCipher=t.Cipher=a.createCipher,t.createCipheriv=t.Cipheriv=a.createCipheriv,t.createDecipher=t.Decipher=n.createDecipher,t.createDecipheriv=t.Decipheriv=n.createDecipheriv,t.listCiphers=t.getCiphers=function getCiphers(){return Object.keys(o)}},(e,t,r)=>{var a={ECB:r(1236),CBC:r(1237),CFB:r(1238),CFB8:r(1239),CFB1:r(1240),OFB:r(1241),CTR:r(737),GCM:r(737)},n=r(738);for(var o in n)n[o].module=a[n[o].mode];e.exports=n},(e,t,r)=>{var a=r(11).Buffer;function asUInt32Array(e){a.isBuffer(e)||(e=a.from(e));for(var t=e.length/4|0,r=new Array(t),n=0;n>>24]^h[p>>>16&255]^l[B>>>8&255]^b[255&m]^t[I++],s=u[p>>>24]^h[B>>>16&255]^l[m>>>8&255]^b[255&g]^t[I++],c=u[B>>>24]^h[m>>>16&255]^l[g>>>8&255]^b[255&p]^t[I++],d=u[m>>>24]^h[g>>>16&255]^l[p>>>8&255]^b[255&B]^t[I++],g=o,p=s,B=c,m=d;return o=(a[g>>>24]<<24|a[p>>>16&255]<<16|a[B>>>8&255]<<8|a[255&m])^t[I++],s=(a[p>>>24]<<24|a[B>>>16&255]<<16|a[m>>>8&255]<<8|a[255&g])^t[I++],c=(a[B>>>24]<<24|a[m>>>16&255]<<16|a[g>>>8&255]<<8|a[255&p])^t[I++],d=(a[m>>>24]<<24|a[g>>>16&255]<<16|a[p>>>8&255]<<8|a[255&B])^t[I++],[o>>>=0,s>>>=0,c>>>=0,d>>>=0]}var n=[0,1,2,4,8,16,32,64,128,27,54],o=function(){for(var e=new Array(256),t=0;t<256;t++)e[t]=t<128?t<<1:t<<1^283;for(var r=[],a=[],n=[[],[],[],[]],o=[[],[],[],[]],s=0,c=0,d=0;d<256;++d){var u=c^c<<1^c<<2^c<<3^c<<4;u=u>>>8^255&u^99,r[s]=u,a[u]=s;var h=e[s],l=e[h],b=e[l],g=257*e[u]^16843008*u;n[0][s]=g<<24|g>>>8,n[1][s]=g<<16|g>>>16,n[2][s]=g<<8|g>>>24,n[3][s]=g,g=16843009*b^65537*l^257*h^16843008*s,o[0][u]=g<<24|g>>>8,o[1][u]=g<<16|g>>>16,o[2][u]=g<<8|g>>>24,o[3][u]=g,0===s?s=c=1:(s=h^e[e[e[b^h]]],c^=e[e[c]])}return{SBOX:r,INV_SBOX:a,SUB_MIX:n,INV_SUB_MIX:o}}();function AES(e){this._key=asUInt32Array(e),this._reset()}AES.blockSize=16,AES.keySize=32,AES.prototype.blockSize=AES.blockSize,AES.prototype.keySize=AES.keySize,AES.prototype._reset=function(){for(var e=this._key,t=e.length,r=t+6,a=4*(r+1),s=[],c=0;c>>24,d=o.SBOX[d>>>24]<<24|o.SBOX[d>>>16&255]<<16|o.SBOX[d>>>8&255]<<8|o.SBOX[255&d],d^=n[c/t|0]<<24):t>6&&c%t==4&&(d=o.SBOX[d>>>24]<<24|o.SBOX[d>>>16&255]<<16|o.SBOX[d>>>8&255]<<8|o.SBOX[255&d]),s[c]=s[c-t]^d}for(var u=[],h=0;h>>24]]^o.INV_SUB_MIX[1][o.SBOX[b>>>16&255]]^o.INV_SUB_MIX[2][o.SBOX[b>>>8&255]]^o.INV_SUB_MIX[3][o.SBOX[255&b]]}this._nRounds=r,this._keySchedule=s,this._invKeySchedule=u},AES.prototype.encryptBlockRaw=function(e){return cryptBlock(e=asUInt32Array(e),this._keySchedule,o.SUB_MIX,o.SBOX,this._nRounds)},AES.prototype.encryptBlock=function(e){var t=this.encryptBlockRaw(e),r=a.allocUnsafe(16);return r.writeUInt32BE(t[0],0),r.writeUInt32BE(t[1],4),r.writeUInt32BE(t[2],8),r.writeUInt32BE(t[3],12),r},AES.prototype.decryptBlock=function(e){var t=(e=asUInt32Array(e))[1];e[1]=e[3],e[3]=t;var r=cryptBlock(e,this._invKeySchedule,o.INV_SUB_MIX,o.INV_SBOX,this._nRounds),n=a.allocUnsafe(16);return n.writeUInt32BE(r[0],0),n.writeUInt32BE(r[3],4),n.writeUInt32BE(r[2],8),n.writeUInt32BE(r[1],12),n},AES.prototype.scrub=function(){scrubVec(this._keySchedule),scrubVec(this._invKeySchedule),scrubVec(this._key)},e.exports.AES=AES},(e,t,r)=>{"use strict";var a=r(10),n=r(440),o=r(11).Buffer,s=new Array(16);function MD5(){n.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878}function rotl(e,t){return e<>>32-t}function fnF(e,t,r,a,n,o,s){return rotl(e+(t&r|~t&a)+n+o|0,s)+t|0}function fnG(e,t,r,a,n,o,s){return rotl(e+(t&a|r&~a)+n+o|0,s)+t|0}function fnH(e,t,r,a,n,o,s){return rotl(e+(t^r^a)+n+o|0,s)+t|0}function fnI(e,t,r,a,n,o,s){return rotl(e+(r^(t|~a))+n+o|0,s)+t|0}a(MD5,n),MD5.prototype._update=function(){for(var e=s,t=0;t<16;++t)e[t]=this._block.readInt32LE(4*t);var r=this._a,a=this._b,n=this._c,o=this._d;r=fnF(r,a,n,o,e[0],3614090360,7),o=fnF(o,r,a,n,e[1],3905402710,12),n=fnF(n,o,r,a,e[2],606105819,17),a=fnF(a,n,o,r,e[3],3250441966,22),r=fnF(r,a,n,o,e[4],4118548399,7),o=fnF(o,r,a,n,e[5],1200080426,12),n=fnF(n,o,r,a,e[6],2821735955,17),a=fnF(a,n,o,r,e[7],4249261313,22),r=fnF(r,a,n,o,e[8],1770035416,7),o=fnF(o,r,a,n,e[9],2336552879,12),n=fnF(n,o,r,a,e[10],4294925233,17),a=fnF(a,n,o,r,e[11],2304563134,22),r=fnF(r,a,n,o,e[12],1804603682,7),o=fnF(o,r,a,n,e[13],4254626195,12),n=fnF(n,o,r,a,e[14],2792965006,17),r=fnG(r,a=fnF(a,n,o,r,e[15],1236535329,22),n,o,e[1],4129170786,5),o=fnG(o,r,a,n,e[6],3225465664,9),n=fnG(n,o,r,a,e[11],643717713,14),a=fnG(a,n,o,r,e[0],3921069994,20),r=fnG(r,a,n,o,e[5],3593408605,5),o=fnG(o,r,a,n,e[10],38016083,9),n=fnG(n,o,r,a,e[15],3634488961,14),a=fnG(a,n,o,r,e[4],3889429448,20),r=fnG(r,a,n,o,e[9],568446438,5),o=fnG(o,r,a,n,e[14],3275163606,9),n=fnG(n,o,r,a,e[3],4107603335,14),a=fnG(a,n,o,r,e[8],1163531501,20),r=fnG(r,a,n,o,e[13],2850285829,5),o=fnG(o,r,a,n,e[2],4243563512,9),n=fnG(n,o,r,a,e[7],1735328473,14),r=fnH(r,a=fnG(a,n,o,r,e[12],2368359562,20),n,o,e[5],4294588738,4),o=fnH(o,r,a,n,e[8],2272392833,11),n=fnH(n,o,r,a,e[11],1839030562,16),a=fnH(a,n,o,r,e[14],4259657740,23),r=fnH(r,a,n,o,e[1],2763975236,4),o=fnH(o,r,a,n,e[4],1272893353,11),n=fnH(n,o,r,a,e[7],4139469664,16),a=fnH(a,n,o,r,e[10],3200236656,23),r=fnH(r,a,n,o,e[13],681279174,4),o=fnH(o,r,a,n,e[0],3936430074,11),n=fnH(n,o,r,a,e[3],3572445317,16),a=fnH(a,n,o,r,e[6],76029189,23),r=fnH(r,a,n,o,e[9],3654602809,4),o=fnH(o,r,a,n,e[12],3873151461,11),n=fnH(n,o,r,a,e[15],530742520,16),r=fnI(r,a=fnH(a,n,o,r,e[2],3299628645,23),n,o,e[0],4096336452,6),o=fnI(o,r,a,n,e[7],1126891415,10),n=fnI(n,o,r,a,e[14],2878612391,15),a=fnI(a,n,o,r,e[5],4237533241,21),r=fnI(r,a,n,o,e[12],1700485571,6),o=fnI(o,r,a,n,e[3],2399980690,10),n=fnI(n,o,r,a,e[10],4293915773,15),a=fnI(a,n,o,r,e[1],2240044497,21),r=fnI(r,a,n,o,e[8],1873313359,6),o=fnI(o,r,a,n,e[15],4264355552,10),n=fnI(n,o,r,a,e[6],2734768916,15),a=fnI(a,n,o,r,e[13],1309151649,21),r=fnI(r,a,n,o,e[4],4149444226,6),o=fnI(o,r,a,n,e[11],3174756917,10),n=fnI(n,o,r,a,e[2],718787259,15),a=fnI(a,n,o,r,e[9],3951481745,21),this._a=this._a+r|0,this._b=this._b+a|0,this._c=this._c+n|0,this._d=this._d+o|0},MD5.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 e=o.allocUnsafe(16);return e.writeInt32LE(this._a,0),e.writeInt32LE(this._b,4),e.writeInt32LE(this._c,8),e.writeInt32LE(this._d,12),e},e.exports=MD5},(e,t,r)=>{"use strict";var a=r(2).Buffer,n=r(10),o=r(440),s=new Array(16),c=[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],d=[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],u=[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],h=[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],l=[0,1518500249,1859775393,2400959708,2840853838],b=[1352829926,1548603684,1836072691,2053994217,0];function RIPEMD160(){o.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520}function rotl(e,t){return e<>>32-t}function fn1(e,t,r,a,n,o,s,c){return rotl(e+(t^r^a)+o+s|0,c)+n|0}function fn2(e,t,r,a,n,o,s,c){return rotl(e+(t&r|~t&a)+o+s|0,c)+n|0}function fn3(e,t,r,a,n,o,s,c){return rotl(e+((t|~r)^a)+o+s|0,c)+n|0}function fn4(e,t,r,a,n,o,s,c){return rotl(e+(t&a|r&~a)+o+s|0,c)+n|0}function fn5(e,t,r,a,n,o,s,c){return rotl(e+(t^(r|~a))+o+s|0,c)+n|0}n(RIPEMD160,o),RIPEMD160.prototype._update=function(){for(var e=s,t=0;t<16;++t)e[t]=this._block.readInt32LE(4*t);for(var r=0|this._a,a=0|this._b,n=0|this._c,o=0|this._d,g=0|this._e,p=0|this._a,B=0|this._b,m=0|this._c,I=0|this._d,y=0|this._e,v=0;v<80;v+=1){var x,C;v<16?(x=fn1(r,a,n,o,g,e[c[v]],l[0],u[v]),C=fn5(p,B,m,I,y,e[d[v]],b[0],h[v])):v<32?(x=fn2(r,a,n,o,g,e[c[v]],l[1],u[v]),C=fn4(p,B,m,I,y,e[d[v]],b[1],h[v])):v<48?(x=fn3(r,a,n,o,g,e[c[v]],l[2],u[v]),C=fn3(p,B,m,I,y,e[d[v]],b[2],h[v])):v<64?(x=fn4(r,a,n,o,g,e[c[v]],l[3],u[v]),C=fn2(p,B,m,I,y,e[d[v]],b[3],h[v])):(x=fn5(r,a,n,o,g,e[c[v]],l[4],u[v]),C=fn1(p,B,m,I,y,e[d[v]],b[4],h[v])),r=g,g=o,o=rotl(n,10),n=a,a=x,p=y,y=I,I=rotl(m,10),m=B,B=C}var Q=this._b+n+I|0;this._b=this._c+o+y|0,this._c=this._d+g+p|0,this._d=this._e+r+B|0,this._e=this._a+a+m|0,this._a=Q},RIPEMD160.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 e=a.alloc?a.alloc(20):new a(20);return e.writeInt32LE(this._a,0),e.writeInt32LE(this._b,4),e.writeInt32LE(this._c,8),e.writeInt32LE(this._d,12),e.writeInt32LE(this._e,16),e},e.exports=RIPEMD160},(e,t,r)=>{var a=e.exports=function SHA(e){e=e.toLowerCase();var t=a[e];if(!t)throw new Error(e+" is not supported (we accept pull requests)");return new t};a.sha=r(740),a.sha1=r(741),a.sha224=r(742),a.sha256=r(442),a.sha384=r(743),a.sha512=r(443)},(e,t,r)=>{"use strict";var a=r(67);function Cipher(e){this.options=e,this.type=this.options.type,this.blockSize=8,this._init(),this.buffer=new Array(this.blockSize),this.bufferOff=0}e.exports=Cipher,Cipher.prototype._init=function _init(){},Cipher.prototype.update=function update(e){return 0===e.length?[]:"decrypt"===this.type?this._updateDecrypt(e):this._updateEncrypt(e)},Cipher.prototype._buffer=function _buffer(e,t){for(var r=Math.min(this.buffer.length-this.bufferOff,e.length-t),a=0;a0;a--)t+=this._buffer(e,t),r+=this._flushBuffer(n,r);return t+=this._buffer(e,t),n},Cipher.prototype.final=function final(e){var t,r;return e&&(t=this.update(e)),r="encrypt"===this.type?this._finalEncrypt():this._finalDecrypt(),t?t.concat(r):r},Cipher.prototype._pad=function _pad(e,t){if(0===t)return!1;for(;t{var a;function Rand(e){this.rand=e}if(e.exports=function rand(e){return a||(a=new Rand(null)),a.generate(e)},e.exports.Rand=Rand,Rand.prototype.generate=function generate(e){return this._rand(e)},Rand.prototype._rand=function _rand(e){if(this.rand.getBytes)return this.rand.getBytes(e);for(var t=new Uint8Array(e),r=0;r{var a=r(2).Buffer,n=r(453),o=r(156);function getr(e){var t,r=e.modulus.byteLength();do{t=new n(o(r))}while(t.cmp(e.modulus)>=0||!t.umod(e.prime1)||!t.umod(e.prime2));return t}function crt(e,t){var r=function blind(e){var t=getr(e);return{blinder:t.toRed(n.mont(e.modulus)).redPow(new n(e.publicExponent)).fromRed(),unblinder:t.invm(e.modulus)}}(t),o=t.modulus.byteLength(),s=new n(e).mul(r.blinder).umod(t.modulus),c=s.toRed(n.mont(t.prime1)),d=s.toRed(n.mont(t.prime2)),u=t.coefficient,h=t.prime1,l=t.prime2,b=c.redPow(t.exponent1).fromRed(),g=d.redPow(t.exponent2).fromRed(),p=b.isub(g).imul(u).umod(h).imul(l);return g.iadd(p).imul(r.unblinder).umod(t.modulus).toArrayLike(a,"be",o)}crt.getr=getr,e.exports=crt},(e,t,r)=>{"use strict";var a=t;a.version=r(1251).a,a.utils=r(68),a.rand=r(324),a.curve=r(455),a.curves=r(327),a.ec=r(763),a.eddsa=r(767)},(e,t,r)=>{"use strict";var a,n=t,o=r(328),s=r(455),c=r(68).assert;function PresetCurve(e){"short"===e.type?this.curve=new s.short(e):"edwards"===e.type?this.curve=new s.edwards(e):this.curve=new s.mont(e),this.g=this.curve.g,this.n=this.curve.n,this.hash=e.hash,c(this.g.validate(),"Invalid curve"),c(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function defineCurve(e,t){Object.defineProperty(n,e,{configurable:!0,enumerable:!0,get:function(){var r=new PresetCurve(t);return Object.defineProperty(n,e,{configurable:!0,enumerable:!0,value:r}),r}})}n.PresetCurve=PresetCurve,defineCurve("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:o.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),defineCurve("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:o.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),defineCurve("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:o.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),defineCurve("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:o.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"]}),defineCurve("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:o.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"]}),defineCurve("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:o.sha256,gRed:!1,g:["9"]}),defineCurve("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:o.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});try{a=r(762)}catch(e){a=void 0}defineCurve("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:o.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",a]})},(e,t,r)=>{var a=t;a.utils=r(109),a.common=r(262),a.sha=r(1252),a.ripemd=r(1253),a.hmac=r(761),a.sha1=a.sha.sha1,a.sha256=a.sha.sha256,a.sha224=a.sha.sha224,a.sha384=a.sha.sha384,a.sha512=a.sha.sha512,a.ripemd160=a.ripemd.ripemd160},function(e,t,r){!function(e,t){"use strict";function assert(e,t){if(!e)throw new Error(t||"Assertion failed")}function inherits(e,t){e.super_=t;var TempCtor=function(){};TempCtor.prototype=t.prototype,e.prototype=new TempCtor,e.prototype.constructor=e}function BN(e,t,r){if(BN.isBN(e))return e;this.negative=0,this.words=null,this.length=0,this.red=null,null!==e&&("le"!==t&&"be"!==t||(r=t,t=10),this._init(e||0,t||10,r||"be"))}var a;"object"==typeof e?e.exports=BN:t.BN=BN,BN.BN=BN,BN.wordSize=26;try{a="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:r(17).Buffer}catch(e){}function parseHex4Bits(e,t){var r=e.charCodeAt(t);return r>=48&&r<=57?r-48:r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:void assert(!1,"Invalid character in "+e)}function parseHexByte(e,t,r){var a=parseHex4Bits(e,r);return r-1>=t&&(a|=parseHex4Bits(e,r-1)<<4),a}function parseBase(e,t,r,a){for(var n=0,o=0,s=Math.min(e.length,r),c=t;c=49?d-49+10:d>=17?d-17+10:d,assert(d>=0&&o0?e:t},BN.min=function min(e,t){return e.cmp(t)<0?e:t},BN.prototype._init=function init(e,t,r){if("number"==typeof e)return this._initNumber(e,t,r);if("object"==typeof e)return this._initArray(e,t,r);"hex"===t&&(t=16),assert(t===(0|t)&&t>=2&&t<=36);var a=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&(a++,this.negative=1),a=0;a-=3)o=e[a]|e[a-1]<<8|e[a-2]<<16,this.words[n]|=o<>>26-s&67108863,(s+=24)>=26&&(s-=26,n++);else if("le"===r)for(a=0,n=0;a>>26-s&67108863,(s+=24)>=26&&(s-=26,n++);return this._strip()},BN.prototype._parseHex=function _parseHex(e,t,r){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var a=0;a=t;a-=2)n=parseHexByte(e,t,a)<=18?(o-=18,s+=1,this.words[s]|=n>>>26):o+=8;else for(a=(e.length-t)%2==0?t+1:t;a=18?(o-=18,s+=1,this.words[s]|=n>>>26):o+=8;this._strip()},BN.prototype._parseBase=function _parseBase(e,t,r){this.words=[0],this.length=1;for(var a=0,n=1;n<=67108863;n*=t)a++;a--,n=n/t|0;for(var o=e.length-r,s=o%a,c=Math.min(o,o-s)+r,d=0,u=r;u1&&0===this.words[this.length-1];)this.length--;return this._normSign()},BN.prototype._normSign=function _normSign(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for)try{BN.prototype[Symbol.for("nodejs.util.inspect.custom")]=inspect}catch(e){BN.prototype.inspect=inspect}else BN.prototype.inspect=inspect;function inspect(){return(this.red?""}var n=["","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"],o=[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],s=[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];BN.prototype.toString=function toString(e,t){var r;if(t=0|t||1,16===(e=e||10)||"hex"===e){r="";for(var a=0,c=0,d=0;d>>24-a&16777215)||d!==this.length-1?n[6-h.length]+h+r:h+r,(a+=2)>=26&&(a-=26,d--)}for(0!==c&&(r=c.toString(16)+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(e===(0|e)&&e>=2&&e<=36){var l=o[e],b=s[e];r="";var g=this.clone();for(g.negative=0;!g.isZero();){var p=g.modrn(b).toString(e);r=(g=g.idivn(b)).isZero()?p+r:n[l-p.length]+p+r}for(this.isZero()&&(r="0"+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}assert(!1,"Base should be between 2 and 36")},BN.prototype.toNumber=function toNumber(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&assert(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},BN.prototype.toJSON=function toJSON(){return this.toString(16,2)},a&&(BN.prototype.toBuffer=function toBuffer(e,t){return this.toArrayLike(a,e,t)}),BN.prototype.toArray=function toArray(e,t){return this.toArrayLike(Array,e,t)};function smallMulTo(e,t,r){r.negative=t.negative^e.negative;var a=e.length+t.length|0;r.length=a,a=a-1|0;var n=0|e.words[0],o=0|t.words[0],s=n*o,c=67108863&s,d=s/67108864|0;r.words[0]=c;for(var u=1;u>>26,l=67108863&d,b=Math.min(u,t.length-1),g=Math.max(0,u-e.length+1);g<=b;g++){var p=u-g|0;h+=(s=(n=0|e.words[p])*(o=0|t.words[g])+l)/67108864|0,l=67108863&s}r.words[u]=0|l,d=0|h}return 0!==d?r.words[u]=0|d:r.length--,r._strip()}BN.prototype.toArrayLike=function toArrayLike(e,t,r){this._strip();var a=this.byteLength(),n=r||Math.max(1,a);assert(a<=n,"byte array longer than desired length"),assert(n>0,"Requested array length <= 0");var o=function allocate(e,t){return e.allocUnsafe?e.allocUnsafe(t):new e(t)}(e,n);return this["_toArrayLike"+("le"===t?"LE":"BE")](o,a),o},BN.prototype._toArrayLikeLE=function _toArrayLikeLE(e,t){for(var r=0,a=0,n=0,o=0;n>8&255),r>16&255),6===o?(r>24&255),a=0,o=0):(a=s>>>24,o+=2)}if(r=0&&(e[r--]=s>>8&255),r>=0&&(e[r--]=s>>16&255),6===o?(r>=0&&(e[r--]=s>>24&255),a=0,o=0):(a=s>>>24,o+=2)}if(r>=0)for(e[r--]=a;r>=0;)e[r--]=0},Math.clz32?BN.prototype._countBits=function _countBits(e){return 32-Math.clz32(e)}:BN.prototype._countBits=function _countBits(e){var t=e,r=0;return t>=4096&&(r+=13,t>>>=13),t>=64&&(r+=7,t>>>=7),t>=8&&(r+=4,t>>>=4),t>=2&&(r+=2,t>>>=2),r+t},BN.prototype._zeroBits=function _zeroBits(e){if(0===e)return 26;var t=e,r=0;return 0==(8191&t)&&(r+=13,t>>>=13),0==(127&t)&&(r+=7,t>>>=7),0==(15&t)&&(r+=4,t>>>=4),0==(3&t)&&(r+=2,t>>>=2),0==(1&t)&&r++,r},BN.prototype.bitLength=function bitLength(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},BN.prototype.zeroBits=function zeroBits(){if(this.isZero())return 0;for(var e=0,t=0;te.length?this.clone().ior(e):e.clone().ior(this)},BN.prototype.uor=function uor(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},BN.prototype.iuand=function iuand(e){var t;t=this.length>e.length?e:this;for(var r=0;re.length?this.clone().iand(e):e.clone().iand(this)},BN.prototype.uand=function uand(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},BN.prototype.iuxor=function iuxor(e){var t,r;this.length>e.length?(t=this,r=e):(t=e,r=this);for(var a=0;ae.length?this.clone().ixor(e):e.clone().ixor(this)},BN.prototype.uxor=function uxor(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},BN.prototype.inotn=function inotn(e){assert("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),r=e%26;this._expand(t),r>0&&t--;for(var a=0;a0&&(this.words[a]=~this.words[a]&67108863>>26-r),this._strip()},BN.prototype.notn=function notn(e){return this.clone().inotn(e)},BN.prototype.setn=function setn(e,t){assert("number"==typeof e&&e>=0);var r=e/26|0,a=e%26;return this._expand(r+1),this.words[r]=t?this.words[r]|1<e.length?(r=this,a=e):(r=e,a=this);for(var n=0,o=0;o>>26;for(;0!==n&&o>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;oe.length?this.clone().iadd(e):e.clone().iadd(this)},BN.prototype.isub=function isub(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var r,a,n=this.cmp(e);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,a=e):(r=e,a=this);for(var o=0,s=0;s>26,this.words[s]=67108863&t;for(;0!==o&&s>26,this.words[s]=67108863&t;if(0===o&&s>>13,g=0|s[1],p=8191&g,B=g>>>13,m=0|s[2],I=8191&m,y=m>>>13,v=0|s[3],x=8191&v,C=v>>>13,Q=0|s[4],w=8191&Q,_=Q>>>13,k=0|s[5],N=8191&k,D=k>>>13,U=0|s[6],G=8191&U,T=U>>>13,L=0|s[7],P=8191&L,q=L>>>13,O=0|s[8],H=8191&O,Y=O>>>13,j=0|s[9],J=8191&j,z=j>>>13,W=0|c[0],V=8191&W,X=W>>>13,$=0|c[1],et=8191&$,tt=$>>>13,rt=0|c[2],at=8191&rt,it=rt>>>13,nt=0|c[3],ot=8191&nt,At=nt>>>13,st=0|c[4],ct=8191&st,dt=st>>>13,ut=0|c[5],ht=8191&ut,bt=ut>>>13,pt=0|c[6],Bt=8191&pt,mt=pt>>>13,It=0|c[7],Et=8191&It,yt=It>>>13,vt=0|c[8],xt=8191&vt,Ct=vt>>>13,Qt=0|c[9],wt=8191&Qt,Mt=Qt>>>13;r.negative=e.negative^t.negative,r.length=19;var _t=(u+(a=Math.imul(l,V))|0)+((8191&(n=(n=Math.imul(l,X))+Math.imul(b,V)|0))<<13)|0;u=((o=Math.imul(b,X))+(n>>>13)|0)+(_t>>>26)|0,_t&=67108863,a=Math.imul(p,V),n=(n=Math.imul(p,X))+Math.imul(B,V)|0,o=Math.imul(B,X);var kt=(u+(a=a+Math.imul(l,et)|0)|0)+((8191&(n=(n=n+Math.imul(l,tt)|0)+Math.imul(b,et)|0))<<13)|0;u=((o=o+Math.imul(b,tt)|0)+(n>>>13)|0)+(kt>>>26)|0,kt&=67108863,a=Math.imul(I,V),n=(n=Math.imul(I,X))+Math.imul(y,V)|0,o=Math.imul(y,X),a=a+Math.imul(p,et)|0,n=(n=n+Math.imul(p,tt)|0)+Math.imul(B,et)|0,o=o+Math.imul(B,tt)|0;var St=(u+(a=a+Math.imul(l,at)|0)|0)+((8191&(n=(n=n+Math.imul(l,it)|0)+Math.imul(b,at)|0))<<13)|0;u=((o=o+Math.imul(b,it)|0)+(n>>>13)|0)+(St>>>26)|0,St&=67108863,a=Math.imul(x,V),n=(n=Math.imul(x,X))+Math.imul(C,V)|0,o=Math.imul(C,X),a=a+Math.imul(I,et)|0,n=(n=n+Math.imul(I,tt)|0)+Math.imul(y,et)|0,o=o+Math.imul(y,tt)|0,a=a+Math.imul(p,at)|0,n=(n=n+Math.imul(p,it)|0)+Math.imul(B,at)|0,o=o+Math.imul(B,it)|0;var Nt=(u+(a=a+Math.imul(l,ot)|0)|0)+((8191&(n=(n=n+Math.imul(l,At)|0)+Math.imul(b,ot)|0))<<13)|0;u=((o=o+Math.imul(b,At)|0)+(n>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,a=Math.imul(w,V),n=(n=Math.imul(w,X))+Math.imul(_,V)|0,o=Math.imul(_,X),a=a+Math.imul(x,et)|0,n=(n=n+Math.imul(x,tt)|0)+Math.imul(C,et)|0,o=o+Math.imul(C,tt)|0,a=a+Math.imul(I,at)|0,n=(n=n+Math.imul(I,it)|0)+Math.imul(y,at)|0,o=o+Math.imul(y,it)|0,a=a+Math.imul(p,ot)|0,n=(n=n+Math.imul(p,At)|0)+Math.imul(B,ot)|0,o=o+Math.imul(B,At)|0;var Dt=(u+(a=a+Math.imul(l,ct)|0)|0)+((8191&(n=(n=n+Math.imul(l,dt)|0)+Math.imul(b,ct)|0))<<13)|0;u=((o=o+Math.imul(b,dt)|0)+(n>>>13)|0)+(Dt>>>26)|0,Dt&=67108863,a=Math.imul(N,V),n=(n=Math.imul(N,X))+Math.imul(D,V)|0,o=Math.imul(D,X),a=a+Math.imul(w,et)|0,n=(n=n+Math.imul(w,tt)|0)+Math.imul(_,et)|0,o=o+Math.imul(_,tt)|0,a=a+Math.imul(x,at)|0,n=(n=n+Math.imul(x,it)|0)+Math.imul(C,at)|0,o=o+Math.imul(C,it)|0,a=a+Math.imul(I,ot)|0,n=(n=n+Math.imul(I,At)|0)+Math.imul(y,ot)|0,o=o+Math.imul(y,At)|0,a=a+Math.imul(p,ct)|0,n=(n=n+Math.imul(p,dt)|0)+Math.imul(B,ct)|0,o=o+Math.imul(B,dt)|0;var Rt=(u+(a=a+Math.imul(l,ht)|0)|0)+((8191&(n=(n=n+Math.imul(l,bt)|0)+Math.imul(b,ht)|0))<<13)|0;u=((o=o+Math.imul(b,bt)|0)+(n>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,a=Math.imul(G,V),n=(n=Math.imul(G,X))+Math.imul(T,V)|0,o=Math.imul(T,X),a=a+Math.imul(N,et)|0,n=(n=n+Math.imul(N,tt)|0)+Math.imul(D,et)|0,o=o+Math.imul(D,tt)|0,a=a+Math.imul(w,at)|0,n=(n=n+Math.imul(w,it)|0)+Math.imul(_,at)|0,o=o+Math.imul(_,it)|0,a=a+Math.imul(x,ot)|0,n=(n=n+Math.imul(x,At)|0)+Math.imul(C,ot)|0,o=o+Math.imul(C,At)|0,a=a+Math.imul(I,ct)|0,n=(n=n+Math.imul(I,dt)|0)+Math.imul(y,ct)|0,o=o+Math.imul(y,dt)|0,a=a+Math.imul(p,ht)|0,n=(n=n+Math.imul(p,bt)|0)+Math.imul(B,ht)|0,o=o+Math.imul(B,bt)|0;var Ft=(u+(a=a+Math.imul(l,Bt)|0)|0)+((8191&(n=(n=n+Math.imul(l,mt)|0)+Math.imul(b,Bt)|0))<<13)|0;u=((o=o+Math.imul(b,mt)|0)+(n>>>13)|0)+(Ft>>>26)|0,Ft&=67108863,a=Math.imul(P,V),n=(n=Math.imul(P,X))+Math.imul(q,V)|0,o=Math.imul(q,X),a=a+Math.imul(G,et)|0,n=(n=n+Math.imul(G,tt)|0)+Math.imul(T,et)|0,o=o+Math.imul(T,tt)|0,a=a+Math.imul(N,at)|0,n=(n=n+Math.imul(N,it)|0)+Math.imul(D,at)|0,o=o+Math.imul(D,it)|0,a=a+Math.imul(w,ot)|0,n=(n=n+Math.imul(w,At)|0)+Math.imul(_,ot)|0,o=o+Math.imul(_,At)|0,a=a+Math.imul(x,ct)|0,n=(n=n+Math.imul(x,dt)|0)+Math.imul(C,ct)|0,o=o+Math.imul(C,dt)|0,a=a+Math.imul(I,ht)|0,n=(n=n+Math.imul(I,bt)|0)+Math.imul(y,ht)|0,o=o+Math.imul(y,bt)|0,a=a+Math.imul(p,Bt)|0,n=(n=n+Math.imul(p,mt)|0)+Math.imul(B,Bt)|0,o=o+Math.imul(B,mt)|0;var Ut=(u+(a=a+Math.imul(l,Et)|0)|0)+((8191&(n=(n=n+Math.imul(l,yt)|0)+Math.imul(b,Et)|0))<<13)|0;u=((o=o+Math.imul(b,yt)|0)+(n>>>13)|0)+(Ut>>>26)|0,Ut&=67108863,a=Math.imul(H,V),n=(n=Math.imul(H,X))+Math.imul(Y,V)|0,o=Math.imul(Y,X),a=a+Math.imul(P,et)|0,n=(n=n+Math.imul(P,tt)|0)+Math.imul(q,et)|0,o=o+Math.imul(q,tt)|0,a=a+Math.imul(G,at)|0,n=(n=n+Math.imul(G,it)|0)+Math.imul(T,at)|0,o=o+Math.imul(T,it)|0,a=a+Math.imul(N,ot)|0,n=(n=n+Math.imul(N,At)|0)+Math.imul(D,ot)|0,o=o+Math.imul(D,At)|0,a=a+Math.imul(w,ct)|0,n=(n=n+Math.imul(w,dt)|0)+Math.imul(_,ct)|0,o=o+Math.imul(_,dt)|0,a=a+Math.imul(x,ht)|0,n=(n=n+Math.imul(x,bt)|0)+Math.imul(C,ht)|0,o=o+Math.imul(C,bt)|0,a=a+Math.imul(I,Bt)|0,n=(n=n+Math.imul(I,mt)|0)+Math.imul(y,Bt)|0,o=o+Math.imul(y,mt)|0,a=a+Math.imul(p,Et)|0,n=(n=n+Math.imul(p,yt)|0)+Math.imul(B,Et)|0,o=o+Math.imul(B,yt)|0;var Gt=(u+(a=a+Math.imul(l,xt)|0)|0)+((8191&(n=(n=n+Math.imul(l,Ct)|0)+Math.imul(b,xt)|0))<<13)|0;u=((o=o+Math.imul(b,Ct)|0)+(n>>>13)|0)+(Gt>>>26)|0,Gt&=67108863,a=Math.imul(J,V),n=(n=Math.imul(J,X))+Math.imul(z,V)|0,o=Math.imul(z,X),a=a+Math.imul(H,et)|0,n=(n=n+Math.imul(H,tt)|0)+Math.imul(Y,et)|0,o=o+Math.imul(Y,tt)|0,a=a+Math.imul(P,at)|0,n=(n=n+Math.imul(P,it)|0)+Math.imul(q,at)|0,o=o+Math.imul(q,it)|0,a=a+Math.imul(G,ot)|0,n=(n=n+Math.imul(G,At)|0)+Math.imul(T,ot)|0,o=o+Math.imul(T,At)|0,a=a+Math.imul(N,ct)|0,n=(n=n+Math.imul(N,dt)|0)+Math.imul(D,ct)|0,o=o+Math.imul(D,dt)|0,a=a+Math.imul(w,ht)|0,n=(n=n+Math.imul(w,bt)|0)+Math.imul(_,ht)|0,o=o+Math.imul(_,bt)|0,a=a+Math.imul(x,Bt)|0,n=(n=n+Math.imul(x,mt)|0)+Math.imul(C,Bt)|0,o=o+Math.imul(C,mt)|0,a=a+Math.imul(I,Et)|0,n=(n=n+Math.imul(I,yt)|0)+Math.imul(y,Et)|0,o=o+Math.imul(y,yt)|0,a=a+Math.imul(p,xt)|0,n=(n=n+Math.imul(p,Ct)|0)+Math.imul(B,xt)|0,o=o+Math.imul(B,Ct)|0;var Tt=(u+(a=a+Math.imul(l,wt)|0)|0)+((8191&(n=(n=n+Math.imul(l,Mt)|0)+Math.imul(b,wt)|0))<<13)|0;u=((o=o+Math.imul(b,Mt)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,a=Math.imul(J,et),n=(n=Math.imul(J,tt))+Math.imul(z,et)|0,o=Math.imul(z,tt),a=a+Math.imul(H,at)|0,n=(n=n+Math.imul(H,it)|0)+Math.imul(Y,at)|0,o=o+Math.imul(Y,it)|0,a=a+Math.imul(P,ot)|0,n=(n=n+Math.imul(P,At)|0)+Math.imul(q,ot)|0,o=o+Math.imul(q,At)|0,a=a+Math.imul(G,ct)|0,n=(n=n+Math.imul(G,dt)|0)+Math.imul(T,ct)|0,o=o+Math.imul(T,dt)|0,a=a+Math.imul(N,ht)|0,n=(n=n+Math.imul(N,bt)|0)+Math.imul(D,ht)|0,o=o+Math.imul(D,bt)|0,a=a+Math.imul(w,Bt)|0,n=(n=n+Math.imul(w,mt)|0)+Math.imul(_,Bt)|0,o=o+Math.imul(_,mt)|0,a=a+Math.imul(x,Et)|0,n=(n=n+Math.imul(x,yt)|0)+Math.imul(C,Et)|0,o=o+Math.imul(C,yt)|0,a=a+Math.imul(I,xt)|0,n=(n=n+Math.imul(I,Ct)|0)+Math.imul(y,xt)|0,o=o+Math.imul(y,Ct)|0;var Lt=(u+(a=a+Math.imul(p,wt)|0)|0)+((8191&(n=(n=n+Math.imul(p,Mt)|0)+Math.imul(B,wt)|0))<<13)|0;u=((o=o+Math.imul(B,Mt)|0)+(n>>>13)|0)+(Lt>>>26)|0,Lt&=67108863,a=Math.imul(J,at),n=(n=Math.imul(J,it))+Math.imul(z,at)|0,o=Math.imul(z,it),a=a+Math.imul(H,ot)|0,n=(n=n+Math.imul(H,At)|0)+Math.imul(Y,ot)|0,o=o+Math.imul(Y,At)|0,a=a+Math.imul(P,ct)|0,n=(n=n+Math.imul(P,dt)|0)+Math.imul(q,ct)|0,o=o+Math.imul(q,dt)|0,a=a+Math.imul(G,ht)|0,n=(n=n+Math.imul(G,bt)|0)+Math.imul(T,ht)|0,o=o+Math.imul(T,bt)|0,a=a+Math.imul(N,Bt)|0,n=(n=n+Math.imul(N,mt)|0)+Math.imul(D,Bt)|0,o=o+Math.imul(D,mt)|0,a=a+Math.imul(w,Et)|0,n=(n=n+Math.imul(w,yt)|0)+Math.imul(_,Et)|0,o=o+Math.imul(_,yt)|0,a=a+Math.imul(x,xt)|0,n=(n=n+Math.imul(x,Ct)|0)+Math.imul(C,xt)|0,o=o+Math.imul(C,Ct)|0;var Pt=(u+(a=a+Math.imul(I,wt)|0)|0)+((8191&(n=(n=n+Math.imul(I,Mt)|0)+Math.imul(y,wt)|0))<<13)|0;u=((o=o+Math.imul(y,Mt)|0)+(n>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,a=Math.imul(J,ot),n=(n=Math.imul(J,At))+Math.imul(z,ot)|0,o=Math.imul(z,At),a=a+Math.imul(H,ct)|0,n=(n=n+Math.imul(H,dt)|0)+Math.imul(Y,ct)|0,o=o+Math.imul(Y,dt)|0,a=a+Math.imul(P,ht)|0,n=(n=n+Math.imul(P,bt)|0)+Math.imul(q,ht)|0,o=o+Math.imul(q,bt)|0,a=a+Math.imul(G,Bt)|0,n=(n=n+Math.imul(G,mt)|0)+Math.imul(T,Bt)|0,o=o+Math.imul(T,mt)|0,a=a+Math.imul(N,Et)|0,n=(n=n+Math.imul(N,yt)|0)+Math.imul(D,Et)|0,o=o+Math.imul(D,yt)|0,a=a+Math.imul(w,xt)|0,n=(n=n+Math.imul(w,Ct)|0)+Math.imul(_,xt)|0,o=o+Math.imul(_,Ct)|0;var qt=(u+(a=a+Math.imul(x,wt)|0)|0)+((8191&(n=(n=n+Math.imul(x,Mt)|0)+Math.imul(C,wt)|0))<<13)|0;u=((o=o+Math.imul(C,Mt)|0)+(n>>>13)|0)+(qt>>>26)|0,qt&=67108863,a=Math.imul(J,ct),n=(n=Math.imul(J,dt))+Math.imul(z,ct)|0,o=Math.imul(z,dt),a=a+Math.imul(H,ht)|0,n=(n=n+Math.imul(H,bt)|0)+Math.imul(Y,ht)|0,o=o+Math.imul(Y,bt)|0,a=a+Math.imul(P,Bt)|0,n=(n=n+Math.imul(P,mt)|0)+Math.imul(q,Bt)|0,o=o+Math.imul(q,mt)|0,a=a+Math.imul(G,Et)|0,n=(n=n+Math.imul(G,yt)|0)+Math.imul(T,Et)|0,o=o+Math.imul(T,yt)|0,a=a+Math.imul(N,xt)|0,n=(n=n+Math.imul(N,Ct)|0)+Math.imul(D,xt)|0,o=o+Math.imul(D,Ct)|0;var Ot=(u+(a=a+Math.imul(w,wt)|0)|0)+((8191&(n=(n=n+Math.imul(w,Mt)|0)+Math.imul(_,wt)|0))<<13)|0;u=((o=o+Math.imul(_,Mt)|0)+(n>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,a=Math.imul(J,ht),n=(n=Math.imul(J,bt))+Math.imul(z,ht)|0,o=Math.imul(z,bt),a=a+Math.imul(H,Bt)|0,n=(n=n+Math.imul(H,mt)|0)+Math.imul(Y,Bt)|0,o=o+Math.imul(Y,mt)|0,a=a+Math.imul(P,Et)|0,n=(n=n+Math.imul(P,yt)|0)+Math.imul(q,Et)|0,o=o+Math.imul(q,yt)|0,a=a+Math.imul(G,xt)|0,n=(n=n+Math.imul(G,Ct)|0)+Math.imul(T,xt)|0,o=o+Math.imul(T,Ct)|0;var Ht=(u+(a=a+Math.imul(N,wt)|0)|0)+((8191&(n=(n=n+Math.imul(N,Mt)|0)+Math.imul(D,wt)|0))<<13)|0;u=((o=o+Math.imul(D,Mt)|0)+(n>>>13)|0)+(Ht>>>26)|0,Ht&=67108863,a=Math.imul(J,Bt),n=(n=Math.imul(J,mt))+Math.imul(z,Bt)|0,o=Math.imul(z,mt),a=a+Math.imul(H,Et)|0,n=(n=n+Math.imul(H,yt)|0)+Math.imul(Y,Et)|0,o=o+Math.imul(Y,yt)|0,a=a+Math.imul(P,xt)|0,n=(n=n+Math.imul(P,Ct)|0)+Math.imul(q,xt)|0,o=o+Math.imul(q,Ct)|0;var Yt=(u+(a=a+Math.imul(G,wt)|0)|0)+((8191&(n=(n=n+Math.imul(G,Mt)|0)+Math.imul(T,wt)|0))<<13)|0;u=((o=o+Math.imul(T,Mt)|0)+(n>>>13)|0)+(Yt>>>26)|0,Yt&=67108863,a=Math.imul(J,Et),n=(n=Math.imul(J,yt))+Math.imul(z,Et)|0,o=Math.imul(z,yt),a=a+Math.imul(H,xt)|0,n=(n=n+Math.imul(H,Ct)|0)+Math.imul(Y,xt)|0,o=o+Math.imul(Y,Ct)|0;var jt=(u+(a=a+Math.imul(P,wt)|0)|0)+((8191&(n=(n=n+Math.imul(P,Mt)|0)+Math.imul(q,wt)|0))<<13)|0;u=((o=o+Math.imul(q,Mt)|0)+(n>>>13)|0)+(jt>>>26)|0,jt&=67108863,a=Math.imul(J,xt),n=(n=Math.imul(J,Ct))+Math.imul(z,xt)|0,o=Math.imul(z,Ct);var Jt=(u+(a=a+Math.imul(H,wt)|0)|0)+((8191&(n=(n=n+Math.imul(H,Mt)|0)+Math.imul(Y,wt)|0))<<13)|0;u=((o=o+Math.imul(Y,Mt)|0)+(n>>>13)|0)+(Jt>>>26)|0,Jt&=67108863;var Kt=(u+(a=Math.imul(J,wt))|0)+((8191&(n=(n=Math.imul(J,Mt))+Math.imul(z,wt)|0))<<13)|0;return u=((o=Math.imul(z,Mt))+(n>>>13)|0)+(Kt>>>26)|0,Kt&=67108863,d[0]=_t,d[1]=kt,d[2]=St,d[3]=Nt,d[4]=Dt,d[5]=Rt,d[6]=Ft,d[7]=Ut,d[8]=Gt,d[9]=Tt,d[10]=Lt,d[11]=Pt,d[12]=qt,d[13]=Ot,d[14]=Ht,d[15]=Yt,d[16]=jt,d[17]=Jt,d[18]=Kt,0!==u&&(d[19]=u,r.length++),r};function bigMulTo(e,t,r){r.negative=t.negative^e.negative,r.length=e.length+t.length;for(var a=0,n=0,o=0;o>>26)|0)>>>26,s&=67108863}r.words[o]=c,a=s,s=n}return 0!==a?r.words[o]=a:r.length--,r._strip()}function jumboMulTo(e,t,r){return bigMulTo(e,t,r)}function FFTM(e,t){this.x=e,this.y=t}Math.imul||(c=smallMulTo),BN.prototype.mulTo=function mulTo(e,t){var r=this.length+e.length;return 10===this.length&&10===e.length?c(this,e,t):r<63?smallMulTo(this,e,t):r<1024?bigMulTo(this,e,t):jumboMulTo(this,e,t)},FFTM.prototype.makeRBT=function makeRBT(e){for(var t=new Array(e),r=BN.prototype._countBits(e)-1,a=0;a>=1;return a},FFTM.prototype.permute=function permute(e,t,r,a,n,o){for(var s=0;s>>=1)n++;return 1<>>=13,r[2*o+1]=8191&n,n>>>=13;for(o=2*t;o>=26,r+=n/67108864|0,r+=o>>>26,this.words[a]=67108863&o}return 0!==r&&(this.words[a]=r,this.length++),t?this.ineg():this},BN.prototype.muln=function muln(e){return this.clone().imuln(e)},BN.prototype.sqr=function sqr(){return this.mul(this)},BN.prototype.isqr=function isqr(){return this.imul(this.clone())},BN.prototype.pow=function pow(e){var t=function toBitArray(e){for(var t=new Array(e.bitLength()),r=0;r>>n&1}return t}(e);if(0===t.length)return new BN(1);for(var r=this,a=0;a=0);var t,r=e%26,a=(e-r)/26,n=67108863>>>26-r<<26-r;if(0!==r){var o=0;for(t=0;t>>26-r}o&&(this.words[t]=o,this.length++)}if(0!==a){for(t=this.length-1;t>=0;t--)this.words[t+a]=this.words[t];for(t=0;t=0),a=t?(t-t%26)/26:0;var n=e%26,o=Math.min((e-n)/26,this.length),s=67108863^67108863>>>n<o)for(this.length-=o,d=0;d=0&&(0!==u||d>=a);d--){var h=0|this.words[d];this.words[d]=u<<26-n|h>>>n,u=h&s}return c&&0!==u&&(c.words[c.length++]=u),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},BN.prototype.ishrn=function ishrn(e,t,r){return assert(0===this.negative),this.iushrn(e,t,r)},BN.prototype.shln=function shln(e){return this.clone().ishln(e)},BN.prototype.ushln=function ushln(e){return this.clone().iushln(e)},BN.prototype.shrn=function shrn(e){return this.clone().ishrn(e)},BN.prototype.ushrn=function ushrn(e){return this.clone().iushrn(e)},BN.prototype.testn=function testn(e){assert("number"==typeof e&&e>=0);var t=e%26,r=(e-t)/26,a=1<=0);var t=e%26,r=(e-t)/26;if(assert(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==t&&r++,this.length=Math.min(r,this.length),0!==t){var a=67108863^67108863>>>t<=67108864;t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},BN.prototype.isubn=function isubn(e){if(assert("number"==typeof e),assert(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t>26)-(c/67108864|0),this.words[a+r]=67108863&n}for(;a>26,this.words[a+r]=67108863&n;if(0===s)return this._strip();for(assert(-1===s),s=0,a=0;a>26,this.words[a]=67108863&n;return this.negative=1,this._strip()},BN.prototype._wordDiv=function _wordDiv(e,t){var r=(this.length,e.length),a=this.clone(),n=e,o=0|n.words[n.length-1];0!==(r=26-this._countBits(o))&&(n=n.ushln(r),a.iushln(r),o=0|n.words[n.length-1]);var s,c=a.length-n.length;if("mod"!==t){(s=new BN(null)).length=c+1,s.words=new Array(s.length);for(var d=0;d=0;h--){var l=67108864*(0|a.words[n.length+h])+(0|a.words[n.length+h-1]);for(l=Math.min(l/o|0,67108863),a._ishlnsubmul(n,l,h);0!==a.negative;)l--,a.negative=0,a._ishlnsubmul(n,1,h),a.isZero()||(a.negative^=1);s&&(s.words[h]=l)}return s&&s._strip(),a._strip(),"div"!==t&&0!==r&&a.iushrn(r),{div:s||null,mod:a}},BN.prototype.divmod=function divmod(e,t,r){return assert(!e.isZero()),this.isZero()?{div:new BN(0),mod:new BN(0)}:0!==this.negative&&0===e.negative?(o=this.neg().divmod(e,t),"mod"!==t&&(a=o.div.neg()),"div"!==t&&(n=o.mod.neg(),r&&0!==n.negative&&n.iadd(e)),{div:a,mod:n}):0===this.negative&&0!==e.negative?(o=this.divmod(e.neg(),t),"mod"!==t&&(a=o.div.neg()),{div:a,mod:o.mod}):0!=(this.negative&e.negative)?(o=this.neg().divmod(e.neg(),t),"div"!==t&&(n=o.mod.neg(),r&&0!==n.negative&&n.isub(e)),{div:o.div,mod:n}):e.length>this.length||this.cmp(e)<0?{div:new BN(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new BN(this.modrn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new BN(this.modrn(e.words[0]))}:this._wordDiv(e,t);var a,n,o},BN.prototype.div=function div(e){return this.divmod(e,"div",!1).div},BN.prototype.mod=function mod(e){return this.divmod(e,"mod",!1).mod},BN.prototype.umod=function umod(e){return this.divmod(e,"mod",!0).mod},BN.prototype.divRound=function divRound(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var r=0!==t.div.negative?t.mod.isub(e):t.mod,a=e.ushrn(1),n=e.andln(1),o=r.cmp(a);return o<0||1===n&&0===o?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},BN.prototype.modrn=function modrn(e){var t=e<0;t&&(e=-e),assert(e<=67108863);for(var r=(1<<26)%e,a=0,n=this.length-1;n>=0;n--)a=(r*a+(0|this.words[n]))%e;return t?-a:a},BN.prototype.modn=function modn(e){return this.modrn(e)},BN.prototype.idivn=function idivn(e){var t=e<0;t&&(e=-e),assert(e<=67108863);for(var r=0,a=this.length-1;a>=0;a--){var n=(0|this.words[a])+67108864*r;this.words[a]=n/e|0,r=n%e}return this._strip(),t?this.ineg():this},BN.prototype.divn=function divn(e){return this.clone().idivn(e)},BN.prototype.egcd=function egcd(e){assert(0===e.negative),assert(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var a=new BN(1),n=new BN(0),o=new BN(0),s=new BN(1),c=0;t.isEven()&&r.isEven();)t.iushrn(1),r.iushrn(1),++c;for(var d=r.clone(),u=t.clone();!t.isZero();){for(var h=0,l=1;0==(t.words[0]&l)&&h<26;++h,l<<=1);if(h>0)for(t.iushrn(h);h-- >0;)(a.isOdd()||n.isOdd())&&(a.iadd(d),n.isub(u)),a.iushrn(1),n.iushrn(1);for(var b=0,g=1;0==(r.words[0]&g)&&b<26;++b,g<<=1);if(b>0)for(r.iushrn(b);b-- >0;)(o.isOdd()||s.isOdd())&&(o.iadd(d),s.isub(u)),o.iushrn(1),s.iushrn(1);t.cmp(r)>=0?(t.isub(r),a.isub(o),n.isub(s)):(r.isub(t),o.isub(a),s.isub(n))}return{a:o,b:s,gcd:r.iushln(c)}},BN.prototype._invmp=function _invmp(e){assert(0===e.negative),assert(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var a,n=new BN(1),o=new BN(0),s=r.clone();t.cmpn(1)>0&&r.cmpn(1)>0;){for(var c=0,d=1;0==(t.words[0]&d)&&c<26;++c,d<<=1);if(c>0)for(t.iushrn(c);c-- >0;)n.isOdd()&&n.iadd(s),n.iushrn(1);for(var u=0,h=1;0==(r.words[0]&h)&&u<26;++u,h<<=1);if(u>0)for(r.iushrn(u);u-- >0;)o.isOdd()&&o.iadd(s),o.iushrn(1);t.cmp(r)>=0?(t.isub(r),n.isub(o)):(r.isub(t),o.isub(n))}return(a=0===t.cmpn(1)?n:o).cmpn(0)<0&&a.iadd(e),a},BN.prototype.gcd=function gcd(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),r=e.clone();t.negative=0,r.negative=0;for(var a=0;t.isEven()&&r.isEven();a++)t.iushrn(1),r.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=t.cmp(r);if(n<0){var o=t;t=r,r=o}else if(0===n||0===r.cmpn(1))break;t.isub(r)}return r.iushln(a)},BN.prototype.invm=function invm(e){return this.egcd(e).a.umod(e)},BN.prototype.isEven=function isEven(){return 0==(1&this.words[0])},BN.prototype.isOdd=function isOdd(){return 1==(1&this.words[0])},BN.prototype.andln=function andln(e){return this.words[0]&e},BN.prototype.bincn=function bincn(e){assert("number"==typeof e);var t=e%26,r=(e-t)/26,a=1<>>26,s&=67108863,this.words[o]=s}return 0!==n&&(this.words[o]=n,this.length++),this},BN.prototype.isZero=function isZero(){return 1===this.length&&0===this.words[0]},BN.prototype.cmpn=function cmpn(e){var t,r=e<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this._strip(),this.length>1)t=1;else{r&&(e=-e),assert(e<=67108863,"Number is too big");var a=0|this.words[0];t=a===e?0:ae.length)return 1;if(this.length=0;r--){var a=0|this.words[r],n=0|e.words[r];if(a!==n){an&&(t=1);break}}return t},BN.prototype.gtn=function gtn(e){return 1===this.cmpn(e)},BN.prototype.gt=function gt(e){return 1===this.cmp(e)},BN.prototype.gten=function gten(e){return this.cmpn(e)>=0},BN.prototype.gte=function gte(e){return this.cmp(e)>=0},BN.prototype.ltn=function ltn(e){return-1===this.cmpn(e)},BN.prototype.lt=function lt(e){return-1===this.cmp(e)},BN.prototype.lten=function lten(e){return this.cmpn(e)<=0},BN.prototype.lte=function lte(e){return this.cmp(e)<=0},BN.prototype.eqn=function eqn(e){return 0===this.cmpn(e)},BN.prototype.eq=function eq(e){return 0===this.cmp(e)},BN.red=function red(e){return new Red(e)},BN.prototype.toRed=function toRed(e){return assert(!this.red,"Already a number in reduction context"),assert(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},BN.prototype.fromRed=function fromRed(){return assert(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},BN.prototype._forceRed=function _forceRed(e){return this.red=e,this},BN.prototype.forceRed=function forceRed(e){return assert(!this.red,"Already a number in reduction context"),this._forceRed(e)},BN.prototype.redAdd=function redAdd(e){return assert(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},BN.prototype.redIAdd=function redIAdd(e){return assert(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},BN.prototype.redSub=function redSub(e){return assert(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},BN.prototype.redISub=function redISub(e){return assert(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},BN.prototype.redShl=function redShl(e){return assert(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},BN.prototype.redMul=function redMul(e){return assert(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},BN.prototype.redIMul=function redIMul(e){return assert(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},BN.prototype.redSqr=function redSqr(){return assert(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},BN.prototype.redISqr=function redISqr(){return assert(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},BN.prototype.redSqrt=function redSqrt(){return assert(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},BN.prototype.redInvm=function redInvm(){return assert(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},BN.prototype.redNeg=function redNeg(){return assert(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},BN.prototype.redPow=function redPow(e){return assert(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var d={k256:null,p224:null,p192:null,p25519:null};function MPrime(e,t){this.name=e,this.p=new BN(t,16),this.n=this.p.bitLength(),this.k=new BN(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function K256(){MPrime.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function P224(){MPrime.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function P192(){MPrime.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function P25519(){MPrime.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function Red(e){if("string"==typeof e){var t=BN._prime(e);this.m=t.p,this.prime=t}else assert(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function Mont(e){Red.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new BN(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)}MPrime.prototype._tmp=function _tmp(){var e=new BN(null);return e.words=new Array(Math.ceil(this.n/13)),e},MPrime.prototype.ireduce=function ireduce(e){var t,r=e;do{this.split(r,this.tmp),t=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(t>this.n);var a=t0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},MPrime.prototype.split=function split(e,t){e.iushrn(this.n,0,t)},MPrime.prototype.imulK=function imulK(e){return e.imul(this.k)},inherits(K256,MPrime),K256.prototype.split=function split(e,t){for(var r=4194303,a=Math.min(e.length,9),n=0;n>>22,o=s}o>>>=22,e.words[n-10]=o,0===o&&e.length>10?e.length-=10:e.length-=9},K256.prototype.imulK=function imulK(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,r=0;r>>=26,e.words[r]=n,t=a}return 0!==t&&(e.words[e.length++]=t),e},BN._prime=function prime(e){if(d[e])return d[e];var prime;if("k256"===e)prime=new K256;else if("p224"===e)prime=new P224;else if("p192"===e)prime=new P192;else{if("p25519"!==e)throw new Error("Unknown prime "+e);prime=new P25519}return d[e]=prime,prime},Red.prototype._verify1=function _verify1(e){assert(0===e.negative,"red works only with positives"),assert(e.red,"red works only with red numbers")},Red.prototype._verify2=function _verify2(e,t){assert(0==(e.negative|t.negative),"red works only with positives"),assert(e.red&&e.red===t.red,"red works only with red numbers")},Red.prototype.imod=function imod(e){return this.prime?this.prime.ireduce(e)._forceRed(this):(move(e,e.umod(this.m)._forceRed(this)),e)},Red.prototype.neg=function neg(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},Red.prototype.add=function add(e,t){this._verify2(e,t);var r=e.add(t);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},Red.prototype.iadd=function iadd(e,t){this._verify2(e,t);var r=e.iadd(t);return r.cmp(this.m)>=0&&r.isub(this.m),r},Red.prototype.sub=function sub(e,t){this._verify2(e,t);var r=e.sub(t);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},Red.prototype.isub=function isub(e,t){this._verify2(e,t);var r=e.isub(t);return r.cmpn(0)<0&&r.iadd(this.m),r},Red.prototype.shl=function shl(e,t){return this._verify1(e),this.imod(e.ushln(t))},Red.prototype.imul=function imul(e,t){return this._verify2(e,t),this.imod(e.imul(t))},Red.prototype.mul=function mul(e,t){return this._verify2(e,t),this.imod(e.mul(t))},Red.prototype.isqr=function isqr(e){return this.imul(e,e.clone())},Red.prototype.sqr=function sqr(e){return this.mul(e,e)},Red.prototype.sqrt=function sqrt(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(assert(t%2==1),3===t){var r=this.m.add(new BN(1)).iushrn(2);return this.pow(e,r)}for(var a=this.m.subn(1),n=0;!a.isZero()&&0===a.andln(1);)n++,a.iushrn(1);assert(!a.isZero());var o=new BN(1).toRed(this),s=o.redNeg(),c=this.m.subn(1).iushrn(1),d=this.m.bitLength();for(d=new BN(2*d*d).toRed(this);0!==this.pow(d,c).cmp(s);)d.redIAdd(s);for(var u=this.pow(d,a),h=this.pow(e,a.addn(1).iushrn(1)),l=this.pow(e,a),b=n;0!==l.cmp(o);){for(var g=l,p=0;0!==g.cmp(o);p++)g=g.redSqr();assert(p=0;a--){for(var d=t.words[a],u=c-1;u>=0;u--){var h=d>>u&1;n!==r[0]&&(n=this.sqr(n)),0!==h||0!==o?(o<<=1,o|=h,(4===++s||0===a&&0===u)&&(n=this.mul(n,r[o]),s=0,o=0)):s=0}c=26}return n},Red.prototype.convertTo=function convertTo(e){var t=e.umod(this.m);return t===e?t.clone():t},Red.prototype.convertFrom=function convertFrom(e){var t=e.clone();return t.red=null,t},BN.mont=function mont(e){return new Mont(e)},inherits(Mont,Red),Mont.prototype.convertTo=function convertTo(e){return this.imod(e.ushln(this.shift))},Mont.prototype.convertFrom=function convertFrom(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},Mont.prototype.imul=function imul(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var r=e.imul(t),a=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(a).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},Mont.prototype.mul=function mul(e,t){if(e.isZero()||t.isZero())return new BN(0)._forceRed(this);var r=e.mul(t),a=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(a).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},Mont.prototype.invm=function invm(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(e=r.nmd(e),this)},(e,t,r)=>{"use strict";var a,n=r(1),o=r(2),s=o.Buffer,c={};for(a in o)o.hasOwnProperty(a)&&"SlowBuffer"!==a&&"Buffer"!==a&&(c[a]=o[a]);var d=c.Buffer={};for(a in s)s.hasOwnProperty(a)&&"allocUnsafe"!==a&&"allocUnsafeSlow"!==a&&(d[a]=s[a]);if(c.Buffer.prototype=s.prototype,d.from&&d.from!==Uint8Array.from||(d.from=function(e,t,r){if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type '+typeof e);if(e&&void 0===e.length)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);return s(e,t,r)}),d.alloc||(d.alloc=function(e,t,r){if("number"!=typeof e)throw new TypeError('The "size" argument must be of type number. Received type '+typeof e);if(e<0||e>=2*(1<<30))throw new RangeError('The value "'+e+'" is invalid for option "size"');var a=s(e);return t&&0!==t.length?"string"==typeof r?a.fill(t,r):a.fill(t):a.fill(0),a}),!c.kStringMaxLength)try{c.kStringMaxLength=n.binding("buffer").kStringMaxLength}catch(e){}c.constants||(c.constants={MAX_LENGTH:c.kMaxLength},c.kStringMaxLength&&(c.constants.MAX_STRING_LENGTH=c.kStringMaxLength)),e.exports=c},(e,t,r)=>{"use strict";const a=r(461).a,n=r(264).b,o=r(264).a,s=r(67),c=["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"],d=["key","obj","use","optional","explicit","implicit","def","choice","any","contains"].concat(c);function Node(e,t,r){const a={};this._baseState=a,a.name=r,a.enc=e,a.parent=t||null,a.children=null,a.tag=null,a.args=null,a.reverseArgs=null,a.choice=null,a.optional=!1,a.any=!1,a.obj=!1,a.use=null,a.useDecoder=null,a.key=null,a.default=null,a.explicit=null,a.implicit=null,a.contains=null,a.parent||(a.children=[],this._wrap())}e.exports=Node;const u=["enc","parent","children","tag","args","reverseArgs","choice","optional","any","obj","use","alteredUse","key","default","explicit","implicit","contains"];Node.prototype.clone=function clone(){const e=this._baseState,t={};u.forEach((function(r){t[r]=e[r]}));const r=new this.constructor(t.parent);return r._baseState=t,r},Node.prototype._wrap=function wrap(){const e=this._baseState;d.forEach((function(t){this[t]=function _wrappedMethod(){const r=new this.constructor(this);return e.children.push(r),r[t].apply(r,arguments)}}),this)},Node.prototype._init=function init(e){const t=this._baseState;s(null===t.parent),e.call(this),t.children=t.children.filter((function(e){return e._baseState.parent===this}),this),s.equal(t.children.length,1,"Root node can have only one child")},Node.prototype._useArgs=function useArgs(e){const t=this._baseState,r=e.filter((function(e){return e instanceof this.constructor}),this);e=e.filter((function(e){return!(e instanceof this.constructor)}),this),0!==r.length&&(s(null===t.children),t.children=r,r.forEach((function(e){e._baseState.parent=this}),this)),0!==e.length&&(s(null===t.args),t.args=e,t.reverseArgs=e.map((function(e){if("object"!=typeof e||e.constructor!==Object)return e;const t={};return Object.keys(e).forEach((function(r){r==(0|r)&&(r|=0);const a=e[r];t[a]=r})),t})))},["_peekTag","_decodeTag","_use","_decodeStr","_decodeObjid","_decodeTime","_decodeNull","_decodeInt","_decodeBool","_decodeList","_encodeComposite","_encodeStr","_encodeObjid","_encodeTime","_encodeNull","_encodeInt","_encodeBool"].forEach((function(e){Node.prototype[e]=function _overrided(){const t=this._baseState;throw new Error(e+" not implemented for encoding: "+t.enc)}})),c.forEach((function(e){Node.prototype[e]=function _tagMethod(){const t=this._baseState,r=Array.prototype.slice.call(arguments);return s(null===t.tag),t.tag=e,this._useArgs(r),this}})),Node.prototype.use=function use(e){s(e);const t=this._baseState;return s(null===t.use),t.use=e,this},Node.prototype.optional=function optional(){return this._baseState.optional=!0,this},Node.prototype.def=function def(e){const t=this._baseState;return s(null===t.default),t.default=e,t.optional=!0,this},Node.prototype.explicit=function explicit(e){const t=this._baseState;return s(null===t.explicit&&null===t.implicit),t.explicit=e,this},Node.prototype.implicit=function implicit(e){const t=this._baseState;return s(null===t.explicit&&null===t.implicit),t.implicit=e,this},Node.prototype.obj=function obj(){const e=this._baseState,t=Array.prototype.slice.call(arguments);return e.obj=!0,0!==t.length&&this._useArgs(t),this},Node.prototype.key=function key(e){const t=this._baseState;return s(null===t.key),t.key=e,this},Node.prototype.any=function any(){return this._baseState.any=!0,this},Node.prototype.choice=function choice(e){const t=this._baseState;return s(null===t.choice),t.choice=e,this._useArgs(Object.keys(e).map((function(t){return e[t]}))),this},Node.prototype.contains=function contains(e){const t=this._baseState;return s(null===t.use),t.contains=e,this},Node.prototype._decode=function decode(e,t){const r=this._baseState;if(null===r.parent)return e.wrapResult(r.children[0]._decode(e,t));let a,n=r.default,s=!0,c=null;if(null!==r.key&&(c=e.enterKey(r.key)),r.optional){let a=null;if(null!==r.explicit?a=r.explicit:null!==r.implicit?a=r.implicit:null!==r.tag&&(a=r.tag),null!==a||r.any){if(s=this._peekTag(e,a,r.any),e.isError(s))return s}else{const a=e.save();try{null===r.choice?this._decodeGeneric(r.tag,e,t):this._decodeChoice(e,t),s=!0}catch(e){s=!1}e.restore(a)}}if(r.obj&&s&&(a=e.enterObject()),s){if(null!==r.explicit){const t=this._decodeTag(e,r.explicit);if(e.isError(t))return t;e=t}const a=e.offset;if(null===r.use&&null===r.choice){let t;r.any&&(t=e.save());const a=this._decodeTag(e,null!==r.implicit?r.implicit:r.tag,r.any);if(e.isError(a))return a;r.any?n=e.raw(t):e=a}if(t&&t.track&&null!==r.tag&&t.track(e.path(),a,e.length,"tagged"),t&&t.track&&null!==r.tag&&t.track(e.path(),e.offset,e.length,"content"),r.any||(n=null===r.choice?this._decodeGeneric(r.tag,e,t):this._decodeChoice(e,t)),e.isError(n))return n;if(r.any||null!==r.choice||null===r.children||r.children.forEach((function decodeChildren(r){r._decode(e,t)})),r.contains&&("octstr"===r.tag||"bitstr"===r.tag)){const a=new o(n);n=this._getUse(r.contains,e._reporterState.obj)._decode(a,t)}}return r.obj&&s&&(n=e.leaveObject(a)),null===r.key||null===n&&!0!==s?null!==c&&e.exitKey(c):e.leaveKey(c,r.key,n),n},Node.prototype._decodeGeneric=function decodeGeneric(e,t,r){const a=this._baseState;return"seq"===e||"set"===e?null:"seqof"===e||"setof"===e?this._decodeList(t,e,a.args[0],r):/str$/.test(e)?this._decodeStr(t,e,r):"objid"===e&&a.args?this._decodeObjid(t,a.args[0],a.args[1],r):"objid"===e?this._decodeObjid(t,null,null,r):"gentime"===e||"utctime"===e?this._decodeTime(t,e,r):"null_"===e?this._decodeNull(t,r):"bool"===e?this._decodeBool(t,r):"objDesc"===e?this._decodeStr(t,e,r):"int"===e||"enum"===e?this._decodeInt(t,a.args&&a.args[0],r):null!==a.use?this._getUse(a.use,t._reporterState.obj)._decode(t,r):t.error("unknown tag: "+e)},Node.prototype._getUse=function _getUse(e,t){const r=this._baseState;return r.useDecoder=this._use(e,t),s(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},Node.prototype._decodeChoice=function decodeChoice(e,t){const r=this._baseState;let a=null,n=!1;return Object.keys(r.choice).some((function(o){const s=e.save(),c=r.choice[o];try{const r=c._decode(e,t);if(e.isError(r))return!1;a={type:o,value:r},n=!0}catch(t){return e.restore(s),!1}return!0}),this),n?a:e.error("Choice not matched")},Node.prototype._createEncoderBuffer=function createEncoderBuffer(e){return new n(e,this.reporter)},Node.prototype._encode=function encode(e,t,r){const a=this._baseState;if(null!==a.default&&a.default===e)return;const n=this._encodeValue(e,t,r);return void 0===n||this._skipDefault(n,t,r)?void 0:n},Node.prototype._encodeValue=function encode(e,t,r){const n=this._baseState;if(null===n.parent)return n.children[0]._encode(e,t||new a);let o=null;if(this.reporter=t,n.optional&&void 0===e){if(null===n.default)return;e=n.default}let s=null,c=!1;if(n.any)o=this._createEncoderBuffer(e);else if(n.choice)o=this._encodeChoice(e,t);else if(n.contains)s=this._getUse(n.contains,r)._encode(e,t),c=!0;else if(n.children)s=n.children.map((function(r){if("null_"===r._baseState.tag)return r._encode(null,t,e);if(null===r._baseState.key)return t.error("Child should have a key");const a=t.enterKey(r._baseState.key);if("object"!=typeof e)return t.error("Child expected, but input is not object");const n=r._encode(e[r._baseState.key],t,e);return t.leaveKey(a),n}),this).filter((function(e){return e})),s=this._createEncoderBuffer(s);else if("seqof"===n.tag||"setof"===n.tag){if(!n.args||1!==n.args.length)return t.error("Too many args for : "+n.tag);if(!Array.isArray(e))return t.error("seqof/setof, but data is not Array");const r=this.clone();r._baseState.implicit=null,s=this._createEncoderBuffer(e.map((function(r){const a=this._baseState;return this._getUse(a.args[0],e)._encode(r,t)}),r))}else null!==n.use?o=this._getUse(n.use,r)._encode(e,t):(s=this._encodePrimitive(n.tag,e),c=!0);if(!n.any&&null===n.choice){const e=null!==n.implicit?n.implicit:n.tag,r=null===n.implicit?"universal":"context";null===e?null===n.use&&t.error("Tag could be omitted only for .use()"):null===n.use&&(o=this._encodeComposite(e,c,r,s))}return null!==n.explicit&&(o=this._encodeComposite(n.explicit,!1,"context",o)),o},Node.prototype._encodeChoice=function encodeChoice(e,t){const r=this._baseState,a=r.choice[e.type];return a||s(!1,e.type+" not found in "+JSON.stringify(Object.keys(r.choice))),a._encode(e.value,t)},Node.prototype._encodePrimitive=function encodePrimitive(e,t){const r=this._baseState;if(/str$/.test(e))return this._encodeStr(t,e);if("objid"===e&&r.args)return this._encodeObjid(t,r.reverseArgs[0],r.args[1]);if("objid"===e)return this._encodeObjid(t,null,null);if("gentime"===e||"utctime"===e)return this._encodeTime(t,e);if("null_"===e)return this._encodeNull();if("int"===e||"enum"===e)return this._encodeInt(t,r.args&&r.reverseArgs[0]);if("bool"===e)return this._encodeBool(t);if("objDesc"===e)return this._encodeStr(t,e);throw new Error("Unsupported tag: "+e)},Node.prototype._isNumstr=function isNumstr(e){return/^[0-9 ]*$/.test(e)},Node.prototype._isPrintstr=function isPrintstr(e){return/^[A-Za-z0-9 '()+,-./:=?]*$/.test(e)}},(e,t,r)=>{"use strict";var a=r(3).Buffer;Object.defineProperty(t,"__esModule",{value:!0}),t.ecdhUnsafe=t.ecdh=t.recover=t.verify=t.sign=t.signatureImportLax=t.signatureImport=t.signatureExport=t.signatureNormalize=t.publicKeyCombine=t.publicKeyTweakMul=t.publicKeyTweakAdd=t.publicKeyVerify=t.publicKeyConvert=t.publicKeyCreate=t.privateKeyTweakMul=t.privateKeyTweakAdd=t.privateKeyModInverse=t.privateKeyNegate=t.privateKeyImport=t.privateKeyExport=t.privateKeyVerify=void 0;var n=r(125),o=r(1265),s=r(1266);t.privateKeyVerify=function(e){return 32===e.length&&n.privateKeyVerify(Uint8Array.from(e))},t.privateKeyExport=function(e,t){if(32!==e.length)throw new RangeError("private key length is invalid");var r=o.privateKeyExport(e,t);return s.privateKeyExport(e,r,t)},t.privateKeyImport=function(e){if(null!==(e=s.privateKeyImport(e))&&32===e.length&&t.privateKeyVerify(e))return e;throw new Error("couldn't import from DER format")},t.privateKeyNegate=function(e){return a.from(n.privateKeyNegate(Uint8Array.from(e)))},t.privateKeyModInverse=function(e){if(32!==e.length)throw new Error("private key length is invalid");return a.from(o.privateKeyModInverse(Uint8Array.from(e)))},t.privateKeyTweakAdd=function(e,t){return a.from(n.privateKeyTweakAdd(Uint8Array.from(e),t))},t.privateKeyTweakMul=function(e,t){return a.from(n.privateKeyTweakMul(Uint8Array.from(e),Uint8Array.from(t)))},t.publicKeyCreate=function(e,t){return a.from(n.publicKeyCreate(Uint8Array.from(e),t))},t.publicKeyConvert=function(e,t){return a.from(n.publicKeyConvert(Uint8Array.from(e),t))},t.publicKeyVerify=function(e){return(33===e.length||65===e.length)&&n.publicKeyVerify(Uint8Array.from(e))},t.publicKeyTweakAdd=function(e,t,r){return a.from(n.publicKeyTweakAdd(Uint8Array.from(e),Uint8Array.from(t),r))},t.publicKeyTweakMul=function(e,t,r){return a.from(n.publicKeyTweakMul(Uint8Array.from(e),Uint8Array.from(t),r))},t.publicKeyCombine=function(e,t){var r=[];return e.forEach((function(e){r.push(Uint8Array.from(e))})),a.from(n.publicKeyCombine(r,t))},t.signatureNormalize=function(e){return a.from(n.signatureNormalize(Uint8Array.from(e)))},t.signatureExport=function(e){return a.from(n.signatureExport(Uint8Array.from(e)))},t.signatureImport=function(e){return a.from(n.signatureImport(Uint8Array.from(e)))},t.signatureImportLax=function(e){if(0===e.length)throw new RangeError("signature length is invalid");var t=s.signatureImportLax(e);if(null===t)throw new Error("couldn't parse DER signature");return o.signatureImport(t)},t.sign=function(e,t,r){if(null===r)throw new TypeError("options should be an Object");var o=void 0;if(r){if(o={},null===r.data)throw new TypeError("options.data should be a Buffer");if(r.data){if(32!=r.data.length)throw new RangeError("options.data length is invalid");o.data=new Uint8Array(r.data)}if(null===r.noncefn)throw new TypeError("options.noncefn should be a Function");r.noncefn&&(o.noncefn=function(e,t,n,o,s){var c=null!=n?a.from(n):null,d=null!=o?a.from(o):null,u=a.from("");return r.noncefn&&(u=r.noncefn(a.from(e),a.from(t),c,d,s)),new Uint8Array(u)})}var s=n.ecdsaSign(Uint8Array.from(e),Uint8Array.from(t),o);return{signature:a.from(s.signature),recovery:s.recid}},t.verify=function(e,t,r){return n.ecdsaVerify(Uint8Array.from(t),Uint8Array.from(e),r)},t.recover=function(e,t,r,o){return a.from(n.ecdsaRecover(Uint8Array.from(t),r,Uint8Array.from(e),o))},t.ecdh=function(e,t){return a.from(n.ecdh(Uint8Array.from(e),Uint8Array.from(t),{}))},t.ecdhUnsafe=function(e,t,r){if(33!==e.length&&65!==e.length)throw new RangeError("public key length is invalid");if(32!==t.length)throw new RangeError("private key length is invalid");return a.from(o.ecdhUnsafe(Uint8Array.from(e),Uint8Array.from(t),r))}},(e,t,r)=>{"use strict";var a,n=t,o=r(334),s=r(472),c=r(69).assert;function PresetCurve(e){"short"===e.type?this.curve=new s.short(e):"edwards"===e.type?this.curve=new s.edwards(e):this.curve=new s.mont(e),this.g=this.curve.g,this.n=this.curve.n,this.hash=e.hash,c(this.g.validate(),"Invalid curve"),c(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function defineCurve(e,t){Object.defineProperty(n,e,{configurable:!0,enumerable:!0,get:function(){var r=new PresetCurve(t);return Object.defineProperty(n,e,{configurable:!0,enumerable:!0,value:r}),r}})}n.PresetCurve=PresetCurve,defineCurve("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:o.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),defineCurve("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:o.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),defineCurve("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:o.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),defineCurve("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:o.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"]}),defineCurve("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:o.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"]}),defineCurve("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:o.sha256,gRed:!1,g:["9"]}),defineCurve("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:o.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});try{a=r(798)}catch(e){a=void 0}defineCurve("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:o.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",a]})},(e,t,r)=>{var a=t;a.utils=r(110),a.common=r(268),a.sha=r(1260),a.ripemd=r(1261),a.hmac=r(797),a.sha1=a.sha.sha1,a.sha256=a.sha.sha256,a.sha224=a.sha.sha224,a.sha384=a.sha.sha384,a.sha512=a.sha.sha512,a.ripemd160=a.ripemd.ripemd160},(e,t,r)=>{"use strict";var a=r(3).Buffer;Object.defineProperty(t,"__esModule",{value:!0}),t.KECCAK256_RLP=t.KECCAK256_RLP_S=t.KECCAK256_RLP_ARRAY=t.KECCAK256_RLP_ARRAY_S=t.KECCAK256_NULL=t.KECCAK256_NULL_S=t.TWO_POW256=t.MAX_INTEGER=void 0;var n=r(126);t.MAX_INTEGER=new n("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",16),t.TWO_POW256=new n("10000000000000000000000000000000000000000000000000000000000000000",16),t.KECCAK256_NULL_S="c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470",t.KECCAK256_NULL=a.from(t.KECCAK256_NULL_S,"hex"),t.KECCAK256_RLP_ARRAY_S="1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",t.KECCAK256_RLP_ARRAY=a.from(t.KECCAK256_RLP_ARRAY_S,"hex"),t.KECCAK256_RLP_S="56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",t.KECCAK256_RLP=a.from(t.KECCAK256_RLP_S,"hex")},(e,t,r)=>{"use strict";var a=r(810);e.exports=Function.prototype.bind||a},e=>{var t=Object.prototype.hasOwnProperty,r=Object.prototype.toString;e.exports=function forEach(e,a,n){if("[object Function]"!==r.call(a))throw new TypeError("iterator must be a function");var o=e.length;if(o===+o)for(var s=0;s{"use strict";var a=["BigInt64Array","BigUint64Array","Float32Array","Float64Array","Int16Array","Int32Array","Int8Array","Uint16Array","Uint32Array","Uint8Array","Uint8ClampedArray"];e.exports=function availableTypedArrays(){for(var e=[],t=0;t{(t=e.exports=r(489)).Stream=t,t.Readable=t,t.Writable=r(492),t.Duplex=r(182),t.Transform=r(494),t.PassThrough=r(838),t.finished=r(340),t.pipeline=r(839)},(e,t,r)=>{"use strict";var a=r(235).a.ERR_STREAM_PREMATURE_CLOSE;function noop(){}e.exports=function eos(e,t,r){if("function"==typeof t)return eos(e,null,t);t||(t={}),r=function once(e){var t=!1;return function(){if(!t){t=!0;for(var r=arguments.length,a=new Array(r),n=0;n{"use strict";var a=r(3).Buffer;Object.defineProperty(t,"__esModule",{value:!0}),t.assertIsString=t.assertIsArray=t.assertIsBuffer=t.assertIsHexString=void 0;var n=r(87);t.assertIsHexString=function(e){if(!n.isHexString(e))throw new Error("This method only supports 0x-prefixed hex strings but input was: "+e)},t.assertIsBuffer=function(e){if(!a.isBuffer(e))throw new Error("This method only supports Buffer but input was: "+e)},t.assertIsArray=function(e){if(!Array.isArray(e))throw new Error("This method only supports number arrays but input was: "+e)},t.assertIsString=function(e){if("string"!=typeof e)throw new Error("This method only supports strings but input was: "+e)}},function(e,t,r){"use strict";var a=r(4).Buffer,n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.EIP2930AccessListTransaction=void 0;const o=r(8),s=r(47),c=r(16),d=r(46),u=r(160),h=r(890),l=r(97),b=n(r(349)),g=r(14);const p=[2718,2930];class EIP2930AccessListTransaction extends u.RuntimeTransaction{constructor(e,t,r){if(super(e,t,r),this.type=o.Quantity.from("0x1"),Array.isArray(e)){this.chainId=o.Quantity.from(e[0]),this.nonce=o.Quantity.from(e[1]),this.gasPrice=this.effectiveGasPrice=o.Quantity.from(e[2]),this.gas=o.Quantity.from(e[3]),this.to=0==e[4].length?o.RPCQUANTITY_EMPTY:s.Address.from(e[4]),this.value=o.Quantity.from(e[5]),this.data=o.Data.from(e[6]);const a=h.AccessLists.getAccessListData(e[7]);if(this.accessList=a.accessList,this.accessListJSON=a.AccessListJSON,this.accessListDataFee=a.dataFeeEIP2930,this.v=o.Quantity.from(e[8]),this.r=o.Quantity.from(e[9]),this.s=o.Quantity.from(e[10]),this.raw=[this.type.toBuffer(),...e],!r){if(t.chainId()!==this.chainId.toNumber())throw new g.CodedError(`Invalid chain id (${this.chainId.toNumber()}) for chain with id ${t.chainId()}.`,o.JsonRpcErrorCode.INVALID_INPUT);const{from:e,serialized:r,hash:a,encodedData:n,encodedSignature:s}=this.computeIntrinsics(this.v,this.raw);this.from=e,this.serialized=r,this.hash=a,this.encodedData=n,this.encodedSignature=s}}else{if(e.chainId){if(this.chainId=o.Quantity.from(e.chainId),this.common.chainId()!==this.chainId.toNumber())throw new g.CodedError(`Invalid chain id (${this.chainId.toNumber()}) for chain with id ${t.chainId()}.`,o.JsonRpcErrorCode.INVALID_INPUT)}else this.chainId=o.Quantity.from(t.chainIdBN().toArrayLike(a));this.gasPrice=this.effectiveGasPrice=o.Quantity.from(e.gasPrice);const r=h.AccessLists.getAccessListData(e.accessList);this.accessList=r.accessList,this.accessListJSON=r.AccessListJSON,this.accessListDataFee=r.dataFeeEIP2930,this.validateAndSetSignature(e)}}toJSON(e){return{hash:this.hash,type:this.type,chainId:this.chainId,nonce:this.nonce,blockHash:this.blockHash?this.blockHash:null,blockNumber:this.blockNumber?this.blockNumber:null,transactionIndex:this.index?this.index:null,from:this.from,to:this.to.isNull()?null:this.to,value:this.value,gas:this.gas,gasPrice:this.gasPrice,input:this.data,accessList:this.accessListJSON,v:this.v,r:this.r,s:this.s}}static fromTxData(e,t,r){return new EIP2930AccessListTransaction(e,t,r)}toVmTransaction(){const e=this.from.toBuffer(),t=this.to.toBuffer(),r=this.data.toBuffer();return{hash:()=>o.BUFFER_32_ZERO,nonce:new c.BN(this.nonce.toBuffer()),gasPrice:new c.BN(this.gasPrice.toBuffer()),gasLimit:new c.BN(this.gas.toBuffer()),to:0===t.length?null:{buf:t,equals:e=>t.equals(e.buf)},value:new c.BN(this.value.toBuffer()),data:r,AccessListJSON:this.accessListJSON,getSenderAddress:()=>({buf:e,equals:t=>e.equals(t.buf)}),getBaseFee:()=>{const e=this.calculateIntrinsicGas();return new c.BN(o.Quantity.from(e+this.accessListDataFee).toBuffer())},getUpfrontCost:()=>{const{gas:e,gasPrice:t,value:r}=this;try{const a=e.toBigInt()*t.toBigInt()+r.toBigInt();return new c.BN(o.Quantity.from(a).toBuffer())}catch(e){throw e}},supports:e=>p.includes(e)}}signAndHash(e){if(null!=this.v)throw new Error("Internal Error: RuntimeTransaction `sign` called but transaction has already been signed");const t=this.type.toBuffer(),r=this.toEthRawTransaction(o.BUFFER_ZERO,o.BUFFER_ZERO,o.BUFFER_ZERO),n=d.encodeRange(r,1,8),s=n.length,c=function ecsign(e,t){const r={signature:new Uint8Array(64),recid:null};if(0===b.default.ecdsaSign(r,e,t)){const e=r.signature.buffer;return{r:a.from(e,0,32),s:a.from(e,32,32),v:r.recid}}throw new Error("The nonce generation function failed, or the private key was invalid")}(o.keccak(a.concat([t,d.digest([n.output],s)])),e);this.v=o.Quantity.from(c.v),this.r=o.Quantity.from(c.r),this.s=o.Quantity.from(c.s),r[9]=this.v.toBuffer(),r[10]=this.r.toBuffer(),r[11]=this.s.toBuffer(),this.raw=r;const u=d.encodeRange(r,9,3);this.serialized=a.concat([t,d.digest([n.output,u.output],s+u.length)]),this.hash=o.Data.from(o.keccak(this.serialized)),this.encodedData=n,this.encodedSignature=u}toEthRawTransaction(e,t,r){return[this.type.toBuffer(),this.chainId.toBuffer(),this.nonce.toBuffer(),this.gasPrice.toBuffer(),this.gas.toBuffer(),this.to.toBuffer(),this.value.toBuffer(),this.data.toBuffer(),this.accessList,e,t,r]}computeIntrinsics(e,t){return l.computeIntrinsicsAccessListTx(e,t)}updateEffectiveGasPrice(){}}t.EIP2930AccessListTransaction=EIP2930AccessListTransaction},(e,t,r)=>{"use strict";var a=r(4).Buffer;Object.defineProperty(t,"__esModule",{value:!0}),t.getLength=t.decode=t.encode=void 0;var n=r(501);function safeParseInt(e,t){if("00"===e.slice(0,2))throw new Error("invalid RLP: extra zeros");return parseInt(e,t)}function encodeLength(e,t){if(e<56)return a.from([e+t]);var r=intToHex(e),n=intToHex(t+55+r.length/2);return a.from(n+r,"hex")}function _decode(e){var t,r,n,o,s,c=[],d=e[0];if(d<=127)return{data:e.slice(0,1),remainder:e.slice(1)};if(d<=183){if(t=d-127,n=128===d?a.from([]):e.slice(1,t),2===t&&n[0]<128)throw new Error("invalid rlp encoding: byte must be less 0x80");return{data:n,remainder:e.slice(t)}}if(d<=191){if(r=d-182,e.length-1e.length)throw new Error("invalid rlp: total length is larger than the data");if(0===(o=e.slice(r,u)).length)throw new Error("invalid rlp, List has a invalid length");for(;o.length;)s=_decode(o),c.push(s.data),o=s.remainder;return{data:c,remainder:e.slice(u)}}function isHexPrefixed(e){return"0x"===e.slice(0,2)}function intToHex(e){if(e<0)throw new Error("Invalid integer as argument, must be unsigned!");var t=e.toString(16);return t.length%2?"0"+t:t}function toBuffer(e){if(!a.isBuffer(e)){if("string"==typeof e)return isHexPrefixed(e)?a.from(function padToEven(e){return e.length%2?"0"+e:e}(function stripHexPrefix(e){return"string"!=typeof e?e:isHexPrefixed(e)?e.slice(2):e}(e)),"hex"):a.from(e);if("number"==typeof e||"bigint"==typeof e)return e?function intToBuffer(e){var t=intToHex(e);return a.from(t,"hex")}(e):a.from([]);if(null==e)return a.from([]);if(e instanceof Uint8Array)return a.from(e);if(n.isBN(e))return a.from(e.toArray());throw new Error("invalid type")}return e}t.encode=function encode(e){if(Array.isArray(e)){for(var t=[],r=0;r{"use strict";var a,n=t,o=r(345),s=r(505),c=r(72).assert;function PresetCurve(e){"short"===e.type?this.curve=new s.short(e):"edwards"===e.type?this.curve=new s.edwards(e):this.curve=new s.mont(e),this.g=this.curve.g,this.n=this.curve.n,this.hash=e.hash,c(this.g.validate(),"Invalid curve"),c(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function defineCurve(e,t){Object.defineProperty(n,e,{configurable:!0,enumerable:!0,get:function(){var r=new PresetCurve(t);return Object.defineProperty(n,e,{configurable:!0,enumerable:!0,value:r}),r}})}n.PresetCurve=PresetCurve,defineCurve("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:o.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),defineCurve("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:o.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),defineCurve("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:o.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),defineCurve("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:o.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"]}),defineCurve("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:o.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"]}),defineCurve("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:o.sha256,gRed:!1,g:["9"]}),defineCurve("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:o.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});try{a=r(860)}catch(e){a=void 0}defineCurve("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:o.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",a]})},(e,t,r)=>{var a=t;a.utils=r(111),a.common=r(276),a.sha=r(1287),a.ripemd=r(1288),a.hmac=r(859),a.sha1=a.sha.sha1,a.sha256=a.sha.sha256,a.sha224=a.sha.sha224,a.sha384=a.sha.sha384,a.sha512=a.sha.sha512,a.ripemd160=a.ripemd.ripemd160},(e,t,r)=>{"use strict";var a=r(4).Buffer;Object.defineProperty(t,"__esModule",{value:!0}),t.assertIsString=t.assertIsArray=t.assertIsBuffer=t.assertIsHexString=void 0;var n=r(186);t.assertIsHexString=function(e){if(!n.isHexString(e))throw new Error("This method only supports 0x-prefixed hex strings but input was: "+e)},t.assertIsBuffer=function(e){if(!a.isBuffer(e))throw new Error("This method only supports Buffer but input was: "+e)},t.assertIsArray=function(e){if(!Array.isArray(e))throw new Error("This method only supports number arrays but input was: "+e)},t.assertIsString=function(e){if("string"!=typeof e)throw new Error("This method only supports strings but input was: "+e)}},(e,t,r)=>{(t=e.exports=r(511)).Stream=t,t.Readable=t,t.Writable=r(514),t.Duplex=r(187),t.Transform=r(516),t.PassThrough=r(881),t.finished=r(348),t.pipeline=r(882)},(e,t,r)=>{"use strict";var a=r(237).a.ERR_STREAM_PREMATURE_CLOSE;function noop(){}e.exports=function eos(e,t,r){if("function"==typeof t)return eos(e,null,t);t||(t={}),r=function once(e){var t=!1;return function(){if(!t){t=!0;for(var r=arguments.length,a=new Array(r),n=0;n{"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const path_1=__webpack_require__(240);let secp256k1;try{const nodeRequire=eval("require"),path=nodeRequire.resolve("secp256k1/package.json"),dir=path_1.dirname(path),nodeGypBuild=__webpack_require__(893),{Secp256k1}=nodeGypBuild(dir);secp256k1=new Secp256k1}catch{secp256k1=__webpack_require__(895)}exports.default=secp256k1},()=>{},(e,t,r)=>{"use strict";var a,n=t,o=r(352),s=r(525),c=r(74).assert;function PresetCurve(e){"short"===e.type?this.curve=new s.short(e):"edwards"===e.type?this.curve=new s.edwards(e):this.curve=new s.mont(e),this.g=this.curve.g,this.n=this.curve.n,this.hash=e.hash,c(this.g.validate(),"Invalid curve"),c(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function defineCurve(e,t){Object.defineProperty(n,e,{configurable:!0,enumerable:!0,get:function(){var r=new PresetCurve(t);return Object.defineProperty(n,e,{configurable:!0,enumerable:!0,value:r}),r}})}n.PresetCurve=PresetCurve,defineCurve("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:o.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),defineCurve("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:o.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),defineCurve("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:o.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),defineCurve("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:o.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"]}),defineCurve("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:o.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"]}),defineCurve("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:o.sha256,gRed:!1,g:["9"]}),defineCurve("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:o.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});try{a=r(905)}catch(e){a=void 0}defineCurve("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:o.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",a]})},(e,t,r)=>{var a=t;a.utils=r(113),a.common=r(279),a.sha=r(1326),a.ripemd=r(1327),a.hmac=r(904),a.sha1=a.sha.sha1,a.sha256=a.sha.sha256,a.sha224=a.sha.sha224,a.sha384=a.sha.sha384,a.sha512=a.sha.sha512,a.ripemd160=a.ripemd.ripemd160},function(e,t,r){"use strict";var a=r(4).Buffer,n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.EIP1559FeeMarketTransaction=void 0;const o=r(8),s=r(47),c=r(16),d=r(46),u=r(160),h=r(890),l=r(97),b=n(r(349)),g=r(14);const p=[2718,2930,1559];class EIP1559FeeMarketTransaction extends u.RuntimeTransaction{constructor(e,t,r){if(super(e,t,r),this.type=o.Quantity.from("0x2"),Array.isArray(e)){this.chainId=o.Quantity.from(e[0]),this.nonce=o.Quantity.from(e[1]),this.maxPriorityFeePerGas=o.Quantity.from(e[2]),this.maxFeePerGas=o.Quantity.from(e[3]),this.gas=o.Quantity.from(e[4]),this.to=0==e[5].length?o.RPCQUANTITY_EMPTY:s.Address.from(e[5]),this.value=o.Quantity.from(e[6]),this.data=o.Data.from(e[7]);const a=h.AccessLists.getAccessListData(e[8]);if(this.accessList=a.accessList,this.accessListJSON=a.AccessListJSON,this.v=o.Quantity.from(e[9]),this.r=o.Quantity.from(e[10]),this.s=o.Quantity.from(e[11]),this.raw=[this.type.toBuffer(),...e],!r){if(t.chainId()!==this.chainId.toNumber())throw new g.CodedError(`Invalid chain id (${this.chainId.toNumber()}) for chain with id ${t.chainId()}.`,o.JsonRpcErrorCode.INVALID_INPUT);const{from:e,serialized:r,hash:a,encodedData:n,encodedSignature:s}=this.computeIntrinsics(this.v,this.raw);this.from=e,this.serialized=r,this.hash=a,this.encodedData=n,this.encodedSignature=s}}else{if(e.chainId){if(this.chainId=o.Quantity.from(e.chainId),this.common.chainId()!==this.chainId.toNumber())throw new g.CodedError(`Invalid chain id (${this.chainId.toNumber()}) for chain with id ${t.chainId()}.`,o.JsonRpcErrorCode.INVALID_INPUT)}else this.chainId=o.Quantity.from(t.chainIdBN().toArrayLike(a));this.maxPriorityFeePerGas=o.Quantity.from(e.maxPriorityFeePerGas),this.maxFeePerGas=o.Quantity.from(e.maxFeePerGas);const r=h.AccessLists.getAccessListData(e.accessList);this.accessList=r.accessList,this.accessListJSON=r.AccessListJSON,this.validateAndSetSignature(e)}}toJSON(e){return{type:this.type,hash:this.hash,chainId:this.chainId,nonce:this.nonce,blockHash:this.blockHash?this.blockHash:null,blockNumber:this.blockNumber?this.blockNumber:null,transactionIndex:this.index?this.index:null,from:this.from,to:this.to.isNull()?null:this.to,value:this.value,maxPriorityFeePerGas:this.maxPriorityFeePerGas,maxFeePerGas:this.maxFeePerGas,gasPrice:this.effectiveGasPrice,gas:this.gas,input:this.data,accessList:this.accessListJSON,v:this.v,r:this.r,s:this.s}}static fromTxData(e,t,r){return new EIP1559FeeMarketTransaction(e,t,r)}toVmTransaction(){const e=this.from.toBuffer(),t=this.to.toBuffer(),r=this.data.toBuffer();return{hash:()=>o.BUFFER_32_ZERO,nonce:new c.BN(this.nonce.toBuffer()),maxPriorityFeePerGas:new c.BN(this.maxPriorityFeePerGas.toBuffer()),maxFeePerGas:new c.BN(this.maxFeePerGas.toBuffer()),gasLimit:new c.BN(this.gas.toBuffer()),to:0===t.length?null:{buf:t,equals:e=>t.equals(e.buf)},value:new c.BN(this.value.toBuffer()),data:r,AccessListJSON:this.accessListJSON,getSenderAddress:()=>({buf:e,equals:t=>e.equals(t.buf)}),getBaseFee:()=>{const e=this.calculateIntrinsicGas();return new c.BN(o.Quantity.from(e).toBuffer())},getUpfrontCost:(e=new c.BN(0))=>{const{gas:t,maxPriorityFeePerGas:r,maxFeePerGas:a,value:n}=this,o=new c.BN(r.toBuffer()),s=new c.BN(a.toBuffer()),d=new c.BN(t.toBuffer()),u=new c.BN(n.toBuffer()),h=c.BN.min(o,s.sub(e)).add(e);return d.mul(h).add(u)},supports:e=>p.includes(e)}}signAndHash(e){if(null!=this.v)throw new Error("Internal Error: RuntimeTransaction `sign` called but transaction has already been signed");const t=this.type.toBuffer(),r=this.toEthRawTransaction(o.BUFFER_ZERO,o.BUFFER_ZERO,o.BUFFER_ZERO),n=d.encodeRange(r,1,9),s=n.length,c=function ecsign(e,t){const r={signature:new Uint8Array(64),recid:null};if(0===b.default.ecdsaSign(r,e,t)){const e=r.signature.buffer;return{r:a.from(e,0,32),s:a.from(e,32,32),v:r.recid}}throw new Error("The nonce generation function failed, or the private key was invalid")}(o.keccak(a.concat([t,d.digest([n.output],s)])),e);this.v=o.Quantity.from(c.v),this.r=o.Quantity.from(c.r),this.s=o.Quantity.from(c.s),r[10]=this.v.toBuffer(),r[11]=this.r.toBuffer(),r[12]=this.s.toBuffer(),this.raw=r;const u=d.encodeRange(r,10,3);this.serialized=a.concat([t,d.digest([n.output,u.output],s+u.length)]),this.hash=o.Data.from(o.keccak(this.serialized)),this.encodedData=n,this.encodedSignature=u}toEthRawTransaction(e,t,r){return[this.type.toBuffer(),this.chainId.toBuffer(),this.nonce.toBuffer(),this.maxPriorityFeePerGas.toBuffer(),this.maxFeePerGas.toBuffer(),this.gas.toBuffer(),this.to.toBuffer(),this.value.toBuffer(),this.data.toBuffer(),this.accessList,e,t,r]}computeIntrinsics(e,t){return l.computeIntrinsicsFeeMarketTx(e,t)}updateEffectiveGasPrice(e){const t=e.toBigInt(),r=this.maxFeePerGas.toBigInt(),a=this.maxPriorityFeePerGas.toBigInt(),n=r-t,s=n{"use strict";var a=r(2).Buffer;Object.defineProperty(t,"__esModule",{value:!0}),t.getLength=t.decode=t.encode=void 0;var n=r(528);function safeParseInt(e,t){if("00"===e.slice(0,2))throw new Error("invalid RLP: extra zeros");return parseInt(e,t)}function encodeLength(e,t){if(e<56)return a.from([e+t]);var r=intToHex(e),n=intToHex(t+55+r.length/2);return a.from(n+r,"hex")}function _decode(e){var t,r,n,o,s,c=[],d=e[0];if(d<=127)return{data:e.slice(0,1),remainder:e.slice(1)};if(d<=183){if(t=d-127,n=128===d?a.from([]):e.slice(1,t),2===t&&n[0]<128)throw new Error("invalid rlp encoding: byte must be less 0x80");return{data:n,remainder:e.slice(t)}}if(d<=191){if(r=d-182,e.length-1e.length)throw new Error("invalid rlp: total length is larger than the data");if(0===(o=e.slice(r,u)).length)throw new Error("invalid rlp, List has a invalid length");for(;o.length;)s=_decode(o),c.push(s.data),o=s.remainder;return{data:c,remainder:e.slice(u)}}function isHexPrefixed(e){return"0x"===e.slice(0,2)}function intToHex(e){if(e<0)throw new Error("Invalid integer as argument, must be unsigned!");var t=e.toString(16);return t.length%2?"0"+t:t}function toBuffer(e){if(!a.isBuffer(e)){if("string"==typeof e)return isHexPrefixed(e)?a.from(function padToEven(e){return e.length%2?"0"+e:e}(function stripHexPrefix(e){return"string"!=typeof e?e:isHexPrefixed(e)?e.slice(2):e}(e)),"hex"):a.from(e);if("number"==typeof e||"bigint"==typeof e)return e?function intToBuffer(e){var t=intToHex(e);return a.from(t,"hex")}(e):a.from([]);if(null==e)return a.from([]);if(e instanceof Uint8Array)return a.from(e);if(n.isBN(e))return a.from(e.toArray());throw new Error("invalid type")}return e}t.encode=function encode(e){if(Array.isArray(e)){for(var t=[],r=0;r{"use strict";var a,n=t,o=r(356),s=r(532),c=r(75).assert;function PresetCurve(e){"short"===e.type?this.curve=new s.short(e):"edwards"===e.type?this.curve=new s.edwards(e):this.curve=new s.mont(e),this.g=this.curve.g,this.n=this.curve.n,this.hash=e.hash,c(this.g.validate(),"Invalid curve"),c(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function defineCurve(e,t){Object.defineProperty(n,e,{configurable:!0,enumerable:!0,get:function(){var r=new PresetCurve(t);return Object.defineProperty(n,e,{configurable:!0,enumerable:!0,value:r}),r}})}n.PresetCurve=PresetCurve,defineCurve("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:o.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),defineCurve("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:o.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),defineCurve("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:o.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),defineCurve("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:o.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"]}),defineCurve("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:o.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"]}),defineCurve("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:o.sha256,gRed:!1,g:["9"]}),defineCurve("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:o.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});try{a=r(927)}catch(e){a=void 0}defineCurve("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:o.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",a]})},(e,t,r)=>{var a=t;a.utils=r(114),a.common=r(281),a.sha=r(1334),a.ripemd=r(1335),a.hmac=r(926),a.sha1=a.sha.sha1,a.sha256=a.sha.sha256,a.sha224=a.sha.sha224,a.sha384=a.sha.sha384,a.sha512=a.sha.sha512,a.ripemd160=a.ripemd.ripemd160},(e,t,r)=>{"use strict";var a=r(2).Buffer;Object.defineProperty(t,"__esModule",{value:!0}),t.assertIsString=t.assertIsArray=t.assertIsBuffer=t.assertIsHexString=void 0;var n=r(195);t.assertIsHexString=function(e){if(!n.isHexString(e))throw new Error("This method only supports 0x-prefixed hex strings but input was: "+e)},t.assertIsBuffer=function(e){if(!a.isBuffer(e))throw new Error("This method only supports Buffer but input was: "+e)},t.assertIsArray=function(e){if(!Array.isArray(e))throw new Error("This method only supports number arrays but input was: "+e)},t.assertIsString=function(e){if("string"!=typeof e)throw new Error("This method only supports strings but input was: "+e)}},(e,t,r)=>{(t=e.exports=r(538)).Stream=t,t.Readable=t,t.Writable=r(541),t.Duplex=r(196),t.Transform=r(543),t.PassThrough=r(948),t.finished=r(359),t.pipeline=r(949)},(e,t,r)=>{"use strict";var a=r(242).a.ERR_STREAM_PREMATURE_CLOSE;function noop(){}e.exports=function eos(e,t,r){if("function"==typeof t)return eos(e,null,t);t||(t={}),r=function once(e){var t=!1;return function(){if(!t){t=!0;for(var r=arguments.length,a=new Array(r),n=0;n{e.exports=r(958)(r(959))},(e,t,r)=>{"use strict";var a=t;a.version=r(1344).a,a.utils=r(77),a.rand=r(362),a.curve=r(550),a.curves=r(363),a.ec=r(969),a.eddsa=r(973)},(e,t,r)=>{var a;function Rand(e){this.rand=e}if(e.exports=function rand(e){return a||(a=new Rand(null)),a.generate(e)},e.exports.Rand=Rand,Rand.prototype.generate=function generate(e){return this._rand(e)},Rand.prototype._rand=function _rand(e){if(this.rand.getBytes)return this.rand.getBytes(e);for(var t=new Uint8Array(e),r=0;r{"use strict";var a,n=t,o=r(364),s=r(550),c=r(77).assert;function PresetCurve(e){"short"===e.type?this.curve=new s.short(e):"edwards"===e.type?this.curve=new s.edwards(e):this.curve=new s.mont(e),this.g=this.curve.g,this.n=this.curve.n,this.hash=e.hash,c(this.g.validate(),"Invalid curve"),c(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function defineCurve(e,t){Object.defineProperty(n,e,{configurable:!0,enumerable:!0,get:function(){var r=new PresetCurve(t);return Object.defineProperty(n,e,{configurable:!0,enumerable:!0,value:r}),r}})}n.PresetCurve=PresetCurve,defineCurve("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:o.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),defineCurve("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:o.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),defineCurve("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:o.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),defineCurve("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:o.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"]}),defineCurve("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:o.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"]}),defineCurve("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:o.sha256,gRed:!1,g:["9"]}),defineCurve("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:o.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});try{a=r(968)}catch(e){a=void 0}defineCurve("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:o.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",a]})},(e,t,r)=>{var a=t;a.utils=r(115),a.common=r(283),a.sha=r(1345),a.ripemd=r(1346),a.hmac=r(967),a.sha1=a.sha.sha1,a.sha256=a.sha.sha256,a.sha224=a.sha.sha224,a.sha384=a.sha.sha384,a.sha512=a.sha.sha512,a.ripemd160=a.ripemd.ripemd160},(e,t,r)=>{"use strict";var a=r(1),n=65536,o=4294967295;var s=r(19).Buffer,c=r.g.crypto||r.g.msCrypto;c&&c.getRandomValues?e.exports=function randomBytes(e,t){if(e>o)throw new RangeError("requested too many random bytes");var r=s.allocUnsafe(e);if(e>0)if(e>n)for(var d=0;d{"use strict";var a=r(0).Buffer;Object.defineProperty(t,"__esModule",{value:!0}),t.assertIsString=t.assertIsArray=t.assertIsBuffer=t.assertIsHexString=void 0;var n=r(62);t.assertIsHexString=function(e){if(!n.isHexString(e))throw new Error("This method only supports 0x-prefixed hex strings but input was: "+e)},t.assertIsBuffer=function(e){if(!a.isBuffer(e))throw new Error("This method only supports Buffer but input was: "+e)},t.assertIsArray=function(e){if(!Array.isArray(e))throw new Error("This method only supports number arrays but input was: "+e)},t.assertIsString=function(e){if("string"!=typeof e)throw new Error("This method only supports strings but input was: "+e)}},(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var a=r(1348),n=r(554);t.keccak224=a.createHashFunction((function(){return n("keccak224")})),t.keccak256=a.createHashFunction((function(){return n("keccak256")})),t.keccak384=a.createHashFunction((function(){return n("keccak384")})),t.keccak512=a.createHashFunction((function(){return n("keccak512")}))},(e,t,r)=>{"use strict";var a=r(245).a.ERR_STREAM_PREMATURE_CLOSE;function noop(){}e.exports=function eos(e,t,r){if("function"==typeof t)return eos(e,null,t);t||(t={}),r=function once(e){var t=!1;return function(){if(!t){t=!0;for(var r=arguments.length,a=new Array(r),n=0;n=l;)e/=2,t/=2,r>>>=1;return(e+r)/t};return prng.int32=function(){return 0|g.g(4)},prng.quick=function(){return g.g(4)/4294967296},prng.double=prng,mixkey(tostring(g.S),o),(t.pass||r||function(e,t,r,a){return a&&(a.S&©(a,g),e.state=function(){return copy(g,{})}),r?(s.random=e,t):e})(prng,b,"global"in t?t.global:this==s,t.state)}function ARC4(e){var t,r=e.length,a=this,n=0,o=a.i=a.j=0,s=a.S=[];for(r||(e=[r++]);n{"use strict";t.__esModule=!0;var a=r(247);t.default=a.default,function __export(e){for(var r in e)t.hasOwnProperty(r)||(t[r]=e[r])}(r(581))},(e,t,r)=>{"use strict";var a=r(0).Buffer;Object.defineProperty(t,"__esModule",{value:!0}),t.assertIsString=t.assertIsArray=t.assertIsBuffer=t.assertIsHexString=void 0;var n=r(62);t.assertIsHexString=function(e){if(!n.isHexString(e))throw new Error("This method only supports 0x-prefixed hex strings but input was: "+e)},t.assertIsBuffer=function(e){if(!a.isBuffer(e))throw new Error("This method only supports Buffer but input was: "+e)},t.assertIsArray=function(e){if(!Array.isArray(e))throw new Error("This method only supports number arrays but input was: "+e)},t.assertIsString=function(e){if("string"!=typeof e)throw new Error("This method only supports strings but input was: "+e)}},(e,t,r)=>{e.exports=r(1006)(r(1018))},(e,t,r)=>{var a=r(1),n=r(32).EventEmitter,o=r(40).inherits,s=r(204),c=r(1007),d=r(1013),u=r(1014),h=r(375),l=r(284),b=r(6),g=r(588),p=r(377).a,B=r(377).b,m=h.WriteError,I=h.ReadError,y=h.NotFoundError,v=h.OpenError,x=h.InitializationError;function LevelUP(e,t,r){if(!(this instanceof LevelUP))return new LevelUP(e,t,r);var o,s=this;if(n.call(this),this.setMaxListeners(1/0),"function"==typeof t&&(r=t,t={}),t=t||{},!e||"object"!=typeof e){if(o=new x("First argument must be an abstract-leveldown compliant store"),"function"==typeof r)return a.nextTick(r,o);throw o}b.strictEqual(typeof e.status,"string",".status required, old abstract-leveldown"),this.options=B(t),this._db=e,this.db=new c(e),this.open(r||function(e){e&&s.emit("error",e)}),this.supports=l(this.db.supports,{status:!1,deferredOpen:!0,openCallback:!0,promises:!0,streams:!0}),Object.keys(this.supports.additionalMethods).forEach((function(e){null==this[e]&&(this[e]=function(){return this.db[e].apply(this.db,arguments)})}),this)}function maybeError(e,t){if(!e._isOpening()&&!e.isOpen())return a.nextTick(t,new I("Database is not open")),!0}LevelUP.prototype.emit=n.prototype.emit,LevelUP.prototype.once=n.prototype.once,o(LevelUP,n),LevelUP.prototype.open=function(e,t){var r,n=this;return"function"==typeof e&&(t=e,e=null),t||(r=(t=g()).promise),e||(e=this.options),this.isOpen()?(a.nextTick(t,null,n),r):this._isOpening()?(this.once("open",(function(){t(null,n)})),r):(this.emit("opening"),this.db.open(e,(function(e){if(e)return t(new v(e));n.db=n._db,t(null,n),n.emit("open"),n.emit("ready")})),r)},LevelUP.prototype.close=function(e){var t,r=this;return e||(t=(e=g()).promise),this.isOpen()?(this.db.close((function(){r.emit("closed"),e.apply(null,arguments)})),this.emit("closing"),this.db=new c(this._db)):this.isClosed()?a.nextTick(e):"closing"===this.db.status?this.once("closed",e):this._isOpening()&&this.once("open",(function(){r.close(e)})),t},LevelUP.prototype.isOpen=function(){return"open"===this.db.status},LevelUP.prototype._isOpening=function(){return"opening"===this.db.status},LevelUP.prototype.isClosed=function(){return/^clos|new/.test(this.db.status)},LevelUP.prototype.get=function(e,t,r){var a;return(r=p(t,r))||(a=(r=g()).promise),maybeError(this,r)||(t=B(t),this.db.get(e,t,(function(t,a){if(t)return t=/notfound/i.test(t)||t.notFound?new y("Key not found in database ["+e+"]",t):new I(t),r(t);r(null,a)}))),a},LevelUP.prototype.put=function(e,t,r,a){var n,o=this;return(a=p(r,a))||(n=(a=g()).promise),maybeError(this,a)||(r=B(r),this.db.put(e,t,r,(function(r){if(r)return a(new m(r));o.emit("put",e,t),a()}))),n},LevelUP.prototype.del=function(e,t,r){var a,n=this;return(r=p(t,r))||(a=(r=g()).promise),maybeError(this,r)||(t=B(t),this.db.del(e,t,(function(t){if(t)return r(new m(t));n.emit("del",e),r()}))),a},LevelUP.prototype.batch=function(e,t,r){if(!arguments.length)return new u(this);var a,n=this;return(r="function"==typeof e?e:p(t,r))||(a=(r=g()).promise),maybeError(this,r)||(t=B(t),this.db.batch(e,t,(function(t){if(t)return r(new m(t));n.emit("batch",e),r()}))),a},LevelUP.prototype.iterator=function(e){return this.db.iterator(e)},LevelUP.prototype.clear=function(e,t){var r,a=this;return t=p(e,t),e=B(e),t||(r=(t=g()).promise),maybeError(this,t)||this.db.clear(e,(function(r){if(r)return t(new m(r));a.emit("clear",e),t()})),r},LevelUP.prototype.readStream=LevelUP.prototype.createReadStream=function(e){return"number"!=typeof(e=s({keys:!0,values:!0},e)).limit&&(e.limit=-1),new d(this.db.iterator(e),e)},LevelUP.prototype.keyStream=LevelUP.prototype.createKeyStream=function(e){return this.createReadStream(s(e,{keys:!0,values:!1}))},LevelUP.prototype.valueStream=LevelUP.prototype.createValueStream=function(e){return this.createReadStream(s(e,{keys:!1,values:!0}))},LevelUP.prototype.toString=function(){return"LevelUP"},LevelUP.prototype.type="levelup",LevelUP.errors=h,e.exports=LevelUP.default=LevelUP},(e,t,r)=>{var a=r(285).create,n=a("LevelUPError"),o=a("NotFoundError",n);o.prototype.notFound=!0,o.prototype.status=404,e.exports={LevelUPError:n,InitializationError:a("InitializationError",n),OpenError:a("OpenError",n),ReadError:a("ReadError",n),WriteError:a("WriteError",n),NotFoundError:o,EncodingError:a("EncodingError",n)}},function(e){var t,r;t=this,r=function(){var e="function"==typeof Object.defineProperty?function(e,t,r){return Object.defineProperty(e,t,r),e}:function(e,t,r){return e[t]=r.value,e};return function(t,r,a,n){var o;if(n=function(e,t){var r="object"==typeof t,a=!r&&"string"==typeof t,op=function(e){return r?!!t[e]:!!a&&t.indexOf(e[0])>-1};return{enumerable:op("enumerable"),configurable:op("configurable"),writable:op("writable"),value:e}}(a,n),"object"==typeof r){for(o in r)Object.hasOwnProperty.call(r,o)&&(n.value=r[o],e(t,o,n));return t}return e(t,r,n)}},e.exports?e.exports=r():t.prr=r()},(e,t)=>{t.a=function(e,t){return"function"==typeof e?e:t},t.b=function(e){return"object"==typeof e&&null!==e?e:{}}},(e,t,r)=>{"use strict";var a=r(379).AbstractLevelDOWN,n=r(379).AbstractChainedBatch,o=r(379).AbstractIterator,s=r(15),c=r(1017),d=r(375).EncodingError,u=["approximateSize","compactRange"];function DB(e,t){if(!(this instanceof DB))return new DB(e,t);var r=e.supports||{},n=r.additionalMethods||{};a.call(this,r),this.supports.encodings=!0,this.supports.additionalMethods={},u.forEach((function(t){var r="function"==typeof e[t];(n[t]||r)&&(this.supports.additionalMethods[t]=!0,this[t]=function(e,r,a,n){return e=this.codec.encodeKey(e,a),r=this.codec.encodeKey(r,a),this.db[t](e,r,a,n)})}),this),void 0===(t=t||{}).keyEncoding&&(t.keyEncoding="utf8"),void 0===t.valueEncoding&&(t.valueEncoding="utf8"),this.db=e,this.codec=new c(t)}function Iterator(e,t){o.call(this,e),this.codec=e.codec,this.keys=t.keys,this.values=t.values,this.opts=this.codec.encodeLtgt(t),this.it=e.db.iterator(this.opts)}function Batch(e,t){n.call(this,e),this.codec=e.codec,this.batch=e.db.batch()}e.exports=DB.default=DB,s(DB,a),DB.prototype.type="encoding-down",DB.prototype._serializeKey=DB.prototype._serializeValue=function(e){return e},DB.prototype._open=function(e,t){this.db.open(e,t)},DB.prototype._close=function(e){this.db.close(e)},DB.prototype._put=function(e,t,r,a){e=this.codec.encodeKey(e,r),t=this.codec.encodeValue(t,r),this.db.put(e,t,r,a)},DB.prototype._get=function(e,t,r){var a=this;e=this.codec.encodeKey(e,t),t.asBuffer=this.codec.valueAsBuffer(t),this.db.get(e,t,(function(e,n){if(e)return r(e);try{n=a.codec.decodeValue(n,t)}catch(e){return r(new d(e))}r(null,n)}))},DB.prototype._del=function(e,t,r){e=this.codec.encodeKey(e,t),this.db.del(e,t,r)},DB.prototype._chainedBatch=function(){return new Batch(this)},DB.prototype._batch=function(e,t,r){e=this.codec.encodeBatch(e,t),this.db.batch(e,t,r)},DB.prototype._iterator=function(e){return e.keyAsBuffer=this.codec.keyAsBuffer(e),e.valueAsBuffer=this.codec.valueAsBuffer(e),new Iterator(this,e)},DB.prototype._clear=function(e,t){e=this.codec.encodeLtgt(e),this.db.clear(e,t)},s(Iterator,o),Iterator.prototype._next=function(e){var t=this;this.it.next((function(r,a,n){if(r)return e(r);try{a=t.keys&&void 0!==a?t.codec.decodeKey(a,t.opts):void 0,n=t.values&&void 0!==n?t.codec.decodeValue(n,t.opts):void 0}catch(r){return e(new d(r))}e(null,a,n)}))},Iterator.prototype._seek=function(e){e=this.codec.encodeKey(e,this.opts),this.it.seek(e)},Iterator.prototype._end=function(e){this.it.end(e)},s(Batch,n),Batch.prototype._put=function(e,t){e=this.codec.encodeKey(e),t=this.codec.encodeValue(t),this.batch.put(e,t)},Batch.prototype._del=function(e){e=this.codec.encodeKey(e),this.batch.del(e)},Batch.prototype._clear=function(){this.batch.clear()},Batch.prototype._write=function(e,t){this.batch.write(e,t)}},(e,t,r)=>{t.AbstractLevelDOWN=r(1016),t.AbstractIterator=r(589),t.AbstractChainedBatch=r(591)},e=>{"use strict";e.exports=function createRBTree(e){return new RedBlackTree(e||defaultCompare,null)};function RBNode(e,t,r,a,n,o){this._color=e,this.key=t,this.value=r,this.left=a,this.right=n,this._count=o}function cloneNode(e){return new RBNode(e._color,e.key,e.value,e.left,e.right,e._count)}function repaint(e,t){return new RBNode(e,t.key,t.value,t.left,t.right,t._count)}function recount(e){e._count=1+(e.left?e.left._count:0)+(e.right?e.right._count:0)}function RedBlackTree(e,t){this._compare=e,this.root=t}var t=RedBlackTree.prototype;function doVisitFull(e,t){var r;if(t.left&&(r=doVisitFull(e,t.left)))return r;return(r=e(t.key,t.value))||(t.right?doVisitFull(e,t.right):void 0)}function doVisitHalf(e,t,r,a){if(t(e,a.key)<=0){var n;if(a.left)if(n=doVisitHalf(e,t,r,a.left))return n;if(n=r(a.key,a.value))return n}if(a.right)return doVisitHalf(e,t,r,a.right)}function doVisit(e,t,r,a,n){var o,s=r(e,n.key),c=r(t,n.key);if(s<=0){if(n.left&&(o=doVisit(e,t,r,a,n.left)))return o;if(c>0&&(o=a(n.key,n.value)))return o}if(c>0&&n.right)return doVisit(e,t,r,a,n.right)}function RedBlackTreeIterator(e,t){this.tree=e,this._stack=t}Object.defineProperty(t,"keys",{get:function(){var e=[];return this.forEach((function(t,r){e.push(t)})),e}}),Object.defineProperty(t,"values",{get:function(){var e=[];return this.forEach((function(t,r){e.push(r)})),e}}),Object.defineProperty(t,"length",{get:function(){return this.root?this.root._count:0}}),t.insert=function(e,t){for(var r=this._compare,a=this.root,n=[],o=[];a;){var s=r(e,a.key);n.push(a),o.push(s),a=s<=0?a.left:a.right}n.push(new RBNode(0,e,t,null,null,1));for(var c=n.length-2;c>=0;--c){a=n[c];o[c]<=0?n[c]=new RBNode(a._color,a.key,a.value,n[c+1],a.right,a._count+1):n[c]=new RBNode(a._color,a.key,a.value,a.left,n[c+1],a._count+1)}for(c=n.length-1;c>1;--c){var d=n[c-1];a=n[c];if(1===d._color||1===a._color)break;var u=n[c-2];if(u.left===d)if(d.left===a){if(!(h=u.right)||0!==h._color){if(u._color=0,u.left=d.right,d._color=1,d.right=u,n[c-2]=d,n[c-1]=a,recount(u),recount(d),c>=3)(l=n[c-3]).left===u?l.left=d:l.right=d;break}d._color=1,u.right=repaint(1,h),u._color=0,c-=1}else{if(!(h=u.right)||0!==h._color){if(d.right=a.left,u._color=0,u.left=a.right,a._color=1,a.left=d,a.right=u,n[c-2]=a,n[c-1]=d,recount(u),recount(d),recount(a),c>=3)(l=n[c-3]).left===u?l.left=a:l.right=a;break}d._color=1,u.right=repaint(1,h),u._color=0,c-=1}else if(d.right===a){if(!(h=u.left)||0!==h._color){if(u._color=0,u.right=d.left,d._color=1,d.left=u,n[c-2]=d,n[c-1]=a,recount(u),recount(d),c>=3)(l=n[c-3]).right===u?l.right=d:l.left=d;break}d._color=1,u.left=repaint(1,h),u._color=0,c-=1}else{var h;if(!(h=u.left)||0!==h._color){var l;if(d.left=a.right,u._color=0,u.right=a.left,a._color=1,a.right=d,a.left=u,n[c-2]=a,n[c-1]=d,recount(u),recount(d),recount(a),c>=3)(l=n[c-3]).right===u?l.right=a:l.left=a;break}d._color=1,u.left=repaint(1,h),u._color=0,c-=1}}return n[0]._color=1,new RedBlackTree(r,n[0])},t.forEach=function rbTreeForEach(e,t,r){if(this.root)switch(arguments.length){case 1:return doVisitFull(e,this.root);case 2:return doVisitHalf(t,this._compare,e,this.root);case 3:if(this._compare(t,r)>=0)return;return doVisit(t,r,this._compare,e,this.root)}},Object.defineProperty(t,"begin",{get:function(){for(var e=[],t=this.root;t;)e.push(t),t=t.left;return new RedBlackTreeIterator(this,e)}}),Object.defineProperty(t,"end",{get:function(){for(var e=[],t=this.root;t;)e.push(t),t=t.right;return new RedBlackTreeIterator(this,e)}}),t.at=function(e){if(e<0)return new RedBlackTreeIterator(this,[]);for(var t=this.root,r=[];;){if(r.push(t),t.left){if(e=t.right._count)break;t=t.right}return new RedBlackTreeIterator(this,[])},t.ge=function(e){for(var t=this._compare,r=this.root,a=[],n=0;r;){var o=t(e,r.key);a.push(r),o<=0&&(n=a.length),r=o<=0?r.left:r.right}return a.length=n,new RedBlackTreeIterator(this,a)},t.gt=function(e){for(var t=this._compare,r=this.root,a=[],n=0;r;){var o=t(e,r.key);a.push(r),o<0&&(n=a.length),r=o<0?r.left:r.right}return a.length=n,new RedBlackTreeIterator(this,a)},t.lt=function(e){for(var t=this._compare,r=this.root,a=[],n=0;r;){var o=t(e,r.key);a.push(r),o>0&&(n=a.length),r=o<=0?r.left:r.right}return a.length=n,new RedBlackTreeIterator(this,a)},t.le=function(e){for(var t=this._compare,r=this.root,a=[],n=0;r;){var o=t(e,r.key);a.push(r),o>=0&&(n=a.length),r=o<0?r.left:r.right}return a.length=n,new RedBlackTreeIterator(this,a)},t.find=function(e){for(var t=this._compare,r=this.root,a=[];r;){var n=t(e,r.key);if(a.push(r),0===n)return new RedBlackTreeIterator(this,a);r=n<=0?r.left:r.right}return new RedBlackTreeIterator(this,[])},t.remove=function(e){var t=this.find(e);return t?t.remove():this},t.get=function(e){for(var t=this._compare,r=this.root;r;){var a=t(e,r.key);if(0===a)return r.value;r=a<=0?r.left:r.right}};var r=RedBlackTreeIterator.prototype;function swapNode(e,t){e.key=t.key,e.value=t.value,e.left=t.left,e.right=t.right,e._color=t._color,e._count=t._count}function defaultCompare(e,t){return et?1:0}Object.defineProperty(r,"valid",{get:function(){return this._stack.length>0}}),Object.defineProperty(r,"node",{get:function(){return this._stack.length>0?this._stack[this._stack.length-1]:null},enumerable:!0}),r.clone=function(){return new RedBlackTreeIterator(this.tree,this._stack.slice())},r.remove=function(){var e=this._stack;if(0===e.length)return this.tree;var t=new Array(e.length),r=e[e.length-1];t[t.length-1]=new RBNode(r._color,r.key,r.value,r.left,r.right,r._count);for(var a=e.length-2;a>=0;--a){(r=e[a]).left===e[a+1]?t[a]=new RBNode(r._color,r.key,r.value,t[a+1],r.right,r._count):t[a]=new RBNode(r._color,r.key,r.value,r.left,t[a+1],r._count)}if((r=t[t.length-1]).left&&r.right){var n=t.length;for(r=r.left;r.right;)t.push(r),r=r.right;var o=t[n-1];t.push(new RBNode(r._color,o.key,o.value,r.left,r.right,r._count)),t[n-1].key=r.key,t[n-1].value=r.value;for(a=t.length-2;a>=n;--a)r=t[a],t[a]=new RBNode(r._color,r.key,r.value,r.left,t[a+1],r._count);t[n-1].left=t[n]}if(0===(r=t[t.length-1])._color){var s=t[t.length-2];s.left===r?s.left=null:s.right===r&&(s.right=null),t.pop();for(a=0;a=0;--o){if(t=e[o],0===o)return void(t._color=1);if((r=e[o-1]).left===t){if((a=r.right).right&&0===a.right._color)return n=(a=r.right=cloneNode(a)).right=cloneNode(a.right),r.right=a.left,a.left=r,a.right=n,a._color=r._color,t._color=1,r._color=1,n._color=1,recount(r),recount(a),o>1&&((s=e[o-2]).left===r?s.left=a:s.right=a),void(e[o-1]=a);if(a.left&&0===a.left._color)return n=(a=r.right=cloneNode(a)).left=cloneNode(a.left),r.right=n.left,a.left=n.right,n.left=r,n.right=a,n._color=r._color,r._color=1,a._color=1,t._color=1,recount(r),recount(a),recount(n),o>1&&((s=e[o-2]).left===r?s.left=n:s.right=n),void(e[o-1]=n);if(1===a._color){if(0===r._color)return r._color=1,void(r.right=repaint(0,a));r.right=repaint(0,a);continue}a=cloneNode(a),r.right=a.left,a.left=r,a._color=r._color,r._color=0,recount(r),recount(a),o>1&&((s=e[o-2]).left===r?s.left=a:s.right=a),e[o-1]=a,e[o]=r,o+11&&((s=e[o-2]).right===r?s.right=a:s.left=a),void(e[o-1]=a);if(a.right&&0===a.right._color)return n=(a=r.left=cloneNode(a)).right=cloneNode(a.right),r.left=n.right,a.right=n.left,n.right=r,n.left=a,n._color=r._color,r._color=1,a._color=1,t._color=1,recount(r),recount(a),recount(n),o>1&&((s=e[o-2]).right===r?s.right=n:s.left=n),void(e[o-1]=n);if(1===a._color){if(0===r._color)return r._color=1,void(r.left=repaint(0,a));r.left=repaint(0,a);continue}var s;a=cloneNode(a),r.left=a.right,a.right=r,a._color=r._color,r._color=0,recount(r),recount(a),o>1&&((s=e[o-2]).right===r?s.right=a:s.left=a),e[o-1]=a,e[o]=r,o+10)return this._stack[this._stack.length-1].key},enumerable:!0}),Object.defineProperty(r,"value",{get:function(){if(this._stack.length>0)return this._stack[this._stack.length-1].value},enumerable:!0}),Object.defineProperty(r,"index",{get:function(){var e=0,t=this._stack;if(0===t.length){var r=this.tree.root;return r?r._count:0}t[t.length-1].left&&(e=t[t.length-1].left._count);for(var a=t.length-2;a>=0;--a)t[a+1]===t[a].right&&(++e,t[a].left&&(e+=t[a].left._count));return e},enumerable:!0}),r.next=function(){var e=this._stack;if(0!==e.length){var t=e[e.length-1];if(t.right)for(t=t.right;t;)e.push(t),t=t.left;else for(e.pop();e.length>0&&e[e.length-1].right===t;)t=e[e.length-1],e.pop()}},Object.defineProperty(r,"hasNext",{get:function(){var e=this._stack;if(0===e.length)return!1;if(e[e.length-1].right)return!0;for(var t=e.length-1;t>0;--t)if(e[t-1].left===e[t])return!0;return!1}}),r.update=function(e){var t=this._stack;if(0===t.length)throw new Error("Can't update empty node!");var r=new Array(t.length),a=t[t.length-1];r[r.length-1]=new RBNode(a._color,a.key,e,a.left,a.right,a._count);for(var n=t.length-2;n>=0;--n)(a=t[n]).left===t[n+1]?r[n]=new RBNode(a._color,a.key,a.value,r[n+1],a.right,a._count):r[n]=new RBNode(a._color,a.key,a.value,a.left,r[n+1],a._count);return new RedBlackTree(this.tree._compare,r[0])},r.prev=function(){var e=this._stack;if(0!==e.length){var t=e[e.length-1];if(t.left)for(t=t.left;t;)e.push(t),t=t.right;else for(e.pop();e.length>0&&e[e.length-1].left===t;)t=e[e.length-1],e.pop()}},Object.defineProperty(r,"hasPrev",{get:function(){var e=this._stack;if(0===e.length)return!1;if(e[e.length-1].left)return!0;for(var t=e.length-1;t>0;--t)if(e[t-1].right===e[t])return!0;return!1}})},function(e,t,r){"use strict";var a=r(2).Buffer,n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.WalletOptions=void 0;const o=r(207),s=n(r(1026)),c=r(1383),d=r(53),u=s.default();const h=(()=>{const e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",t=e.length;return(r,a)=>{let n="";for(let o=0;o,`, can be specified multiple times. Note that private keys are 64 characters long and must be entered as an 0x-prefixed hex string. Balance can either be input as an integer, or as a 0x-prefixed hex string with either form specifying the initial balance in wei.",legacyName:"accounts",cliAliases:["account"],cliType:"array:string",cliCoerce:e=>e.map((e=>{const[t,r]=e.split(/,(.+)/);return{secretKey:t,balance:BigInt(r)}})),conflicts:["totalAccounts"]},totalAccounts:{normalize:o.normalize,cliDescription:"Number of accounts to generate at startup.",default:e=>null==e.accounts?10:0,legacyName:"total_accounts",cliAliases:["a","accounts"],cliType:"number",conflicts:["accounts"]},deterministic:{normalize:o.normalize,cliDescription:"Use pre-defined, deterministic seed.",default:()=>!1,cliAliases:["d","deterministic"],cliType:"boolean",conflicts:["mnemonic","seed"]},seed:{normalize:o.normalize,cliDescription:"Seed to use to generate a mnemonic.",default:e=>!0===e.deterministic?d.DeterministicSeedPhrase:h(10,u),defaultDescription:"Random value, unless wallet.deterministic is specified",legacyName:"seed",cliAliases:["s","seed"],cliType:"string",conflicts:["mnemonic","deterministic"]},mnemonic:{normalize:o.normalize,cliDescription:"Use a specific HD wallet mnemonic to generate initial addresses.",default:e=>c.entropyToMnemonic(function notVeryRandomBytes(e,t){const r=a.allocUnsafe(e);for(let a=0;a!1,legacyName:"secure",cliAliases:["n","secure"],cliType:"boolean"},accountKeysPath:{normalize:o.normalize,cliDescription:"Specifies a file to save accounts and private keys to, for testing.",legacyName:"account_keys_path",cliAliases:["account_keys_path","acctKeys"],cliType:"string"},defaultBalance:{normalize:o.normalize,cliDescription:"The default account balance, specified in ether.",default:()=>1e3,legacyName:"default_balance_ether",cliAliases:["e","defaultBalanceEther"],cliType:"number"},hdPath:{normalize:o.normalize,cliDescription:"The hierarchical deterministic path to use when generating accounts.",default:()=>"m/44'/60'/0'/0/",legacyName:"hd_path",cliType:"string"}}},function(e,t,r){var a;!function(n,o,s){var c,d=256,u=s.pow(d,6),h=s.pow(2,52),l=2*h,b=255;function seedrandom(e,t,r){var a=[],b=mixkey(flatten((t=1==t?{entropy:!0}:t||{}).entropy?[e,tostring(o)]:null==e?function autoseed(){try{var e;return c&&(e=c.randomBytes)?e=e(d):(e=new Uint8Array(d),(n.crypto||n.msCrypto).getRandomValues(e)),tostring(e)}catch(e){var t=n.navigator,r=t&&t.plugins;return[+new Date,n,r,n.screen,tostring(o)]}}():e,3),a),g=new ARC4(a),prng=function(){for(var e=g.g(6),t=u,r=0;e=l;)e/=2,t/=2,r>>>=1;return(e+r)/t};return prng.int32=function(){return 0|g.g(4)},prng.quick=function(){return g.g(4)/4294967296},prng.double=prng,mixkey(tostring(g.S),o),(t.pass||r||function(e,t,r,a){return a&&(a.S&©(a,g),e.state=function(){return copy(g,{})}),r?(s.random=e,t):e})(prng,b,"global"in t?t.global:this==s,t.state)}function ARC4(e){var t,r=e.length,a=this,n=0,o=a.i=a.j=0,s=a.S=[];for(r||(e=[r++]);n{(t=e.exports=r(606)).Stream=t,t.Readable=t,t.Writable=r(609),t.Duplex=r(208),t.Transform=r(611),t.PassThrough=r(1033),t.finished=r(384),t.pipeline=r(1034)},(e,t,r)=>{"use strict";var a=r(249).a.ERR_STREAM_PREMATURE_CLOSE;function noop(){}e.exports=function eos(e,t,r){if("function"==typeof t)return eos(e,null,t);t||(t={}),r=function once(e){var t=!1;return function(){if(!t){t=!0;for(var r=arguments.length,a=new Array(r),n=0;n{"use strict";var a=r(422),n=r(423),o="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;t.a=Buffer,t.b=50;var s=2147483647;function createBuffer(e){if(e>s)throw new RangeError('The value "'+e+'" is invalid for option "size"');var t=new Uint8Array(e);return Object.setPrototypeOf(t,Buffer.prototype),t}function Buffer(e,t,r){if("number"==typeof e){if("string"==typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return allocUnsafe(e)}return from(e,t,r)}function from(e,t,r){if("string"==typeof e)return function fromString(e,t){"string"==typeof t&&""!==t||(t="utf8");if(!Buffer.isEncoding(t))throw new TypeError("Unknown encoding: "+t);var r=0|byteLength(e,t),a=createBuffer(r),n=a.write(e,t);n!==r&&(a=a.slice(0,n));return a}(e,t);if(ArrayBuffer.isView(e))return function fromArrayView(e){if(isInstance(e,Uint8Array)){var t=new Uint8Array(e);return fromArrayBuffer(t.buffer,t.byteOffset,t.byteLength)}return fromArrayLike(e)}(e);if(null==e)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(isInstance(e,ArrayBuffer)||e&&isInstance(e.buffer,ArrayBuffer))return fromArrayBuffer(e,t,r);if("undefined"!=typeof SharedArrayBuffer&&(isInstance(e,SharedArrayBuffer)||e&&isInstance(e.buffer,SharedArrayBuffer)))return fromArrayBuffer(e,t,r);if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');var a=e.valueOf&&e.valueOf();if(null!=a&&a!==e)return Buffer.from(a,t,r);var n=function fromObject(e){if(Buffer.isBuffer(e)){var t=0|checked(e.length),r=createBuffer(t);return 0===r.length||e.copy(r,0,0,t),r}if(void 0!==e.length)return"number"!=typeof e.length||numberIsNaN(e.length)?createBuffer(0):fromArrayLike(e);if("Buffer"===e.type&&Array.isArray(e.data))return fromArrayLike(e.data)}(e);if(n)return n;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return Buffer.from(e[Symbol.toPrimitive]("string"),t,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function assertSize(e){if("number"!=typeof e)throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function allocUnsafe(e){return assertSize(e),createBuffer(e<0?0:0|checked(e))}function fromArrayLike(e){for(var t=e.length<0?0:0|checked(e.length),r=createBuffer(t),a=0;a=s)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s.toString(16)+" bytes");return 0|e}function byteLength(e,t){if(Buffer.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||isInstance(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);var r=e.length,a=arguments.length>2&&!0===arguments[2];if(!a&&0===r)return 0;for(var n=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return utf8ToBytes(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return base64ToBytes(e).length;default:if(n)return a?-1:utf8ToBytes(e).length;t=(""+t).toLowerCase(),n=!0}}function slowToString(e,t,r){var a=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return hexSlice(this,t,r);case"utf8":case"utf-8":return utf8Slice(this,t,r);case"ascii":return asciiSlice(this,t,r);case"latin1":case"binary":return latin1Slice(this,t,r);case"base64":return base64Slice(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return utf16leSlice(this,t,r);default:if(a)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),a=!0}}function swap(e,t,r){var a=e[t];e[t]=e[r],e[r]=a}function bidirectionalIndexOf(e,t,r,a,n){if(0===e.length)return-1;if("string"==typeof r?(a=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),numberIsNaN(r=+r)&&(r=n?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(n)return-1;r=e.length-1}else if(r<0){if(!n)return-1;r=0}if("string"==typeof t&&(t=Buffer.from(t,a)),Buffer.isBuffer(t))return 0===t.length?-1:arrayIndexOf(e,t,r,a,n);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?n?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):arrayIndexOf(e,[t],r,a,n);throw new TypeError("val must be string, number or Buffer")}function arrayIndexOf(e,t,r,a,n){var o,s=1,c=e.length,d=t.length;if(void 0!==a&&("ucs2"===(a=String(a).toLowerCase())||"ucs-2"===a||"utf16le"===a||"utf-16le"===a)){if(e.length<2||t.length<2)return-1;s=2,c/=2,d/=2,r/=2}function read(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}if(n){var u=-1;for(o=r;oc&&(r=c-d),o=r;o>=0;o--){for(var h=!0,l=0;ln&&(a=n):a=n;var o=t.length;a>o/2&&(a=o/2);for(var s=0;s>8,n=r%256,o.push(n),o.push(a);return o}(t,e.length-r),e,r,a)}function base64Slice(e,t,r){return 0===t&&r===e.length?a.fromByteArray(e):a.fromByteArray(e.slice(t,r))}function utf8Slice(e,t,r){r=Math.min(e.length,r);for(var a=[],n=t;n239?4:h>223?3:h>191?2:1;if(n+b<=r)switch(b){case 1:h<128&&(l=h);break;case 2:128==(192&(o=e[n+1]))&&(u=(31&h)<<6|63&o)>127&&(l=u);break;case 3:o=e[n+1],s=e[n+2],128==(192&o)&&128==(192&s)&&(u=(15&h)<<12|(63&o)<<6|63&s)>2047&&(u<55296||u>57343)&&(l=u);break;case 4:o=e[n+1],s=e[n+2],d=e[n+3],128==(192&o)&&128==(192&s)&&128==(192&d)&&(u=(15&h)<<18|(63&o)<<12|(63&s)<<6|63&d)>65535&&u<1114112&&(l=u)}null===l?(l=65533,b=1):l>65535&&(l-=65536,a.push(l>>>10&1023|55296),l=56320|1023&l),a.push(l),n+=b}return function decodeCodePointsArray(e){var t=e.length;if(t<=c)return String.fromCharCode.apply(String,e);var r="",a=0;for(;aa.length?Buffer.from(o).copy(a,n):Uint8Array.prototype.set.call(a,o,n);else{if(!Buffer.isBuffer(o))throw new TypeError('"list" argument must be an Array of Buffers');o.copy(a,n)}n+=o.length}return a},Buffer.byteLength=byteLength,Buffer.prototype._isBuffer=!0,Buffer.prototype.swap16=function swap16(){var e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;tr&&(e+=" ... "),""},o&&(Buffer.prototype[o]=Buffer.prototype.inspect),Buffer.prototype.compare=function compare(e,t,r,a,n){if(isInstance(e,Uint8Array)&&(e=Buffer.from(e,e.offset,e.byteLength)),!Buffer.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===a&&(a=0),void 0===n&&(n=this.length),t<0||r>e.length||a<0||n>this.length)throw new RangeError("out of range index");if(a>=n&&t>=r)return 0;if(a>=n)return-1;if(t>=r)return 1;if(this===e)return 0;for(var o=(n>>>=0)-(a>>>=0),s=(r>>>=0)-(t>>>=0),c=Math.min(o,s),d=this.slice(a,n),u=e.slice(t,r),h=0;h>>=0,isFinite(r)?(r>>>=0,void 0===a&&(a="utf8")):(a=r,r=void 0)}var n=this.length-t;if((void 0===r||r>n)&&(r=n),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");a||(a="utf8");for(var o=!1;;)switch(a){case"hex":return hexWrite(this,e,t,r);case"utf8":case"utf-8":return utf8Write(this,e,t,r);case"ascii":case"latin1":case"binary":return asciiWrite(this,e,t,r);case"base64":return base64Write(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ucs2Write(this,e,t,r);default:if(o)throw new TypeError("Unknown encoding: "+a);a=(""+a).toLowerCase(),o=!0}},Buffer.prototype.toJSON=function toJSON(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var c=4096;function asciiSlice(e,t,r){var a="";r=Math.min(e.length,r);for(var n=t;na)&&(r=a);for(var n="",o=t;or)throw new RangeError("Trying to access beyond buffer length")}function checkInt(e,t,r,a,n,o){if(!Buffer.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>n||te.length)throw new RangeError("Index out of range")}function checkIEEE754(e,t,r,a,n,o){if(r+a>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function writeFloat(e,t,r,a,o){return t=+t,r>>>=0,o||checkIEEE754(e,0,r,4),n.write(e,t,r,a,23,4),r+4}function writeDouble(e,t,r,a,o){return t=+t,r>>>=0,o||checkIEEE754(e,0,r,8),n.write(e,t,r,a,52,8),r+8}Buffer.prototype.slice=function slice(e,t){var r=this.length;(e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t>>=0,t>>>=0,r||checkOffset(e,t,this.length);for(var a=this[e],n=1,o=0;++o>>=0,t>>>=0,r||checkOffset(e,t,this.length);for(var a=this[e+--t],n=1;t>0&&(n*=256);)a+=this[e+--t]*n;return a},Buffer.prototype.readUint8=Buffer.prototype.readUInt8=function readUInt8(e,t){return e>>>=0,t||checkOffset(e,1,this.length),this[e]},Buffer.prototype.readUint16LE=Buffer.prototype.readUInt16LE=function readUInt16LE(e,t){return e>>>=0,t||checkOffset(e,2,this.length),this[e]|this[e+1]<<8},Buffer.prototype.readUint16BE=Buffer.prototype.readUInt16BE=function readUInt16BE(e,t){return e>>>=0,t||checkOffset(e,2,this.length),this[e]<<8|this[e+1]},Buffer.prototype.readUint32LE=Buffer.prototype.readUInt32LE=function readUInt32LE(e,t){return e>>>=0,t||checkOffset(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},Buffer.prototype.readUint32BE=Buffer.prototype.readUInt32BE=function readUInt32BE(e,t){return e>>>=0,t||checkOffset(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},Buffer.prototype.readIntLE=function readIntLE(e,t,r){e>>>=0,t>>>=0,r||checkOffset(e,t,this.length);for(var a=this[e],n=1,o=0;++o=(n*=128)&&(a-=Math.pow(2,8*t)),a},Buffer.prototype.readIntBE=function readIntBE(e,t,r){e>>>=0,t>>>=0,r||checkOffset(e,t,this.length);for(var a=t,n=1,o=this[e+--a];a>0&&(n*=256);)o+=this[e+--a]*n;return o>=(n*=128)&&(o-=Math.pow(2,8*t)),o},Buffer.prototype.readInt8=function readInt8(e,t){return e>>>=0,t||checkOffset(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},Buffer.prototype.readInt16LE=function readInt16LE(e,t){e>>>=0,t||checkOffset(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},Buffer.prototype.readInt16BE=function readInt16BE(e,t){e>>>=0,t||checkOffset(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},Buffer.prototype.readInt32LE=function readInt32LE(e,t){return e>>>=0,t||checkOffset(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},Buffer.prototype.readInt32BE=function readInt32BE(e,t){return e>>>=0,t||checkOffset(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},Buffer.prototype.readFloatLE=function readFloatLE(e,t){return e>>>=0,t||checkOffset(e,4,this.length),n.read(this,e,!0,23,4)},Buffer.prototype.readFloatBE=function readFloatBE(e,t){return e>>>=0,t||checkOffset(e,4,this.length),n.read(this,e,!1,23,4)},Buffer.prototype.readDoubleLE=function readDoubleLE(e,t){return e>>>=0,t||checkOffset(e,8,this.length),n.read(this,e,!0,52,8)},Buffer.prototype.readDoubleBE=function readDoubleBE(e,t){return e>>>=0,t||checkOffset(e,8,this.length),n.read(this,e,!1,52,8)},Buffer.prototype.writeUintLE=Buffer.prototype.writeUIntLE=function writeUIntLE(e,t,r,a){(e=+e,t>>>=0,r>>>=0,a)||checkInt(this,e,t,r,Math.pow(2,8*r)-1,0);var n=1,o=0;for(this[t]=255&e;++o>>=0,r>>>=0,a)||checkInt(this,e,t,r,Math.pow(2,8*r)-1,0);var n=r-1,o=1;for(this[t+n]=255&e;--n>=0&&(o*=256);)this[t+n]=e/o&255;return t+r},Buffer.prototype.writeUint8=Buffer.prototype.writeUInt8=function writeUInt8(e,t,r){return e=+e,t>>>=0,r||checkInt(this,e,t,1,255,0),this[t]=255&e,t+1},Buffer.prototype.writeUint16LE=Buffer.prototype.writeUInt16LE=function writeUInt16LE(e,t,r){return e=+e,t>>>=0,r||checkInt(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},Buffer.prototype.writeUint16BE=Buffer.prototype.writeUInt16BE=function writeUInt16BE(e,t,r){return e=+e,t>>>=0,r||checkInt(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},Buffer.prototype.writeUint32LE=Buffer.prototype.writeUInt32LE=function writeUInt32LE(e,t,r){return e=+e,t>>>=0,r||checkInt(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},Buffer.prototype.writeUint32BE=Buffer.prototype.writeUInt32BE=function writeUInt32BE(e,t,r){return e=+e,t>>>=0,r||checkInt(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},Buffer.prototype.writeIntLE=function writeIntLE(e,t,r,a){if(e=+e,t>>>=0,!a){var n=Math.pow(2,8*r-1);checkInt(this,e,t,r,n-1,-n)}var o=0,s=1,c=0;for(this[t]=255&e;++o>0)-c&255;return t+r},Buffer.prototype.writeIntBE=function writeIntBE(e,t,r,a){if(e=+e,t>>>=0,!a){var n=Math.pow(2,8*r-1);checkInt(this,e,t,r,n-1,-n)}var o=r-1,s=1,c=0;for(this[t+o]=255&e;--o>=0&&(s*=256);)e<0&&0===c&&0!==this[t+o+1]&&(c=1),this[t+o]=(e/s>>0)-c&255;return t+r},Buffer.prototype.writeInt8=function writeInt8(e,t,r){return e=+e,t>>>=0,r||checkInt(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},Buffer.prototype.writeInt16LE=function writeInt16LE(e,t,r){return e=+e,t>>>=0,r||checkInt(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},Buffer.prototype.writeInt16BE=function writeInt16BE(e,t,r){return e=+e,t>>>=0,r||checkInt(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},Buffer.prototype.writeInt32LE=function writeInt32LE(e,t,r){return e=+e,t>>>=0,r||checkInt(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},Buffer.prototype.writeInt32BE=function writeInt32BE(e,t,r){return e=+e,t>>>=0,r||checkInt(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},Buffer.prototype.writeFloatLE=function writeFloatLE(e,t,r){return writeFloat(this,e,t,!0,r)},Buffer.prototype.writeFloatBE=function writeFloatBE(e,t,r){return writeFloat(this,e,t,!1,r)},Buffer.prototype.writeDoubleLE=function writeDoubleLE(e,t,r){return writeDouble(this,e,t,!0,r)},Buffer.prototype.writeDoubleBE=function writeDoubleBE(e,t,r){return writeDouble(this,e,t,!1,r)},Buffer.prototype.copy=function copy(e,t,r,a){if(!Buffer.isBuffer(e))throw new TypeError("argument should be a Buffer");if(r||(r=0),a||0===a||(a=this.length),t>=e.length&&(t=e.length),t||(t=0),a>0&&a=this.length)throw new RangeError("Index out of range");if(a<0)throw new RangeError("sourceEnd out of bounds");a>this.length&&(a=this.length),e.length-t>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(o=t;o55295&&r<57344){if(!n){if(r>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(s+1===a){(t-=3)>-1&&o.push(239,191,189);continue}n=r;continue}if(r<56320){(t-=3)>-1&&o.push(239,191,189),n=r;continue}r=65536+(n-55296<<10|r-56320)}else n&&(t-=3)>-1&&o.push(239,191,189);if(n=null,r<128){if((t-=1)<0)break;o.push(r)}else if(r<2048){if((t-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=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((t-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function base64ToBytes(e){return a.toByteArray(function base64clean(e){if((e=(e=e.split("=")[0]).trim().replace(d,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function blitBuffer(e,t,r,a){for(var n=0;n=t.length||n>=e.length);++n)t[n+r]=e[n];return n}function isInstance(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function numberIsNaN(e){return e!=e}var u=function(){for(var e="0123456789abcdef",t=new Array(256),r=0;r<16;++r)for(var a=16*r,n=0;n<16;++n)t[a+n]=e[r]+e[n];return t}()},(e,t,r)=>{var a=r(1055),n=r(374),o=r(378);e.exports=function(t,r,s){return"object"!=typeof r||s?(s||(s={}),n(o(a(t,r,s),s),s)):e.exports(t,null,r)}},(e,t,r)=>{"use strict";var a=r(0).Buffer;Object.defineProperty(t,"__esModule",{value:!0}),t.DBOp=t.DBTarget=void 0;var n,o=r(1068);!function(e){e[e.Heads=0]="Heads",e[e.HeadHeader=1]="HeadHeader",e[e.HeadBlock=2]="HeadBlock",e[e.HashToNumber=3]="HashToNumber",e[e.NumberToHash=4]="NumberToHash",e[e.TotalDifficulty=5]="TotalDifficulty",e[e.Body=6]="Body",e[e.Header=7]="Header",e[e.CliqueSignerStates=8]="CliqueSignerStates",e[e.CliqueVotes=9]="CliqueVotes",e[e.CliqueBlockSigners=10]="CliqueBlockSigners"}(n=t.DBTarget||(t.DBTarget={}));var s=function(){function DBOp(e,t){switch(this.operationTarget=e,this.baseDBOp={key:"",keyEncoding:"binary",valueEncoding:"binary"},e){case n.Heads:this.baseDBOp.key=o.HEADS_KEY,this.baseDBOp.valueEncoding="json";break;case n.HeadHeader:this.baseDBOp.key=o.HEAD_HEADER_KEY;break;case n.HeadBlock:this.baseDBOp.key=o.HEAD_BLOCK_KEY;break;case n.HashToNumber:this.baseDBOp.key=o.hashToNumberKey(t.blockHash),this.cacheString="hashToNumber";break;case n.NumberToHash:this.baseDBOp.key=o.numberToHashKey(t.blockNumber),this.cacheString="numberToHash";break;case n.TotalDifficulty:this.baseDBOp.key=o.tdKey(t.blockNumber,t.blockHash),this.cacheString="td";break;case n.Body:this.baseDBOp.key=o.bodyKey(t.blockNumber,t.blockHash),this.cacheString="body";break;case n.Header:this.baseDBOp.key=o.headerKey(t.blockNumber,t.blockHash),this.cacheString="header";break;case n.CliqueSignerStates:this.baseDBOp.key=o.CLIQUE_SIGNERS_KEY;break;case n.CliqueVotes:this.baseDBOp.key=o.CLIQUE_VOTES_KEY;break;case n.CliqueBlockSigners:this.baseDBOp.key=o.CLIQUE_BLOCK_SIGNERS_KEY}}return DBOp.get=function(e,t){return new DBOp(e,t)},DBOp.set=function(e,t,r){var a=new DBOp(e,r);return a.baseDBOp.value=t,a.baseDBOp.type="put",e==n.Heads?a.baseDBOp.valueEncoding="json":a.baseDBOp.valueEncoding="binary",a},DBOp.del=function(e,t){var r=new DBOp(e,t);return r.baseDBOp.type="del",r},DBOp.prototype.updateCache=function(e){if(this.cacheString&&e[this.cacheString]&&a.isBuffer(this.baseDBOp.value))if("put"==this.baseDBOp.type)e[this.cacheString].set(this.baseDBOp.key,this.baseDBOp.value);else{if("del"!=this.baseDBOp.type)throw new Error("unsupported db operation on cache");e[this.cacheString].del(this.baseDBOp.key)}},DBOp}();t.DBOp=s},e=>{var t={}.toString;e.exports=function(e){return t.call(e).slice(8,-1)}},e=>{e.exports=function(e){if(null==e)throw TypeError("Can't call method on "+e);return e}},(e,t,r)=>{var a=r(104),n=r(1073),o="__core-js_shared__",s=a[o]||n(o,{});e.exports=s},(e,t,r)=>{var a=r(291),n=r(634);e.exports=n?function(e){return"symbol"==typeof e}:function(e){var t=a("Symbol");return"function"==typeof t&&Object(e)instanceof t}},e=>{e.exports={}},e=>{e.exports=!0},(e,t,r)=>{var a=r(389);e.exports=function(e){return Object(a(e))}},e=>{var t=0,r=Math.random();e.exports=function(e){return"Symbol("+String(void 0===e?"":e)+")_"+(++t+r).toString(36)}},e=>{e.exports=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}}},(e,t,r)=>{var a=r(636),n=r(395),o=a("keys");e.exports=function(e){return o[e]||(o[e]=n(e))}},(e,t,r)=>{"use strict";var a=r(399),n=r(1080),o=r(638),s=r(1088),c=r(403),d=r(169),u=r(642),h=r(105),l=r(393),b=r(251),g=r(637),p=g.IteratorPrototype,B=g.BUGGY_SAFARI_ITERATORS,m=h("iterator"),I="keys",y="values",v="entries",returnThis=function(){return this};e.exports=function(e,t,r,h,g,x,C){n(r,t,h);var Q,w,_,getIterationMethod=function(e){if(e===g&&G)return G;if(!B&&e in D)return D[e];switch(e){case I:return function keys(){return new r(this,e)};case y:return function values(){return new r(this,e)};case v:return function entries(){return new r(this,e)}}return function(){return new r(this)}},k=t+" Iterator",N=!1,D=e.prototype,U=D[m]||D["@@iterator"]||g&&D[g],G=!B&&U||getIterationMethod(g),T="Array"==t&&D.entries||U;if(T&&(Q=o(T.call(new e)),p!==Object.prototype&&Q.next&&(l||o(Q)===p||(s?s(Q,p):"function"!=typeof Q[m]&&d(Q,m,returnThis)),c(Q,k,!0,!0),l&&(b[k]=returnThis))),g==y&&U&&U.name!==y&&(N=!0,G=function values(){return U.call(this)}),l&&!C||D[m]===G||d(D,m,G),b[t]=G,g)if(w={values:getIterationMethod(y),keys:x?G:getIterationMethod(I),entries:getIterationMethod(v)},C)for(_ in w)(B||N||!(_ in D))&&u(D,_,w[_]);else a({target:t,proto:!0,forced:B||N},w);return w}},(e,t,r)=>{"use strict";var a=r(104),n=r(1443).f,o=r(1078),s=r(392),c=r(293),d=r(169),u=r(120),wrapConstructor=function(e){var Wrapper=function(t,r,a){if(this instanceof e){switch(arguments.length){case 0:return new e;case 1:return new e(t);case 2:return new e(t,r)}return new e(t,r,a)}return e.apply(this,arguments)};return Wrapper.prototype=e.prototype,Wrapper};e.exports=function(e,t){var r,h,l,b,g,p,B,m,I=e.target,y=e.global,v=e.stat,x=e.proto,C=y?a:v?a[I]:(a[I]||{}).prototype,Q=y?s:s[I]||d(s,I,{})[I],w=Q.prototype;for(l in t)r=!o(y?l:I+(v?".":"#")+l,e.forced)&&C&&u(C,l),g=Q[l],r&&(p=e.noTargetGet?(m=n(C,l))&&m.value:C[l]),b=r&&p?p:t[l],r&&typeof g==typeof b||(B=e.bind&&r?c(b,a):e.wrap&&r?wrapConstructor(b):x&&"function"==typeof b?c(Function.call,b):b,(e.sham||b&&b.sham||g&&g.sham)&&d(B,"sham",!0),d(Q,l,B),x&&(u(s,h=I+"Prototype")||d(s,h,{}),d(s[h],l,b),e.real&&w&&!w[l]&&d(w,l,b)))}},(e,t,r)=>{var a=r(401),n=Math.min;e.exports=function(e){return e>0?n(a(e),9007199254740991):0}},e=>{var t=Math.ceil,r=Math.floor;e.exports=function(e){return isNaN(e=+e)?0:(e>0?r:t)(e)}},e=>{e.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]},(e,t,r)=>{var a=r(404),n=r(216).f,o=r(169),s=r(120),c=r(1087),d=r(105)("toStringTag");e.exports=function(e,t,r,u){if(e){var h=r?e:e.prototype;s(h,d)||n(h,d,{configurable:!0,value:t}),u&&!a&&o(h,"toString",c)}}},(e,t,r)=>{var a={};a[r(105)("toStringTag")]="z",e.exports="[object z]"===String(a)},(e,t,r)=>{"use strict";var a=r(0).Buffer;Object.defineProperty(t,"__esModule",{value:!0});var n=r(5),o=function(){function Message(e){this.to=e.to,this.value=e.value?e.value:new n.BN(0),this.caller=e.caller,this.gasLimit=e.gasLimit,this.data=e.data||a.alloc(0),this.depth=e.depth||0,this.code=e.code,this._codeAddress=e.codeAddress,this.isStatic=e.isStatic||!1,this.isCompiled=e.isCompiled||!1,this.salt=e.salt,this.selfdestruct=e.selfdestruct,this.delegatecall=e.delegatecall||!1}return Object.defineProperty(Message.prototype,"codeAddress",{get:function(){return this._codeAddress?this._codeAddress:this.to},enumerable:!1,configurable:!0}),Message}();t.default=o},(e,t,r)=>{var a=r(660),n=r(1108),o=r(1109),s=a?a.toStringTag:void 0;e.exports=function baseGetTag(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":s&&s in Object(e)?n(e):o(e)}},e=>{e.exports=function isObjectLike(e){return null!=e&&"object"==typeof e}},(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function slice(e,t){t|=0;for(var r=Math.max(e.length-t,0),a=Array(r),n=0;n{"use strict";var a=r(1126),n="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),o=Object.prototype.toString,s=Array.prototype.concat,c=Object.defineProperty,d=c&&function(){var e={};try{for(var t in c(e,"x",{enumerable:!1,value:e}),e)return!1;return e.x===e}catch(e){return!1}}(),defineProperty=function(e,t,r,a){var n;(!(t in e)||"function"==typeof(n=a)&&"[object Function]"===o.call(n)&&a())&&(d?c(e,t,{configurable:!0,enumerable:!1,value:r,writable:!0}):e[t]=r)},defineProperties=function(e,t){var r=arguments.length>2?arguments[2]:{},o=a(t);n&&(o=s.call(o,Object.getOwnPropertySymbols(t)));for(var c=0;c{"use strict";var a=r(411),n=r(66),o=n("%Function.prototype.apply%"),s=n("%Function.prototype.call%"),c=n("%Reflect.apply%",!0)||a.call(s,o),d=n("%Object.getOwnPropertyDescriptor%",!0),u=n("%Object.defineProperty%",!0),h=n("%Math.max%");if(u)try{u({},"a",{value:1})}catch(e){u=null}e.exports=function callBind(e){var t=c(a,s,arguments);if(d&&u){var r=d(t,"length");r.configurable&&u(t,"length",{value:1+h(0,e.length-(arguments.length-1))})}return t};var l=function applyBind(){return c(a,o,arguments)};u?u(e.exports,"apply",{value:l}):e.exports.apply=l},(e,t,r)=>{"use strict";var a=r(1130);e.exports=Function.prototype.bind||a},function(e,t,r){"use strict";var a=r(1),n=r(0).Buffer,o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const s=r(629),c=r(49),d=r(166),u=r(5),h=r(41),l=o(r(44)),b=r(1105),g=o(r(1156)),p=r(413),B=r(148),m=c.debug("vm:state");class DefaultStateManager{constructor(e={}){var t;this.DEBUG=!1;let r=e.common;r||(r=new l.default({chain:"mainnet",hardfork:"petersburg"})),this._common=r,this._trie=null!==(t=e.trie)&&void 0!==t?t:new d.SecureTrie,this._storageTries={},this._cache=new g.default(this._trie),this._touched=new s,this._touchedStack=[],this._checkpointCount=0,this._originalStorageCache=new Map,this._accessedStorage=[new Map],this._accessedStorageReverted=[new Map],void 0!==a&&a.env.DEBUG&&(this.DEBUG=!0)}copy(){return new DefaultStateManager({trie:this._trie.copy(!1),common:this._common})}async getAccount(e){return await this._cache.getOrLoad(e)}async putAccount(e,t){this.DEBUG&&m(`Save account address=${e} nonce=${t.nonce} balance=${t.balance} contract=${t.isContract()?"yes":"no"} empty=${t.isEmpty()?"yes":"no"}`),this._cache.put(e,t),this.touchAccount(e)}async deleteAccount(e){this.DEBUG&&m(`Delete account ${e}`),this._cache.del(e),this.touchAccount(e)}touchAccount(e){this._touched.add(e.buf.toString("hex"))}async putContractCode(e,t){const r=u.keccak256(t);if(r.equals(u.KECCAK256_NULL))return;await this._trie.db.put(r,t);const a=await this.getAccount(e);this.DEBUG&&m(`Update codeHash (-> ${B.short(r)}) for account ${e}`),a.codeHash=r,await this.putAccount(e,a)}async getContractCode(e){const t=await this.getAccount(e);if(!t.isContract())return n.alloc(0);const r=await this._trie.db.get(t.codeHash);return null!=r?r:n.alloc(0)}async _lookupStorageTrie(e){const t=await this.getAccount(e),r=this._trie.copy(!1);return r.root=t.stateRoot,r.db.checkpoints=[],r}async _getStorageTrie(e){const t=e.buf.toString("hex");let r=this._storageTries[t];return r||(r=await this._lookupStorageTrie(e)),r}async getContractStorage(e,t){if(32!==t.length)throw new Error("Storage key must be 32 bytes long");const r=await this._getStorageTrie(e),a=await r.get(t);return h.decode(a)}async getOriginalContractStorage(e,t){if(32!==t.length)throw new Error("Storage key must be 32 bytes long");const r=e.buf.toString("hex"),a=t.toString("hex");let n;if(this._originalStorageCache.has(r)?n=this._originalStorageCache.get(r):(n=new Map,this._originalStorageCache.set(r,n)),n.has(a))return n.get(a);{const r=await this.getContractStorage(e,t);return n.set(a,r),r}}_clearOriginalStorageCache(){this._originalStorageCache=new Map}clearOriginalStorageCache(){this._clearOriginalStorageCache()}async _modifyContractStorage(e,t){return new Promise((async r=>{const a=await this._getStorageTrie(e);t(a,(async()=>{const t=e.buf.toString("hex");this._storageTries[t]=a;const n=this._cache.get(e);n.stateRoot=a.root,await this.putAccount(e,n),this.touchAccount(e),r()}))}))}async putContractStorage(e,t,r){if(32!==t.length)throw new Error("Storage key must be 32 bytes long");if(r.length>32)throw new Error("Storage value cannot be longer than 32 bytes");r=u.unpadBuffer(r),await this._modifyContractStorage(e,(async(a,n)=>{if(r&&r.length){const n=h.encode(r);this.DEBUG&&m(`Update contract storage for account ${e} to ${B.short(r)}`),await a.put(t,n)}else this.DEBUG&&m("Delete contract storage for account"),await a.del(t);n()}))}async clearContractStorage(e){await this._modifyContractStorage(e,((e,t)=>{e.root=e.EMPTY_TRIE_ROOT,t()}))}async checkpoint(){this._trie.checkpoint(),this._cache.checkpoint(),this._touchedStack.push(new s(Array.from(this._touched))),this._accessedStorage.push(new Map),this._checkpointCount++}_accessedStorageMerge(e,t){const r=e[e.length-1];r&&(null==t||t.forEach(((e,t)=>{r.get(t)||r.set(t,new s);const a=r.get(t);e.forEach((e=>{a.add(e)}))})))}async commit(){await this._trie.commit(),this._cache.commit(),this._touchedStack.pop(),this._checkpointCount--;const e=this._accessedStorage.pop();e&&this._accessedStorageMerge(this._accessedStorage,e),0===this._checkpointCount&&(await this._cache.flush(),this._clearOriginalStorageCache())}async revert(){await this._trie.revert(),this._cache.revert(),this._storageTries={};const e=this._accessedStorage.pop();e&&this._accessedStorageReverted.push(e);const t=this._touchedStack.pop();if(!t)throw new Error("Reverting to invalid state checkpoint failed");this._touched.has(p.ripemdPrecompileAddress)&&t.add(p.ripemdPrecompileAddress),this._touched=t,this._checkpointCount--,0===this._checkpointCount&&(await this._cache.flush(),this._clearOriginalStorageCache())}async getStateRoot(){await this._cache.flush();return this._trie.root}async setStateRoot(e){if(0!==this._checkpointCount)throw new Error("Cannot set state root with uncommitted checkpoints");if(await this._cache.flush(),!e.equals(this._trie.EMPTY_TRIE_ROOT)){if(!await this._trie.checkRoot(e))throw new Error("State trie does not contain state root")}this._trie.root=e,this._cache.clear(),this._storageTries={}}async dumpStorage(e){return new Promise(((t,r)=>{this._getStorageTrie(e).then((e=>{const r={},a=e.createReadStream();a.on("data",(e=>{r[e.key.toString("hex")]=e.value.toString("hex")})),a.on("end",(()=>{t(r)}))})).catch((e=>{r(e)}))}))}async hasGenesisState(){const e=this._common.genesis().stateRoot;return await this._trie.checkRoot(e)}async generateCanonicalGenesis(){if(0!==this._checkpointCount)throw new Error("Cannot create genesis state with uncommitted checkpoints");await this.hasGenesisState()||await this.generateGenesis(b.genesisStateByName(this._common.chainName()))}async generateGenesis(e){if(0!==this._checkpointCount)throw new Error("Cannot create genesis state with uncommitted checkpoints");this.DEBUG&&m("Save genesis state into the state trie");const t=Object.keys(e);for(const r of t){const t=new u.BN(u.toBuffer(e[r])),a=u.Account.fromAccountData({balance:t}),n=u.toBuffer(r);await this._trie.put(n,a.serialize())}}async accountIsEmpty(e){return(await this.getAccount(e)).isEmpty()}async accountExists(e){return!(!this._cache.lookup(e)||this._cache.keyIsDeleted(e))||!!await this._cache._trie.get(e.buf)}isWarmedAddress(e){for(let t=this._accessedStorage.length-1;t>=0;t--){if(this._accessedStorage[t].has(e.toString("hex")))return!0}return!1}addWarmedAddress(e){const t=e.toString("hex");if(!this._accessedStorage[this._accessedStorage.length-1].get(t)){const e=new s;this._accessedStorage[this._accessedStorage.length-1].set(t,e)}}isWarmedStorage(e,t){const r=e.toString("hex"),a=t.toString("hex");for(let e=this._accessedStorage.length-1;e>=0;e--){const t=this._accessedStorage[e];if(t.has(r)&&t.get(r).has(a))return!0}return!1}addWarmedStorage(e,t){const r=e.toString("hex");let a=this._accessedStorage[this._accessedStorage.length-1].get(r);a||(a=new s,this._accessedStorage[this._accessedStorage.length-1].set(r,a)),a.add(t.toString("hex"))}clearWarmedAccounts(){this._accessedStorage=[new Map],this._accessedStorageReverted=[new Map]}generateAccessList(e=[],t=[]){const r=[...this._accessedStorage,...this._accessedStorageReverted];for(;r.length>=2;){const e=r.pop();e&&this._accessedStorageMerge(r,e)}const a=new Map([...r[0].entries()].sort()),n=[];return a.forEach(((r,a)=>{const o=u.Address.fromString(`0x${a}`),s=p.getActivePrecompiles(this._common).find((e=>e.equals(o))),c=e.find((e=>e.equals(o))),d=void 0!==t.find((e=>e.equals(o)))&&0===r.size;if(!s&&!c&&!d){const e={address:`0x${a}`,storageKeys:Array.from(r).map((e=>`0x${e}`)).sort()};n.push(e)}})),n}async cleanupTouchedAccounts(){if(this._common.gteHardfork("spuriousDragon")){const e=Array.from(this._touched);for(const t of e){const e=new u.Address(n.from(t,"hex"));await this.accountIsEmpty(e)&&(this._cache.del(e),this.DEBUG&&m(`Cleanup touched account address=${e.toString()} (>= SpuriousDragon)`))}}this._touched.clear()}}t.default=DefaultStateManager},function(e,t,r){"use strict";var a=r(0).Buffer,n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.getActivePrecompiles=t.ripemdPrecompileAddress=t.getPrecompile=t.precompiles=void 0;const o=r(5),s=n(r(1472)),c=n(r(1478)),d=n(r(1479)),u=n(r(1480)),h=n(r(1481)),l=n(r(1482)),b=n(r(1483)),g=n(r(1484)),p=n(r(1485)),B=n(r(1486)),m=n(r(1487)),I=n(r(1488)),y=n(r(1489)),v=n(r(1490)),x=n(r(1491)),C=n(r(1492)),Q=n(r(1493)),w=n(r(1494));var _;!function(e){e[e.EIP=0]="EIP",e[e.Hardfork=1]="Hardfork"}(_||(_={}));const k="0000000000000000000000000000000000000003";t.ripemdPrecompileAddress=k;const N={"0000000000000000000000000000000000000001":s.default,"0000000000000000000000000000000000000002":c.default,[k]:d.default,"0000000000000000000000000000000000000004":u.default,"0000000000000000000000000000000000000005":h.default,"0000000000000000000000000000000000000006":l.default,"0000000000000000000000000000000000000007":b.default,"0000000000000000000000000000000000000008":g.default,"0000000000000000000000000000000000000009":p.default,"000000000000000000000000000000000000000a":B.default,"000000000000000000000000000000000000000b":m.default,"000000000000000000000000000000000000000c":I.default,"000000000000000000000000000000000000000d":y.default,"000000000000000000000000000000000000000e":v.default,"000000000000000000000000000000000000000f":x.default,"0000000000000000000000000000000000000010":C.default,"0000000000000000000000000000000000000011":Q.default,"0000000000000000000000000000000000000012":w.default};t.precompiles=N;const D={"0000000000000000000000000000000000000001":{type:_.Hardfork,param:"chainstart"},"0000000000000000000000000000000000000002":{type:_.Hardfork,param:"chainstart"},[k]:{type:_.Hardfork,param:"chainstart"},"0000000000000000000000000000000000000004":{type:_.Hardfork,param:"chainstart"},"0000000000000000000000000000000000000005":{type:_.Hardfork,param:"byzantium"},"0000000000000000000000000000000000000006":{type:_.Hardfork,param:"byzantium"},"0000000000000000000000000000000000000007":{type:_.Hardfork,param:"byzantium"},"0000000000000000000000000000000000000008":{type:_.Hardfork,param:"byzantium"},"0000000000000000000000000000000000000009":{type:_.Hardfork,param:"istanbul"},"000000000000000000000000000000000000000a":{type:_.EIP,param:2537},"000000000000000000000000000000000000000b":{type:_.EIP,param:2537},"000000000000000000000000000000000000000c":{type:_.EIP,param:2537},"000000000000000000000000000000000000000d":{type:_.EIP,param:2537},"000000000000000000000000000000000000000f":{type:_.EIP,param:2537},"000000000000000000000000000000000000000e":{type:_.EIP,param:2537},"0000000000000000000000000000000000000010":{type:_.EIP,param:2537},"0000000000000000000000000000000000000011":{type:_.EIP,param:2537},"0000000000000000000000000000000000000012":{type:_.EIP,param:2537}};function getPrecompile(e,t){const r=e.buf.toString("hex");if(N[r]){const e=D[r];if(e.type==_.Hardfork&&t.gteHardfork(e.param)||e.type==_.EIP&&t.eips().includes(e.param))return N[r]}return N[""]}t.getPrecompile=getPrecompile,t.getActivePrecompiles=function getActivePrecompiles(e){const t=[];for(const r in N){const n=new o.Address(a.from(r,"hex"));getPrecompile(n,e)&&t.push(n)}return t}},function(e,t,r){var a;!function(n,o,s){var c,d=256,u=s.pow(d,6),h=s.pow(2,52),l=2*h,b=255;function seedrandom(e,t,r){var a=[],b=mixkey(flatten((t=1==t?{entropy:!0}:t||{}).entropy?[e,tostring(o)]:null==e?function autoseed(){try{var e;return c&&(e=c.randomBytes)?e=e(d):(e=new Uint8Array(d),(n.crypto||n.msCrypto).getRandomValues(e)),tostring(e)}catch(e){var t=n.navigator,r=t&&t.plugins;return[+new Date,n,r,n.screen,tostring(o)]}}():e,3),a),g=new ARC4(a),prng=function(){for(var e=g.g(6),t=u,r=0;e=l;)e/=2,t/=2,r>>>=1;return(e+r)/t};return prng.int32=function(){return 0|g.g(4)},prng.quick=function(){return g.g(4)/4294967296},prng.double=prng,mixkey(tostring(g.S),o),(t.pass||r||function(e,t,r,a){return a&&(a.S&©(a,g),e.state=function(){return copy(g,{})}),r?(s.random=e,t):e})(prng,b,"global"in t?t.global:this==s,t.state)}function ARC4(e){var t,r=e.length,a=this,n=0,o=a.i=a.j=0,s=a.S=[];for(r||(e=[r++]);n{"use strict";var a=r(1175);e.exports=Function.prototype.bind||a},(e,t,r)=>{"use strict";var a="undefined"!=typeof Symbol&&Symbol,n=r(417);e.exports=function hasNativeSymbols(){return"function"==typeof a&&("function"==typeof Symbol&&("symbol"==typeof a("foo")&&("symbol"==typeof Symbol("bar")&&n())))}},e=>{"use strict";e.exports=function hasSymbols(){if("function"!=typeof Symbol||"function"!=typeof Object.getOwnPropertySymbols)return!1;if("symbol"==typeof Symbol.iterator)return!0;var e={},t=Symbol("test"),r=Object(t);if("string"==typeof t)return!1;if("[object Symbol]"!==Object.prototype.toString.call(t))return!1;if("[object Symbol]"!==Object.prototype.toString.call(r))return!1;for(t in e[t]=42,e)return!1;if("function"==typeof Object.keys&&0!==Object.keys(e).length)return!1;if("function"==typeof Object.getOwnPropertyNames&&0!==Object.getOwnPropertyNames(e).length)return!1;var a=Object.getOwnPropertySymbols(e);if(1!==a.length||a[0]!==t)return!1;if(!Object.prototype.propertyIsEnumerable.call(e,t))return!1;if("function"==typeof Object.getOwnPropertyDescriptor){var n=Object.getOwnPropertyDescriptor(e,t);if(42!==n.value||!0!==n.enumerable)return!1}return!0}},(e,t,r)=>{"use strict";var a=r(1),n=r(1181);if(r(416)()||r(417)()){var o=Symbol.iterator;e.exports=function getIterator(e){return null!=e&&void 0!==e[o]?e[o]():n(e)?Array.prototype[o].call(e):void 0}}else{var s=r(1182),c=r(704),d=r(13),u=d("%Map%",!0),h=d("%Set%",!0),l=r(108),b=l("Array.prototype.push"),g=l("String.prototype.charCodeAt"),p=l("String.prototype.slice"),B=function getArrayIterator(e){var t=0;return{next:function next(){var r,a=t>=e.length;return a||(r=e[t],t+=1),{done:a,value:r}}}},m=function getNonCollectionIterator(e,t){if(s(e)||n(e))return B(e);if(c(e)){var r=0;return{next:function next(){var t=function advanceStringIndex(e,t){if(t+1>=e.length)return t+1;var r=g(e,t);if(r<55296||r>56319)return t+1;var a=g(e,t+1);return a<56320||a>57343?t+1:t+2}(e,r),a=p(e,r,t);return r=t,{done:t>e.length,value:a}}}}return t&&void 0!==e["_es6-shim iterator_"]?e["_es6-shim iterator_"]():void 0};if(u||h){var I=r(1183),y=r(1184),v=l("Map.prototype.forEach",!0),x=l("Set.prototype.forEach",!0);if(void 0===a||!a.versions||!a.versions.node)var C=l("Map.prototype.iterator",!0),Q=l("Set.prototype.iterator",!0),getStopIterationIterator=function(e){var t=!1;return{next:function next(){try{return{done:t,value:t?void 0:e.next()}}catch(e){return t=!0,{done:!0,value:void 0}}}}};var w=l("Map.prototype.@@iterator",!0)||l("Map.prototype._es6-shim iterator_",!0),_=l("Set.prototype.@@iterator",!0)||l("Set.prototype._es6-shim iterator_",!0);e.exports=function getIterator(e){return function getCollectionIterator(e){if(I(e)){if(C)return getStopIterationIterator(C(e));if(w)return w(e);if(v){var t=[];return v(e,(function(e,r){b(t,[r,e])})),B(t)}}if(y(e)){if(Q)return getStopIterationIterator(Q(e));if(_)return _(e);if(x){var r=[];return x(e,(function(e){b(r,e)})),B(r)}}}(e)||m(e)}}else e.exports=function getIterator(e){if(null!=e)return m(e,!0)}}},(e,t,r)=>{"use strict";var a=r(13)("%Array%"),n=!a.isArray&&r(108)("Object.prototype.toString");e.exports=a.isArray||function IsArray(e){return"[object Array]"===n(e)}},(e,t,r)=>{"use strict";var a=r(13),n=a("%TypeError%"),o=a("%SyntaxError%"),s=r(175),c={"Property Descriptor":function isPropertyDescriptor(e,t){if("Object"!==e(t))return!1;var r={"[[Configurable]]":!0,"[[Enumerable]]":!0,"[[Get]]":!0,"[[Set]]":!0,"[[Value]]":!0,"[[Writable]]":!0};for(var a in t)if(s(t,a)&&!r[a])return!1;var o=s(t,"[[Value]]"),c=s(t,"[[Get]]")||s(t,"[[Set]]");if(o&&c)throw new n("Property Descriptors may not be both accessor and data descriptors");return!0}};e.exports=function assertRecord(e,t,r,a){var s=c[t];if("function"!=typeof s)throw new o("unknown record type: "+t);if(!s(e,a))throw new n(r+" must be a "+t)}},function(e,t,r){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.provider=t.server=t.Server=void 0;var n=r(312);Object.defineProperty(t,"Server",{enumerable:!0,get:function(){return n.Server}}),Object.defineProperty(t,"server",{enumerable:!0,get:function(){return n.server}}),Object.defineProperty(t,"provider",{enumerable:!0,get:function(){return n.provider}});const o=a(r(312));t.default=o.default},(e,t)=>{"use strict";t.byteLength=function byteLength(e){var t=getLens(e),r=t[0],a=t[1];return 3*(r+a)/4-a},t.toByteArray=function toByteArray(e){var t,r,o=getLens(e),s=o[0],c=o[1],d=new n(function _byteLength(e,t,r){return 3*(t+r)/4-r}(0,s,c)),u=0,h=c>0?s-4:s;for(r=0;r>16&255,d[u++]=t>>8&255,d[u++]=255&t;2===c&&(t=a[e.charCodeAt(r)]<<2|a[e.charCodeAt(r+1)]>>4,d[u++]=255&t);1===c&&(t=a[e.charCodeAt(r)]<<10|a[e.charCodeAt(r+1)]<<4|a[e.charCodeAt(r+2)]>>2,d[u++]=t>>8&255,d[u++]=255&t);return d},t.fromByteArray=function fromByteArray(e){for(var t,a=e.length,n=a%3,o=[],s=16383,c=0,d=a-n;cd?d:c+s));1===n?(t=e[a-1],o.push(r[t>>2]+r[t<<4&63]+"==")):2===n&&(t=(e[a-2]<<8)+e[a-1],o.push(r[t>>10]+r[t>>4&63]+r[t<<2&63]+"="));return o.join("")};for(var r=[],a=[],n="undefined"!=typeof Uint8Array?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0,c=o.length;s0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");return-1===r&&(r=t),[r,r===t?0:4-r%4]}function encodeChunk(e,t,a){for(var n,o,s=[],c=t;c>18&63]+r[o>>12&63]+r[o>>6&63]+r[63&o]);return s.join("")}a["-".charCodeAt(0)]=62,a["_".charCodeAt(0)]=63},(e,t)=>{t.read=function(e,t,r,a,n){var o,s,c=8*n-a-1,d=(1<>1,h=-7,l=r?n-1:0,b=r?-1:1,g=e[t+l];for(l+=b,o=g&(1<<-h)-1,g>>=-h,h+=c;h>0;o=256*o+e[t+l],l+=b,h-=8);for(s=o&(1<<-h)-1,o>>=-h,h+=a;h>0;s=256*s+e[t+l],l+=b,h-=8);if(0===o)o=1-u;else{if(o===d)return s?NaN:1/0*(g?-1:1);s+=Math.pow(2,a),o-=u}return(g?-1:1)*s*Math.pow(2,o-a)},t.write=function(e,t,r,a,n,o){var s,c,d,u=8*o-n-1,h=(1<>1,b=23===n?Math.pow(2,-24)-Math.pow(2,-77):0,g=a?0:o-1,p=a?1:-1,B=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(c=isNaN(t)?1:0,s=h):(s=Math.floor(Math.log(t)/Math.LN2),t*(d=Math.pow(2,-s))<1&&(s--,d*=2),(t+=s+l>=1?b/d:b*Math.pow(2,1-l))*d>=2&&(s++,d/=2),s+l>=h?(c=0,s=h):s+l>=1?(c=(t*d-1)*Math.pow(2,n),s+=l):(c=t*Math.pow(2,l-1)*Math.pow(2,n),s=0));n>=8;e[r+g]=255&c,g+=p,c/=256,n-=8);for(s=s<0;e[r+g]=255&s,g+=p,s/=256,u-=8);e[r+g-p]|=128*B}},function(e,t,r){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.keccak=void 0;const n=a(r(726)),o=n.default("keccak256");t.keccak=function keccak(e){o._state.absorb(e);const t=o._state.squeeze(32);return o._state.initialize(1088,512),o._finalized=!1,t}},(e,t,r)=>{"use strict";var a=r(1);function emitErrorAndCloseNT(e,t){emitErrorNT(e,t),emitCloseNT(e)}function emitCloseNT(e){e._writableState&&!e._writableState.emitClose||e._readableState&&!e._readableState.emitClose||e.emit("close")}function emitErrorNT(e,t){e.emit("error",t)}e.exports={destroy:function destroy(e,t){var r=this,n=this._readableState&&this._readableState.destroyed,o=this._writableState&&this._writableState.destroyed;return n||o?(t?t(e):e&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,a.nextTick(emitErrorNT,this,e)):a.nextTick(emitErrorNT,this,e)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,(function(e){!t&&e?r._writableState?r._writableState.errorEmitted?a.nextTick(emitCloseNT,r):(r._writableState.errorEmitted=!0,a.nextTick(emitErrorAndCloseNT,r,e)):a.nextTick(emitErrorAndCloseNT,r,e):t?(a.nextTick(emitCloseNT,r),t(e)):a.nextTick(emitCloseNT,r)})),this)},undestroy:function undestroy(){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 errorOrDestroy(e,t){var r=e._readableState,a=e._writableState;r&&r.autoDestroy||a&&a.autoDestroy?e.destroy(t):e.emit("error",t)}}},(e,t,r)=>{"use strict";var a=r(231).a.ERR_INVALID_OPT_VALUE;e.exports={getHighWaterMark:function getHighWaterMark(e,t,r,n){var o=function highWaterMarkFrom(e,t,r){return null!=e.highWaterMark?e.highWaterMark:t?e[r]:null}(t,n,r);if(null!=o){if(!isFinite(o)||Math.floor(o)!==o||o<0)throw new a(n?r:"highWaterMark",o);return Math.floor(o)}return e.objectMode?16:16384}}},(e,t,r)=>{"use strict";var a=r(11).Buffer,n=a.isEncoding||function(e){switch((e=""+e)&&e.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 StringDecoder(e){var t;switch(this.encoding=function normalizeEncoding(e){var t=function _normalizeEncoding(e){if(!e)return"utf8";for(var t;;)switch(e){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 e;default:if(t)return;e=(""+e).toLowerCase(),t=!0}}(e);if("string"!=typeof t&&(a.isEncoding===n||!n(e)))throw new Error("Unknown encoding: "+e);return t||e}(e),this.encoding){case"utf16le":this.text=utf16Text,this.end=utf16End,t=4;break;case"utf8":this.fillLast=utf8FillLast,t=4;break;case"base64":this.text=base64Text,this.end=base64End,t=3;break;default:return this.write=simpleWrite,void(this.end=simpleEnd)}this.lastNeed=0,this.lastTotal=0,this.lastChar=a.allocUnsafe(t)}function utf8CheckByte(e){return e<=127?0:e>>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function utf8FillLast(e){var t=this.lastTotal-this.lastNeed,r=function utf8CheckExtraBytes(e,t,r){if(128!=(192&t[0]))return e.lastNeed=0,"�";if(e.lastNeed>1&&t.length>1){if(128!=(192&t[1]))return e.lastNeed=1,"�";if(e.lastNeed>2&&t.length>2&&128!=(192&t[2]))return e.lastNeed=2,"�"}}(this,e);return void 0!==r?r:this.lastNeed<=e.length?(e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(e.copy(this.lastChar,t,0,e.length),void(this.lastNeed-=e.length))}function utf16Text(e,t){if((e.length-t)%2==0){var r=e.toString("utf16le",t);if(r){var a=r.charCodeAt(r.length-1);if(a>=55296&&a<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",t,e.length-1)}function utf16End(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return t+this.lastChar.toString("utf16le",0,r)}return t}function base64Text(e,t){var r=(e.length-t)%3;return 0===r?e.toString("base64",t):(this.lastNeed=3-r,this.lastTotal=3,1===r?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString("base64",t,e.length-r))}function base64End(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function simpleWrite(e){return e.toString(this.encoding)}function simpleEnd(e){return e&&e.length?this.write(e):""}t.a=StringDecoder,StringDecoder.prototype.write=function(e){if(0===e.length)return"";var t,r;if(this.lastNeed){if(void 0===(t=this.fillLast(e)))return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r=0)return n>0&&(e.lastNeed=n-1),n;if(--a=0)return n>0&&(e.lastNeed=n-2),n;if(--a=0)return n>0&&(2===n?n=0:e.lastNeed=n-3),n;return 0}(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=r;var a=e.length-(r-this.lastNeed);return e.copy(this.lastChar,0,a),e.toString("utf8",t,a)},StringDecoder.prototype.fillLast=function(e){if(this.lastNeed<=e.length)return e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,e.length),this.lastNeed-=e.length}},(e,t,r)=>{"use strict";e.exports=PassThrough;var a=r(315);function PassThrough(e){if(!(this instanceof PassThrough))return new PassThrough(e);a.call(this,e)}r(10)(PassThrough,a),PassThrough.prototype._transform=function(e,t,r){r(null,e)}},(e,t,r)=>{"use strict";var a;var n=r(231).a,o=n.ERR_MISSING_ARGS,s=n.ERR_STREAM_DESTROYED;function noop(e){if(e)throw e}function destroyer(e,t,n,o){o=function once(e){var t=!1;return function(){t||(t=!0,e.apply(void 0,arguments))}}(o);var c=!1;e.on("close",(function(){c=!0})),void 0===a&&(a=r(258)),a(e,{readable:t,writable:n},(function(e){if(e)return o(e);c=!0,o()}));var d=!1;return function(t){if(!c&&!d)return d=!0,function isRequest(e){return e.setHeader&&"function"==typeof e.abort}(e)?e.abort():"function"==typeof e.destroy?e.destroy():void o(t||new s("pipe"))}}function call(e){e()}function pipe(e,t){return e.pipe(t)}function popCallback(e){return e.length?"function"!=typeof e[e.length-1]?noop:e.pop():noop}e.exports=function pipeline(){for(var e=arguments.length,t=new Array(e),r=0;r0,(function(e){a||(a=e),e&&s.forEach(call),o||(s.forEach(call),n(a))}))}));return t.reduce(pipe)}},function(e,t,r){"use strict";var a=r(2).Buffer,n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.RandomNumberGenerator=void 0;const o=n(r(736));t.RandomNumberGenerator=class RandomNumberGenerator{constructor(e,t){if("string"==typeof e&&void 0===t)this.rng=o.default.alea(e,{state:!0});else if("object"==typeof t)this.rng=o.default.alea("",{state:t});else{const e=Math.random()*Date.now();this.rng=o.default.alea(`${e}`,{state:!0})}}getNumber(e=1){return 1!==e?this.rng()*e:this.rng()}getNumbers(e,t=1){const r=[];for(let a=0;a>>0,e=(a*=e)>>>0,e+=4294967296*(a-=e)}return 2.3283064365386963e-10*(e>>>0)}}();t.next=function(){var e=2091639*t.s0+2.3283064365386963e-10*t.c;return t.s0=t.s1,t.s1=t.s2,t.s2=e-(t.c=0|e)},t.c=1,t.s0=r(" "),t.s1=r(" "),t.s2=r(" "),t.s0-=r(e),t.s0<0&&(t.s0+=1),t.s1-=r(e),t.s1<0&&(t.s1+=1),t.s2-=r(e),t.s2<0&&(t.s2+=1),r=null}function copy(e,t){return t.c=e.c,t.s0=e.s0,t.s1=e.s1,t.s2=e.s2,t}function impl(e,t){var r=new Alea(e),a=t&&t.state,n=r.next;return n.int32=function(){return 4294967296*r.next()|0},n.double=function(){return n()+11102230246251565e-32*(2097152*n()|0)},n.quick=n,a&&("object"==typeof a&©(a,r),n.state=function(){return copy(r,{})}),n}n&&n.exports?n.exports=impl:r.amdD&&r.amdO?void 0===(a=function(){return impl}.call(t,r,t,n))||(n.exports=a):this.alea=impl}(0,e=r.nmd(e),r.amdD)},function(e,t,r){var a;!function(e,n,o){function XorGen(e){var t=this,r="";t.x=0,t.y=0,t.z=0,t.w=0,t.next=function(){var e=t.x^t.x<<11;return t.x=t.y,t.y=t.z,t.z=t.w,t.w^=t.w>>>19^e^e>>>8},e===(0|e)?t.x=e:r+=e;for(var a=0;a>>0)/4294967296};return prng.double=function(){do{var e=((r.next()>>>11)+(r.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},prng.int32=r.next,prng.quick=prng,a&&("object"==typeof a&©(a,r),prng.state=function(){return copy(r,{})}),prng}n&&n.exports?n.exports=impl:r.amdD&&r.amdO?void 0===(a=function(){return impl}.call(t,r,t,n))||(n.exports=a):this.xor128=impl}(0,e=r.nmd(e),r.amdD)},function(e,t,r){var a;!function(e,n,o){function XorGen(e){var t=this,r="";t.next=function(){var e=t.x^t.x>>>2;return t.x=t.y,t.y=t.z,t.z=t.w,t.w=t.v,(t.d=t.d+362437|0)+(t.v=t.v^t.v<<4^e^e<<1)|0},t.x=0,t.y=0,t.z=0,t.w=0,t.v=0,e===(0|e)?t.x=e:r+=e;for(var a=0;a>>4),t.next()}function copy(e,t){return t.x=e.x,t.y=e.y,t.z=e.z,t.w=e.w,t.v=e.v,t.d=e.d,t}function impl(e,t){var r=new XorGen(e),a=t&&t.state,prng=function(){return(r.next()>>>0)/4294967296};return prng.double=function(){do{var e=((r.next()>>>11)+(r.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},prng.int32=r.next,prng.quick=prng,a&&("object"==typeof a&©(a,r),prng.state=function(){return copy(r,{})}),prng}n&&n.exports?n.exports=impl:r.amdD&&r.amdO?void 0===(a=function(){return impl}.call(t,r,t,n))||(n.exports=a):this.xorwow=impl}(0,e=r.nmd(e),r.amdD)},function(e,t,r){var a;!function(e,n,o){function XorGen(e){var t=this;t.next=function(){var e,r,a=t.x,n=t.i;return e=a[n],r=(e^=e>>>7)^e<<24,r^=(e=a[n+1&7])^e>>>10,r^=(e=a[n+3&7])^e>>>3,r^=(e=a[n+4&7])^e<<7,e=a[n+7&7],r^=(e^=e<<13)^e<<9,a[n]=r,t.i=n+1&7,r},function init(e,t){var r,a=[];if(t===(0|t))a[0]=t;else for(t=""+t,r=0;r0;--r)e.next()}(t,e)}function copy(e,t){return t.x=e.x.slice(),t.i=e.i,t}function impl(e,t){null==e&&(e=+new Date);var r=new XorGen(e),a=t&&t.state,prng=function(){return(r.next()>>>0)/4294967296};return prng.double=function(){do{var e=((r.next()>>>11)+(r.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},prng.int32=r.next,prng.quick=prng,a&&(a.x&©(a,r),prng.state=function(){return copy(r,{})}),prng}n&&n.exports?n.exports=impl:r.amdD&&r.amdO?void 0===(a=function(){return impl}.call(t,r,t,n))||(n.exports=a):this.xorshift7=impl}(0,e=r.nmd(e),r.amdD)},function(e,t,r){var a;!function(e,n,o){function XorGen(e){var t=this;t.next=function(){var e,r,a=t.w,n=t.X,o=t.i;return t.w=a=a+1640531527|0,r=n[o+34&127],e=n[o=o+1&127],r^=r<<13,e^=e<<17,r^=r>>>15,e^=e>>>12,r=n[o]=r^e,t.i=o,r+(a^a>>>16)|0},function init(e,t){var r,a,n,o,s,c=[],d=128;for(t===(0|t)?(a=t,t=null):(t+="\0",a=0,d=Math.max(d,t.length)),n=0,o=-32;o>>15,a^=a<<4,a^=a>>>13,o>=0&&(s=s+1640531527|0,n=0==(r=c[127&o]^=a+s)?n+1:0);for(n>=128&&(c[127&(t&&t.length||0)]=-1),n=127,o=512;o>0;--o)a=c[n+34&127],r=c[n=n+1&127],a^=a<<13,r^=r<<17,a^=a>>>15,r^=r>>>12,c[n]=a^r;e.w=s,e.X=c,e.i=n}(t,e)}function copy(e,t){return t.i=e.i,t.w=e.w,t.X=e.X.slice(),t}function impl(e,t){null==e&&(e=+new Date);var r=new XorGen(e),a=t&&t.state,prng=function(){return(r.next()>>>0)/4294967296};return prng.double=function(){do{var e=((r.next()>>>11)+(r.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},prng.int32=r.next,prng.quick=prng,a&&(a.X&©(a,r),prng.state=function(){return copy(r,{})}),prng}n&&n.exports?n.exports=impl:r.amdD&&r.amdO?void 0===(a=function(){return impl}.call(t,r,t,n))||(n.exports=a):this.xor4096=impl}(0,e=r.nmd(e),r.amdD)},function(e,t,r){var a;!function(e,n,o){function XorGen(e){var t=this,r="";t.next=function(){var e=t.b,r=t.c,a=t.d,n=t.a;return e=e<<25^e>>>7^r,r=r-a|0,a=a<<24^a>>>8^n,n=n-e|0,t.b=e=e<<20^e>>>12^r,t.c=r=r-a|0,t.d=a<<16^r>>>16^n,t.a=n-e|0},t.a=0,t.b=0,t.c=-1640531527,t.d=1367130551,e===Math.floor(e)?(t.a=e/4294967296|0,t.b=0|e):r+=e;for(var a=0;a>>0)/4294967296};return prng.double=function(){do{var e=((r.next()>>>11)+(r.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},prng.int32=r.next,prng.quick=prng,a&&("object"==typeof a&©(a,r),prng.state=function(){return copy(r,{})}),prng}n&&n.exports?n.exports=impl:r.amdD&&r.amdO?void 0===(a=function(){return impl}.call(t,r,t,n))||(n.exports=a):this.tychei=impl}(0,e=r.nmd(e),r.amdD)},e=>{e.exports=function incr32(e){for(var t,r=e.length;r--;){if(255!==(t=e.readUInt8(r))){t++,e.writeUInt8(t,r);break}e.writeUInt8(0,r)}}},(e,t,r)=>{var a=r(319),n=r(11).Buffer,o=r(123),s=r(10),c=r(739),d=r(232),u=r(437);function StreamCipher(e,t,r,s){o.call(this);var d=n.alloc(4,0);this._cipher=new a.AES(t);var h=this._cipher.encryptBlock(d);this._ghash=new c(h),r=function calcIv(e,t,r){if(12===t.length)return e._finID=n.concat([t,n.from([0,0,0,1])]),n.concat([t,n.from([0,0,0,2])]);var a=new c(r),o=t.length,s=o%16;a.update(t),s&&(s=16-s,a.update(n.alloc(s,0))),a.update(n.alloc(8,0));var d=8*o,h=n.alloc(8);h.writeUIntBE(d,0,8),a.update(h),e._finID=a.state;var l=n.from(e._finID);return u(l),l}(this,r,h),this._prev=n.from(r),this._cache=n.allocUnsafe(0),this._secCache=n.allocUnsafe(0),this._decrypt=s,this._alen=0,this._len=0,this._mode=e,this._authTag=null,this._called=!1}s(StreamCipher,o),StreamCipher.prototype._update=function(e){if(!this._called&&this._alen){var t=16-this._alen%16;t<16&&(t=n.alloc(t,0),this._ghash.update(t))}this._called=!0;var r=this._mode.encrypt(this,e);return this._decrypt?this._ghash.update(e):this._ghash.update(r),this._len+=e.length,r},StreamCipher.prototype._final=function(){if(this._decrypt&&!this._authTag)throw new Error("Unsupported state or unable to authenticate data");var e=d(this._ghash.final(8*this._alen,8*this._len),this._cipher.encryptBlock(this._finID));if(this._decrypt&&function xorTest(e,t){var r=0;e.length!==t.length&&r++;for(var a=Math.min(e.length,t.length),n=0;n{var a=r(319),n=r(11).Buffer,o=r(123);function StreamCipher(e,t,r,s){o.call(this),this._cipher=new a.AES(t),this._prev=n.from(r),this._cache=n.allocUnsafe(0),this._secCache=n.allocUnsafe(0),this._decrypt=s,this._mode=e}r(10)(StreamCipher,o),StreamCipher.prototype._update=function(e){return this._mode.encrypt(this,e,this._decrypt)},StreamCipher.prototype._final=function(){this._cipher.scrub()},e.exports=StreamCipher},(e,t,r)=>{"use strict";var a=r(11).Buffer,n=r(260).Transform;function HashBase(e){n.call(this),this._block=a.allocUnsafe(e),this._blockSize=e,this._blockOffset=0,this._length=[0,0,0,0],this._finalized=!1}r(10)(HashBase,n),HashBase.prototype._transform=function(e,t,r){var a=null;try{this.update(e,t)}catch(e){a=e}r(a)},HashBase.prototype._flush=function(e){var t=null;try{this.push(this.digest())}catch(e){t=e}e(t)},HashBase.prototype.update=function(e,t){if(function throwIfNotStringOrBuffer(e,t){if(!a.isBuffer(e)&&"string"!=typeof e)throw new TypeError(t+" must be a string or a buffer")}(e,"Data"),this._finalized)throw new Error("Digest already called");a.isBuffer(e)||(e=a.from(e,t));for(var r=this._block,n=0;this._blockOffset+e.length-n>=this._blockSize;){for(var o=this._blockOffset;o0;++s)this._length[s]+=c,(c=this._length[s]/4294967296|0)>0&&(this._length[s]-=4294967296*c);return this},HashBase.prototype._update=function(){throw new Error("_update is not implemented")},HashBase.prototype.digest=function(e){if(this._finalized)throw new Error("Digest already called");this._finalized=!0;var t=this._digest();void 0!==e&&(t=t.toString(e)),this._block.fill(0),this._blockOffset=0;for(var r=0;r<4;++r)this._length[r]=0;return t},HashBase.prototype._digest=function(){throw new Error("_digest is not implemented")},e.exports=HashBase},function(e){"use strict";!function(t){const r=2147483647;function SHA256(e){const t=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,a=3144134277,n=1013904242,o=2773480762,s=1359893119,c=2600822924,d=528734635,u=1541459225;const h=new Uint32Array(64);function blocks(e){let l=0,b=e.length;for(;b>=64;){let g,p,B,m,I,y=r,v=a,x=n,C=o,Q=s,w=c,_=d,k=u;for(p=0;p<16;p++)B=l+4*p,h[p]=(255&e[B])<<24|(255&e[B+1])<<16|(255&e[B+2])<<8|255&e[B+3];for(p=16;p<64;p++)g=h[p-2],m=(g>>>17|g<<15)^(g>>>19|g<<13)^g>>>10,g=h[p-15],I=(g>>>7|g<<25)^(g>>>18|g<<14)^g>>>3,h[p]=(m+h[p-7]|0)+(I+h[p-16]|0)|0;for(p=0;p<64;p++)m=(((Q>>>6|Q<<26)^(Q>>>11|Q<<21)^(Q>>>25|Q<<7))+(Q&w^~Q&_)|0)+(k+(t[p]+h[p]|0)|0)|0,I=((y>>>2|y<<30)^(y>>>13|y<<19)^(y>>>22|y<<10))+(y&v^y&x^v&x)|0,k=_,_=w,w=Q,Q=C+m|0,C=x,x=v,v=y,y=m+I|0;r=r+y|0,a=a+v|0,n=n+x|0,o=o+C|0,s=s+Q|0,c=c+w|0,d=d+_|0,u=u+k|0,l+=64,b-=64}}blocks(e);let l,b=e.length%64,g=e.length/536870912|0,p=e.length<<3,B=b<56?56:120,m=e.slice(e.length-b,e.length);for(m.push(128),l=b+1;l>>24&255),m.push(g>>>16&255),m.push(g>>>8&255),m.push(g>>>0&255),m.push(p>>>24&255),m.push(p>>>16&255),m.push(p>>>8&255),m.push(p>>>0&255),blocks(m),[r>>>24&255,r>>>16&255,r>>>8&255,r>>>0&255,a>>>24&255,a>>>16&255,a>>>8&255,a>>>0&255,n>>>24&255,n>>>16&255,n>>>8&255,n>>>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,c>>>24&255,c>>>16&255,c>>>8&255,c>>>0&255,d>>>24&255,d>>>16&255,d>>>8&255,d>>>0&255,u>>>24&255,u>>>16&255,u>>>8&255,u>>>0&255]}function PBKDF2_HMAC_SHA256_OneIter(e,t,r){e=e.length<=64?e:SHA256(e);const a=64+t.length+4,n=new Array(a),o=new Array(64);let s,c=[];for(s=0;s<64;s++)n[s]=54;for(s=0;s=a-4;e--){if(n[e]++,n[e]<=255)return;n[e]=0}}for(;r>=32;)incrementCounter(),c=c.concat(SHA256(o.concat(SHA256(n)))),r-=32;return r>0&&(incrementCounter(),c=c.concat(SHA256(o.concat(SHA256(n))).slice(0,r))),c}function blockmix_salsa8(e,t,r,a,n){let o;for(arraycopy(e,16*(2*r-1),n,0,16),o=0;o<2*r;o++)blockxor(e,16*o,n,16),salsa20_8(n,a),arraycopy(n,0,e,t+16*o,16);for(o=0;o>>32-t}function salsa20_8(e,t){arraycopy(e,0,t,0,16);for(let e=8;e>0;e-=2)t[4]^=R(t[0]+t[12],7),t[8]^=R(t[4]+t[0],9),t[12]^=R(t[8]+t[4],13),t[0]^=R(t[12]+t[8],18),t[9]^=R(t[5]+t[1],7),t[13]^=R(t[9]+t[5],9),t[1]^=R(t[13]+t[9],13),t[5]^=R(t[1]+t[13],18),t[14]^=R(t[10]+t[6],7),t[2]^=R(t[14]+t[10],9),t[6]^=R(t[2]+t[14],13),t[10]^=R(t[6]+t[2],18),t[3]^=R(t[15]+t[11],7),t[7]^=R(t[3]+t[15],9),t[11]^=R(t[7]+t[3],13),t[15]^=R(t[11]+t[7],18),t[1]^=R(t[0]+t[3],7),t[2]^=R(t[1]+t[0],9),t[3]^=R(t[2]+t[1],13),t[0]^=R(t[3]+t[2],18),t[6]^=R(t[5]+t[4],7),t[7]^=R(t[6]+t[5],9),t[4]^=R(t[7]+t[6],13),t[5]^=R(t[4]+t[7],18),t[11]^=R(t[10]+t[9],7),t[8]^=R(t[11]+t[10],9),t[9]^=R(t[8]+t[11],13),t[10]^=R(t[9]+t[8],18),t[12]^=R(t[15]+t[14],7),t[13]^=R(t[12]+t[15],9),t[14]^=R(t[13]+t[12],13),t[15]^=R(t[14]+t[13],18);for(let r=0;r<16;++r)e[r]+=t[r]}function blockxor(e,t,r,a){for(let n=0;n=256)return!1}return!0}function ensureInteger(e,t){if("number"!=typeof e||e%1)throw new Error("invalid "+t);return e}function _scrypt(e,t,a,n,o,s,c){if(a=ensureInteger(a,"N"),n=ensureInteger(n,"r"),o=ensureInteger(o,"p"),s=ensureInteger(s,"dkLen"),0===a||0!=(a&a-1))throw new Error("N must be power of 2");if(a>r/128/n)throw new Error("N too large");if(n>r/128/o)throw new Error("r too large");if(!checkBufferish(e))throw new Error("password must be an array or buffer");if(e=Array.prototype.slice.call(e),!checkBufferish(t))throw new Error("salt must be an array or buffer");t=Array.prototype.slice.call(t);let d=PBKDF2_HMAC_SHA256_OneIter(e,t,128*o*n);const u=new Uint32Array(32*o*n);for(let e=0;ew&&(t=w);for(let e=0;ew&&(t=w);for(let e=0;e>0&255),d.push(u[e]>>8&255),d.push(u[e]>>16&255),d.push(u[e]>>24&255);const r=PBKDF2_HMAC_SHA256_OneIter(e,d,s);return c&&c(null,1,r),r}c&&_(incrementalSMix)};if(!c)for(;;){const e=incrementalSMix();if(null!=e)return e}incrementalSMix()}const a={scrypt:function(e,t,r,a,n,o,s){return new Promise((function(c,d){let u=0;s&&s(0),_scrypt(e,t,r,a,n,o,(function(e,t,r){if(e)d(e);else if(r)s&&1!==u&&s(1),c(new Uint8Array(r));else if(s&&t!==u)return u=t,s(t)}))}))},syncScrypt:function(e,t,r,a,n,o){return new Uint8Array(_scrypt(e,t,r,a,n,o))}};e.exports=a}()},(e,t,r)=>{var a=r(10),n=r(176),o=r(11).Buffer,s=[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],c=new Array(64);function Sha256(){this.init(),this._w=c,n.call(this,64,56)}function ch(e,t,r){return r^e&(t^r)}function maj(e,t,r){return e&t|r&(e|t)}function sigma0(e){return(e>>>2|e<<30)^(e>>>13|e<<19)^(e>>>22|e<<10)}function sigma1(e){return(e>>>6|e<<26)^(e>>>11|e<<21)^(e>>>25|e<<7)}function gamma0(e){return(e>>>7|e<<25)^(e>>>18|e<<14)^e>>>3}a(Sha256,n),Sha256.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},Sha256.prototype._update=function(e){for(var t,r=this._w,a=0|this._a,n=0|this._b,o=0|this._c,c=0|this._d,d=0|this._e,u=0|this._f,h=0|this._g,l=0|this._h,b=0;b<16;++b)r[b]=e.readInt32BE(4*b);for(;b<64;++b)r[b]=0|(((t=r[b-2])>>>17|t<<15)^(t>>>19|t<<13)^t>>>10)+r[b-7]+gamma0(r[b-15])+r[b-16];for(var g=0;g<64;++g){var p=l+sigma1(d)+ch(d,u,h)+s[g]+r[g]|0,B=sigma0(a)+maj(a,n,o)|0;l=h,h=u,u=d,d=c+p|0,c=o,o=n,n=a,a=p+B|0}this._a=a+this._a|0,this._b=n+this._b|0,this._c=o+this._c|0,this._d=c+this._d|0,this._e=d+this._e|0,this._f=u+this._f|0,this._g=h+this._g|0,this._h=l+this._h|0},Sha256.prototype._hash=function(){var e=o.allocUnsafe(32);return e.writeInt32BE(this._a,0),e.writeInt32BE(this._b,4),e.writeInt32BE(this._c,8),e.writeInt32BE(this._d,12),e.writeInt32BE(this._e,16),e.writeInt32BE(this._f,20),e.writeInt32BE(this._g,24),e.writeInt32BE(this._h,28),e},e.exports=Sha256},(e,t,r)=>{var a=r(10),n=r(176),o=r(11).Buffer,s=[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],c=new Array(160);function Sha512(){this.init(),this._w=c,n.call(this,128,112)}function Ch(e,t,r){return r^e&(t^r)}function maj(e,t,r){return e&t|r&(e|t)}function sigma0(e,t){return(e>>>28|t<<4)^(t>>>2|e<<30)^(t>>>7|e<<25)}function sigma1(e,t){return(e>>>14|t<<18)^(e>>>18|t<<14)^(t>>>9|e<<23)}function Gamma0(e,t){return(e>>>1|t<<31)^(e>>>8|t<<24)^e>>>7}function Gamma0l(e,t){return(e>>>1|t<<31)^(e>>>8|t<<24)^(e>>>7|t<<25)}function Gamma1(e,t){return(e>>>19|t<<13)^(t>>>29|e<<3)^e>>>6}function Gamma1l(e,t){return(e>>>19|t<<13)^(t>>>29|e<<3)^(e>>>6|t<<26)}function getCarry(e,t){return e>>>0>>0?1:0}a(Sha512,n),Sha512.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},Sha512.prototype._update=function(e){for(var t=this._w,r=0|this._ah,a=0|this._bh,n=0|this._ch,o=0|this._dh,c=0|this._eh,d=0|this._fh,u=0|this._gh,h=0|this._hh,l=0|this._al,b=0|this._bl,g=0|this._cl,p=0|this._dl,B=0|this._el,m=0|this._fl,I=0|this._gl,y=0|this._hl,v=0;v<32;v+=2)t[v]=e.readInt32BE(4*v),t[v+1]=e.readInt32BE(4*v+4);for(;v<160;v+=2){var x=t[v-30],C=t[v-30+1],Q=Gamma0(x,C),w=Gamma0l(C,x),_=Gamma1(x=t[v-4],C=t[v-4+1]),k=Gamma1l(C,x),N=t[v-14],D=t[v-14+1],U=t[v-32],G=t[v-32+1],T=w+D|0,L=Q+N+getCarry(T,w)|0;L=(L=L+_+getCarry(T=T+k|0,k)|0)+U+getCarry(T=T+G|0,G)|0,t[v]=L,t[v+1]=T}for(var P=0;P<160;P+=2){L=t[P],T=t[P+1];var q=maj(r,a,n),O=maj(l,b,g),H=sigma0(r,l),Y=sigma0(l,r),j=sigma1(c,B),J=sigma1(B,c),z=s[P],W=s[P+1],V=Ch(c,d,u),X=Ch(B,m,I),$=y+J|0,et=h+j+getCarry($,y)|0;et=(et=(et=et+V+getCarry($=$+X|0,X)|0)+z+getCarry($=$+W|0,W)|0)+L+getCarry($=$+T|0,T)|0;var tt=Y+O|0,rt=H+q+getCarry(tt,Y)|0;h=u,y=I,u=d,I=m,d=c,m=B,c=o+et+getCarry(B=p+$|0,p)|0,o=n,p=g,n=a,g=b,a=r,b=l,r=et+rt+getCarry(l=$+tt|0,$)|0}this._al=this._al+l|0,this._bl=this._bl+b|0,this._cl=this._cl+g|0,this._dl=this._dl+p|0,this._el=this._el+B|0,this._fl=this._fl+m|0,this._gl=this._gl+I|0,this._hl=this._hl+y|0,this._ah=this._ah+r+getCarry(this._al,l)|0,this._bh=this._bh+a+getCarry(this._bl,b)|0,this._ch=this._ch+n+getCarry(this._cl,g)|0,this._dh=this._dh+o+getCarry(this._dl,p)|0,this._eh=this._eh+c+getCarry(this._el,B)|0,this._fh=this._fh+d+getCarry(this._fl,m)|0,this._gh=this._gh+u+getCarry(this._gl,I)|0,this._hh=this._hh+h+getCarry(this._hl,y)|0},Sha512.prototype._hash=function(){var e=o.allocUnsafe(64);function writeInt64BE(t,r,a){e.writeInt32BE(t,a),e.writeInt32BE(r,a+4)}return writeInt64BE(this._ah,this._al,0),writeInt64BE(this._bh,this._bl,8),writeInt64BE(this._ch,this._cl,16),writeInt64BE(this._dh,this._dl,24),writeInt64BE(this._eh,this._el,32),writeInt64BE(this._fh,this._fl,40),writeInt64BE(this._gh,this._gl,48),writeInt64BE(this._hh,this._hl,56),e},e.exports=Sha512},(e,t,r)=>{"use strict";var a=r(10),n=r(744),o=r(123),s=r(11).Buffer,c=r(445),d=r(321),u=r(322),h=s.alloc(128);function Hmac(e,t){o.call(this,"digest"),"string"==typeof t&&(t=s.from(t));var r="sha512"===e||"sha384"===e?128:64;(this._alg=e,this._key=t,t.length>r)?t=("rmd160"===e?new d:u(e)).update(t).digest():t.length{var a=r(320);e.exports=function(e){return(new a).update(e).digest()}},e=>{var t=Math.pow(2,30)-1;e.exports=function(e,r){if("number"!=typeof e)throw new TypeError("Iterations not a number");if(e<0)throw new TypeError("Bad iterations");if("number"!=typeof r)throw new TypeError("Key length not a number");if(r<0||r>t||r!=r)throw new TypeError("Bad key length")}},(e,t,r)=>{var a,n=r(1);if(r.g.process&&r.g.process.browser)a="utf-8";else if(r.g.process&&r.g.process.version){a=parseInt(n.version.split(".")[0].slice(1),10)>=6?"utf-8":"binary"}else a="utf-8";e.exports=a},(e,t,r)=>{var a=r(445),n=r(321),o=r(322),s=r(11).Buffer,c=r(446),d=r(447),u=r(449),h=s.alloc(128),l={md5:16,sha1:20,sha224:28,sha256:32,sha384:48,sha512:64,rmd160:20,ripemd160:20};function Hmac(e,t,r){var c=function getDigest(e){function shaFunc(t){return o(e).update(t).digest()}function rmd160Func(e){return(new n).update(e).digest()}return"rmd160"===e||"ripemd160"===e?rmd160Func:"md5"===e?a:shaFunc}(e),d="sha512"===e||"sha384"===e?128:64;t.length>d?t=c(t):t.length{var a=r(11).Buffer;e.exports=function(e,t,r){if(a.isBuffer(e))return e;if("string"==typeof e)return a.from(e,t);if(ArrayBuffer.isView(e))return a.from(e.buffer);throw new TypeError(r+" must be a string, a Buffer, a typed array or a DataView")}},(e,t,r)=>{"use strict";var a=r(67),n=r(10),o=r(749),s=r(323);function DESState(){this.tmp=new Array(2),this.keys=null}function DES(e){s.call(this,e);var t=new DESState;this._desState=t,this.deriveKeys(t,e.key)}n(DES,s),e.exports=DES,DES.create=function create(e){return new DES(e)};var c=[1,1,2,2,2,2,2,2,1,2,2,2,2,2,2,1];DES.prototype.deriveKeys=function deriveKeys(e,t){e.keys=new Array(32),a.equal(t.length,this.blockSize,"Invalid key length");var r=o.readUInt32BE(t,0),n=o.readUInt32BE(t,4);o.pc1(r,n,e.tmp,0),r=e.tmp[0],n=e.tmp[1];for(var s=0;s>>1];r=o.r28shl(r,d),n=o.r28shl(n,d),o.pc2(r,n,e.keys,s)}},DES.prototype._update=function _update(e,t,r,a){var n=this._desState,s=o.readUInt32BE(e,t),c=o.readUInt32BE(e,t+4);o.ip(s,c,n.tmp,0),s=n.tmp[0],c=n.tmp[1],"encrypt"===this.type?this._encrypt(n,s,c,n.tmp,0):this._decrypt(n,s,c,n.tmp,0),s=n.tmp[0],c=n.tmp[1],o.writeUInt32BE(r,s,a),o.writeUInt32BE(r,c,a+4)},DES.prototype._pad=function _pad(e,t){for(var r=e.length-t,a=t;a>>0,s=b}o.rip(c,s,a,n)},DES.prototype._decrypt=function _decrypt(e,t,r,a,n){for(var s=r,c=t,d=e.keys.length-2;d>=0;d-=2){var u=e.keys[d],h=e.keys[d+1];o.expand(s,e.tmp,0),u^=e.tmp[0],h^=e.tmp[1];var l=o.substitute(u,h),b=s;s=(c^o.permute(l))>>>0,c=b}o.rip(s,c,a,n)}},(e,t,r)=>{var a=r(156);e.exports=findPrime,findPrime.simpleSieve=simpleSieve,findPrime.fermatTest=fermatTest;var n=r(26),o=new n(24),s=new(r(452)),c=new n(1),d=new n(2),u=new n(5),h=(new n(16),new n(8),new n(10)),l=new n(3),b=(new n(7),new n(11)),g=new n(4),p=(new n(12),null);function _getPrimes(){if(null!==p)return p;var e=[];e[0]=2;for(var t=1,r=3;r<1048576;r+=2){for(var a=Math.ceil(Math.sqrt(r)),n=0;ne;)r.ishrn(1);if(r.isEven()&&r.iadd(c),r.testn(1)||r.iadd(d),t.cmp(d)){if(!t.cmp(u))for(;r.mod(h).cmp(l);)r.iadd(g)}else for(;r.mod(o).cmp(b);)r.iadd(g);if(simpleSieve(p=r.shrn(1))&&simpleSieve(r)&&fermatTest(p)&&fermatTest(r)&&s.test(p)&&s.test(r))return r}}},(e,t,r)=>{var a=r(26),n=r(324);function MillerRabin(e){this.rand=e||new n.Rand}e.exports=MillerRabin,MillerRabin.create=function create(e){return new MillerRabin(e)},MillerRabin.prototype._randbelow=function _randbelow(e){var t=e.bitLength(),r=Math.ceil(t/8);do{var n=new a(this.rand.generate(r))}while(n.cmp(e)>=0);return n},MillerRabin.prototype._randrange=function _randrange(e,t){var r=t.sub(e);return e.add(this._randbelow(r))},MillerRabin.prototype.test=function test(e,t,r){var n=e.bitLength(),o=a.mont(e),s=new a(1).toRed(o);t||(t=Math.max(1,n/48|0));for(var c=e.subn(1),d=0;!c.testn(d);d++);for(var u=e.shrn(d),h=c.toRed(o);t>0;t--){var l=this._randrange(new a(2),c);r&&r(l);var b=l.toRed(o).redPow(u);if(0!==b.cmp(s)&&0!==b.cmp(h)){for(var g=1;g0;t--){var h=this._randrange(new a(2),s),l=e.gcd(h);if(0!==l.cmpn(1))return l;var b=h.toRed(n).redPow(d);if(0!==b.cmp(o)&&0!==b.cmp(u)){for(var g=1;g=48&&r<=57?r-48:r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:void assert(!1,"Invalid character in "+e)}function parseHexByte(e,t,r){var a=parseHex4Bits(e,r);return r-1>=t&&(a|=parseHex4Bits(e,r-1)<<4),a}function parseBase(e,t,r,a){for(var n=0,o=0,s=Math.min(e.length,r),c=t;c=49?d-49+10:d>=17?d-17+10:d,assert(d>=0&&o0?e:t},BN.min=function min(e,t){return e.cmp(t)<0?e:t},BN.prototype._init=function init(e,t,r){if("number"==typeof e)return this._initNumber(e,t,r);if("object"==typeof e)return this._initArray(e,t,r);"hex"===t&&(t=16),assert(t===(0|t)&&t>=2&&t<=36);var a=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&(a++,this.negative=1),a=0;a-=3)o=e[a]|e[a-1]<<8|e[a-2]<<16,this.words[n]|=o<>>26-s&67108863,(s+=24)>=26&&(s-=26,n++);else if("le"===r)for(a=0,n=0;a>>26-s&67108863,(s+=24)>=26&&(s-=26,n++);return this._strip()},BN.prototype._parseHex=function _parseHex(e,t,r){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var a=0;a=t;a-=2)n=parseHexByte(e,t,a)<=18?(o-=18,s+=1,this.words[s]|=n>>>26):o+=8;else for(a=(e.length-t)%2==0?t+1:t;a=18?(o-=18,s+=1,this.words[s]|=n>>>26):o+=8;this._strip()},BN.prototype._parseBase=function _parseBase(e,t,r){this.words=[0],this.length=1;for(var a=0,n=1;n<=67108863;n*=t)a++;a--,n=n/t|0;for(var o=e.length-r,s=o%a,c=Math.min(o,o-s)+r,d=0,u=r;u1&&0===this.words[this.length-1];)this.length--;return this._normSign()},BN.prototype._normSign=function _normSign(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for)try{BN.prototype[Symbol.for("nodejs.util.inspect.custom")]=inspect}catch(e){BN.prototype.inspect=inspect}else BN.prototype.inspect=inspect;function inspect(){return(this.red?""}var n=["","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"],o=[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],s=[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];BN.prototype.toString=function toString(e,t){var r;if(t=0|t||1,16===(e=e||10)||"hex"===e){r="";for(var a=0,c=0,d=0;d>>24-a&16777215)||d!==this.length-1?n[6-h.length]+h+r:h+r,(a+=2)>=26&&(a-=26,d--)}for(0!==c&&(r=c.toString(16)+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(e===(0|e)&&e>=2&&e<=36){var l=o[e],b=s[e];r="";var g=this.clone();for(g.negative=0;!g.isZero();){var p=g.modrn(b).toString(e);r=(g=g.idivn(b)).isZero()?p+r:n[l-p.length]+p+r}for(this.isZero()&&(r="0"+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}assert(!1,"Base should be between 2 and 36")},BN.prototype.toNumber=function toNumber(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&assert(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},BN.prototype.toJSON=function toJSON(){return this.toString(16,2)},a&&(BN.prototype.toBuffer=function toBuffer(e,t){return this.toArrayLike(a,e,t)}),BN.prototype.toArray=function toArray(e,t){return this.toArrayLike(Array,e,t)};function smallMulTo(e,t,r){r.negative=t.negative^e.negative;var a=e.length+t.length|0;r.length=a,a=a-1|0;var n=0|e.words[0],o=0|t.words[0],s=n*o,c=67108863&s,d=s/67108864|0;r.words[0]=c;for(var u=1;u>>26,l=67108863&d,b=Math.min(u,t.length-1),g=Math.max(0,u-e.length+1);g<=b;g++){var p=u-g|0;h+=(s=(n=0|e.words[p])*(o=0|t.words[g])+l)/67108864|0,l=67108863&s}r.words[u]=0|l,d=0|h}return 0!==d?r.words[u]=0|d:r.length--,r._strip()}BN.prototype.toArrayLike=function toArrayLike(e,t,r){this._strip();var a=this.byteLength(),n=r||Math.max(1,a);assert(a<=n,"byte array longer than desired length"),assert(n>0,"Requested array length <= 0");var o=function allocate(e,t){return e.allocUnsafe?e.allocUnsafe(t):new e(t)}(e,n);return this["_toArrayLike"+("le"===t?"LE":"BE")](o,a),o},BN.prototype._toArrayLikeLE=function _toArrayLikeLE(e,t){for(var r=0,a=0,n=0,o=0;n>8&255),r>16&255),6===o?(r>24&255),a=0,o=0):(a=s>>>24,o+=2)}if(r=0&&(e[r--]=s>>8&255),r>=0&&(e[r--]=s>>16&255),6===o?(r>=0&&(e[r--]=s>>24&255),a=0,o=0):(a=s>>>24,o+=2)}if(r>=0)for(e[r--]=a;r>=0;)e[r--]=0},Math.clz32?BN.prototype._countBits=function _countBits(e){return 32-Math.clz32(e)}:BN.prototype._countBits=function _countBits(e){var t=e,r=0;return t>=4096&&(r+=13,t>>>=13),t>=64&&(r+=7,t>>>=7),t>=8&&(r+=4,t>>>=4),t>=2&&(r+=2,t>>>=2),r+t},BN.prototype._zeroBits=function _zeroBits(e){if(0===e)return 26;var t=e,r=0;return 0==(8191&t)&&(r+=13,t>>>=13),0==(127&t)&&(r+=7,t>>>=7),0==(15&t)&&(r+=4,t>>>=4),0==(3&t)&&(r+=2,t>>>=2),0==(1&t)&&r++,r},BN.prototype.bitLength=function bitLength(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},BN.prototype.zeroBits=function zeroBits(){if(this.isZero())return 0;for(var e=0,t=0;te.length?this.clone().ior(e):e.clone().ior(this)},BN.prototype.uor=function uor(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},BN.prototype.iuand=function iuand(e){var t;t=this.length>e.length?e:this;for(var r=0;re.length?this.clone().iand(e):e.clone().iand(this)},BN.prototype.uand=function uand(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},BN.prototype.iuxor=function iuxor(e){var t,r;this.length>e.length?(t=this,r=e):(t=e,r=this);for(var a=0;ae.length?this.clone().ixor(e):e.clone().ixor(this)},BN.prototype.uxor=function uxor(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},BN.prototype.inotn=function inotn(e){assert("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),r=e%26;this._expand(t),r>0&&t--;for(var a=0;a0&&(this.words[a]=~this.words[a]&67108863>>26-r),this._strip()},BN.prototype.notn=function notn(e){return this.clone().inotn(e)},BN.prototype.setn=function setn(e,t){assert("number"==typeof e&&e>=0);var r=e/26|0,a=e%26;return this._expand(r+1),this.words[r]=t?this.words[r]|1<e.length?(r=this,a=e):(r=e,a=this);for(var n=0,o=0;o>>26;for(;0!==n&&o>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;oe.length?this.clone().iadd(e):e.clone().iadd(this)},BN.prototype.isub=function isub(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var r,a,n=this.cmp(e);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,a=e):(r=e,a=this);for(var o=0,s=0;s>26,this.words[s]=67108863&t;for(;0!==o&&s>26,this.words[s]=67108863&t;if(0===o&&s>>13,g=0|s[1],p=8191&g,B=g>>>13,m=0|s[2],I=8191&m,y=m>>>13,v=0|s[3],x=8191&v,C=v>>>13,Q=0|s[4],w=8191&Q,_=Q>>>13,k=0|s[5],N=8191&k,D=k>>>13,U=0|s[6],G=8191&U,T=U>>>13,L=0|s[7],P=8191&L,q=L>>>13,O=0|s[8],H=8191&O,Y=O>>>13,j=0|s[9],J=8191&j,z=j>>>13,W=0|c[0],V=8191&W,X=W>>>13,$=0|c[1],et=8191&$,tt=$>>>13,rt=0|c[2],at=8191&rt,it=rt>>>13,nt=0|c[3],ot=8191&nt,At=nt>>>13,st=0|c[4],ct=8191&st,dt=st>>>13,ut=0|c[5],ht=8191&ut,bt=ut>>>13,pt=0|c[6],Bt=8191&pt,mt=pt>>>13,It=0|c[7],Et=8191&It,yt=It>>>13,vt=0|c[8],xt=8191&vt,Ct=vt>>>13,Qt=0|c[9],wt=8191&Qt,Mt=Qt>>>13;r.negative=e.negative^t.negative,r.length=19;var _t=(u+(a=Math.imul(l,V))|0)+((8191&(n=(n=Math.imul(l,X))+Math.imul(b,V)|0))<<13)|0;u=((o=Math.imul(b,X))+(n>>>13)|0)+(_t>>>26)|0,_t&=67108863,a=Math.imul(p,V),n=(n=Math.imul(p,X))+Math.imul(B,V)|0,o=Math.imul(B,X);var kt=(u+(a=a+Math.imul(l,et)|0)|0)+((8191&(n=(n=n+Math.imul(l,tt)|0)+Math.imul(b,et)|0))<<13)|0;u=((o=o+Math.imul(b,tt)|0)+(n>>>13)|0)+(kt>>>26)|0,kt&=67108863,a=Math.imul(I,V),n=(n=Math.imul(I,X))+Math.imul(y,V)|0,o=Math.imul(y,X),a=a+Math.imul(p,et)|0,n=(n=n+Math.imul(p,tt)|0)+Math.imul(B,et)|0,o=o+Math.imul(B,tt)|0;var St=(u+(a=a+Math.imul(l,at)|0)|0)+((8191&(n=(n=n+Math.imul(l,it)|0)+Math.imul(b,at)|0))<<13)|0;u=((o=o+Math.imul(b,it)|0)+(n>>>13)|0)+(St>>>26)|0,St&=67108863,a=Math.imul(x,V),n=(n=Math.imul(x,X))+Math.imul(C,V)|0,o=Math.imul(C,X),a=a+Math.imul(I,et)|0,n=(n=n+Math.imul(I,tt)|0)+Math.imul(y,et)|0,o=o+Math.imul(y,tt)|0,a=a+Math.imul(p,at)|0,n=(n=n+Math.imul(p,it)|0)+Math.imul(B,at)|0,o=o+Math.imul(B,it)|0;var Nt=(u+(a=a+Math.imul(l,ot)|0)|0)+((8191&(n=(n=n+Math.imul(l,At)|0)+Math.imul(b,ot)|0))<<13)|0;u=((o=o+Math.imul(b,At)|0)+(n>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,a=Math.imul(w,V),n=(n=Math.imul(w,X))+Math.imul(_,V)|0,o=Math.imul(_,X),a=a+Math.imul(x,et)|0,n=(n=n+Math.imul(x,tt)|0)+Math.imul(C,et)|0,o=o+Math.imul(C,tt)|0,a=a+Math.imul(I,at)|0,n=(n=n+Math.imul(I,it)|0)+Math.imul(y,at)|0,o=o+Math.imul(y,it)|0,a=a+Math.imul(p,ot)|0,n=(n=n+Math.imul(p,At)|0)+Math.imul(B,ot)|0,o=o+Math.imul(B,At)|0;var Dt=(u+(a=a+Math.imul(l,ct)|0)|0)+((8191&(n=(n=n+Math.imul(l,dt)|0)+Math.imul(b,ct)|0))<<13)|0;u=((o=o+Math.imul(b,dt)|0)+(n>>>13)|0)+(Dt>>>26)|0,Dt&=67108863,a=Math.imul(N,V),n=(n=Math.imul(N,X))+Math.imul(D,V)|0,o=Math.imul(D,X),a=a+Math.imul(w,et)|0,n=(n=n+Math.imul(w,tt)|0)+Math.imul(_,et)|0,o=o+Math.imul(_,tt)|0,a=a+Math.imul(x,at)|0,n=(n=n+Math.imul(x,it)|0)+Math.imul(C,at)|0,o=o+Math.imul(C,it)|0,a=a+Math.imul(I,ot)|0,n=(n=n+Math.imul(I,At)|0)+Math.imul(y,ot)|0,o=o+Math.imul(y,At)|0,a=a+Math.imul(p,ct)|0,n=(n=n+Math.imul(p,dt)|0)+Math.imul(B,ct)|0,o=o+Math.imul(B,dt)|0;var Rt=(u+(a=a+Math.imul(l,ht)|0)|0)+((8191&(n=(n=n+Math.imul(l,bt)|0)+Math.imul(b,ht)|0))<<13)|0;u=((o=o+Math.imul(b,bt)|0)+(n>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,a=Math.imul(G,V),n=(n=Math.imul(G,X))+Math.imul(T,V)|0,o=Math.imul(T,X),a=a+Math.imul(N,et)|0,n=(n=n+Math.imul(N,tt)|0)+Math.imul(D,et)|0,o=o+Math.imul(D,tt)|0,a=a+Math.imul(w,at)|0,n=(n=n+Math.imul(w,it)|0)+Math.imul(_,at)|0,o=o+Math.imul(_,it)|0,a=a+Math.imul(x,ot)|0,n=(n=n+Math.imul(x,At)|0)+Math.imul(C,ot)|0,o=o+Math.imul(C,At)|0,a=a+Math.imul(I,ct)|0,n=(n=n+Math.imul(I,dt)|0)+Math.imul(y,ct)|0,o=o+Math.imul(y,dt)|0,a=a+Math.imul(p,ht)|0,n=(n=n+Math.imul(p,bt)|0)+Math.imul(B,ht)|0,o=o+Math.imul(B,bt)|0;var Ft=(u+(a=a+Math.imul(l,Bt)|0)|0)+((8191&(n=(n=n+Math.imul(l,mt)|0)+Math.imul(b,Bt)|0))<<13)|0;u=((o=o+Math.imul(b,mt)|0)+(n>>>13)|0)+(Ft>>>26)|0,Ft&=67108863,a=Math.imul(P,V),n=(n=Math.imul(P,X))+Math.imul(q,V)|0,o=Math.imul(q,X),a=a+Math.imul(G,et)|0,n=(n=n+Math.imul(G,tt)|0)+Math.imul(T,et)|0,o=o+Math.imul(T,tt)|0,a=a+Math.imul(N,at)|0,n=(n=n+Math.imul(N,it)|0)+Math.imul(D,at)|0,o=o+Math.imul(D,it)|0,a=a+Math.imul(w,ot)|0,n=(n=n+Math.imul(w,At)|0)+Math.imul(_,ot)|0,o=o+Math.imul(_,At)|0,a=a+Math.imul(x,ct)|0,n=(n=n+Math.imul(x,dt)|0)+Math.imul(C,ct)|0,o=o+Math.imul(C,dt)|0,a=a+Math.imul(I,ht)|0,n=(n=n+Math.imul(I,bt)|0)+Math.imul(y,ht)|0,o=o+Math.imul(y,bt)|0,a=a+Math.imul(p,Bt)|0,n=(n=n+Math.imul(p,mt)|0)+Math.imul(B,Bt)|0,o=o+Math.imul(B,mt)|0;var Ut=(u+(a=a+Math.imul(l,Et)|0)|0)+((8191&(n=(n=n+Math.imul(l,yt)|0)+Math.imul(b,Et)|0))<<13)|0;u=((o=o+Math.imul(b,yt)|0)+(n>>>13)|0)+(Ut>>>26)|0,Ut&=67108863,a=Math.imul(H,V),n=(n=Math.imul(H,X))+Math.imul(Y,V)|0,o=Math.imul(Y,X),a=a+Math.imul(P,et)|0,n=(n=n+Math.imul(P,tt)|0)+Math.imul(q,et)|0,o=o+Math.imul(q,tt)|0,a=a+Math.imul(G,at)|0,n=(n=n+Math.imul(G,it)|0)+Math.imul(T,at)|0,o=o+Math.imul(T,it)|0,a=a+Math.imul(N,ot)|0,n=(n=n+Math.imul(N,At)|0)+Math.imul(D,ot)|0,o=o+Math.imul(D,At)|0,a=a+Math.imul(w,ct)|0,n=(n=n+Math.imul(w,dt)|0)+Math.imul(_,ct)|0,o=o+Math.imul(_,dt)|0,a=a+Math.imul(x,ht)|0,n=(n=n+Math.imul(x,bt)|0)+Math.imul(C,ht)|0,o=o+Math.imul(C,bt)|0,a=a+Math.imul(I,Bt)|0,n=(n=n+Math.imul(I,mt)|0)+Math.imul(y,Bt)|0,o=o+Math.imul(y,mt)|0,a=a+Math.imul(p,Et)|0,n=(n=n+Math.imul(p,yt)|0)+Math.imul(B,Et)|0,o=o+Math.imul(B,yt)|0;var Gt=(u+(a=a+Math.imul(l,xt)|0)|0)+((8191&(n=(n=n+Math.imul(l,Ct)|0)+Math.imul(b,xt)|0))<<13)|0;u=((o=o+Math.imul(b,Ct)|0)+(n>>>13)|0)+(Gt>>>26)|0,Gt&=67108863,a=Math.imul(J,V),n=(n=Math.imul(J,X))+Math.imul(z,V)|0,o=Math.imul(z,X),a=a+Math.imul(H,et)|0,n=(n=n+Math.imul(H,tt)|0)+Math.imul(Y,et)|0,o=o+Math.imul(Y,tt)|0,a=a+Math.imul(P,at)|0,n=(n=n+Math.imul(P,it)|0)+Math.imul(q,at)|0,o=o+Math.imul(q,it)|0,a=a+Math.imul(G,ot)|0,n=(n=n+Math.imul(G,At)|0)+Math.imul(T,ot)|0,o=o+Math.imul(T,At)|0,a=a+Math.imul(N,ct)|0,n=(n=n+Math.imul(N,dt)|0)+Math.imul(D,ct)|0,o=o+Math.imul(D,dt)|0,a=a+Math.imul(w,ht)|0,n=(n=n+Math.imul(w,bt)|0)+Math.imul(_,ht)|0,o=o+Math.imul(_,bt)|0,a=a+Math.imul(x,Bt)|0,n=(n=n+Math.imul(x,mt)|0)+Math.imul(C,Bt)|0,o=o+Math.imul(C,mt)|0,a=a+Math.imul(I,Et)|0,n=(n=n+Math.imul(I,yt)|0)+Math.imul(y,Et)|0,o=o+Math.imul(y,yt)|0,a=a+Math.imul(p,xt)|0,n=(n=n+Math.imul(p,Ct)|0)+Math.imul(B,xt)|0,o=o+Math.imul(B,Ct)|0;var Tt=(u+(a=a+Math.imul(l,wt)|0)|0)+((8191&(n=(n=n+Math.imul(l,Mt)|0)+Math.imul(b,wt)|0))<<13)|0;u=((o=o+Math.imul(b,Mt)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,a=Math.imul(J,et),n=(n=Math.imul(J,tt))+Math.imul(z,et)|0,o=Math.imul(z,tt),a=a+Math.imul(H,at)|0,n=(n=n+Math.imul(H,it)|0)+Math.imul(Y,at)|0,o=o+Math.imul(Y,it)|0,a=a+Math.imul(P,ot)|0,n=(n=n+Math.imul(P,At)|0)+Math.imul(q,ot)|0,o=o+Math.imul(q,At)|0,a=a+Math.imul(G,ct)|0,n=(n=n+Math.imul(G,dt)|0)+Math.imul(T,ct)|0,o=o+Math.imul(T,dt)|0,a=a+Math.imul(N,ht)|0,n=(n=n+Math.imul(N,bt)|0)+Math.imul(D,ht)|0,o=o+Math.imul(D,bt)|0,a=a+Math.imul(w,Bt)|0,n=(n=n+Math.imul(w,mt)|0)+Math.imul(_,Bt)|0,o=o+Math.imul(_,mt)|0,a=a+Math.imul(x,Et)|0,n=(n=n+Math.imul(x,yt)|0)+Math.imul(C,Et)|0,o=o+Math.imul(C,yt)|0,a=a+Math.imul(I,xt)|0,n=(n=n+Math.imul(I,Ct)|0)+Math.imul(y,xt)|0,o=o+Math.imul(y,Ct)|0;var Lt=(u+(a=a+Math.imul(p,wt)|0)|0)+((8191&(n=(n=n+Math.imul(p,Mt)|0)+Math.imul(B,wt)|0))<<13)|0;u=((o=o+Math.imul(B,Mt)|0)+(n>>>13)|0)+(Lt>>>26)|0,Lt&=67108863,a=Math.imul(J,at),n=(n=Math.imul(J,it))+Math.imul(z,at)|0,o=Math.imul(z,it),a=a+Math.imul(H,ot)|0,n=(n=n+Math.imul(H,At)|0)+Math.imul(Y,ot)|0,o=o+Math.imul(Y,At)|0,a=a+Math.imul(P,ct)|0,n=(n=n+Math.imul(P,dt)|0)+Math.imul(q,ct)|0,o=o+Math.imul(q,dt)|0,a=a+Math.imul(G,ht)|0,n=(n=n+Math.imul(G,bt)|0)+Math.imul(T,ht)|0,o=o+Math.imul(T,bt)|0,a=a+Math.imul(N,Bt)|0,n=(n=n+Math.imul(N,mt)|0)+Math.imul(D,Bt)|0,o=o+Math.imul(D,mt)|0,a=a+Math.imul(w,Et)|0,n=(n=n+Math.imul(w,yt)|0)+Math.imul(_,Et)|0,o=o+Math.imul(_,yt)|0,a=a+Math.imul(x,xt)|0,n=(n=n+Math.imul(x,Ct)|0)+Math.imul(C,xt)|0,o=o+Math.imul(C,Ct)|0;var Pt=(u+(a=a+Math.imul(I,wt)|0)|0)+((8191&(n=(n=n+Math.imul(I,Mt)|0)+Math.imul(y,wt)|0))<<13)|0;u=((o=o+Math.imul(y,Mt)|0)+(n>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,a=Math.imul(J,ot),n=(n=Math.imul(J,At))+Math.imul(z,ot)|0,o=Math.imul(z,At),a=a+Math.imul(H,ct)|0,n=(n=n+Math.imul(H,dt)|0)+Math.imul(Y,ct)|0,o=o+Math.imul(Y,dt)|0,a=a+Math.imul(P,ht)|0,n=(n=n+Math.imul(P,bt)|0)+Math.imul(q,ht)|0,o=o+Math.imul(q,bt)|0,a=a+Math.imul(G,Bt)|0,n=(n=n+Math.imul(G,mt)|0)+Math.imul(T,Bt)|0,o=o+Math.imul(T,mt)|0,a=a+Math.imul(N,Et)|0,n=(n=n+Math.imul(N,yt)|0)+Math.imul(D,Et)|0,o=o+Math.imul(D,yt)|0,a=a+Math.imul(w,xt)|0,n=(n=n+Math.imul(w,Ct)|0)+Math.imul(_,xt)|0,o=o+Math.imul(_,Ct)|0;var qt=(u+(a=a+Math.imul(x,wt)|0)|0)+((8191&(n=(n=n+Math.imul(x,Mt)|0)+Math.imul(C,wt)|0))<<13)|0;u=((o=o+Math.imul(C,Mt)|0)+(n>>>13)|0)+(qt>>>26)|0,qt&=67108863,a=Math.imul(J,ct),n=(n=Math.imul(J,dt))+Math.imul(z,ct)|0,o=Math.imul(z,dt),a=a+Math.imul(H,ht)|0,n=(n=n+Math.imul(H,bt)|0)+Math.imul(Y,ht)|0,o=o+Math.imul(Y,bt)|0,a=a+Math.imul(P,Bt)|0,n=(n=n+Math.imul(P,mt)|0)+Math.imul(q,Bt)|0,o=o+Math.imul(q,mt)|0,a=a+Math.imul(G,Et)|0,n=(n=n+Math.imul(G,yt)|0)+Math.imul(T,Et)|0,o=o+Math.imul(T,yt)|0,a=a+Math.imul(N,xt)|0,n=(n=n+Math.imul(N,Ct)|0)+Math.imul(D,xt)|0,o=o+Math.imul(D,Ct)|0;var Ot=(u+(a=a+Math.imul(w,wt)|0)|0)+((8191&(n=(n=n+Math.imul(w,Mt)|0)+Math.imul(_,wt)|0))<<13)|0;u=((o=o+Math.imul(_,Mt)|0)+(n>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,a=Math.imul(J,ht),n=(n=Math.imul(J,bt))+Math.imul(z,ht)|0,o=Math.imul(z,bt),a=a+Math.imul(H,Bt)|0,n=(n=n+Math.imul(H,mt)|0)+Math.imul(Y,Bt)|0,o=o+Math.imul(Y,mt)|0,a=a+Math.imul(P,Et)|0,n=(n=n+Math.imul(P,yt)|0)+Math.imul(q,Et)|0,o=o+Math.imul(q,yt)|0,a=a+Math.imul(G,xt)|0,n=(n=n+Math.imul(G,Ct)|0)+Math.imul(T,xt)|0,o=o+Math.imul(T,Ct)|0;var Ht=(u+(a=a+Math.imul(N,wt)|0)|0)+((8191&(n=(n=n+Math.imul(N,Mt)|0)+Math.imul(D,wt)|0))<<13)|0;u=((o=o+Math.imul(D,Mt)|0)+(n>>>13)|0)+(Ht>>>26)|0,Ht&=67108863,a=Math.imul(J,Bt),n=(n=Math.imul(J,mt))+Math.imul(z,Bt)|0,o=Math.imul(z,mt),a=a+Math.imul(H,Et)|0,n=(n=n+Math.imul(H,yt)|0)+Math.imul(Y,Et)|0,o=o+Math.imul(Y,yt)|0,a=a+Math.imul(P,xt)|0,n=(n=n+Math.imul(P,Ct)|0)+Math.imul(q,xt)|0,o=o+Math.imul(q,Ct)|0;var Yt=(u+(a=a+Math.imul(G,wt)|0)|0)+((8191&(n=(n=n+Math.imul(G,Mt)|0)+Math.imul(T,wt)|0))<<13)|0;u=((o=o+Math.imul(T,Mt)|0)+(n>>>13)|0)+(Yt>>>26)|0,Yt&=67108863,a=Math.imul(J,Et),n=(n=Math.imul(J,yt))+Math.imul(z,Et)|0,o=Math.imul(z,yt),a=a+Math.imul(H,xt)|0,n=(n=n+Math.imul(H,Ct)|0)+Math.imul(Y,xt)|0,o=o+Math.imul(Y,Ct)|0;var jt=(u+(a=a+Math.imul(P,wt)|0)|0)+((8191&(n=(n=n+Math.imul(P,Mt)|0)+Math.imul(q,wt)|0))<<13)|0;u=((o=o+Math.imul(q,Mt)|0)+(n>>>13)|0)+(jt>>>26)|0,jt&=67108863,a=Math.imul(J,xt),n=(n=Math.imul(J,Ct))+Math.imul(z,xt)|0,o=Math.imul(z,Ct);var Jt=(u+(a=a+Math.imul(H,wt)|0)|0)+((8191&(n=(n=n+Math.imul(H,Mt)|0)+Math.imul(Y,wt)|0))<<13)|0;u=((o=o+Math.imul(Y,Mt)|0)+(n>>>13)|0)+(Jt>>>26)|0,Jt&=67108863;var Kt=(u+(a=Math.imul(J,wt))|0)+((8191&(n=(n=Math.imul(J,Mt))+Math.imul(z,wt)|0))<<13)|0;return u=((o=Math.imul(z,Mt))+(n>>>13)|0)+(Kt>>>26)|0,Kt&=67108863,d[0]=_t,d[1]=kt,d[2]=St,d[3]=Nt,d[4]=Dt,d[5]=Rt,d[6]=Ft,d[7]=Ut,d[8]=Gt,d[9]=Tt,d[10]=Lt,d[11]=Pt,d[12]=qt,d[13]=Ot,d[14]=Ht,d[15]=Yt,d[16]=jt,d[17]=Jt,d[18]=Kt,0!==u&&(d[19]=u,r.length++),r};function bigMulTo(e,t,r){r.negative=t.negative^e.negative,r.length=e.length+t.length;for(var a=0,n=0,o=0;o>>26)|0)>>>26,s&=67108863}r.words[o]=c,a=s,s=n}return 0!==a?r.words[o]=a:r.length--,r._strip()}function jumboMulTo(e,t,r){return bigMulTo(e,t,r)}function FFTM(e,t){this.x=e,this.y=t}Math.imul||(c=smallMulTo),BN.prototype.mulTo=function mulTo(e,t){var r=this.length+e.length;return 10===this.length&&10===e.length?c(this,e,t):r<63?smallMulTo(this,e,t):r<1024?bigMulTo(this,e,t):jumboMulTo(this,e,t)},FFTM.prototype.makeRBT=function makeRBT(e){for(var t=new Array(e),r=BN.prototype._countBits(e)-1,a=0;a>=1;return a},FFTM.prototype.permute=function permute(e,t,r,a,n,o){for(var s=0;s>>=1)n++;return 1<>>=13,r[2*o+1]=8191&n,n>>>=13;for(o=2*t;o>=26,r+=n/67108864|0,r+=o>>>26,this.words[a]=67108863&o}return 0!==r&&(this.words[a]=r,this.length++),t?this.ineg():this},BN.prototype.muln=function muln(e){return this.clone().imuln(e)},BN.prototype.sqr=function sqr(){return this.mul(this)},BN.prototype.isqr=function isqr(){return this.imul(this.clone())},BN.prototype.pow=function pow(e){var t=function toBitArray(e){for(var t=new Array(e.bitLength()),r=0;r>>n&1}return t}(e);if(0===t.length)return new BN(1);for(var r=this,a=0;a=0);var t,r=e%26,a=(e-r)/26,n=67108863>>>26-r<<26-r;if(0!==r){var o=0;for(t=0;t>>26-r}o&&(this.words[t]=o,this.length++)}if(0!==a){for(t=this.length-1;t>=0;t--)this.words[t+a]=this.words[t];for(t=0;t=0),a=t?(t-t%26)/26:0;var n=e%26,o=Math.min((e-n)/26,this.length),s=67108863^67108863>>>n<o)for(this.length-=o,d=0;d=0&&(0!==u||d>=a);d--){var h=0|this.words[d];this.words[d]=u<<26-n|h>>>n,u=h&s}return c&&0!==u&&(c.words[c.length++]=u),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},BN.prototype.ishrn=function ishrn(e,t,r){return assert(0===this.negative),this.iushrn(e,t,r)},BN.prototype.shln=function shln(e){return this.clone().ishln(e)},BN.prototype.ushln=function ushln(e){return this.clone().iushln(e)},BN.prototype.shrn=function shrn(e){return this.clone().ishrn(e)},BN.prototype.ushrn=function ushrn(e){return this.clone().iushrn(e)},BN.prototype.testn=function testn(e){assert("number"==typeof e&&e>=0);var t=e%26,r=(e-t)/26,a=1<=0);var t=e%26,r=(e-t)/26;if(assert(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==t&&r++,this.length=Math.min(r,this.length),0!==t){var a=67108863^67108863>>>t<=67108864;t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},BN.prototype.isubn=function isubn(e){if(assert("number"==typeof e),assert(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t>26)-(c/67108864|0),this.words[a+r]=67108863&n}for(;a>26,this.words[a+r]=67108863&n;if(0===s)return this._strip();for(assert(-1===s),s=0,a=0;a>26,this.words[a]=67108863&n;return this.negative=1,this._strip()},BN.prototype._wordDiv=function _wordDiv(e,t){var r=(this.length,e.length),a=this.clone(),n=e,o=0|n.words[n.length-1];0!==(r=26-this._countBits(o))&&(n=n.ushln(r),a.iushln(r),o=0|n.words[n.length-1]);var s,c=a.length-n.length;if("mod"!==t){(s=new BN(null)).length=c+1,s.words=new Array(s.length);for(var d=0;d=0;h--){var l=67108864*(0|a.words[n.length+h])+(0|a.words[n.length+h-1]);for(l=Math.min(l/o|0,67108863),a._ishlnsubmul(n,l,h);0!==a.negative;)l--,a.negative=0,a._ishlnsubmul(n,1,h),a.isZero()||(a.negative^=1);s&&(s.words[h]=l)}return s&&s._strip(),a._strip(),"div"!==t&&0!==r&&a.iushrn(r),{div:s||null,mod:a}},BN.prototype.divmod=function divmod(e,t,r){return assert(!e.isZero()),this.isZero()?{div:new BN(0),mod:new BN(0)}:0!==this.negative&&0===e.negative?(o=this.neg().divmod(e,t),"mod"!==t&&(a=o.div.neg()),"div"!==t&&(n=o.mod.neg(),r&&0!==n.negative&&n.iadd(e)),{div:a,mod:n}):0===this.negative&&0!==e.negative?(o=this.divmod(e.neg(),t),"mod"!==t&&(a=o.div.neg()),{div:a,mod:o.mod}):0!=(this.negative&e.negative)?(o=this.neg().divmod(e.neg(),t),"div"!==t&&(n=o.mod.neg(),r&&0!==n.negative&&n.isub(e)),{div:o.div,mod:n}):e.length>this.length||this.cmp(e)<0?{div:new BN(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new BN(this.modrn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new BN(this.modrn(e.words[0]))}:this._wordDiv(e,t);var a,n,o},BN.prototype.div=function div(e){return this.divmod(e,"div",!1).div},BN.prototype.mod=function mod(e){return this.divmod(e,"mod",!1).mod},BN.prototype.umod=function umod(e){return this.divmod(e,"mod",!0).mod},BN.prototype.divRound=function divRound(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var r=0!==t.div.negative?t.mod.isub(e):t.mod,a=e.ushrn(1),n=e.andln(1),o=r.cmp(a);return o<0||1===n&&0===o?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},BN.prototype.modrn=function modrn(e){var t=e<0;t&&(e=-e),assert(e<=67108863);for(var r=(1<<26)%e,a=0,n=this.length-1;n>=0;n--)a=(r*a+(0|this.words[n]))%e;return t?-a:a},BN.prototype.modn=function modn(e){return this.modrn(e)},BN.prototype.idivn=function idivn(e){var t=e<0;t&&(e=-e),assert(e<=67108863);for(var r=0,a=this.length-1;a>=0;a--){var n=(0|this.words[a])+67108864*r;this.words[a]=n/e|0,r=n%e}return this._strip(),t?this.ineg():this},BN.prototype.divn=function divn(e){return this.clone().idivn(e)},BN.prototype.egcd=function egcd(e){assert(0===e.negative),assert(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var a=new BN(1),n=new BN(0),o=new BN(0),s=new BN(1),c=0;t.isEven()&&r.isEven();)t.iushrn(1),r.iushrn(1),++c;for(var d=r.clone(),u=t.clone();!t.isZero();){for(var h=0,l=1;0==(t.words[0]&l)&&h<26;++h,l<<=1);if(h>0)for(t.iushrn(h);h-- >0;)(a.isOdd()||n.isOdd())&&(a.iadd(d),n.isub(u)),a.iushrn(1),n.iushrn(1);for(var b=0,g=1;0==(r.words[0]&g)&&b<26;++b,g<<=1);if(b>0)for(r.iushrn(b);b-- >0;)(o.isOdd()||s.isOdd())&&(o.iadd(d),s.isub(u)),o.iushrn(1),s.iushrn(1);t.cmp(r)>=0?(t.isub(r),a.isub(o),n.isub(s)):(r.isub(t),o.isub(a),s.isub(n))}return{a:o,b:s,gcd:r.iushln(c)}},BN.prototype._invmp=function _invmp(e){assert(0===e.negative),assert(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var a,n=new BN(1),o=new BN(0),s=r.clone();t.cmpn(1)>0&&r.cmpn(1)>0;){for(var c=0,d=1;0==(t.words[0]&d)&&c<26;++c,d<<=1);if(c>0)for(t.iushrn(c);c-- >0;)n.isOdd()&&n.iadd(s),n.iushrn(1);for(var u=0,h=1;0==(r.words[0]&h)&&u<26;++u,h<<=1);if(u>0)for(r.iushrn(u);u-- >0;)o.isOdd()&&o.iadd(s),o.iushrn(1);t.cmp(r)>=0?(t.isub(r),n.isub(o)):(r.isub(t),o.isub(n))}return(a=0===t.cmpn(1)?n:o).cmpn(0)<0&&a.iadd(e),a},BN.prototype.gcd=function gcd(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),r=e.clone();t.negative=0,r.negative=0;for(var a=0;t.isEven()&&r.isEven();a++)t.iushrn(1),r.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=t.cmp(r);if(n<0){var o=t;t=r,r=o}else if(0===n||0===r.cmpn(1))break;t.isub(r)}return r.iushln(a)},BN.prototype.invm=function invm(e){return this.egcd(e).a.umod(e)},BN.prototype.isEven=function isEven(){return 0==(1&this.words[0])},BN.prototype.isOdd=function isOdd(){return 1==(1&this.words[0])},BN.prototype.andln=function andln(e){return this.words[0]&e},BN.prototype.bincn=function bincn(e){assert("number"==typeof e);var t=e%26,r=(e-t)/26,a=1<>>26,s&=67108863,this.words[o]=s}return 0!==n&&(this.words[o]=n,this.length++),this},BN.prototype.isZero=function isZero(){return 1===this.length&&0===this.words[0]},BN.prototype.cmpn=function cmpn(e){var t,r=e<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this._strip(),this.length>1)t=1;else{r&&(e=-e),assert(e<=67108863,"Number is too big");var a=0|this.words[0];t=a===e?0:ae.length)return 1;if(this.length=0;r--){var a=0|this.words[r],n=0|e.words[r];if(a!==n){an&&(t=1);break}}return t},BN.prototype.gtn=function gtn(e){return 1===this.cmpn(e)},BN.prototype.gt=function gt(e){return 1===this.cmp(e)},BN.prototype.gten=function gten(e){return this.cmpn(e)>=0},BN.prototype.gte=function gte(e){return this.cmp(e)>=0},BN.prototype.ltn=function ltn(e){return-1===this.cmpn(e)},BN.prototype.lt=function lt(e){return-1===this.cmp(e)},BN.prototype.lten=function lten(e){return this.cmpn(e)<=0},BN.prototype.lte=function lte(e){return this.cmp(e)<=0},BN.prototype.eqn=function eqn(e){return 0===this.cmpn(e)},BN.prototype.eq=function eq(e){return 0===this.cmp(e)},BN.red=function red(e){return new Red(e)},BN.prototype.toRed=function toRed(e){return assert(!this.red,"Already a number in reduction context"),assert(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},BN.prototype.fromRed=function fromRed(){return assert(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},BN.prototype._forceRed=function _forceRed(e){return this.red=e,this},BN.prototype.forceRed=function forceRed(e){return assert(!this.red,"Already a number in reduction context"),this._forceRed(e)},BN.prototype.redAdd=function redAdd(e){return assert(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},BN.prototype.redIAdd=function redIAdd(e){return assert(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},BN.prototype.redSub=function redSub(e){return assert(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},BN.prototype.redISub=function redISub(e){return assert(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},BN.prototype.redShl=function redShl(e){return assert(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},BN.prototype.redMul=function redMul(e){return assert(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},BN.prototype.redIMul=function redIMul(e){return assert(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},BN.prototype.redSqr=function redSqr(){return assert(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},BN.prototype.redISqr=function redISqr(){return assert(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},BN.prototype.redSqrt=function redSqrt(){return assert(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},BN.prototype.redInvm=function redInvm(){return assert(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},BN.prototype.redNeg=function redNeg(){return assert(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},BN.prototype.redPow=function redPow(e){return assert(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var d={k256:null,p224:null,p192:null,p25519:null};function MPrime(e,t){this.name=e,this.p=new BN(t,16),this.n=this.p.bitLength(),this.k=new BN(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function K256(){MPrime.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function P224(){MPrime.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function P192(){MPrime.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function P25519(){MPrime.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function Red(e){if("string"==typeof e){var t=BN._prime(e);this.m=t.p,this.prime=t}else assert(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function Mont(e){Red.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new BN(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)}MPrime.prototype._tmp=function _tmp(){var e=new BN(null);return e.words=new Array(Math.ceil(this.n/13)),e},MPrime.prototype.ireduce=function ireduce(e){var t,r=e;do{this.split(r,this.tmp),t=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(t>this.n);var a=t0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},MPrime.prototype.split=function split(e,t){e.iushrn(this.n,0,t)},MPrime.prototype.imulK=function imulK(e){return e.imul(this.k)},inherits(K256,MPrime),K256.prototype.split=function split(e,t){for(var r=4194303,a=Math.min(e.length,9),n=0;n>>22,o=s}o>>>=22,e.words[n-10]=o,0===o&&e.length>10?e.length-=10:e.length-=9},K256.prototype.imulK=function imulK(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,r=0;r>>=26,e.words[r]=n,t=a}return 0!==t&&(e.words[e.length++]=t),e},BN._prime=function prime(e){if(d[e])return d[e];var prime;if("k256"===e)prime=new K256;else if("p224"===e)prime=new P224;else if("p192"===e)prime=new P192;else{if("p25519"!==e)throw new Error("Unknown prime "+e);prime=new P25519}return d[e]=prime,prime},Red.prototype._verify1=function _verify1(e){assert(0===e.negative,"red works only with positives"),assert(e.red,"red works only with red numbers")},Red.prototype._verify2=function _verify2(e,t){assert(0==(e.negative|t.negative),"red works only with positives"),assert(e.red&&e.red===t.red,"red works only with red numbers")},Red.prototype.imod=function imod(e){return this.prime?this.prime.ireduce(e)._forceRed(this):(move(e,e.umod(this.m)._forceRed(this)),e)},Red.prototype.neg=function neg(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},Red.prototype.add=function add(e,t){this._verify2(e,t);var r=e.add(t);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},Red.prototype.iadd=function iadd(e,t){this._verify2(e,t);var r=e.iadd(t);return r.cmp(this.m)>=0&&r.isub(this.m),r},Red.prototype.sub=function sub(e,t){this._verify2(e,t);var r=e.sub(t);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},Red.prototype.isub=function isub(e,t){this._verify2(e,t);var r=e.isub(t);return r.cmpn(0)<0&&r.iadd(this.m),r},Red.prototype.shl=function shl(e,t){return this._verify1(e),this.imod(e.ushln(t))},Red.prototype.imul=function imul(e,t){return this._verify2(e,t),this.imod(e.imul(t))},Red.prototype.mul=function mul(e,t){return this._verify2(e,t),this.imod(e.mul(t))},Red.prototype.isqr=function isqr(e){return this.imul(e,e.clone())},Red.prototype.sqr=function sqr(e){return this.mul(e,e)},Red.prototype.sqrt=function sqrt(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(assert(t%2==1),3===t){var r=this.m.add(new BN(1)).iushrn(2);return this.pow(e,r)}for(var a=this.m.subn(1),n=0;!a.isZero()&&0===a.andln(1);)n++,a.iushrn(1);assert(!a.isZero());var o=new BN(1).toRed(this),s=o.redNeg(),c=this.m.subn(1).iushrn(1),d=this.m.bitLength();for(d=new BN(2*d*d).toRed(this);0!==this.pow(d,c).cmp(s);)d.redIAdd(s);for(var u=this.pow(d,a),h=this.pow(e,a.addn(1).iushrn(1)),l=this.pow(e,a),b=n;0!==l.cmp(o);){for(var g=l,p=0;0!==g.cmp(o);p++)g=g.redSqr();assert(p=0;a--){for(var d=t.words[a],u=c-1;u>=0;u--){var h=d>>u&1;n!==r[0]&&(n=this.sqr(n)),0!==h||0!==o?(o<<=1,o|=h,(4===++s||0===a&&0===u)&&(n=this.mul(n,r[o]),s=0,o=0)):s=0}c=26}return n},Red.prototype.convertTo=function convertTo(e){var t=e.umod(this.m);return t===e?t.clone():t},Red.prototype.convertFrom=function convertFrom(e){var t=e.clone();return t.red=null,t},BN.mont=function mont(e){return new Mont(e)},inherits(Mont,Red),Mont.prototype.convertTo=function convertTo(e){return this.imod(e.ushln(this.shift))},Mont.prototype.convertFrom=function convertFrom(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},Mont.prototype.imul=function imul(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var r=e.imul(t),a=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(a).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},Mont.prototype.mul=function mul(e,t){if(e.isZero()||t.isZero())return new BN(0)._forceRed(this);var r=e.mul(t),a=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(a).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},Mont.prototype.invm=function invm(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(e=r.nmd(e),this)},(e,t)=>{"use strict";var r=t;function zero2(e){return 1===e.length?"0"+e:e}function toHex(e){for(var t="",r=0;r>8,s=255&n;o?r.push(o,s):r.push(s)}return r},r.zero2=zero2,r.toHex=toHex,r.encode=function encode(e,t){return"hex"===t?toHex(e):e}},(e,t,r)=>{"use strict";var a=t;a.base=r(261),a.short=r(754),a.mont=r(755),a.edwards=r(756)},(e,t,r)=>{"use strict";var a=r(109),n=r(262),o=r(758),s=r(67),c=a.sum32,d=a.sum32_4,u=a.sum32_5,h=o.ch32,l=o.maj32,b=o.s0_256,g=o.s1_256,p=o.g0_256,B=o.g1_256,m=n.BlockHash,I=[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 SHA256(){if(!(this instanceof SHA256))return new SHA256;m.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=I,this.W=new Array(64)}a.inherits(SHA256,m),e.exports=SHA256,SHA256.blockSize=512,SHA256.outSize=256,SHA256.hmacStrength=192,SHA256.padLength=64,SHA256.prototype._update=function _update(e,t){for(var r=this.W,a=0;a<16;a++)r[a]=e[t+a];for(;a{"use strict";var a=r(109),n=r(262),o=r(67),s=a.rotr64_hi,c=a.rotr64_lo,d=a.shr64_hi,u=a.shr64_lo,h=a.sum64,l=a.sum64_hi,b=a.sum64_lo,g=a.sum64_4_hi,p=a.sum64_4_lo,B=a.sum64_5_hi,m=a.sum64_5_lo,I=n.BlockHash,y=[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 SHA512(){if(!(this instanceof SHA512))return new SHA512;I.call(this),this.h=[1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209],this.k=y,this.W=new Array(160)}function ch64_hi(e,t,r,a,n){var o=e&r^~e&n;return o<0&&(o+=4294967296),o}function ch64_lo(e,t,r,a,n,o){var s=t&a^~t&o;return s<0&&(s+=4294967296),s}function maj64_hi(e,t,r,a,n){var o=e&r^e&n^r&n;return o<0&&(o+=4294967296),o}function maj64_lo(e,t,r,a,n,o){var s=t&a^t&o^a&o;return s<0&&(s+=4294967296),s}function s0_512_hi(e,t){var r=s(e,t,28)^s(t,e,2)^s(t,e,7);return r<0&&(r+=4294967296),r}function s0_512_lo(e,t){var r=c(e,t,28)^c(t,e,2)^c(t,e,7);return r<0&&(r+=4294967296),r}function s1_512_hi(e,t){var r=s(e,t,14)^s(e,t,18)^s(t,e,9);return r<0&&(r+=4294967296),r}function s1_512_lo(e,t){var r=c(e,t,14)^c(e,t,18)^c(t,e,9);return r<0&&(r+=4294967296),r}function g0_512_hi(e,t){var r=s(e,t,1)^s(e,t,8)^d(e,t,7);return r<0&&(r+=4294967296),r}function g0_512_lo(e,t){var r=c(e,t,1)^c(e,t,8)^u(e,t,7);return r<0&&(r+=4294967296),r}function g1_512_hi(e,t){var r=s(e,t,19)^s(t,e,29)^d(e,t,6);return r<0&&(r+=4294967296),r}function g1_512_lo(e,t){var r=c(e,t,19)^c(t,e,29)^u(e,t,6);return r<0&&(r+=4294967296),r}a.inherits(SHA512,I),e.exports=SHA512,SHA512.blockSize=1024,SHA512.outSize=512,SHA512.hmacStrength=192,SHA512.padLength=128,SHA512.prototype._prepareBlock=function _prepareBlock(e,t){for(var r=this.W,a=0;a<32;a++)r[a]=e[t+a];for(;a{"use strict";const a=t;a.bignum=r(26),a.define=r(770).define,a.base=r(773),a.constants=r(774),a.decoders=r(462),a.encoders=r(459)},(e,t,r)=>{"use strict";const a=t;a.der=r(460),a.pem=r(771)},(e,t,r)=>{"use strict";const a=r(10),n=r(330).Buffer,o=r(331),s=r(265);function DEREncoder(e){this.enc="der",this.name=e.name,this.entity=e,this.tree=new DERNode,this.tree._init(e.body)}function DERNode(e){o.call(this,"der",e)}function two(e){return e<10?"0"+e:e}e.exports=DEREncoder,DEREncoder.prototype.encode=function encode(e,t){return this.tree._encode(e,t).join()},a(DERNode,o),DERNode.prototype._encodeComposite=function encodeComposite(e,t,r,a){const o=function encodeTag(e,t,r,a){let n;"seqof"===e?e="seq":"setof"===e&&(e="set");if(s.tagByName.hasOwnProperty(e))n=s.tagByName[e];else{if("number"!=typeof e||(0|e)!==e)return a.error("Unknown tag: "+e);n=e}if(n>=31)return a.error("Multi-octet tag encoding unsupported");t||(n|=32);return n|=s.tagClassByName[r||"universal"]<<6,n}(e,t,r,this.reporter);if(a.length<128){const e=n.alloc(2);return e[0]=o,e[1]=a.length,this._createEncoderBuffer([e,a])}let c=1;for(let e=a.length;e>=256;e>>=8)c++;const d=n.alloc(2+c);d[0]=o,d[1]=128|c;for(let e=1+c,t=a.length;t>0;e--,t>>=8)d[e]=255&t;return this._createEncoderBuffer([d,a])},DERNode.prototype._encodeStr=function encodeStr(e,t){if("bitstr"===t)return this._createEncoderBuffer([0|e.unused,e.data]);if("bmpstr"===t){const t=n.alloc(2*e.length);for(let r=0;r=40)return this.reporter.error("Second objid identifier OOB");e.splice(0,2,40*e[0]+e[1])}let a=0;for(let t=0;t=128;r>>=7)a++}const o=n.alloc(a);let s=o.length-1;for(let t=e.length-1;t>=0;t--){let r=e[t];for(o[s--]=127&r;(r>>=7)>0;)o[s--]=128|127&r}return this._createEncoderBuffer(o)},DERNode.prototype._encodeTime=function encodeTime(e,t){let r;const a=new Date(e);return"gentime"===t?r=[two(a.getUTCFullYear()),two(a.getUTCMonth()+1),two(a.getUTCDate()),two(a.getUTCHours()),two(a.getUTCMinutes()),two(a.getUTCSeconds()),"Z"].join(""):"utctime"===t?r=[two(a.getUTCFullYear()%100),two(a.getUTCMonth()+1),two(a.getUTCDate()),two(a.getUTCHours()),two(a.getUTCMinutes()),two(a.getUTCSeconds()),"Z"].join(""):this.reporter.error("Encoding "+t+" time is not supported yet"),this._encodeStr(r,"octstr")},DERNode.prototype._encodeNull=function encodeNull(){return this._createEncoderBuffer("")},DERNode.prototype._encodeInt=function encodeInt(e,t){if("string"==typeof e){if(!t)return this.reporter.error("String int or enum given, but no values map");if(!t.hasOwnProperty(e))return this.reporter.error("Values map doesn't contain: "+JSON.stringify(e));e=t[e]}if("number"!=typeof e&&!n.isBuffer(e)){const t=e.toArray();!e.sign&&128&t[0]&&t.unshift(0),e=n.from(t)}if(n.isBuffer(e)){let t=e.length;0===e.length&&t++;const r=n.alloc(t);return e.copy(r),0===e.length&&(r[0]=0),this._createEncoderBuffer(r)}if(e<128)return this._createEncoderBuffer(e);if(e<256)return this._createEncoderBuffer([0,e]);let r=1;for(let t=e;t>=256;t>>=8)r++;const a=new Array(r);for(let t=a.length-1;t>=0;t--)a[t]=255&e,e>>=8;return 128&a[0]&&a.unshift(0),this._createEncoderBuffer(n.from(a))},DERNode.prototype._encodeBool=function encodeBool(e){return this._createEncoderBuffer(e?255:0)},DERNode.prototype._use=function use(e,t){return"function"==typeof e&&(e=e(t)),e._getEncoder("der").tree},DERNode.prototype._skipDefault=function skipDefault(e,t,r){const a=this._baseState;let n;if(null===a.default)return!1;const o=e.join();if(void 0===a.defaultBuffer&&(a.defaultBuffer=this._encodeValue(a.default,t,r).join()),o.length!==a.defaultBuffer.length)return!1;for(n=0;n{"use strict";const a=r(10);function Reporter(e){this._reporterState={obj:null,path:[],options:e||{},errors:[]}}function ReporterError(e,t){this.path=e,this.rethrow(t)}t.a=Reporter,Reporter.prototype.isError=function isError(e){return e instanceof ReporterError},Reporter.prototype.save=function save(){const e=this._reporterState;return{obj:e.obj,pathLen:e.path.length}},Reporter.prototype.restore=function restore(e){const t=this._reporterState;t.obj=e.obj,t.path=t.path.slice(0,e.pathLen)},Reporter.prototype.enterKey=function enterKey(e){return this._reporterState.path.push(e)},Reporter.prototype.exitKey=function exitKey(e){const t=this._reporterState;t.path=t.path.slice(0,e-1)},Reporter.prototype.leaveKey=function leaveKey(e,t,r){const a=this._reporterState;this.exitKey(e),null!==a.obj&&(a.obj[t]=r)},Reporter.prototype.path=function path(){return this._reporterState.path.join("/")},Reporter.prototype.enterObject=function enterObject(){const e=this._reporterState,t=e.obj;return e.obj={},t},Reporter.prototype.leaveObject=function leaveObject(e){const t=this._reporterState,r=t.obj;return t.obj=e,r},Reporter.prototype.error=function error(e){let t;const r=this._reporterState,a=e instanceof ReporterError;if(t=a?e:new ReporterError(r.path.map((function(e){return"["+JSON.stringify(e)+"]"})).join(""),e.message||e,e.stack),!r.options.partial)throw t;return a||r.errors.push(t),t},Reporter.prototype.wrapResult=function wrapResult(e){const t=this._reporterState;return t.options.partial?{result:this.isError(e)?null:e,errors:t.errors}:e},a(ReporterError,Error),ReporterError.prototype.rethrow=function rethrow(e){if(this.message=e+" at: "+(this.path||"(shallow)"),Error.captureStackTrace&&Error.captureStackTrace(this,ReporterError),!this.stack)try{throw new Error(this.message)}catch(e){this.stack=e.stack}return this}},(e,t,r)=>{"use strict";const a=t;a.der=r(463),a.pem=r(772)},(e,t,r)=>{"use strict";const a=r(10),n=r(26),o=r(264).a,s=r(331),c=r(265);function DERDecoder(e){this.enc="der",this.name=e.name,this.entity=e,this.tree=new DERNode,this.tree._init(e.body)}function DERNode(e){s.call(this,"der",e)}function derDecodeTag(e,t){let r=e.readUInt8(t);if(e.isError(r))return r;const a=c.tagClass[r>>6],n=0==(32&r);if(31==(31&r)){let a=r;for(r=0;128==(128&a);){if(a=e.readUInt8(t),e.isError(a))return a;r<<=7,r|=127&a}}else r&=31;return{cls:a,primitive:n,tag:r,tagStr:c.tag[r]}}function derDecodeLen(e,t,r){let a=e.readUInt8(r);if(e.isError(a))return a;if(!t&&128===a)return null;if(0==(128&a))return a;const n=127&a;if(n>4)return e.error("length octect is too long");a=0;for(let t=0;t{t.publicEncrypt=r(780),t.privateDecrypt=r(781),t.privateEncrypt=function privateEncrypt(e,r){return t.publicEncrypt(e,r,!0)},t.publicDecrypt=function publicDecrypt(e,r){return t.privateDecrypt(e,r,!0)}},(e,t,r)=>{var a=r(233),n=r(11).Buffer;function i2ops(e){var t=n.allocUnsafe(4);return t.writeUInt32BE(e,0),t}e.exports=function(e,t){for(var r,o=n.alloc(0),s=0;o.length{e.exports=function xor(e,t){for(var r=e.length,a=-1;++a{var a=r(26),n=r(11).Buffer;e.exports=function withPublic(e,t){return n.from(e.toRed(a.mont(t.modulus)).redPow(new a(t.publicExponent)).fromRed().toArray())}},(e,t,r)=>{e.exports=r(788)(r(789))},(e,t,r)=>{"use strict";var a=t;a.version=r(1259).a,a.utils=r(69),a.rand=r(471),a.curve=r(472),a.curves=r(333),a.ec=r(799),a.eddsa=r(803)},(e,t)=>{"use strict";var r=t;function zero2(e){return 1===e.length?"0"+e:e}function toHex(e){for(var t="",r=0;r>8,s=255&n;o?r.push(o,s):r.push(s)}return r},r.zero2=zero2,r.toHex=toHex,r.encode=function encode(e,t){return"hex"===t?toHex(e):e}},(e,t,r)=>{var a;function Rand(e){this.rand=e}if(e.exports=function rand(e){return a||(a=new Rand(null)),a.generate(e)},e.exports.Rand=Rand,Rand.prototype.generate=function generate(e){return this._rand(e)},Rand.prototype._rand=function _rand(e){if(this.rand.getBytes)return this.rand.getBytes(e);for(var t=new Uint8Array(e),r=0;r{"use strict";var a=t;a.base=r(267),a.short=r(790),a.mont=r(791),a.edwards=r(792)},(e,t,r)=>{"use strict";var a=r(110),n=r(268),o=r(794),s=r(157),c=a.sum32,d=a.sum32_4,u=a.sum32_5,h=o.ch32,l=o.maj32,b=o.s0_256,g=o.s1_256,p=o.g0_256,B=o.g1_256,m=n.BlockHash,I=[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 SHA256(){if(!(this instanceof SHA256))return new SHA256;m.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=I,this.W=new Array(64)}a.inherits(SHA256,m),e.exports=SHA256,SHA256.blockSize=512,SHA256.outSize=256,SHA256.hmacStrength=192,SHA256.padLength=64,SHA256.prototype._update=function _update(e,t){for(var r=this.W,a=0;a<16;a++)r[a]=e[t+a];for(;a{"use strict";var a=r(110),n=r(268),o=r(157),s=a.rotr64_hi,c=a.rotr64_lo,d=a.shr64_hi,u=a.shr64_lo,h=a.sum64,l=a.sum64_hi,b=a.sum64_lo,g=a.sum64_4_hi,p=a.sum64_4_lo,B=a.sum64_5_hi,m=a.sum64_5_lo,I=n.BlockHash,y=[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 SHA512(){if(!(this instanceof SHA512))return new SHA512;I.call(this),this.h=[1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209],this.k=y,this.W=new Array(160)}function ch64_hi(e,t,r,a,n){var o=e&r^~e&n;return o<0&&(o+=4294967296),o}function ch64_lo(e,t,r,a,n,o){var s=t&a^~t&o;return s<0&&(s+=4294967296),s}function maj64_hi(e,t,r,a,n){var o=e&r^e&n^r&n;return o<0&&(o+=4294967296),o}function maj64_lo(e,t,r,a,n,o){var s=t&a^t&o^a&o;return s<0&&(s+=4294967296),s}function s0_512_hi(e,t){var r=s(e,t,28)^s(t,e,2)^s(t,e,7);return r<0&&(r+=4294967296),r}function s0_512_lo(e,t){var r=c(e,t,28)^c(t,e,2)^c(t,e,7);return r<0&&(r+=4294967296),r}function s1_512_hi(e,t){var r=s(e,t,14)^s(e,t,18)^s(t,e,9);return r<0&&(r+=4294967296),r}function s1_512_lo(e,t){var r=c(e,t,14)^c(e,t,18)^c(t,e,9);return r<0&&(r+=4294967296),r}function g0_512_hi(e,t){var r=s(e,t,1)^s(e,t,8)^d(e,t,7);return r<0&&(r+=4294967296),r}function g0_512_lo(e,t){var r=c(e,t,1)^c(e,t,8)^u(e,t,7);return r<0&&(r+=4294967296),r}function g1_512_hi(e,t){var r=s(e,t,19)^s(t,e,29)^d(e,t,6);return r<0&&(r+=4294967296),r}function g1_512_lo(e,t){var r=c(e,t,19)^c(t,e,29)^u(e,t,6);return r<0&&(r+=4294967296),r}a.inherits(SHA512,I),e.exports=SHA512,SHA512.blockSize=1024,SHA512.outSize=512,SHA512.hmacStrength=192,SHA512.padLength=128,SHA512.prototype._prepareBlock=function _prepareBlock(e,t){for(var r=this.W,a=0;a<32;a++)r[a]=e[t+a];for(;a{"use strict";var a=r(1),n=65536,o=4294967295;var s=r(56).Buffer,c=r.g.crypto||r.g.msCrypto;c&&c.getRandomValues?e.exports=function randomBytes(e,t){if(e>o)throw new RangeError("requested too many random bytes");var r=s.allocUnsafe(e);if(e>0)if(e>n)for(var d=0;d{e.exports=function isHexPrefixed(e){if("string"!=typeof e)throw new Error("[is-hex-prefixed] value must be type 'string', is currently type "+typeof e+", while checking isHexPrefixed.");return"0x"===e.slice(0,2)}},function(e,t,r){!function(e,t){"use strict";function assert(e,t){if(!e)throw new Error(t||"Assertion failed")}function inherits(e,t){e.super_=t;var TempCtor=function(){};TempCtor.prototype=t.prototype,e.prototype=new TempCtor,e.prototype.constructor=e}function BN(e,t,r){if(BN.isBN(e))return e;this.negative=0,this.words=null,this.length=0,this.red=null,null!==e&&("le"!==t&&"be"!==t||(r=t,t=10),this._init(e||0,t||10,r||"be"))}var a;"object"==typeof e?e.exports=BN:t.BN=BN,BN.BN=BN,BN.wordSize=26;try{a="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:r(17).Buffer}catch(e){}function parseHex4Bits(e,t){var r=e.charCodeAt(t);return r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:r-48&15}function parseHexByte(e,t,r){var a=parseHex4Bits(e,r);return r-1>=t&&(a|=parseHex4Bits(e,r-1)<<4),a}function parseBase(e,t,r,a){for(var n=0,o=Math.min(e.length,r),s=t;s=49?c-49+10:c>=17?c-17+10:c}return n}BN.isBN=function isBN(e){return e instanceof BN||null!==e&&"object"==typeof e&&e.constructor.wordSize===BN.wordSize&&Array.isArray(e.words)},BN.max=function max(e,t){return e.cmp(t)>0?e:t},BN.min=function min(e,t){return e.cmp(t)<0?e:t},BN.prototype._init=function init(e,t,r){if("number"==typeof e)return this._initNumber(e,t,r);if("object"==typeof e)return this._initArray(e,t,r);"hex"===t&&(t=16),assert(t===(0|t)&&t>=2&&t<=36);var a=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&(a++,this.negative=1),a=0;a-=3)o=e[a]|e[a-1]<<8|e[a-2]<<16,this.words[n]|=o<>>26-s&67108863,(s+=24)>=26&&(s-=26,n++);else if("le"===r)for(a=0,n=0;a>>26-s&67108863,(s+=24)>=26&&(s-=26,n++);return this.strip()},BN.prototype._parseHex=function _parseHex(e,t,r){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var a=0;a=t;a-=2)n=parseHexByte(e,t,a)<=18?(o-=18,s+=1,this.words[s]|=n>>>26):o+=8;else for(a=(e.length-t)%2==0?t+1:t;a=18?(o-=18,s+=1,this.words[s]|=n>>>26):o+=8;this.strip()},BN.prototype._parseBase=function _parseBase(e,t,r){this.words=[0],this.length=1;for(var a=0,n=1;n<=67108863;n*=t)a++;a--,n=n/t|0;for(var o=e.length-r,s=o%a,c=Math.min(o,o-s)+r,d=0,u=r;u1&&0===this.words[this.length-1];)this.length--;return this._normSign()},BN.prototype._normSign=function _normSign(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},BN.prototype.inspect=function inspect(){return(this.red?""};var n=["","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"],o=[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],s=[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 smallMulTo(e,t,r){r.negative=t.negative^e.negative;var a=e.length+t.length|0;r.length=a,a=a-1|0;var n=0|e.words[0],o=0|t.words[0],s=n*o,c=67108863&s,d=s/67108864|0;r.words[0]=c;for(var u=1;u>>26,l=67108863&d,b=Math.min(u,t.length-1),g=Math.max(0,u-e.length+1);g<=b;g++){var p=u-g|0;h+=(s=(n=0|e.words[p])*(o=0|t.words[g])+l)/67108864|0,l=67108863&s}r.words[u]=0|l,d=0|h}return 0!==d?r.words[u]=0|d:r.length--,r.strip()}BN.prototype.toString=function toString(e,t){var r;if(t=0|t||1,16===(e=e||10)||"hex"===e){r="";for(var a=0,c=0,d=0;d>>24-a&16777215)||d!==this.length-1?n[6-h.length]+h+r:h+r,(a+=2)>=26&&(a-=26,d--)}for(0!==c&&(r=c.toString(16)+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(e===(0|e)&&e>=2&&e<=36){var l=o[e],b=s[e];r="";var g=this.clone();for(g.negative=0;!g.isZero();){var p=g.modn(b).toString(e);r=(g=g.idivn(b)).isZero()?p+r:n[l-p.length]+p+r}for(this.isZero()&&(r="0"+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}assert(!1,"Base should be between 2 and 36")},BN.prototype.toNumber=function toNumber(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&assert(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},BN.prototype.toJSON=function toJSON(){return this.toString(16)},BN.prototype.toBuffer=function toBuffer(e,t){return assert(void 0!==a),this.toArrayLike(a,e,t)},BN.prototype.toArray=function toArray(e,t){return this.toArrayLike(Array,e,t)},BN.prototype.toArrayLike=function toArrayLike(e,t,r){var a=this.byteLength(),n=r||Math.max(1,a);assert(a<=n,"byte array longer than desired length"),assert(n>0,"Requested array length <= 0"),this.strip();var o,s,c="le"===t,d=new e(n),u=this.clone();if(c){for(s=0;!u.isZero();s++)o=u.andln(255),u.iushrn(8),d[s]=o;for(;s=4096&&(r+=13,t>>>=13),t>=64&&(r+=7,t>>>=7),t>=8&&(r+=4,t>>>=4),t>=2&&(r+=2,t>>>=2),r+t},BN.prototype._zeroBits=function _zeroBits(e){if(0===e)return 26;var t=e,r=0;return 0==(8191&t)&&(r+=13,t>>>=13),0==(127&t)&&(r+=7,t>>>=7),0==(15&t)&&(r+=4,t>>>=4),0==(3&t)&&(r+=2,t>>>=2),0==(1&t)&&r++,r},BN.prototype.bitLength=function bitLength(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},BN.prototype.zeroBits=function zeroBits(){if(this.isZero())return 0;for(var e=0,t=0;te.length?this.clone().ior(e):e.clone().ior(this)},BN.prototype.uor=function uor(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},BN.prototype.iuand=function iuand(e){var t;t=this.length>e.length?e:this;for(var r=0;re.length?this.clone().iand(e):e.clone().iand(this)},BN.prototype.uand=function uand(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},BN.prototype.iuxor=function iuxor(e){var t,r;this.length>e.length?(t=this,r=e):(t=e,r=this);for(var a=0;ae.length?this.clone().ixor(e):e.clone().ixor(this)},BN.prototype.uxor=function uxor(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},BN.prototype.inotn=function inotn(e){assert("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),r=e%26;this._expand(t),r>0&&t--;for(var a=0;a0&&(this.words[a]=~this.words[a]&67108863>>26-r),this.strip()},BN.prototype.notn=function notn(e){return this.clone().inotn(e)},BN.prototype.setn=function setn(e,t){assert("number"==typeof e&&e>=0);var r=e/26|0,a=e%26;return this._expand(r+1),this.words[r]=t?this.words[r]|1<e.length?(r=this,a=e):(r=e,a=this);for(var n=0,o=0;o>>26;for(;0!==n&&o>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;oe.length?this.clone().iadd(e):e.clone().iadd(this)},BN.prototype.isub=function isub(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var r,a,n=this.cmp(e);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,a=e):(r=e,a=this);for(var o=0,s=0;s>26,this.words[s]=67108863&t;for(;0!==o&&s>26,this.words[s]=67108863&t;if(0===o&&s>>13,g=0|s[1],p=8191&g,B=g>>>13,m=0|s[2],I=8191&m,y=m>>>13,v=0|s[3],x=8191&v,C=v>>>13,Q=0|s[4],w=8191&Q,_=Q>>>13,k=0|s[5],N=8191&k,D=k>>>13,U=0|s[6],G=8191&U,T=U>>>13,L=0|s[7],P=8191&L,q=L>>>13,O=0|s[8],H=8191&O,Y=O>>>13,j=0|s[9],J=8191&j,z=j>>>13,W=0|c[0],V=8191&W,X=W>>>13,$=0|c[1],et=8191&$,tt=$>>>13,rt=0|c[2],at=8191&rt,it=rt>>>13,nt=0|c[3],ot=8191&nt,At=nt>>>13,st=0|c[4],ct=8191&st,dt=st>>>13,ut=0|c[5],ht=8191&ut,bt=ut>>>13,pt=0|c[6],Bt=8191&pt,mt=pt>>>13,It=0|c[7],Et=8191&It,yt=It>>>13,vt=0|c[8],xt=8191&vt,Ct=vt>>>13,Qt=0|c[9],wt=8191&Qt,Mt=Qt>>>13;r.negative=e.negative^t.negative,r.length=19;var _t=(u+(a=Math.imul(l,V))|0)+((8191&(n=(n=Math.imul(l,X))+Math.imul(b,V)|0))<<13)|0;u=((o=Math.imul(b,X))+(n>>>13)|0)+(_t>>>26)|0,_t&=67108863,a=Math.imul(p,V),n=(n=Math.imul(p,X))+Math.imul(B,V)|0,o=Math.imul(B,X);var kt=(u+(a=a+Math.imul(l,et)|0)|0)+((8191&(n=(n=n+Math.imul(l,tt)|0)+Math.imul(b,et)|0))<<13)|0;u=((o=o+Math.imul(b,tt)|0)+(n>>>13)|0)+(kt>>>26)|0,kt&=67108863,a=Math.imul(I,V),n=(n=Math.imul(I,X))+Math.imul(y,V)|0,o=Math.imul(y,X),a=a+Math.imul(p,et)|0,n=(n=n+Math.imul(p,tt)|0)+Math.imul(B,et)|0,o=o+Math.imul(B,tt)|0;var St=(u+(a=a+Math.imul(l,at)|0)|0)+((8191&(n=(n=n+Math.imul(l,it)|0)+Math.imul(b,at)|0))<<13)|0;u=((o=o+Math.imul(b,it)|0)+(n>>>13)|0)+(St>>>26)|0,St&=67108863,a=Math.imul(x,V),n=(n=Math.imul(x,X))+Math.imul(C,V)|0,o=Math.imul(C,X),a=a+Math.imul(I,et)|0,n=(n=n+Math.imul(I,tt)|0)+Math.imul(y,et)|0,o=o+Math.imul(y,tt)|0,a=a+Math.imul(p,at)|0,n=(n=n+Math.imul(p,it)|0)+Math.imul(B,at)|0,o=o+Math.imul(B,it)|0;var Nt=(u+(a=a+Math.imul(l,ot)|0)|0)+((8191&(n=(n=n+Math.imul(l,At)|0)+Math.imul(b,ot)|0))<<13)|0;u=((o=o+Math.imul(b,At)|0)+(n>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,a=Math.imul(w,V),n=(n=Math.imul(w,X))+Math.imul(_,V)|0,o=Math.imul(_,X),a=a+Math.imul(x,et)|0,n=(n=n+Math.imul(x,tt)|0)+Math.imul(C,et)|0,o=o+Math.imul(C,tt)|0,a=a+Math.imul(I,at)|0,n=(n=n+Math.imul(I,it)|0)+Math.imul(y,at)|0,o=o+Math.imul(y,it)|0,a=a+Math.imul(p,ot)|0,n=(n=n+Math.imul(p,At)|0)+Math.imul(B,ot)|0,o=o+Math.imul(B,At)|0;var Dt=(u+(a=a+Math.imul(l,ct)|0)|0)+((8191&(n=(n=n+Math.imul(l,dt)|0)+Math.imul(b,ct)|0))<<13)|0;u=((o=o+Math.imul(b,dt)|0)+(n>>>13)|0)+(Dt>>>26)|0,Dt&=67108863,a=Math.imul(N,V),n=(n=Math.imul(N,X))+Math.imul(D,V)|0,o=Math.imul(D,X),a=a+Math.imul(w,et)|0,n=(n=n+Math.imul(w,tt)|0)+Math.imul(_,et)|0,o=o+Math.imul(_,tt)|0,a=a+Math.imul(x,at)|0,n=(n=n+Math.imul(x,it)|0)+Math.imul(C,at)|0,o=o+Math.imul(C,it)|0,a=a+Math.imul(I,ot)|0,n=(n=n+Math.imul(I,At)|0)+Math.imul(y,ot)|0,o=o+Math.imul(y,At)|0,a=a+Math.imul(p,ct)|0,n=(n=n+Math.imul(p,dt)|0)+Math.imul(B,ct)|0,o=o+Math.imul(B,dt)|0;var Rt=(u+(a=a+Math.imul(l,ht)|0)|0)+((8191&(n=(n=n+Math.imul(l,bt)|0)+Math.imul(b,ht)|0))<<13)|0;u=((o=o+Math.imul(b,bt)|0)+(n>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,a=Math.imul(G,V),n=(n=Math.imul(G,X))+Math.imul(T,V)|0,o=Math.imul(T,X),a=a+Math.imul(N,et)|0,n=(n=n+Math.imul(N,tt)|0)+Math.imul(D,et)|0,o=o+Math.imul(D,tt)|0,a=a+Math.imul(w,at)|0,n=(n=n+Math.imul(w,it)|0)+Math.imul(_,at)|0,o=o+Math.imul(_,it)|0,a=a+Math.imul(x,ot)|0,n=(n=n+Math.imul(x,At)|0)+Math.imul(C,ot)|0,o=o+Math.imul(C,At)|0,a=a+Math.imul(I,ct)|0,n=(n=n+Math.imul(I,dt)|0)+Math.imul(y,ct)|0,o=o+Math.imul(y,dt)|0,a=a+Math.imul(p,ht)|0,n=(n=n+Math.imul(p,bt)|0)+Math.imul(B,ht)|0,o=o+Math.imul(B,bt)|0;var Ft=(u+(a=a+Math.imul(l,Bt)|0)|0)+((8191&(n=(n=n+Math.imul(l,mt)|0)+Math.imul(b,Bt)|0))<<13)|0;u=((o=o+Math.imul(b,mt)|0)+(n>>>13)|0)+(Ft>>>26)|0,Ft&=67108863,a=Math.imul(P,V),n=(n=Math.imul(P,X))+Math.imul(q,V)|0,o=Math.imul(q,X),a=a+Math.imul(G,et)|0,n=(n=n+Math.imul(G,tt)|0)+Math.imul(T,et)|0,o=o+Math.imul(T,tt)|0,a=a+Math.imul(N,at)|0,n=(n=n+Math.imul(N,it)|0)+Math.imul(D,at)|0,o=o+Math.imul(D,it)|0,a=a+Math.imul(w,ot)|0,n=(n=n+Math.imul(w,At)|0)+Math.imul(_,ot)|0,o=o+Math.imul(_,At)|0,a=a+Math.imul(x,ct)|0,n=(n=n+Math.imul(x,dt)|0)+Math.imul(C,ct)|0,o=o+Math.imul(C,dt)|0,a=a+Math.imul(I,ht)|0,n=(n=n+Math.imul(I,bt)|0)+Math.imul(y,ht)|0,o=o+Math.imul(y,bt)|0,a=a+Math.imul(p,Bt)|0,n=(n=n+Math.imul(p,mt)|0)+Math.imul(B,Bt)|0,o=o+Math.imul(B,mt)|0;var Ut=(u+(a=a+Math.imul(l,Et)|0)|0)+((8191&(n=(n=n+Math.imul(l,yt)|0)+Math.imul(b,Et)|0))<<13)|0;u=((o=o+Math.imul(b,yt)|0)+(n>>>13)|0)+(Ut>>>26)|0,Ut&=67108863,a=Math.imul(H,V),n=(n=Math.imul(H,X))+Math.imul(Y,V)|0,o=Math.imul(Y,X),a=a+Math.imul(P,et)|0,n=(n=n+Math.imul(P,tt)|0)+Math.imul(q,et)|0,o=o+Math.imul(q,tt)|0,a=a+Math.imul(G,at)|0,n=(n=n+Math.imul(G,it)|0)+Math.imul(T,at)|0,o=o+Math.imul(T,it)|0,a=a+Math.imul(N,ot)|0,n=(n=n+Math.imul(N,At)|0)+Math.imul(D,ot)|0,o=o+Math.imul(D,At)|0,a=a+Math.imul(w,ct)|0,n=(n=n+Math.imul(w,dt)|0)+Math.imul(_,ct)|0,o=o+Math.imul(_,dt)|0,a=a+Math.imul(x,ht)|0,n=(n=n+Math.imul(x,bt)|0)+Math.imul(C,ht)|0,o=o+Math.imul(C,bt)|0,a=a+Math.imul(I,Bt)|0,n=(n=n+Math.imul(I,mt)|0)+Math.imul(y,Bt)|0,o=o+Math.imul(y,mt)|0,a=a+Math.imul(p,Et)|0,n=(n=n+Math.imul(p,yt)|0)+Math.imul(B,Et)|0,o=o+Math.imul(B,yt)|0;var Gt=(u+(a=a+Math.imul(l,xt)|0)|0)+((8191&(n=(n=n+Math.imul(l,Ct)|0)+Math.imul(b,xt)|0))<<13)|0;u=((o=o+Math.imul(b,Ct)|0)+(n>>>13)|0)+(Gt>>>26)|0,Gt&=67108863,a=Math.imul(J,V),n=(n=Math.imul(J,X))+Math.imul(z,V)|0,o=Math.imul(z,X),a=a+Math.imul(H,et)|0,n=(n=n+Math.imul(H,tt)|0)+Math.imul(Y,et)|0,o=o+Math.imul(Y,tt)|0,a=a+Math.imul(P,at)|0,n=(n=n+Math.imul(P,it)|0)+Math.imul(q,at)|0,o=o+Math.imul(q,it)|0,a=a+Math.imul(G,ot)|0,n=(n=n+Math.imul(G,At)|0)+Math.imul(T,ot)|0,o=o+Math.imul(T,At)|0,a=a+Math.imul(N,ct)|0,n=(n=n+Math.imul(N,dt)|0)+Math.imul(D,ct)|0,o=o+Math.imul(D,dt)|0,a=a+Math.imul(w,ht)|0,n=(n=n+Math.imul(w,bt)|0)+Math.imul(_,ht)|0,o=o+Math.imul(_,bt)|0,a=a+Math.imul(x,Bt)|0,n=(n=n+Math.imul(x,mt)|0)+Math.imul(C,Bt)|0,o=o+Math.imul(C,mt)|0,a=a+Math.imul(I,Et)|0,n=(n=n+Math.imul(I,yt)|0)+Math.imul(y,Et)|0,o=o+Math.imul(y,yt)|0,a=a+Math.imul(p,xt)|0,n=(n=n+Math.imul(p,Ct)|0)+Math.imul(B,xt)|0,o=o+Math.imul(B,Ct)|0;var Tt=(u+(a=a+Math.imul(l,wt)|0)|0)+((8191&(n=(n=n+Math.imul(l,Mt)|0)+Math.imul(b,wt)|0))<<13)|0;u=((o=o+Math.imul(b,Mt)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,a=Math.imul(J,et),n=(n=Math.imul(J,tt))+Math.imul(z,et)|0,o=Math.imul(z,tt),a=a+Math.imul(H,at)|0,n=(n=n+Math.imul(H,it)|0)+Math.imul(Y,at)|0,o=o+Math.imul(Y,it)|0,a=a+Math.imul(P,ot)|0,n=(n=n+Math.imul(P,At)|0)+Math.imul(q,ot)|0,o=o+Math.imul(q,At)|0,a=a+Math.imul(G,ct)|0,n=(n=n+Math.imul(G,dt)|0)+Math.imul(T,ct)|0,o=o+Math.imul(T,dt)|0,a=a+Math.imul(N,ht)|0,n=(n=n+Math.imul(N,bt)|0)+Math.imul(D,ht)|0,o=o+Math.imul(D,bt)|0,a=a+Math.imul(w,Bt)|0,n=(n=n+Math.imul(w,mt)|0)+Math.imul(_,Bt)|0,o=o+Math.imul(_,mt)|0,a=a+Math.imul(x,Et)|0,n=(n=n+Math.imul(x,yt)|0)+Math.imul(C,Et)|0,o=o+Math.imul(C,yt)|0,a=a+Math.imul(I,xt)|0,n=(n=n+Math.imul(I,Ct)|0)+Math.imul(y,xt)|0,o=o+Math.imul(y,Ct)|0;var Lt=(u+(a=a+Math.imul(p,wt)|0)|0)+((8191&(n=(n=n+Math.imul(p,Mt)|0)+Math.imul(B,wt)|0))<<13)|0;u=((o=o+Math.imul(B,Mt)|0)+(n>>>13)|0)+(Lt>>>26)|0,Lt&=67108863,a=Math.imul(J,at),n=(n=Math.imul(J,it))+Math.imul(z,at)|0,o=Math.imul(z,it),a=a+Math.imul(H,ot)|0,n=(n=n+Math.imul(H,At)|0)+Math.imul(Y,ot)|0,o=o+Math.imul(Y,At)|0,a=a+Math.imul(P,ct)|0,n=(n=n+Math.imul(P,dt)|0)+Math.imul(q,ct)|0,o=o+Math.imul(q,dt)|0,a=a+Math.imul(G,ht)|0,n=(n=n+Math.imul(G,bt)|0)+Math.imul(T,ht)|0,o=o+Math.imul(T,bt)|0,a=a+Math.imul(N,Bt)|0,n=(n=n+Math.imul(N,mt)|0)+Math.imul(D,Bt)|0,o=o+Math.imul(D,mt)|0,a=a+Math.imul(w,Et)|0,n=(n=n+Math.imul(w,yt)|0)+Math.imul(_,Et)|0,o=o+Math.imul(_,yt)|0,a=a+Math.imul(x,xt)|0,n=(n=n+Math.imul(x,Ct)|0)+Math.imul(C,xt)|0,o=o+Math.imul(C,Ct)|0;var Pt=(u+(a=a+Math.imul(I,wt)|0)|0)+((8191&(n=(n=n+Math.imul(I,Mt)|0)+Math.imul(y,wt)|0))<<13)|0;u=((o=o+Math.imul(y,Mt)|0)+(n>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,a=Math.imul(J,ot),n=(n=Math.imul(J,At))+Math.imul(z,ot)|0,o=Math.imul(z,At),a=a+Math.imul(H,ct)|0,n=(n=n+Math.imul(H,dt)|0)+Math.imul(Y,ct)|0,o=o+Math.imul(Y,dt)|0,a=a+Math.imul(P,ht)|0,n=(n=n+Math.imul(P,bt)|0)+Math.imul(q,ht)|0,o=o+Math.imul(q,bt)|0,a=a+Math.imul(G,Bt)|0,n=(n=n+Math.imul(G,mt)|0)+Math.imul(T,Bt)|0,o=o+Math.imul(T,mt)|0,a=a+Math.imul(N,Et)|0,n=(n=n+Math.imul(N,yt)|0)+Math.imul(D,Et)|0,o=o+Math.imul(D,yt)|0,a=a+Math.imul(w,xt)|0,n=(n=n+Math.imul(w,Ct)|0)+Math.imul(_,xt)|0,o=o+Math.imul(_,Ct)|0;var qt=(u+(a=a+Math.imul(x,wt)|0)|0)+((8191&(n=(n=n+Math.imul(x,Mt)|0)+Math.imul(C,wt)|0))<<13)|0;u=((o=o+Math.imul(C,Mt)|0)+(n>>>13)|0)+(qt>>>26)|0,qt&=67108863,a=Math.imul(J,ct),n=(n=Math.imul(J,dt))+Math.imul(z,ct)|0,o=Math.imul(z,dt),a=a+Math.imul(H,ht)|0,n=(n=n+Math.imul(H,bt)|0)+Math.imul(Y,ht)|0,o=o+Math.imul(Y,bt)|0,a=a+Math.imul(P,Bt)|0,n=(n=n+Math.imul(P,mt)|0)+Math.imul(q,Bt)|0,o=o+Math.imul(q,mt)|0,a=a+Math.imul(G,Et)|0,n=(n=n+Math.imul(G,yt)|0)+Math.imul(T,Et)|0,o=o+Math.imul(T,yt)|0,a=a+Math.imul(N,xt)|0,n=(n=n+Math.imul(N,Ct)|0)+Math.imul(D,xt)|0,o=o+Math.imul(D,Ct)|0;var Ot=(u+(a=a+Math.imul(w,wt)|0)|0)+((8191&(n=(n=n+Math.imul(w,Mt)|0)+Math.imul(_,wt)|0))<<13)|0;u=((o=o+Math.imul(_,Mt)|0)+(n>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,a=Math.imul(J,ht),n=(n=Math.imul(J,bt))+Math.imul(z,ht)|0,o=Math.imul(z,bt),a=a+Math.imul(H,Bt)|0,n=(n=n+Math.imul(H,mt)|0)+Math.imul(Y,Bt)|0,o=o+Math.imul(Y,mt)|0,a=a+Math.imul(P,Et)|0,n=(n=n+Math.imul(P,yt)|0)+Math.imul(q,Et)|0,o=o+Math.imul(q,yt)|0,a=a+Math.imul(G,xt)|0,n=(n=n+Math.imul(G,Ct)|0)+Math.imul(T,xt)|0,o=o+Math.imul(T,Ct)|0;var Ht=(u+(a=a+Math.imul(N,wt)|0)|0)+((8191&(n=(n=n+Math.imul(N,Mt)|0)+Math.imul(D,wt)|0))<<13)|0;u=((o=o+Math.imul(D,Mt)|0)+(n>>>13)|0)+(Ht>>>26)|0,Ht&=67108863,a=Math.imul(J,Bt),n=(n=Math.imul(J,mt))+Math.imul(z,Bt)|0,o=Math.imul(z,mt),a=a+Math.imul(H,Et)|0,n=(n=n+Math.imul(H,yt)|0)+Math.imul(Y,Et)|0,o=o+Math.imul(Y,yt)|0,a=a+Math.imul(P,xt)|0,n=(n=n+Math.imul(P,Ct)|0)+Math.imul(q,xt)|0,o=o+Math.imul(q,Ct)|0;var Yt=(u+(a=a+Math.imul(G,wt)|0)|0)+((8191&(n=(n=n+Math.imul(G,Mt)|0)+Math.imul(T,wt)|0))<<13)|0;u=((o=o+Math.imul(T,Mt)|0)+(n>>>13)|0)+(Yt>>>26)|0,Yt&=67108863,a=Math.imul(J,Et),n=(n=Math.imul(J,yt))+Math.imul(z,Et)|0,o=Math.imul(z,yt),a=a+Math.imul(H,xt)|0,n=(n=n+Math.imul(H,Ct)|0)+Math.imul(Y,xt)|0,o=o+Math.imul(Y,Ct)|0;var jt=(u+(a=a+Math.imul(P,wt)|0)|0)+((8191&(n=(n=n+Math.imul(P,Mt)|0)+Math.imul(q,wt)|0))<<13)|0;u=((o=o+Math.imul(q,Mt)|0)+(n>>>13)|0)+(jt>>>26)|0,jt&=67108863,a=Math.imul(J,xt),n=(n=Math.imul(J,Ct))+Math.imul(z,xt)|0,o=Math.imul(z,Ct);var Jt=(u+(a=a+Math.imul(H,wt)|0)|0)+((8191&(n=(n=n+Math.imul(H,Mt)|0)+Math.imul(Y,wt)|0))<<13)|0;u=((o=o+Math.imul(Y,Mt)|0)+(n>>>13)|0)+(Jt>>>26)|0,Jt&=67108863;var Kt=(u+(a=Math.imul(J,wt))|0)+((8191&(n=(n=Math.imul(J,Mt))+Math.imul(z,wt)|0))<<13)|0;return u=((o=Math.imul(z,Mt))+(n>>>13)|0)+(Kt>>>26)|0,Kt&=67108863,d[0]=_t,d[1]=kt,d[2]=St,d[3]=Nt,d[4]=Dt,d[5]=Rt,d[6]=Ft,d[7]=Ut,d[8]=Gt,d[9]=Tt,d[10]=Lt,d[11]=Pt,d[12]=qt,d[13]=Ot,d[14]=Ht,d[15]=Yt,d[16]=jt,d[17]=Jt,d[18]=Kt,0!==u&&(d[19]=u,r.length++),r};function jumboMulTo(e,t,r){return(new FFTM).mulp(e,t,r)}function FFTM(e,t){this.x=e,this.y=t}Math.imul||(c=smallMulTo),BN.prototype.mulTo=function mulTo(e,t){var r=this.length+e.length;return 10===this.length&&10===e.length?c(this,e,t):r<63?smallMulTo(this,e,t):r<1024?function bigMulTo(e,t,r){r.negative=t.negative^e.negative,r.length=e.length+t.length;for(var a=0,n=0,o=0;o>>26)|0)>>>26,s&=67108863}r.words[o]=c,a=s,s=n}return 0!==a?r.words[o]=a:r.length--,r.strip()}(this,e,t):jumboMulTo(this,e,t)},FFTM.prototype.makeRBT=function makeRBT(e){for(var t=new Array(e),r=BN.prototype._countBits(e)-1,a=0;a>=1;return a},FFTM.prototype.permute=function permute(e,t,r,a,n,o){for(var s=0;s>>=1)n++;return 1<>>=13,r[2*o+1]=8191&n,n>>>=13;for(o=2*t;o>=26,t+=a/67108864|0,t+=n>>>26,this.words[r]=67108863&n}return 0!==t&&(this.words[r]=t,this.length++),this},BN.prototype.muln=function muln(e){return this.clone().imuln(e)},BN.prototype.sqr=function sqr(){return this.mul(this)},BN.prototype.isqr=function isqr(){return this.imul(this.clone())},BN.prototype.pow=function pow(e){var t=function toBitArray(e){for(var t=new Array(e.bitLength()),r=0;r>>n}return t}(e);if(0===t.length)return new BN(1);for(var r=this,a=0;a=0);var t,r=e%26,a=(e-r)/26,n=67108863>>>26-r<<26-r;if(0!==r){var o=0;for(t=0;t>>26-r}o&&(this.words[t]=o,this.length++)}if(0!==a){for(t=this.length-1;t>=0;t--)this.words[t+a]=this.words[t];for(t=0;t=0),a=t?(t-t%26)/26:0;var n=e%26,o=Math.min((e-n)/26,this.length),s=67108863^67108863>>>n<o)for(this.length-=o,d=0;d=0&&(0!==u||d>=a);d--){var h=0|this.words[d];this.words[d]=u<<26-n|h>>>n,u=h&s}return c&&0!==u&&(c.words[c.length++]=u),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},BN.prototype.ishrn=function ishrn(e,t,r){return assert(0===this.negative),this.iushrn(e,t,r)},BN.prototype.shln=function shln(e){return this.clone().ishln(e)},BN.prototype.ushln=function ushln(e){return this.clone().iushln(e)},BN.prototype.shrn=function shrn(e){return this.clone().ishrn(e)},BN.prototype.ushrn=function ushrn(e){return this.clone().iushrn(e)},BN.prototype.testn=function testn(e){assert("number"==typeof e&&e>=0);var t=e%26,r=(e-t)/26,a=1<=0);var t=e%26,r=(e-t)/26;if(assert(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==t&&r++,this.length=Math.min(r,this.length),0!==t){var a=67108863^67108863>>>t<=67108864;t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},BN.prototype.isubn=function isubn(e){if(assert("number"==typeof e),assert(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t>26)-(c/67108864|0),this.words[a+r]=67108863&n}for(;a>26,this.words[a+r]=67108863&n;if(0===s)return this.strip();for(assert(-1===s),s=0,a=0;a>26,this.words[a]=67108863&n;return this.negative=1,this.strip()},BN.prototype._wordDiv=function _wordDiv(e,t){var r=(this.length,e.length),a=this.clone(),n=e,o=0|n.words[n.length-1];0!==(r=26-this._countBits(o))&&(n=n.ushln(r),a.iushln(r),o=0|n.words[n.length-1]);var s,c=a.length-n.length;if("mod"!==t){(s=new BN(null)).length=c+1,s.words=new Array(s.length);for(var d=0;d=0;h--){var l=67108864*(0|a.words[n.length+h])+(0|a.words[n.length+h-1]);for(l=Math.min(l/o|0,67108863),a._ishlnsubmul(n,l,h);0!==a.negative;)l--,a.negative=0,a._ishlnsubmul(n,1,h),a.isZero()||(a.negative^=1);s&&(s.words[h]=l)}return s&&s.strip(),a.strip(),"div"!==t&&0!==r&&a.iushrn(r),{div:s||null,mod:a}},BN.prototype.divmod=function divmod(e,t,r){return assert(!e.isZero()),this.isZero()?{div:new BN(0),mod:new BN(0)}:0!==this.negative&&0===e.negative?(o=this.neg().divmod(e,t),"mod"!==t&&(a=o.div.neg()),"div"!==t&&(n=o.mod.neg(),r&&0!==n.negative&&n.iadd(e)),{div:a,mod:n}):0===this.negative&&0!==e.negative?(o=this.divmod(e.neg(),t),"mod"!==t&&(a=o.div.neg()),{div:a,mod:o.mod}):0!=(this.negative&e.negative)?(o=this.neg().divmod(e.neg(),t),"div"!==t&&(n=o.mod.neg(),r&&0!==n.negative&&n.isub(e)),{div:o.div,mod:n}):e.length>this.length||this.cmp(e)<0?{div:new BN(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new BN(this.modn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new BN(this.modn(e.words[0]))}:this._wordDiv(e,t);var a,n,o},BN.prototype.div=function div(e){return this.divmod(e,"div",!1).div},BN.prototype.mod=function mod(e){return this.divmod(e,"mod",!1).mod},BN.prototype.umod=function umod(e){return this.divmod(e,"mod",!0).mod},BN.prototype.divRound=function divRound(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var r=0!==t.div.negative?t.mod.isub(e):t.mod,a=e.ushrn(1),n=e.andln(1),o=r.cmp(a);return o<0||1===n&&0===o?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},BN.prototype.modn=function modn(e){assert(e<=67108863);for(var t=(1<<26)%e,r=0,a=this.length-1;a>=0;a--)r=(t*r+(0|this.words[a]))%e;return r},BN.prototype.idivn=function idivn(e){assert(e<=67108863);for(var t=0,r=this.length-1;r>=0;r--){var a=(0|this.words[r])+67108864*t;this.words[r]=a/e|0,t=a%e}return this.strip()},BN.prototype.divn=function divn(e){return this.clone().idivn(e)},BN.prototype.egcd=function egcd(e){assert(0===e.negative),assert(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var a=new BN(1),n=new BN(0),o=new BN(0),s=new BN(1),c=0;t.isEven()&&r.isEven();)t.iushrn(1),r.iushrn(1),++c;for(var d=r.clone(),u=t.clone();!t.isZero();){for(var h=0,l=1;0==(t.words[0]&l)&&h<26;++h,l<<=1);if(h>0)for(t.iushrn(h);h-- >0;)(a.isOdd()||n.isOdd())&&(a.iadd(d),n.isub(u)),a.iushrn(1),n.iushrn(1);for(var b=0,g=1;0==(r.words[0]&g)&&b<26;++b,g<<=1);if(b>0)for(r.iushrn(b);b-- >0;)(o.isOdd()||s.isOdd())&&(o.iadd(d),s.isub(u)),o.iushrn(1),s.iushrn(1);t.cmp(r)>=0?(t.isub(r),a.isub(o),n.isub(s)):(r.isub(t),o.isub(a),s.isub(n))}return{a:o,b:s,gcd:r.iushln(c)}},BN.prototype._invmp=function _invmp(e){assert(0===e.negative),assert(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var a,n=new BN(1),o=new BN(0),s=r.clone();t.cmpn(1)>0&&r.cmpn(1)>0;){for(var c=0,d=1;0==(t.words[0]&d)&&c<26;++c,d<<=1);if(c>0)for(t.iushrn(c);c-- >0;)n.isOdd()&&n.iadd(s),n.iushrn(1);for(var u=0,h=1;0==(r.words[0]&h)&&u<26;++u,h<<=1);if(u>0)for(r.iushrn(u);u-- >0;)o.isOdd()&&o.iadd(s),o.iushrn(1);t.cmp(r)>=0?(t.isub(r),n.isub(o)):(r.isub(t),o.isub(n))}return(a=0===t.cmpn(1)?n:o).cmpn(0)<0&&a.iadd(e),a},BN.prototype.gcd=function gcd(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),r=e.clone();t.negative=0,r.negative=0;for(var a=0;t.isEven()&&r.isEven();a++)t.iushrn(1),r.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=t.cmp(r);if(n<0){var o=t;t=r,r=o}else if(0===n||0===r.cmpn(1))break;t.isub(r)}return r.iushln(a)},BN.prototype.invm=function invm(e){return this.egcd(e).a.umod(e)},BN.prototype.isEven=function isEven(){return 0==(1&this.words[0])},BN.prototype.isOdd=function isOdd(){return 1==(1&this.words[0])},BN.prototype.andln=function andln(e){return this.words[0]&e},BN.prototype.bincn=function bincn(e){assert("number"==typeof e);var t=e%26,r=(e-t)/26,a=1<>>26,s&=67108863,this.words[o]=s}return 0!==n&&(this.words[o]=n,this.length++),this},BN.prototype.isZero=function isZero(){return 1===this.length&&0===this.words[0]},BN.prototype.cmpn=function cmpn(e){var t,r=e<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this.strip(),this.length>1)t=1;else{r&&(e=-e),assert(e<=67108863,"Number is too big");var a=0|this.words[0];t=a===e?0:ae.length)return 1;if(this.length=0;r--){var a=0|this.words[r],n=0|e.words[r];if(a!==n){an&&(t=1);break}}return t},BN.prototype.gtn=function gtn(e){return 1===this.cmpn(e)},BN.prototype.gt=function gt(e){return 1===this.cmp(e)},BN.prototype.gten=function gten(e){return this.cmpn(e)>=0},BN.prototype.gte=function gte(e){return this.cmp(e)>=0},BN.prototype.ltn=function ltn(e){return-1===this.cmpn(e)},BN.prototype.lt=function lt(e){return-1===this.cmp(e)},BN.prototype.lten=function lten(e){return this.cmpn(e)<=0},BN.prototype.lte=function lte(e){return this.cmp(e)<=0},BN.prototype.eqn=function eqn(e){return 0===this.cmpn(e)},BN.prototype.eq=function eq(e){return 0===this.cmp(e)},BN.red=function red(e){return new Red(e)},BN.prototype.toRed=function toRed(e){return assert(!this.red,"Already a number in reduction context"),assert(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},BN.prototype.fromRed=function fromRed(){return assert(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},BN.prototype._forceRed=function _forceRed(e){return this.red=e,this},BN.prototype.forceRed=function forceRed(e){return assert(!this.red,"Already a number in reduction context"),this._forceRed(e)},BN.prototype.redAdd=function redAdd(e){return assert(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},BN.prototype.redIAdd=function redIAdd(e){return assert(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},BN.prototype.redSub=function redSub(e){return assert(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},BN.prototype.redISub=function redISub(e){return assert(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},BN.prototype.redShl=function redShl(e){return assert(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},BN.prototype.redMul=function redMul(e){return assert(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},BN.prototype.redIMul=function redIMul(e){return assert(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},BN.prototype.redSqr=function redSqr(){return assert(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},BN.prototype.redISqr=function redISqr(){return assert(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},BN.prototype.redSqrt=function redSqrt(){return assert(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},BN.prototype.redInvm=function redInvm(){return assert(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},BN.prototype.redNeg=function redNeg(){return assert(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},BN.prototype.redPow=function redPow(e){return assert(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var d={k256:null,p224:null,p192:null,p25519:null};function MPrime(e,t){this.name=e,this.p=new BN(t,16),this.n=this.p.bitLength(),this.k=new BN(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function K256(){MPrime.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function P224(){MPrime.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function P192(){MPrime.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function P25519(){MPrime.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function Red(e){if("string"==typeof e){var t=BN._prime(e);this.m=t.p,this.prime=t}else assert(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function Mont(e){Red.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new BN(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)}MPrime.prototype._tmp=function _tmp(){var e=new BN(null);return e.words=new Array(Math.ceil(this.n/13)),e},MPrime.prototype.ireduce=function ireduce(e){var t,r=e;do{this.split(r,this.tmp),t=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(t>this.n);var a=t0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},MPrime.prototype.split=function split(e,t){e.iushrn(this.n,0,t)},MPrime.prototype.imulK=function imulK(e){return e.imul(this.k)},inherits(K256,MPrime),K256.prototype.split=function split(e,t){for(var r=4194303,a=Math.min(e.length,9),n=0;n>>22,o=s}o>>>=22,e.words[n-10]=o,0===o&&e.length>10?e.length-=10:e.length-=9},K256.prototype.imulK=function imulK(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,r=0;r>>=26,e.words[r]=n,t=a}return 0!==t&&(e.words[e.length++]=t),e},BN._prime=function prime(e){if(d[e])return d[e];var prime;if("k256"===e)prime=new K256;else if("p224"===e)prime=new P224;else if("p192"===e)prime=new P192;else{if("p25519"!==e)throw new Error("Unknown prime "+e);prime=new P25519}return d[e]=prime,prime},Red.prototype._verify1=function _verify1(e){assert(0===e.negative,"red works only with positives"),assert(e.red,"red works only with red numbers")},Red.prototype._verify2=function _verify2(e,t){assert(0==(e.negative|t.negative),"red works only with positives"),assert(e.red&&e.red===t.red,"red works only with red numbers")},Red.prototype.imod=function imod(e){return this.prime?this.prime.ireduce(e)._forceRed(this):e.umod(this.m)._forceRed(this)},Red.prototype.neg=function neg(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},Red.prototype.add=function add(e,t){this._verify2(e,t);var r=e.add(t);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},Red.prototype.iadd=function iadd(e,t){this._verify2(e,t);var r=e.iadd(t);return r.cmp(this.m)>=0&&r.isub(this.m),r},Red.prototype.sub=function sub(e,t){this._verify2(e,t);var r=e.sub(t);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},Red.prototype.isub=function isub(e,t){this._verify2(e,t);var r=e.isub(t);return r.cmpn(0)<0&&r.iadd(this.m),r},Red.prototype.shl=function shl(e,t){return this._verify1(e),this.imod(e.ushln(t))},Red.prototype.imul=function imul(e,t){return this._verify2(e,t),this.imod(e.imul(t))},Red.prototype.mul=function mul(e,t){return this._verify2(e,t),this.imod(e.mul(t))},Red.prototype.isqr=function isqr(e){return this.imul(e,e.clone())},Red.prototype.sqr=function sqr(e){return this.mul(e,e)},Red.prototype.sqrt=function sqrt(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(assert(t%2==1),3===t){var r=this.m.add(new BN(1)).iushrn(2);return this.pow(e,r)}for(var a=this.m.subn(1),n=0;!a.isZero()&&0===a.andln(1);)n++,a.iushrn(1);assert(!a.isZero());var o=new BN(1).toRed(this),s=o.redNeg(),c=this.m.subn(1).iushrn(1),d=this.m.bitLength();for(d=new BN(2*d*d).toRed(this);0!==this.pow(d,c).cmp(s);)d.redIAdd(s);for(var u=this.pow(d,a),h=this.pow(e,a.addn(1).iushrn(1)),l=this.pow(e,a),b=n;0!==l.cmp(o);){for(var g=l,p=0;0!==g.cmp(o);p++)g=g.redSqr();assert(p=0;a--){for(var d=t.words[a],u=c-1;u>=0;u--){var h=d>>u&1;n!==r[0]&&(n=this.sqr(n)),0!==h||0!==o?(o<<=1,o|=h,(4===++s||0===a&&0===u)&&(n=this.mul(n,r[o]),s=0,o=0)):s=0}c=26}return n},Red.prototype.convertTo=function convertTo(e){var t=e.umod(this.m);return t===e?t.clone():t},Red.prototype.convertFrom=function convertFrom(e){var t=e.clone();return t.red=null,t},BN.mont=function mont(e){return new Mont(e)},inherits(Mont,Red),Mont.prototype.convertTo=function convertTo(e){return this.imod(e.ushln(this.shift))},Mont.prototype.convertFrom=function convertFrom(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},Mont.prototype.imul=function imul(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var r=e.imul(t),a=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(a).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},Mont.prototype.mul=function mul(e,t){if(e.isZero()||t.isZero())return new BN(0)._forceRed(this);var r=e.mul(t),a=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(a).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},Mont.prototype.invm=function invm(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(e=r.nmd(e),this)},e=>{"use strict";e.exports=function hasSymbols(){if("function"!=typeof Symbol||"function"!=typeof Object.getOwnPropertySymbols)return!1;if("symbol"==typeof Symbol.iterator)return!0;var e={},t=Symbol("test"),r=Object(t);if("string"==typeof t)return!1;if("[object Symbol]"!==Object.prototype.toString.call(t))return!1;if("[object Symbol]"!==Object.prototype.toString.call(r))return!1;for(t in e[t]=42,e)return!1;if("function"==typeof Object.keys&&0!==Object.keys(e).length)return!1;if("function"==typeof Object.getOwnPropertyNames&&0!==Object.getOwnPropertyNames(e).length)return!1;var a=Object.getOwnPropertySymbols(e);if(1!==a.length||a[0]!==t)return!1;if(!Object.prototype.propertyIsEnumerable.call(e,t))return!1;if("function"==typeof Object.getOwnPropertyDescriptor){var n=Object.getOwnPropertyDescriptor(e,t);if(42!==n.value||!0!==n.enumerable)return!1}return!0}},(e,t,r)=>{"use strict";var a="undefined"!=typeof Symbol&&Symbol,n=r(478);e.exports=function hasNativeSymbols(){return"function"==typeof a&&("function"==typeof Symbol&&("symbol"==typeof a("foo")&&("symbol"==typeof Symbol("bar")&&n())))}},(e,t,r)=>{"use strict";var a=r(271)("%Object.getOwnPropertyDescriptor%");if(a)try{a([],"length")}catch(e){a=null}e.exports=a},(e,t,r)=>{"use strict";var a=r(273),n=r(272),o=r(483),s=r(484),c=r(822),d=n(s(),Object);a(d,{getPolyfill:s,implementation:o,shim:c}),e.exports=d},e=>{"use strict";var t=Object.prototype.toString;e.exports=function isArguments(e){var r=t.call(e),a="[object Arguments]"===r;return a||(a="[object Array]"!==r&&null!==e&&"object"==typeof e&&"number"==typeof e.length&&e.length>=0&&"[object Function]"===t.call(e.callee)),a}},e=>{"use strict";var numberIsNaN=function(e){return e!=e};e.exports=function is(e,t){return 0===e&&0===t?1/e==1/t:e===t||!(!numberIsNaN(e)||!numberIsNaN(t))}},(e,t,r)=>{"use strict";var a=r(483);e.exports=function getPolyfill(){return"function"==typeof Object.is?Object.is:a}},e=>{"use strict";e.exports=function isNaN(e){return e!=e}},(e,t,r)=>{"use strict";var a=r(485);e.exports=function getPolyfill(){return Number.isNaN&&Number.isNaN(NaN)&&!Number.isNaN("a")?Number.isNaN:a}},(e,t,r)=>{"use strict";var a=r(21),n=r(832),o=r(840),s=r(841),c=r(846);function Hash(e){c.call(this,"digest"),this._hash=e}a(Hash,c),Hash.prototype._update=function(e){this._hash.update(e)},Hash.prototype._final=function(){return this._hash.digest()},e.exports=function createHash(e){return"md5"===(e=e.toLowerCase())?new n:"rmd160"===e||"ripemd160"===e?new o:new Hash(s(e))}},(e,t,r)=>{"use strict";var a=r(56).Buffer,n=r(339).Transform;function HashBase(e){n.call(this),this._block=a.allocUnsafe(e),this._blockSize=e,this._blockOffset=0,this._length=[0,0,0,0],this._finalized=!1}r(21)(HashBase,n),HashBase.prototype._transform=function(e,t,r){var a=null;try{this.update(e,t)}catch(e){a=e}r(a)},HashBase.prototype._flush=function(e){var t=null;try{this.push(this.digest())}catch(e){t=e}e(t)},HashBase.prototype.update=function(e,t){if(function throwIfNotStringOrBuffer(e,t){if(!a.isBuffer(e)&&"string"!=typeof e)throw new TypeError(t+" must be a string or a buffer")}(e,"Data"),this._finalized)throw new Error("Digest already called");a.isBuffer(e)||(e=a.from(e,t));for(var r=this._block,n=0;this._blockOffset+e.length-n>=this._blockSize;){for(var o=this._blockOffset;o0;++s)this._length[s]+=c,(c=this._length[s]/4294967296|0)>0&&(this._length[s]-=4294967296*c);return this},HashBase.prototype._update=function(){throw new Error("_update is not implemented")},HashBase.prototype.digest=function(e){if(this._finalized)throw new Error("Digest already called");this._finalized=!0;var t=this._digest();void 0!==e&&(t=t.toString(e)),this._block.fill(0),this._blockOffset=0;for(var r=0;r<4;++r)this._length[r]=0;return t},HashBase.prototype._digest=function(){throw new Error("_digest is not implemented")},e.exports=HashBase},(e,t,r)=>{"use strict";var a,n=r(1);e.exports=Readable,Readable.ReadableState=ReadableState;r(32).EventEmitter;var o=function EElistenerCount(e,t){return e.listeners(t).length},s=r(833),c=r(3).Buffer,d=r.g.Uint8Array||function(){};var u,h=r(85);u=h&&h.debuglog?h.debuglog("stream"):function debug(){};var l,b,g,p=r(834),B=r(490),m=r(491).getHighWaterMark,I=r(235).a,y=I.ERR_INVALID_ARG_TYPE,v=I.ERR_STREAM_PUSH_AFTER_EOF,x=I.ERR_METHOD_NOT_IMPLEMENTED,C=I.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;r(21)(Readable,s);var Q=B.errorOrDestroy,w=["error","close","destroy","pause","resume"];function ReadableState(e,t,n){a=a||r(182),e=e||{},"boolean"!=typeof n&&(n=t instanceof a),this.objectMode=!!e.objectMode,n&&(this.objectMode=this.objectMode||!!e.readableObjectMode),this.highWaterMark=m(this,e,"readableHighWaterMark",n),this.buffer=new p,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&&(l||(l=r(493).a),this.decoder=new l(e.encoding),this.encoding=e.encoding)}function Readable(e){if(a=a||r(182),!(this instanceof Readable))return new Readable(e);var t=this instanceof a;this._readableState=new ReadableState(e,this,t),this.readable=!0,e&&("function"==typeof e.read&&(this._read=e.read),"function"==typeof e.destroy&&(this._destroy=e.destroy)),s.call(this)}function readableAddChunk(e,t,r,a,n){u("readableAddChunk",t);var o,s=e._readableState;if(null===t)s.reading=!1,function onEofChunk(e,t){if(u("onEofChunk"),t.ended)return;if(t.decoder){var r=t.decoder.end();r&&r.length&&(t.buffer.push(r),t.length+=t.objectMode?1:r.length)}t.ended=!0,t.sync?emitReadable(e):(t.needReadable=!1,t.emittedReadable||(t.emittedReadable=!0,emitReadable_(e)))}(e,s);else if(n||(o=function chunkInvalid(e,t){var r;(function _isUint8Array(e){return c.isBuffer(e)||e instanceof d})(t)||"string"==typeof t||void 0===t||e.objectMode||(r=new y("chunk",["string","Buffer","Uint8Array"],t));return r}(s,t)),o)Q(e,o);else if(s.objectMode||t&&t.length>0)if("string"==typeof t||s.objectMode||Object.getPrototypeOf(t)===c.prototype||(t=function _uint8ArrayToBuffer(e){return c.from(e)}(t)),a)s.endEmitted?Q(e,new C):addChunk(e,s,t,!0);else if(s.ended)Q(e,new v);else{if(s.destroyed)return!1;s.reading=!1,s.decoder&&!r?(t=s.decoder.write(t),s.objectMode||0!==t.length?addChunk(e,s,t,!1):maybeReadMore(e,s)):addChunk(e,s,t,!1)}else a||(s.reading=!1,maybeReadMore(e,s));return!s.ended&&(s.lengtht.highWaterMark&&(t.highWaterMark=function computeNewHighWaterMark(e){return e>=_?e=_:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function emitReadable(e){var t=e._readableState;u("emitReadable",t.needReadable,t.emittedReadable),t.needReadable=!1,t.emittedReadable||(u("emitReadable",t.flowing),t.emittedReadable=!0,n.nextTick(emitReadable_,e))}function emitReadable_(e){var t=e._readableState;u("emitReadable_",t.destroyed,t.length,t.ended),t.destroyed||!t.length&&!t.ended||(e.emit("readable"),t.emittedReadable=!1),t.needReadable=!t.flowing&&!t.ended&&t.length<=t.highWaterMark,flow(e)}function maybeReadMore(e,t){t.readingMore||(t.readingMore=!0,n.nextTick(maybeReadMore_,e,t))}function maybeReadMore_(e,t){for(;!t.reading&&!t.ended&&(t.length0,t.resumeScheduled&&!t.paused?t.flowing=!0:e.listenerCount("data")>0&&e.resume()}function nReadingNextTick(e){u("readable nexttick read 0"),e.read(0)}function resume_(e,t){u("resume",t.reading),t.reading||e.read(0),t.resumeScheduled=!1,e.emit("resume"),flow(e),t.flowing&&!t.reading&&e.read(0)}function flow(e){var t=e._readableState;for(u("flow",t.flowing);t.flowing&&null!==e.read(););}function fromList(e,t){return 0===t.length?null:(t.objectMode?r=t.buffer.shift():!e||e>=t.length?(r=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.first():t.buffer.concat(t.length),t.buffer.clear()):r=t.buffer.consume(e,t.decoder),r);var r}function endReadable(e){var t=e._readableState;u("endReadable",t.endEmitted),t.endEmitted||(t.ended=!0,n.nextTick(endReadableNT,t,e))}function endReadableNT(e,t){if(u("endReadableNT",e.endEmitted,e.length),!e.endEmitted&&0===e.length&&(e.endEmitted=!0,t.readable=!1,t.emit("end"),e.autoDestroy)){var r=t._writableState;(!r||r.autoDestroy&&r.finished)&&t.destroy()}}function indexOf(e,t){for(var r=0,a=e.length;r=t.highWaterMark:t.length>0)||t.ended))return u("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?endReadable(this):emitReadable(this),null;if(0===(e=howMuchToRead(e,t))&&t.ended)return 0===t.length&&endReadable(this),null;var a,n=t.needReadable;return u("need readable",n),(0===t.length||t.length-e0?fromList(e,t):null)?(t.needReadable=t.length<=t.highWaterMark,e=0):(t.length-=e,t.awaitDrain=0),0===t.length&&(t.ended||(t.needReadable=!0),r!==e&&t.ended&&endReadable(this)),null!==a&&this.emit("data",a),a},Readable.prototype._read=function(e){Q(this,new x("_read()"))},Readable.prototype.pipe=function(e,t){var r=this,a=this._readableState;switch(a.pipesCount){case 0:a.pipes=e;break;case 1:a.pipes=[a.pipes,e];break;default:a.pipes.push(e)}a.pipesCount+=1,u("pipe count=%d opts=%j",a.pipesCount,t);var s=(!t||!1!==t.end)&&e!==n.stdout&&e!==n.stderr?onend:unpipe;function onunpipe(t,n){u("onunpipe"),t===r&&n&&!1===n.hasUnpiped&&(n.hasUnpiped=!0,function cleanup(){u("cleanup"),e.removeListener("close",onclose),e.removeListener("finish",onfinish),e.removeListener("drain",c),e.removeListener("error",onerror),e.removeListener("unpipe",onunpipe),r.removeListener("end",onend),r.removeListener("end",unpipe),r.removeListener("data",ondata),d=!0,!a.awaitDrain||e._writableState&&!e._writableState.needDrain||c()}())}function onend(){u("onend"),e.end()}a.endEmitted?n.nextTick(s):r.once("end",s),e.on("unpipe",onunpipe);var c=function pipeOnDrain(e){return function pipeOnDrainFunctionResult(){var t=e._readableState;u("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&o(e,"data")&&(t.flowing=!0,flow(e))}}(r);e.on("drain",c);var d=!1;function ondata(t){u("ondata");var n=e.write(t);u("dest.write",n),!1===n&&((1===a.pipesCount&&a.pipes===e||a.pipesCount>1&&-1!==indexOf(a.pipes,e))&&!d&&(u("false write response, pause",a.awaitDrain),a.awaitDrain++),r.pause())}function onerror(t){u("onerror",t),unpipe(),e.removeListener("error",onerror),0===o(e,"error")&&Q(e,t)}function onclose(){e.removeListener("finish",onfinish),unpipe()}function onfinish(){u("onfinish"),e.removeListener("close",onclose),unpipe()}function unpipe(){u("unpipe"),r.unpipe(e)}return r.on("data",ondata),function prependListener(e,t,r){if("function"==typeof e.prependListener)return e.prependListener(t,r);e._events&&e._events[t]?Array.isArray(e._events[t])?e._events[t].unshift(r):e._events[t]=[r,e._events[t]]:e.on(t,r)}(e,"error",onerror),e.once("close",onclose),e.once("finish",onfinish),e.emit("pipe",r),a.flowing||(u("pipe resume"),r.resume()),e},Readable.prototype.unpipe=function(e){var t=this._readableState,r={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes||(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,r)),this;if(!e){var a=t.pipes,n=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var o=0;o0,!1!==a.flowing&&this.resume()):"readable"===e&&(a.endEmitted||a.readableListening||(a.readableListening=a.needReadable=!0,a.flowing=!1,a.emittedReadable=!1,u("on readable",a.length,a.reading),a.length?emitReadable(this):a.reading||n.nextTick(nReadingNextTick,this))),r},Readable.prototype.addListener=Readable.prototype.on,Readable.prototype.removeListener=function(e,t){var r=s.prototype.removeListener.call(this,e,t);return"readable"===e&&n.nextTick(updateReadableListening,this),r},Readable.prototype.removeAllListeners=function(e){var t=s.prototype.removeAllListeners.apply(this,arguments);return"readable"!==e&&void 0!==e||n.nextTick(updateReadableListening,this),t},Readable.prototype.resume=function(){var e=this._readableState;return e.flowing||(u("resume"),e.flowing=!e.readableListening,function resume(e,t){t.resumeScheduled||(t.resumeScheduled=!0,n.nextTick(resume_,e,t))}(this,e)),e.paused=!1,this},Readable.prototype.pause=function(){return u("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(u("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},Readable.prototype.wrap=function(e){var t=this,r=this._readableState,a=!1;for(var n in e.on("end",(function(){if(u("wrapped end"),r.decoder&&!r.ended){var e=r.decoder.end();e&&e.length&&t.push(e)}t.push(null)})),e.on("data",(function(n){(u("wrapped data"),r.decoder&&(n=r.decoder.write(n)),r.objectMode&&null==n)||(r.objectMode||n&&n.length)&&(t.push(n)||(a=!0,e.pause()))})),e)void 0===this[n]&&"function"==typeof e[n]&&(this[n]=function methodWrap(t){return function methodWrapReturnFunction(){return e[t].apply(e,arguments)}}(n));for(var o=0;o{"use strict";var a=r(1);function emitErrorAndCloseNT(e,t){emitErrorNT(e,t),emitCloseNT(e)}function emitCloseNT(e){e._writableState&&!e._writableState.emitClose||e._readableState&&!e._readableState.emitClose||e.emit("close")}function emitErrorNT(e,t){e.emit("error",t)}e.exports={destroy:function destroy(e,t){var r=this,n=this._readableState&&this._readableState.destroyed,o=this._writableState&&this._writableState.destroyed;return n||o?(t?t(e):e&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,a.nextTick(emitErrorNT,this,e)):a.nextTick(emitErrorNT,this,e)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,(function(e){!t&&e?r._writableState?r._writableState.errorEmitted?a.nextTick(emitCloseNT,r):(r._writableState.errorEmitted=!0,a.nextTick(emitErrorAndCloseNT,r,e)):a.nextTick(emitErrorAndCloseNT,r,e):t?(a.nextTick(emitCloseNT,r),t(e)):a.nextTick(emitCloseNT,r)})),this)},undestroy:function undestroy(){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 errorOrDestroy(e,t){var r=e._readableState,a=e._writableState;r&&r.autoDestroy||a&&a.autoDestroy?e.destroy(t):e.emit("error",t)}}},(e,t,r)=>{"use strict";var a=r(235).a.ERR_INVALID_OPT_VALUE;e.exports={getHighWaterMark:function getHighWaterMark(e,t,r,n){var o=function highWaterMarkFrom(e,t,r){return null!=e.highWaterMark?e.highWaterMark:t?e[r]:null}(t,n,r);if(null!=o){if(!isFinite(o)||Math.floor(o)!==o||o<0)throw new a(n?r:"highWaterMark",o);return Math.floor(o)}return e.objectMode?16:16384}}},(e,t,r)=>{"use strict";var a,n=r(1);function CorkedRequest(e){var t=this;this.next=null,this.entry=null,this.finish=function(){!function onCorkedFinish(e,t,r){var a=e.entry;e.entry=null;for(;a;){var n=a.callback;t.pendingcb--,n(r),a=a.next}t.corkedRequestsFree.next=e}(t,e)}}e.exports=Writable,Writable.WritableState=WritableState;var o={deprecate:r(835)},s=r(833),c=r(3).Buffer,d=r.g.Uint8Array||function(){};var u,h=r(490),l=r(491).getHighWaterMark,b=r(235).a,g=b.ERR_INVALID_ARG_TYPE,p=b.ERR_METHOD_NOT_IMPLEMENTED,B=b.ERR_MULTIPLE_CALLBACK,m=b.ERR_STREAM_CANNOT_PIPE,I=b.ERR_STREAM_DESTROYED,y=b.ERR_STREAM_NULL_VALUES,v=b.ERR_STREAM_WRITE_AFTER_END,x=b.ERR_UNKNOWN_ENCODING,C=h.errorOrDestroy;function nop(){}function WritableState(e,t,o){a=a||r(182),e=e||{},"boolean"!=typeof o&&(o=t instanceof a),this.objectMode=!!e.objectMode,o&&(this.objectMode=this.objectMode||!!e.writableObjectMode),this.highWaterMark=l(this,e,"writableHighWaterMark",o),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var s=!1===e.decodeStrings;this.decodeStrings=!s,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 onwrite(e,t){var r=e._writableState,a=r.sync,o=r.writecb;if("function"!=typeof o)throw new B;if(function onwriteStateUpdate(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}(r),t)!function onwriteError(e,t,r,a,o){--t.pendingcb,r?(n.nextTick(o,a),n.nextTick(finishMaybe,e,t),e._writableState.errorEmitted=!0,C(e,a)):(o(a),e._writableState.errorEmitted=!0,C(e,a),finishMaybe(e,t))}(e,r,a,t,o);else{var s=needFinish(r)||e.destroyed;s||r.corked||r.bufferProcessing||!r.bufferedRequest||clearBuffer(e,r),a?n.nextTick(afterWrite,e,r,s,o):afterWrite(e,r,s,o)}}(t,e)},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 CorkedRequest(this)}function Writable(e){var t=this instanceof(a=a||r(182));if(!t&&!u.call(Writable,this))return new Writable(e);this._writableState=new WritableState(e,this,t),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),s.call(this)}function doWrite(e,t,r,a,n,o,s){t.writelen=a,t.writecb=s,t.writing=!0,t.sync=!0,t.destroyed?t.onwrite(new I("write")):r?e._writev(n,t.onwrite):e._write(n,o,t.onwrite),t.sync=!1}function afterWrite(e,t,r,a){r||function onwriteDrain(e,t){0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}(e,t),t.pendingcb--,a(),finishMaybe(e,t)}function clearBuffer(e,t){t.bufferProcessing=!0;var r=t.bufferedRequest;if(e._writev&&r&&r.next){var a=t.bufferedRequestCount,n=new Array(a),o=t.corkedRequestsFree;o.entry=r;for(var s=0,c=!0;r;)n[s]=r,r.isBuf||(c=!1),r=r.next,s+=1;n.allBuffers=c,doWrite(e,t,!0,t.length,n,"",o.finish),t.pendingcb++,t.lastBufferedRequest=null,o.next?(t.corkedRequestsFree=o.next,o.next=null):t.corkedRequestsFree=new CorkedRequest(t),t.bufferedRequestCount=0}else{for(;r;){var d=r.chunk,u=r.encoding,h=r.callback;if(doWrite(e,t,!1,t.objectMode?1:d.length,d,u,h),r=r.next,t.bufferedRequestCount--,t.writing)break}null===r&&(t.lastBufferedRequest=null)}t.bufferedRequest=r,t.bufferProcessing=!1}function needFinish(e){return e.ending&&0===e.length&&null===e.bufferedRequest&&!e.finished&&!e.writing}function callFinal(e,t){e._final((function(r){t.pendingcb--,r&&C(e,r),t.prefinished=!0,e.emit("prefinish"),finishMaybe(e,t)}))}function finishMaybe(e,t){var r=needFinish(t);if(r&&(function prefinish(e,t){t.prefinished||t.finalCalled||("function"!=typeof e._final||t.destroyed?(t.prefinished=!0,e.emit("prefinish")):(t.pendingcb++,t.finalCalled=!0,n.nextTick(callFinal,e,t)))}(e,t),0===t.pendingcb&&(t.finished=!0,e.emit("finish"),t.autoDestroy))){var a=e._readableState;(!a||a.autoDestroy&&a.endEmitted)&&e.destroy()}return r}r(21)(Writable,s),WritableState.prototype.getBuffer=function getBuffer(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},function(){try{Object.defineProperty(WritableState.prototype,"buffer",{get:o.deprecate((function writableStateBufferGetter(){return this.getBuffer()}),"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(e){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(u=Function.prototype[Symbol.hasInstance],Object.defineProperty(Writable,Symbol.hasInstance,{value:function value(e){return!!u.call(this,e)||this===Writable&&(e&&e._writableState instanceof WritableState)}})):u=function realHasInstance(e){return e instanceof this},Writable.prototype.pipe=function(){C(this,new m)},Writable.prototype.write=function(e,t,r){var a=this._writableState,o=!1,s=!a.objectMode&&function _isUint8Array(e){return c.isBuffer(e)||e instanceof d}(e);return s&&!c.isBuffer(e)&&(e=function _uint8ArrayToBuffer(e){return c.from(e)}(e)),"function"==typeof t&&(r=t,t=null),s?t="buffer":t||(t=a.defaultEncoding),"function"!=typeof r&&(r=nop),a.ending?function writeAfterEnd(e,t){var r=new v;C(e,r),n.nextTick(t,r)}(this,r):(s||function validChunk(e,t,r,a){var o;return null===r?o=new y:"string"==typeof r||t.objectMode||(o=new g("chunk",["string","Buffer"],r)),!o||(C(e,o),n.nextTick(a,o),!1)}(this,a,e,r))&&(a.pendingcb++,o=function writeOrBuffer(e,t,r,a,n,o){if(!r){var s=function decodeChunk(e,t,r){e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=c.from(t,r));return t}(t,a,n);a!==s&&(r=!0,n="buffer",a=s)}var d=t.objectMode?1:a.length;t.length+=d;var u=t.length-1))throw new x(e);return this._writableState.defaultEncoding=e,this},Object.defineProperty(Writable.prototype,"writableBuffer",{enumerable:!1,get:function get(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(Writable.prototype,"writableHighWaterMark",{enumerable:!1,get:function get(){return this._writableState.highWaterMark}}),Writable.prototype._write=function(e,t,r){r(new p("_write()"))},Writable.prototype._writev=null,Writable.prototype.end=function(e,t,r){var a=this._writableState;return"function"==typeof e?(r=e,e=null,t=null):"function"==typeof t&&(r=t,t=null),null!=e&&this.write(e,t),a.corked&&(a.corked=1,this.uncork()),a.ending||function endWritable(e,t,r){t.ending=!0,finishMaybe(e,t),r&&(t.finished?n.nextTick(r):e.once("finish",r));t.ended=!0,e.writable=!1}(this,a,r),this},Object.defineProperty(Writable.prototype,"writableLength",{enumerable:!1,get:function get(){return this._writableState.length}}),Object.defineProperty(Writable.prototype,"destroyed",{enumerable:!1,get:function get(){return void 0!==this._writableState&&this._writableState.destroyed},set:function set(e){this._writableState&&(this._writableState.destroyed=e)}}),Writable.prototype.destroy=h.destroy,Writable.prototype._undestroy=h.undestroy,Writable.prototype._destroy=function(e,t){t(e)}},(e,t,r)=>{"use strict";var a=r(56).Buffer,n=a.isEncoding||function(e){switch((e=""+e)&&e.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 StringDecoder(e){var t;switch(this.encoding=function normalizeEncoding(e){var t=function _normalizeEncoding(e){if(!e)return"utf8";for(var t;;)switch(e){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 e;default:if(t)return;e=(""+e).toLowerCase(),t=!0}}(e);if("string"!=typeof t&&(a.isEncoding===n||!n(e)))throw new Error("Unknown encoding: "+e);return t||e}(e),this.encoding){case"utf16le":this.text=utf16Text,this.end=utf16End,t=4;break;case"utf8":this.fillLast=utf8FillLast,t=4;break;case"base64":this.text=base64Text,this.end=base64End,t=3;break;default:return this.write=simpleWrite,void(this.end=simpleEnd)}this.lastNeed=0,this.lastTotal=0,this.lastChar=a.allocUnsafe(t)}function utf8CheckByte(e){return e<=127?0:e>>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function utf8FillLast(e){var t=this.lastTotal-this.lastNeed,r=function utf8CheckExtraBytes(e,t,r){if(128!=(192&t[0]))return e.lastNeed=0,"�";if(e.lastNeed>1&&t.length>1){if(128!=(192&t[1]))return e.lastNeed=1,"�";if(e.lastNeed>2&&t.length>2&&128!=(192&t[2]))return e.lastNeed=2,"�"}}(this,e);return void 0!==r?r:this.lastNeed<=e.length?(e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(e.copy(this.lastChar,t,0,e.length),void(this.lastNeed-=e.length))}function utf16Text(e,t){if((e.length-t)%2==0){var r=e.toString("utf16le",t);if(r){var a=r.charCodeAt(r.length-1);if(a>=55296&&a<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",t,e.length-1)}function utf16End(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return t+this.lastChar.toString("utf16le",0,r)}return t}function base64Text(e,t){var r=(e.length-t)%3;return 0===r?e.toString("base64",t):(this.lastNeed=3-r,this.lastTotal=3,1===r?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString("base64",t,e.length-r))}function base64End(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function simpleWrite(e){return e.toString(this.encoding)}function simpleEnd(e){return e&&e.length?this.write(e):""}t.a=StringDecoder,StringDecoder.prototype.write=function(e){if(0===e.length)return"";var t,r;if(this.lastNeed){if(void 0===(t=this.fillLast(e)))return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r=0)return n>0&&(e.lastNeed=n-1),n;if(--a=0)return n>0&&(e.lastNeed=n-2),n;if(--a=0)return n>0&&(2===n?n=0:e.lastNeed=n-3),n;return 0}(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=r;var a=e.length-(r-this.lastNeed);return e.copy(this.lastChar,0,a),e.toString("utf8",t,a)},StringDecoder.prototype.fillLast=function(e){if(this.lastNeed<=e.length)return e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,e.length),this.lastNeed-=e.length}},(e,t,r)=>{"use strict";e.exports=Transform;var a=r(235).a,n=a.ERR_METHOD_NOT_IMPLEMENTED,o=a.ERR_MULTIPLE_CALLBACK,s=a.ERR_TRANSFORM_ALREADY_TRANSFORMING,c=a.ERR_TRANSFORM_WITH_LENGTH_0,d=r(182);function afterTransform(e,t){var r=this._transformState;r.transforming=!1;var a=r.writecb;if(null===a)return this.emit("error",new o);r.writechunk=null,r.writecb=null,null!=t&&this.push(t),a(e);var n=this._readableState;n.reading=!1,(n.needReadable||n.length{var a=r(21),n=r(183),o=r(56).Buffer,s=[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],c=new Array(64);function Sha256(){this.init(),this._w=c,n.call(this,64,56)}function ch(e,t,r){return r^e&(t^r)}function maj(e,t,r){return e&t|r&(e|t)}function sigma0(e){return(e>>>2|e<<30)^(e>>>13|e<<19)^(e>>>22|e<<10)}function sigma1(e){return(e>>>6|e<<26)^(e>>>11|e<<21)^(e>>>25|e<<7)}function gamma0(e){return(e>>>7|e<<25)^(e>>>18|e<<14)^e>>>3}a(Sha256,n),Sha256.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},Sha256.prototype._update=function(e){for(var t,r=this._w,a=0|this._a,n=0|this._b,o=0|this._c,c=0|this._d,d=0|this._e,u=0|this._f,h=0|this._g,l=0|this._h,b=0;b<16;++b)r[b]=e.readInt32BE(4*b);for(;b<64;++b)r[b]=0|(((t=r[b-2])>>>17|t<<15)^(t>>>19|t<<13)^t>>>10)+r[b-7]+gamma0(r[b-15])+r[b-16];for(var g=0;g<64;++g){var p=l+sigma1(d)+ch(d,u,h)+s[g]+r[g]|0,B=sigma0(a)+maj(a,n,o)|0;l=h,h=u,u=d,d=c+p|0,c=o,o=n,n=a,a=p+B|0}this._a=a+this._a|0,this._b=n+this._b|0,this._c=o+this._c|0,this._d=c+this._d|0,this._e=d+this._e|0,this._f=u+this._f|0,this._g=h+this._g|0,this._h=l+this._h|0},Sha256.prototype._hash=function(){var e=o.allocUnsafe(32);return e.writeInt32BE(this._a,0),e.writeInt32BE(this._b,4),e.writeInt32BE(this._c,8),e.writeInt32BE(this._d,12),e.writeInt32BE(this._e,16),e.writeInt32BE(this._f,20),e.writeInt32BE(this._g,24),e.writeInt32BE(this._h,28),e},e.exports=Sha256},(e,t,r)=>{var a=r(21),n=r(183),o=r(56).Buffer,s=[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],c=new Array(160);function Sha512(){this.init(),this._w=c,n.call(this,128,112)}function Ch(e,t,r){return r^e&(t^r)}function maj(e,t,r){return e&t|r&(e|t)}function sigma0(e,t){return(e>>>28|t<<4)^(t>>>2|e<<30)^(t>>>7|e<<25)}function sigma1(e,t){return(e>>>14|t<<18)^(e>>>18|t<<14)^(t>>>9|e<<23)}function Gamma0(e,t){return(e>>>1|t<<31)^(e>>>8|t<<24)^e>>>7}function Gamma0l(e,t){return(e>>>1|t<<31)^(e>>>8|t<<24)^(e>>>7|t<<25)}function Gamma1(e,t){return(e>>>19|t<<13)^(t>>>29|e<<3)^e>>>6}function Gamma1l(e,t){return(e>>>19|t<<13)^(t>>>29|e<<3)^(e>>>6|t<<26)}function getCarry(e,t){return e>>>0>>0?1:0}a(Sha512,n),Sha512.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},Sha512.prototype._update=function(e){for(var t=this._w,r=0|this._ah,a=0|this._bh,n=0|this._ch,o=0|this._dh,c=0|this._eh,d=0|this._fh,u=0|this._gh,h=0|this._hh,l=0|this._al,b=0|this._bl,g=0|this._cl,p=0|this._dl,B=0|this._el,m=0|this._fl,I=0|this._gl,y=0|this._hl,v=0;v<32;v+=2)t[v]=e.readInt32BE(4*v),t[v+1]=e.readInt32BE(4*v+4);for(;v<160;v+=2){var x=t[v-30],C=t[v-30+1],Q=Gamma0(x,C),w=Gamma0l(C,x),_=Gamma1(x=t[v-4],C=t[v-4+1]),k=Gamma1l(C,x),N=t[v-14],D=t[v-14+1],U=t[v-32],G=t[v-32+1],T=w+D|0,L=Q+N+getCarry(T,w)|0;L=(L=L+_+getCarry(T=T+k|0,k)|0)+U+getCarry(T=T+G|0,G)|0,t[v]=L,t[v+1]=T}for(var P=0;P<160;P+=2){L=t[P],T=t[P+1];var q=maj(r,a,n),O=maj(l,b,g),H=sigma0(r,l),Y=sigma0(l,r),j=sigma1(c,B),J=sigma1(B,c),z=s[P],W=s[P+1],V=Ch(c,d,u),X=Ch(B,m,I),$=y+J|0,et=h+j+getCarry($,y)|0;et=(et=(et=et+V+getCarry($=$+X|0,X)|0)+z+getCarry($=$+W|0,W)|0)+L+getCarry($=$+T|0,T)|0;var tt=Y+O|0,rt=H+q+getCarry(tt,Y)|0;h=u,y=I,u=d,I=m,d=c,m=B,c=o+et+getCarry(B=p+$|0,p)|0,o=n,p=g,n=a,g=b,a=r,b=l,r=et+rt+getCarry(l=$+tt|0,$)|0}this._al=this._al+l|0,this._bl=this._bl+b|0,this._cl=this._cl+g|0,this._dl=this._dl+p|0,this._el=this._el+B|0,this._fl=this._fl+m|0,this._gl=this._gl+I|0,this._hl=this._hl+y|0,this._ah=this._ah+r+getCarry(this._al,l)|0,this._bh=this._bh+a+getCarry(this._bl,b)|0,this._ch=this._ch+n+getCarry(this._cl,g)|0,this._dh=this._dh+o+getCarry(this._dl,p)|0,this._eh=this._eh+c+getCarry(this._el,B)|0,this._fh=this._fh+d+getCarry(this._fl,m)|0,this._gh=this._gh+u+getCarry(this._gl,I)|0,this._hh=this._hh+h+getCarry(this._hl,y)|0},Sha512.prototype._hash=function(){var e=o.allocUnsafe(64);function writeInt64BE(t,r,a){e.writeInt32BE(t,a),e.writeInt32BE(r,a+4)}return writeInt64BE(this._ah,this._al,0),writeInt64BE(this._bh,this._bl,8),writeInt64BE(this._ch,this._cl,16),writeInt64BE(this._dh,this._dl,24),writeInt64BE(this._eh,this._el,32),writeInt64BE(this._fh,this._fl,40),writeInt64BE(this._gh,this._gl,48),writeInt64BE(this._hh,this._hl,56),e},e.exports=Sha512},function(e,t,r){"use strict";var a=r(3).Buffer,n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.Address=void 0;var o=n(r(6)),s=n(r(127)),c=r(71),d=r(33),u=function(){function Address(e){o.default(20===e.length,"Invalid address length"),this.buf=e}return Address.zero=function(){return new Address(c.zeros(20))},Address.fromString=function(e){return o.default(d.isValidAddress(e),"Invalid address"),new Address(c.toBuffer(e))},Address.fromPublicKey=function(e){return o.default(a.isBuffer(e),"Public key should be Buffer"),new Address(d.pubToAddress(e))},Address.fromPrivateKey=function(e){return o.default(a.isBuffer(e),"Private key should be Buffer"),new Address(d.privateToAddress(e))},Address.generate=function(e,t){return o.default(s.default.isBN(t)),new Address(d.generateAddress(e.buf,t.toArrayLike(a)))},Address.generate2=function(e,t,r){return o.default(a.isBuffer(t)),o.default(a.isBuffer(r)),new Address(d.generateAddress2(e.buf,t,r))},Address.prototype.equals=function(e){return this.buf.equals(e.buf)},Address.prototype.isZero=function(){return this.equals(Address.zero())},Address.prototype.isPrecompileOrSystemAddress=function(){var e=new s.default(this.buf),t=new s.default(0),r=new s.default("ffff","hex");return e.gte(t)&&e.lte(r)},Address.prototype.toString=function(){return"0x"+this.buf.toString("hex")},Address.prototype.toBuffer=function(){return a.from(this.buf)},Address}();t.Address=u},function(e,t,r){"use strict";var a=r(3).Buffer,n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.hashPersonalMessage=t.isValidSignature=t.fromRpcSig=t.toCompactSig=t.toRpcSig=t.ecrecover=t.ecsign=void 0;var o=r(125),s=n(r(127)),c=r(71),d=r(57),u=r(341),h=r(236);function calculateSigRecovery(e,t){var r=h.toType(e,h.TypeOutput.BN);if(!t)return r.subn(27);var a=h.toType(t,h.TypeOutput.BN);return r.sub(a.muln(2).addn(35))}function isValidSigRecovery(e){var t=new s.default(e);return t.eqn(0)||t.eqn(1)}t.ecsign=function ecsign(e,t,r){var n=o.ecdsaSign(e,t),s=n.signature,c=n.recid,d=a.from(s.slice(0,32)),u=a.from(s.slice(32,64));if(!r||"number"==typeof r){if(r&&!Number.isSafeInteger(r))throw new Error("The provided number is greater than MAX_SAFE_INTEGER (please use an alternative input type)");return{r:d,s:u,v:r?c+(2*r+35):c+27}}return{r:d,s:u,v:h.toType(r,h.TypeOutput.BN).muln(2).addn(35).addn(c).toArrayLike(a)}},t.ecrecover=function(e,t,r,n,s){var d=a.concat([c.setLengthLeft(r,32),c.setLengthLeft(n,32)],64),u=calculateSigRecovery(t,s);if(!isValidSigRecovery(u))throw new Error("Invalid signature v value");var h=o.ecdsaRecover(d,u.toNumber(),e);return a.from(o.publicKeyConvert(h,!1).slice(1))},t.toRpcSig=function(e,t,r,n){if(!isValidSigRecovery(calculateSigRecovery(e,n)))throw new Error("Invalid signature v value");return c.bufferToHex(a.concat([c.setLengthLeft(t,32),c.setLengthLeft(r,32),c.toBuffer(e)]))},t.toCompactSig=function(e,t,r,n){if(!isValidSigRecovery(calculateSigRecovery(e,n)))throw new Error("Invalid signature v value");var o=h.toType(e,h.TypeOutput.Number),s=r;return(o>28&&o%2==1||1===o||28===o)&&((s=a.from(r))[0]|=128),c.bufferToHex(a.concat([c.setLengthLeft(t,32),c.setLengthLeft(s,32)]))},t.fromRpcSig=function(e){var t,r,a,n=c.toBuffer(e);if(n.length>=65)t=n.slice(0,32),r=n.slice(32,64),a=c.bufferToInt(n.slice(64));else{if(64!==n.length)throw new Error("Invalid signature length");t=n.slice(0,32),r=n.slice(32,64),a=c.bufferToInt(n.slice(32,33))>>7,r[0]&=127}return a<27&&(a+=27),{v:a,r:t,s:r}},t.isValidSignature=function(e,t,r,a,n){void 0===a&&(a=!0);var o=new s.default("7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0",16),c=new s.default("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141",16);if(32!==t.length||32!==r.length)return!1;if(!isValidSigRecovery(calculateSigRecovery(e,n)))return!1;var d=new s.default(t),u=new s.default(r);return!(d.isZero()||d.gt(c)||u.isZero()||u.gt(c))&&(!a||1!==u.cmp(o))},t.hashPersonalMessage=function(e){u.assertIsBuffer(e);var t=a.from("Ethereum Signed Message:\n"+e.length.toString(),"utf-8");return d.keccak(a.concat([t,e]))}},function(e,t,r){!function(e,t){"use strict";function assert(e,t){if(!e)throw new Error(t||"Assertion failed")}function inherits(e,t){e.super_=t;var TempCtor=function(){};TempCtor.prototype=t.prototype,e.prototype=new TempCtor,e.prototype.constructor=e}function BN(e,t,r){if(BN.isBN(e))return e;this.negative=0,this.words=null,this.length=0,this.red=null,null!==e&&("le"!==t&&"be"!==t||(r=t,t=10),this._init(e||0,t||10,r||"be"))}var a;"object"==typeof e?e.exports=BN:t.BN=BN,BN.BN=BN,BN.wordSize=26;try{a="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:r(17).Buffer}catch(e){}function parseHex4Bits(e,t){var r=e.charCodeAt(t);return r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:r-48&15}function parseHexByte(e,t,r){var a=parseHex4Bits(e,r);return r-1>=t&&(a|=parseHex4Bits(e,r-1)<<4),a}function parseBase(e,t,r,a){for(var n=0,o=Math.min(e.length,r),s=t;s=49?c-49+10:c>=17?c-17+10:c}return n}BN.isBN=function isBN(e){return e instanceof BN||null!==e&&"object"==typeof e&&e.constructor.wordSize===BN.wordSize&&Array.isArray(e.words)},BN.max=function max(e,t){return e.cmp(t)>0?e:t},BN.min=function min(e,t){return e.cmp(t)<0?e:t},BN.prototype._init=function init(e,t,r){if("number"==typeof e)return this._initNumber(e,t,r);if("object"==typeof e)return this._initArray(e,t,r);"hex"===t&&(t=16),assert(t===(0|t)&&t>=2&&t<=36);var a=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&(a++,this.negative=1),a=0;a-=3)o=e[a]|e[a-1]<<8|e[a-2]<<16,this.words[n]|=o<>>26-s&67108863,(s+=24)>=26&&(s-=26,n++);else if("le"===r)for(a=0,n=0;a>>26-s&67108863,(s+=24)>=26&&(s-=26,n++);return this.strip()},BN.prototype._parseHex=function _parseHex(e,t,r){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var a=0;a=t;a-=2)n=parseHexByte(e,t,a)<=18?(o-=18,s+=1,this.words[s]|=n>>>26):o+=8;else for(a=(e.length-t)%2==0?t+1:t;a=18?(o-=18,s+=1,this.words[s]|=n>>>26):o+=8;this.strip()},BN.prototype._parseBase=function _parseBase(e,t,r){this.words=[0],this.length=1;for(var a=0,n=1;n<=67108863;n*=t)a++;a--,n=n/t|0;for(var o=e.length-r,s=o%a,c=Math.min(o,o-s)+r,d=0,u=r;u1&&0===this.words[this.length-1];)this.length--;return this._normSign()},BN.prototype._normSign=function _normSign(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},BN.prototype.inspect=function inspect(){return(this.red?""};var n=["","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"],o=[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],s=[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 smallMulTo(e,t,r){r.negative=t.negative^e.negative;var a=e.length+t.length|0;r.length=a,a=a-1|0;var n=0|e.words[0],o=0|t.words[0],s=n*o,c=67108863&s,d=s/67108864|0;r.words[0]=c;for(var u=1;u>>26,l=67108863&d,b=Math.min(u,t.length-1),g=Math.max(0,u-e.length+1);g<=b;g++){var p=u-g|0;h+=(s=(n=0|e.words[p])*(o=0|t.words[g])+l)/67108864|0,l=67108863&s}r.words[u]=0|l,d=0|h}return 0!==d?r.words[u]=0|d:r.length--,r.strip()}BN.prototype.toString=function toString(e,t){var r;if(t=0|t||1,16===(e=e||10)||"hex"===e){r="";for(var a=0,c=0,d=0;d>>24-a&16777215)||d!==this.length-1?n[6-h.length]+h+r:h+r,(a+=2)>=26&&(a-=26,d--)}for(0!==c&&(r=c.toString(16)+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(e===(0|e)&&e>=2&&e<=36){var l=o[e],b=s[e];r="";var g=this.clone();for(g.negative=0;!g.isZero();){var p=g.modn(b).toString(e);r=(g=g.idivn(b)).isZero()?p+r:n[l-p.length]+p+r}for(this.isZero()&&(r="0"+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}assert(!1,"Base should be between 2 and 36")},BN.prototype.toNumber=function toNumber(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&assert(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},BN.prototype.toJSON=function toJSON(){return this.toString(16)},BN.prototype.toBuffer=function toBuffer(e,t){return assert(void 0!==a),this.toArrayLike(a,e,t)},BN.prototype.toArray=function toArray(e,t){return this.toArrayLike(Array,e,t)},BN.prototype.toArrayLike=function toArrayLike(e,t,r){var a=this.byteLength(),n=r||Math.max(1,a);assert(a<=n,"byte array longer than desired length"),assert(n>0,"Requested array length <= 0"),this.strip();var o,s,c="le"===t,d=new e(n),u=this.clone();if(c){for(s=0;!u.isZero();s++)o=u.andln(255),u.iushrn(8),d[s]=o;for(;s=4096&&(r+=13,t>>>=13),t>=64&&(r+=7,t>>>=7),t>=8&&(r+=4,t>>>=4),t>=2&&(r+=2,t>>>=2),r+t},BN.prototype._zeroBits=function _zeroBits(e){if(0===e)return 26;var t=e,r=0;return 0==(8191&t)&&(r+=13,t>>>=13),0==(127&t)&&(r+=7,t>>>=7),0==(15&t)&&(r+=4,t>>>=4),0==(3&t)&&(r+=2,t>>>=2),0==(1&t)&&r++,r},BN.prototype.bitLength=function bitLength(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},BN.prototype.zeroBits=function zeroBits(){if(this.isZero())return 0;for(var e=0,t=0;te.length?this.clone().ior(e):e.clone().ior(this)},BN.prototype.uor=function uor(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},BN.prototype.iuand=function iuand(e){var t;t=this.length>e.length?e:this;for(var r=0;re.length?this.clone().iand(e):e.clone().iand(this)},BN.prototype.uand=function uand(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},BN.prototype.iuxor=function iuxor(e){var t,r;this.length>e.length?(t=this,r=e):(t=e,r=this);for(var a=0;ae.length?this.clone().ixor(e):e.clone().ixor(this)},BN.prototype.uxor=function uxor(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},BN.prototype.inotn=function inotn(e){assert("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),r=e%26;this._expand(t),r>0&&t--;for(var a=0;a0&&(this.words[a]=~this.words[a]&67108863>>26-r),this.strip()},BN.prototype.notn=function notn(e){return this.clone().inotn(e)},BN.prototype.setn=function setn(e,t){assert("number"==typeof e&&e>=0);var r=e/26|0,a=e%26;return this._expand(r+1),this.words[r]=t?this.words[r]|1<e.length?(r=this,a=e):(r=e,a=this);for(var n=0,o=0;o>>26;for(;0!==n&&o>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;oe.length?this.clone().iadd(e):e.clone().iadd(this)},BN.prototype.isub=function isub(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var r,a,n=this.cmp(e);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,a=e):(r=e,a=this);for(var o=0,s=0;s>26,this.words[s]=67108863&t;for(;0!==o&&s>26,this.words[s]=67108863&t;if(0===o&&s>>13,g=0|s[1],p=8191&g,B=g>>>13,m=0|s[2],I=8191&m,y=m>>>13,v=0|s[3],x=8191&v,C=v>>>13,Q=0|s[4],w=8191&Q,_=Q>>>13,k=0|s[5],N=8191&k,D=k>>>13,U=0|s[6],G=8191&U,T=U>>>13,L=0|s[7],P=8191&L,q=L>>>13,O=0|s[8],H=8191&O,Y=O>>>13,j=0|s[9],J=8191&j,z=j>>>13,W=0|c[0],V=8191&W,X=W>>>13,$=0|c[1],et=8191&$,tt=$>>>13,rt=0|c[2],at=8191&rt,it=rt>>>13,nt=0|c[3],ot=8191&nt,At=nt>>>13,st=0|c[4],ct=8191&st,dt=st>>>13,ut=0|c[5],ht=8191&ut,bt=ut>>>13,pt=0|c[6],Bt=8191&pt,mt=pt>>>13,It=0|c[7],Et=8191&It,yt=It>>>13,vt=0|c[8],xt=8191&vt,Ct=vt>>>13,Qt=0|c[9],wt=8191&Qt,Mt=Qt>>>13;r.negative=e.negative^t.negative,r.length=19;var _t=(u+(a=Math.imul(l,V))|0)+((8191&(n=(n=Math.imul(l,X))+Math.imul(b,V)|0))<<13)|0;u=((o=Math.imul(b,X))+(n>>>13)|0)+(_t>>>26)|0,_t&=67108863,a=Math.imul(p,V),n=(n=Math.imul(p,X))+Math.imul(B,V)|0,o=Math.imul(B,X);var kt=(u+(a=a+Math.imul(l,et)|0)|0)+((8191&(n=(n=n+Math.imul(l,tt)|0)+Math.imul(b,et)|0))<<13)|0;u=((o=o+Math.imul(b,tt)|0)+(n>>>13)|0)+(kt>>>26)|0,kt&=67108863,a=Math.imul(I,V),n=(n=Math.imul(I,X))+Math.imul(y,V)|0,o=Math.imul(y,X),a=a+Math.imul(p,et)|0,n=(n=n+Math.imul(p,tt)|0)+Math.imul(B,et)|0,o=o+Math.imul(B,tt)|0;var St=(u+(a=a+Math.imul(l,at)|0)|0)+((8191&(n=(n=n+Math.imul(l,it)|0)+Math.imul(b,at)|0))<<13)|0;u=((o=o+Math.imul(b,it)|0)+(n>>>13)|0)+(St>>>26)|0,St&=67108863,a=Math.imul(x,V),n=(n=Math.imul(x,X))+Math.imul(C,V)|0,o=Math.imul(C,X),a=a+Math.imul(I,et)|0,n=(n=n+Math.imul(I,tt)|0)+Math.imul(y,et)|0,o=o+Math.imul(y,tt)|0,a=a+Math.imul(p,at)|0,n=(n=n+Math.imul(p,it)|0)+Math.imul(B,at)|0,o=o+Math.imul(B,it)|0;var Nt=(u+(a=a+Math.imul(l,ot)|0)|0)+((8191&(n=(n=n+Math.imul(l,At)|0)+Math.imul(b,ot)|0))<<13)|0;u=((o=o+Math.imul(b,At)|0)+(n>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,a=Math.imul(w,V),n=(n=Math.imul(w,X))+Math.imul(_,V)|0,o=Math.imul(_,X),a=a+Math.imul(x,et)|0,n=(n=n+Math.imul(x,tt)|0)+Math.imul(C,et)|0,o=o+Math.imul(C,tt)|0,a=a+Math.imul(I,at)|0,n=(n=n+Math.imul(I,it)|0)+Math.imul(y,at)|0,o=o+Math.imul(y,it)|0,a=a+Math.imul(p,ot)|0,n=(n=n+Math.imul(p,At)|0)+Math.imul(B,ot)|0,o=o+Math.imul(B,At)|0;var Dt=(u+(a=a+Math.imul(l,ct)|0)|0)+((8191&(n=(n=n+Math.imul(l,dt)|0)+Math.imul(b,ct)|0))<<13)|0;u=((o=o+Math.imul(b,dt)|0)+(n>>>13)|0)+(Dt>>>26)|0,Dt&=67108863,a=Math.imul(N,V),n=(n=Math.imul(N,X))+Math.imul(D,V)|0,o=Math.imul(D,X),a=a+Math.imul(w,et)|0,n=(n=n+Math.imul(w,tt)|0)+Math.imul(_,et)|0,o=o+Math.imul(_,tt)|0,a=a+Math.imul(x,at)|0,n=(n=n+Math.imul(x,it)|0)+Math.imul(C,at)|0,o=o+Math.imul(C,it)|0,a=a+Math.imul(I,ot)|0,n=(n=n+Math.imul(I,At)|0)+Math.imul(y,ot)|0,o=o+Math.imul(y,At)|0,a=a+Math.imul(p,ct)|0,n=(n=n+Math.imul(p,dt)|0)+Math.imul(B,ct)|0,o=o+Math.imul(B,dt)|0;var Rt=(u+(a=a+Math.imul(l,ht)|0)|0)+((8191&(n=(n=n+Math.imul(l,bt)|0)+Math.imul(b,ht)|0))<<13)|0;u=((o=o+Math.imul(b,bt)|0)+(n>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,a=Math.imul(G,V),n=(n=Math.imul(G,X))+Math.imul(T,V)|0,o=Math.imul(T,X),a=a+Math.imul(N,et)|0,n=(n=n+Math.imul(N,tt)|0)+Math.imul(D,et)|0,o=o+Math.imul(D,tt)|0,a=a+Math.imul(w,at)|0,n=(n=n+Math.imul(w,it)|0)+Math.imul(_,at)|0,o=o+Math.imul(_,it)|0,a=a+Math.imul(x,ot)|0,n=(n=n+Math.imul(x,At)|0)+Math.imul(C,ot)|0,o=o+Math.imul(C,At)|0,a=a+Math.imul(I,ct)|0,n=(n=n+Math.imul(I,dt)|0)+Math.imul(y,ct)|0,o=o+Math.imul(y,dt)|0,a=a+Math.imul(p,ht)|0,n=(n=n+Math.imul(p,bt)|0)+Math.imul(B,ht)|0,o=o+Math.imul(B,bt)|0;var Ft=(u+(a=a+Math.imul(l,Bt)|0)|0)+((8191&(n=(n=n+Math.imul(l,mt)|0)+Math.imul(b,Bt)|0))<<13)|0;u=((o=o+Math.imul(b,mt)|0)+(n>>>13)|0)+(Ft>>>26)|0,Ft&=67108863,a=Math.imul(P,V),n=(n=Math.imul(P,X))+Math.imul(q,V)|0,o=Math.imul(q,X),a=a+Math.imul(G,et)|0,n=(n=n+Math.imul(G,tt)|0)+Math.imul(T,et)|0,o=o+Math.imul(T,tt)|0,a=a+Math.imul(N,at)|0,n=(n=n+Math.imul(N,it)|0)+Math.imul(D,at)|0,o=o+Math.imul(D,it)|0,a=a+Math.imul(w,ot)|0,n=(n=n+Math.imul(w,At)|0)+Math.imul(_,ot)|0,o=o+Math.imul(_,At)|0,a=a+Math.imul(x,ct)|0,n=(n=n+Math.imul(x,dt)|0)+Math.imul(C,ct)|0,o=o+Math.imul(C,dt)|0,a=a+Math.imul(I,ht)|0,n=(n=n+Math.imul(I,bt)|0)+Math.imul(y,ht)|0,o=o+Math.imul(y,bt)|0,a=a+Math.imul(p,Bt)|0,n=(n=n+Math.imul(p,mt)|0)+Math.imul(B,Bt)|0,o=o+Math.imul(B,mt)|0;var Ut=(u+(a=a+Math.imul(l,Et)|0)|0)+((8191&(n=(n=n+Math.imul(l,yt)|0)+Math.imul(b,Et)|0))<<13)|0;u=((o=o+Math.imul(b,yt)|0)+(n>>>13)|0)+(Ut>>>26)|0,Ut&=67108863,a=Math.imul(H,V),n=(n=Math.imul(H,X))+Math.imul(Y,V)|0,o=Math.imul(Y,X),a=a+Math.imul(P,et)|0,n=(n=n+Math.imul(P,tt)|0)+Math.imul(q,et)|0,o=o+Math.imul(q,tt)|0,a=a+Math.imul(G,at)|0,n=(n=n+Math.imul(G,it)|0)+Math.imul(T,at)|0,o=o+Math.imul(T,it)|0,a=a+Math.imul(N,ot)|0,n=(n=n+Math.imul(N,At)|0)+Math.imul(D,ot)|0,o=o+Math.imul(D,At)|0,a=a+Math.imul(w,ct)|0,n=(n=n+Math.imul(w,dt)|0)+Math.imul(_,ct)|0,o=o+Math.imul(_,dt)|0,a=a+Math.imul(x,ht)|0,n=(n=n+Math.imul(x,bt)|0)+Math.imul(C,ht)|0,o=o+Math.imul(C,bt)|0,a=a+Math.imul(I,Bt)|0,n=(n=n+Math.imul(I,mt)|0)+Math.imul(y,Bt)|0,o=o+Math.imul(y,mt)|0,a=a+Math.imul(p,Et)|0,n=(n=n+Math.imul(p,yt)|0)+Math.imul(B,Et)|0,o=o+Math.imul(B,yt)|0;var Gt=(u+(a=a+Math.imul(l,xt)|0)|0)+((8191&(n=(n=n+Math.imul(l,Ct)|0)+Math.imul(b,xt)|0))<<13)|0;u=((o=o+Math.imul(b,Ct)|0)+(n>>>13)|0)+(Gt>>>26)|0,Gt&=67108863,a=Math.imul(J,V),n=(n=Math.imul(J,X))+Math.imul(z,V)|0,o=Math.imul(z,X),a=a+Math.imul(H,et)|0,n=(n=n+Math.imul(H,tt)|0)+Math.imul(Y,et)|0,o=o+Math.imul(Y,tt)|0,a=a+Math.imul(P,at)|0,n=(n=n+Math.imul(P,it)|0)+Math.imul(q,at)|0,o=o+Math.imul(q,it)|0,a=a+Math.imul(G,ot)|0,n=(n=n+Math.imul(G,At)|0)+Math.imul(T,ot)|0,o=o+Math.imul(T,At)|0,a=a+Math.imul(N,ct)|0,n=(n=n+Math.imul(N,dt)|0)+Math.imul(D,ct)|0,o=o+Math.imul(D,dt)|0,a=a+Math.imul(w,ht)|0,n=(n=n+Math.imul(w,bt)|0)+Math.imul(_,ht)|0,o=o+Math.imul(_,bt)|0,a=a+Math.imul(x,Bt)|0,n=(n=n+Math.imul(x,mt)|0)+Math.imul(C,Bt)|0,o=o+Math.imul(C,mt)|0,a=a+Math.imul(I,Et)|0,n=(n=n+Math.imul(I,yt)|0)+Math.imul(y,Et)|0,o=o+Math.imul(y,yt)|0,a=a+Math.imul(p,xt)|0,n=(n=n+Math.imul(p,Ct)|0)+Math.imul(B,xt)|0,o=o+Math.imul(B,Ct)|0;var Tt=(u+(a=a+Math.imul(l,wt)|0)|0)+((8191&(n=(n=n+Math.imul(l,Mt)|0)+Math.imul(b,wt)|0))<<13)|0;u=((o=o+Math.imul(b,Mt)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,a=Math.imul(J,et),n=(n=Math.imul(J,tt))+Math.imul(z,et)|0,o=Math.imul(z,tt),a=a+Math.imul(H,at)|0,n=(n=n+Math.imul(H,it)|0)+Math.imul(Y,at)|0,o=o+Math.imul(Y,it)|0,a=a+Math.imul(P,ot)|0,n=(n=n+Math.imul(P,At)|0)+Math.imul(q,ot)|0,o=o+Math.imul(q,At)|0,a=a+Math.imul(G,ct)|0,n=(n=n+Math.imul(G,dt)|0)+Math.imul(T,ct)|0,o=o+Math.imul(T,dt)|0,a=a+Math.imul(N,ht)|0,n=(n=n+Math.imul(N,bt)|0)+Math.imul(D,ht)|0,o=o+Math.imul(D,bt)|0,a=a+Math.imul(w,Bt)|0,n=(n=n+Math.imul(w,mt)|0)+Math.imul(_,Bt)|0,o=o+Math.imul(_,mt)|0,a=a+Math.imul(x,Et)|0,n=(n=n+Math.imul(x,yt)|0)+Math.imul(C,Et)|0,o=o+Math.imul(C,yt)|0,a=a+Math.imul(I,xt)|0,n=(n=n+Math.imul(I,Ct)|0)+Math.imul(y,xt)|0,o=o+Math.imul(y,Ct)|0;var Lt=(u+(a=a+Math.imul(p,wt)|0)|0)+((8191&(n=(n=n+Math.imul(p,Mt)|0)+Math.imul(B,wt)|0))<<13)|0;u=((o=o+Math.imul(B,Mt)|0)+(n>>>13)|0)+(Lt>>>26)|0,Lt&=67108863,a=Math.imul(J,at),n=(n=Math.imul(J,it))+Math.imul(z,at)|0,o=Math.imul(z,it),a=a+Math.imul(H,ot)|0,n=(n=n+Math.imul(H,At)|0)+Math.imul(Y,ot)|0,o=o+Math.imul(Y,At)|0,a=a+Math.imul(P,ct)|0,n=(n=n+Math.imul(P,dt)|0)+Math.imul(q,ct)|0,o=o+Math.imul(q,dt)|0,a=a+Math.imul(G,ht)|0,n=(n=n+Math.imul(G,bt)|0)+Math.imul(T,ht)|0,o=o+Math.imul(T,bt)|0,a=a+Math.imul(N,Bt)|0,n=(n=n+Math.imul(N,mt)|0)+Math.imul(D,Bt)|0,o=o+Math.imul(D,mt)|0,a=a+Math.imul(w,Et)|0,n=(n=n+Math.imul(w,yt)|0)+Math.imul(_,Et)|0,o=o+Math.imul(_,yt)|0,a=a+Math.imul(x,xt)|0,n=(n=n+Math.imul(x,Ct)|0)+Math.imul(C,xt)|0,o=o+Math.imul(C,Ct)|0;var Pt=(u+(a=a+Math.imul(I,wt)|0)|0)+((8191&(n=(n=n+Math.imul(I,Mt)|0)+Math.imul(y,wt)|0))<<13)|0;u=((o=o+Math.imul(y,Mt)|0)+(n>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,a=Math.imul(J,ot),n=(n=Math.imul(J,At))+Math.imul(z,ot)|0,o=Math.imul(z,At),a=a+Math.imul(H,ct)|0,n=(n=n+Math.imul(H,dt)|0)+Math.imul(Y,ct)|0,o=o+Math.imul(Y,dt)|0,a=a+Math.imul(P,ht)|0,n=(n=n+Math.imul(P,bt)|0)+Math.imul(q,ht)|0,o=o+Math.imul(q,bt)|0,a=a+Math.imul(G,Bt)|0,n=(n=n+Math.imul(G,mt)|0)+Math.imul(T,Bt)|0,o=o+Math.imul(T,mt)|0,a=a+Math.imul(N,Et)|0,n=(n=n+Math.imul(N,yt)|0)+Math.imul(D,Et)|0,o=o+Math.imul(D,yt)|0,a=a+Math.imul(w,xt)|0,n=(n=n+Math.imul(w,Ct)|0)+Math.imul(_,xt)|0,o=o+Math.imul(_,Ct)|0;var qt=(u+(a=a+Math.imul(x,wt)|0)|0)+((8191&(n=(n=n+Math.imul(x,Mt)|0)+Math.imul(C,wt)|0))<<13)|0;u=((o=o+Math.imul(C,Mt)|0)+(n>>>13)|0)+(qt>>>26)|0,qt&=67108863,a=Math.imul(J,ct),n=(n=Math.imul(J,dt))+Math.imul(z,ct)|0,o=Math.imul(z,dt),a=a+Math.imul(H,ht)|0,n=(n=n+Math.imul(H,bt)|0)+Math.imul(Y,ht)|0,o=o+Math.imul(Y,bt)|0,a=a+Math.imul(P,Bt)|0,n=(n=n+Math.imul(P,mt)|0)+Math.imul(q,Bt)|0,o=o+Math.imul(q,mt)|0,a=a+Math.imul(G,Et)|0,n=(n=n+Math.imul(G,yt)|0)+Math.imul(T,Et)|0,o=o+Math.imul(T,yt)|0,a=a+Math.imul(N,xt)|0,n=(n=n+Math.imul(N,Ct)|0)+Math.imul(D,xt)|0,o=o+Math.imul(D,Ct)|0;var Ot=(u+(a=a+Math.imul(w,wt)|0)|0)+((8191&(n=(n=n+Math.imul(w,Mt)|0)+Math.imul(_,wt)|0))<<13)|0;u=((o=o+Math.imul(_,Mt)|0)+(n>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,a=Math.imul(J,ht),n=(n=Math.imul(J,bt))+Math.imul(z,ht)|0,o=Math.imul(z,bt),a=a+Math.imul(H,Bt)|0,n=(n=n+Math.imul(H,mt)|0)+Math.imul(Y,Bt)|0,o=o+Math.imul(Y,mt)|0,a=a+Math.imul(P,Et)|0,n=(n=n+Math.imul(P,yt)|0)+Math.imul(q,Et)|0,o=o+Math.imul(q,yt)|0,a=a+Math.imul(G,xt)|0,n=(n=n+Math.imul(G,Ct)|0)+Math.imul(T,xt)|0,o=o+Math.imul(T,Ct)|0;var Ht=(u+(a=a+Math.imul(N,wt)|0)|0)+((8191&(n=(n=n+Math.imul(N,Mt)|0)+Math.imul(D,wt)|0))<<13)|0;u=((o=o+Math.imul(D,Mt)|0)+(n>>>13)|0)+(Ht>>>26)|0,Ht&=67108863,a=Math.imul(J,Bt),n=(n=Math.imul(J,mt))+Math.imul(z,Bt)|0,o=Math.imul(z,mt),a=a+Math.imul(H,Et)|0,n=(n=n+Math.imul(H,yt)|0)+Math.imul(Y,Et)|0,o=o+Math.imul(Y,yt)|0,a=a+Math.imul(P,xt)|0,n=(n=n+Math.imul(P,Ct)|0)+Math.imul(q,xt)|0,o=o+Math.imul(q,Ct)|0;var Yt=(u+(a=a+Math.imul(G,wt)|0)|0)+((8191&(n=(n=n+Math.imul(G,Mt)|0)+Math.imul(T,wt)|0))<<13)|0;u=((o=o+Math.imul(T,Mt)|0)+(n>>>13)|0)+(Yt>>>26)|0,Yt&=67108863,a=Math.imul(J,Et),n=(n=Math.imul(J,yt))+Math.imul(z,Et)|0,o=Math.imul(z,yt),a=a+Math.imul(H,xt)|0,n=(n=n+Math.imul(H,Ct)|0)+Math.imul(Y,xt)|0,o=o+Math.imul(Y,Ct)|0;var jt=(u+(a=a+Math.imul(P,wt)|0)|0)+((8191&(n=(n=n+Math.imul(P,Mt)|0)+Math.imul(q,wt)|0))<<13)|0;u=((o=o+Math.imul(q,Mt)|0)+(n>>>13)|0)+(jt>>>26)|0,jt&=67108863,a=Math.imul(J,xt),n=(n=Math.imul(J,Ct))+Math.imul(z,xt)|0,o=Math.imul(z,Ct);var Jt=(u+(a=a+Math.imul(H,wt)|0)|0)+((8191&(n=(n=n+Math.imul(H,Mt)|0)+Math.imul(Y,wt)|0))<<13)|0;u=((o=o+Math.imul(Y,Mt)|0)+(n>>>13)|0)+(Jt>>>26)|0,Jt&=67108863;var Kt=(u+(a=Math.imul(J,wt))|0)+((8191&(n=(n=Math.imul(J,Mt))+Math.imul(z,wt)|0))<<13)|0;return u=((o=Math.imul(z,Mt))+(n>>>13)|0)+(Kt>>>26)|0,Kt&=67108863,d[0]=_t,d[1]=kt,d[2]=St,d[3]=Nt,d[4]=Dt,d[5]=Rt,d[6]=Ft,d[7]=Ut,d[8]=Gt,d[9]=Tt,d[10]=Lt,d[11]=Pt,d[12]=qt,d[13]=Ot,d[14]=Ht,d[15]=Yt,d[16]=jt,d[17]=Jt,d[18]=Kt,0!==u&&(d[19]=u,r.length++),r};function jumboMulTo(e,t,r){return(new FFTM).mulp(e,t,r)}function FFTM(e,t){this.x=e,this.y=t}Math.imul||(c=smallMulTo),BN.prototype.mulTo=function mulTo(e,t){var r=this.length+e.length;return 10===this.length&&10===e.length?c(this,e,t):r<63?smallMulTo(this,e,t):r<1024?function bigMulTo(e,t,r){r.negative=t.negative^e.negative,r.length=e.length+t.length;for(var a=0,n=0,o=0;o>>26)|0)>>>26,s&=67108863}r.words[o]=c,a=s,s=n}return 0!==a?r.words[o]=a:r.length--,r.strip()}(this,e,t):jumboMulTo(this,e,t)},FFTM.prototype.makeRBT=function makeRBT(e){for(var t=new Array(e),r=BN.prototype._countBits(e)-1,a=0;a>=1;return a},FFTM.prototype.permute=function permute(e,t,r,a,n,o){for(var s=0;s>>=1)n++;return 1<>>=13,r[2*o+1]=8191&n,n>>>=13;for(o=2*t;o>=26,t+=a/67108864|0,t+=n>>>26,this.words[r]=67108863&n}return 0!==t&&(this.words[r]=t,this.length++),this},BN.prototype.muln=function muln(e){return this.clone().imuln(e)},BN.prototype.sqr=function sqr(){return this.mul(this)},BN.prototype.isqr=function isqr(){return this.imul(this.clone())},BN.prototype.pow=function pow(e){var t=function toBitArray(e){for(var t=new Array(e.bitLength()),r=0;r>>n}return t}(e);if(0===t.length)return new BN(1);for(var r=this,a=0;a=0);var t,r=e%26,a=(e-r)/26,n=67108863>>>26-r<<26-r;if(0!==r){var o=0;for(t=0;t>>26-r}o&&(this.words[t]=o,this.length++)}if(0!==a){for(t=this.length-1;t>=0;t--)this.words[t+a]=this.words[t];for(t=0;t=0),a=t?(t-t%26)/26:0;var n=e%26,o=Math.min((e-n)/26,this.length),s=67108863^67108863>>>n<o)for(this.length-=o,d=0;d=0&&(0!==u||d>=a);d--){var h=0|this.words[d];this.words[d]=u<<26-n|h>>>n,u=h&s}return c&&0!==u&&(c.words[c.length++]=u),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},BN.prototype.ishrn=function ishrn(e,t,r){return assert(0===this.negative),this.iushrn(e,t,r)},BN.prototype.shln=function shln(e){return this.clone().ishln(e)},BN.prototype.ushln=function ushln(e){return this.clone().iushln(e)},BN.prototype.shrn=function shrn(e){return this.clone().ishrn(e)},BN.prototype.ushrn=function ushrn(e){return this.clone().iushrn(e)},BN.prototype.testn=function testn(e){assert("number"==typeof e&&e>=0);var t=e%26,r=(e-t)/26,a=1<=0);var t=e%26,r=(e-t)/26;if(assert(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==t&&r++,this.length=Math.min(r,this.length),0!==t){var a=67108863^67108863>>>t<=67108864;t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},BN.prototype.isubn=function isubn(e){if(assert("number"==typeof e),assert(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t>26)-(c/67108864|0),this.words[a+r]=67108863&n}for(;a>26,this.words[a+r]=67108863&n;if(0===s)return this.strip();for(assert(-1===s),s=0,a=0;a>26,this.words[a]=67108863&n;return this.negative=1,this.strip()},BN.prototype._wordDiv=function _wordDiv(e,t){var r=(this.length,e.length),a=this.clone(),n=e,o=0|n.words[n.length-1];0!==(r=26-this._countBits(o))&&(n=n.ushln(r),a.iushln(r),o=0|n.words[n.length-1]);var s,c=a.length-n.length;if("mod"!==t){(s=new BN(null)).length=c+1,s.words=new Array(s.length);for(var d=0;d=0;h--){var l=67108864*(0|a.words[n.length+h])+(0|a.words[n.length+h-1]);for(l=Math.min(l/o|0,67108863),a._ishlnsubmul(n,l,h);0!==a.negative;)l--,a.negative=0,a._ishlnsubmul(n,1,h),a.isZero()||(a.negative^=1);s&&(s.words[h]=l)}return s&&s.strip(),a.strip(),"div"!==t&&0!==r&&a.iushrn(r),{div:s||null,mod:a}},BN.prototype.divmod=function divmod(e,t,r){return assert(!e.isZero()),this.isZero()?{div:new BN(0),mod:new BN(0)}:0!==this.negative&&0===e.negative?(o=this.neg().divmod(e,t),"mod"!==t&&(a=o.div.neg()),"div"!==t&&(n=o.mod.neg(),r&&0!==n.negative&&n.iadd(e)),{div:a,mod:n}):0===this.negative&&0!==e.negative?(o=this.divmod(e.neg(),t),"mod"!==t&&(a=o.div.neg()),{div:a,mod:o.mod}):0!=(this.negative&e.negative)?(o=this.neg().divmod(e.neg(),t),"div"!==t&&(n=o.mod.neg(),r&&0!==n.negative&&n.isub(e)),{div:o.div,mod:n}):e.length>this.length||this.cmp(e)<0?{div:new BN(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new BN(this.modn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new BN(this.modn(e.words[0]))}:this._wordDiv(e,t);var a,n,o},BN.prototype.div=function div(e){return this.divmod(e,"div",!1).div},BN.prototype.mod=function mod(e){return this.divmod(e,"mod",!1).mod},BN.prototype.umod=function umod(e){return this.divmod(e,"mod",!0).mod},BN.prototype.divRound=function divRound(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var r=0!==t.div.negative?t.mod.isub(e):t.mod,a=e.ushrn(1),n=e.andln(1),o=r.cmp(a);return o<0||1===n&&0===o?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},BN.prototype.modn=function modn(e){assert(e<=67108863);for(var t=(1<<26)%e,r=0,a=this.length-1;a>=0;a--)r=(t*r+(0|this.words[a]))%e;return r},BN.prototype.idivn=function idivn(e){assert(e<=67108863);for(var t=0,r=this.length-1;r>=0;r--){var a=(0|this.words[r])+67108864*t;this.words[r]=a/e|0,t=a%e}return this.strip()},BN.prototype.divn=function divn(e){return this.clone().idivn(e)},BN.prototype.egcd=function egcd(e){assert(0===e.negative),assert(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var a=new BN(1),n=new BN(0),o=new BN(0),s=new BN(1),c=0;t.isEven()&&r.isEven();)t.iushrn(1),r.iushrn(1),++c;for(var d=r.clone(),u=t.clone();!t.isZero();){for(var h=0,l=1;0==(t.words[0]&l)&&h<26;++h,l<<=1);if(h>0)for(t.iushrn(h);h-- >0;)(a.isOdd()||n.isOdd())&&(a.iadd(d),n.isub(u)),a.iushrn(1),n.iushrn(1);for(var b=0,g=1;0==(r.words[0]&g)&&b<26;++b,g<<=1);if(b>0)for(r.iushrn(b);b-- >0;)(o.isOdd()||s.isOdd())&&(o.iadd(d),s.isub(u)),o.iushrn(1),s.iushrn(1);t.cmp(r)>=0?(t.isub(r),a.isub(o),n.isub(s)):(r.isub(t),o.isub(a),s.isub(n))}return{a:o,b:s,gcd:r.iushln(c)}},BN.prototype._invmp=function _invmp(e){assert(0===e.negative),assert(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var a,n=new BN(1),o=new BN(0),s=r.clone();t.cmpn(1)>0&&r.cmpn(1)>0;){for(var c=0,d=1;0==(t.words[0]&d)&&c<26;++c,d<<=1);if(c>0)for(t.iushrn(c);c-- >0;)n.isOdd()&&n.iadd(s),n.iushrn(1);for(var u=0,h=1;0==(r.words[0]&h)&&u<26;++u,h<<=1);if(u>0)for(r.iushrn(u);u-- >0;)o.isOdd()&&o.iadd(s),o.iushrn(1);t.cmp(r)>=0?(t.isub(r),n.isub(o)):(r.isub(t),o.isub(n))}return(a=0===t.cmpn(1)?n:o).cmpn(0)<0&&a.iadd(e),a},BN.prototype.gcd=function gcd(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),r=e.clone();t.negative=0,r.negative=0;for(var a=0;t.isEven()&&r.isEven();a++)t.iushrn(1),r.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=t.cmp(r);if(n<0){var o=t;t=r,r=o}else if(0===n||0===r.cmpn(1))break;t.isub(r)}return r.iushln(a)},BN.prototype.invm=function invm(e){return this.egcd(e).a.umod(e)},BN.prototype.isEven=function isEven(){return 0==(1&this.words[0])},BN.prototype.isOdd=function isOdd(){return 1==(1&this.words[0])},BN.prototype.andln=function andln(e){return this.words[0]&e},BN.prototype.bincn=function bincn(e){assert("number"==typeof e);var t=e%26,r=(e-t)/26,a=1<>>26,s&=67108863,this.words[o]=s}return 0!==n&&(this.words[o]=n,this.length++),this},BN.prototype.isZero=function isZero(){return 1===this.length&&0===this.words[0]},BN.prototype.cmpn=function cmpn(e){var t,r=e<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this.strip(),this.length>1)t=1;else{r&&(e=-e),assert(e<=67108863,"Number is too big");var a=0|this.words[0];t=a===e?0:ae.length)return 1;if(this.length=0;r--){var a=0|this.words[r],n=0|e.words[r];if(a!==n){an&&(t=1);break}}return t},BN.prototype.gtn=function gtn(e){return 1===this.cmpn(e)},BN.prototype.gt=function gt(e){return 1===this.cmp(e)},BN.prototype.gten=function gten(e){return this.cmpn(e)>=0},BN.prototype.gte=function gte(e){return this.cmp(e)>=0},BN.prototype.ltn=function ltn(e){return-1===this.cmpn(e)},BN.prototype.lt=function lt(e){return-1===this.cmp(e)},BN.prototype.lten=function lten(e){return this.cmpn(e)<=0},BN.prototype.lte=function lte(e){return this.cmp(e)<=0},BN.prototype.eqn=function eqn(e){return 0===this.cmpn(e)},BN.prototype.eq=function eq(e){return 0===this.cmp(e)},BN.red=function red(e){return new Red(e)},BN.prototype.toRed=function toRed(e){return assert(!this.red,"Already a number in reduction context"),assert(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},BN.prototype.fromRed=function fromRed(){return assert(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},BN.prototype._forceRed=function _forceRed(e){return this.red=e,this},BN.prototype.forceRed=function forceRed(e){return assert(!this.red,"Already a number in reduction context"),this._forceRed(e)},BN.prototype.redAdd=function redAdd(e){return assert(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},BN.prototype.redIAdd=function redIAdd(e){return assert(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},BN.prototype.redSub=function redSub(e){return assert(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},BN.prototype.redISub=function redISub(e){return assert(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},BN.prototype.redShl=function redShl(e){return assert(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},BN.prototype.redMul=function redMul(e){return assert(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},BN.prototype.redIMul=function redIMul(e){return assert(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},BN.prototype.redSqr=function redSqr(){return assert(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},BN.prototype.redISqr=function redISqr(){return assert(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},BN.prototype.redSqrt=function redSqrt(){return assert(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},BN.prototype.redInvm=function redInvm(){return assert(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},BN.prototype.redNeg=function redNeg(){return assert(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},BN.prototype.redPow=function redPow(e){return assert(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var d={k256:null,p224:null,p192:null,p25519:null};function MPrime(e,t){this.name=e,this.p=new BN(t,16),this.n=this.p.bitLength(),this.k=new BN(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function K256(){MPrime.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function P224(){MPrime.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function P192(){MPrime.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function P25519(){MPrime.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function Red(e){if("string"==typeof e){var t=BN._prime(e);this.m=t.p,this.prime=t}else assert(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function Mont(e){Red.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new BN(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)}MPrime.prototype._tmp=function _tmp(){var e=new BN(null);return e.words=new Array(Math.ceil(this.n/13)),e},MPrime.prototype.ireduce=function ireduce(e){var t,r=e;do{this.split(r,this.tmp),t=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(t>this.n);var a=t0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},MPrime.prototype.split=function split(e,t){e.iushrn(this.n,0,t)},MPrime.prototype.imulK=function imulK(e){return e.imul(this.k)},inherits(K256,MPrime),K256.prototype.split=function split(e,t){for(var r=4194303,a=Math.min(e.length,9),n=0;n>>22,o=s}o>>>=22,e.words[n-10]=o,0===o&&e.length>10?e.length-=10:e.length-=9},K256.prototype.imulK=function imulK(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,r=0;r>>=26,e.words[r]=n,t=a}return 0!==t&&(e.words[e.length++]=t),e},BN._prime=function prime(e){if(d[e])return d[e];var prime;if("k256"===e)prime=new K256;else if("p224"===e)prime=new P224;else if("p192"===e)prime=new P192;else{if("p25519"!==e)throw new Error("Unknown prime "+e);prime=new P25519}return d[e]=prime,prime},Red.prototype._verify1=function _verify1(e){assert(0===e.negative,"red works only with positives"),assert(e.red,"red works only with red numbers")},Red.prototype._verify2=function _verify2(e,t){assert(0==(e.negative|t.negative),"red works only with positives"),assert(e.red&&e.red===t.red,"red works only with red numbers")},Red.prototype.imod=function imod(e){return this.prime?this.prime.ireduce(e)._forceRed(this):e.umod(this.m)._forceRed(this)},Red.prototype.neg=function neg(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},Red.prototype.add=function add(e,t){this._verify2(e,t);var r=e.add(t);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},Red.prototype.iadd=function iadd(e,t){this._verify2(e,t);var r=e.iadd(t);return r.cmp(this.m)>=0&&r.isub(this.m),r},Red.prototype.sub=function sub(e,t){this._verify2(e,t);var r=e.sub(t);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},Red.prototype.isub=function isub(e,t){this._verify2(e,t);var r=e.isub(t);return r.cmpn(0)<0&&r.iadd(this.m),r},Red.prototype.shl=function shl(e,t){return this._verify1(e),this.imod(e.ushln(t))},Red.prototype.imul=function imul(e,t){return this._verify2(e,t),this.imod(e.imul(t))},Red.prototype.mul=function mul(e,t){return this._verify2(e,t),this.imod(e.mul(t))},Red.prototype.isqr=function isqr(e){return this.imul(e,e.clone())},Red.prototype.sqr=function sqr(e){return this.mul(e,e)},Red.prototype.sqrt=function sqrt(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(assert(t%2==1),3===t){var r=this.m.add(new BN(1)).iushrn(2);return this.pow(e,r)}for(var a=this.m.subn(1),n=0;!a.isZero()&&0===a.andln(1);)n++,a.iushrn(1);assert(!a.isZero());var o=new BN(1).toRed(this),s=o.redNeg(),c=this.m.subn(1).iushrn(1),d=this.m.bitLength();for(d=new BN(2*d*d).toRed(this);0!==this.pow(d,c).cmp(s);)d.redIAdd(s);for(var u=this.pow(d,a),h=this.pow(e,a.addn(1).iushrn(1)),l=this.pow(e,a),b=n;0!==l.cmp(o);){for(var g=l,p=0;0!==g.cmp(o);p++)g=g.redSqr();assert(p=0;a--){for(var d=t.words[a],u=c-1;u>=0;u--){var h=d>>u&1;n!==r[0]&&(n=this.sqr(n)),0!==h||0!==o?(o<<=1,o|=h,(4===++s||0===a&&0===u)&&(n=this.mul(n,r[o]),s=0,o=0)):s=0}c=26}return n},Red.prototype.convertTo=function convertTo(e){var t=e.umod(this.m);return t===e?t.clone():t},Red.prototype.convertFrom=function convertFrom(e){var t=e.clone();return t.red=null,t},BN.mont=function mont(e){return new Mont(e)},inherits(Mont,Red),Mont.prototype.convertTo=function convertTo(e){return this.imod(e.ushln(this.shift))},Mont.prototype.convertFrom=function convertFrom(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},Mont.prototype.imul=function imul(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var r=e.imul(t),a=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(a).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},Mont.prototype.mul=function mul(e,t){if(e.isZero()||t.isZero())return new BN(0)._forceRed(this);var r=e.mul(t),a=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(a).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},Mont.prototype.invm=function invm(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(e=r.nmd(e),this)},(e,t)=>{"use strict";var r;Object.defineProperty(t,"__esModule",{value:!0}),t.Tag=void 0,function(e){e.EARLIEST="earliest",e.LATEST="latest",e.PENDING="pending"}(t.Tag||(t.Tag={})),function(e){e[e.earliest=0]="earliest",e[e.latest=1]="latest",e[e.pending=2]="pending"}(r||(r={})),function(e){e.normalize=function normalize(t){if("string"==typeof t)return e[t.toUpperCase()];switch(t){case r.earliest:return e.EARLIEST;case r.latest:return e.LATEST;case r.pending:return e.PENDING}}}(t.Tag||(t.Tag={}))},function(e,t,r){!function(e,t){"use strict";function assert(e,t){if(!e)throw new Error(t||"Assertion failed")}function inherits(e,t){e.super_=t;var TempCtor=function(){};TempCtor.prototype=t.prototype,e.prototype=new TempCtor,e.prototype.constructor=e}function BN(e,t,r){if(BN.isBN(e))return e;this.negative=0,this.words=null,this.length=0,this.red=null,null!==e&&("le"!==t&&"be"!==t||(r=t,t=10),this._init(e||0,t||10,r||"be"))}var a;"object"==typeof e?e.exports=BN:t.BN=BN,BN.BN=BN,BN.wordSize=26;try{a="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:r(17).Buffer}catch(e){}function parseHex4Bits(e,t){var r=e.charCodeAt(t);return r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:r-48&15}function parseHexByte(e,t,r){var a=parseHex4Bits(e,r);return r-1>=t&&(a|=parseHex4Bits(e,r-1)<<4),a}function parseBase(e,t,r,a){for(var n=0,o=Math.min(e.length,r),s=t;s=49?c-49+10:c>=17?c-17+10:c}return n}BN.isBN=function isBN(e){return e instanceof BN||null!==e&&"object"==typeof e&&e.constructor.wordSize===BN.wordSize&&Array.isArray(e.words)},BN.max=function max(e,t){return e.cmp(t)>0?e:t},BN.min=function min(e,t){return e.cmp(t)<0?e:t},BN.prototype._init=function init(e,t,r){if("number"==typeof e)return this._initNumber(e,t,r);if("object"==typeof e)return this._initArray(e,t,r);"hex"===t&&(t=16),assert(t===(0|t)&&t>=2&&t<=36);var a=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&(a++,this.negative=1),a=0;a-=3)o=e[a]|e[a-1]<<8|e[a-2]<<16,this.words[n]|=o<>>26-s&67108863,(s+=24)>=26&&(s-=26,n++);else if("le"===r)for(a=0,n=0;a>>26-s&67108863,(s+=24)>=26&&(s-=26,n++);return this.strip()},BN.prototype._parseHex=function _parseHex(e,t,r){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var a=0;a=t;a-=2)n=parseHexByte(e,t,a)<=18?(o-=18,s+=1,this.words[s]|=n>>>26):o+=8;else for(a=(e.length-t)%2==0?t+1:t;a=18?(o-=18,s+=1,this.words[s]|=n>>>26):o+=8;this.strip()},BN.prototype._parseBase=function _parseBase(e,t,r){this.words=[0],this.length=1;for(var a=0,n=1;n<=67108863;n*=t)a++;a--,n=n/t|0;for(var o=e.length-r,s=o%a,c=Math.min(o,o-s)+r,d=0,u=r;u1&&0===this.words[this.length-1];)this.length--;return this._normSign()},BN.prototype._normSign=function _normSign(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},BN.prototype.inspect=function inspect(){return(this.red?""};var n=["","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"],o=[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],s=[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 smallMulTo(e,t,r){r.negative=t.negative^e.negative;var a=e.length+t.length|0;r.length=a,a=a-1|0;var n=0|e.words[0],o=0|t.words[0],s=n*o,c=67108863&s,d=s/67108864|0;r.words[0]=c;for(var u=1;u>>26,l=67108863&d,b=Math.min(u,t.length-1),g=Math.max(0,u-e.length+1);g<=b;g++){var p=u-g|0;h+=(s=(n=0|e.words[p])*(o=0|t.words[g])+l)/67108864|0,l=67108863&s}r.words[u]=0|l,d=0|h}return 0!==d?r.words[u]=0|d:r.length--,r.strip()}BN.prototype.toString=function toString(e,t){var r;if(t=0|t||1,16===(e=e||10)||"hex"===e){r="";for(var a=0,c=0,d=0;d>>24-a&16777215)||d!==this.length-1?n[6-h.length]+h+r:h+r,(a+=2)>=26&&(a-=26,d--)}for(0!==c&&(r=c.toString(16)+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(e===(0|e)&&e>=2&&e<=36){var l=o[e],b=s[e];r="";var g=this.clone();for(g.negative=0;!g.isZero();){var p=g.modn(b).toString(e);r=(g=g.idivn(b)).isZero()?p+r:n[l-p.length]+p+r}for(this.isZero()&&(r="0"+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}assert(!1,"Base should be between 2 and 36")},BN.prototype.toNumber=function toNumber(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&assert(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},BN.prototype.toJSON=function toJSON(){return this.toString(16)},BN.prototype.toBuffer=function toBuffer(e,t){return assert(void 0!==a),this.toArrayLike(a,e,t)},BN.prototype.toArray=function toArray(e,t){return this.toArrayLike(Array,e,t)},BN.prototype.toArrayLike=function toArrayLike(e,t,r){var a=this.byteLength(),n=r||Math.max(1,a);assert(a<=n,"byte array longer than desired length"),assert(n>0,"Requested array length <= 0"),this.strip();var o,s,c="le"===t,d=new e(n),u=this.clone();if(c){for(s=0;!u.isZero();s++)o=u.andln(255),u.iushrn(8),d[s]=o;for(;s=4096&&(r+=13,t>>>=13),t>=64&&(r+=7,t>>>=7),t>=8&&(r+=4,t>>>=4),t>=2&&(r+=2,t>>>=2),r+t},BN.prototype._zeroBits=function _zeroBits(e){if(0===e)return 26;var t=e,r=0;return 0==(8191&t)&&(r+=13,t>>>=13),0==(127&t)&&(r+=7,t>>>=7),0==(15&t)&&(r+=4,t>>>=4),0==(3&t)&&(r+=2,t>>>=2),0==(1&t)&&r++,r},BN.prototype.bitLength=function bitLength(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},BN.prototype.zeroBits=function zeroBits(){if(this.isZero())return 0;for(var e=0,t=0;te.length?this.clone().ior(e):e.clone().ior(this)},BN.prototype.uor=function uor(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},BN.prototype.iuand=function iuand(e){var t;t=this.length>e.length?e:this;for(var r=0;re.length?this.clone().iand(e):e.clone().iand(this)},BN.prototype.uand=function uand(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},BN.prototype.iuxor=function iuxor(e){var t,r;this.length>e.length?(t=this,r=e):(t=e,r=this);for(var a=0;ae.length?this.clone().ixor(e):e.clone().ixor(this)},BN.prototype.uxor=function uxor(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},BN.prototype.inotn=function inotn(e){assert("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),r=e%26;this._expand(t),r>0&&t--;for(var a=0;a0&&(this.words[a]=~this.words[a]&67108863>>26-r),this.strip()},BN.prototype.notn=function notn(e){return this.clone().inotn(e)},BN.prototype.setn=function setn(e,t){assert("number"==typeof e&&e>=0);var r=e/26|0,a=e%26;return this._expand(r+1),this.words[r]=t?this.words[r]|1<e.length?(r=this,a=e):(r=e,a=this);for(var n=0,o=0;o>>26;for(;0!==n&&o>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;oe.length?this.clone().iadd(e):e.clone().iadd(this)},BN.prototype.isub=function isub(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var r,a,n=this.cmp(e);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,a=e):(r=e,a=this);for(var o=0,s=0;s>26,this.words[s]=67108863&t;for(;0!==o&&s>26,this.words[s]=67108863&t;if(0===o&&s>>13,g=0|s[1],p=8191&g,B=g>>>13,m=0|s[2],I=8191&m,y=m>>>13,v=0|s[3],x=8191&v,C=v>>>13,Q=0|s[4],w=8191&Q,_=Q>>>13,k=0|s[5],N=8191&k,D=k>>>13,U=0|s[6],G=8191&U,T=U>>>13,L=0|s[7],P=8191&L,q=L>>>13,O=0|s[8],H=8191&O,Y=O>>>13,j=0|s[9],J=8191&j,z=j>>>13,W=0|c[0],V=8191&W,X=W>>>13,$=0|c[1],et=8191&$,tt=$>>>13,rt=0|c[2],at=8191&rt,it=rt>>>13,nt=0|c[3],ot=8191&nt,At=nt>>>13,st=0|c[4],ct=8191&st,dt=st>>>13,ut=0|c[5],ht=8191&ut,bt=ut>>>13,pt=0|c[6],Bt=8191&pt,mt=pt>>>13,It=0|c[7],Et=8191&It,yt=It>>>13,vt=0|c[8],xt=8191&vt,Ct=vt>>>13,Qt=0|c[9],wt=8191&Qt,Mt=Qt>>>13;r.negative=e.negative^t.negative,r.length=19;var _t=(u+(a=Math.imul(l,V))|0)+((8191&(n=(n=Math.imul(l,X))+Math.imul(b,V)|0))<<13)|0;u=((o=Math.imul(b,X))+(n>>>13)|0)+(_t>>>26)|0,_t&=67108863,a=Math.imul(p,V),n=(n=Math.imul(p,X))+Math.imul(B,V)|0,o=Math.imul(B,X);var kt=(u+(a=a+Math.imul(l,et)|0)|0)+((8191&(n=(n=n+Math.imul(l,tt)|0)+Math.imul(b,et)|0))<<13)|0;u=((o=o+Math.imul(b,tt)|0)+(n>>>13)|0)+(kt>>>26)|0,kt&=67108863,a=Math.imul(I,V),n=(n=Math.imul(I,X))+Math.imul(y,V)|0,o=Math.imul(y,X),a=a+Math.imul(p,et)|0,n=(n=n+Math.imul(p,tt)|0)+Math.imul(B,et)|0,o=o+Math.imul(B,tt)|0;var St=(u+(a=a+Math.imul(l,at)|0)|0)+((8191&(n=(n=n+Math.imul(l,it)|0)+Math.imul(b,at)|0))<<13)|0;u=((o=o+Math.imul(b,it)|0)+(n>>>13)|0)+(St>>>26)|0,St&=67108863,a=Math.imul(x,V),n=(n=Math.imul(x,X))+Math.imul(C,V)|0,o=Math.imul(C,X),a=a+Math.imul(I,et)|0,n=(n=n+Math.imul(I,tt)|0)+Math.imul(y,et)|0,o=o+Math.imul(y,tt)|0,a=a+Math.imul(p,at)|0,n=(n=n+Math.imul(p,it)|0)+Math.imul(B,at)|0,o=o+Math.imul(B,it)|0;var Nt=(u+(a=a+Math.imul(l,ot)|0)|0)+((8191&(n=(n=n+Math.imul(l,At)|0)+Math.imul(b,ot)|0))<<13)|0;u=((o=o+Math.imul(b,At)|0)+(n>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,a=Math.imul(w,V),n=(n=Math.imul(w,X))+Math.imul(_,V)|0,o=Math.imul(_,X),a=a+Math.imul(x,et)|0,n=(n=n+Math.imul(x,tt)|0)+Math.imul(C,et)|0,o=o+Math.imul(C,tt)|0,a=a+Math.imul(I,at)|0,n=(n=n+Math.imul(I,it)|0)+Math.imul(y,at)|0,o=o+Math.imul(y,it)|0,a=a+Math.imul(p,ot)|0,n=(n=n+Math.imul(p,At)|0)+Math.imul(B,ot)|0,o=o+Math.imul(B,At)|0;var Dt=(u+(a=a+Math.imul(l,ct)|0)|0)+((8191&(n=(n=n+Math.imul(l,dt)|0)+Math.imul(b,ct)|0))<<13)|0;u=((o=o+Math.imul(b,dt)|0)+(n>>>13)|0)+(Dt>>>26)|0,Dt&=67108863,a=Math.imul(N,V),n=(n=Math.imul(N,X))+Math.imul(D,V)|0,o=Math.imul(D,X),a=a+Math.imul(w,et)|0,n=(n=n+Math.imul(w,tt)|0)+Math.imul(_,et)|0,o=o+Math.imul(_,tt)|0,a=a+Math.imul(x,at)|0,n=(n=n+Math.imul(x,it)|0)+Math.imul(C,at)|0,o=o+Math.imul(C,it)|0,a=a+Math.imul(I,ot)|0,n=(n=n+Math.imul(I,At)|0)+Math.imul(y,ot)|0,o=o+Math.imul(y,At)|0,a=a+Math.imul(p,ct)|0,n=(n=n+Math.imul(p,dt)|0)+Math.imul(B,ct)|0,o=o+Math.imul(B,dt)|0;var Rt=(u+(a=a+Math.imul(l,ht)|0)|0)+((8191&(n=(n=n+Math.imul(l,bt)|0)+Math.imul(b,ht)|0))<<13)|0;u=((o=o+Math.imul(b,bt)|0)+(n>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,a=Math.imul(G,V),n=(n=Math.imul(G,X))+Math.imul(T,V)|0,o=Math.imul(T,X),a=a+Math.imul(N,et)|0,n=(n=n+Math.imul(N,tt)|0)+Math.imul(D,et)|0,o=o+Math.imul(D,tt)|0,a=a+Math.imul(w,at)|0,n=(n=n+Math.imul(w,it)|0)+Math.imul(_,at)|0,o=o+Math.imul(_,it)|0,a=a+Math.imul(x,ot)|0,n=(n=n+Math.imul(x,At)|0)+Math.imul(C,ot)|0,o=o+Math.imul(C,At)|0,a=a+Math.imul(I,ct)|0,n=(n=n+Math.imul(I,dt)|0)+Math.imul(y,ct)|0,o=o+Math.imul(y,dt)|0,a=a+Math.imul(p,ht)|0,n=(n=n+Math.imul(p,bt)|0)+Math.imul(B,ht)|0,o=o+Math.imul(B,bt)|0;var Ft=(u+(a=a+Math.imul(l,Bt)|0)|0)+((8191&(n=(n=n+Math.imul(l,mt)|0)+Math.imul(b,Bt)|0))<<13)|0;u=((o=o+Math.imul(b,mt)|0)+(n>>>13)|0)+(Ft>>>26)|0,Ft&=67108863,a=Math.imul(P,V),n=(n=Math.imul(P,X))+Math.imul(q,V)|0,o=Math.imul(q,X),a=a+Math.imul(G,et)|0,n=(n=n+Math.imul(G,tt)|0)+Math.imul(T,et)|0,o=o+Math.imul(T,tt)|0,a=a+Math.imul(N,at)|0,n=(n=n+Math.imul(N,it)|0)+Math.imul(D,at)|0,o=o+Math.imul(D,it)|0,a=a+Math.imul(w,ot)|0,n=(n=n+Math.imul(w,At)|0)+Math.imul(_,ot)|0,o=o+Math.imul(_,At)|0,a=a+Math.imul(x,ct)|0,n=(n=n+Math.imul(x,dt)|0)+Math.imul(C,ct)|0,o=o+Math.imul(C,dt)|0,a=a+Math.imul(I,ht)|0,n=(n=n+Math.imul(I,bt)|0)+Math.imul(y,ht)|0,o=o+Math.imul(y,bt)|0,a=a+Math.imul(p,Bt)|0,n=(n=n+Math.imul(p,mt)|0)+Math.imul(B,Bt)|0,o=o+Math.imul(B,mt)|0;var Ut=(u+(a=a+Math.imul(l,Et)|0)|0)+((8191&(n=(n=n+Math.imul(l,yt)|0)+Math.imul(b,Et)|0))<<13)|0;u=((o=o+Math.imul(b,yt)|0)+(n>>>13)|0)+(Ut>>>26)|0,Ut&=67108863,a=Math.imul(H,V),n=(n=Math.imul(H,X))+Math.imul(Y,V)|0,o=Math.imul(Y,X),a=a+Math.imul(P,et)|0,n=(n=n+Math.imul(P,tt)|0)+Math.imul(q,et)|0,o=o+Math.imul(q,tt)|0,a=a+Math.imul(G,at)|0,n=(n=n+Math.imul(G,it)|0)+Math.imul(T,at)|0,o=o+Math.imul(T,it)|0,a=a+Math.imul(N,ot)|0,n=(n=n+Math.imul(N,At)|0)+Math.imul(D,ot)|0,o=o+Math.imul(D,At)|0,a=a+Math.imul(w,ct)|0,n=(n=n+Math.imul(w,dt)|0)+Math.imul(_,ct)|0,o=o+Math.imul(_,dt)|0,a=a+Math.imul(x,ht)|0,n=(n=n+Math.imul(x,bt)|0)+Math.imul(C,ht)|0,o=o+Math.imul(C,bt)|0,a=a+Math.imul(I,Bt)|0,n=(n=n+Math.imul(I,mt)|0)+Math.imul(y,Bt)|0,o=o+Math.imul(y,mt)|0,a=a+Math.imul(p,Et)|0,n=(n=n+Math.imul(p,yt)|0)+Math.imul(B,Et)|0,o=o+Math.imul(B,yt)|0;var Gt=(u+(a=a+Math.imul(l,xt)|0)|0)+((8191&(n=(n=n+Math.imul(l,Ct)|0)+Math.imul(b,xt)|0))<<13)|0;u=((o=o+Math.imul(b,Ct)|0)+(n>>>13)|0)+(Gt>>>26)|0,Gt&=67108863,a=Math.imul(J,V),n=(n=Math.imul(J,X))+Math.imul(z,V)|0,o=Math.imul(z,X),a=a+Math.imul(H,et)|0,n=(n=n+Math.imul(H,tt)|0)+Math.imul(Y,et)|0,o=o+Math.imul(Y,tt)|0,a=a+Math.imul(P,at)|0,n=(n=n+Math.imul(P,it)|0)+Math.imul(q,at)|0,o=o+Math.imul(q,it)|0,a=a+Math.imul(G,ot)|0,n=(n=n+Math.imul(G,At)|0)+Math.imul(T,ot)|0,o=o+Math.imul(T,At)|0,a=a+Math.imul(N,ct)|0,n=(n=n+Math.imul(N,dt)|0)+Math.imul(D,ct)|0,o=o+Math.imul(D,dt)|0,a=a+Math.imul(w,ht)|0,n=(n=n+Math.imul(w,bt)|0)+Math.imul(_,ht)|0,o=o+Math.imul(_,bt)|0,a=a+Math.imul(x,Bt)|0,n=(n=n+Math.imul(x,mt)|0)+Math.imul(C,Bt)|0,o=o+Math.imul(C,mt)|0,a=a+Math.imul(I,Et)|0,n=(n=n+Math.imul(I,yt)|0)+Math.imul(y,Et)|0,o=o+Math.imul(y,yt)|0,a=a+Math.imul(p,xt)|0,n=(n=n+Math.imul(p,Ct)|0)+Math.imul(B,xt)|0,o=o+Math.imul(B,Ct)|0;var Tt=(u+(a=a+Math.imul(l,wt)|0)|0)+((8191&(n=(n=n+Math.imul(l,Mt)|0)+Math.imul(b,wt)|0))<<13)|0;u=((o=o+Math.imul(b,Mt)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,a=Math.imul(J,et),n=(n=Math.imul(J,tt))+Math.imul(z,et)|0,o=Math.imul(z,tt),a=a+Math.imul(H,at)|0,n=(n=n+Math.imul(H,it)|0)+Math.imul(Y,at)|0,o=o+Math.imul(Y,it)|0,a=a+Math.imul(P,ot)|0,n=(n=n+Math.imul(P,At)|0)+Math.imul(q,ot)|0,o=o+Math.imul(q,At)|0,a=a+Math.imul(G,ct)|0,n=(n=n+Math.imul(G,dt)|0)+Math.imul(T,ct)|0,o=o+Math.imul(T,dt)|0,a=a+Math.imul(N,ht)|0,n=(n=n+Math.imul(N,bt)|0)+Math.imul(D,ht)|0,o=o+Math.imul(D,bt)|0,a=a+Math.imul(w,Bt)|0,n=(n=n+Math.imul(w,mt)|0)+Math.imul(_,Bt)|0,o=o+Math.imul(_,mt)|0,a=a+Math.imul(x,Et)|0,n=(n=n+Math.imul(x,yt)|0)+Math.imul(C,Et)|0,o=o+Math.imul(C,yt)|0,a=a+Math.imul(I,xt)|0,n=(n=n+Math.imul(I,Ct)|0)+Math.imul(y,xt)|0,o=o+Math.imul(y,Ct)|0;var Lt=(u+(a=a+Math.imul(p,wt)|0)|0)+((8191&(n=(n=n+Math.imul(p,Mt)|0)+Math.imul(B,wt)|0))<<13)|0;u=((o=o+Math.imul(B,Mt)|0)+(n>>>13)|0)+(Lt>>>26)|0,Lt&=67108863,a=Math.imul(J,at),n=(n=Math.imul(J,it))+Math.imul(z,at)|0,o=Math.imul(z,it),a=a+Math.imul(H,ot)|0,n=(n=n+Math.imul(H,At)|0)+Math.imul(Y,ot)|0,o=o+Math.imul(Y,At)|0,a=a+Math.imul(P,ct)|0,n=(n=n+Math.imul(P,dt)|0)+Math.imul(q,ct)|0,o=o+Math.imul(q,dt)|0,a=a+Math.imul(G,ht)|0,n=(n=n+Math.imul(G,bt)|0)+Math.imul(T,ht)|0,o=o+Math.imul(T,bt)|0,a=a+Math.imul(N,Bt)|0,n=(n=n+Math.imul(N,mt)|0)+Math.imul(D,Bt)|0,o=o+Math.imul(D,mt)|0,a=a+Math.imul(w,Et)|0,n=(n=n+Math.imul(w,yt)|0)+Math.imul(_,Et)|0,o=o+Math.imul(_,yt)|0,a=a+Math.imul(x,xt)|0,n=(n=n+Math.imul(x,Ct)|0)+Math.imul(C,xt)|0,o=o+Math.imul(C,Ct)|0;var Pt=(u+(a=a+Math.imul(I,wt)|0)|0)+((8191&(n=(n=n+Math.imul(I,Mt)|0)+Math.imul(y,wt)|0))<<13)|0;u=((o=o+Math.imul(y,Mt)|0)+(n>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,a=Math.imul(J,ot),n=(n=Math.imul(J,At))+Math.imul(z,ot)|0,o=Math.imul(z,At),a=a+Math.imul(H,ct)|0,n=(n=n+Math.imul(H,dt)|0)+Math.imul(Y,ct)|0,o=o+Math.imul(Y,dt)|0,a=a+Math.imul(P,ht)|0,n=(n=n+Math.imul(P,bt)|0)+Math.imul(q,ht)|0,o=o+Math.imul(q,bt)|0,a=a+Math.imul(G,Bt)|0,n=(n=n+Math.imul(G,mt)|0)+Math.imul(T,Bt)|0,o=o+Math.imul(T,mt)|0,a=a+Math.imul(N,Et)|0,n=(n=n+Math.imul(N,yt)|0)+Math.imul(D,Et)|0,o=o+Math.imul(D,yt)|0,a=a+Math.imul(w,xt)|0,n=(n=n+Math.imul(w,Ct)|0)+Math.imul(_,xt)|0,o=o+Math.imul(_,Ct)|0;var qt=(u+(a=a+Math.imul(x,wt)|0)|0)+((8191&(n=(n=n+Math.imul(x,Mt)|0)+Math.imul(C,wt)|0))<<13)|0;u=((o=o+Math.imul(C,Mt)|0)+(n>>>13)|0)+(qt>>>26)|0,qt&=67108863,a=Math.imul(J,ct),n=(n=Math.imul(J,dt))+Math.imul(z,ct)|0,o=Math.imul(z,dt),a=a+Math.imul(H,ht)|0,n=(n=n+Math.imul(H,bt)|0)+Math.imul(Y,ht)|0,o=o+Math.imul(Y,bt)|0,a=a+Math.imul(P,Bt)|0,n=(n=n+Math.imul(P,mt)|0)+Math.imul(q,Bt)|0,o=o+Math.imul(q,mt)|0,a=a+Math.imul(G,Et)|0,n=(n=n+Math.imul(G,yt)|0)+Math.imul(T,Et)|0,o=o+Math.imul(T,yt)|0,a=a+Math.imul(N,xt)|0,n=(n=n+Math.imul(N,Ct)|0)+Math.imul(D,xt)|0,o=o+Math.imul(D,Ct)|0;var Ot=(u+(a=a+Math.imul(w,wt)|0)|0)+((8191&(n=(n=n+Math.imul(w,Mt)|0)+Math.imul(_,wt)|0))<<13)|0;u=((o=o+Math.imul(_,Mt)|0)+(n>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,a=Math.imul(J,ht),n=(n=Math.imul(J,bt))+Math.imul(z,ht)|0,o=Math.imul(z,bt),a=a+Math.imul(H,Bt)|0,n=(n=n+Math.imul(H,mt)|0)+Math.imul(Y,Bt)|0,o=o+Math.imul(Y,mt)|0,a=a+Math.imul(P,Et)|0,n=(n=n+Math.imul(P,yt)|0)+Math.imul(q,Et)|0,o=o+Math.imul(q,yt)|0,a=a+Math.imul(G,xt)|0,n=(n=n+Math.imul(G,Ct)|0)+Math.imul(T,xt)|0,o=o+Math.imul(T,Ct)|0;var Ht=(u+(a=a+Math.imul(N,wt)|0)|0)+((8191&(n=(n=n+Math.imul(N,Mt)|0)+Math.imul(D,wt)|0))<<13)|0;u=((o=o+Math.imul(D,Mt)|0)+(n>>>13)|0)+(Ht>>>26)|0,Ht&=67108863,a=Math.imul(J,Bt),n=(n=Math.imul(J,mt))+Math.imul(z,Bt)|0,o=Math.imul(z,mt),a=a+Math.imul(H,Et)|0,n=(n=n+Math.imul(H,yt)|0)+Math.imul(Y,Et)|0,o=o+Math.imul(Y,yt)|0,a=a+Math.imul(P,xt)|0,n=(n=n+Math.imul(P,Ct)|0)+Math.imul(q,xt)|0,o=o+Math.imul(q,Ct)|0;var Yt=(u+(a=a+Math.imul(G,wt)|0)|0)+((8191&(n=(n=n+Math.imul(G,Mt)|0)+Math.imul(T,wt)|0))<<13)|0;u=((o=o+Math.imul(T,Mt)|0)+(n>>>13)|0)+(Yt>>>26)|0,Yt&=67108863,a=Math.imul(J,Et),n=(n=Math.imul(J,yt))+Math.imul(z,Et)|0,o=Math.imul(z,yt),a=a+Math.imul(H,xt)|0,n=(n=n+Math.imul(H,Ct)|0)+Math.imul(Y,xt)|0,o=o+Math.imul(Y,Ct)|0;var jt=(u+(a=a+Math.imul(P,wt)|0)|0)+((8191&(n=(n=n+Math.imul(P,Mt)|0)+Math.imul(q,wt)|0))<<13)|0;u=((o=o+Math.imul(q,Mt)|0)+(n>>>13)|0)+(jt>>>26)|0,jt&=67108863,a=Math.imul(J,xt),n=(n=Math.imul(J,Ct))+Math.imul(z,xt)|0,o=Math.imul(z,Ct);var Jt=(u+(a=a+Math.imul(H,wt)|0)|0)+((8191&(n=(n=n+Math.imul(H,Mt)|0)+Math.imul(Y,wt)|0))<<13)|0;u=((o=o+Math.imul(Y,Mt)|0)+(n>>>13)|0)+(Jt>>>26)|0,Jt&=67108863;var Kt=(u+(a=Math.imul(J,wt))|0)+((8191&(n=(n=Math.imul(J,Mt))+Math.imul(z,wt)|0))<<13)|0;return u=((o=Math.imul(z,Mt))+(n>>>13)|0)+(Kt>>>26)|0,Kt&=67108863,d[0]=_t,d[1]=kt,d[2]=St,d[3]=Nt,d[4]=Dt,d[5]=Rt,d[6]=Ft,d[7]=Ut,d[8]=Gt,d[9]=Tt,d[10]=Lt,d[11]=Pt,d[12]=qt,d[13]=Ot,d[14]=Ht,d[15]=Yt,d[16]=jt,d[17]=Jt,d[18]=Kt,0!==u&&(d[19]=u,r.length++),r};function jumboMulTo(e,t,r){return(new FFTM).mulp(e,t,r)}function FFTM(e,t){this.x=e,this.y=t}Math.imul||(c=smallMulTo),BN.prototype.mulTo=function mulTo(e,t){var r=this.length+e.length;return 10===this.length&&10===e.length?c(this,e,t):r<63?smallMulTo(this,e,t):r<1024?function bigMulTo(e,t,r){r.negative=t.negative^e.negative,r.length=e.length+t.length;for(var a=0,n=0,o=0;o>>26)|0)>>>26,s&=67108863}r.words[o]=c,a=s,s=n}return 0!==a?r.words[o]=a:r.length--,r.strip()}(this,e,t):jumboMulTo(this,e,t)},FFTM.prototype.makeRBT=function makeRBT(e){for(var t=new Array(e),r=BN.prototype._countBits(e)-1,a=0;a>=1;return a},FFTM.prototype.permute=function permute(e,t,r,a,n,o){for(var s=0;s>>=1)n++;return 1<>>=13,r[2*o+1]=8191&n,n>>>=13;for(o=2*t;o>=26,t+=a/67108864|0,t+=n>>>26,this.words[r]=67108863&n}return 0!==t&&(this.words[r]=t,this.length++),this},BN.prototype.muln=function muln(e){return this.clone().imuln(e)},BN.prototype.sqr=function sqr(){return this.mul(this)},BN.prototype.isqr=function isqr(){return this.imul(this.clone())},BN.prototype.pow=function pow(e){var t=function toBitArray(e){for(var t=new Array(e.bitLength()),r=0;r>>n}return t}(e);if(0===t.length)return new BN(1);for(var r=this,a=0;a=0);var t,r=e%26,a=(e-r)/26,n=67108863>>>26-r<<26-r;if(0!==r){var o=0;for(t=0;t>>26-r}o&&(this.words[t]=o,this.length++)}if(0!==a){for(t=this.length-1;t>=0;t--)this.words[t+a]=this.words[t];for(t=0;t=0),a=t?(t-t%26)/26:0;var n=e%26,o=Math.min((e-n)/26,this.length),s=67108863^67108863>>>n<o)for(this.length-=o,d=0;d=0&&(0!==u||d>=a);d--){var h=0|this.words[d];this.words[d]=u<<26-n|h>>>n,u=h&s}return c&&0!==u&&(c.words[c.length++]=u),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},BN.prototype.ishrn=function ishrn(e,t,r){return assert(0===this.negative),this.iushrn(e,t,r)},BN.prototype.shln=function shln(e){return this.clone().ishln(e)},BN.prototype.ushln=function ushln(e){return this.clone().iushln(e)},BN.prototype.shrn=function shrn(e){return this.clone().ishrn(e)},BN.prototype.ushrn=function ushrn(e){return this.clone().iushrn(e)},BN.prototype.testn=function testn(e){assert("number"==typeof e&&e>=0);var t=e%26,r=(e-t)/26,a=1<=0);var t=e%26,r=(e-t)/26;if(assert(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==t&&r++,this.length=Math.min(r,this.length),0!==t){var a=67108863^67108863>>>t<=67108864;t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},BN.prototype.isubn=function isubn(e){if(assert("number"==typeof e),assert(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t>26)-(c/67108864|0),this.words[a+r]=67108863&n}for(;a>26,this.words[a+r]=67108863&n;if(0===s)return this.strip();for(assert(-1===s),s=0,a=0;a>26,this.words[a]=67108863&n;return this.negative=1,this.strip()},BN.prototype._wordDiv=function _wordDiv(e,t){var r=(this.length,e.length),a=this.clone(),n=e,o=0|n.words[n.length-1];0!==(r=26-this._countBits(o))&&(n=n.ushln(r),a.iushln(r),o=0|n.words[n.length-1]);var s,c=a.length-n.length;if("mod"!==t){(s=new BN(null)).length=c+1,s.words=new Array(s.length);for(var d=0;d=0;h--){var l=67108864*(0|a.words[n.length+h])+(0|a.words[n.length+h-1]);for(l=Math.min(l/o|0,67108863),a._ishlnsubmul(n,l,h);0!==a.negative;)l--,a.negative=0,a._ishlnsubmul(n,1,h),a.isZero()||(a.negative^=1);s&&(s.words[h]=l)}return s&&s.strip(),a.strip(),"div"!==t&&0!==r&&a.iushrn(r),{div:s||null,mod:a}},BN.prototype.divmod=function divmod(e,t,r){return assert(!e.isZero()),this.isZero()?{div:new BN(0),mod:new BN(0)}:0!==this.negative&&0===e.negative?(o=this.neg().divmod(e,t),"mod"!==t&&(a=o.div.neg()),"div"!==t&&(n=o.mod.neg(),r&&0!==n.negative&&n.iadd(e)),{div:a,mod:n}):0===this.negative&&0!==e.negative?(o=this.divmod(e.neg(),t),"mod"!==t&&(a=o.div.neg()),{div:a,mod:o.mod}):0!=(this.negative&e.negative)?(o=this.neg().divmod(e.neg(),t),"div"!==t&&(n=o.mod.neg(),r&&0!==n.negative&&n.isub(e)),{div:o.div,mod:n}):e.length>this.length||this.cmp(e)<0?{div:new BN(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new BN(this.modn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new BN(this.modn(e.words[0]))}:this._wordDiv(e,t);var a,n,o},BN.prototype.div=function div(e){return this.divmod(e,"div",!1).div},BN.prototype.mod=function mod(e){return this.divmod(e,"mod",!1).mod},BN.prototype.umod=function umod(e){return this.divmod(e,"mod",!0).mod},BN.prototype.divRound=function divRound(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var r=0!==t.div.negative?t.mod.isub(e):t.mod,a=e.ushrn(1),n=e.andln(1),o=r.cmp(a);return o<0||1===n&&0===o?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},BN.prototype.modn=function modn(e){assert(e<=67108863);for(var t=(1<<26)%e,r=0,a=this.length-1;a>=0;a--)r=(t*r+(0|this.words[a]))%e;return r},BN.prototype.idivn=function idivn(e){assert(e<=67108863);for(var t=0,r=this.length-1;r>=0;r--){var a=(0|this.words[r])+67108864*t;this.words[r]=a/e|0,t=a%e}return this.strip()},BN.prototype.divn=function divn(e){return this.clone().idivn(e)},BN.prototype.egcd=function egcd(e){assert(0===e.negative),assert(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var a=new BN(1),n=new BN(0),o=new BN(0),s=new BN(1),c=0;t.isEven()&&r.isEven();)t.iushrn(1),r.iushrn(1),++c;for(var d=r.clone(),u=t.clone();!t.isZero();){for(var h=0,l=1;0==(t.words[0]&l)&&h<26;++h,l<<=1);if(h>0)for(t.iushrn(h);h-- >0;)(a.isOdd()||n.isOdd())&&(a.iadd(d),n.isub(u)),a.iushrn(1),n.iushrn(1);for(var b=0,g=1;0==(r.words[0]&g)&&b<26;++b,g<<=1);if(b>0)for(r.iushrn(b);b-- >0;)(o.isOdd()||s.isOdd())&&(o.iadd(d),s.isub(u)),o.iushrn(1),s.iushrn(1);t.cmp(r)>=0?(t.isub(r),a.isub(o),n.isub(s)):(r.isub(t),o.isub(a),s.isub(n))}return{a:o,b:s,gcd:r.iushln(c)}},BN.prototype._invmp=function _invmp(e){assert(0===e.negative),assert(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var a,n=new BN(1),o=new BN(0),s=r.clone();t.cmpn(1)>0&&r.cmpn(1)>0;){for(var c=0,d=1;0==(t.words[0]&d)&&c<26;++c,d<<=1);if(c>0)for(t.iushrn(c);c-- >0;)n.isOdd()&&n.iadd(s),n.iushrn(1);for(var u=0,h=1;0==(r.words[0]&h)&&u<26;++u,h<<=1);if(u>0)for(r.iushrn(u);u-- >0;)o.isOdd()&&o.iadd(s),o.iushrn(1);t.cmp(r)>=0?(t.isub(r),n.isub(o)):(r.isub(t),o.isub(n))}return(a=0===t.cmpn(1)?n:o).cmpn(0)<0&&a.iadd(e),a},BN.prototype.gcd=function gcd(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),r=e.clone();t.negative=0,r.negative=0;for(var a=0;t.isEven()&&r.isEven();a++)t.iushrn(1),r.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=t.cmp(r);if(n<0){var o=t;t=r,r=o}else if(0===n||0===r.cmpn(1))break;t.isub(r)}return r.iushln(a)},BN.prototype.invm=function invm(e){return this.egcd(e).a.umod(e)},BN.prototype.isEven=function isEven(){return 0==(1&this.words[0])},BN.prototype.isOdd=function isOdd(){return 1==(1&this.words[0])},BN.prototype.andln=function andln(e){return this.words[0]&e},BN.prototype.bincn=function bincn(e){assert("number"==typeof e);var t=e%26,r=(e-t)/26,a=1<>>26,s&=67108863,this.words[o]=s}return 0!==n&&(this.words[o]=n,this.length++),this},BN.prototype.isZero=function isZero(){return 1===this.length&&0===this.words[0]},BN.prototype.cmpn=function cmpn(e){var t,r=e<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this.strip(),this.length>1)t=1;else{r&&(e=-e),assert(e<=67108863,"Number is too big");var a=0|this.words[0];t=a===e?0:ae.length)return 1;if(this.length=0;r--){var a=0|this.words[r],n=0|e.words[r];if(a!==n){an&&(t=1);break}}return t},BN.prototype.gtn=function gtn(e){return 1===this.cmpn(e)},BN.prototype.gt=function gt(e){return 1===this.cmp(e)},BN.prototype.gten=function gten(e){return this.cmpn(e)>=0},BN.prototype.gte=function gte(e){return this.cmp(e)>=0},BN.prototype.ltn=function ltn(e){return-1===this.cmpn(e)},BN.prototype.lt=function lt(e){return-1===this.cmp(e)},BN.prototype.lten=function lten(e){return this.cmpn(e)<=0},BN.prototype.lte=function lte(e){return this.cmp(e)<=0},BN.prototype.eqn=function eqn(e){return 0===this.cmpn(e)},BN.prototype.eq=function eq(e){return 0===this.cmp(e)},BN.red=function red(e){return new Red(e)},BN.prototype.toRed=function toRed(e){return assert(!this.red,"Already a number in reduction context"),assert(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},BN.prototype.fromRed=function fromRed(){return assert(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},BN.prototype._forceRed=function _forceRed(e){return this.red=e,this},BN.prototype.forceRed=function forceRed(e){return assert(!this.red,"Already a number in reduction context"),this._forceRed(e)},BN.prototype.redAdd=function redAdd(e){return assert(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},BN.prototype.redIAdd=function redIAdd(e){return assert(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},BN.prototype.redSub=function redSub(e){return assert(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},BN.prototype.redISub=function redISub(e){return assert(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},BN.prototype.redShl=function redShl(e){return assert(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},BN.prototype.redMul=function redMul(e){return assert(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},BN.prototype.redIMul=function redIMul(e){return assert(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},BN.prototype.redSqr=function redSqr(){return assert(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},BN.prototype.redISqr=function redISqr(){return assert(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},BN.prototype.redSqrt=function redSqrt(){return assert(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},BN.prototype.redInvm=function redInvm(){return assert(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},BN.prototype.redNeg=function redNeg(){return assert(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},BN.prototype.redPow=function redPow(e){return assert(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var d={k256:null,p224:null,p192:null,p25519:null};function MPrime(e,t){this.name=e,this.p=new BN(t,16),this.n=this.p.bitLength(),this.k=new BN(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function K256(){MPrime.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function P224(){MPrime.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function P192(){MPrime.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function P25519(){MPrime.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function Red(e){if("string"==typeof e){var t=BN._prime(e);this.m=t.p,this.prime=t}else assert(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function Mont(e){Red.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new BN(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)}MPrime.prototype._tmp=function _tmp(){var e=new BN(null);return e.words=new Array(Math.ceil(this.n/13)),e},MPrime.prototype.ireduce=function ireduce(e){var t,r=e;do{this.split(r,this.tmp),t=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(t>this.n);var a=t0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},MPrime.prototype.split=function split(e,t){e.iushrn(this.n,0,t)},MPrime.prototype.imulK=function imulK(e){return e.imul(this.k)},inherits(K256,MPrime),K256.prototype.split=function split(e,t){for(var r=4194303,a=Math.min(e.length,9),n=0;n>>22,o=s}o>>>=22,e.words[n-10]=o,0===o&&e.length>10?e.length-=10:e.length-=9},K256.prototype.imulK=function imulK(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,r=0;r>>=26,e.words[r]=n,t=a}return 0!==t&&(e.words[e.length++]=t),e},BN._prime=function prime(e){if(d[e])return d[e];var prime;if("k256"===e)prime=new K256;else if("p224"===e)prime=new P224;else if("p192"===e)prime=new P192;else{if("p25519"!==e)throw new Error("Unknown prime "+e);prime=new P25519}return d[e]=prime,prime},Red.prototype._verify1=function _verify1(e){assert(0===e.negative,"red works only with positives"),assert(e.red,"red works only with red numbers")},Red.prototype._verify2=function _verify2(e,t){assert(0==(e.negative|t.negative),"red works only with positives"),assert(e.red&&e.red===t.red,"red works only with red numbers")},Red.prototype.imod=function imod(e){return this.prime?this.prime.ireduce(e)._forceRed(this):e.umod(this.m)._forceRed(this)},Red.prototype.neg=function neg(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},Red.prototype.add=function add(e,t){this._verify2(e,t);var r=e.add(t);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},Red.prototype.iadd=function iadd(e,t){this._verify2(e,t);var r=e.iadd(t);return r.cmp(this.m)>=0&&r.isub(this.m),r},Red.prototype.sub=function sub(e,t){this._verify2(e,t);var r=e.sub(t);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},Red.prototype.isub=function isub(e,t){this._verify2(e,t);var r=e.isub(t);return r.cmpn(0)<0&&r.iadd(this.m),r},Red.prototype.shl=function shl(e,t){return this._verify1(e),this.imod(e.ushln(t))},Red.prototype.imul=function imul(e,t){return this._verify2(e,t),this.imod(e.imul(t))},Red.prototype.mul=function mul(e,t){return this._verify2(e,t),this.imod(e.mul(t))},Red.prototype.isqr=function isqr(e){return this.imul(e,e.clone())},Red.prototype.sqr=function sqr(e){return this.mul(e,e)},Red.prototype.sqrt=function sqrt(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(assert(t%2==1),3===t){var r=this.m.add(new BN(1)).iushrn(2);return this.pow(e,r)}for(var a=this.m.subn(1),n=0;!a.isZero()&&0===a.andln(1);)n++,a.iushrn(1);assert(!a.isZero());var o=new BN(1).toRed(this),s=o.redNeg(),c=this.m.subn(1).iushrn(1),d=this.m.bitLength();for(d=new BN(2*d*d).toRed(this);0!==this.pow(d,c).cmp(s);)d.redIAdd(s);for(var u=this.pow(d,a),h=this.pow(e,a.addn(1).iushrn(1)),l=this.pow(e,a),b=n;0!==l.cmp(o);){for(var g=l,p=0;0!==g.cmp(o);p++)g=g.redSqr();assert(p=0;a--){for(var d=t.words[a],u=c-1;u>=0;u--){var h=d>>u&1;n!==r[0]&&(n=this.sqr(n)),0!==h||0!==o?(o<<=1,o|=h,(4===++s||0===a&&0===u)&&(n=this.mul(n,r[o]),s=0,o=0)):s=0}c=26}return n},Red.prototype.convertTo=function convertTo(e){var t=e.umod(this.m);return t===e?t.clone():t},Red.prototype.convertFrom=function convertFrom(e){var t=e.clone();return t.red=null,t},BN.mont=function mont(e){return new Mont(e)},inherits(Mont,Red),Mont.prototype.convertTo=function convertTo(e){return this.imod(e.ushln(this.shift))},Mont.prototype.convertFrom=function convertFrom(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},Mont.prototype.imul=function imul(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var r=e.imul(t),a=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(a).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},Mont.prototype.mul=function mul(e,t){if(e.isZero()||t.isZero())return new BN(0)._forceRed(this);var r=e.mul(t),a=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(a).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},Mont.prototype.invm=function invm(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(e=r.nmd(e),this)},(e,t,r)=>{e.exports=r(849)(r(850))},(e,t)=>{"use strict";var r=t;function zero2(e){return 1===e.length?"0"+e:e}function toHex(e){for(var t="",r=0;r>8,s=255&n;o?r.push(o,s):r.push(s)}return r},r.zero2=zero2,r.toHex=toHex,r.encode=function encode(e,t){return"hex"===t?toHex(e):e}},(e,t,r)=>{var a;function Rand(e){this.rand=e}if(e.exports=function rand(e){return a||(a=new Rand(null)),a.generate(e)},e.exports.Rand=Rand,Rand.prototype.generate=function generate(e){return this._rand(e)},Rand.prototype._rand=function _rand(e){if(this.rand.getBytes)return this.rand.getBytes(e);for(var t=new Uint8Array(e),r=0;r{"use strict";var a=t;a.base=r(275),a.short=r(852),a.mont=r(853),a.edwards=r(854)},(e,t,r)=>{"use strict";var a=r(111),n=r(276),o=r(856),s=r(159),c=a.sum32,d=a.sum32_4,u=a.sum32_5,h=o.ch32,l=o.maj32,b=o.s0_256,g=o.s1_256,p=o.g0_256,B=o.g1_256,m=n.BlockHash,I=[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 SHA256(){if(!(this instanceof SHA256))return new SHA256;m.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=I,this.W=new Array(64)}a.inherits(SHA256,m),e.exports=SHA256,SHA256.blockSize=512,SHA256.outSize=256,SHA256.hmacStrength=192,SHA256.padLength=64,SHA256.prototype._update=function _update(e,t){for(var r=this.W,a=0;a<16;a++)r[a]=e[t+a];for(;a{"use strict";var a=r(111),n=r(276),o=r(159),s=a.rotr64_hi,c=a.rotr64_lo,d=a.shr64_hi,u=a.shr64_lo,h=a.sum64,l=a.sum64_hi,b=a.sum64_lo,g=a.sum64_4_hi,p=a.sum64_4_lo,B=a.sum64_5_hi,m=a.sum64_5_lo,I=n.BlockHash,y=[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 SHA512(){if(!(this instanceof SHA512))return new SHA512;I.call(this),this.h=[1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209],this.k=y,this.W=new Array(160)}function ch64_hi(e,t,r,a,n){var o=e&r^~e&n;return o<0&&(o+=4294967296),o}function ch64_lo(e,t,r,a,n,o){var s=t&a^~t&o;return s<0&&(s+=4294967296),s}function maj64_hi(e,t,r,a,n){var o=e&r^e&n^r&n;return o<0&&(o+=4294967296),o}function maj64_lo(e,t,r,a,n,o){var s=t&a^t&o^a&o;return s<0&&(s+=4294967296),s}function s0_512_hi(e,t){var r=s(e,t,28)^s(t,e,2)^s(t,e,7);return r<0&&(r+=4294967296),r}function s0_512_lo(e,t){var r=c(e,t,28)^c(t,e,2)^c(t,e,7);return r<0&&(r+=4294967296),r}function s1_512_hi(e,t){var r=s(e,t,14)^s(e,t,18)^s(t,e,9);return r<0&&(r+=4294967296),r}function s1_512_lo(e,t){var r=c(e,t,14)^c(e,t,18)^c(t,e,9);return r<0&&(r+=4294967296),r}function g0_512_hi(e,t){var r=s(e,t,1)^s(e,t,8)^d(e,t,7);return r<0&&(r+=4294967296),r}function g0_512_lo(e,t){var r=c(e,t,1)^c(e,t,8)^u(e,t,7);return r<0&&(r+=4294967296),r}function g1_512_hi(e,t){var r=s(e,t,19)^s(t,e,29)^d(e,t,6);return r<0&&(r+=4294967296),r}function g1_512_lo(e,t){var r=c(e,t,19)^c(t,e,29)^u(e,t,6);return r<0&&(r+=4294967296),r}a.inherits(SHA512,I),e.exports=SHA512,SHA512.blockSize=1024,SHA512.outSize=512,SHA512.hmacStrength=192,SHA512.padLength=128,SHA512.prototype._prepareBlock=function _prepareBlock(e,t){for(var r=this.W,a=0;a<32;a++)r[a]=e[t+a];for(;a{"use strict";var a=r(1),n=65536,o=4294967295;var s=r(58).Buffer,c=r.g.crypto||r.g.msCrypto;c&&c.getRandomValues?e.exports=function randomBytes(e,t){if(e>o)throw new RangeError("requested too many random bytes");var r=s.allocUnsafe(e);if(e>0)if(e>n)for(var d=0;d{e.exports=function isHexPrefixed(e){if("string"!=typeof e)throw new Error("[is-hex-prefixed] value must be type 'string', is currently type "+typeof e+", while checking isHexPrefixed.");return"0x"===e.slice(0,2)}},(e,t,r)=>{"use strict";var a=r(58).Buffer,n=r(347).Transform;function HashBase(e){n.call(this),this._block=a.allocUnsafe(e),this._blockSize=e,this._blockOffset=0,this._length=[0,0,0,0],this._finalized=!1}r(22)(HashBase,n),HashBase.prototype._transform=function(e,t,r){var a=null;try{this.update(e,t)}catch(e){a=e}r(a)},HashBase.prototype._flush=function(e){var t=null;try{this.push(this.digest())}catch(e){t=e}e(t)},HashBase.prototype.update=function(e,t){if(function throwIfNotStringOrBuffer(e,t){if(!a.isBuffer(e)&&"string"!=typeof e)throw new TypeError(t+" must be a string or a buffer")}(e,"Data"),this._finalized)throw new Error("Digest already called");a.isBuffer(e)||(e=a.from(e,t));for(var r=this._block,n=0;this._blockOffset+e.length-n>=this._blockSize;){for(var o=this._blockOffset;o0;++s)this._length[s]+=c,(c=this._length[s]/4294967296|0)>0&&(this._length[s]-=4294967296*c);return this},HashBase.prototype._update=function(){throw new Error("_update is not implemented")},HashBase.prototype.digest=function(e){if(this._finalized)throw new Error("Digest already called");this._finalized=!0;var t=this._digest();void 0!==e&&(t=t.toString(e)),this._block.fill(0),this._blockOffset=0;for(var r=0;r<4;++r)this._length[r]=0;return t},HashBase.prototype._digest=function(){throw new Error("_digest is not implemented")},e.exports=HashBase},(e,t,r)=>{"use strict";var a,n=r(1);e.exports=Readable,Readable.ReadableState=ReadableState;r(32).EventEmitter;var o=function EElistenerCount(e,t){return e.listeners(t).length},s=r(876),c=r(4).Buffer,d=r.g.Uint8Array||function(){};var u,h=r(85);u=h&&h.debuglog?h.debuglog("stream"):function debug(){};var l,b,g,p=r(877),B=r(512),m=r(513).getHighWaterMark,I=r(237).a,y=I.ERR_INVALID_ARG_TYPE,v=I.ERR_STREAM_PUSH_AFTER_EOF,x=I.ERR_METHOD_NOT_IMPLEMENTED,C=I.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;r(22)(Readable,s);var Q=B.errorOrDestroy,w=["error","close","destroy","pause","resume"];function ReadableState(e,t,n){a=a||r(187),e=e||{},"boolean"!=typeof n&&(n=t instanceof a),this.objectMode=!!e.objectMode,n&&(this.objectMode=this.objectMode||!!e.readableObjectMode),this.highWaterMark=m(this,e,"readableHighWaterMark",n),this.buffer=new p,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&&(l||(l=r(515).a),this.decoder=new l(e.encoding),this.encoding=e.encoding)}function Readable(e){if(a=a||r(187),!(this instanceof Readable))return new Readable(e);var t=this instanceof a;this._readableState=new ReadableState(e,this,t),this.readable=!0,e&&("function"==typeof e.read&&(this._read=e.read),"function"==typeof e.destroy&&(this._destroy=e.destroy)),s.call(this)}function readableAddChunk(e,t,r,a,n){u("readableAddChunk",t);var o,s=e._readableState;if(null===t)s.reading=!1,function onEofChunk(e,t){if(u("onEofChunk"),t.ended)return;if(t.decoder){var r=t.decoder.end();r&&r.length&&(t.buffer.push(r),t.length+=t.objectMode?1:r.length)}t.ended=!0,t.sync?emitReadable(e):(t.needReadable=!1,t.emittedReadable||(t.emittedReadable=!0,emitReadable_(e)))}(e,s);else if(n||(o=function chunkInvalid(e,t){var r;(function _isUint8Array(e){return c.isBuffer(e)||e instanceof d})(t)||"string"==typeof t||void 0===t||e.objectMode||(r=new y("chunk",["string","Buffer","Uint8Array"],t));return r}(s,t)),o)Q(e,o);else if(s.objectMode||t&&t.length>0)if("string"==typeof t||s.objectMode||Object.getPrototypeOf(t)===c.prototype||(t=function _uint8ArrayToBuffer(e){return c.from(e)}(t)),a)s.endEmitted?Q(e,new C):addChunk(e,s,t,!0);else if(s.ended)Q(e,new v);else{if(s.destroyed)return!1;s.reading=!1,s.decoder&&!r?(t=s.decoder.write(t),s.objectMode||0!==t.length?addChunk(e,s,t,!1):maybeReadMore(e,s)):addChunk(e,s,t,!1)}else a||(s.reading=!1,maybeReadMore(e,s));return!s.ended&&(s.lengtht.highWaterMark&&(t.highWaterMark=function computeNewHighWaterMark(e){return e>=_?e=_:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function emitReadable(e){var t=e._readableState;u("emitReadable",t.needReadable,t.emittedReadable),t.needReadable=!1,t.emittedReadable||(u("emitReadable",t.flowing),t.emittedReadable=!0,n.nextTick(emitReadable_,e))}function emitReadable_(e){var t=e._readableState;u("emitReadable_",t.destroyed,t.length,t.ended),t.destroyed||!t.length&&!t.ended||(e.emit("readable"),t.emittedReadable=!1),t.needReadable=!t.flowing&&!t.ended&&t.length<=t.highWaterMark,flow(e)}function maybeReadMore(e,t){t.readingMore||(t.readingMore=!0,n.nextTick(maybeReadMore_,e,t))}function maybeReadMore_(e,t){for(;!t.reading&&!t.ended&&(t.length0,t.resumeScheduled&&!t.paused?t.flowing=!0:e.listenerCount("data")>0&&e.resume()}function nReadingNextTick(e){u("readable nexttick read 0"),e.read(0)}function resume_(e,t){u("resume",t.reading),t.reading||e.read(0),t.resumeScheduled=!1,e.emit("resume"),flow(e),t.flowing&&!t.reading&&e.read(0)}function flow(e){var t=e._readableState;for(u("flow",t.flowing);t.flowing&&null!==e.read(););}function fromList(e,t){return 0===t.length?null:(t.objectMode?r=t.buffer.shift():!e||e>=t.length?(r=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.first():t.buffer.concat(t.length),t.buffer.clear()):r=t.buffer.consume(e,t.decoder),r);var r}function endReadable(e){var t=e._readableState;u("endReadable",t.endEmitted),t.endEmitted||(t.ended=!0,n.nextTick(endReadableNT,t,e))}function endReadableNT(e,t){if(u("endReadableNT",e.endEmitted,e.length),!e.endEmitted&&0===e.length&&(e.endEmitted=!0,t.readable=!1,t.emit("end"),e.autoDestroy)){var r=t._writableState;(!r||r.autoDestroy&&r.finished)&&t.destroy()}}function indexOf(e,t){for(var r=0,a=e.length;r=t.highWaterMark:t.length>0)||t.ended))return u("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?endReadable(this):emitReadable(this),null;if(0===(e=howMuchToRead(e,t))&&t.ended)return 0===t.length&&endReadable(this),null;var a,n=t.needReadable;return u("need readable",n),(0===t.length||t.length-e0?fromList(e,t):null)?(t.needReadable=t.length<=t.highWaterMark,e=0):(t.length-=e,t.awaitDrain=0),0===t.length&&(t.ended||(t.needReadable=!0),r!==e&&t.ended&&endReadable(this)),null!==a&&this.emit("data",a),a},Readable.prototype._read=function(e){Q(this,new x("_read()"))},Readable.prototype.pipe=function(e,t){var r=this,a=this._readableState;switch(a.pipesCount){case 0:a.pipes=e;break;case 1:a.pipes=[a.pipes,e];break;default:a.pipes.push(e)}a.pipesCount+=1,u("pipe count=%d opts=%j",a.pipesCount,t);var s=(!t||!1!==t.end)&&e!==n.stdout&&e!==n.stderr?onend:unpipe;function onunpipe(t,n){u("onunpipe"),t===r&&n&&!1===n.hasUnpiped&&(n.hasUnpiped=!0,function cleanup(){u("cleanup"),e.removeListener("close",onclose),e.removeListener("finish",onfinish),e.removeListener("drain",c),e.removeListener("error",onerror),e.removeListener("unpipe",onunpipe),r.removeListener("end",onend),r.removeListener("end",unpipe),r.removeListener("data",ondata),d=!0,!a.awaitDrain||e._writableState&&!e._writableState.needDrain||c()}())}function onend(){u("onend"),e.end()}a.endEmitted?n.nextTick(s):r.once("end",s),e.on("unpipe",onunpipe);var c=function pipeOnDrain(e){return function pipeOnDrainFunctionResult(){var t=e._readableState;u("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&o(e,"data")&&(t.flowing=!0,flow(e))}}(r);e.on("drain",c);var d=!1;function ondata(t){u("ondata");var n=e.write(t);u("dest.write",n),!1===n&&((1===a.pipesCount&&a.pipes===e||a.pipesCount>1&&-1!==indexOf(a.pipes,e))&&!d&&(u("false write response, pause",a.awaitDrain),a.awaitDrain++),r.pause())}function onerror(t){u("onerror",t),unpipe(),e.removeListener("error",onerror),0===o(e,"error")&&Q(e,t)}function onclose(){e.removeListener("finish",onfinish),unpipe()}function onfinish(){u("onfinish"),e.removeListener("close",onclose),unpipe()}function unpipe(){u("unpipe"),r.unpipe(e)}return r.on("data",ondata),function prependListener(e,t,r){if("function"==typeof e.prependListener)return e.prependListener(t,r);e._events&&e._events[t]?Array.isArray(e._events[t])?e._events[t].unshift(r):e._events[t]=[r,e._events[t]]:e.on(t,r)}(e,"error",onerror),e.once("close",onclose),e.once("finish",onfinish),e.emit("pipe",r),a.flowing||(u("pipe resume"),r.resume()),e},Readable.prototype.unpipe=function(e){var t=this._readableState,r={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes||(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,r)),this;if(!e){var a=t.pipes,n=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var o=0;o0,!1!==a.flowing&&this.resume()):"readable"===e&&(a.endEmitted||a.readableListening||(a.readableListening=a.needReadable=!0,a.flowing=!1,a.emittedReadable=!1,u("on readable",a.length,a.reading),a.length?emitReadable(this):a.reading||n.nextTick(nReadingNextTick,this))),r},Readable.prototype.addListener=Readable.prototype.on,Readable.prototype.removeListener=function(e,t){var r=s.prototype.removeListener.call(this,e,t);return"readable"===e&&n.nextTick(updateReadableListening,this),r},Readable.prototype.removeAllListeners=function(e){var t=s.prototype.removeAllListeners.apply(this,arguments);return"readable"!==e&&void 0!==e||n.nextTick(updateReadableListening,this),t},Readable.prototype.resume=function(){var e=this._readableState;return e.flowing||(u("resume"),e.flowing=!e.readableListening,function resume(e,t){t.resumeScheduled||(t.resumeScheduled=!0,n.nextTick(resume_,e,t))}(this,e)),e.paused=!1,this},Readable.prototype.pause=function(){return u("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(u("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},Readable.prototype.wrap=function(e){var t=this,r=this._readableState,a=!1;for(var n in e.on("end",(function(){if(u("wrapped end"),r.decoder&&!r.ended){var e=r.decoder.end();e&&e.length&&t.push(e)}t.push(null)})),e.on("data",(function(n){(u("wrapped data"),r.decoder&&(n=r.decoder.write(n)),r.objectMode&&null==n)||(r.objectMode||n&&n.length)&&(t.push(n)||(a=!0,e.pause()))})),e)void 0===this[n]&&"function"==typeof e[n]&&(this[n]=function methodWrap(t){return function methodWrapReturnFunction(){return e[t].apply(e,arguments)}}(n));for(var o=0;o{"use strict";var a=r(1);function emitErrorAndCloseNT(e,t){emitErrorNT(e,t),emitCloseNT(e)}function emitCloseNT(e){e._writableState&&!e._writableState.emitClose||e._readableState&&!e._readableState.emitClose||e.emit("close")}function emitErrorNT(e,t){e.emit("error",t)}e.exports={destroy:function destroy(e,t){var r=this,n=this._readableState&&this._readableState.destroyed,o=this._writableState&&this._writableState.destroyed;return n||o?(t?t(e):e&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,a.nextTick(emitErrorNT,this,e)):a.nextTick(emitErrorNT,this,e)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,(function(e){!t&&e?r._writableState?r._writableState.errorEmitted?a.nextTick(emitCloseNT,r):(r._writableState.errorEmitted=!0,a.nextTick(emitErrorAndCloseNT,r,e)):a.nextTick(emitErrorAndCloseNT,r,e):t?(a.nextTick(emitCloseNT,r),t(e)):a.nextTick(emitCloseNT,r)})),this)},undestroy:function undestroy(){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 errorOrDestroy(e,t){var r=e._readableState,a=e._writableState;r&&r.autoDestroy||a&&a.autoDestroy?e.destroy(t):e.emit("error",t)}}},(e,t,r)=>{"use strict";var a=r(237).a.ERR_INVALID_OPT_VALUE;e.exports={getHighWaterMark:function getHighWaterMark(e,t,r,n){var o=function highWaterMarkFrom(e,t,r){return null!=e.highWaterMark?e.highWaterMark:t?e[r]:null}(t,n,r);if(null!=o){if(!isFinite(o)||Math.floor(o)!==o||o<0)throw new a(n?r:"highWaterMark",o);return Math.floor(o)}return e.objectMode?16:16384}}},(e,t,r)=>{"use strict";var a,n=r(1);function CorkedRequest(e){var t=this;this.next=null,this.entry=null,this.finish=function(){!function onCorkedFinish(e,t,r){var a=e.entry;e.entry=null;for(;a;){var n=a.callback;t.pendingcb--,n(r),a=a.next}t.corkedRequestsFree.next=e}(t,e)}}e.exports=Writable,Writable.WritableState=WritableState;var o={deprecate:r(878)},s=r(876),c=r(4).Buffer,d=r.g.Uint8Array||function(){};var u,h=r(512),l=r(513).getHighWaterMark,b=r(237).a,g=b.ERR_INVALID_ARG_TYPE,p=b.ERR_METHOD_NOT_IMPLEMENTED,B=b.ERR_MULTIPLE_CALLBACK,m=b.ERR_STREAM_CANNOT_PIPE,I=b.ERR_STREAM_DESTROYED,y=b.ERR_STREAM_NULL_VALUES,v=b.ERR_STREAM_WRITE_AFTER_END,x=b.ERR_UNKNOWN_ENCODING,C=h.errorOrDestroy;function nop(){}function WritableState(e,t,o){a=a||r(187),e=e||{},"boolean"!=typeof o&&(o=t instanceof a),this.objectMode=!!e.objectMode,o&&(this.objectMode=this.objectMode||!!e.writableObjectMode),this.highWaterMark=l(this,e,"writableHighWaterMark",o),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var s=!1===e.decodeStrings;this.decodeStrings=!s,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 onwrite(e,t){var r=e._writableState,a=r.sync,o=r.writecb;if("function"!=typeof o)throw new B;if(function onwriteStateUpdate(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}(r),t)!function onwriteError(e,t,r,a,o){--t.pendingcb,r?(n.nextTick(o,a),n.nextTick(finishMaybe,e,t),e._writableState.errorEmitted=!0,C(e,a)):(o(a),e._writableState.errorEmitted=!0,C(e,a),finishMaybe(e,t))}(e,r,a,t,o);else{var s=needFinish(r)||e.destroyed;s||r.corked||r.bufferProcessing||!r.bufferedRequest||clearBuffer(e,r),a?n.nextTick(afterWrite,e,r,s,o):afterWrite(e,r,s,o)}}(t,e)},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 CorkedRequest(this)}function Writable(e){var t=this instanceof(a=a||r(187));if(!t&&!u.call(Writable,this))return new Writable(e);this._writableState=new WritableState(e,this,t),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),s.call(this)}function doWrite(e,t,r,a,n,o,s){t.writelen=a,t.writecb=s,t.writing=!0,t.sync=!0,t.destroyed?t.onwrite(new I("write")):r?e._writev(n,t.onwrite):e._write(n,o,t.onwrite),t.sync=!1}function afterWrite(e,t,r,a){r||function onwriteDrain(e,t){0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}(e,t),t.pendingcb--,a(),finishMaybe(e,t)}function clearBuffer(e,t){t.bufferProcessing=!0;var r=t.bufferedRequest;if(e._writev&&r&&r.next){var a=t.bufferedRequestCount,n=new Array(a),o=t.corkedRequestsFree;o.entry=r;for(var s=0,c=!0;r;)n[s]=r,r.isBuf||(c=!1),r=r.next,s+=1;n.allBuffers=c,doWrite(e,t,!0,t.length,n,"",o.finish),t.pendingcb++,t.lastBufferedRequest=null,o.next?(t.corkedRequestsFree=o.next,o.next=null):t.corkedRequestsFree=new CorkedRequest(t),t.bufferedRequestCount=0}else{for(;r;){var d=r.chunk,u=r.encoding,h=r.callback;if(doWrite(e,t,!1,t.objectMode?1:d.length,d,u,h),r=r.next,t.bufferedRequestCount--,t.writing)break}null===r&&(t.lastBufferedRequest=null)}t.bufferedRequest=r,t.bufferProcessing=!1}function needFinish(e){return e.ending&&0===e.length&&null===e.bufferedRequest&&!e.finished&&!e.writing}function callFinal(e,t){e._final((function(r){t.pendingcb--,r&&C(e,r),t.prefinished=!0,e.emit("prefinish"),finishMaybe(e,t)}))}function finishMaybe(e,t){var r=needFinish(t);if(r&&(function prefinish(e,t){t.prefinished||t.finalCalled||("function"!=typeof e._final||t.destroyed?(t.prefinished=!0,e.emit("prefinish")):(t.pendingcb++,t.finalCalled=!0,n.nextTick(callFinal,e,t)))}(e,t),0===t.pendingcb&&(t.finished=!0,e.emit("finish"),t.autoDestroy))){var a=e._readableState;(!a||a.autoDestroy&&a.endEmitted)&&e.destroy()}return r}r(22)(Writable,s),WritableState.prototype.getBuffer=function getBuffer(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},function(){try{Object.defineProperty(WritableState.prototype,"buffer",{get:o.deprecate((function writableStateBufferGetter(){return this.getBuffer()}),"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(e){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(u=Function.prototype[Symbol.hasInstance],Object.defineProperty(Writable,Symbol.hasInstance,{value:function value(e){return!!u.call(this,e)||this===Writable&&(e&&e._writableState instanceof WritableState)}})):u=function realHasInstance(e){return e instanceof this},Writable.prototype.pipe=function(){C(this,new m)},Writable.prototype.write=function(e,t,r){var a=this._writableState,o=!1,s=!a.objectMode&&function _isUint8Array(e){return c.isBuffer(e)||e instanceof d}(e);return s&&!c.isBuffer(e)&&(e=function _uint8ArrayToBuffer(e){return c.from(e)}(e)),"function"==typeof t&&(r=t,t=null),s?t="buffer":t||(t=a.defaultEncoding),"function"!=typeof r&&(r=nop),a.ending?function writeAfterEnd(e,t){var r=new v;C(e,r),n.nextTick(t,r)}(this,r):(s||function validChunk(e,t,r,a){var o;return null===r?o=new y:"string"==typeof r||t.objectMode||(o=new g("chunk",["string","Buffer"],r)),!o||(C(e,o),n.nextTick(a,o),!1)}(this,a,e,r))&&(a.pendingcb++,o=function writeOrBuffer(e,t,r,a,n,o){if(!r){var s=function decodeChunk(e,t,r){e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=c.from(t,r));return t}(t,a,n);a!==s&&(r=!0,n="buffer",a=s)}var d=t.objectMode?1:a.length;t.length+=d;var u=t.length-1))throw new x(e);return this._writableState.defaultEncoding=e,this},Object.defineProperty(Writable.prototype,"writableBuffer",{enumerable:!1,get:function get(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(Writable.prototype,"writableHighWaterMark",{enumerable:!1,get:function get(){return this._writableState.highWaterMark}}),Writable.prototype._write=function(e,t,r){r(new p("_write()"))},Writable.prototype._writev=null,Writable.prototype.end=function(e,t,r){var a=this._writableState;return"function"==typeof e?(r=e,e=null,t=null):"function"==typeof t&&(r=t,t=null),null!=e&&this.write(e,t),a.corked&&(a.corked=1,this.uncork()),a.ending||function endWritable(e,t,r){t.ending=!0,finishMaybe(e,t),r&&(t.finished?n.nextTick(r):e.once("finish",r));t.ended=!0,e.writable=!1}(this,a,r),this},Object.defineProperty(Writable.prototype,"writableLength",{enumerable:!1,get:function get(){return this._writableState.length}}),Object.defineProperty(Writable.prototype,"destroyed",{enumerable:!1,get:function get(){return void 0!==this._writableState&&this._writableState.destroyed},set:function set(e){this._writableState&&(this._writableState.destroyed=e)}}),Writable.prototype.destroy=h.destroy,Writable.prototype._undestroy=h.undestroy,Writable.prototype._destroy=function(e,t){t(e)}},(e,t,r)=>{"use strict";var a=r(58).Buffer,n=a.isEncoding||function(e){switch((e=""+e)&&e.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 StringDecoder(e){var t;switch(this.encoding=function normalizeEncoding(e){var t=function _normalizeEncoding(e){if(!e)return"utf8";for(var t;;)switch(e){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 e;default:if(t)return;e=(""+e).toLowerCase(),t=!0}}(e);if("string"!=typeof t&&(a.isEncoding===n||!n(e)))throw new Error("Unknown encoding: "+e);return t||e}(e),this.encoding){case"utf16le":this.text=utf16Text,this.end=utf16End,t=4;break;case"utf8":this.fillLast=utf8FillLast,t=4;break;case"base64":this.text=base64Text,this.end=base64End,t=3;break;default:return this.write=simpleWrite,void(this.end=simpleEnd)}this.lastNeed=0,this.lastTotal=0,this.lastChar=a.allocUnsafe(t)}function utf8CheckByte(e){return e<=127?0:e>>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function utf8FillLast(e){var t=this.lastTotal-this.lastNeed,r=function utf8CheckExtraBytes(e,t,r){if(128!=(192&t[0]))return e.lastNeed=0,"�";if(e.lastNeed>1&&t.length>1){if(128!=(192&t[1]))return e.lastNeed=1,"�";if(e.lastNeed>2&&t.length>2&&128!=(192&t[2]))return e.lastNeed=2,"�"}}(this,e);return void 0!==r?r:this.lastNeed<=e.length?(e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(e.copy(this.lastChar,t,0,e.length),void(this.lastNeed-=e.length))}function utf16Text(e,t){if((e.length-t)%2==0){var r=e.toString("utf16le",t);if(r){var a=r.charCodeAt(r.length-1);if(a>=55296&&a<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",t,e.length-1)}function utf16End(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return t+this.lastChar.toString("utf16le",0,r)}return t}function base64Text(e,t){var r=(e.length-t)%3;return 0===r?e.toString("base64",t):(this.lastNeed=3-r,this.lastTotal=3,1===r?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString("base64",t,e.length-r))}function base64End(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function simpleWrite(e){return e.toString(this.encoding)}function simpleEnd(e){return e&&e.length?this.write(e):""}t.a=StringDecoder,StringDecoder.prototype.write=function(e){if(0===e.length)return"";var t,r;if(this.lastNeed){if(void 0===(t=this.fillLast(e)))return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r=0)return n>0&&(e.lastNeed=n-1),n;if(--a=0)return n>0&&(e.lastNeed=n-2),n;if(--a=0)return n>0&&(2===n?n=0:e.lastNeed=n-3),n;return 0}(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=r;var a=e.length-(r-this.lastNeed);return e.copy(this.lastChar,0,a),e.toString("utf8",t,a)},StringDecoder.prototype.fillLast=function(e){if(this.lastNeed<=e.length)return e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,e.length),this.lastNeed-=e.length}},(e,t,r)=>{"use strict";e.exports=Transform;var a=r(237).a,n=a.ERR_METHOD_NOT_IMPLEMENTED,o=a.ERR_MULTIPLE_CALLBACK,s=a.ERR_TRANSFORM_ALREADY_TRANSFORMING,c=a.ERR_TRANSFORM_WITH_LENGTH_0,d=r(187);function afterTransform(e,t){var r=this._transformState;r.transforming=!1;var a=r.writecb;if(null===a)return this.emit("error",new o);r.writechunk=null,r.writecb=null,null!=t&&this.push(t),a(e);var n=this._readableState;n.reading=!1,(n.needReadable||n.length{var a=r(22),n=r(188),o=r(58).Buffer,s=[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],c=new Array(64);function Sha256(){this.init(),this._w=c,n.call(this,64,56)}function ch(e,t,r){return r^e&(t^r)}function maj(e,t,r){return e&t|r&(e|t)}function sigma0(e){return(e>>>2|e<<30)^(e>>>13|e<<19)^(e>>>22|e<<10)}function sigma1(e){return(e>>>6|e<<26)^(e>>>11|e<<21)^(e>>>25|e<<7)}function gamma0(e){return(e>>>7|e<<25)^(e>>>18|e<<14)^e>>>3}a(Sha256,n),Sha256.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},Sha256.prototype._update=function(e){for(var t,r=this._w,a=0|this._a,n=0|this._b,o=0|this._c,c=0|this._d,d=0|this._e,u=0|this._f,h=0|this._g,l=0|this._h,b=0;b<16;++b)r[b]=e.readInt32BE(4*b);for(;b<64;++b)r[b]=0|(((t=r[b-2])>>>17|t<<15)^(t>>>19|t<<13)^t>>>10)+r[b-7]+gamma0(r[b-15])+r[b-16];for(var g=0;g<64;++g){var p=l+sigma1(d)+ch(d,u,h)+s[g]+r[g]|0,B=sigma0(a)+maj(a,n,o)|0;l=h,h=u,u=d,d=c+p|0,c=o,o=n,n=a,a=p+B|0}this._a=a+this._a|0,this._b=n+this._b|0,this._c=o+this._c|0,this._d=c+this._d|0,this._e=d+this._e|0,this._f=u+this._f|0,this._g=h+this._g|0,this._h=l+this._h|0},Sha256.prototype._hash=function(){var e=o.allocUnsafe(32);return e.writeInt32BE(this._a,0),e.writeInt32BE(this._b,4),e.writeInt32BE(this._c,8),e.writeInt32BE(this._d,12),e.writeInt32BE(this._e,16),e.writeInt32BE(this._f,20),e.writeInt32BE(this._g,24),e.writeInt32BE(this._h,28),e},e.exports=Sha256},(e,t,r)=>{var a=r(22),n=r(188),o=r(58).Buffer,s=[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],c=new Array(160);function Sha512(){this.init(),this._w=c,n.call(this,128,112)}function Ch(e,t,r){return r^e&(t^r)}function maj(e,t,r){return e&t|r&(e|t)}function sigma0(e,t){return(e>>>28|t<<4)^(t>>>2|e<<30)^(t>>>7|e<<25)}function sigma1(e,t){return(e>>>14|t<<18)^(e>>>18|t<<14)^(t>>>9|e<<23)}function Gamma0(e,t){return(e>>>1|t<<31)^(e>>>8|t<<24)^e>>>7}function Gamma0l(e,t){return(e>>>1|t<<31)^(e>>>8|t<<24)^(e>>>7|t<<25)}function Gamma1(e,t){return(e>>>19|t<<13)^(t>>>29|e<<3)^e>>>6}function Gamma1l(e,t){return(e>>>19|t<<13)^(t>>>29|e<<3)^(e>>>6|t<<26)}function getCarry(e,t){return e>>>0>>0?1:0}a(Sha512,n),Sha512.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},Sha512.prototype._update=function(e){for(var t=this._w,r=0|this._ah,a=0|this._bh,n=0|this._ch,o=0|this._dh,c=0|this._eh,d=0|this._fh,u=0|this._gh,h=0|this._hh,l=0|this._al,b=0|this._bl,g=0|this._cl,p=0|this._dl,B=0|this._el,m=0|this._fl,I=0|this._gl,y=0|this._hl,v=0;v<32;v+=2)t[v]=e.readInt32BE(4*v),t[v+1]=e.readInt32BE(4*v+4);for(;v<160;v+=2){var x=t[v-30],C=t[v-30+1],Q=Gamma0(x,C),w=Gamma0l(C,x),_=Gamma1(x=t[v-4],C=t[v-4+1]),k=Gamma1l(C,x),N=t[v-14],D=t[v-14+1],U=t[v-32],G=t[v-32+1],T=w+D|0,L=Q+N+getCarry(T,w)|0;L=(L=L+_+getCarry(T=T+k|0,k)|0)+U+getCarry(T=T+G|0,G)|0,t[v]=L,t[v+1]=T}for(var P=0;P<160;P+=2){L=t[P],T=t[P+1];var q=maj(r,a,n),O=maj(l,b,g),H=sigma0(r,l),Y=sigma0(l,r),j=sigma1(c,B),J=sigma1(B,c),z=s[P],W=s[P+1],V=Ch(c,d,u),X=Ch(B,m,I),$=y+J|0,et=h+j+getCarry($,y)|0;et=(et=(et=et+V+getCarry($=$+X|0,X)|0)+z+getCarry($=$+W|0,W)|0)+L+getCarry($=$+T|0,T)|0;var tt=Y+O|0,rt=H+q+getCarry(tt,Y)|0;h=u,y=I,u=d,I=m,d=c,m=B,c=o+et+getCarry(B=p+$|0,p)|0,o=n,p=g,n=a,g=b,a=r,b=l,r=et+rt+getCarry(l=$+tt|0,$)|0}this._al=this._al+l|0,this._bl=this._bl+b|0,this._cl=this._cl+g|0,this._dl=this._dl+p|0,this._el=this._el+B|0,this._fl=this._fl+m|0,this._gl=this._gl+I|0,this._hl=this._hl+y|0,this._ah=this._ah+r+getCarry(this._al,l)|0,this._bh=this._bh+a+getCarry(this._bl,b)|0,this._ch=this._ch+n+getCarry(this._cl,g)|0,this._dh=this._dh+o+getCarry(this._dl,p)|0,this._eh=this._eh+c+getCarry(this._el,B)|0,this._fh=this._fh+d+getCarry(this._fl,m)|0,this._gh=this._gh+u+getCarry(this._gl,I)|0,this._hh=this._hh+h+getCarry(this._hl,y)|0},Sha512.prototype._hash=function(){var e=o.allocUnsafe(64);function writeInt64BE(t,r,a){e.writeInt32BE(t,a),e.writeInt32BE(r,a+4)}return writeInt64BE(this._ah,this._al,0),writeInt64BE(this._bh,this._bl,8),writeInt64BE(this._ch,this._cl,16),writeInt64BE(this._dh,this._dl,24),writeInt64BE(this._eh,this._el,32),writeInt64BE(this._fh,this._fl,40),writeInt64BE(this._gh,this._gl,48),writeInt64BE(this._hh,this._hl,56),e},e.exports=Sha512},function(e,t,r){"use strict";var a=r(4).Buffer,n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.Address=void 0;var o=n(r(6)),s=n(r(130)),c=r(73),d=r(34),u=function(){function Address(e){o.default(20===e.length,"Invalid address length"),this.buf=e}return Address.zero=function(){return new Address(c.zeros(20))},Address.fromString=function(e){return o.default(d.isValidAddress(e),"Invalid address"),new Address(c.toBuffer(e))},Address.fromPublicKey=function(e){return o.default(a.isBuffer(e),"Public key should be Buffer"),new Address(d.pubToAddress(e))},Address.fromPrivateKey=function(e){return o.default(a.isBuffer(e),"Private key should be Buffer"),new Address(d.privateToAddress(e))},Address.generate=function(e,t){return o.default(s.default.isBN(t)),new Address(d.generateAddress(e.buf,t.toArrayLike(a)))},Address.generate2=function(e,t,r){return o.default(a.isBuffer(t)),o.default(a.isBuffer(r)),new Address(d.generateAddress2(e.buf,t,r))},Address.prototype.equals=function(e){return this.buf.equals(e.buf)},Address.prototype.isZero=function(){return this.equals(Address.zero())},Address.prototype.isPrecompileOrSystemAddress=function(){var e=new s.default(this.buf),t=new s.default(0),r=new s.default("ffff","hex");return e.gte(t)&&e.lte(r)},Address.prototype.toString=function(){return"0x"+this.buf.toString("hex")},Address.prototype.toBuffer=function(){return a.from(this.buf)},Address}();t.Address=u},function(e,t,r){"use strict";var a=r(4).Buffer,n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.hashPersonalMessage=t.isValidSignature=t.fromRpcSig=t.toCompactSig=t.toRpcSig=t.ecrecover=t.ecsign=void 0;var o=r(158),s=n(r(130)),c=r(73),d=r(59),u=r(346),h=r(238);function calculateSigRecovery(e,t){var r=h.toType(e,h.TypeOutput.BN);if(!t)return r.subn(27);var a=h.toType(t,h.TypeOutput.BN);return r.sub(a.muln(2).addn(35))}function isValidSigRecovery(e){var t=new s.default(e);return t.eqn(0)||t.eqn(1)}t.ecsign=function ecsign(e,t,r){var n=o.ecdsaSign(e,t),s=n.signature,c=n.recid,d=a.from(s.slice(0,32)),u=a.from(s.slice(32,64));if(!r||"number"==typeof r){if(r&&!Number.isSafeInteger(r))throw new Error("The provided number is greater than MAX_SAFE_INTEGER (please use an alternative input type)");return{r:d,s:u,v:r?c+(2*r+35):c+27}}return{r:d,s:u,v:h.toType(r,h.TypeOutput.BN).muln(2).addn(35).addn(c).toArrayLike(a)}},t.ecrecover=function(e,t,r,n,s){var d=a.concat([c.setLengthLeft(r,32),c.setLengthLeft(n,32)],64),u=calculateSigRecovery(t,s);if(!isValidSigRecovery(u))throw new Error("Invalid signature v value");var h=o.ecdsaRecover(d,u.toNumber(),e);return a.from(o.publicKeyConvert(h,!1).slice(1))},t.toRpcSig=function(e,t,r,n){if(!isValidSigRecovery(calculateSigRecovery(e,n)))throw new Error("Invalid signature v value");return c.bufferToHex(a.concat([c.setLengthLeft(t,32),c.setLengthLeft(r,32),c.toBuffer(e)]))},t.toCompactSig=function(e,t,r,n){if(!isValidSigRecovery(calculateSigRecovery(e,n)))throw new Error("Invalid signature v value");var o=h.toType(e,h.TypeOutput.Number),s=r;return(o>28&&o%2==1||1===o||28===o)&&((s=a.from(r))[0]|=128),c.bufferToHex(a.concat([c.setLengthLeft(t,32),c.setLengthLeft(s,32)]))},t.fromRpcSig=function(e){var t,r,a,n=c.toBuffer(e);if(n.length>=65)t=n.slice(0,32),r=n.slice(32,64),a=c.bufferToInt(n.slice(64));else{if(64!==n.length)throw new Error("Invalid signature length");t=n.slice(0,32),r=n.slice(32,64),a=c.bufferToInt(n.slice(32,33))>>7,r[0]&=127}return a<27&&(a+=27),{v:a,r:t,s:r}},t.isValidSignature=function(e,t,r,a,n){void 0===a&&(a=!0);var o=new s.default("7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0",16),c=new s.default("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141",16);if(32!==t.length||32!==r.length)return!1;if(!isValidSigRecovery(calculateSigRecovery(e,n)))return!1;var d=new s.default(t),u=new s.default(r);return!(d.isZero()||d.gt(c)||u.isZero()||u.gt(c))&&(!a||1!==u.cmp(o))},t.hashPersonalMessage=function(e){u.assertIsBuffer(e);var t=a.from("Ethereum Signed Message:\n"+e.length.toString(),"utf-8");return d.keccak(a.concat([t,e]))}},(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BaseTransaction=t.calculateIntrinsicGas=void 0;const a=r(8),n=r(47),o=r(522),s=1n<<64n-1n;t.calculateIntrinsicGas=(e,t,r)=>{const a=r.hardfork();let n=o.Params.TRANSACTION_GAS;if(t||(n+=o.Params.TRANSACTION_CREATION),e){const t=e.toBuffer(),r=t.byteLength;if(r>0){const e=o.Params.TRANSACTION_DATA_NON_ZERO_GAS.get(a),c=o.Params.TRANSACTION_DATA_ZERO_GAS;let d=0n;for(const e of t)0!==e&&d++;if((s-n)/e{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Params=void 0,t.Params={TRANSACTION_GAS:21000n,TRANSACTION_DATA_NON_ZERO_GAS:new Map([["constantinople",68n],["byzantium",68n],["petersburg",68n],["istanbul",16n],["muirGlacier",16n],["berlin",16n],["london",16n]]),TRANSACTION_DATA_ZERO_GAS:4n,TRANSACTION_CREATION:32000n,ACCESS_LIST_ADDRESS_GAS:2400,ACCESS_LIST_STORAGE_KEY_GAS:1900}},(e,t)=>{"use strict";var r=t;function zero2(e){return 1===e.length?"0"+e:e}function toHex(e){for(var t="",r=0;r>8,s=255&n;o?r.push(o,s):r.push(s)}return r},r.zero2=zero2,r.toHex=toHex,r.encode=function encode(e,t){return"hex"===t?toHex(e):e}},(e,t,r)=>{var a;function Rand(e){this.rand=e}if(e.exports=function rand(e){return a||(a=new Rand(null)),a.generate(e)},e.exports.Rand=Rand,Rand.prototype.generate=function generate(e){return this._rand(e)},Rand.prototype._rand=function _rand(e){if(this.rand.getBytes)return this.rand.getBytes(e);for(var t=new Uint8Array(e),r=0;r{"use strict";var a=t;a.base=r(278),a.short=r(897),a.mont=r(898),a.edwards=r(899)},(e,t,r)=>{"use strict";var a=r(113),n=r(279),o=r(901),s=r(161),c=a.sum32,d=a.sum32_4,u=a.sum32_5,h=o.ch32,l=o.maj32,b=o.s0_256,g=o.s1_256,p=o.g0_256,B=o.g1_256,m=n.BlockHash,I=[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 SHA256(){if(!(this instanceof SHA256))return new SHA256;m.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=I,this.W=new Array(64)}a.inherits(SHA256,m),e.exports=SHA256,SHA256.blockSize=512,SHA256.outSize=256,SHA256.hmacStrength=192,SHA256.padLength=64,SHA256.prototype._update=function _update(e,t){for(var r=this.W,a=0;a<16;a++)r[a]=e[t+a];for(;a{"use strict";var a=r(113),n=r(279),o=r(161),s=a.rotr64_hi,c=a.rotr64_lo,d=a.shr64_hi,u=a.shr64_lo,h=a.sum64,l=a.sum64_hi,b=a.sum64_lo,g=a.sum64_4_hi,p=a.sum64_4_lo,B=a.sum64_5_hi,m=a.sum64_5_lo,I=n.BlockHash,y=[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 SHA512(){if(!(this instanceof SHA512))return new SHA512;I.call(this),this.h=[1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209],this.k=y,this.W=new Array(160)}function ch64_hi(e,t,r,a,n){var o=e&r^~e&n;return o<0&&(o+=4294967296),o}function ch64_lo(e,t,r,a,n,o){var s=t&a^~t&o;return s<0&&(s+=4294967296),s}function maj64_hi(e,t,r,a,n){var o=e&r^e&n^r&n;return o<0&&(o+=4294967296),o}function maj64_lo(e,t,r,a,n,o){var s=t&a^t&o^a&o;return s<0&&(s+=4294967296),s}function s0_512_hi(e,t){var r=s(e,t,28)^s(t,e,2)^s(t,e,7);return r<0&&(r+=4294967296),r}function s0_512_lo(e,t){var r=c(e,t,28)^c(t,e,2)^c(t,e,7);return r<0&&(r+=4294967296),r}function s1_512_hi(e,t){var r=s(e,t,14)^s(e,t,18)^s(t,e,9);return r<0&&(r+=4294967296),r}function s1_512_lo(e,t){var r=c(e,t,14)^c(e,t,18)^c(t,e,9);return r<0&&(r+=4294967296),r}function g0_512_hi(e,t){var r=s(e,t,1)^s(e,t,8)^d(e,t,7);return r<0&&(r+=4294967296),r}function g0_512_lo(e,t){var r=c(e,t,1)^c(e,t,8)^u(e,t,7);return r<0&&(r+=4294967296),r}function g1_512_hi(e,t){var r=s(e,t,19)^s(t,e,29)^d(e,t,6);return r<0&&(r+=4294967296),r}function g1_512_lo(e,t){var r=c(e,t,19)^c(t,e,29)^u(e,t,6);return r<0&&(r+=4294967296),r}a.inherits(SHA512,I),e.exports=SHA512,SHA512.blockSize=1024,SHA512.outSize=512,SHA512.hmacStrength=192,SHA512.padLength=128,SHA512.prototype._prepareBlock=function _prepareBlock(e,t){for(var r=this.W,a=0;a<32;a++)r[a]=e[t+a];for(;a=65&&r<=70?r-55:r>=97&&r<=102?r-87:r-48&15}function parseHexByte(e,t,r){var a=parseHex4Bits(e,r);return r-1>=t&&(a|=parseHex4Bits(e,r-1)<<4),a}function parseBase(e,t,r,a){for(var n=0,o=Math.min(e.length,r),s=t;s=49?c-49+10:c>=17?c-17+10:c}return n}BN.isBN=function isBN(e){return e instanceof BN||null!==e&&"object"==typeof e&&e.constructor.wordSize===BN.wordSize&&Array.isArray(e.words)},BN.max=function max(e,t){return e.cmp(t)>0?e:t},BN.min=function min(e,t){return e.cmp(t)<0?e:t},BN.prototype._init=function init(e,t,r){if("number"==typeof e)return this._initNumber(e,t,r);if("object"==typeof e)return this._initArray(e,t,r);"hex"===t&&(t=16),assert(t===(0|t)&&t>=2&&t<=36);var a=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&(a++,this.negative=1),a=0;a-=3)o=e[a]|e[a-1]<<8|e[a-2]<<16,this.words[n]|=o<>>26-s&67108863,(s+=24)>=26&&(s-=26,n++);else if("le"===r)for(a=0,n=0;a>>26-s&67108863,(s+=24)>=26&&(s-=26,n++);return this.strip()},BN.prototype._parseHex=function _parseHex(e,t,r){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var a=0;a=t;a-=2)n=parseHexByte(e,t,a)<=18?(o-=18,s+=1,this.words[s]|=n>>>26):o+=8;else for(a=(e.length-t)%2==0?t+1:t;a=18?(o-=18,s+=1,this.words[s]|=n>>>26):o+=8;this.strip()},BN.prototype._parseBase=function _parseBase(e,t,r){this.words=[0],this.length=1;for(var a=0,n=1;n<=67108863;n*=t)a++;a--,n=n/t|0;for(var o=e.length-r,s=o%a,c=Math.min(o,o-s)+r,d=0,u=r;u1&&0===this.words[this.length-1];)this.length--;return this._normSign()},BN.prototype._normSign=function _normSign(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},BN.prototype.inspect=function inspect(){return(this.red?""};var n=["","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"],o=[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],s=[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 smallMulTo(e,t,r){r.negative=t.negative^e.negative;var a=e.length+t.length|0;r.length=a,a=a-1|0;var n=0|e.words[0],o=0|t.words[0],s=n*o,c=67108863&s,d=s/67108864|0;r.words[0]=c;for(var u=1;u>>26,l=67108863&d,b=Math.min(u,t.length-1),g=Math.max(0,u-e.length+1);g<=b;g++){var p=u-g|0;h+=(s=(n=0|e.words[p])*(o=0|t.words[g])+l)/67108864|0,l=67108863&s}r.words[u]=0|l,d=0|h}return 0!==d?r.words[u]=0|d:r.length--,r.strip()}BN.prototype.toString=function toString(e,t){var r;if(t=0|t||1,16===(e=e||10)||"hex"===e){r="";for(var a=0,c=0,d=0;d>>24-a&16777215)||d!==this.length-1?n[6-h.length]+h+r:h+r,(a+=2)>=26&&(a-=26,d--)}for(0!==c&&(r=c.toString(16)+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(e===(0|e)&&e>=2&&e<=36){var l=o[e],b=s[e];r="";var g=this.clone();for(g.negative=0;!g.isZero();){var p=g.modn(b).toString(e);r=(g=g.idivn(b)).isZero()?p+r:n[l-p.length]+p+r}for(this.isZero()&&(r="0"+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}assert(!1,"Base should be between 2 and 36")},BN.prototype.toNumber=function toNumber(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&assert(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},BN.prototype.toJSON=function toJSON(){return this.toString(16)},BN.prototype.toBuffer=function toBuffer(e,t){return assert(void 0!==a),this.toArrayLike(a,e,t)},BN.prototype.toArray=function toArray(e,t){return this.toArrayLike(Array,e,t)},BN.prototype.toArrayLike=function toArrayLike(e,t,r){var a=this.byteLength(),n=r||Math.max(1,a);assert(a<=n,"byte array longer than desired length"),assert(n>0,"Requested array length <= 0"),this.strip();var o,s,c="le"===t,d=new e(n),u=this.clone();if(c){for(s=0;!u.isZero();s++)o=u.andln(255),u.iushrn(8),d[s]=o;for(;s=4096&&(r+=13,t>>>=13),t>=64&&(r+=7,t>>>=7),t>=8&&(r+=4,t>>>=4),t>=2&&(r+=2,t>>>=2),r+t},BN.prototype._zeroBits=function _zeroBits(e){if(0===e)return 26;var t=e,r=0;return 0==(8191&t)&&(r+=13,t>>>=13),0==(127&t)&&(r+=7,t>>>=7),0==(15&t)&&(r+=4,t>>>=4),0==(3&t)&&(r+=2,t>>>=2),0==(1&t)&&r++,r},BN.prototype.bitLength=function bitLength(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},BN.prototype.zeroBits=function zeroBits(){if(this.isZero())return 0;for(var e=0,t=0;te.length?this.clone().ior(e):e.clone().ior(this)},BN.prototype.uor=function uor(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},BN.prototype.iuand=function iuand(e){var t;t=this.length>e.length?e:this;for(var r=0;re.length?this.clone().iand(e):e.clone().iand(this)},BN.prototype.uand=function uand(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},BN.prototype.iuxor=function iuxor(e){var t,r;this.length>e.length?(t=this,r=e):(t=e,r=this);for(var a=0;ae.length?this.clone().ixor(e):e.clone().ixor(this)},BN.prototype.uxor=function uxor(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},BN.prototype.inotn=function inotn(e){assert("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),r=e%26;this._expand(t),r>0&&t--;for(var a=0;a0&&(this.words[a]=~this.words[a]&67108863>>26-r),this.strip()},BN.prototype.notn=function notn(e){return this.clone().inotn(e)},BN.prototype.setn=function setn(e,t){assert("number"==typeof e&&e>=0);var r=e/26|0,a=e%26;return this._expand(r+1),this.words[r]=t?this.words[r]|1<e.length?(r=this,a=e):(r=e,a=this);for(var n=0,o=0;o>>26;for(;0!==n&&o>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;oe.length?this.clone().iadd(e):e.clone().iadd(this)},BN.prototype.isub=function isub(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var r,a,n=this.cmp(e);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,a=e):(r=e,a=this);for(var o=0,s=0;s>26,this.words[s]=67108863&t;for(;0!==o&&s>26,this.words[s]=67108863&t;if(0===o&&s>>13,g=0|s[1],p=8191&g,B=g>>>13,m=0|s[2],I=8191&m,y=m>>>13,v=0|s[3],x=8191&v,C=v>>>13,Q=0|s[4],w=8191&Q,_=Q>>>13,k=0|s[5],N=8191&k,D=k>>>13,U=0|s[6],G=8191&U,T=U>>>13,L=0|s[7],P=8191&L,q=L>>>13,O=0|s[8],H=8191&O,Y=O>>>13,j=0|s[9],J=8191&j,z=j>>>13,W=0|c[0],V=8191&W,X=W>>>13,$=0|c[1],et=8191&$,tt=$>>>13,rt=0|c[2],at=8191&rt,it=rt>>>13,nt=0|c[3],ot=8191&nt,At=nt>>>13,st=0|c[4],ct=8191&st,dt=st>>>13,ut=0|c[5],ht=8191&ut,bt=ut>>>13,pt=0|c[6],Bt=8191&pt,mt=pt>>>13,It=0|c[7],Et=8191&It,yt=It>>>13,vt=0|c[8],xt=8191&vt,Ct=vt>>>13,Qt=0|c[9],wt=8191&Qt,Mt=Qt>>>13;r.negative=e.negative^t.negative,r.length=19;var _t=(u+(a=Math.imul(l,V))|0)+((8191&(n=(n=Math.imul(l,X))+Math.imul(b,V)|0))<<13)|0;u=((o=Math.imul(b,X))+(n>>>13)|0)+(_t>>>26)|0,_t&=67108863,a=Math.imul(p,V),n=(n=Math.imul(p,X))+Math.imul(B,V)|0,o=Math.imul(B,X);var kt=(u+(a=a+Math.imul(l,et)|0)|0)+((8191&(n=(n=n+Math.imul(l,tt)|0)+Math.imul(b,et)|0))<<13)|0;u=((o=o+Math.imul(b,tt)|0)+(n>>>13)|0)+(kt>>>26)|0,kt&=67108863,a=Math.imul(I,V),n=(n=Math.imul(I,X))+Math.imul(y,V)|0,o=Math.imul(y,X),a=a+Math.imul(p,et)|0,n=(n=n+Math.imul(p,tt)|0)+Math.imul(B,et)|0,o=o+Math.imul(B,tt)|0;var St=(u+(a=a+Math.imul(l,at)|0)|0)+((8191&(n=(n=n+Math.imul(l,it)|0)+Math.imul(b,at)|0))<<13)|0;u=((o=o+Math.imul(b,it)|0)+(n>>>13)|0)+(St>>>26)|0,St&=67108863,a=Math.imul(x,V),n=(n=Math.imul(x,X))+Math.imul(C,V)|0,o=Math.imul(C,X),a=a+Math.imul(I,et)|0,n=(n=n+Math.imul(I,tt)|0)+Math.imul(y,et)|0,o=o+Math.imul(y,tt)|0,a=a+Math.imul(p,at)|0,n=(n=n+Math.imul(p,it)|0)+Math.imul(B,at)|0,o=o+Math.imul(B,it)|0;var Nt=(u+(a=a+Math.imul(l,ot)|0)|0)+((8191&(n=(n=n+Math.imul(l,At)|0)+Math.imul(b,ot)|0))<<13)|0;u=((o=o+Math.imul(b,At)|0)+(n>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,a=Math.imul(w,V),n=(n=Math.imul(w,X))+Math.imul(_,V)|0,o=Math.imul(_,X),a=a+Math.imul(x,et)|0,n=(n=n+Math.imul(x,tt)|0)+Math.imul(C,et)|0,o=o+Math.imul(C,tt)|0,a=a+Math.imul(I,at)|0,n=(n=n+Math.imul(I,it)|0)+Math.imul(y,at)|0,o=o+Math.imul(y,it)|0,a=a+Math.imul(p,ot)|0,n=(n=n+Math.imul(p,At)|0)+Math.imul(B,ot)|0,o=o+Math.imul(B,At)|0;var Dt=(u+(a=a+Math.imul(l,ct)|0)|0)+((8191&(n=(n=n+Math.imul(l,dt)|0)+Math.imul(b,ct)|0))<<13)|0;u=((o=o+Math.imul(b,dt)|0)+(n>>>13)|0)+(Dt>>>26)|0,Dt&=67108863,a=Math.imul(N,V),n=(n=Math.imul(N,X))+Math.imul(D,V)|0,o=Math.imul(D,X),a=a+Math.imul(w,et)|0,n=(n=n+Math.imul(w,tt)|0)+Math.imul(_,et)|0,o=o+Math.imul(_,tt)|0,a=a+Math.imul(x,at)|0,n=(n=n+Math.imul(x,it)|0)+Math.imul(C,at)|0,o=o+Math.imul(C,it)|0,a=a+Math.imul(I,ot)|0,n=(n=n+Math.imul(I,At)|0)+Math.imul(y,ot)|0,o=o+Math.imul(y,At)|0,a=a+Math.imul(p,ct)|0,n=(n=n+Math.imul(p,dt)|0)+Math.imul(B,ct)|0,o=o+Math.imul(B,dt)|0;var Rt=(u+(a=a+Math.imul(l,ht)|0)|0)+((8191&(n=(n=n+Math.imul(l,bt)|0)+Math.imul(b,ht)|0))<<13)|0;u=((o=o+Math.imul(b,bt)|0)+(n>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,a=Math.imul(G,V),n=(n=Math.imul(G,X))+Math.imul(T,V)|0,o=Math.imul(T,X),a=a+Math.imul(N,et)|0,n=(n=n+Math.imul(N,tt)|0)+Math.imul(D,et)|0,o=o+Math.imul(D,tt)|0,a=a+Math.imul(w,at)|0,n=(n=n+Math.imul(w,it)|0)+Math.imul(_,at)|0,o=o+Math.imul(_,it)|0,a=a+Math.imul(x,ot)|0,n=(n=n+Math.imul(x,At)|0)+Math.imul(C,ot)|0,o=o+Math.imul(C,At)|0,a=a+Math.imul(I,ct)|0,n=(n=n+Math.imul(I,dt)|0)+Math.imul(y,ct)|0,o=o+Math.imul(y,dt)|0,a=a+Math.imul(p,ht)|0,n=(n=n+Math.imul(p,bt)|0)+Math.imul(B,ht)|0,o=o+Math.imul(B,bt)|0;var Ft=(u+(a=a+Math.imul(l,Bt)|0)|0)+((8191&(n=(n=n+Math.imul(l,mt)|0)+Math.imul(b,Bt)|0))<<13)|0;u=((o=o+Math.imul(b,mt)|0)+(n>>>13)|0)+(Ft>>>26)|0,Ft&=67108863,a=Math.imul(P,V),n=(n=Math.imul(P,X))+Math.imul(q,V)|0,o=Math.imul(q,X),a=a+Math.imul(G,et)|0,n=(n=n+Math.imul(G,tt)|0)+Math.imul(T,et)|0,o=o+Math.imul(T,tt)|0,a=a+Math.imul(N,at)|0,n=(n=n+Math.imul(N,it)|0)+Math.imul(D,at)|0,o=o+Math.imul(D,it)|0,a=a+Math.imul(w,ot)|0,n=(n=n+Math.imul(w,At)|0)+Math.imul(_,ot)|0,o=o+Math.imul(_,At)|0,a=a+Math.imul(x,ct)|0,n=(n=n+Math.imul(x,dt)|0)+Math.imul(C,ct)|0,o=o+Math.imul(C,dt)|0,a=a+Math.imul(I,ht)|0,n=(n=n+Math.imul(I,bt)|0)+Math.imul(y,ht)|0,o=o+Math.imul(y,bt)|0,a=a+Math.imul(p,Bt)|0,n=(n=n+Math.imul(p,mt)|0)+Math.imul(B,Bt)|0,o=o+Math.imul(B,mt)|0;var Ut=(u+(a=a+Math.imul(l,Et)|0)|0)+((8191&(n=(n=n+Math.imul(l,yt)|0)+Math.imul(b,Et)|0))<<13)|0;u=((o=o+Math.imul(b,yt)|0)+(n>>>13)|0)+(Ut>>>26)|0,Ut&=67108863,a=Math.imul(H,V),n=(n=Math.imul(H,X))+Math.imul(Y,V)|0,o=Math.imul(Y,X),a=a+Math.imul(P,et)|0,n=(n=n+Math.imul(P,tt)|0)+Math.imul(q,et)|0,o=o+Math.imul(q,tt)|0,a=a+Math.imul(G,at)|0,n=(n=n+Math.imul(G,it)|0)+Math.imul(T,at)|0,o=o+Math.imul(T,it)|0,a=a+Math.imul(N,ot)|0,n=(n=n+Math.imul(N,At)|0)+Math.imul(D,ot)|0,o=o+Math.imul(D,At)|0,a=a+Math.imul(w,ct)|0,n=(n=n+Math.imul(w,dt)|0)+Math.imul(_,ct)|0,o=o+Math.imul(_,dt)|0,a=a+Math.imul(x,ht)|0,n=(n=n+Math.imul(x,bt)|0)+Math.imul(C,ht)|0,o=o+Math.imul(C,bt)|0,a=a+Math.imul(I,Bt)|0,n=(n=n+Math.imul(I,mt)|0)+Math.imul(y,Bt)|0,o=o+Math.imul(y,mt)|0,a=a+Math.imul(p,Et)|0,n=(n=n+Math.imul(p,yt)|0)+Math.imul(B,Et)|0,o=o+Math.imul(B,yt)|0;var Gt=(u+(a=a+Math.imul(l,xt)|0)|0)+((8191&(n=(n=n+Math.imul(l,Ct)|0)+Math.imul(b,xt)|0))<<13)|0;u=((o=o+Math.imul(b,Ct)|0)+(n>>>13)|0)+(Gt>>>26)|0,Gt&=67108863,a=Math.imul(J,V),n=(n=Math.imul(J,X))+Math.imul(z,V)|0,o=Math.imul(z,X),a=a+Math.imul(H,et)|0,n=(n=n+Math.imul(H,tt)|0)+Math.imul(Y,et)|0,o=o+Math.imul(Y,tt)|0,a=a+Math.imul(P,at)|0,n=(n=n+Math.imul(P,it)|0)+Math.imul(q,at)|0,o=o+Math.imul(q,it)|0,a=a+Math.imul(G,ot)|0,n=(n=n+Math.imul(G,At)|0)+Math.imul(T,ot)|0,o=o+Math.imul(T,At)|0,a=a+Math.imul(N,ct)|0,n=(n=n+Math.imul(N,dt)|0)+Math.imul(D,ct)|0,o=o+Math.imul(D,dt)|0,a=a+Math.imul(w,ht)|0,n=(n=n+Math.imul(w,bt)|0)+Math.imul(_,ht)|0,o=o+Math.imul(_,bt)|0,a=a+Math.imul(x,Bt)|0,n=(n=n+Math.imul(x,mt)|0)+Math.imul(C,Bt)|0,o=o+Math.imul(C,mt)|0,a=a+Math.imul(I,Et)|0,n=(n=n+Math.imul(I,yt)|0)+Math.imul(y,Et)|0,o=o+Math.imul(y,yt)|0,a=a+Math.imul(p,xt)|0,n=(n=n+Math.imul(p,Ct)|0)+Math.imul(B,xt)|0,o=o+Math.imul(B,Ct)|0;var Tt=(u+(a=a+Math.imul(l,wt)|0)|0)+((8191&(n=(n=n+Math.imul(l,Mt)|0)+Math.imul(b,wt)|0))<<13)|0;u=((o=o+Math.imul(b,Mt)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,a=Math.imul(J,et),n=(n=Math.imul(J,tt))+Math.imul(z,et)|0,o=Math.imul(z,tt),a=a+Math.imul(H,at)|0,n=(n=n+Math.imul(H,it)|0)+Math.imul(Y,at)|0,o=o+Math.imul(Y,it)|0,a=a+Math.imul(P,ot)|0,n=(n=n+Math.imul(P,At)|0)+Math.imul(q,ot)|0,o=o+Math.imul(q,At)|0,a=a+Math.imul(G,ct)|0,n=(n=n+Math.imul(G,dt)|0)+Math.imul(T,ct)|0,o=o+Math.imul(T,dt)|0,a=a+Math.imul(N,ht)|0,n=(n=n+Math.imul(N,bt)|0)+Math.imul(D,ht)|0,o=o+Math.imul(D,bt)|0,a=a+Math.imul(w,Bt)|0,n=(n=n+Math.imul(w,mt)|0)+Math.imul(_,Bt)|0,o=o+Math.imul(_,mt)|0,a=a+Math.imul(x,Et)|0,n=(n=n+Math.imul(x,yt)|0)+Math.imul(C,Et)|0,o=o+Math.imul(C,yt)|0,a=a+Math.imul(I,xt)|0,n=(n=n+Math.imul(I,Ct)|0)+Math.imul(y,xt)|0,o=o+Math.imul(y,Ct)|0;var Lt=(u+(a=a+Math.imul(p,wt)|0)|0)+((8191&(n=(n=n+Math.imul(p,Mt)|0)+Math.imul(B,wt)|0))<<13)|0;u=((o=o+Math.imul(B,Mt)|0)+(n>>>13)|0)+(Lt>>>26)|0,Lt&=67108863,a=Math.imul(J,at),n=(n=Math.imul(J,it))+Math.imul(z,at)|0,o=Math.imul(z,it),a=a+Math.imul(H,ot)|0,n=(n=n+Math.imul(H,At)|0)+Math.imul(Y,ot)|0,o=o+Math.imul(Y,At)|0,a=a+Math.imul(P,ct)|0,n=(n=n+Math.imul(P,dt)|0)+Math.imul(q,ct)|0,o=o+Math.imul(q,dt)|0,a=a+Math.imul(G,ht)|0,n=(n=n+Math.imul(G,bt)|0)+Math.imul(T,ht)|0,o=o+Math.imul(T,bt)|0,a=a+Math.imul(N,Bt)|0,n=(n=n+Math.imul(N,mt)|0)+Math.imul(D,Bt)|0,o=o+Math.imul(D,mt)|0,a=a+Math.imul(w,Et)|0,n=(n=n+Math.imul(w,yt)|0)+Math.imul(_,Et)|0,o=o+Math.imul(_,yt)|0,a=a+Math.imul(x,xt)|0,n=(n=n+Math.imul(x,Ct)|0)+Math.imul(C,xt)|0,o=o+Math.imul(C,Ct)|0;var Pt=(u+(a=a+Math.imul(I,wt)|0)|0)+((8191&(n=(n=n+Math.imul(I,Mt)|0)+Math.imul(y,wt)|0))<<13)|0;u=((o=o+Math.imul(y,Mt)|0)+(n>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,a=Math.imul(J,ot),n=(n=Math.imul(J,At))+Math.imul(z,ot)|0,o=Math.imul(z,At),a=a+Math.imul(H,ct)|0,n=(n=n+Math.imul(H,dt)|0)+Math.imul(Y,ct)|0,o=o+Math.imul(Y,dt)|0,a=a+Math.imul(P,ht)|0,n=(n=n+Math.imul(P,bt)|0)+Math.imul(q,ht)|0,o=o+Math.imul(q,bt)|0,a=a+Math.imul(G,Bt)|0,n=(n=n+Math.imul(G,mt)|0)+Math.imul(T,Bt)|0,o=o+Math.imul(T,mt)|0,a=a+Math.imul(N,Et)|0,n=(n=n+Math.imul(N,yt)|0)+Math.imul(D,Et)|0,o=o+Math.imul(D,yt)|0,a=a+Math.imul(w,xt)|0,n=(n=n+Math.imul(w,Ct)|0)+Math.imul(_,xt)|0,o=o+Math.imul(_,Ct)|0;var qt=(u+(a=a+Math.imul(x,wt)|0)|0)+((8191&(n=(n=n+Math.imul(x,Mt)|0)+Math.imul(C,wt)|0))<<13)|0;u=((o=o+Math.imul(C,Mt)|0)+(n>>>13)|0)+(qt>>>26)|0,qt&=67108863,a=Math.imul(J,ct),n=(n=Math.imul(J,dt))+Math.imul(z,ct)|0,o=Math.imul(z,dt),a=a+Math.imul(H,ht)|0,n=(n=n+Math.imul(H,bt)|0)+Math.imul(Y,ht)|0,o=o+Math.imul(Y,bt)|0,a=a+Math.imul(P,Bt)|0,n=(n=n+Math.imul(P,mt)|0)+Math.imul(q,Bt)|0,o=o+Math.imul(q,mt)|0,a=a+Math.imul(G,Et)|0,n=(n=n+Math.imul(G,yt)|0)+Math.imul(T,Et)|0,o=o+Math.imul(T,yt)|0,a=a+Math.imul(N,xt)|0,n=(n=n+Math.imul(N,Ct)|0)+Math.imul(D,xt)|0,o=o+Math.imul(D,Ct)|0;var Ot=(u+(a=a+Math.imul(w,wt)|0)|0)+((8191&(n=(n=n+Math.imul(w,Mt)|0)+Math.imul(_,wt)|0))<<13)|0;u=((o=o+Math.imul(_,Mt)|0)+(n>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,a=Math.imul(J,ht),n=(n=Math.imul(J,bt))+Math.imul(z,ht)|0,o=Math.imul(z,bt),a=a+Math.imul(H,Bt)|0,n=(n=n+Math.imul(H,mt)|0)+Math.imul(Y,Bt)|0,o=o+Math.imul(Y,mt)|0,a=a+Math.imul(P,Et)|0,n=(n=n+Math.imul(P,yt)|0)+Math.imul(q,Et)|0,o=o+Math.imul(q,yt)|0,a=a+Math.imul(G,xt)|0,n=(n=n+Math.imul(G,Ct)|0)+Math.imul(T,xt)|0,o=o+Math.imul(T,Ct)|0;var Ht=(u+(a=a+Math.imul(N,wt)|0)|0)+((8191&(n=(n=n+Math.imul(N,Mt)|0)+Math.imul(D,wt)|0))<<13)|0;u=((o=o+Math.imul(D,Mt)|0)+(n>>>13)|0)+(Ht>>>26)|0,Ht&=67108863,a=Math.imul(J,Bt),n=(n=Math.imul(J,mt))+Math.imul(z,Bt)|0,o=Math.imul(z,mt),a=a+Math.imul(H,Et)|0,n=(n=n+Math.imul(H,yt)|0)+Math.imul(Y,Et)|0,o=o+Math.imul(Y,yt)|0,a=a+Math.imul(P,xt)|0,n=(n=n+Math.imul(P,Ct)|0)+Math.imul(q,xt)|0,o=o+Math.imul(q,Ct)|0;var Yt=(u+(a=a+Math.imul(G,wt)|0)|0)+((8191&(n=(n=n+Math.imul(G,Mt)|0)+Math.imul(T,wt)|0))<<13)|0;u=((o=o+Math.imul(T,Mt)|0)+(n>>>13)|0)+(Yt>>>26)|0,Yt&=67108863,a=Math.imul(J,Et),n=(n=Math.imul(J,yt))+Math.imul(z,Et)|0,o=Math.imul(z,yt),a=a+Math.imul(H,xt)|0,n=(n=n+Math.imul(H,Ct)|0)+Math.imul(Y,xt)|0,o=o+Math.imul(Y,Ct)|0;var jt=(u+(a=a+Math.imul(P,wt)|0)|0)+((8191&(n=(n=n+Math.imul(P,Mt)|0)+Math.imul(q,wt)|0))<<13)|0;u=((o=o+Math.imul(q,Mt)|0)+(n>>>13)|0)+(jt>>>26)|0,jt&=67108863,a=Math.imul(J,xt),n=(n=Math.imul(J,Ct))+Math.imul(z,xt)|0,o=Math.imul(z,Ct);var Jt=(u+(a=a+Math.imul(H,wt)|0)|0)+((8191&(n=(n=n+Math.imul(H,Mt)|0)+Math.imul(Y,wt)|0))<<13)|0;u=((o=o+Math.imul(Y,Mt)|0)+(n>>>13)|0)+(Jt>>>26)|0,Jt&=67108863;var Kt=(u+(a=Math.imul(J,wt))|0)+((8191&(n=(n=Math.imul(J,Mt))+Math.imul(z,wt)|0))<<13)|0;return u=((o=Math.imul(z,Mt))+(n>>>13)|0)+(Kt>>>26)|0,Kt&=67108863,d[0]=_t,d[1]=kt,d[2]=St,d[3]=Nt,d[4]=Dt,d[5]=Rt,d[6]=Ft,d[7]=Ut,d[8]=Gt,d[9]=Tt,d[10]=Lt,d[11]=Pt,d[12]=qt,d[13]=Ot,d[14]=Ht,d[15]=Yt,d[16]=jt,d[17]=Jt,d[18]=Kt,0!==u&&(d[19]=u,r.length++),r};function jumboMulTo(e,t,r){return(new FFTM).mulp(e,t,r)}function FFTM(e,t){this.x=e,this.y=t}Math.imul||(c=smallMulTo),BN.prototype.mulTo=function mulTo(e,t){var r=this.length+e.length;return 10===this.length&&10===e.length?c(this,e,t):r<63?smallMulTo(this,e,t):r<1024?function bigMulTo(e,t,r){r.negative=t.negative^e.negative,r.length=e.length+t.length;for(var a=0,n=0,o=0;o>>26)|0)>>>26,s&=67108863}r.words[o]=c,a=s,s=n}return 0!==a?r.words[o]=a:r.length--,r.strip()}(this,e,t):jumboMulTo(this,e,t)},FFTM.prototype.makeRBT=function makeRBT(e){for(var t=new Array(e),r=BN.prototype._countBits(e)-1,a=0;a>=1;return a},FFTM.prototype.permute=function permute(e,t,r,a,n,o){for(var s=0;s>>=1)n++;return 1<>>=13,r[2*o+1]=8191&n,n>>>=13;for(o=2*t;o>=26,t+=a/67108864|0,t+=n>>>26,this.words[r]=67108863&n}return 0!==t&&(this.words[r]=t,this.length++),this},BN.prototype.muln=function muln(e){return this.clone().imuln(e)},BN.prototype.sqr=function sqr(){return this.mul(this)},BN.prototype.isqr=function isqr(){return this.imul(this.clone())},BN.prototype.pow=function pow(e){var t=function toBitArray(e){for(var t=new Array(e.bitLength()),r=0;r>>n}return t}(e);if(0===t.length)return new BN(1);for(var r=this,a=0;a=0);var t,r=e%26,a=(e-r)/26,n=67108863>>>26-r<<26-r;if(0!==r){var o=0;for(t=0;t>>26-r}o&&(this.words[t]=o,this.length++)}if(0!==a){for(t=this.length-1;t>=0;t--)this.words[t+a]=this.words[t];for(t=0;t=0),a=t?(t-t%26)/26:0;var n=e%26,o=Math.min((e-n)/26,this.length),s=67108863^67108863>>>n<o)for(this.length-=o,d=0;d=0&&(0!==u||d>=a);d--){var h=0|this.words[d];this.words[d]=u<<26-n|h>>>n,u=h&s}return c&&0!==u&&(c.words[c.length++]=u),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},BN.prototype.ishrn=function ishrn(e,t,r){return assert(0===this.negative),this.iushrn(e,t,r)},BN.prototype.shln=function shln(e){return this.clone().ishln(e)},BN.prototype.ushln=function ushln(e){return this.clone().iushln(e)},BN.prototype.shrn=function shrn(e){return this.clone().ishrn(e)},BN.prototype.ushrn=function ushrn(e){return this.clone().iushrn(e)},BN.prototype.testn=function testn(e){assert("number"==typeof e&&e>=0);var t=e%26,r=(e-t)/26,a=1<=0);var t=e%26,r=(e-t)/26;if(assert(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==t&&r++,this.length=Math.min(r,this.length),0!==t){var a=67108863^67108863>>>t<=67108864;t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},BN.prototype.isubn=function isubn(e){if(assert("number"==typeof e),assert(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t>26)-(c/67108864|0),this.words[a+r]=67108863&n}for(;a>26,this.words[a+r]=67108863&n;if(0===s)return this.strip();for(assert(-1===s),s=0,a=0;a>26,this.words[a]=67108863&n;return this.negative=1,this.strip()},BN.prototype._wordDiv=function _wordDiv(e,t){var r=(this.length,e.length),a=this.clone(),n=e,o=0|n.words[n.length-1];0!==(r=26-this._countBits(o))&&(n=n.ushln(r),a.iushln(r),o=0|n.words[n.length-1]);var s,c=a.length-n.length;if("mod"!==t){(s=new BN(null)).length=c+1,s.words=new Array(s.length);for(var d=0;d=0;h--){var l=67108864*(0|a.words[n.length+h])+(0|a.words[n.length+h-1]);for(l=Math.min(l/o|0,67108863),a._ishlnsubmul(n,l,h);0!==a.negative;)l--,a.negative=0,a._ishlnsubmul(n,1,h),a.isZero()||(a.negative^=1);s&&(s.words[h]=l)}return s&&s.strip(),a.strip(),"div"!==t&&0!==r&&a.iushrn(r),{div:s||null,mod:a}},BN.prototype.divmod=function divmod(e,t,r){return assert(!e.isZero()),this.isZero()?{div:new BN(0),mod:new BN(0)}:0!==this.negative&&0===e.negative?(o=this.neg().divmod(e,t),"mod"!==t&&(a=o.div.neg()),"div"!==t&&(n=o.mod.neg(),r&&0!==n.negative&&n.iadd(e)),{div:a,mod:n}):0===this.negative&&0!==e.negative?(o=this.divmod(e.neg(),t),"mod"!==t&&(a=o.div.neg()),{div:a,mod:o.mod}):0!=(this.negative&e.negative)?(o=this.neg().divmod(e.neg(),t),"div"!==t&&(n=o.mod.neg(),r&&0!==n.negative&&n.isub(e)),{div:o.div,mod:n}):e.length>this.length||this.cmp(e)<0?{div:new BN(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new BN(this.modn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new BN(this.modn(e.words[0]))}:this._wordDiv(e,t);var a,n,o},BN.prototype.div=function div(e){return this.divmod(e,"div",!1).div},BN.prototype.mod=function mod(e){return this.divmod(e,"mod",!1).mod},BN.prototype.umod=function umod(e){return this.divmod(e,"mod",!0).mod},BN.prototype.divRound=function divRound(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var r=0!==t.div.negative?t.mod.isub(e):t.mod,a=e.ushrn(1),n=e.andln(1),o=r.cmp(a);return o<0||1===n&&0===o?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},BN.prototype.modn=function modn(e){assert(e<=67108863);for(var t=(1<<26)%e,r=0,a=this.length-1;a>=0;a--)r=(t*r+(0|this.words[a]))%e;return r},BN.prototype.idivn=function idivn(e){assert(e<=67108863);for(var t=0,r=this.length-1;r>=0;r--){var a=(0|this.words[r])+67108864*t;this.words[r]=a/e|0,t=a%e}return this.strip()},BN.prototype.divn=function divn(e){return this.clone().idivn(e)},BN.prototype.egcd=function egcd(e){assert(0===e.negative),assert(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var a=new BN(1),n=new BN(0),o=new BN(0),s=new BN(1),c=0;t.isEven()&&r.isEven();)t.iushrn(1),r.iushrn(1),++c;for(var d=r.clone(),u=t.clone();!t.isZero();){for(var h=0,l=1;0==(t.words[0]&l)&&h<26;++h,l<<=1);if(h>0)for(t.iushrn(h);h-- >0;)(a.isOdd()||n.isOdd())&&(a.iadd(d),n.isub(u)),a.iushrn(1),n.iushrn(1);for(var b=0,g=1;0==(r.words[0]&g)&&b<26;++b,g<<=1);if(b>0)for(r.iushrn(b);b-- >0;)(o.isOdd()||s.isOdd())&&(o.iadd(d),s.isub(u)),o.iushrn(1),s.iushrn(1);t.cmp(r)>=0?(t.isub(r),a.isub(o),n.isub(s)):(r.isub(t),o.isub(a),s.isub(n))}return{a:o,b:s,gcd:r.iushln(c)}},BN.prototype._invmp=function _invmp(e){assert(0===e.negative),assert(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var a,n=new BN(1),o=new BN(0),s=r.clone();t.cmpn(1)>0&&r.cmpn(1)>0;){for(var c=0,d=1;0==(t.words[0]&d)&&c<26;++c,d<<=1);if(c>0)for(t.iushrn(c);c-- >0;)n.isOdd()&&n.iadd(s),n.iushrn(1);for(var u=0,h=1;0==(r.words[0]&h)&&u<26;++u,h<<=1);if(u>0)for(r.iushrn(u);u-- >0;)o.isOdd()&&o.iadd(s),o.iushrn(1);t.cmp(r)>=0?(t.isub(r),n.isub(o)):(r.isub(t),o.isub(n))}return(a=0===t.cmpn(1)?n:o).cmpn(0)<0&&a.iadd(e),a},BN.prototype.gcd=function gcd(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),r=e.clone();t.negative=0,r.negative=0;for(var a=0;t.isEven()&&r.isEven();a++)t.iushrn(1),r.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=t.cmp(r);if(n<0){var o=t;t=r,r=o}else if(0===n||0===r.cmpn(1))break;t.isub(r)}return r.iushln(a)},BN.prototype.invm=function invm(e){return this.egcd(e).a.umod(e)},BN.prototype.isEven=function isEven(){return 0==(1&this.words[0])},BN.prototype.isOdd=function isOdd(){return 1==(1&this.words[0])},BN.prototype.andln=function andln(e){return this.words[0]&e},BN.prototype.bincn=function bincn(e){assert("number"==typeof e);var t=e%26,r=(e-t)/26,a=1<>>26,s&=67108863,this.words[o]=s}return 0!==n&&(this.words[o]=n,this.length++),this},BN.prototype.isZero=function isZero(){return 1===this.length&&0===this.words[0]},BN.prototype.cmpn=function cmpn(e){var t,r=e<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this.strip(),this.length>1)t=1;else{r&&(e=-e),assert(e<=67108863,"Number is too big");var a=0|this.words[0];t=a===e?0:ae.length)return 1;if(this.length=0;r--){var a=0|this.words[r],n=0|e.words[r];if(a!==n){an&&(t=1);break}}return t},BN.prototype.gtn=function gtn(e){return 1===this.cmpn(e)},BN.prototype.gt=function gt(e){return 1===this.cmp(e)},BN.prototype.gten=function gten(e){return this.cmpn(e)>=0},BN.prototype.gte=function gte(e){return this.cmp(e)>=0},BN.prototype.ltn=function ltn(e){return-1===this.cmpn(e)},BN.prototype.lt=function lt(e){return-1===this.cmp(e)},BN.prototype.lten=function lten(e){return this.cmpn(e)<=0},BN.prototype.lte=function lte(e){return this.cmp(e)<=0},BN.prototype.eqn=function eqn(e){return 0===this.cmpn(e)},BN.prototype.eq=function eq(e){return 0===this.cmp(e)},BN.red=function red(e){return new Red(e)},BN.prototype.toRed=function toRed(e){return assert(!this.red,"Already a number in reduction context"),assert(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},BN.prototype.fromRed=function fromRed(){return assert(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},BN.prototype._forceRed=function _forceRed(e){return this.red=e,this},BN.prototype.forceRed=function forceRed(e){return assert(!this.red,"Already a number in reduction context"),this._forceRed(e)},BN.prototype.redAdd=function redAdd(e){return assert(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},BN.prototype.redIAdd=function redIAdd(e){return assert(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},BN.prototype.redSub=function redSub(e){return assert(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},BN.prototype.redISub=function redISub(e){return assert(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},BN.prototype.redShl=function redShl(e){return assert(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},BN.prototype.redMul=function redMul(e){return assert(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},BN.prototype.redIMul=function redIMul(e){return assert(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},BN.prototype.redSqr=function redSqr(){return assert(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},BN.prototype.redISqr=function redISqr(){return assert(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},BN.prototype.redSqrt=function redSqrt(){return assert(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},BN.prototype.redInvm=function redInvm(){return assert(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},BN.prototype.redNeg=function redNeg(){return assert(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},BN.prototype.redPow=function redPow(e){return assert(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var d={k256:null,p224:null,p192:null,p25519:null};function MPrime(e,t){this.name=e,this.p=new BN(t,16),this.n=this.p.bitLength(),this.k=new BN(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function K256(){MPrime.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function P224(){MPrime.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function P192(){MPrime.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function P25519(){MPrime.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function Red(e){if("string"==typeof e){var t=BN._prime(e);this.m=t.p,this.prime=t}else assert(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function Mont(e){Red.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new BN(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)}MPrime.prototype._tmp=function _tmp(){var e=new BN(null);return e.words=new Array(Math.ceil(this.n/13)),e},MPrime.prototype.ireduce=function ireduce(e){var t,r=e;do{this.split(r,this.tmp),t=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(t>this.n);var a=t0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},MPrime.prototype.split=function split(e,t){e.iushrn(this.n,0,t)},MPrime.prototype.imulK=function imulK(e){return e.imul(this.k)},inherits(K256,MPrime),K256.prototype.split=function split(e,t){for(var r=4194303,a=Math.min(e.length,9),n=0;n>>22,o=s}o>>>=22,e.words[n-10]=o,0===o&&e.length>10?e.length-=10:e.length-=9},K256.prototype.imulK=function imulK(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,r=0;r>>=26,e.words[r]=n,t=a}return 0!==t&&(e.words[e.length++]=t),e},BN._prime=function prime(e){if(d[e])return d[e];var prime;if("k256"===e)prime=new K256;else if("p224"===e)prime=new P224;else if("p192"===e)prime=new P192;else{if("p25519"!==e)throw new Error("Unknown prime "+e);prime=new P25519}return d[e]=prime,prime},Red.prototype._verify1=function _verify1(e){assert(0===e.negative,"red works only with positives"),assert(e.red,"red works only with red numbers")},Red.prototype._verify2=function _verify2(e,t){assert(0==(e.negative|t.negative),"red works only with positives"),assert(e.red&&e.red===t.red,"red works only with red numbers")},Red.prototype.imod=function imod(e){return this.prime?this.prime.ireduce(e)._forceRed(this):e.umod(this.m)._forceRed(this)},Red.prototype.neg=function neg(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},Red.prototype.add=function add(e,t){this._verify2(e,t);var r=e.add(t);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},Red.prototype.iadd=function iadd(e,t){this._verify2(e,t);var r=e.iadd(t);return r.cmp(this.m)>=0&&r.isub(this.m),r},Red.prototype.sub=function sub(e,t){this._verify2(e,t);var r=e.sub(t);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},Red.prototype.isub=function isub(e,t){this._verify2(e,t);var r=e.isub(t);return r.cmpn(0)<0&&r.iadd(this.m),r},Red.prototype.shl=function shl(e,t){return this._verify1(e),this.imod(e.ushln(t))},Red.prototype.imul=function imul(e,t){return this._verify2(e,t),this.imod(e.imul(t))},Red.prototype.mul=function mul(e,t){return this._verify2(e,t),this.imod(e.mul(t))},Red.prototype.isqr=function isqr(e){return this.imul(e,e.clone())},Red.prototype.sqr=function sqr(e){return this.mul(e,e)},Red.prototype.sqrt=function sqrt(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(assert(t%2==1),3===t){var r=this.m.add(new BN(1)).iushrn(2);return this.pow(e,r)}for(var a=this.m.subn(1),n=0;!a.isZero()&&0===a.andln(1);)n++,a.iushrn(1);assert(!a.isZero());var o=new BN(1).toRed(this),s=o.redNeg(),c=this.m.subn(1).iushrn(1),d=this.m.bitLength();for(d=new BN(2*d*d).toRed(this);0!==this.pow(d,c).cmp(s);)d.redIAdd(s);for(var u=this.pow(d,a),h=this.pow(e,a.addn(1).iushrn(1)),l=this.pow(e,a),b=n;0!==l.cmp(o);){for(var g=l,p=0;0!==g.cmp(o);p++)g=g.redSqr();assert(p=0;a--){for(var d=t.words[a],u=c-1;u>=0;u--){var h=d>>u&1;n!==r[0]&&(n=this.sqr(n)),0!==h||0!==o?(o<<=1,o|=h,(4===++s||0===a&&0===u)&&(n=this.mul(n,r[o]),s=0,o=0)):s=0}c=26}return n},Red.prototype.convertTo=function convertTo(e){var t=e.umod(this.m);return t===e?t.clone():t},Red.prototype.convertFrom=function convertFrom(e){var t=e.clone();return t.red=null,t},BN.mont=function mont(e){return new Mont(e)},inherits(Mont,Red),Mont.prototype.convertTo=function convertTo(e){return this.imod(e.ushln(this.shift))},Mont.prototype.convertFrom=function convertFrom(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},Mont.prototype.imul=function imul(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var r=e.imul(t),a=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(a).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},Mont.prototype.mul=function mul(e,t){if(e.isZero()||t.isZero())return new BN(0)._forceRed(this);var r=e.mul(t),a=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(a).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},Mont.prototype.invm=function invm(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(e=r.nmd(e),this)},(e,t,r)=>{e.exports=r(916)(r(917))},(e,t)=>{"use strict";var r=t;function zero2(e){return 1===e.length?"0"+e:e}function toHex(e){for(var t="",r=0;r>8,s=255&n;o?r.push(o,s):r.push(s)}return r},r.zero2=zero2,r.toHex=toHex,r.encode=function encode(e,t){return"hex"===t?toHex(e):e}},(e,t,r)=>{var a;function Rand(e){this.rand=e}if(e.exports=function rand(e){return a||(a=new Rand(null)),a.generate(e)},e.exports.Rand=Rand,Rand.prototype.generate=function generate(e){return this._rand(e)},Rand.prototype._rand=function _rand(e){if(this.rand.getBytes)return this.rand.getBytes(e);for(var t=new Uint8Array(e),r=0;r{"use strict";var a=t;a.base=r(280),a.short=r(919),a.mont=r(920),a.edwards=r(921)},(e,t,r)=>{"use strict";var a=r(114),n=r(281),o=r(923),s=r(163),c=a.sum32,d=a.sum32_4,u=a.sum32_5,h=o.ch32,l=o.maj32,b=o.s0_256,g=o.s1_256,p=o.g0_256,B=o.g1_256,m=n.BlockHash,I=[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 SHA256(){if(!(this instanceof SHA256))return new SHA256;m.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=I,this.W=new Array(64)}a.inherits(SHA256,m),e.exports=SHA256,SHA256.blockSize=512,SHA256.outSize=256,SHA256.hmacStrength=192,SHA256.padLength=64,SHA256.prototype._update=function _update(e,t){for(var r=this.W,a=0;a<16;a++)r[a]=e[t+a];for(;a{"use strict";var a=r(114),n=r(281),o=r(163),s=a.rotr64_hi,c=a.rotr64_lo,d=a.shr64_hi,u=a.shr64_lo,h=a.sum64,l=a.sum64_hi,b=a.sum64_lo,g=a.sum64_4_hi,p=a.sum64_4_lo,B=a.sum64_5_hi,m=a.sum64_5_lo,I=n.BlockHash,y=[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 SHA512(){if(!(this instanceof SHA512))return new SHA512;I.call(this),this.h=[1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209],this.k=y,this.W=new Array(160)}function ch64_hi(e,t,r,a,n){var o=e&r^~e&n;return o<0&&(o+=4294967296),o}function ch64_lo(e,t,r,a,n,o){var s=t&a^~t&o;return s<0&&(s+=4294967296),s}function maj64_hi(e,t,r,a,n){var o=e&r^e&n^r&n;return o<0&&(o+=4294967296),o}function maj64_lo(e,t,r,a,n,o){var s=t&a^t&o^a&o;return s<0&&(s+=4294967296),s}function s0_512_hi(e,t){var r=s(e,t,28)^s(t,e,2)^s(t,e,7);return r<0&&(r+=4294967296),r}function s0_512_lo(e,t){var r=c(e,t,28)^c(t,e,2)^c(t,e,7);return r<0&&(r+=4294967296),r}function s1_512_hi(e,t){var r=s(e,t,14)^s(e,t,18)^s(t,e,9);return r<0&&(r+=4294967296),r}function s1_512_lo(e,t){var r=c(e,t,14)^c(e,t,18)^c(t,e,9);return r<0&&(r+=4294967296),r}function g0_512_hi(e,t){var r=s(e,t,1)^s(e,t,8)^d(e,t,7);return r<0&&(r+=4294967296),r}function g0_512_lo(e,t){var r=c(e,t,1)^c(e,t,8)^u(e,t,7);return r<0&&(r+=4294967296),r}function g1_512_hi(e,t){var r=s(e,t,19)^s(t,e,29)^d(e,t,6);return r<0&&(r+=4294967296),r}function g1_512_lo(e,t){var r=c(e,t,19)^c(t,e,29)^u(e,t,6);return r<0&&(r+=4294967296),r}a.inherits(SHA512,I),e.exports=SHA512,SHA512.blockSize=1024,SHA512.outSize=512,SHA512.hmacStrength=192,SHA512.padLength=128,SHA512.prototype._prepareBlock=function _prepareBlock(e,t){for(var r=this.W,a=0;a<32;a++)r[a]=e[t+a];for(;a{"use strict";var a=r(1),n=65536,o=4294967295;var s=r(60).Buffer,c=r.g.crypto||r.g.msCrypto;c&&c.getRandomValues?e.exports=function randomBytes(e,t){if(e>o)throw new RangeError("requested too many random bytes");var r=s.allocUnsafe(e);if(e>0)if(e>n)for(var d=0;d{e.exports=function isHexPrefixed(e){if("string"!=typeof e)throw new Error("[is-hex-prefixed] value must be type 'string', is currently type "+typeof e+", while checking isHexPrefixed.");return"0x"===e.slice(0,2)}},(e,t,r)=>{"use strict";var a=r(60).Buffer,n=r(358).Transform;function HashBase(e){n.call(this),this._block=a.allocUnsafe(e),this._blockSize=e,this._blockOffset=0,this._length=[0,0,0,0],this._finalized=!1}r(23)(HashBase,n),HashBase.prototype._transform=function(e,t,r){var a=null;try{this.update(e,t)}catch(e){a=e}r(a)},HashBase.prototype._flush=function(e){var t=null;try{this.push(this.digest())}catch(e){t=e}e(t)},HashBase.prototype.update=function(e,t){if(function throwIfNotStringOrBuffer(e,t){if(!a.isBuffer(e)&&"string"!=typeof e)throw new TypeError(t+" must be a string or a buffer")}(e,"Data"),this._finalized)throw new Error("Digest already called");a.isBuffer(e)||(e=a.from(e,t));for(var r=this._block,n=0;this._blockOffset+e.length-n>=this._blockSize;){for(var o=this._blockOffset;o0;++s)this._length[s]+=c,(c=this._length[s]/4294967296|0)>0&&(this._length[s]-=4294967296*c);return this},HashBase.prototype._update=function(){throw new Error("_update is not implemented")},HashBase.prototype.digest=function(e){if(this._finalized)throw new Error("Digest already called");this._finalized=!0;var t=this._digest();void 0!==e&&(t=t.toString(e)),this._block.fill(0),this._blockOffset=0;for(var r=0;r<4;++r)this._length[r]=0;return t},HashBase.prototype._digest=function(){throw new Error("_digest is not implemented")},e.exports=HashBase},(e,t,r)=>{"use strict";var a,n=r(1);e.exports=Readable,Readable.ReadableState=ReadableState;r(32).EventEmitter;var o=function EElistenerCount(e,t){return e.listeners(t).length},s=r(943),c=r(2).Buffer,d=r.g.Uint8Array||function(){};var u,h=r(85);u=h&&h.debuglog?h.debuglog("stream"):function debug(){};var l,b,g,p=r(944),B=r(539),m=r(540).getHighWaterMark,I=r(242).a,y=I.ERR_INVALID_ARG_TYPE,v=I.ERR_STREAM_PUSH_AFTER_EOF,x=I.ERR_METHOD_NOT_IMPLEMENTED,C=I.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;r(23)(Readable,s);var Q=B.errorOrDestroy,w=["error","close","destroy","pause","resume"];function ReadableState(e,t,n){a=a||r(196),e=e||{},"boolean"!=typeof n&&(n=t instanceof a),this.objectMode=!!e.objectMode,n&&(this.objectMode=this.objectMode||!!e.readableObjectMode),this.highWaterMark=m(this,e,"readableHighWaterMark",n),this.buffer=new p,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&&(l||(l=r(542).a),this.decoder=new l(e.encoding),this.encoding=e.encoding)}function Readable(e){if(a=a||r(196),!(this instanceof Readable))return new Readable(e);var t=this instanceof a;this._readableState=new ReadableState(e,this,t),this.readable=!0,e&&("function"==typeof e.read&&(this._read=e.read),"function"==typeof e.destroy&&(this._destroy=e.destroy)),s.call(this)}function readableAddChunk(e,t,r,a,n){u("readableAddChunk",t);var o,s=e._readableState;if(null===t)s.reading=!1,function onEofChunk(e,t){if(u("onEofChunk"),t.ended)return;if(t.decoder){var r=t.decoder.end();r&&r.length&&(t.buffer.push(r),t.length+=t.objectMode?1:r.length)}t.ended=!0,t.sync?emitReadable(e):(t.needReadable=!1,t.emittedReadable||(t.emittedReadable=!0,emitReadable_(e)))}(e,s);else if(n||(o=function chunkInvalid(e,t){var r;(function _isUint8Array(e){return c.isBuffer(e)||e instanceof d})(t)||"string"==typeof t||void 0===t||e.objectMode||(r=new y("chunk",["string","Buffer","Uint8Array"],t));return r}(s,t)),o)Q(e,o);else if(s.objectMode||t&&t.length>0)if("string"==typeof t||s.objectMode||Object.getPrototypeOf(t)===c.prototype||(t=function _uint8ArrayToBuffer(e){return c.from(e)}(t)),a)s.endEmitted?Q(e,new C):addChunk(e,s,t,!0);else if(s.ended)Q(e,new v);else{if(s.destroyed)return!1;s.reading=!1,s.decoder&&!r?(t=s.decoder.write(t),s.objectMode||0!==t.length?addChunk(e,s,t,!1):maybeReadMore(e,s)):addChunk(e,s,t,!1)}else a||(s.reading=!1,maybeReadMore(e,s));return!s.ended&&(s.lengtht.highWaterMark&&(t.highWaterMark=function computeNewHighWaterMark(e){return e>=_?e=_:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function emitReadable(e){var t=e._readableState;u("emitReadable",t.needReadable,t.emittedReadable),t.needReadable=!1,t.emittedReadable||(u("emitReadable",t.flowing),t.emittedReadable=!0,n.nextTick(emitReadable_,e))}function emitReadable_(e){var t=e._readableState;u("emitReadable_",t.destroyed,t.length,t.ended),t.destroyed||!t.length&&!t.ended||(e.emit("readable"),t.emittedReadable=!1),t.needReadable=!t.flowing&&!t.ended&&t.length<=t.highWaterMark,flow(e)}function maybeReadMore(e,t){t.readingMore||(t.readingMore=!0,n.nextTick(maybeReadMore_,e,t))}function maybeReadMore_(e,t){for(;!t.reading&&!t.ended&&(t.length0,t.resumeScheduled&&!t.paused?t.flowing=!0:e.listenerCount("data")>0&&e.resume()}function nReadingNextTick(e){u("readable nexttick read 0"),e.read(0)}function resume_(e,t){u("resume",t.reading),t.reading||e.read(0),t.resumeScheduled=!1,e.emit("resume"),flow(e),t.flowing&&!t.reading&&e.read(0)}function flow(e){var t=e._readableState;for(u("flow",t.flowing);t.flowing&&null!==e.read(););}function fromList(e,t){return 0===t.length?null:(t.objectMode?r=t.buffer.shift():!e||e>=t.length?(r=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.first():t.buffer.concat(t.length),t.buffer.clear()):r=t.buffer.consume(e,t.decoder),r);var r}function endReadable(e){var t=e._readableState;u("endReadable",t.endEmitted),t.endEmitted||(t.ended=!0,n.nextTick(endReadableNT,t,e))}function endReadableNT(e,t){if(u("endReadableNT",e.endEmitted,e.length),!e.endEmitted&&0===e.length&&(e.endEmitted=!0,t.readable=!1,t.emit("end"),e.autoDestroy)){var r=t._writableState;(!r||r.autoDestroy&&r.finished)&&t.destroy()}}function indexOf(e,t){for(var r=0,a=e.length;r=t.highWaterMark:t.length>0)||t.ended))return u("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?endReadable(this):emitReadable(this),null;if(0===(e=howMuchToRead(e,t))&&t.ended)return 0===t.length&&endReadable(this),null;var a,n=t.needReadable;return u("need readable",n),(0===t.length||t.length-e0?fromList(e,t):null)?(t.needReadable=t.length<=t.highWaterMark,e=0):(t.length-=e,t.awaitDrain=0),0===t.length&&(t.ended||(t.needReadable=!0),r!==e&&t.ended&&endReadable(this)),null!==a&&this.emit("data",a),a},Readable.prototype._read=function(e){Q(this,new x("_read()"))},Readable.prototype.pipe=function(e,t){var r=this,a=this._readableState;switch(a.pipesCount){case 0:a.pipes=e;break;case 1:a.pipes=[a.pipes,e];break;default:a.pipes.push(e)}a.pipesCount+=1,u("pipe count=%d opts=%j",a.pipesCount,t);var s=(!t||!1!==t.end)&&e!==n.stdout&&e!==n.stderr?onend:unpipe;function onunpipe(t,n){u("onunpipe"),t===r&&n&&!1===n.hasUnpiped&&(n.hasUnpiped=!0,function cleanup(){u("cleanup"),e.removeListener("close",onclose),e.removeListener("finish",onfinish),e.removeListener("drain",c),e.removeListener("error",onerror),e.removeListener("unpipe",onunpipe),r.removeListener("end",onend),r.removeListener("end",unpipe),r.removeListener("data",ondata),d=!0,!a.awaitDrain||e._writableState&&!e._writableState.needDrain||c()}())}function onend(){u("onend"),e.end()}a.endEmitted?n.nextTick(s):r.once("end",s),e.on("unpipe",onunpipe);var c=function pipeOnDrain(e){return function pipeOnDrainFunctionResult(){var t=e._readableState;u("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&o(e,"data")&&(t.flowing=!0,flow(e))}}(r);e.on("drain",c);var d=!1;function ondata(t){u("ondata");var n=e.write(t);u("dest.write",n),!1===n&&((1===a.pipesCount&&a.pipes===e||a.pipesCount>1&&-1!==indexOf(a.pipes,e))&&!d&&(u("false write response, pause",a.awaitDrain),a.awaitDrain++),r.pause())}function onerror(t){u("onerror",t),unpipe(),e.removeListener("error",onerror),0===o(e,"error")&&Q(e,t)}function onclose(){e.removeListener("finish",onfinish),unpipe()}function onfinish(){u("onfinish"),e.removeListener("close",onclose),unpipe()}function unpipe(){u("unpipe"),r.unpipe(e)}return r.on("data",ondata),function prependListener(e,t,r){if("function"==typeof e.prependListener)return e.prependListener(t,r);e._events&&e._events[t]?Array.isArray(e._events[t])?e._events[t].unshift(r):e._events[t]=[r,e._events[t]]:e.on(t,r)}(e,"error",onerror),e.once("close",onclose),e.once("finish",onfinish),e.emit("pipe",r),a.flowing||(u("pipe resume"),r.resume()),e},Readable.prototype.unpipe=function(e){var t=this._readableState,r={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes||(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,r)),this;if(!e){var a=t.pipes,n=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var o=0;o0,!1!==a.flowing&&this.resume()):"readable"===e&&(a.endEmitted||a.readableListening||(a.readableListening=a.needReadable=!0,a.flowing=!1,a.emittedReadable=!1,u("on readable",a.length,a.reading),a.length?emitReadable(this):a.reading||n.nextTick(nReadingNextTick,this))),r},Readable.prototype.addListener=Readable.prototype.on,Readable.prototype.removeListener=function(e,t){var r=s.prototype.removeListener.call(this,e,t);return"readable"===e&&n.nextTick(updateReadableListening,this),r},Readable.prototype.removeAllListeners=function(e){var t=s.prototype.removeAllListeners.apply(this,arguments);return"readable"!==e&&void 0!==e||n.nextTick(updateReadableListening,this),t},Readable.prototype.resume=function(){var e=this._readableState;return e.flowing||(u("resume"),e.flowing=!e.readableListening,function resume(e,t){t.resumeScheduled||(t.resumeScheduled=!0,n.nextTick(resume_,e,t))}(this,e)),e.paused=!1,this},Readable.prototype.pause=function(){return u("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(u("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},Readable.prototype.wrap=function(e){var t=this,r=this._readableState,a=!1;for(var n in e.on("end",(function(){if(u("wrapped end"),r.decoder&&!r.ended){var e=r.decoder.end();e&&e.length&&t.push(e)}t.push(null)})),e.on("data",(function(n){(u("wrapped data"),r.decoder&&(n=r.decoder.write(n)),r.objectMode&&null==n)||(r.objectMode||n&&n.length)&&(t.push(n)||(a=!0,e.pause()))})),e)void 0===this[n]&&"function"==typeof e[n]&&(this[n]=function methodWrap(t){return function methodWrapReturnFunction(){return e[t].apply(e,arguments)}}(n));for(var o=0;o{"use strict";var a=r(1);function emitErrorAndCloseNT(e,t){emitErrorNT(e,t),emitCloseNT(e)}function emitCloseNT(e){e._writableState&&!e._writableState.emitClose||e._readableState&&!e._readableState.emitClose||e.emit("close")}function emitErrorNT(e,t){e.emit("error",t)}e.exports={destroy:function destroy(e,t){var r=this,n=this._readableState&&this._readableState.destroyed,o=this._writableState&&this._writableState.destroyed;return n||o?(t?t(e):e&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,a.nextTick(emitErrorNT,this,e)):a.nextTick(emitErrorNT,this,e)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,(function(e){!t&&e?r._writableState?r._writableState.errorEmitted?a.nextTick(emitCloseNT,r):(r._writableState.errorEmitted=!0,a.nextTick(emitErrorAndCloseNT,r,e)):a.nextTick(emitErrorAndCloseNT,r,e):t?(a.nextTick(emitCloseNT,r),t(e)):a.nextTick(emitCloseNT,r)})),this)},undestroy:function undestroy(){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 errorOrDestroy(e,t){var r=e._readableState,a=e._writableState;r&&r.autoDestroy||a&&a.autoDestroy?e.destroy(t):e.emit("error",t)}}},(e,t,r)=>{"use strict";var a=r(242).a.ERR_INVALID_OPT_VALUE;e.exports={getHighWaterMark:function getHighWaterMark(e,t,r,n){var o=function highWaterMarkFrom(e,t,r){return null!=e.highWaterMark?e.highWaterMark:t?e[r]:null}(t,n,r);if(null!=o){if(!isFinite(o)||Math.floor(o)!==o||o<0)throw new a(n?r:"highWaterMark",o);return Math.floor(o)}return e.objectMode?16:16384}}},(e,t,r)=>{"use strict";var a,n=r(1);function CorkedRequest(e){var t=this;this.next=null,this.entry=null,this.finish=function(){!function onCorkedFinish(e,t,r){var a=e.entry;e.entry=null;for(;a;){var n=a.callback;t.pendingcb--,n(r),a=a.next}t.corkedRequestsFree.next=e}(t,e)}}e.exports=Writable,Writable.WritableState=WritableState;var o={deprecate:r(945)},s=r(943),c=r(2).Buffer,d=r.g.Uint8Array||function(){};var u,h=r(539),l=r(540).getHighWaterMark,b=r(242).a,g=b.ERR_INVALID_ARG_TYPE,p=b.ERR_METHOD_NOT_IMPLEMENTED,B=b.ERR_MULTIPLE_CALLBACK,m=b.ERR_STREAM_CANNOT_PIPE,I=b.ERR_STREAM_DESTROYED,y=b.ERR_STREAM_NULL_VALUES,v=b.ERR_STREAM_WRITE_AFTER_END,x=b.ERR_UNKNOWN_ENCODING,C=h.errorOrDestroy;function nop(){}function WritableState(e,t,o){a=a||r(196),e=e||{},"boolean"!=typeof o&&(o=t instanceof a),this.objectMode=!!e.objectMode,o&&(this.objectMode=this.objectMode||!!e.writableObjectMode),this.highWaterMark=l(this,e,"writableHighWaterMark",o),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var s=!1===e.decodeStrings;this.decodeStrings=!s,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 onwrite(e,t){var r=e._writableState,a=r.sync,o=r.writecb;if("function"!=typeof o)throw new B;if(function onwriteStateUpdate(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}(r),t)!function onwriteError(e,t,r,a,o){--t.pendingcb,r?(n.nextTick(o,a),n.nextTick(finishMaybe,e,t),e._writableState.errorEmitted=!0,C(e,a)):(o(a),e._writableState.errorEmitted=!0,C(e,a),finishMaybe(e,t))}(e,r,a,t,o);else{var s=needFinish(r)||e.destroyed;s||r.corked||r.bufferProcessing||!r.bufferedRequest||clearBuffer(e,r),a?n.nextTick(afterWrite,e,r,s,o):afterWrite(e,r,s,o)}}(t,e)},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 CorkedRequest(this)}function Writable(e){var t=this instanceof(a=a||r(196));if(!t&&!u.call(Writable,this))return new Writable(e);this._writableState=new WritableState(e,this,t),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),s.call(this)}function doWrite(e,t,r,a,n,o,s){t.writelen=a,t.writecb=s,t.writing=!0,t.sync=!0,t.destroyed?t.onwrite(new I("write")):r?e._writev(n,t.onwrite):e._write(n,o,t.onwrite),t.sync=!1}function afterWrite(e,t,r,a){r||function onwriteDrain(e,t){0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}(e,t),t.pendingcb--,a(),finishMaybe(e,t)}function clearBuffer(e,t){t.bufferProcessing=!0;var r=t.bufferedRequest;if(e._writev&&r&&r.next){var a=t.bufferedRequestCount,n=new Array(a),o=t.corkedRequestsFree;o.entry=r;for(var s=0,c=!0;r;)n[s]=r,r.isBuf||(c=!1),r=r.next,s+=1;n.allBuffers=c,doWrite(e,t,!0,t.length,n,"",o.finish),t.pendingcb++,t.lastBufferedRequest=null,o.next?(t.corkedRequestsFree=o.next,o.next=null):t.corkedRequestsFree=new CorkedRequest(t),t.bufferedRequestCount=0}else{for(;r;){var d=r.chunk,u=r.encoding,h=r.callback;if(doWrite(e,t,!1,t.objectMode?1:d.length,d,u,h),r=r.next,t.bufferedRequestCount--,t.writing)break}null===r&&(t.lastBufferedRequest=null)}t.bufferedRequest=r,t.bufferProcessing=!1}function needFinish(e){return e.ending&&0===e.length&&null===e.bufferedRequest&&!e.finished&&!e.writing}function callFinal(e,t){e._final((function(r){t.pendingcb--,r&&C(e,r),t.prefinished=!0,e.emit("prefinish"),finishMaybe(e,t)}))}function finishMaybe(e,t){var r=needFinish(t);if(r&&(function prefinish(e,t){t.prefinished||t.finalCalled||("function"!=typeof e._final||t.destroyed?(t.prefinished=!0,e.emit("prefinish")):(t.pendingcb++,t.finalCalled=!0,n.nextTick(callFinal,e,t)))}(e,t),0===t.pendingcb&&(t.finished=!0,e.emit("finish"),t.autoDestroy))){var a=e._readableState;(!a||a.autoDestroy&&a.endEmitted)&&e.destroy()}return r}r(23)(Writable,s),WritableState.prototype.getBuffer=function getBuffer(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},function(){try{Object.defineProperty(WritableState.prototype,"buffer",{get:o.deprecate((function writableStateBufferGetter(){return this.getBuffer()}),"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(e){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(u=Function.prototype[Symbol.hasInstance],Object.defineProperty(Writable,Symbol.hasInstance,{value:function value(e){return!!u.call(this,e)||this===Writable&&(e&&e._writableState instanceof WritableState)}})):u=function realHasInstance(e){return e instanceof this},Writable.prototype.pipe=function(){C(this,new m)},Writable.prototype.write=function(e,t,r){var a=this._writableState,o=!1,s=!a.objectMode&&function _isUint8Array(e){return c.isBuffer(e)||e instanceof d}(e);return s&&!c.isBuffer(e)&&(e=function _uint8ArrayToBuffer(e){return c.from(e)}(e)),"function"==typeof t&&(r=t,t=null),s?t="buffer":t||(t=a.defaultEncoding),"function"!=typeof r&&(r=nop),a.ending?function writeAfterEnd(e,t){var r=new v;C(e,r),n.nextTick(t,r)}(this,r):(s||function validChunk(e,t,r,a){var o;return null===r?o=new y:"string"==typeof r||t.objectMode||(o=new g("chunk",["string","Buffer"],r)),!o||(C(e,o),n.nextTick(a,o),!1)}(this,a,e,r))&&(a.pendingcb++,o=function writeOrBuffer(e,t,r,a,n,o){if(!r){var s=function decodeChunk(e,t,r){e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=c.from(t,r));return t}(t,a,n);a!==s&&(r=!0,n="buffer",a=s)}var d=t.objectMode?1:a.length;t.length+=d;var u=t.length-1))throw new x(e);return this._writableState.defaultEncoding=e,this},Object.defineProperty(Writable.prototype,"writableBuffer",{enumerable:!1,get:function get(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(Writable.prototype,"writableHighWaterMark",{enumerable:!1,get:function get(){return this._writableState.highWaterMark}}),Writable.prototype._write=function(e,t,r){r(new p("_write()"))},Writable.prototype._writev=null,Writable.prototype.end=function(e,t,r){var a=this._writableState;return"function"==typeof e?(r=e,e=null,t=null):"function"==typeof t&&(r=t,t=null),null!=e&&this.write(e,t),a.corked&&(a.corked=1,this.uncork()),a.ending||function endWritable(e,t,r){t.ending=!0,finishMaybe(e,t),r&&(t.finished?n.nextTick(r):e.once("finish",r));t.ended=!0,e.writable=!1}(this,a,r),this},Object.defineProperty(Writable.prototype,"writableLength",{enumerable:!1,get:function get(){return this._writableState.length}}),Object.defineProperty(Writable.prototype,"destroyed",{enumerable:!1,get:function get(){return void 0!==this._writableState&&this._writableState.destroyed},set:function set(e){this._writableState&&(this._writableState.destroyed=e)}}),Writable.prototype.destroy=h.destroy,Writable.prototype._undestroy=h.undestroy,Writable.prototype._destroy=function(e,t){t(e)}},(e,t,r)=>{"use strict";var a=r(60).Buffer,n=a.isEncoding||function(e){switch((e=""+e)&&e.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 StringDecoder(e){var t;switch(this.encoding=function normalizeEncoding(e){var t=function _normalizeEncoding(e){if(!e)return"utf8";for(var t;;)switch(e){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 e;default:if(t)return;e=(""+e).toLowerCase(),t=!0}}(e);if("string"!=typeof t&&(a.isEncoding===n||!n(e)))throw new Error("Unknown encoding: "+e);return t||e}(e),this.encoding){case"utf16le":this.text=utf16Text,this.end=utf16End,t=4;break;case"utf8":this.fillLast=utf8FillLast,t=4;break;case"base64":this.text=base64Text,this.end=base64End,t=3;break;default:return this.write=simpleWrite,void(this.end=simpleEnd)}this.lastNeed=0,this.lastTotal=0,this.lastChar=a.allocUnsafe(t)}function utf8CheckByte(e){return e<=127?0:e>>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function utf8FillLast(e){var t=this.lastTotal-this.lastNeed,r=function utf8CheckExtraBytes(e,t,r){if(128!=(192&t[0]))return e.lastNeed=0,"�";if(e.lastNeed>1&&t.length>1){if(128!=(192&t[1]))return e.lastNeed=1,"�";if(e.lastNeed>2&&t.length>2&&128!=(192&t[2]))return e.lastNeed=2,"�"}}(this,e);return void 0!==r?r:this.lastNeed<=e.length?(e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(e.copy(this.lastChar,t,0,e.length),void(this.lastNeed-=e.length))}function utf16Text(e,t){if((e.length-t)%2==0){var r=e.toString("utf16le",t);if(r){var a=r.charCodeAt(r.length-1);if(a>=55296&&a<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",t,e.length-1)}function utf16End(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return t+this.lastChar.toString("utf16le",0,r)}return t}function base64Text(e,t){var r=(e.length-t)%3;return 0===r?e.toString("base64",t):(this.lastNeed=3-r,this.lastTotal=3,1===r?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString("base64",t,e.length-r))}function base64End(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function simpleWrite(e){return e.toString(this.encoding)}function simpleEnd(e){return e&&e.length?this.write(e):""}t.a=StringDecoder,StringDecoder.prototype.write=function(e){if(0===e.length)return"";var t,r;if(this.lastNeed){if(void 0===(t=this.fillLast(e)))return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r=0)return n>0&&(e.lastNeed=n-1),n;if(--a=0)return n>0&&(e.lastNeed=n-2),n;if(--a=0)return n>0&&(2===n?n=0:e.lastNeed=n-3),n;return 0}(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=r;var a=e.length-(r-this.lastNeed);return e.copy(this.lastChar,0,a),e.toString("utf8",t,a)},StringDecoder.prototype.fillLast=function(e){if(this.lastNeed<=e.length)return e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,e.length),this.lastNeed-=e.length}},(e,t,r)=>{"use strict";e.exports=Transform;var a=r(242).a,n=a.ERR_METHOD_NOT_IMPLEMENTED,o=a.ERR_MULTIPLE_CALLBACK,s=a.ERR_TRANSFORM_ALREADY_TRANSFORMING,c=a.ERR_TRANSFORM_WITH_LENGTH_0,d=r(196);function afterTransform(e,t){var r=this._transformState;r.transforming=!1;var a=r.writecb;if(null===a)return this.emit("error",new o);r.writechunk=null,r.writecb=null,null!=t&&this.push(t),a(e);var n=this._readableState;n.reading=!1,(n.needReadable||n.length{var a=r(23),n=r(197),o=r(60).Buffer,s=[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],c=new Array(64);function Sha256(){this.init(),this._w=c,n.call(this,64,56)}function ch(e,t,r){return r^e&(t^r)}function maj(e,t,r){return e&t|r&(e|t)}function sigma0(e){return(e>>>2|e<<30)^(e>>>13|e<<19)^(e>>>22|e<<10)}function sigma1(e){return(e>>>6|e<<26)^(e>>>11|e<<21)^(e>>>25|e<<7)}function gamma0(e){return(e>>>7|e<<25)^(e>>>18|e<<14)^e>>>3}a(Sha256,n),Sha256.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},Sha256.prototype._update=function(e){for(var t,r=this._w,a=0|this._a,n=0|this._b,o=0|this._c,c=0|this._d,d=0|this._e,u=0|this._f,h=0|this._g,l=0|this._h,b=0;b<16;++b)r[b]=e.readInt32BE(4*b);for(;b<64;++b)r[b]=0|(((t=r[b-2])>>>17|t<<15)^(t>>>19|t<<13)^t>>>10)+r[b-7]+gamma0(r[b-15])+r[b-16];for(var g=0;g<64;++g){var p=l+sigma1(d)+ch(d,u,h)+s[g]+r[g]|0,B=sigma0(a)+maj(a,n,o)|0;l=h,h=u,u=d,d=c+p|0,c=o,o=n,n=a,a=p+B|0}this._a=a+this._a|0,this._b=n+this._b|0,this._c=o+this._c|0,this._d=c+this._d|0,this._e=d+this._e|0,this._f=u+this._f|0,this._g=h+this._g|0,this._h=l+this._h|0},Sha256.prototype._hash=function(){var e=o.allocUnsafe(32);return e.writeInt32BE(this._a,0),e.writeInt32BE(this._b,4),e.writeInt32BE(this._c,8),e.writeInt32BE(this._d,12),e.writeInt32BE(this._e,16),e.writeInt32BE(this._f,20),e.writeInt32BE(this._g,24),e.writeInt32BE(this._h,28),e},e.exports=Sha256},(e,t,r)=>{var a=r(23),n=r(197),o=r(60).Buffer,s=[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],c=new Array(160);function Sha512(){this.init(),this._w=c,n.call(this,128,112)}function Ch(e,t,r){return r^e&(t^r)}function maj(e,t,r){return e&t|r&(e|t)}function sigma0(e,t){return(e>>>28|t<<4)^(t>>>2|e<<30)^(t>>>7|e<<25)}function sigma1(e,t){return(e>>>14|t<<18)^(e>>>18|t<<14)^(t>>>9|e<<23)}function Gamma0(e,t){return(e>>>1|t<<31)^(e>>>8|t<<24)^e>>>7}function Gamma0l(e,t){return(e>>>1|t<<31)^(e>>>8|t<<24)^(e>>>7|t<<25)}function Gamma1(e,t){return(e>>>19|t<<13)^(t>>>29|e<<3)^e>>>6}function Gamma1l(e,t){return(e>>>19|t<<13)^(t>>>29|e<<3)^(e>>>6|t<<26)}function getCarry(e,t){return e>>>0>>0?1:0}a(Sha512,n),Sha512.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},Sha512.prototype._update=function(e){for(var t=this._w,r=0|this._ah,a=0|this._bh,n=0|this._ch,o=0|this._dh,c=0|this._eh,d=0|this._fh,u=0|this._gh,h=0|this._hh,l=0|this._al,b=0|this._bl,g=0|this._cl,p=0|this._dl,B=0|this._el,m=0|this._fl,I=0|this._gl,y=0|this._hl,v=0;v<32;v+=2)t[v]=e.readInt32BE(4*v),t[v+1]=e.readInt32BE(4*v+4);for(;v<160;v+=2){var x=t[v-30],C=t[v-30+1],Q=Gamma0(x,C),w=Gamma0l(C,x),_=Gamma1(x=t[v-4],C=t[v-4+1]),k=Gamma1l(C,x),N=t[v-14],D=t[v-14+1],U=t[v-32],G=t[v-32+1],T=w+D|0,L=Q+N+getCarry(T,w)|0;L=(L=L+_+getCarry(T=T+k|0,k)|0)+U+getCarry(T=T+G|0,G)|0,t[v]=L,t[v+1]=T}for(var P=0;P<160;P+=2){L=t[P],T=t[P+1];var q=maj(r,a,n),O=maj(l,b,g),H=sigma0(r,l),Y=sigma0(l,r),j=sigma1(c,B),J=sigma1(B,c),z=s[P],W=s[P+1],V=Ch(c,d,u),X=Ch(B,m,I),$=y+J|0,et=h+j+getCarry($,y)|0;et=(et=(et=et+V+getCarry($=$+X|0,X)|0)+z+getCarry($=$+W|0,W)|0)+L+getCarry($=$+T|0,T)|0;var tt=Y+O|0,rt=H+q+getCarry(tt,Y)|0;h=u,y=I,u=d,I=m,d=c,m=B,c=o+et+getCarry(B=p+$|0,p)|0,o=n,p=g,n=a,g=b,a=r,b=l,r=et+rt+getCarry(l=$+tt|0,$)|0}this._al=this._al+l|0,this._bl=this._bl+b|0,this._cl=this._cl+g|0,this._dl=this._dl+p|0,this._el=this._el+B|0,this._fl=this._fl+m|0,this._gl=this._gl+I|0,this._hl=this._hl+y|0,this._ah=this._ah+r+getCarry(this._al,l)|0,this._bh=this._bh+a+getCarry(this._bl,b)|0,this._ch=this._ch+n+getCarry(this._cl,g)|0,this._dh=this._dh+o+getCarry(this._dl,p)|0,this._eh=this._eh+c+getCarry(this._el,B)|0,this._fh=this._fh+d+getCarry(this._fl,m)|0,this._gh=this._gh+u+getCarry(this._gl,I)|0,this._hh=this._hh+h+getCarry(this._hl,y)|0},Sha512.prototype._hash=function(){var e=o.allocUnsafe(64);function writeInt64BE(t,r,a){e.writeInt32BE(t,a),e.writeInt32BE(r,a+4)}return writeInt64BE(this._ah,this._al,0),writeInt64BE(this._bh,this._bl,8),writeInt64BE(this._ch,this._cl,16),writeInt64BE(this._dh,this._dl,24),writeInt64BE(this._eh,this._el,32),writeInt64BE(this._fh,this._fl,40),writeInt64BE(this._gh,this._gl,48),writeInt64BE(this._hh,this._hl,56),e},e.exports=Sha512},function(e,t,r){"use strict";var a=r(2).Buffer,n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.Address=void 0;var o=n(r(6)),s=n(r(134)),c=r(76),d=r(35),u=function(){function Address(e){o.default(20===e.length,"Invalid address length"),this.buf=e}return Address.zero=function(){return new Address(c.zeros(20))},Address.fromString=function(e){return o.default(d.isValidAddress(e),"Invalid address"),new Address(c.toBuffer(e))},Address.fromPublicKey=function(e){return o.default(a.isBuffer(e),"Public key should be Buffer"),new Address(d.pubToAddress(e))},Address.fromPrivateKey=function(e){return o.default(a.isBuffer(e),"Private key should be Buffer"),new Address(d.privateToAddress(e))},Address.generate=function(e,t){return o.default(s.default.isBN(t)),new Address(d.generateAddress(e.buf,t.toArrayLike(a)))},Address.generate2=function(e,t,r){return o.default(a.isBuffer(t)),o.default(a.isBuffer(r)),new Address(d.generateAddress2(e.buf,t,r))},Address.prototype.equals=function(e){return this.buf.equals(e.buf)},Address.prototype.isZero=function(){return this.equals(Address.zero())},Address.prototype.isPrecompileOrSystemAddress=function(){var e=new s.default(this.buf),t=new s.default(0),r=new s.default("ffff","hex");return e.gte(t)&&e.lte(r)},Address.prototype.toString=function(){return"0x"+this.buf.toString("hex")},Address.prototype.toBuffer=function(){return a.from(this.buf)},Address}();t.Address=u},function(e,t,r){"use strict";var a=r(2).Buffer,n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.hashPersonalMessage=t.isValidSignature=t.fromRpcSig=t.toCompactSig=t.toRpcSig=t.ecrecover=t.ecsign=void 0;var o=r(162),s=n(r(134)),c=r(76),d=r(61),u=r(357),h=r(243);function calculateSigRecovery(e,t){var r=h.toType(e,h.TypeOutput.BN);if(!t)return r.subn(27);var a=h.toType(t,h.TypeOutput.BN);return r.sub(a.muln(2).addn(35))}function isValidSigRecovery(e){var t=new s.default(e);return t.eqn(0)||t.eqn(1)}t.ecsign=function ecsign(e,t,r){var n=o.ecdsaSign(e,t),s=n.signature,c=n.recid,d=a.from(s.slice(0,32)),u=a.from(s.slice(32,64));if(!r||"number"==typeof r){if(r&&!Number.isSafeInteger(r))throw new Error("The provided number is greater than MAX_SAFE_INTEGER (please use an alternative input type)");return{r:d,s:u,v:r?c+(2*r+35):c+27}}return{r:d,s:u,v:h.toType(r,h.TypeOutput.BN).muln(2).addn(35).addn(c).toArrayLike(a)}},t.ecrecover=function(e,t,r,n,s){var d=a.concat([c.setLengthLeft(r,32),c.setLengthLeft(n,32)],64),u=calculateSigRecovery(t,s);if(!isValidSigRecovery(u))throw new Error("Invalid signature v value");var h=o.ecdsaRecover(d,u.toNumber(),e);return a.from(o.publicKeyConvert(h,!1).slice(1))},t.toRpcSig=function(e,t,r,n){if(!isValidSigRecovery(calculateSigRecovery(e,n)))throw new Error("Invalid signature v value");return c.bufferToHex(a.concat([c.setLengthLeft(t,32),c.setLengthLeft(r,32),c.toBuffer(e)]))},t.toCompactSig=function(e,t,r,n){if(!isValidSigRecovery(calculateSigRecovery(e,n)))throw new Error("Invalid signature v value");var o=h.toType(e,h.TypeOutput.Number),s=r;return(o>28&&o%2==1||1===o||28===o)&&((s=a.from(r))[0]|=128),c.bufferToHex(a.concat([c.setLengthLeft(t,32),c.setLengthLeft(s,32)]))},t.fromRpcSig=function(e){var t,r,a,n=c.toBuffer(e);if(n.length>=65)t=n.slice(0,32),r=n.slice(32,64),a=c.bufferToInt(n.slice(64));else{if(64!==n.length)throw new Error("Invalid signature length");t=n.slice(0,32),r=n.slice(32,64),a=c.bufferToInt(n.slice(32,33))>>7,r[0]&=127}return a<27&&(a+=27),{v:a,r:t,s:r}},t.isValidSignature=function(e,t,r,a,n){void 0===a&&(a=!0);var o=new s.default("7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0",16),c=new s.default("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141",16);if(32!==t.length||32!==r.length)return!1;if(!isValidSigRecovery(calculateSigRecovery(e,n)))return!1;var d=new s.default(t),u=new s.default(r);return!(d.isZero()||d.gt(c)||u.isZero()||u.gt(c))&&(!a||1!==u.cmp(o))},t.hashPersonalMessage=function(e){u.assertIsBuffer(e);var t=a.from("Ethereum Signed Message:\n"+e.length.toString(),"utf-8");return d.keccak(a.concat([t,e]))}},function(e,t,r){!function(e,t){"use strict";function assert(e,t){if(!e)throw new Error(t||"Assertion failed")}function inherits(e,t){e.super_=t;var TempCtor=function(){};TempCtor.prototype=t.prototype,e.prototype=new TempCtor,e.prototype.constructor=e}function BN(e,t,r){if(BN.isBN(e))return e;this.negative=0,this.words=null,this.length=0,this.red=null,null!==e&&("le"!==t&&"be"!==t||(r=t,t=10),this._init(e||0,t||10,r||"be"))}var a;"object"==typeof e?e.exports=BN:t.BN=BN,BN.BN=BN,BN.wordSize=26;try{a="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:r(17).Buffer}catch(e){}function parseHex4Bits(e,t){var r=e.charCodeAt(t);return r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:r-48&15}function parseHexByte(e,t,r){var a=parseHex4Bits(e,r);return r-1>=t&&(a|=parseHex4Bits(e,r-1)<<4),a}function parseBase(e,t,r,a){for(var n=0,o=Math.min(e.length,r),s=t;s=49?c-49+10:c>=17?c-17+10:c}return n}BN.isBN=function isBN(e){return e instanceof BN||null!==e&&"object"==typeof e&&e.constructor.wordSize===BN.wordSize&&Array.isArray(e.words)},BN.max=function max(e,t){return e.cmp(t)>0?e:t},BN.min=function min(e,t){return e.cmp(t)<0?e:t},BN.prototype._init=function init(e,t,r){if("number"==typeof e)return this._initNumber(e,t,r);if("object"==typeof e)return this._initArray(e,t,r);"hex"===t&&(t=16),assert(t===(0|t)&&t>=2&&t<=36);var a=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&(a++,this.negative=1),a=0;a-=3)o=e[a]|e[a-1]<<8|e[a-2]<<16,this.words[n]|=o<>>26-s&67108863,(s+=24)>=26&&(s-=26,n++);else if("le"===r)for(a=0,n=0;a>>26-s&67108863,(s+=24)>=26&&(s-=26,n++);return this.strip()},BN.prototype._parseHex=function _parseHex(e,t,r){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var a=0;a=t;a-=2)n=parseHexByte(e,t,a)<=18?(o-=18,s+=1,this.words[s]|=n>>>26):o+=8;else for(a=(e.length-t)%2==0?t+1:t;a=18?(o-=18,s+=1,this.words[s]|=n>>>26):o+=8;this.strip()},BN.prototype._parseBase=function _parseBase(e,t,r){this.words=[0],this.length=1;for(var a=0,n=1;n<=67108863;n*=t)a++;a--,n=n/t|0;for(var o=e.length-r,s=o%a,c=Math.min(o,o-s)+r,d=0,u=r;u1&&0===this.words[this.length-1];)this.length--;return this._normSign()},BN.prototype._normSign=function _normSign(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},BN.prototype.inspect=function inspect(){return(this.red?""};var n=["","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"],o=[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],s=[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 smallMulTo(e,t,r){r.negative=t.negative^e.negative;var a=e.length+t.length|0;r.length=a,a=a-1|0;var n=0|e.words[0],o=0|t.words[0],s=n*o,c=67108863&s,d=s/67108864|0;r.words[0]=c;for(var u=1;u>>26,l=67108863&d,b=Math.min(u,t.length-1),g=Math.max(0,u-e.length+1);g<=b;g++){var p=u-g|0;h+=(s=(n=0|e.words[p])*(o=0|t.words[g])+l)/67108864|0,l=67108863&s}r.words[u]=0|l,d=0|h}return 0!==d?r.words[u]=0|d:r.length--,r.strip()}BN.prototype.toString=function toString(e,t){var r;if(t=0|t||1,16===(e=e||10)||"hex"===e){r="";for(var a=0,c=0,d=0;d>>24-a&16777215)||d!==this.length-1?n[6-h.length]+h+r:h+r,(a+=2)>=26&&(a-=26,d--)}for(0!==c&&(r=c.toString(16)+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(e===(0|e)&&e>=2&&e<=36){var l=o[e],b=s[e];r="";var g=this.clone();for(g.negative=0;!g.isZero();){var p=g.modn(b).toString(e);r=(g=g.idivn(b)).isZero()?p+r:n[l-p.length]+p+r}for(this.isZero()&&(r="0"+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}assert(!1,"Base should be between 2 and 36")},BN.prototype.toNumber=function toNumber(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&assert(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},BN.prototype.toJSON=function toJSON(){return this.toString(16)},BN.prototype.toBuffer=function toBuffer(e,t){return assert(void 0!==a),this.toArrayLike(a,e,t)},BN.prototype.toArray=function toArray(e,t){return this.toArrayLike(Array,e,t)},BN.prototype.toArrayLike=function toArrayLike(e,t,r){var a=this.byteLength(),n=r||Math.max(1,a);assert(a<=n,"byte array longer than desired length"),assert(n>0,"Requested array length <= 0"),this.strip();var o,s,c="le"===t,d=new e(n),u=this.clone();if(c){for(s=0;!u.isZero();s++)o=u.andln(255),u.iushrn(8),d[s]=o;for(;s=4096&&(r+=13,t>>>=13),t>=64&&(r+=7,t>>>=7),t>=8&&(r+=4,t>>>=4),t>=2&&(r+=2,t>>>=2),r+t},BN.prototype._zeroBits=function _zeroBits(e){if(0===e)return 26;var t=e,r=0;return 0==(8191&t)&&(r+=13,t>>>=13),0==(127&t)&&(r+=7,t>>>=7),0==(15&t)&&(r+=4,t>>>=4),0==(3&t)&&(r+=2,t>>>=2),0==(1&t)&&r++,r},BN.prototype.bitLength=function bitLength(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},BN.prototype.zeroBits=function zeroBits(){if(this.isZero())return 0;for(var e=0,t=0;te.length?this.clone().ior(e):e.clone().ior(this)},BN.prototype.uor=function uor(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},BN.prototype.iuand=function iuand(e){var t;t=this.length>e.length?e:this;for(var r=0;re.length?this.clone().iand(e):e.clone().iand(this)},BN.prototype.uand=function uand(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},BN.prototype.iuxor=function iuxor(e){var t,r;this.length>e.length?(t=this,r=e):(t=e,r=this);for(var a=0;ae.length?this.clone().ixor(e):e.clone().ixor(this)},BN.prototype.uxor=function uxor(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},BN.prototype.inotn=function inotn(e){assert("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),r=e%26;this._expand(t),r>0&&t--;for(var a=0;a0&&(this.words[a]=~this.words[a]&67108863>>26-r),this.strip()},BN.prototype.notn=function notn(e){return this.clone().inotn(e)},BN.prototype.setn=function setn(e,t){assert("number"==typeof e&&e>=0);var r=e/26|0,a=e%26;return this._expand(r+1),this.words[r]=t?this.words[r]|1<e.length?(r=this,a=e):(r=e,a=this);for(var n=0,o=0;o>>26;for(;0!==n&&o>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;oe.length?this.clone().iadd(e):e.clone().iadd(this)},BN.prototype.isub=function isub(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var r,a,n=this.cmp(e);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,a=e):(r=e,a=this);for(var o=0,s=0;s>26,this.words[s]=67108863&t;for(;0!==o&&s>26,this.words[s]=67108863&t;if(0===o&&s>>13,g=0|s[1],p=8191&g,B=g>>>13,m=0|s[2],I=8191&m,y=m>>>13,v=0|s[3],x=8191&v,C=v>>>13,Q=0|s[4],w=8191&Q,_=Q>>>13,k=0|s[5],N=8191&k,D=k>>>13,U=0|s[6],G=8191&U,T=U>>>13,L=0|s[7],P=8191&L,q=L>>>13,O=0|s[8],H=8191&O,Y=O>>>13,j=0|s[9],J=8191&j,z=j>>>13,W=0|c[0],V=8191&W,X=W>>>13,$=0|c[1],et=8191&$,tt=$>>>13,rt=0|c[2],at=8191&rt,it=rt>>>13,nt=0|c[3],ot=8191&nt,At=nt>>>13,st=0|c[4],ct=8191&st,dt=st>>>13,ut=0|c[5],ht=8191&ut,bt=ut>>>13,pt=0|c[6],Bt=8191&pt,mt=pt>>>13,It=0|c[7],Et=8191&It,yt=It>>>13,vt=0|c[8],xt=8191&vt,Ct=vt>>>13,Qt=0|c[9],wt=8191&Qt,Mt=Qt>>>13;r.negative=e.negative^t.negative,r.length=19;var _t=(u+(a=Math.imul(l,V))|0)+((8191&(n=(n=Math.imul(l,X))+Math.imul(b,V)|0))<<13)|0;u=((o=Math.imul(b,X))+(n>>>13)|0)+(_t>>>26)|0,_t&=67108863,a=Math.imul(p,V),n=(n=Math.imul(p,X))+Math.imul(B,V)|0,o=Math.imul(B,X);var kt=(u+(a=a+Math.imul(l,et)|0)|0)+((8191&(n=(n=n+Math.imul(l,tt)|0)+Math.imul(b,et)|0))<<13)|0;u=((o=o+Math.imul(b,tt)|0)+(n>>>13)|0)+(kt>>>26)|0,kt&=67108863,a=Math.imul(I,V),n=(n=Math.imul(I,X))+Math.imul(y,V)|0,o=Math.imul(y,X),a=a+Math.imul(p,et)|0,n=(n=n+Math.imul(p,tt)|0)+Math.imul(B,et)|0,o=o+Math.imul(B,tt)|0;var St=(u+(a=a+Math.imul(l,at)|0)|0)+((8191&(n=(n=n+Math.imul(l,it)|0)+Math.imul(b,at)|0))<<13)|0;u=((o=o+Math.imul(b,it)|0)+(n>>>13)|0)+(St>>>26)|0,St&=67108863,a=Math.imul(x,V),n=(n=Math.imul(x,X))+Math.imul(C,V)|0,o=Math.imul(C,X),a=a+Math.imul(I,et)|0,n=(n=n+Math.imul(I,tt)|0)+Math.imul(y,et)|0,o=o+Math.imul(y,tt)|0,a=a+Math.imul(p,at)|0,n=(n=n+Math.imul(p,it)|0)+Math.imul(B,at)|0,o=o+Math.imul(B,it)|0;var Nt=(u+(a=a+Math.imul(l,ot)|0)|0)+((8191&(n=(n=n+Math.imul(l,At)|0)+Math.imul(b,ot)|0))<<13)|0;u=((o=o+Math.imul(b,At)|0)+(n>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,a=Math.imul(w,V),n=(n=Math.imul(w,X))+Math.imul(_,V)|0,o=Math.imul(_,X),a=a+Math.imul(x,et)|0,n=(n=n+Math.imul(x,tt)|0)+Math.imul(C,et)|0,o=o+Math.imul(C,tt)|0,a=a+Math.imul(I,at)|0,n=(n=n+Math.imul(I,it)|0)+Math.imul(y,at)|0,o=o+Math.imul(y,it)|0,a=a+Math.imul(p,ot)|0,n=(n=n+Math.imul(p,At)|0)+Math.imul(B,ot)|0,o=o+Math.imul(B,At)|0;var Dt=(u+(a=a+Math.imul(l,ct)|0)|0)+((8191&(n=(n=n+Math.imul(l,dt)|0)+Math.imul(b,ct)|0))<<13)|0;u=((o=o+Math.imul(b,dt)|0)+(n>>>13)|0)+(Dt>>>26)|0,Dt&=67108863,a=Math.imul(N,V),n=(n=Math.imul(N,X))+Math.imul(D,V)|0,o=Math.imul(D,X),a=a+Math.imul(w,et)|0,n=(n=n+Math.imul(w,tt)|0)+Math.imul(_,et)|0,o=o+Math.imul(_,tt)|0,a=a+Math.imul(x,at)|0,n=(n=n+Math.imul(x,it)|0)+Math.imul(C,at)|0,o=o+Math.imul(C,it)|0,a=a+Math.imul(I,ot)|0,n=(n=n+Math.imul(I,At)|0)+Math.imul(y,ot)|0,o=o+Math.imul(y,At)|0,a=a+Math.imul(p,ct)|0,n=(n=n+Math.imul(p,dt)|0)+Math.imul(B,ct)|0,o=o+Math.imul(B,dt)|0;var Rt=(u+(a=a+Math.imul(l,ht)|0)|0)+((8191&(n=(n=n+Math.imul(l,bt)|0)+Math.imul(b,ht)|0))<<13)|0;u=((o=o+Math.imul(b,bt)|0)+(n>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,a=Math.imul(G,V),n=(n=Math.imul(G,X))+Math.imul(T,V)|0,o=Math.imul(T,X),a=a+Math.imul(N,et)|0,n=(n=n+Math.imul(N,tt)|0)+Math.imul(D,et)|0,o=o+Math.imul(D,tt)|0,a=a+Math.imul(w,at)|0,n=(n=n+Math.imul(w,it)|0)+Math.imul(_,at)|0,o=o+Math.imul(_,it)|0,a=a+Math.imul(x,ot)|0,n=(n=n+Math.imul(x,At)|0)+Math.imul(C,ot)|0,o=o+Math.imul(C,At)|0,a=a+Math.imul(I,ct)|0,n=(n=n+Math.imul(I,dt)|0)+Math.imul(y,ct)|0,o=o+Math.imul(y,dt)|0,a=a+Math.imul(p,ht)|0,n=(n=n+Math.imul(p,bt)|0)+Math.imul(B,ht)|0,o=o+Math.imul(B,bt)|0;var Ft=(u+(a=a+Math.imul(l,Bt)|0)|0)+((8191&(n=(n=n+Math.imul(l,mt)|0)+Math.imul(b,Bt)|0))<<13)|0;u=((o=o+Math.imul(b,mt)|0)+(n>>>13)|0)+(Ft>>>26)|0,Ft&=67108863,a=Math.imul(P,V),n=(n=Math.imul(P,X))+Math.imul(q,V)|0,o=Math.imul(q,X),a=a+Math.imul(G,et)|0,n=(n=n+Math.imul(G,tt)|0)+Math.imul(T,et)|0,o=o+Math.imul(T,tt)|0,a=a+Math.imul(N,at)|0,n=(n=n+Math.imul(N,it)|0)+Math.imul(D,at)|0,o=o+Math.imul(D,it)|0,a=a+Math.imul(w,ot)|0,n=(n=n+Math.imul(w,At)|0)+Math.imul(_,ot)|0,o=o+Math.imul(_,At)|0,a=a+Math.imul(x,ct)|0,n=(n=n+Math.imul(x,dt)|0)+Math.imul(C,ct)|0,o=o+Math.imul(C,dt)|0,a=a+Math.imul(I,ht)|0,n=(n=n+Math.imul(I,bt)|0)+Math.imul(y,ht)|0,o=o+Math.imul(y,bt)|0,a=a+Math.imul(p,Bt)|0,n=(n=n+Math.imul(p,mt)|0)+Math.imul(B,Bt)|0,o=o+Math.imul(B,mt)|0;var Ut=(u+(a=a+Math.imul(l,Et)|0)|0)+((8191&(n=(n=n+Math.imul(l,yt)|0)+Math.imul(b,Et)|0))<<13)|0;u=((o=o+Math.imul(b,yt)|0)+(n>>>13)|0)+(Ut>>>26)|0,Ut&=67108863,a=Math.imul(H,V),n=(n=Math.imul(H,X))+Math.imul(Y,V)|0,o=Math.imul(Y,X),a=a+Math.imul(P,et)|0,n=(n=n+Math.imul(P,tt)|0)+Math.imul(q,et)|0,o=o+Math.imul(q,tt)|0,a=a+Math.imul(G,at)|0,n=(n=n+Math.imul(G,it)|0)+Math.imul(T,at)|0,o=o+Math.imul(T,it)|0,a=a+Math.imul(N,ot)|0,n=(n=n+Math.imul(N,At)|0)+Math.imul(D,ot)|0,o=o+Math.imul(D,At)|0,a=a+Math.imul(w,ct)|0,n=(n=n+Math.imul(w,dt)|0)+Math.imul(_,ct)|0,o=o+Math.imul(_,dt)|0,a=a+Math.imul(x,ht)|0,n=(n=n+Math.imul(x,bt)|0)+Math.imul(C,ht)|0,o=o+Math.imul(C,bt)|0,a=a+Math.imul(I,Bt)|0,n=(n=n+Math.imul(I,mt)|0)+Math.imul(y,Bt)|0,o=o+Math.imul(y,mt)|0,a=a+Math.imul(p,Et)|0,n=(n=n+Math.imul(p,yt)|0)+Math.imul(B,Et)|0,o=o+Math.imul(B,yt)|0;var Gt=(u+(a=a+Math.imul(l,xt)|0)|0)+((8191&(n=(n=n+Math.imul(l,Ct)|0)+Math.imul(b,xt)|0))<<13)|0;u=((o=o+Math.imul(b,Ct)|0)+(n>>>13)|0)+(Gt>>>26)|0,Gt&=67108863,a=Math.imul(J,V),n=(n=Math.imul(J,X))+Math.imul(z,V)|0,o=Math.imul(z,X),a=a+Math.imul(H,et)|0,n=(n=n+Math.imul(H,tt)|0)+Math.imul(Y,et)|0,o=o+Math.imul(Y,tt)|0,a=a+Math.imul(P,at)|0,n=(n=n+Math.imul(P,it)|0)+Math.imul(q,at)|0,o=o+Math.imul(q,it)|0,a=a+Math.imul(G,ot)|0,n=(n=n+Math.imul(G,At)|0)+Math.imul(T,ot)|0,o=o+Math.imul(T,At)|0,a=a+Math.imul(N,ct)|0,n=(n=n+Math.imul(N,dt)|0)+Math.imul(D,ct)|0,o=o+Math.imul(D,dt)|0,a=a+Math.imul(w,ht)|0,n=(n=n+Math.imul(w,bt)|0)+Math.imul(_,ht)|0,o=o+Math.imul(_,bt)|0,a=a+Math.imul(x,Bt)|0,n=(n=n+Math.imul(x,mt)|0)+Math.imul(C,Bt)|0,o=o+Math.imul(C,mt)|0,a=a+Math.imul(I,Et)|0,n=(n=n+Math.imul(I,yt)|0)+Math.imul(y,Et)|0,o=o+Math.imul(y,yt)|0,a=a+Math.imul(p,xt)|0,n=(n=n+Math.imul(p,Ct)|0)+Math.imul(B,xt)|0,o=o+Math.imul(B,Ct)|0;var Tt=(u+(a=a+Math.imul(l,wt)|0)|0)+((8191&(n=(n=n+Math.imul(l,Mt)|0)+Math.imul(b,wt)|0))<<13)|0;u=((o=o+Math.imul(b,Mt)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,a=Math.imul(J,et),n=(n=Math.imul(J,tt))+Math.imul(z,et)|0,o=Math.imul(z,tt),a=a+Math.imul(H,at)|0,n=(n=n+Math.imul(H,it)|0)+Math.imul(Y,at)|0,o=o+Math.imul(Y,it)|0,a=a+Math.imul(P,ot)|0,n=(n=n+Math.imul(P,At)|0)+Math.imul(q,ot)|0,o=o+Math.imul(q,At)|0,a=a+Math.imul(G,ct)|0,n=(n=n+Math.imul(G,dt)|0)+Math.imul(T,ct)|0,o=o+Math.imul(T,dt)|0,a=a+Math.imul(N,ht)|0,n=(n=n+Math.imul(N,bt)|0)+Math.imul(D,ht)|0,o=o+Math.imul(D,bt)|0,a=a+Math.imul(w,Bt)|0,n=(n=n+Math.imul(w,mt)|0)+Math.imul(_,Bt)|0,o=o+Math.imul(_,mt)|0,a=a+Math.imul(x,Et)|0,n=(n=n+Math.imul(x,yt)|0)+Math.imul(C,Et)|0,o=o+Math.imul(C,yt)|0,a=a+Math.imul(I,xt)|0,n=(n=n+Math.imul(I,Ct)|0)+Math.imul(y,xt)|0,o=o+Math.imul(y,Ct)|0;var Lt=(u+(a=a+Math.imul(p,wt)|0)|0)+((8191&(n=(n=n+Math.imul(p,Mt)|0)+Math.imul(B,wt)|0))<<13)|0;u=((o=o+Math.imul(B,Mt)|0)+(n>>>13)|0)+(Lt>>>26)|0,Lt&=67108863,a=Math.imul(J,at),n=(n=Math.imul(J,it))+Math.imul(z,at)|0,o=Math.imul(z,it),a=a+Math.imul(H,ot)|0,n=(n=n+Math.imul(H,At)|0)+Math.imul(Y,ot)|0,o=o+Math.imul(Y,At)|0,a=a+Math.imul(P,ct)|0,n=(n=n+Math.imul(P,dt)|0)+Math.imul(q,ct)|0,o=o+Math.imul(q,dt)|0,a=a+Math.imul(G,ht)|0,n=(n=n+Math.imul(G,bt)|0)+Math.imul(T,ht)|0,o=o+Math.imul(T,bt)|0,a=a+Math.imul(N,Bt)|0,n=(n=n+Math.imul(N,mt)|0)+Math.imul(D,Bt)|0,o=o+Math.imul(D,mt)|0,a=a+Math.imul(w,Et)|0,n=(n=n+Math.imul(w,yt)|0)+Math.imul(_,Et)|0,o=o+Math.imul(_,yt)|0,a=a+Math.imul(x,xt)|0,n=(n=n+Math.imul(x,Ct)|0)+Math.imul(C,xt)|0,o=o+Math.imul(C,Ct)|0;var Pt=(u+(a=a+Math.imul(I,wt)|0)|0)+((8191&(n=(n=n+Math.imul(I,Mt)|0)+Math.imul(y,wt)|0))<<13)|0;u=((o=o+Math.imul(y,Mt)|0)+(n>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,a=Math.imul(J,ot),n=(n=Math.imul(J,At))+Math.imul(z,ot)|0,o=Math.imul(z,At),a=a+Math.imul(H,ct)|0,n=(n=n+Math.imul(H,dt)|0)+Math.imul(Y,ct)|0,o=o+Math.imul(Y,dt)|0,a=a+Math.imul(P,ht)|0,n=(n=n+Math.imul(P,bt)|0)+Math.imul(q,ht)|0,o=o+Math.imul(q,bt)|0,a=a+Math.imul(G,Bt)|0,n=(n=n+Math.imul(G,mt)|0)+Math.imul(T,Bt)|0,o=o+Math.imul(T,mt)|0,a=a+Math.imul(N,Et)|0,n=(n=n+Math.imul(N,yt)|0)+Math.imul(D,Et)|0,o=o+Math.imul(D,yt)|0,a=a+Math.imul(w,xt)|0,n=(n=n+Math.imul(w,Ct)|0)+Math.imul(_,xt)|0,o=o+Math.imul(_,Ct)|0;var qt=(u+(a=a+Math.imul(x,wt)|0)|0)+((8191&(n=(n=n+Math.imul(x,Mt)|0)+Math.imul(C,wt)|0))<<13)|0;u=((o=o+Math.imul(C,Mt)|0)+(n>>>13)|0)+(qt>>>26)|0,qt&=67108863,a=Math.imul(J,ct),n=(n=Math.imul(J,dt))+Math.imul(z,ct)|0,o=Math.imul(z,dt),a=a+Math.imul(H,ht)|0,n=(n=n+Math.imul(H,bt)|0)+Math.imul(Y,ht)|0,o=o+Math.imul(Y,bt)|0,a=a+Math.imul(P,Bt)|0,n=(n=n+Math.imul(P,mt)|0)+Math.imul(q,Bt)|0,o=o+Math.imul(q,mt)|0,a=a+Math.imul(G,Et)|0,n=(n=n+Math.imul(G,yt)|0)+Math.imul(T,Et)|0,o=o+Math.imul(T,yt)|0,a=a+Math.imul(N,xt)|0,n=(n=n+Math.imul(N,Ct)|0)+Math.imul(D,xt)|0,o=o+Math.imul(D,Ct)|0;var Ot=(u+(a=a+Math.imul(w,wt)|0)|0)+((8191&(n=(n=n+Math.imul(w,Mt)|0)+Math.imul(_,wt)|0))<<13)|0;u=((o=o+Math.imul(_,Mt)|0)+(n>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,a=Math.imul(J,ht),n=(n=Math.imul(J,bt))+Math.imul(z,ht)|0,o=Math.imul(z,bt),a=a+Math.imul(H,Bt)|0,n=(n=n+Math.imul(H,mt)|0)+Math.imul(Y,Bt)|0,o=o+Math.imul(Y,mt)|0,a=a+Math.imul(P,Et)|0,n=(n=n+Math.imul(P,yt)|0)+Math.imul(q,Et)|0,o=o+Math.imul(q,yt)|0,a=a+Math.imul(G,xt)|0,n=(n=n+Math.imul(G,Ct)|0)+Math.imul(T,xt)|0,o=o+Math.imul(T,Ct)|0;var Ht=(u+(a=a+Math.imul(N,wt)|0)|0)+((8191&(n=(n=n+Math.imul(N,Mt)|0)+Math.imul(D,wt)|0))<<13)|0;u=((o=o+Math.imul(D,Mt)|0)+(n>>>13)|0)+(Ht>>>26)|0,Ht&=67108863,a=Math.imul(J,Bt),n=(n=Math.imul(J,mt))+Math.imul(z,Bt)|0,o=Math.imul(z,mt),a=a+Math.imul(H,Et)|0,n=(n=n+Math.imul(H,yt)|0)+Math.imul(Y,Et)|0,o=o+Math.imul(Y,yt)|0,a=a+Math.imul(P,xt)|0,n=(n=n+Math.imul(P,Ct)|0)+Math.imul(q,xt)|0,o=o+Math.imul(q,Ct)|0;var Yt=(u+(a=a+Math.imul(G,wt)|0)|0)+((8191&(n=(n=n+Math.imul(G,Mt)|0)+Math.imul(T,wt)|0))<<13)|0;u=((o=o+Math.imul(T,Mt)|0)+(n>>>13)|0)+(Yt>>>26)|0,Yt&=67108863,a=Math.imul(J,Et),n=(n=Math.imul(J,yt))+Math.imul(z,Et)|0,o=Math.imul(z,yt),a=a+Math.imul(H,xt)|0,n=(n=n+Math.imul(H,Ct)|0)+Math.imul(Y,xt)|0,o=o+Math.imul(Y,Ct)|0;var jt=(u+(a=a+Math.imul(P,wt)|0)|0)+((8191&(n=(n=n+Math.imul(P,Mt)|0)+Math.imul(q,wt)|0))<<13)|0;u=((o=o+Math.imul(q,Mt)|0)+(n>>>13)|0)+(jt>>>26)|0,jt&=67108863,a=Math.imul(J,xt),n=(n=Math.imul(J,Ct))+Math.imul(z,xt)|0,o=Math.imul(z,Ct);var Jt=(u+(a=a+Math.imul(H,wt)|0)|0)+((8191&(n=(n=n+Math.imul(H,Mt)|0)+Math.imul(Y,wt)|0))<<13)|0;u=((o=o+Math.imul(Y,Mt)|0)+(n>>>13)|0)+(Jt>>>26)|0,Jt&=67108863;var Kt=(u+(a=Math.imul(J,wt))|0)+((8191&(n=(n=Math.imul(J,Mt))+Math.imul(z,wt)|0))<<13)|0;return u=((o=Math.imul(z,Mt))+(n>>>13)|0)+(Kt>>>26)|0,Kt&=67108863,d[0]=_t,d[1]=kt,d[2]=St,d[3]=Nt,d[4]=Dt,d[5]=Rt,d[6]=Ft,d[7]=Ut,d[8]=Gt,d[9]=Tt,d[10]=Lt,d[11]=Pt,d[12]=qt,d[13]=Ot,d[14]=Ht,d[15]=Yt,d[16]=jt,d[17]=Jt,d[18]=Kt,0!==u&&(d[19]=u,r.length++),r};function jumboMulTo(e,t,r){return(new FFTM).mulp(e,t,r)}function FFTM(e,t){this.x=e,this.y=t}Math.imul||(c=smallMulTo),BN.prototype.mulTo=function mulTo(e,t){var r=this.length+e.length;return 10===this.length&&10===e.length?c(this,e,t):r<63?smallMulTo(this,e,t):r<1024?function bigMulTo(e,t,r){r.negative=t.negative^e.negative,r.length=e.length+t.length;for(var a=0,n=0,o=0;o>>26)|0)>>>26,s&=67108863}r.words[o]=c,a=s,s=n}return 0!==a?r.words[o]=a:r.length--,r.strip()}(this,e,t):jumboMulTo(this,e,t)},FFTM.prototype.makeRBT=function makeRBT(e){for(var t=new Array(e),r=BN.prototype._countBits(e)-1,a=0;a>=1;return a},FFTM.prototype.permute=function permute(e,t,r,a,n,o){for(var s=0;s>>=1)n++;return 1<>>=13,r[2*o+1]=8191&n,n>>>=13;for(o=2*t;o>=26,t+=a/67108864|0,t+=n>>>26,this.words[r]=67108863&n}return 0!==t&&(this.words[r]=t,this.length++),this},BN.prototype.muln=function muln(e){return this.clone().imuln(e)},BN.prototype.sqr=function sqr(){return this.mul(this)},BN.prototype.isqr=function isqr(){return this.imul(this.clone())},BN.prototype.pow=function pow(e){var t=function toBitArray(e){for(var t=new Array(e.bitLength()),r=0;r>>n}return t}(e);if(0===t.length)return new BN(1);for(var r=this,a=0;a=0);var t,r=e%26,a=(e-r)/26,n=67108863>>>26-r<<26-r;if(0!==r){var o=0;for(t=0;t>>26-r}o&&(this.words[t]=o,this.length++)}if(0!==a){for(t=this.length-1;t>=0;t--)this.words[t+a]=this.words[t];for(t=0;t=0),a=t?(t-t%26)/26:0;var n=e%26,o=Math.min((e-n)/26,this.length),s=67108863^67108863>>>n<o)for(this.length-=o,d=0;d=0&&(0!==u||d>=a);d--){var h=0|this.words[d];this.words[d]=u<<26-n|h>>>n,u=h&s}return c&&0!==u&&(c.words[c.length++]=u),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},BN.prototype.ishrn=function ishrn(e,t,r){return assert(0===this.negative),this.iushrn(e,t,r)},BN.prototype.shln=function shln(e){return this.clone().ishln(e)},BN.prototype.ushln=function ushln(e){return this.clone().iushln(e)},BN.prototype.shrn=function shrn(e){return this.clone().ishrn(e)},BN.prototype.ushrn=function ushrn(e){return this.clone().iushrn(e)},BN.prototype.testn=function testn(e){assert("number"==typeof e&&e>=0);var t=e%26,r=(e-t)/26,a=1<=0);var t=e%26,r=(e-t)/26;if(assert(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==t&&r++,this.length=Math.min(r,this.length),0!==t){var a=67108863^67108863>>>t<=67108864;t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},BN.prototype.isubn=function isubn(e){if(assert("number"==typeof e),assert(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t>26)-(c/67108864|0),this.words[a+r]=67108863&n}for(;a>26,this.words[a+r]=67108863&n;if(0===s)return this.strip();for(assert(-1===s),s=0,a=0;a>26,this.words[a]=67108863&n;return this.negative=1,this.strip()},BN.prototype._wordDiv=function _wordDiv(e,t){var r=(this.length,e.length),a=this.clone(),n=e,o=0|n.words[n.length-1];0!==(r=26-this._countBits(o))&&(n=n.ushln(r),a.iushln(r),o=0|n.words[n.length-1]);var s,c=a.length-n.length;if("mod"!==t){(s=new BN(null)).length=c+1,s.words=new Array(s.length);for(var d=0;d=0;h--){var l=67108864*(0|a.words[n.length+h])+(0|a.words[n.length+h-1]);for(l=Math.min(l/o|0,67108863),a._ishlnsubmul(n,l,h);0!==a.negative;)l--,a.negative=0,a._ishlnsubmul(n,1,h),a.isZero()||(a.negative^=1);s&&(s.words[h]=l)}return s&&s.strip(),a.strip(),"div"!==t&&0!==r&&a.iushrn(r),{div:s||null,mod:a}},BN.prototype.divmod=function divmod(e,t,r){return assert(!e.isZero()),this.isZero()?{div:new BN(0),mod:new BN(0)}:0!==this.negative&&0===e.negative?(o=this.neg().divmod(e,t),"mod"!==t&&(a=o.div.neg()),"div"!==t&&(n=o.mod.neg(),r&&0!==n.negative&&n.iadd(e)),{div:a,mod:n}):0===this.negative&&0!==e.negative?(o=this.divmod(e.neg(),t),"mod"!==t&&(a=o.div.neg()),{div:a,mod:o.mod}):0!=(this.negative&e.negative)?(o=this.neg().divmod(e.neg(),t),"div"!==t&&(n=o.mod.neg(),r&&0!==n.negative&&n.isub(e)),{div:o.div,mod:n}):e.length>this.length||this.cmp(e)<0?{div:new BN(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new BN(this.modn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new BN(this.modn(e.words[0]))}:this._wordDiv(e,t);var a,n,o},BN.prototype.div=function div(e){return this.divmod(e,"div",!1).div},BN.prototype.mod=function mod(e){return this.divmod(e,"mod",!1).mod},BN.prototype.umod=function umod(e){return this.divmod(e,"mod",!0).mod},BN.prototype.divRound=function divRound(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var r=0!==t.div.negative?t.mod.isub(e):t.mod,a=e.ushrn(1),n=e.andln(1),o=r.cmp(a);return o<0||1===n&&0===o?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},BN.prototype.modn=function modn(e){assert(e<=67108863);for(var t=(1<<26)%e,r=0,a=this.length-1;a>=0;a--)r=(t*r+(0|this.words[a]))%e;return r},BN.prototype.idivn=function idivn(e){assert(e<=67108863);for(var t=0,r=this.length-1;r>=0;r--){var a=(0|this.words[r])+67108864*t;this.words[r]=a/e|0,t=a%e}return this.strip()},BN.prototype.divn=function divn(e){return this.clone().idivn(e)},BN.prototype.egcd=function egcd(e){assert(0===e.negative),assert(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var a=new BN(1),n=new BN(0),o=new BN(0),s=new BN(1),c=0;t.isEven()&&r.isEven();)t.iushrn(1),r.iushrn(1),++c;for(var d=r.clone(),u=t.clone();!t.isZero();){for(var h=0,l=1;0==(t.words[0]&l)&&h<26;++h,l<<=1);if(h>0)for(t.iushrn(h);h-- >0;)(a.isOdd()||n.isOdd())&&(a.iadd(d),n.isub(u)),a.iushrn(1),n.iushrn(1);for(var b=0,g=1;0==(r.words[0]&g)&&b<26;++b,g<<=1);if(b>0)for(r.iushrn(b);b-- >0;)(o.isOdd()||s.isOdd())&&(o.iadd(d),s.isub(u)),o.iushrn(1),s.iushrn(1);t.cmp(r)>=0?(t.isub(r),a.isub(o),n.isub(s)):(r.isub(t),o.isub(a),s.isub(n))}return{a:o,b:s,gcd:r.iushln(c)}},BN.prototype._invmp=function _invmp(e){assert(0===e.negative),assert(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var a,n=new BN(1),o=new BN(0),s=r.clone();t.cmpn(1)>0&&r.cmpn(1)>0;){for(var c=0,d=1;0==(t.words[0]&d)&&c<26;++c,d<<=1);if(c>0)for(t.iushrn(c);c-- >0;)n.isOdd()&&n.iadd(s),n.iushrn(1);for(var u=0,h=1;0==(r.words[0]&h)&&u<26;++u,h<<=1);if(u>0)for(r.iushrn(u);u-- >0;)o.isOdd()&&o.iadd(s),o.iushrn(1);t.cmp(r)>=0?(t.isub(r),n.isub(o)):(r.isub(t),o.isub(n))}return(a=0===t.cmpn(1)?n:o).cmpn(0)<0&&a.iadd(e),a},BN.prototype.gcd=function gcd(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),r=e.clone();t.negative=0,r.negative=0;for(var a=0;t.isEven()&&r.isEven();a++)t.iushrn(1),r.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=t.cmp(r);if(n<0){var o=t;t=r,r=o}else if(0===n||0===r.cmpn(1))break;t.isub(r)}return r.iushln(a)},BN.prototype.invm=function invm(e){return this.egcd(e).a.umod(e)},BN.prototype.isEven=function isEven(){return 0==(1&this.words[0])},BN.prototype.isOdd=function isOdd(){return 1==(1&this.words[0])},BN.prototype.andln=function andln(e){return this.words[0]&e},BN.prototype.bincn=function bincn(e){assert("number"==typeof e);var t=e%26,r=(e-t)/26,a=1<>>26,s&=67108863,this.words[o]=s}return 0!==n&&(this.words[o]=n,this.length++),this},BN.prototype.isZero=function isZero(){return 1===this.length&&0===this.words[0]},BN.prototype.cmpn=function cmpn(e){var t,r=e<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this.strip(),this.length>1)t=1;else{r&&(e=-e),assert(e<=67108863,"Number is too big");var a=0|this.words[0];t=a===e?0:ae.length)return 1;if(this.length=0;r--){var a=0|this.words[r],n=0|e.words[r];if(a!==n){an&&(t=1);break}}return t},BN.prototype.gtn=function gtn(e){return 1===this.cmpn(e)},BN.prototype.gt=function gt(e){return 1===this.cmp(e)},BN.prototype.gten=function gten(e){return this.cmpn(e)>=0},BN.prototype.gte=function gte(e){return this.cmp(e)>=0},BN.prototype.ltn=function ltn(e){return-1===this.cmpn(e)},BN.prototype.lt=function lt(e){return-1===this.cmp(e)},BN.prototype.lten=function lten(e){return this.cmpn(e)<=0},BN.prototype.lte=function lte(e){return this.cmp(e)<=0},BN.prototype.eqn=function eqn(e){return 0===this.cmpn(e)},BN.prototype.eq=function eq(e){return 0===this.cmp(e)},BN.red=function red(e){return new Red(e)},BN.prototype.toRed=function toRed(e){return assert(!this.red,"Already a number in reduction context"),assert(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},BN.prototype.fromRed=function fromRed(){return assert(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},BN.prototype._forceRed=function _forceRed(e){return this.red=e,this},BN.prototype.forceRed=function forceRed(e){return assert(!this.red,"Already a number in reduction context"),this._forceRed(e)},BN.prototype.redAdd=function redAdd(e){return assert(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},BN.prototype.redIAdd=function redIAdd(e){return assert(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},BN.prototype.redSub=function redSub(e){return assert(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},BN.prototype.redISub=function redISub(e){return assert(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},BN.prototype.redShl=function redShl(e){return assert(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},BN.prototype.redMul=function redMul(e){return assert(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},BN.prototype.redIMul=function redIMul(e){return assert(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},BN.prototype.redSqr=function redSqr(){return assert(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},BN.prototype.redISqr=function redISqr(){return assert(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},BN.prototype.redSqrt=function redSqrt(){return assert(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},BN.prototype.redInvm=function redInvm(){return assert(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},BN.prototype.redNeg=function redNeg(){return assert(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},BN.prototype.redPow=function redPow(e){return assert(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var d={k256:null,p224:null,p192:null,p25519:null};function MPrime(e,t){this.name=e,this.p=new BN(t,16),this.n=this.p.bitLength(),this.k=new BN(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function K256(){MPrime.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function P224(){MPrime.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function P192(){MPrime.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function P25519(){MPrime.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function Red(e){if("string"==typeof e){var t=BN._prime(e);this.m=t.p,this.prime=t}else assert(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function Mont(e){Red.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new BN(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)}MPrime.prototype._tmp=function _tmp(){var e=new BN(null);return e.words=new Array(Math.ceil(this.n/13)),e},MPrime.prototype.ireduce=function ireduce(e){var t,r=e;do{this.split(r,this.tmp),t=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(t>this.n);var a=t0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},MPrime.prototype.split=function split(e,t){e.iushrn(this.n,0,t)},MPrime.prototype.imulK=function imulK(e){return e.imul(this.k)},inherits(K256,MPrime),K256.prototype.split=function split(e,t){for(var r=4194303,a=Math.min(e.length,9),n=0;n>>22,o=s}o>>>=22,e.words[n-10]=o,0===o&&e.length>10?e.length-=10:e.length-=9},K256.prototype.imulK=function imulK(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,r=0;r>>=26,e.words[r]=n,t=a}return 0!==t&&(e.words[e.length++]=t),e},BN._prime=function prime(e){if(d[e])return d[e];var prime;if("k256"===e)prime=new K256;else if("p224"===e)prime=new P224;else if("p192"===e)prime=new P192;else{if("p25519"!==e)throw new Error("Unknown prime "+e);prime=new P25519}return d[e]=prime,prime},Red.prototype._verify1=function _verify1(e){assert(0===e.negative,"red works only with positives"),assert(e.red,"red works only with red numbers")},Red.prototype._verify2=function _verify2(e,t){assert(0==(e.negative|t.negative),"red works only with positives"),assert(e.red&&e.red===t.red,"red works only with red numbers")},Red.prototype.imod=function imod(e){return this.prime?this.prime.ireduce(e)._forceRed(this):e.umod(this.m)._forceRed(this)},Red.prototype.neg=function neg(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},Red.prototype.add=function add(e,t){this._verify2(e,t);var r=e.add(t);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},Red.prototype.iadd=function iadd(e,t){this._verify2(e,t);var r=e.iadd(t);return r.cmp(this.m)>=0&&r.isub(this.m),r},Red.prototype.sub=function sub(e,t){this._verify2(e,t);var r=e.sub(t);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},Red.prototype.isub=function isub(e,t){this._verify2(e,t);var r=e.isub(t);return r.cmpn(0)<0&&r.iadd(this.m),r},Red.prototype.shl=function shl(e,t){return this._verify1(e),this.imod(e.ushln(t))},Red.prototype.imul=function imul(e,t){return this._verify2(e,t),this.imod(e.imul(t))},Red.prototype.mul=function mul(e,t){return this._verify2(e,t),this.imod(e.mul(t))},Red.prototype.isqr=function isqr(e){return this.imul(e,e.clone())},Red.prototype.sqr=function sqr(e){return this.mul(e,e)},Red.prototype.sqrt=function sqrt(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(assert(t%2==1),3===t){var r=this.m.add(new BN(1)).iushrn(2);return this.pow(e,r)}for(var a=this.m.subn(1),n=0;!a.isZero()&&0===a.andln(1);)n++,a.iushrn(1);assert(!a.isZero());var o=new BN(1).toRed(this),s=o.redNeg(),c=this.m.subn(1).iushrn(1),d=this.m.bitLength();for(d=new BN(2*d*d).toRed(this);0!==this.pow(d,c).cmp(s);)d.redIAdd(s);for(var u=this.pow(d,a),h=this.pow(e,a.addn(1).iushrn(1)),l=this.pow(e,a),b=n;0!==l.cmp(o);){for(var g=l,p=0;0!==g.cmp(o);p++)g=g.redSqr();assert(p=0;a--){for(var d=t.words[a],u=c-1;u>=0;u--){var h=d>>u&1;n!==r[0]&&(n=this.sqr(n)),0!==h||0!==o?(o<<=1,o|=h,(4===++s||0===a&&0===u)&&(n=this.mul(n,r[o]),s=0,o=0)):s=0}c=26}return n},Red.prototype.convertTo=function convertTo(e){var t=e.umod(this.m);return t===e?t.clone():t},Red.prototype.convertFrom=function convertFrom(e){var t=e.clone();return t.red=null,t},BN.mont=function mont(e){return new Mont(e)},inherits(Mont,Red),Mont.prototype.convertTo=function convertTo(e){return this.imod(e.ushln(this.shift))},Mont.prototype.convertFrom=function convertFrom(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},Mont.prototype.imul=function imul(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var r=e.imul(t),a=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(a).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},Mont.prototype.mul=function mul(e,t){if(e.isZero()||t.isZero())return new BN(0)._forceRed(this);var r=e.mul(t),a=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(a).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},Mont.prototype.invm=function invm(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(e=r.nmd(e),this)},(e,t)=>{"use strict";var r=t;function zero2(e){return 1===e.length?"0"+e:e}function toHex(e){for(var t="",r=0;r>8,s=255&n;o?r.push(o,s):r.push(s)}return r},r.zero2=zero2,r.toHex=toHex,r.encode=function encode(e,t){return"hex"===t?toHex(e):e}},(e,t,r)=>{"use strict";var a=t;a.base=r(282),a.short=r(960),a.mont=r(961),a.edwards=r(962)},(e,t,r)=>{"use strict";var a=r(115),n=r(283),o=r(964),s=r(164),c=a.sum32,d=a.sum32_4,u=a.sum32_5,h=o.ch32,l=o.maj32,b=o.s0_256,g=o.s1_256,p=o.g0_256,B=o.g1_256,m=n.BlockHash,I=[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 SHA256(){if(!(this instanceof SHA256))return new SHA256;m.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=I,this.W=new Array(64)}a.inherits(SHA256,m),e.exports=SHA256,SHA256.blockSize=512,SHA256.outSize=256,SHA256.hmacStrength=192,SHA256.padLength=64,SHA256.prototype._update=function _update(e,t){for(var r=this.W,a=0;a<16;a++)r[a]=e[t+a];for(;a{"use strict";var a=r(115),n=r(283),o=r(164),s=a.rotr64_hi,c=a.rotr64_lo,d=a.shr64_hi,u=a.shr64_lo,h=a.sum64,l=a.sum64_hi,b=a.sum64_lo,g=a.sum64_4_hi,p=a.sum64_4_lo,B=a.sum64_5_hi,m=a.sum64_5_lo,I=n.BlockHash,y=[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 SHA512(){if(!(this instanceof SHA512))return new SHA512;I.call(this),this.h=[1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209],this.k=y,this.W=new Array(160)}function ch64_hi(e,t,r,a,n){var o=e&r^~e&n;return o<0&&(o+=4294967296),o}function ch64_lo(e,t,r,a,n,o){var s=t&a^~t&o;return s<0&&(s+=4294967296),s}function maj64_hi(e,t,r,a,n){var o=e&r^e&n^r&n;return o<0&&(o+=4294967296),o}function maj64_lo(e,t,r,a,n,o){var s=t&a^t&o^a&o;return s<0&&(s+=4294967296),s}function s0_512_hi(e,t){var r=s(e,t,28)^s(t,e,2)^s(t,e,7);return r<0&&(r+=4294967296),r}function s0_512_lo(e,t){var r=c(e,t,28)^c(t,e,2)^c(t,e,7);return r<0&&(r+=4294967296),r}function s1_512_hi(e,t){var r=s(e,t,14)^s(e,t,18)^s(t,e,9);return r<0&&(r+=4294967296),r}function s1_512_lo(e,t){var r=c(e,t,14)^c(e,t,18)^c(t,e,9);return r<0&&(r+=4294967296),r}function g0_512_hi(e,t){var r=s(e,t,1)^s(e,t,8)^d(e,t,7);return r<0&&(r+=4294967296),r}function g0_512_lo(e,t){var r=c(e,t,1)^c(e,t,8)^u(e,t,7);return r<0&&(r+=4294967296),r}function g1_512_hi(e,t){var r=s(e,t,19)^s(t,e,29)^d(e,t,6);return r<0&&(r+=4294967296),r}function g1_512_lo(e,t){var r=c(e,t,19)^c(t,e,29)^u(e,t,6);return r<0&&(r+=4294967296),r}a.inherits(SHA512,I),e.exports=SHA512,SHA512.blockSize=1024,SHA512.outSize=512,SHA512.hmacStrength=192,SHA512.padLength=128,SHA512.prototype._prepareBlock=function _prepareBlock(e,t){for(var r=this.W,a=0;a<32;a++)r[a]=e[t+a];for(;a{e.exports=function isHexPrefixed(e){if("string"!=typeof e)throw new Error("[is-hex-prefixed] value must be type 'string', is currently type "+typeof e+", while checking isHexPrefixed.");return"0x"===e.slice(0,2)}},(e,t,r)=>{e.exports=r(977)(r(980))},(e,t,r)=>{"use strict";var a=r(15),n=r(556),o=r(19).Buffer,s=new Array(16);function MD5(){n.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878}function rotl(e,t){return e<>>32-t}function fnF(e,t,r,a,n,o,s){return rotl(e+(t&r|~t&a)+n+o|0,s)+t|0}function fnG(e,t,r,a,n,o,s){return rotl(e+(t&a|r&~a)+n+o|0,s)+t|0}function fnH(e,t,r,a,n,o,s){return rotl(e+(t^r^a)+n+o|0,s)+t|0}function fnI(e,t,r,a,n,o,s){return rotl(e+(r^(t|~a))+n+o|0,s)+t|0}a(MD5,n),MD5.prototype._update=function(){for(var e=s,t=0;t<16;++t)e[t]=this._block.readInt32LE(4*t);var r=this._a,a=this._b,n=this._c,o=this._d;r=fnF(r,a,n,o,e[0],3614090360,7),o=fnF(o,r,a,n,e[1],3905402710,12),n=fnF(n,o,r,a,e[2],606105819,17),a=fnF(a,n,o,r,e[3],3250441966,22),r=fnF(r,a,n,o,e[4],4118548399,7),o=fnF(o,r,a,n,e[5],1200080426,12),n=fnF(n,o,r,a,e[6],2821735955,17),a=fnF(a,n,o,r,e[7],4249261313,22),r=fnF(r,a,n,o,e[8],1770035416,7),o=fnF(o,r,a,n,e[9],2336552879,12),n=fnF(n,o,r,a,e[10],4294925233,17),a=fnF(a,n,o,r,e[11],2304563134,22),r=fnF(r,a,n,o,e[12],1804603682,7),o=fnF(o,r,a,n,e[13],4254626195,12),n=fnF(n,o,r,a,e[14],2792965006,17),r=fnG(r,a=fnF(a,n,o,r,e[15],1236535329,22),n,o,e[1],4129170786,5),o=fnG(o,r,a,n,e[6],3225465664,9),n=fnG(n,o,r,a,e[11],643717713,14),a=fnG(a,n,o,r,e[0],3921069994,20),r=fnG(r,a,n,o,e[5],3593408605,5),o=fnG(o,r,a,n,e[10],38016083,9),n=fnG(n,o,r,a,e[15],3634488961,14),a=fnG(a,n,o,r,e[4],3889429448,20),r=fnG(r,a,n,o,e[9],568446438,5),o=fnG(o,r,a,n,e[14],3275163606,9),n=fnG(n,o,r,a,e[3],4107603335,14),a=fnG(a,n,o,r,e[8],1163531501,20),r=fnG(r,a,n,o,e[13],2850285829,5),o=fnG(o,r,a,n,e[2],4243563512,9),n=fnG(n,o,r,a,e[7],1735328473,14),r=fnH(r,a=fnG(a,n,o,r,e[12],2368359562,20),n,o,e[5],4294588738,4),o=fnH(o,r,a,n,e[8],2272392833,11),n=fnH(n,o,r,a,e[11],1839030562,16),a=fnH(a,n,o,r,e[14],4259657740,23),r=fnH(r,a,n,o,e[1],2763975236,4),o=fnH(o,r,a,n,e[4],1272893353,11),n=fnH(n,o,r,a,e[7],4139469664,16),a=fnH(a,n,o,r,e[10],3200236656,23),r=fnH(r,a,n,o,e[13],681279174,4),o=fnH(o,r,a,n,e[0],3936430074,11),n=fnH(n,o,r,a,e[3],3572445317,16),a=fnH(a,n,o,r,e[6],76029189,23),r=fnH(r,a,n,o,e[9],3654602809,4),o=fnH(o,r,a,n,e[12],3873151461,11),n=fnH(n,o,r,a,e[15],530742520,16),r=fnI(r,a=fnH(a,n,o,r,e[2],3299628645,23),n,o,e[0],4096336452,6),o=fnI(o,r,a,n,e[7],1126891415,10),n=fnI(n,o,r,a,e[14],2878612391,15),a=fnI(a,n,o,r,e[5],4237533241,21),r=fnI(r,a,n,o,e[12],1700485571,6),o=fnI(o,r,a,n,e[3],2399980690,10),n=fnI(n,o,r,a,e[10],4293915773,15),a=fnI(a,n,o,r,e[1],2240044497,21),r=fnI(r,a,n,o,e[8],1873313359,6),o=fnI(o,r,a,n,e[15],4264355552,10),n=fnI(n,o,r,a,e[6],2734768916,15),a=fnI(a,n,o,r,e[13],1309151649,21),r=fnI(r,a,n,o,e[4],4149444226,6),o=fnI(o,r,a,n,e[11],3174756917,10),n=fnI(n,o,r,a,e[2],718787259,15),a=fnI(a,n,o,r,e[9],3951481745,21),this._a=this._a+r|0,this._b=this._b+a|0,this._c=this._c+n|0,this._d=this._d+o|0},MD5.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 e=o.allocUnsafe(16);return e.writeInt32LE(this._a,0),e.writeInt32LE(this._b,4),e.writeInt32LE(this._c,8),e.writeInt32LE(this._d,12),e},e.exports=MD5},(e,t,r)=>{"use strict";var a=r(19).Buffer,n=r(244).Transform;function HashBase(e){n.call(this),this._block=a.allocUnsafe(e),this._blockSize=e,this._blockOffset=0,this._length=[0,0,0,0],this._finalized=!1}r(15)(HashBase,n),HashBase.prototype._transform=function(e,t,r){var a=null;try{this.update(e,t)}catch(e){a=e}r(a)},HashBase.prototype._flush=function(e){var t=null;try{this.push(this.digest())}catch(e){t=e}e(t)},HashBase.prototype.update=function(e,t){if(function throwIfNotStringOrBuffer(e,t){if(!a.isBuffer(e)&&"string"!=typeof e)throw new TypeError(t+" must be a string or a buffer")}(e,"Data"),this._finalized)throw new Error("Digest already called");a.isBuffer(e)||(e=a.from(e,t));for(var r=this._block,n=0;this._blockOffset+e.length-n>=this._blockSize;){for(var o=this._blockOffset;o0;++s)this._length[s]+=c,(c=this._length[s]/4294967296|0)>0&&(this._length[s]-=4294967296*c);return this},HashBase.prototype._update=function(){throw new Error("_update is not implemented")},HashBase.prototype.digest=function(e){if(this._finalized)throw new Error("Digest already called");this._finalized=!0;var t=this._digest();void 0!==e&&(t=t.toString(e)),this._block.fill(0),this._blockOffset=0;for(var r=0;r<4;++r)this._length[r]=0;return t},HashBase.prototype._digest=function(){throw new Error("_digest is not implemented")},e.exports=HashBase},(e,t,r)=>{"use strict";var a,n=r(1);e.exports=Readable,Readable.ReadableState=ReadableState;r(32).EventEmitter;var o=function EElistenerCount(e,t){return e.listeners(t).length},s=r(981),c=r(0).Buffer,d=r.g.Uint8Array||function(){};var u,h=r(85);u=h&&h.debuglog?h.debuglog("stream"):function debug(){};var l,b,g,p=r(982),B=r(558),m=r(559).getHighWaterMark,I=r(245).a,y=I.ERR_INVALID_ARG_TYPE,v=I.ERR_STREAM_PUSH_AFTER_EOF,x=I.ERR_METHOD_NOT_IMPLEMENTED,C=I.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;r(15)(Readable,s);var Q=B.errorOrDestroy,w=["error","close","destroy","pause","resume"];function ReadableState(e,t,n){a=a||r(200),e=e||{},"boolean"!=typeof n&&(n=t instanceof a),this.objectMode=!!e.objectMode,n&&(this.objectMode=this.objectMode||!!e.readableObjectMode),this.highWaterMark=m(this,e,"readableHighWaterMark",n),this.buffer=new p,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&&(l||(l=r(561).a),this.decoder=new l(e.encoding),this.encoding=e.encoding)}function Readable(e){if(a=a||r(200),!(this instanceof Readable))return new Readable(e);var t=this instanceof a;this._readableState=new ReadableState(e,this,t),this.readable=!0,e&&("function"==typeof e.read&&(this._read=e.read),"function"==typeof e.destroy&&(this._destroy=e.destroy)),s.call(this)}function readableAddChunk(e,t,r,a,n){u("readableAddChunk",t);var o,s=e._readableState;if(null===t)s.reading=!1,function onEofChunk(e,t){if(u("onEofChunk"),t.ended)return;if(t.decoder){var r=t.decoder.end();r&&r.length&&(t.buffer.push(r),t.length+=t.objectMode?1:r.length)}t.ended=!0,t.sync?emitReadable(e):(t.needReadable=!1,t.emittedReadable||(t.emittedReadable=!0,emitReadable_(e)))}(e,s);else if(n||(o=function chunkInvalid(e,t){var r;(function _isUint8Array(e){return c.isBuffer(e)||e instanceof d})(t)||"string"==typeof t||void 0===t||e.objectMode||(r=new y("chunk",["string","Buffer","Uint8Array"],t));return r}(s,t)),o)Q(e,o);else if(s.objectMode||t&&t.length>0)if("string"==typeof t||s.objectMode||Object.getPrototypeOf(t)===c.prototype||(t=function _uint8ArrayToBuffer(e){return c.from(e)}(t)),a)s.endEmitted?Q(e,new C):addChunk(e,s,t,!0);else if(s.ended)Q(e,new v);else{if(s.destroyed)return!1;s.reading=!1,s.decoder&&!r?(t=s.decoder.write(t),s.objectMode||0!==t.length?addChunk(e,s,t,!1):maybeReadMore(e,s)):addChunk(e,s,t,!1)}else a||(s.reading=!1,maybeReadMore(e,s));return!s.ended&&(s.lengtht.highWaterMark&&(t.highWaterMark=function computeNewHighWaterMark(e){return e>=_?e=_:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function emitReadable(e){var t=e._readableState;u("emitReadable",t.needReadable,t.emittedReadable),t.needReadable=!1,t.emittedReadable||(u("emitReadable",t.flowing),t.emittedReadable=!0,n.nextTick(emitReadable_,e))}function emitReadable_(e){var t=e._readableState;u("emitReadable_",t.destroyed,t.length,t.ended),t.destroyed||!t.length&&!t.ended||(e.emit("readable"),t.emittedReadable=!1),t.needReadable=!t.flowing&&!t.ended&&t.length<=t.highWaterMark,flow(e)}function maybeReadMore(e,t){t.readingMore||(t.readingMore=!0,n.nextTick(maybeReadMore_,e,t))}function maybeReadMore_(e,t){for(;!t.reading&&!t.ended&&(t.length0,t.resumeScheduled&&!t.paused?t.flowing=!0:e.listenerCount("data")>0&&e.resume()}function nReadingNextTick(e){u("readable nexttick read 0"),e.read(0)}function resume_(e,t){u("resume",t.reading),t.reading||e.read(0),t.resumeScheduled=!1,e.emit("resume"),flow(e),t.flowing&&!t.reading&&e.read(0)}function flow(e){var t=e._readableState;for(u("flow",t.flowing);t.flowing&&null!==e.read(););}function fromList(e,t){return 0===t.length?null:(t.objectMode?r=t.buffer.shift():!e||e>=t.length?(r=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.first():t.buffer.concat(t.length),t.buffer.clear()):r=t.buffer.consume(e,t.decoder),r);var r}function endReadable(e){var t=e._readableState;u("endReadable",t.endEmitted),t.endEmitted||(t.ended=!0,n.nextTick(endReadableNT,t,e))}function endReadableNT(e,t){if(u("endReadableNT",e.endEmitted,e.length),!e.endEmitted&&0===e.length&&(e.endEmitted=!0,t.readable=!1,t.emit("end"),e.autoDestroy)){var r=t._writableState;(!r||r.autoDestroy&&r.finished)&&t.destroy()}}function indexOf(e,t){for(var r=0,a=e.length;r=t.highWaterMark:t.length>0)||t.ended))return u("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?endReadable(this):emitReadable(this),null;if(0===(e=howMuchToRead(e,t))&&t.ended)return 0===t.length&&endReadable(this),null;var a,n=t.needReadable;return u("need readable",n),(0===t.length||t.length-e0?fromList(e,t):null)?(t.needReadable=t.length<=t.highWaterMark,e=0):(t.length-=e,t.awaitDrain=0),0===t.length&&(t.ended||(t.needReadable=!0),r!==e&&t.ended&&endReadable(this)),null!==a&&this.emit("data",a),a},Readable.prototype._read=function(e){Q(this,new x("_read()"))},Readable.prototype.pipe=function(e,t){var r=this,a=this._readableState;switch(a.pipesCount){case 0:a.pipes=e;break;case 1:a.pipes=[a.pipes,e];break;default:a.pipes.push(e)}a.pipesCount+=1,u("pipe count=%d opts=%j",a.pipesCount,t);var s=(!t||!1!==t.end)&&e!==n.stdout&&e!==n.stderr?onend:unpipe;function onunpipe(t,n){u("onunpipe"),t===r&&n&&!1===n.hasUnpiped&&(n.hasUnpiped=!0,function cleanup(){u("cleanup"),e.removeListener("close",onclose),e.removeListener("finish",onfinish),e.removeListener("drain",c),e.removeListener("error",onerror),e.removeListener("unpipe",onunpipe),r.removeListener("end",onend),r.removeListener("end",unpipe),r.removeListener("data",ondata),d=!0,!a.awaitDrain||e._writableState&&!e._writableState.needDrain||c()}())}function onend(){u("onend"),e.end()}a.endEmitted?n.nextTick(s):r.once("end",s),e.on("unpipe",onunpipe);var c=function pipeOnDrain(e){return function pipeOnDrainFunctionResult(){var t=e._readableState;u("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&o(e,"data")&&(t.flowing=!0,flow(e))}}(r);e.on("drain",c);var d=!1;function ondata(t){u("ondata");var n=e.write(t);u("dest.write",n),!1===n&&((1===a.pipesCount&&a.pipes===e||a.pipesCount>1&&-1!==indexOf(a.pipes,e))&&!d&&(u("false write response, pause",a.awaitDrain),a.awaitDrain++),r.pause())}function onerror(t){u("onerror",t),unpipe(),e.removeListener("error",onerror),0===o(e,"error")&&Q(e,t)}function onclose(){e.removeListener("finish",onfinish),unpipe()}function onfinish(){u("onfinish"),e.removeListener("close",onclose),unpipe()}function unpipe(){u("unpipe"),r.unpipe(e)}return r.on("data",ondata),function prependListener(e,t,r){if("function"==typeof e.prependListener)return e.prependListener(t,r);e._events&&e._events[t]?Array.isArray(e._events[t])?e._events[t].unshift(r):e._events[t]=[r,e._events[t]]:e.on(t,r)}(e,"error",onerror),e.once("close",onclose),e.once("finish",onfinish),e.emit("pipe",r),a.flowing||(u("pipe resume"),r.resume()),e},Readable.prototype.unpipe=function(e){var t=this._readableState,r={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes||(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,r)),this;if(!e){var a=t.pipes,n=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var o=0;o0,!1!==a.flowing&&this.resume()):"readable"===e&&(a.endEmitted||a.readableListening||(a.readableListening=a.needReadable=!0,a.flowing=!1,a.emittedReadable=!1,u("on readable",a.length,a.reading),a.length?emitReadable(this):a.reading||n.nextTick(nReadingNextTick,this))),r},Readable.prototype.addListener=Readable.prototype.on,Readable.prototype.removeListener=function(e,t){var r=s.prototype.removeListener.call(this,e,t);return"readable"===e&&n.nextTick(updateReadableListening,this),r},Readable.prototype.removeAllListeners=function(e){var t=s.prototype.removeAllListeners.apply(this,arguments);return"readable"!==e&&void 0!==e||n.nextTick(updateReadableListening,this),t},Readable.prototype.resume=function(){var e=this._readableState;return e.flowing||(u("resume"),e.flowing=!e.readableListening,function resume(e,t){t.resumeScheduled||(t.resumeScheduled=!0,n.nextTick(resume_,e,t))}(this,e)),e.paused=!1,this},Readable.prototype.pause=function(){return u("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(u("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},Readable.prototype.wrap=function(e){var t=this,r=this._readableState,a=!1;for(var n in e.on("end",(function(){if(u("wrapped end"),r.decoder&&!r.ended){var e=r.decoder.end();e&&e.length&&t.push(e)}t.push(null)})),e.on("data",(function(n){(u("wrapped data"),r.decoder&&(n=r.decoder.write(n)),r.objectMode&&null==n)||(r.objectMode||n&&n.length)&&(t.push(n)||(a=!0,e.pause()))})),e)void 0===this[n]&&"function"==typeof e[n]&&(this[n]=function methodWrap(t){return function methodWrapReturnFunction(){return e[t].apply(e,arguments)}}(n));for(var o=0;o{"use strict";var a=r(1);function emitErrorAndCloseNT(e,t){emitErrorNT(e,t),emitCloseNT(e)}function emitCloseNT(e){e._writableState&&!e._writableState.emitClose||e._readableState&&!e._readableState.emitClose||e.emit("close")}function emitErrorNT(e,t){e.emit("error",t)}e.exports={destroy:function destroy(e,t){var r=this,n=this._readableState&&this._readableState.destroyed,o=this._writableState&&this._writableState.destroyed;return n||o?(t?t(e):e&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,a.nextTick(emitErrorNT,this,e)):a.nextTick(emitErrorNT,this,e)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,(function(e){!t&&e?r._writableState?r._writableState.errorEmitted?a.nextTick(emitCloseNT,r):(r._writableState.errorEmitted=!0,a.nextTick(emitErrorAndCloseNT,r,e)):a.nextTick(emitErrorAndCloseNT,r,e):t?(a.nextTick(emitCloseNT,r),t(e)):a.nextTick(emitCloseNT,r)})),this)},undestroy:function undestroy(){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 errorOrDestroy(e,t){var r=e._readableState,a=e._writableState;r&&r.autoDestroy||a&&a.autoDestroy?e.destroy(t):e.emit("error",t)}}},(e,t,r)=>{"use strict";var a=r(245).a.ERR_INVALID_OPT_VALUE;e.exports={getHighWaterMark:function getHighWaterMark(e,t,r,n){var o=function highWaterMarkFrom(e,t,r){return null!=e.highWaterMark?e.highWaterMark:t?e[r]:null}(t,n,r);if(null!=o){if(!isFinite(o)||Math.floor(o)!==o||o<0)throw new a(n?r:"highWaterMark",o);return Math.floor(o)}return e.objectMode?16:16384}}},(e,t,r)=>{"use strict";var a,n=r(1);function CorkedRequest(e){var t=this;this.next=null,this.entry=null,this.finish=function(){!function onCorkedFinish(e,t,r){var a=e.entry;e.entry=null;for(;a;){var n=a.callback;t.pendingcb--,n(r),a=a.next}t.corkedRequestsFree.next=e}(t,e)}}e.exports=Writable,Writable.WritableState=WritableState;var o={deprecate:r(983)},s=r(981),c=r(0).Buffer,d=r.g.Uint8Array||function(){};var u,h=r(558),l=r(559).getHighWaterMark,b=r(245).a,g=b.ERR_INVALID_ARG_TYPE,p=b.ERR_METHOD_NOT_IMPLEMENTED,B=b.ERR_MULTIPLE_CALLBACK,m=b.ERR_STREAM_CANNOT_PIPE,I=b.ERR_STREAM_DESTROYED,y=b.ERR_STREAM_NULL_VALUES,v=b.ERR_STREAM_WRITE_AFTER_END,x=b.ERR_UNKNOWN_ENCODING,C=h.errorOrDestroy;function nop(){}function WritableState(e,t,o){a=a||r(200),e=e||{},"boolean"!=typeof o&&(o=t instanceof a),this.objectMode=!!e.objectMode,o&&(this.objectMode=this.objectMode||!!e.writableObjectMode),this.highWaterMark=l(this,e,"writableHighWaterMark",o),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var s=!1===e.decodeStrings;this.decodeStrings=!s,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 onwrite(e,t){var r=e._writableState,a=r.sync,o=r.writecb;if("function"!=typeof o)throw new B;if(function onwriteStateUpdate(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}(r),t)!function onwriteError(e,t,r,a,o){--t.pendingcb,r?(n.nextTick(o,a),n.nextTick(finishMaybe,e,t),e._writableState.errorEmitted=!0,C(e,a)):(o(a),e._writableState.errorEmitted=!0,C(e,a),finishMaybe(e,t))}(e,r,a,t,o);else{var s=needFinish(r)||e.destroyed;s||r.corked||r.bufferProcessing||!r.bufferedRequest||clearBuffer(e,r),a?n.nextTick(afterWrite,e,r,s,o):afterWrite(e,r,s,o)}}(t,e)},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 CorkedRequest(this)}function Writable(e){var t=this instanceof(a=a||r(200));if(!t&&!u.call(Writable,this))return new Writable(e);this._writableState=new WritableState(e,this,t),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),s.call(this)}function doWrite(e,t,r,a,n,o,s){t.writelen=a,t.writecb=s,t.writing=!0,t.sync=!0,t.destroyed?t.onwrite(new I("write")):r?e._writev(n,t.onwrite):e._write(n,o,t.onwrite),t.sync=!1}function afterWrite(e,t,r,a){r||function onwriteDrain(e,t){0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}(e,t),t.pendingcb--,a(),finishMaybe(e,t)}function clearBuffer(e,t){t.bufferProcessing=!0;var r=t.bufferedRequest;if(e._writev&&r&&r.next){var a=t.bufferedRequestCount,n=new Array(a),o=t.corkedRequestsFree;o.entry=r;for(var s=0,c=!0;r;)n[s]=r,r.isBuf||(c=!1),r=r.next,s+=1;n.allBuffers=c,doWrite(e,t,!0,t.length,n,"",o.finish),t.pendingcb++,t.lastBufferedRequest=null,o.next?(t.corkedRequestsFree=o.next,o.next=null):t.corkedRequestsFree=new CorkedRequest(t),t.bufferedRequestCount=0}else{for(;r;){var d=r.chunk,u=r.encoding,h=r.callback;if(doWrite(e,t,!1,t.objectMode?1:d.length,d,u,h),r=r.next,t.bufferedRequestCount--,t.writing)break}null===r&&(t.lastBufferedRequest=null)}t.bufferedRequest=r,t.bufferProcessing=!1}function needFinish(e){return e.ending&&0===e.length&&null===e.bufferedRequest&&!e.finished&&!e.writing}function callFinal(e,t){e._final((function(r){t.pendingcb--,r&&C(e,r),t.prefinished=!0,e.emit("prefinish"),finishMaybe(e,t)}))}function finishMaybe(e,t){var r=needFinish(t);if(r&&(function prefinish(e,t){t.prefinished||t.finalCalled||("function"!=typeof e._final||t.destroyed?(t.prefinished=!0,e.emit("prefinish")):(t.pendingcb++,t.finalCalled=!0,n.nextTick(callFinal,e,t)))}(e,t),0===t.pendingcb&&(t.finished=!0,e.emit("finish"),t.autoDestroy))){var a=e._readableState;(!a||a.autoDestroy&&a.endEmitted)&&e.destroy()}return r}r(15)(Writable,s),WritableState.prototype.getBuffer=function getBuffer(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},function(){try{Object.defineProperty(WritableState.prototype,"buffer",{get:o.deprecate((function writableStateBufferGetter(){return this.getBuffer()}),"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(e){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(u=Function.prototype[Symbol.hasInstance],Object.defineProperty(Writable,Symbol.hasInstance,{value:function value(e){return!!u.call(this,e)||this===Writable&&(e&&e._writableState instanceof WritableState)}})):u=function realHasInstance(e){return e instanceof this},Writable.prototype.pipe=function(){C(this,new m)},Writable.prototype.write=function(e,t,r){var a=this._writableState,o=!1,s=!a.objectMode&&function _isUint8Array(e){return c.isBuffer(e)||e instanceof d}(e);return s&&!c.isBuffer(e)&&(e=function _uint8ArrayToBuffer(e){return c.from(e)}(e)),"function"==typeof t&&(r=t,t=null),s?t="buffer":t||(t=a.defaultEncoding),"function"!=typeof r&&(r=nop),a.ending?function writeAfterEnd(e,t){var r=new v;C(e,r),n.nextTick(t,r)}(this,r):(s||function validChunk(e,t,r,a){var o;return null===r?o=new y:"string"==typeof r||t.objectMode||(o=new g("chunk",["string","Buffer"],r)),!o||(C(e,o),n.nextTick(a,o),!1)}(this,a,e,r))&&(a.pendingcb++,o=function writeOrBuffer(e,t,r,a,n,o){if(!r){var s=function decodeChunk(e,t,r){e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=c.from(t,r));return t}(t,a,n);a!==s&&(r=!0,n="buffer",a=s)}var d=t.objectMode?1:a.length;t.length+=d;var u=t.length-1))throw new x(e);return this._writableState.defaultEncoding=e,this},Object.defineProperty(Writable.prototype,"writableBuffer",{enumerable:!1,get:function get(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(Writable.prototype,"writableHighWaterMark",{enumerable:!1,get:function get(){return this._writableState.highWaterMark}}),Writable.prototype._write=function(e,t,r){r(new p("_write()"))},Writable.prototype._writev=null,Writable.prototype.end=function(e,t,r){var a=this._writableState;return"function"==typeof e?(r=e,e=null,t=null):"function"==typeof t&&(r=t,t=null),null!=e&&this.write(e,t),a.corked&&(a.corked=1,this.uncork()),a.ending||function endWritable(e,t,r){t.ending=!0,finishMaybe(e,t),r&&(t.finished?n.nextTick(r):e.once("finish",r));t.ended=!0,e.writable=!1}(this,a,r),this},Object.defineProperty(Writable.prototype,"writableLength",{enumerable:!1,get:function get(){return this._writableState.length}}),Object.defineProperty(Writable.prototype,"destroyed",{enumerable:!1,get:function get(){return void 0!==this._writableState&&this._writableState.destroyed},set:function set(e){this._writableState&&(this._writableState.destroyed=e)}}),Writable.prototype.destroy=h.destroy,Writable.prototype._undestroy=h.undestroy,Writable.prototype._destroy=function(e,t){t(e)}},(e,t,r)=>{"use strict";var a=r(19).Buffer,n=a.isEncoding||function(e){switch((e=""+e)&&e.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 StringDecoder(e){var t;switch(this.encoding=function normalizeEncoding(e){var t=function _normalizeEncoding(e){if(!e)return"utf8";for(var t;;)switch(e){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 e;default:if(t)return;e=(""+e).toLowerCase(),t=!0}}(e);if("string"!=typeof t&&(a.isEncoding===n||!n(e)))throw new Error("Unknown encoding: "+e);return t||e}(e),this.encoding){case"utf16le":this.text=utf16Text,this.end=utf16End,t=4;break;case"utf8":this.fillLast=utf8FillLast,t=4;break;case"base64":this.text=base64Text,this.end=base64End,t=3;break;default:return this.write=simpleWrite,void(this.end=simpleEnd)}this.lastNeed=0,this.lastTotal=0,this.lastChar=a.allocUnsafe(t)}function utf8CheckByte(e){return e<=127?0:e>>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function utf8FillLast(e){var t=this.lastTotal-this.lastNeed,r=function utf8CheckExtraBytes(e,t,r){if(128!=(192&t[0]))return e.lastNeed=0,"�";if(e.lastNeed>1&&t.length>1){if(128!=(192&t[1]))return e.lastNeed=1,"�";if(e.lastNeed>2&&t.length>2&&128!=(192&t[2]))return e.lastNeed=2,"�"}}(this,e);return void 0!==r?r:this.lastNeed<=e.length?(e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(e.copy(this.lastChar,t,0,e.length),void(this.lastNeed-=e.length))}function utf16Text(e,t){if((e.length-t)%2==0){var r=e.toString("utf16le",t);if(r){var a=r.charCodeAt(r.length-1);if(a>=55296&&a<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",t,e.length-1)}function utf16End(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return t+this.lastChar.toString("utf16le",0,r)}return t}function base64Text(e,t){var r=(e.length-t)%3;return 0===r?e.toString("base64",t):(this.lastNeed=3-r,this.lastTotal=3,1===r?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString("base64",t,e.length-r))}function base64End(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function simpleWrite(e){return e.toString(this.encoding)}function simpleEnd(e){return e&&e.length?this.write(e):""}t.a=StringDecoder,StringDecoder.prototype.write=function(e){if(0===e.length)return"";var t,r;if(this.lastNeed){if(void 0===(t=this.fillLast(e)))return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r=0)return n>0&&(e.lastNeed=n-1),n;if(--a=0)return n>0&&(e.lastNeed=n-2),n;if(--a=0)return n>0&&(2===n?n=0:e.lastNeed=n-3),n;return 0}(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=r;var a=e.length-(r-this.lastNeed);return e.copy(this.lastChar,0,a),e.toString("utf8",t,a)},StringDecoder.prototype.fillLast=function(e){if(this.lastNeed<=e.length)return e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,e.length),this.lastNeed-=e.length}},(e,t,r)=>{"use strict";e.exports=Transform;var a=r(245).a,n=a.ERR_METHOD_NOT_IMPLEMENTED,o=a.ERR_MULTIPLE_CALLBACK,s=a.ERR_TRANSFORM_ALREADY_TRANSFORMING,c=a.ERR_TRANSFORM_WITH_LENGTH_0,d=r(200);function afterTransform(e,t){var r=this._transformState;r.transforming=!1;var a=r.writecb;if(null===a)return this.emit("error",new o);r.writechunk=null,r.writecb=null,null!=t&&this.push(t),a(e);var n=this._readableState;n.reading=!1,(n.needReadable||n.length{"use strict";var a=r(0).Buffer,n=r(15),o=r(556),s=new Array(16),c=[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],d=[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],u=[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],h=[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],l=[0,1518500249,1859775393,2400959708,2840853838],b=[1352829926,1548603684,1836072691,2053994217,0];function RIPEMD160(){o.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520}function rotl(e,t){return e<>>32-t}function fn1(e,t,r,a,n,o,s,c){return rotl(e+(t^r^a)+o+s|0,c)+n|0}function fn2(e,t,r,a,n,o,s,c){return rotl(e+(t&r|~t&a)+o+s|0,c)+n|0}function fn3(e,t,r,a,n,o,s,c){return rotl(e+((t|~r)^a)+o+s|0,c)+n|0}function fn4(e,t,r,a,n,o,s,c){return rotl(e+(t&a|r&~a)+o+s|0,c)+n|0}function fn5(e,t,r,a,n,o,s,c){return rotl(e+(t^(r|~a))+o+s|0,c)+n|0}n(RIPEMD160,o),RIPEMD160.prototype._update=function(){for(var e=s,t=0;t<16;++t)e[t]=this._block.readInt32LE(4*t);for(var r=0|this._a,a=0|this._b,n=0|this._c,o=0|this._d,g=0|this._e,p=0|this._a,B=0|this._b,m=0|this._c,I=0|this._d,y=0|this._e,v=0;v<80;v+=1){var x,C;v<16?(x=fn1(r,a,n,o,g,e[c[v]],l[0],u[v]),C=fn5(p,B,m,I,y,e[d[v]],b[0],h[v])):v<32?(x=fn2(r,a,n,o,g,e[c[v]],l[1],u[v]),C=fn4(p,B,m,I,y,e[d[v]],b[1],h[v])):v<48?(x=fn3(r,a,n,o,g,e[c[v]],l[2],u[v]),C=fn3(p,B,m,I,y,e[d[v]],b[2],h[v])):v<64?(x=fn4(r,a,n,o,g,e[c[v]],l[3],u[v]),C=fn2(p,B,m,I,y,e[d[v]],b[3],h[v])):(x=fn5(r,a,n,o,g,e[c[v]],l[4],u[v]),C=fn1(p,B,m,I,y,e[d[v]],b[4],h[v])),r=g,g=o,o=rotl(n,10),n=a,a=x,p=y,y=I,I=rotl(m,10),m=B,B=C}var Q=this._b+n+I|0;this._b=this._c+o+y|0,this._c=this._d+g+p|0,this._d=this._e+r+B|0,this._e=this._a+a+m|0,this._a=Q},RIPEMD160.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 e=a.alloc?a.alloc(20):new a(20);return e.writeInt32LE(this._a,0),e.writeInt32LE(this._b,4),e.writeInt32LE(this._c,8),e.writeInt32LE(this._d,12),e.writeInt32LE(this._e,16),e},e.exports=RIPEMD160},(e,t,r)=>{var a=e.exports=function SHA(e){e=e.toLowerCase();var t=a[e];if(!t)throw new Error(e+" is not supported (we accept pull requests)");return new t};a.sha=r(988),a.sha1=r(989),a.sha224=r(990),a.sha256=r(565),a.sha384=r(991),a.sha512=r(566)},(e,t,r)=>{var a=r(15),n=r(201),o=r(19).Buffer,s=[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],c=new Array(64);function Sha256(){this.init(),this._w=c,n.call(this,64,56)}function ch(e,t,r){return r^e&(t^r)}function maj(e,t,r){return e&t|r&(e|t)}function sigma0(e){return(e>>>2|e<<30)^(e>>>13|e<<19)^(e>>>22|e<<10)}function sigma1(e){return(e>>>6|e<<26)^(e>>>11|e<<21)^(e>>>25|e<<7)}function gamma0(e){return(e>>>7|e<<25)^(e>>>18|e<<14)^e>>>3}a(Sha256,n),Sha256.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},Sha256.prototype._update=function(e){for(var t,r=this._w,a=0|this._a,n=0|this._b,o=0|this._c,c=0|this._d,d=0|this._e,u=0|this._f,h=0|this._g,l=0|this._h,b=0;b<16;++b)r[b]=e.readInt32BE(4*b);for(;b<64;++b)r[b]=0|(((t=r[b-2])>>>17|t<<15)^(t>>>19|t<<13)^t>>>10)+r[b-7]+gamma0(r[b-15])+r[b-16];for(var g=0;g<64;++g){var p=l+sigma1(d)+ch(d,u,h)+s[g]+r[g]|0,B=sigma0(a)+maj(a,n,o)|0;l=h,h=u,u=d,d=c+p|0,c=o,o=n,n=a,a=p+B|0}this._a=a+this._a|0,this._b=n+this._b|0,this._c=o+this._c|0,this._d=c+this._d|0,this._e=d+this._e|0,this._f=u+this._f|0,this._g=h+this._g|0,this._h=l+this._h|0},Sha256.prototype._hash=function(){var e=o.allocUnsafe(32);return e.writeInt32BE(this._a,0),e.writeInt32BE(this._b,4),e.writeInt32BE(this._c,8),e.writeInt32BE(this._d,12),e.writeInt32BE(this._e,16),e.writeInt32BE(this._f,20),e.writeInt32BE(this._g,24),e.writeInt32BE(this._h,28),e},e.exports=Sha256},(e,t,r)=>{var a=r(15),n=r(201),o=r(19).Buffer,s=[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],c=new Array(160);function Sha512(){this.init(),this._w=c,n.call(this,128,112)}function Ch(e,t,r){return r^e&(t^r)}function maj(e,t,r){return e&t|r&(e|t)}function sigma0(e,t){return(e>>>28|t<<4)^(t>>>2|e<<30)^(t>>>7|e<<25)}function sigma1(e,t){return(e>>>14|t<<18)^(e>>>18|t<<14)^(t>>>9|e<<23)}function Gamma0(e,t){return(e>>>1|t<<31)^(e>>>8|t<<24)^e>>>7}function Gamma0l(e,t){return(e>>>1|t<<31)^(e>>>8|t<<24)^(e>>>7|t<<25)}function Gamma1(e,t){return(e>>>19|t<<13)^(t>>>29|e<<3)^e>>>6}function Gamma1l(e,t){return(e>>>19|t<<13)^(t>>>29|e<<3)^(e>>>6|t<<26)}function getCarry(e,t){return e>>>0>>0?1:0}a(Sha512,n),Sha512.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},Sha512.prototype._update=function(e){for(var t=this._w,r=0|this._ah,a=0|this._bh,n=0|this._ch,o=0|this._dh,c=0|this._eh,d=0|this._fh,u=0|this._gh,h=0|this._hh,l=0|this._al,b=0|this._bl,g=0|this._cl,p=0|this._dl,B=0|this._el,m=0|this._fl,I=0|this._gl,y=0|this._hl,v=0;v<32;v+=2)t[v]=e.readInt32BE(4*v),t[v+1]=e.readInt32BE(4*v+4);for(;v<160;v+=2){var x=t[v-30],C=t[v-30+1],Q=Gamma0(x,C),w=Gamma0l(C,x),_=Gamma1(x=t[v-4],C=t[v-4+1]),k=Gamma1l(C,x),N=t[v-14],D=t[v-14+1],U=t[v-32],G=t[v-32+1],T=w+D|0,L=Q+N+getCarry(T,w)|0;L=(L=L+_+getCarry(T=T+k|0,k)|0)+U+getCarry(T=T+G|0,G)|0,t[v]=L,t[v+1]=T}for(var P=0;P<160;P+=2){L=t[P],T=t[P+1];var q=maj(r,a,n),O=maj(l,b,g),H=sigma0(r,l),Y=sigma0(l,r),j=sigma1(c,B),J=sigma1(B,c),z=s[P],W=s[P+1],V=Ch(c,d,u),X=Ch(B,m,I),$=y+J|0,et=h+j+getCarry($,y)|0;et=(et=(et=et+V+getCarry($=$+X|0,X)|0)+z+getCarry($=$+W|0,W)|0)+L+getCarry($=$+T|0,T)|0;var tt=Y+O|0,rt=H+q+getCarry(tt,Y)|0;h=u,y=I,u=d,I=m,d=c,m=B,c=o+et+getCarry(B=p+$|0,p)|0,o=n,p=g,n=a,g=b,a=r,b=l,r=et+rt+getCarry(l=$+tt|0,$)|0}this._al=this._al+l|0,this._bl=this._bl+b|0,this._cl=this._cl+g|0,this._dl=this._dl+p|0,this._el=this._el+B|0,this._fl=this._fl+m|0,this._gl=this._gl+I|0,this._hl=this._hl+y|0,this._ah=this._ah+r+getCarry(this._al,l)|0,this._bh=this._bh+a+getCarry(this._bl,b)|0,this._ch=this._ch+n+getCarry(this._cl,g)|0,this._dh=this._dh+o+getCarry(this._dl,p)|0,this._eh=this._eh+c+getCarry(this._el,B)|0,this._fh=this._fh+d+getCarry(this._fl,m)|0,this._gh=this._gh+u+getCarry(this._gl,I)|0,this._hh=this._hh+h+getCarry(this._hl,y)|0},Sha512.prototype._hash=function(){var e=o.allocUnsafe(64);function writeInt64BE(t,r,a){e.writeInt32BE(t,a),e.writeInt32BE(r,a+4)}return writeInt64BE(this._ah,this._al,0),writeInt64BE(this._bh,this._bl,8),writeInt64BE(this._ch,this._cl,16),writeInt64BE(this._dh,this._dl,24),writeInt64BE(this._eh,this._el,32),writeInt64BE(this._fh,this._fl,40),writeInt64BE(this._gh,this._gl,48),writeInt64BE(this._hh,this._hl,56),e},e.exports=Sha512},function(e,t,r){"use strict";var a=r(0).Buffer,n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.Address=void 0;var o=n(r(6)),s=n(r(48)),c=r(78),d=r(36),u=function(){function Address(e){o.default(20===e.length,"Invalid address length"),this.buf=e}return Address.zero=function(){return new Address(c.zeros(20))},Address.fromString=function(e){return o.default(d.isValidAddress(e),"Invalid address"),new Address(c.toBuffer(e))},Address.fromPublicKey=function(e){return o.default(a.isBuffer(e),"Public key should be Buffer"),new Address(d.pubToAddress(e))},Address.fromPrivateKey=function(e){return o.default(a.isBuffer(e),"Private key should be Buffer"),new Address(d.privateToAddress(e))},Address.generate=function(e,t){return o.default(s.default.isBN(t)),new Address(d.generateAddress(e.buf,t.toArrayLike(a)))},Address.generate2=function(e,t,r){return o.default(a.isBuffer(t)),o.default(a.isBuffer(r)),new Address(d.generateAddress2(e.buf,t,r))},Address.prototype.equals=function(e){return this.buf.equals(e.buf)},Address.prototype.isZero=function(){return this.equals(Address.zero())},Address.prototype.isPrecompileOrSystemAddress=function(){var e=new s.default(this.buf),t=new s.default(0),r=new s.default("ffff","hex");return e.gte(t)&&e.lte(r)},Address.prototype.toString=function(){return"0x"+this.buf.toString("hex")},Address.prototype.toBuffer=function(){return a.from(this.buf)},Address}();t.Address=u},function(e,t,r){"use strict";var a=r(0).Buffer,n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.hashPersonalMessage=t.isValidSignature=t.fromRpcSig=t.toCompactSig=t.toRpcSig=t.ecrecover=t.ecsign=void 0;var o=r(89),s=n(r(48)),c=r(78),d=r(63),u=r(366),h=r(246);function calculateSigRecovery(e,t){var r=h.toType(e,h.TypeOutput.BN);if(!t)return r.subn(27);var a=h.toType(t,h.TypeOutput.BN);return r.sub(a.muln(2).addn(35))}function isValidSigRecovery(e){var t=new s.default(e);return t.eqn(0)||t.eqn(1)}t.ecsign=function ecsign(e,t,r){var n=o.ecdsaSign(e,t),s=n.signature,c=n.recid,d=a.from(s.slice(0,32)),u=a.from(s.slice(32,64));if(!r||"number"==typeof r){if(r&&!Number.isSafeInteger(r))throw new Error("The provided number is greater than MAX_SAFE_INTEGER (please use an alternative input type)");return{r:d,s:u,v:r?c+(2*r+35):c+27}}return{r:d,s:u,v:h.toType(r,h.TypeOutput.BN).muln(2).addn(35).addn(c).toArrayLike(a)}},t.ecrecover=function(e,t,r,n,s){var d=a.concat([c.setLengthLeft(r,32),c.setLengthLeft(n,32)],64),u=calculateSigRecovery(t,s);if(!isValidSigRecovery(u))throw new Error("Invalid signature v value");var h=o.ecdsaRecover(d,u.toNumber(),e);return a.from(o.publicKeyConvert(h,!1).slice(1))},t.toRpcSig=function(e,t,r,n){if(!isValidSigRecovery(calculateSigRecovery(e,n)))throw new Error("Invalid signature v value");return c.bufferToHex(a.concat([c.setLengthLeft(t,32),c.setLengthLeft(r,32),c.toBuffer(e)]))},t.toCompactSig=function(e,t,r,n){if(!isValidSigRecovery(calculateSigRecovery(e,n)))throw new Error("Invalid signature v value");var o=h.toType(e,h.TypeOutput.Number),s=r;return(o>28&&o%2==1||1===o||28===o)&&((s=a.from(r))[0]|=128),c.bufferToHex(a.concat([c.setLengthLeft(t,32),c.setLengthLeft(s,32)]))},t.fromRpcSig=function(e){var t,r,a,n=c.toBuffer(e);if(n.length>=65)t=n.slice(0,32),r=n.slice(32,64),a=c.bufferToInt(n.slice(64));else{if(64!==n.length)throw new Error("Invalid signature length");t=n.slice(0,32),r=n.slice(32,64),a=c.bufferToInt(n.slice(32,33))>>7,r[0]&=127}return a<27&&(a+=27),{v:a,r:t,s:r}},t.isValidSignature=function(e,t,r,a,n){void 0===a&&(a=!0);var o=new s.default("7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0",16),c=new s.default("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141",16);if(32!==t.length||32!==r.length)return!1;if(!isValidSigRecovery(calculateSigRecovery(e,n)))return!1;var d=new s.default(t),u=new s.default(r);return!(d.isZero()||d.gt(c)||u.isZero()||u.gt(c))&&(!a||1!==u.cmp(o))},t.hashPersonalMessage=function(e){u.assertIsBuffer(e);var t=a.from("Ethereum Signed Message:\n"+e.length.toString(),"utf-8");return d.keccak(a.concat([t,e]))}},function(e,t,r){"use strict";var a=r(0).Buffer,n=this&&this.__assign||function(){return(n=Object.assign||function(e){for(var t,r=1,a=arguments.length;r0&&(d=n-c-16),s.padding="0".repeat(d),encrypt(e,{data:JSON.stringify(s)},r)},t.decrypt=decrypt,t.decryptSafely=function decryptSafely(e,t){return JSON.parse(decrypt(e,t)).data},t.getEncryptionPublicKey=function getEncryptionPublicKey(e){var t=nacl_decodeHex(e),r=c.box.keyPair.fromSecretKey(t).publicKey;return d.encodeBase64(r)},t.signTypedMessage=function signTypedMessage(e,t,r){switch(void 0===r&&(r="V4"),r){case"V1":return signTypedDataLegacy(e,t);case"V3":return signTypedData(e,t);case"V4":default:return signTypedData_v4(e,t)}},t.recoverTypedMessage=function recoverTypedMessage(e,t){switch(void 0===t&&(t="V4"),t){case"V1":return recoverTypedSignatureLegacy(e);case"V3":return recoverTypedSignature(e);case"V4":default:return recoverTypedSignature_v4(e)}},t.signTypedData=signTypedData,t.signTypedData_v4=signTypedData_v4,t.recoverTypedSignature=recoverTypedSignature,t.recoverTypedSignature_v4=recoverTypedSignature_v4},(e,t,r)=>{!function(e){"use strict";var gf=function(e){var t,r=new Float64Array(16);if(e)for(t=0;t>24&255,e[t+1]=r>>16&255,e[t+2]=r>>8&255,e[t+3]=255&r,e[t+4]=a>>24&255,e[t+5]=a>>16&255,e[t+6]=a>>8&255,e[t+7]=255&a}function vn(e,t,r,a,n){var o,s=0;for(o=0;o>>8)-1}function crypto_verify_16(e,t,r,a){return vn(e,t,r,a,16)}function crypto_verify_32(e,t,r,a){return vn(e,t,r,a,32)}function crypto_core_salsa20(e,t,r,a){!function core_salsa20(e,t,r,a){for(var n,o=255&a[0]|(255&a[1])<<8|(255&a[2])<<16|(255&a[3])<<24,s=255&r[0]|(255&r[1])<<8|(255&r[2])<<16|(255&r[3])<<24,c=255&r[4]|(255&r[5])<<8|(255&r[6])<<16|(255&r[7])<<24,d=255&r[8]|(255&r[9])<<8|(255&r[10])<<16|(255&r[11])<<24,u=255&r[12]|(255&r[13])<<8|(255&r[14])<<16|(255&r[15])<<24,h=255&a[4]|(255&a[5])<<8|(255&a[6])<<16|(255&a[7])<<24,l=255&t[0]|(255&t[1])<<8|(255&t[2])<<16|(255&t[3])<<24,b=255&t[4]|(255&t[5])<<8|(255&t[6])<<16|(255&t[7])<<24,g=255&t[8]|(255&t[9])<<8|(255&t[10])<<16|(255&t[11])<<24,p=255&t[12]|(255&t[13])<<8|(255&t[14])<<16|(255&t[15])<<24,B=255&a[8]|(255&a[9])<<8|(255&a[10])<<16|(255&a[11])<<24,m=255&r[16]|(255&r[17])<<8|(255&r[18])<<16|(255&r[19])<<24,I=255&r[20]|(255&r[21])<<8|(255&r[22])<<16|(255&r[23])<<24,y=255&r[24]|(255&r[25])<<8|(255&r[26])<<16|(255&r[27])<<24,v=255&r[28]|(255&r[29])<<8|(255&r[30])<<16|(255&r[31])<<24,x=255&a[12]|(255&a[13])<<8|(255&a[14])<<16|(255&a[15])<<24,C=o,Q=s,w=c,_=d,k=u,N=h,D=l,U=b,G=g,T=p,L=B,P=m,q=I,O=y,H=v,Y=x,j=0;j<20;j+=2)C^=(n=(q^=(n=(G^=(n=(k^=(n=C+q|0)<<7|n>>>25)+C|0)<<9|n>>>23)+k|0)<<13|n>>>19)+G|0)<<18|n>>>14,N^=(n=(Q^=(n=(O^=(n=(T^=(n=N+Q|0)<<7|n>>>25)+N|0)<<9|n>>>23)+T|0)<<13|n>>>19)+O|0)<<18|n>>>14,L^=(n=(D^=(n=(w^=(n=(H^=(n=L+D|0)<<7|n>>>25)+L|0)<<9|n>>>23)+H|0)<<13|n>>>19)+w|0)<<18|n>>>14,Y^=(n=(P^=(n=(U^=(n=(_^=(n=Y+P|0)<<7|n>>>25)+Y|0)<<9|n>>>23)+_|0)<<13|n>>>19)+U|0)<<18|n>>>14,C^=(n=(_^=(n=(w^=(n=(Q^=(n=C+_|0)<<7|n>>>25)+C|0)<<9|n>>>23)+Q|0)<<13|n>>>19)+w|0)<<18|n>>>14,N^=(n=(k^=(n=(U^=(n=(D^=(n=N+k|0)<<7|n>>>25)+N|0)<<9|n>>>23)+D|0)<<13|n>>>19)+U|0)<<18|n>>>14,L^=(n=(T^=(n=(G^=(n=(P^=(n=L+T|0)<<7|n>>>25)+L|0)<<9|n>>>23)+P|0)<<13|n>>>19)+G|0)<<18|n>>>14,Y^=(n=(H^=(n=(O^=(n=(q^=(n=Y+H|0)<<7|n>>>25)+Y|0)<<9|n>>>23)+q|0)<<13|n>>>19)+O|0)<<18|n>>>14;C=C+o|0,Q=Q+s|0,w=w+c|0,_=_+d|0,k=k+u|0,N=N+h|0,D=D+l|0,U=U+b|0,G=G+g|0,T=T+p|0,L=L+B|0,P=P+m|0,q=q+I|0,O=O+y|0,H=H+v|0,Y=Y+x|0,e[0]=C>>>0&255,e[1]=C>>>8&255,e[2]=C>>>16&255,e[3]=C>>>24&255,e[4]=Q>>>0&255,e[5]=Q>>>8&255,e[6]=Q>>>16&255,e[7]=Q>>>24&255,e[8]=w>>>0&255,e[9]=w>>>8&255,e[10]=w>>>16&255,e[11]=w>>>24&255,e[12]=_>>>0&255,e[13]=_>>>8&255,e[14]=_>>>16&255,e[15]=_>>>24&255,e[16]=k>>>0&255,e[17]=k>>>8&255,e[18]=k>>>16&255,e[19]=k>>>24&255,e[20]=N>>>0&255,e[21]=N>>>8&255,e[22]=N>>>16&255,e[23]=N>>>24&255,e[24]=D>>>0&255,e[25]=D>>>8&255,e[26]=D>>>16&255,e[27]=D>>>24&255,e[28]=U>>>0&255,e[29]=U>>>8&255,e[30]=U>>>16&255,e[31]=U>>>24&255,e[32]=G>>>0&255,e[33]=G>>>8&255,e[34]=G>>>16&255,e[35]=G>>>24&255,e[36]=T>>>0&255,e[37]=T>>>8&255,e[38]=T>>>16&255,e[39]=T>>>24&255,e[40]=L>>>0&255,e[41]=L>>>8&255,e[42]=L>>>16&255,e[43]=L>>>24&255,e[44]=P>>>0&255,e[45]=P>>>8&255,e[46]=P>>>16&255,e[47]=P>>>24&255,e[48]=q>>>0&255,e[49]=q>>>8&255,e[50]=q>>>16&255,e[51]=q>>>24&255,e[52]=O>>>0&255,e[53]=O>>>8&255,e[54]=O>>>16&255,e[55]=O>>>24&255,e[56]=H>>>0&255,e[57]=H>>>8&255,e[58]=H>>>16&255,e[59]=H>>>24&255,e[60]=Y>>>0&255,e[61]=Y>>>8&255,e[62]=Y>>>16&255,e[63]=Y>>>24&255}(e,t,r,a)}function crypto_core_hsalsa20(e,t,r,a){!function core_hsalsa20(e,t,r,a){for(var n,o=255&a[0]|(255&a[1])<<8|(255&a[2])<<16|(255&a[3])<<24,s=255&r[0]|(255&r[1])<<8|(255&r[2])<<16|(255&r[3])<<24,c=255&r[4]|(255&r[5])<<8|(255&r[6])<<16|(255&r[7])<<24,d=255&r[8]|(255&r[9])<<8|(255&r[10])<<16|(255&r[11])<<24,u=255&r[12]|(255&r[13])<<8|(255&r[14])<<16|(255&r[15])<<24,h=255&a[4]|(255&a[5])<<8|(255&a[6])<<16|(255&a[7])<<24,l=255&t[0]|(255&t[1])<<8|(255&t[2])<<16|(255&t[3])<<24,b=255&t[4]|(255&t[5])<<8|(255&t[6])<<16|(255&t[7])<<24,g=255&t[8]|(255&t[9])<<8|(255&t[10])<<16|(255&t[11])<<24,p=255&t[12]|(255&t[13])<<8|(255&t[14])<<16|(255&t[15])<<24,B=255&a[8]|(255&a[9])<<8|(255&a[10])<<16|(255&a[11])<<24,m=255&r[16]|(255&r[17])<<8|(255&r[18])<<16|(255&r[19])<<24,I=255&r[20]|(255&r[21])<<8|(255&r[22])<<16|(255&r[23])<<24,y=255&r[24]|(255&r[25])<<8|(255&r[26])<<16|(255&r[27])<<24,v=255&r[28]|(255&r[29])<<8|(255&r[30])<<16|(255&r[31])<<24,x=255&a[12]|(255&a[13])<<8|(255&a[14])<<16|(255&a[15])<<24,C=0;C<20;C+=2)o^=(n=(I^=(n=(g^=(n=(u^=(n=o+I|0)<<7|n>>>25)+o|0)<<9|n>>>23)+u|0)<<13|n>>>19)+g|0)<<18|n>>>14,h^=(n=(s^=(n=(y^=(n=(p^=(n=h+s|0)<<7|n>>>25)+h|0)<<9|n>>>23)+p|0)<<13|n>>>19)+y|0)<<18|n>>>14,B^=(n=(l^=(n=(c^=(n=(v^=(n=B+l|0)<<7|n>>>25)+B|0)<<9|n>>>23)+v|0)<<13|n>>>19)+c|0)<<18|n>>>14,x^=(n=(m^=(n=(b^=(n=(d^=(n=x+m|0)<<7|n>>>25)+x|0)<<9|n>>>23)+d|0)<<13|n>>>19)+b|0)<<18|n>>>14,o^=(n=(d^=(n=(c^=(n=(s^=(n=o+d|0)<<7|n>>>25)+o|0)<<9|n>>>23)+s|0)<<13|n>>>19)+c|0)<<18|n>>>14,h^=(n=(u^=(n=(b^=(n=(l^=(n=h+u|0)<<7|n>>>25)+h|0)<<9|n>>>23)+l|0)<<13|n>>>19)+b|0)<<18|n>>>14,B^=(n=(p^=(n=(g^=(n=(m^=(n=B+p|0)<<7|n>>>25)+B|0)<<9|n>>>23)+m|0)<<13|n>>>19)+g|0)<<18|n>>>14,x^=(n=(v^=(n=(y^=(n=(I^=(n=x+v|0)<<7|n>>>25)+x|0)<<9|n>>>23)+I|0)<<13|n>>>19)+y|0)<<18|n>>>14;e[0]=o>>>0&255,e[1]=o>>>8&255,e[2]=o>>>16&255,e[3]=o>>>24&255,e[4]=h>>>0&255,e[5]=h>>>8&255,e[6]=h>>>16&255,e[7]=h>>>24&255,e[8]=B>>>0&255,e[9]=B>>>8&255,e[10]=B>>>16&255,e[11]=B>>>24&255,e[12]=x>>>0&255,e[13]=x>>>8&255,e[14]=x>>>16&255,e[15]=x>>>24&255,e[16]=l>>>0&255,e[17]=l>>>8&255,e[18]=l>>>16&255,e[19]=l>>>24&255,e[20]=b>>>0&255,e[21]=b>>>8&255,e[22]=b>>>16&255,e[23]=b>>>24&255,e[24]=g>>>0&255,e[25]=g>>>8&255,e[26]=g>>>16&255,e[27]=g>>>24&255,e[28]=p>>>0&255,e[29]=p>>>8&255,e[30]=p>>>16&255,e[31]=p>>>24&255}(e,t,r,a)}var b=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function crypto_stream_salsa20_xor(e,t,r,a,n,o,s){var c,d,u=new Uint8Array(16),h=new Uint8Array(64);for(d=0;d<16;d++)u[d]=0;for(d=0;d<8;d++)u[d]=o[d];for(;n>=64;){for(crypto_core_salsa20(h,u,s,b),d=0;d<64;d++)e[t+d]=r[a+d]^h[d];for(c=1,d=8;d<16;d++)c=c+(255&u[d])|0,u[d]=255&c,c>>>=8;n-=64,t+=64,a+=64}if(n>0)for(crypto_core_salsa20(h,u,s,b),d=0;d=64;){for(crypto_core_salsa20(d,c,n,b),s=0;s<64;s++)e[t+s]=d[s];for(o=1,s=8;s<16;s++)o=o+(255&c[s])|0,c[s]=255&o,o>>>=8;r-=64,t+=64}if(r>0)for(crypto_core_salsa20(d,c,n,b),s=0;s>>13|r<<3),a=255&e[4]|(255&e[5])<<8,this.r[2]=7939&(r>>>10|a<<6),n=255&e[6]|(255&e[7])<<8,this.r[3]=8191&(a>>>7|n<<9),o=255&e[8]|(255&e[9])<<8,this.r[4]=255&(n>>>4|o<<12),this.r[5]=o>>>1&8190,s=255&e[10]|(255&e[11])<<8,this.r[6]=8191&(o>>>14|s<<2),c=255&e[12]|(255&e[13])<<8,this.r[7]=8065&(s>>>11|c<<5),d=255&e[14]|(255&e[15])<<8,this.r[8]=8191&(c>>>8|d<<8),this.r[9]=d>>>5&127,this.pad[0]=255&e[16]|(255&e[17])<<8,this.pad[1]=255&e[18]|(255&e[19])<<8,this.pad[2]=255&e[20]|(255&e[21])<<8,this.pad[3]=255&e[22]|(255&e[23])<<8,this.pad[4]=255&e[24]|(255&e[25])<<8,this.pad[5]=255&e[26]|(255&e[27])<<8,this.pad[6]=255&e[28]|(255&e[29])<<8,this.pad[7]=255&e[30]|(255&e[31])<<8};function crypto_onetimeauth(e,t,r,a,n,o){var s=new poly1305(o);return s.update(r,a,n),s.finish(e,t),0}function crypto_onetimeauth_verify(e,t,r,a,n,o){var s=new Uint8Array(16);return crypto_onetimeauth(s,0,r,a,n,o),crypto_verify_16(e,t,s,0)}function crypto_secretbox(e,t,r,a,n){var o;if(r<32)return-1;for(crypto_stream_xor(e,0,t,0,r,a,n),crypto_onetimeauth(e,16,e,32,r-32,e),o=0;o<16;o++)e[o]=0;return 0}function crypto_secretbox_open(e,t,r,a,n){var o,s=new Uint8Array(32);if(r<32)return-1;if(crypto_stream(s,0,32,a,n),0!==crypto_onetimeauth_verify(t,16,t,32,r-32,s))return-1;for(crypto_stream_xor(e,0,t,0,r,a,n),o=0;o<32;o++)e[o]=0;return 0}function set25519(e,t){var r;for(r=0;r<16;r++)e[r]=0|t[r]}function car25519(e){var t,r,a=1;for(t=0;t<16;t++)r=e[t]+a+65535,a=Math.floor(r/65536),e[t]=r-65536*a;e[0]+=a-1+37*(a-1)}function sel25519(e,t,r){for(var a,n=~(r-1),o=0;o<16;o++)a=n&(e[o]^t[o]),e[o]^=a,t[o]^=a}function pack25519(e,t){var r,a,n,o=gf(),s=gf();for(r=0;r<16;r++)s[r]=t[r];for(car25519(s),car25519(s),car25519(s),a=0;a<2;a++){for(o[0]=s[0]-65517,r=1;r<15;r++)o[r]=s[r]-65535-(o[r-1]>>16&1),o[r-1]&=65535;o[15]=s[15]-32767-(o[14]>>16&1),n=o[15]>>16&1,o[14]&=65535,sel25519(s,o,1-n)}for(r=0;r<16;r++)e[2*r]=255&s[r],e[2*r+1]=s[r]>>8}function neq25519(e,t){var r=new Uint8Array(32),a=new Uint8Array(32);return pack25519(r,e),pack25519(a,t),crypto_verify_32(r,0,a,0)}function par25519(e){var t=new Uint8Array(32);return pack25519(t,e),1&t[0]}function unpack25519(e,t){var r;for(r=0;r<16;r++)e[r]=t[2*r]+(t[2*r+1]<<8);e[15]&=32767}function A(e,t,r){for(var a=0;a<16;a++)e[a]=t[a]+r[a]}function Z(e,t,r){for(var a=0;a<16;a++)e[a]=t[a]-r[a]}function M(e,t,r){var a,n,o=0,s=0,c=0,d=0,u=0,h=0,l=0,b=0,g=0,p=0,B=0,m=0,I=0,y=0,v=0,x=0,C=0,Q=0,w=0,_=0,k=0,N=0,D=0,U=0,G=0,T=0,L=0,P=0,q=0,O=0,H=0,Y=r[0],j=r[1],J=r[2],z=r[3],W=r[4],V=r[5],X=r[6],$=r[7],et=r[8],tt=r[9],rt=r[10],at=r[11],it=r[12],nt=r[13],ot=r[14],At=r[15];o+=(a=t[0])*Y,s+=a*j,c+=a*J,d+=a*z,u+=a*W,h+=a*V,l+=a*X,b+=a*$,g+=a*et,p+=a*tt,B+=a*rt,m+=a*at,I+=a*it,y+=a*nt,v+=a*ot,x+=a*At,s+=(a=t[1])*Y,c+=a*j,d+=a*J,u+=a*z,h+=a*W,l+=a*V,b+=a*X,g+=a*$,p+=a*et,B+=a*tt,m+=a*rt,I+=a*at,y+=a*it,v+=a*nt,x+=a*ot,C+=a*At,c+=(a=t[2])*Y,d+=a*j,u+=a*J,h+=a*z,l+=a*W,b+=a*V,g+=a*X,p+=a*$,B+=a*et,m+=a*tt,I+=a*rt,y+=a*at,v+=a*it,x+=a*nt,C+=a*ot,Q+=a*At,d+=(a=t[3])*Y,u+=a*j,h+=a*J,l+=a*z,b+=a*W,g+=a*V,p+=a*X,B+=a*$,m+=a*et,I+=a*tt,y+=a*rt,v+=a*at,x+=a*it,C+=a*nt,Q+=a*ot,w+=a*At,u+=(a=t[4])*Y,h+=a*j,l+=a*J,b+=a*z,g+=a*W,p+=a*V,B+=a*X,m+=a*$,I+=a*et,y+=a*tt,v+=a*rt,x+=a*at,C+=a*it,Q+=a*nt,w+=a*ot,_+=a*At,h+=(a=t[5])*Y,l+=a*j,b+=a*J,g+=a*z,p+=a*W,B+=a*V,m+=a*X,I+=a*$,y+=a*et,v+=a*tt,x+=a*rt,C+=a*at,Q+=a*it,w+=a*nt,_+=a*ot,k+=a*At,l+=(a=t[6])*Y,b+=a*j,g+=a*J,p+=a*z,B+=a*W,m+=a*V,I+=a*X,y+=a*$,v+=a*et,x+=a*tt,C+=a*rt,Q+=a*at,w+=a*it,_+=a*nt,k+=a*ot,N+=a*At,b+=(a=t[7])*Y,g+=a*j,p+=a*J,B+=a*z,m+=a*W,I+=a*V,y+=a*X,v+=a*$,x+=a*et,C+=a*tt,Q+=a*rt,w+=a*at,_+=a*it,k+=a*nt,N+=a*ot,D+=a*At,g+=(a=t[8])*Y,p+=a*j,B+=a*J,m+=a*z,I+=a*W,y+=a*V,v+=a*X,x+=a*$,C+=a*et,Q+=a*tt,w+=a*rt,_+=a*at,k+=a*it,N+=a*nt,D+=a*ot,U+=a*At,p+=(a=t[9])*Y,B+=a*j,m+=a*J,I+=a*z,y+=a*W,v+=a*V,x+=a*X,C+=a*$,Q+=a*et,w+=a*tt,_+=a*rt,k+=a*at,N+=a*it,D+=a*nt,U+=a*ot,G+=a*At,B+=(a=t[10])*Y,m+=a*j,I+=a*J,y+=a*z,v+=a*W,x+=a*V,C+=a*X,Q+=a*$,w+=a*et,_+=a*tt,k+=a*rt,N+=a*at,D+=a*it,U+=a*nt,G+=a*ot,T+=a*At,m+=(a=t[11])*Y,I+=a*j,y+=a*J,v+=a*z,x+=a*W,C+=a*V,Q+=a*X,w+=a*$,_+=a*et,k+=a*tt,N+=a*rt,D+=a*at,U+=a*it,G+=a*nt,T+=a*ot,L+=a*At,I+=(a=t[12])*Y,y+=a*j,v+=a*J,x+=a*z,C+=a*W,Q+=a*V,w+=a*X,_+=a*$,k+=a*et,N+=a*tt,D+=a*rt,U+=a*at,G+=a*it,T+=a*nt,L+=a*ot,P+=a*At,y+=(a=t[13])*Y,v+=a*j,x+=a*J,C+=a*z,Q+=a*W,w+=a*V,_+=a*X,k+=a*$,N+=a*et,D+=a*tt,U+=a*rt,G+=a*at,T+=a*it,L+=a*nt,P+=a*ot,q+=a*At,v+=(a=t[14])*Y,x+=a*j,C+=a*J,Q+=a*z,w+=a*W,_+=a*V,k+=a*X,N+=a*$,D+=a*et,U+=a*tt,G+=a*rt,T+=a*at,L+=a*it,P+=a*nt,q+=a*ot,O+=a*At,x+=(a=t[15])*Y,s+=38*(Q+=a*J),c+=38*(w+=a*z),d+=38*(_+=a*W),u+=38*(k+=a*V),h+=38*(N+=a*X),l+=38*(D+=a*$),b+=38*(U+=a*et),g+=38*(G+=a*tt),p+=38*(T+=a*rt),B+=38*(L+=a*at),m+=38*(P+=a*it),I+=38*(q+=a*nt),y+=38*(O+=a*ot),v+=38*(H+=a*At),o=(a=(o+=38*(C+=a*j))+(n=1)+65535)-65536*(n=Math.floor(a/65536)),s=(a=s+n+65535)-65536*(n=Math.floor(a/65536)),c=(a=c+n+65535)-65536*(n=Math.floor(a/65536)),d=(a=d+n+65535)-65536*(n=Math.floor(a/65536)),u=(a=u+n+65535)-65536*(n=Math.floor(a/65536)),h=(a=h+n+65535)-65536*(n=Math.floor(a/65536)),l=(a=l+n+65535)-65536*(n=Math.floor(a/65536)),b=(a=b+n+65535)-65536*(n=Math.floor(a/65536)),g=(a=g+n+65535)-65536*(n=Math.floor(a/65536)),p=(a=p+n+65535)-65536*(n=Math.floor(a/65536)),B=(a=B+n+65535)-65536*(n=Math.floor(a/65536)),m=(a=m+n+65535)-65536*(n=Math.floor(a/65536)),I=(a=I+n+65535)-65536*(n=Math.floor(a/65536)),y=(a=y+n+65535)-65536*(n=Math.floor(a/65536)),v=(a=v+n+65535)-65536*(n=Math.floor(a/65536)),x=(a=x+n+65535)-65536*(n=Math.floor(a/65536)),o=(a=(o+=n-1+37*(n-1))+(n=1)+65535)-65536*(n=Math.floor(a/65536)),s=(a=s+n+65535)-65536*(n=Math.floor(a/65536)),c=(a=c+n+65535)-65536*(n=Math.floor(a/65536)),d=(a=d+n+65535)-65536*(n=Math.floor(a/65536)),u=(a=u+n+65535)-65536*(n=Math.floor(a/65536)),h=(a=h+n+65535)-65536*(n=Math.floor(a/65536)),l=(a=l+n+65535)-65536*(n=Math.floor(a/65536)),b=(a=b+n+65535)-65536*(n=Math.floor(a/65536)),g=(a=g+n+65535)-65536*(n=Math.floor(a/65536)),p=(a=p+n+65535)-65536*(n=Math.floor(a/65536)),B=(a=B+n+65535)-65536*(n=Math.floor(a/65536)),m=(a=m+n+65535)-65536*(n=Math.floor(a/65536)),I=(a=I+n+65535)-65536*(n=Math.floor(a/65536)),y=(a=y+n+65535)-65536*(n=Math.floor(a/65536)),v=(a=v+n+65535)-65536*(n=Math.floor(a/65536)),x=(a=x+n+65535)-65536*(n=Math.floor(a/65536)),o+=n-1+37*(n-1),e[0]=o,e[1]=s,e[2]=c,e[3]=d,e[4]=u,e[5]=h,e[6]=l,e[7]=b,e[8]=g,e[9]=p,e[10]=B,e[11]=m,e[12]=I,e[13]=y,e[14]=v,e[15]=x}function S(e,t){M(e,t,t)}function inv25519(e,t){var r,a=gf();for(r=0;r<16;r++)a[r]=t[r];for(r=253;r>=0;r--)S(a,a),2!==r&&4!==r&&M(a,a,t);for(r=0;r<16;r++)e[r]=a[r]}function pow2523(e,t){var r,a=gf();for(r=0;r<16;r++)a[r]=t[r];for(r=250;r>=0;r--)S(a,a),1!==r&&M(a,a,t);for(r=0;r<16;r++)e[r]=a[r]}function crypto_scalarmult(e,t,r){var a,n,o=new Uint8Array(32),c=new Float64Array(80),d=gf(),u=gf(),h=gf(),l=gf(),b=gf(),g=gf();for(n=0;n<31;n++)o[n]=t[n];for(o[31]=127&t[31]|64,o[0]&=248,unpack25519(c,r),n=0;n<16;n++)u[n]=c[n],l[n]=d[n]=h[n]=0;for(d[0]=l[0]=1,n=254;n>=0;--n)sel25519(d,u,a=o[n>>>3]>>>(7&n)&1),sel25519(h,l,a),A(b,d,h),Z(d,d,h),A(h,u,l),Z(u,u,l),S(l,b),S(g,d),M(d,h,d),M(h,u,b),A(b,d,h),Z(d,d,h),S(u,d),Z(h,l,g),M(d,h,s),A(d,d,l),M(h,h,d),M(d,l,g),M(l,u,c),S(u,b),sel25519(d,u,a),sel25519(h,l,a);for(n=0;n<16;n++)c[n+16]=d[n],c[n+32]=h[n],c[n+48]=u[n],c[n+64]=l[n];var p=c.subarray(32),B=c.subarray(16);return inv25519(p,p),M(B,B,p),pack25519(e,B),0}function crypto_scalarmult_base(e,t){return crypto_scalarmult(e,t,a)}function crypto_box_keypair(e,t){return randombytes(t,32),crypto_scalarmult_base(e,t)}function crypto_box_beforenm(e,r,a){var n=new Uint8Array(32);return crypto_scalarmult(n,a,r),crypto_core_hsalsa20(e,t,n,b)}poly1305.prototype.blocks=function(e,t,r){for(var a,n,o,s,c,d,u,h,l,b,g,p,B,m,I,y,v,x,C,Q=this.fin?0:2048,w=this.h[0],_=this.h[1],k=this.h[2],N=this.h[3],D=this.h[4],U=this.h[5],G=this.h[6],T=this.h[7],L=this.h[8],P=this.h[9],q=this.r[0],O=this.r[1],H=this.r[2],Y=this.r[3],j=this.r[4],J=this.r[5],z=this.r[6],W=this.r[7],V=this.r[8],X=this.r[9];r>=16;)b=l=0,b+=(w+=8191&(a=255&e[t+0]|(255&e[t+1])<<8))*q,b+=(_+=8191&(a>>>13|(n=255&e[t+2]|(255&e[t+3])<<8)<<3))*(5*X),b+=(k+=8191&(n>>>10|(o=255&e[t+4]|(255&e[t+5])<<8)<<6))*(5*V),b+=(N+=8191&(o>>>7|(s=255&e[t+6]|(255&e[t+7])<<8)<<9))*(5*W),l=(b+=(D+=8191&(s>>>4|(c=255&e[t+8]|(255&e[t+9])<<8)<<12))*(5*z))>>>13,b&=8191,b+=(U+=c>>>1&8191)*(5*J),b+=(G+=8191&(c>>>14|(d=255&e[t+10]|(255&e[t+11])<<8)<<2))*(5*j),b+=(T+=8191&(d>>>11|(u=255&e[t+12]|(255&e[t+13])<<8)<<5))*(5*Y),b+=(L+=8191&(u>>>8|(h=255&e[t+14]|(255&e[t+15])<<8)<<8))*(5*H),g=l+=(b+=(P+=h>>>5|Q)*(5*O))>>>13,g+=w*O,g+=_*q,g+=k*(5*X),g+=N*(5*V),l=(g+=D*(5*W))>>>13,g&=8191,g+=U*(5*z),g+=G*(5*J),g+=T*(5*j),g+=L*(5*Y),l+=(g+=P*(5*H))>>>13,g&=8191,p=l,p+=w*H,p+=_*O,p+=k*q,p+=N*(5*X),l=(p+=D*(5*V))>>>13,p&=8191,p+=U*(5*W),p+=G*(5*z),p+=T*(5*J),p+=L*(5*j),B=l+=(p+=P*(5*Y))>>>13,B+=w*Y,B+=_*H,B+=k*O,B+=N*q,l=(B+=D*(5*X))>>>13,B&=8191,B+=U*(5*V),B+=G*(5*W),B+=T*(5*z),B+=L*(5*J),m=l+=(B+=P*(5*j))>>>13,m+=w*j,m+=_*Y,m+=k*H,m+=N*O,l=(m+=D*q)>>>13,m&=8191,m+=U*(5*X),m+=G*(5*V),m+=T*(5*W),m+=L*(5*z),I=l+=(m+=P*(5*J))>>>13,I+=w*J,I+=_*j,I+=k*Y,I+=N*H,l=(I+=D*O)>>>13,I&=8191,I+=U*q,I+=G*(5*X),I+=T*(5*V),I+=L*(5*W),y=l+=(I+=P*(5*z))>>>13,y+=w*z,y+=_*J,y+=k*j,y+=N*Y,l=(y+=D*H)>>>13,y&=8191,y+=U*O,y+=G*q,y+=T*(5*X),y+=L*(5*V),v=l+=(y+=P*(5*W))>>>13,v+=w*W,v+=_*z,v+=k*J,v+=N*j,l=(v+=D*Y)>>>13,v&=8191,v+=U*H,v+=G*O,v+=T*q,v+=L*(5*X),x=l+=(v+=P*(5*V))>>>13,x+=w*V,x+=_*W,x+=k*z,x+=N*J,l=(x+=D*j)>>>13,x&=8191,x+=U*Y,x+=G*H,x+=T*O,x+=L*q,C=l+=(x+=P*(5*X))>>>13,C+=w*X,C+=_*V,C+=k*W,C+=N*z,l=(C+=D*J)>>>13,C&=8191,C+=U*j,C+=G*Y,C+=T*H,C+=L*O,w=b=8191&(l=(l=((l+=(C+=P*q)>>>13)<<2)+l|0)+(b&=8191)|0),_=g+=l>>>=13,k=p&=8191,N=B&=8191,D=m&=8191,U=I&=8191,G=y&=8191,T=v&=8191,L=x&=8191,P=C&=8191,t+=16,r-=16;this.h[0]=w,this.h[1]=_,this.h[2]=k,this.h[3]=N,this.h[4]=D,this.h[5]=U,this.h[6]=G,this.h[7]=T,this.h[8]=L,this.h[9]=P},poly1305.prototype.finish=function(e,t){var r,a,n,o,s=new Uint16Array(10);if(this.leftover){for(o=this.leftover,this.buffer[o++]=1;o<16;o++)this.buffer[o]=0;this.fin=1,this.blocks(this.buffer,0,16)}for(r=this.h[1]>>>13,this.h[1]&=8191,o=2;o<10;o++)this.h[o]+=r,r=this.h[o]>>>13,this.h[o]&=8191;for(this.h[0]+=5*r,r=this.h[0]>>>13,this.h[0]&=8191,this.h[1]+=r,r=this.h[1]>>>13,this.h[1]&=8191,this.h[2]+=r,s[0]=this.h[0]+5,r=s[0]>>>13,s[0]&=8191,o=1;o<10;o++)s[o]=this.h[o]+r,r=s[o]>>>13,s[o]&=8191;for(s[9]-=8192,a=(1^r)-1,o=0;o<10;o++)s[o]&=a;for(a=~a,o=0;o<10;o++)this.h[o]=this.h[o]&a|s[o];for(this.h[0]=65535&(this.h[0]|this.h[1]<<13),this.h[1]=65535&(this.h[1]>>>3|this.h[2]<<10),this.h[2]=65535&(this.h[2]>>>6|this.h[3]<<7),this.h[3]=65535&(this.h[3]>>>9|this.h[4]<<4),this.h[4]=65535&(this.h[4]>>>12|this.h[5]<<1|this.h[6]<<14),this.h[5]=65535&(this.h[6]>>>2|this.h[7]<<11),this.h[6]=65535&(this.h[7]>>>5|this.h[8]<<8),this.h[7]=65535&(this.h[8]>>>8|this.h[9]<<5),n=this.h[0]+this.pad[0],this.h[0]=65535&n,o=1;o<8;o++)n=(this.h[o]+this.pad[o]|0)+(n>>>16)|0,this.h[o]=65535&n;e[t+0]=this.h[0]>>>0&255,e[t+1]=this.h[0]>>>8&255,e[t+2]=this.h[1]>>>0&255,e[t+3]=this.h[1]>>>8&255,e[t+4]=this.h[2]>>>0&255,e[t+5]=this.h[2]>>>8&255,e[t+6]=this.h[3]>>>0&255,e[t+7]=this.h[3]>>>8&255,e[t+8]=this.h[4]>>>0&255,e[t+9]=this.h[4]>>>8&255,e[t+10]=this.h[5]>>>0&255,e[t+11]=this.h[5]>>>8&255,e[t+12]=this.h[6]>>>0&255,e[t+13]=this.h[6]>>>8&255,e[t+14]=this.h[7]>>>0&255,e[t+15]=this.h[7]>>>8&255},poly1305.prototype.update=function(e,t,r){var a,n;if(this.leftover){for((n=16-this.leftover)>r&&(n=r),a=0;a=16&&(n=r-r%16,this.blocks(e,t,n),t+=n,r-=n),r){for(a=0;a=128;){for(w=0;w<16;w++)_=8*w+nt,L[w]=r[_+0]<<24|r[_+1]<<16|r[_+2]<<8|r[_+3],P[w]=r[_+4]<<24|r[_+5]<<16|r[_+6]<<8|r[_+7];for(w=0;w<80;w++)if(n=q,o=O,s=H,c=Y,d=j,u=J,h=z,W,b=V,g=X,p=$,m=et,I=tt,y=rt,v=at,it,D=65535&(N=it),U=N>>>16,G=65535&(k=W),T=k>>>16,D+=65535&(N=(tt>>>14|j<<18)^(tt>>>18|j<<14)^(j>>>9|tt<<23)),U+=N>>>16,G+=65535&(k=(j>>>14|tt<<18)^(j>>>18|tt<<14)^(tt>>>9|j<<23)),T+=k>>>16,D+=65535&(N=tt&rt^~tt&at),U+=N>>>16,G+=65535&(k=j&J^~j&z),T+=k>>>16,D+=65535&(N=B[2*w+1]),U+=N>>>16,G+=65535&(k=B[2*w]),T+=k>>>16,k=L[w%16],U+=(N=P[w%16])>>>16,G+=65535&k,T+=k>>>16,G+=(U+=(D+=65535&N)>>>16)>>>16,D=65535&(N=Q=65535&D|U<<16),U=N>>>16,G=65535&(k=C=65535&G|(T+=G>>>16)<<16),T=k>>>16,D+=65535&(N=(V>>>28|q<<4)^(q>>>2|V<<30)^(q>>>7|V<<25)),U+=N>>>16,G+=65535&(k=(q>>>28|V<<4)^(V>>>2|q<<30)^(V>>>7|q<<25)),T+=k>>>16,U+=(N=V&X^V&$^X&$)>>>16,G+=65535&(k=q&O^q&H^O&H),T+=k>>>16,l=65535&(G+=(U+=(D+=65535&N)>>>16)>>>16)|(T+=G>>>16)<<16,x=65535&D|U<<16,D=65535&(N=m),U=N>>>16,G=65535&(k=c),T=k>>>16,U+=(N=Q)>>>16,G+=65535&(k=C),T+=k>>>16,O=n,H=o,Y=s,j=c=65535&(G+=(U+=(D+=65535&N)>>>16)>>>16)|(T+=G>>>16)<<16,J=d,z=u,W=h,q=l,X=b,$=g,et=p,tt=m=65535&D|U<<16,rt=I,at=y,it=v,V=x,w%16==15)for(_=0;_<16;_++)k=L[_],D=65535&(N=P[_]),U=N>>>16,G=65535&k,T=k>>>16,k=L[(_+9)%16],D+=65535&(N=P[(_+9)%16]),U+=N>>>16,G+=65535&k,T+=k>>>16,C=L[(_+1)%16],D+=65535&(N=((Q=P[(_+1)%16])>>>1|C<<31)^(Q>>>8|C<<24)^(Q>>>7|C<<25)),U+=N>>>16,G+=65535&(k=(C>>>1|Q<<31)^(C>>>8|Q<<24)^C>>>7),T+=k>>>16,C=L[(_+14)%16],U+=(N=((Q=P[(_+14)%16])>>>19|C<<13)^(C>>>29|Q<<3)^(Q>>>6|C<<26))>>>16,G+=65535&(k=(C>>>19|Q<<13)^(Q>>>29|C<<3)^C>>>6),T+=k>>>16,T+=(G+=(U+=(D+=65535&N)>>>16)>>>16)>>>16,L[_]=65535&G|T<<16,P[_]=65535&D|U<<16;D=65535&(N=V),U=N>>>16,G=65535&(k=q),T=k>>>16,k=e[0],U+=(N=t[0])>>>16,G+=65535&k,T+=k>>>16,T+=(G+=(U+=(D+=65535&N)>>>16)>>>16)>>>16,e[0]=q=65535&G|T<<16,t[0]=V=65535&D|U<<16,D=65535&(N=X),U=N>>>16,G=65535&(k=O),T=k>>>16,k=e[1],U+=(N=t[1])>>>16,G+=65535&k,T+=k>>>16,T+=(G+=(U+=(D+=65535&N)>>>16)>>>16)>>>16,e[1]=O=65535&G|T<<16,t[1]=X=65535&D|U<<16,D=65535&(N=$),U=N>>>16,G=65535&(k=H),T=k>>>16,k=e[2],U+=(N=t[2])>>>16,G+=65535&k,T+=k>>>16,T+=(G+=(U+=(D+=65535&N)>>>16)>>>16)>>>16,e[2]=H=65535&G|T<<16,t[2]=$=65535&D|U<<16,D=65535&(N=et),U=N>>>16,G=65535&(k=Y),T=k>>>16,k=e[3],U+=(N=t[3])>>>16,G+=65535&k,T+=k>>>16,T+=(G+=(U+=(D+=65535&N)>>>16)>>>16)>>>16,e[3]=Y=65535&G|T<<16,t[3]=et=65535&D|U<<16,D=65535&(N=tt),U=N>>>16,G=65535&(k=j),T=k>>>16,k=e[4],U+=(N=t[4])>>>16,G+=65535&k,T+=k>>>16,T+=(G+=(U+=(D+=65535&N)>>>16)>>>16)>>>16,e[4]=j=65535&G|T<<16,t[4]=tt=65535&D|U<<16,D=65535&(N=rt),U=N>>>16,G=65535&(k=J),T=k>>>16,k=e[5],U+=(N=t[5])>>>16,G+=65535&k,T+=k>>>16,T+=(G+=(U+=(D+=65535&N)>>>16)>>>16)>>>16,e[5]=J=65535&G|T<<16,t[5]=rt=65535&D|U<<16,D=65535&(N=at),U=N>>>16,G=65535&(k=z),T=k>>>16,k=e[6],U+=(N=t[6])>>>16,G+=65535&k,T+=k>>>16,T+=(G+=(U+=(D+=65535&N)>>>16)>>>16)>>>16,e[6]=z=65535&G|T<<16,t[6]=at=65535&D|U<<16,D=65535&(N=it),U=N>>>16,G=65535&(k=W),T=k>>>16,k=e[7],U+=(N=t[7])>>>16,G+=65535&k,T+=k>>>16,T+=(G+=(U+=(D+=65535&N)>>>16)>>>16)>>>16,e[7]=W=65535&G|T<<16,t[7]=it=65535&D|U<<16,nt+=128,a-=128}return a}function crypto_hash(e,t,r){var a,n=new Int32Array(8),o=new Int32Array(8),s=new Uint8Array(256),c=r;for(n[0]=1779033703,n[1]=3144134277,n[2]=1013904242,n[3]=2773480762,n[4]=1359893119,n[5]=2600822924,n[6]=528734635,n[7]=1541459225,o[0]=4089235720,o[1]=2227873595,o[2]=4271175723,o[3]=1595750129,o[4]=2917565137,o[5]=725511199,o[6]=4215389547,o[7]=327033209,crypto_hashblocks_hl(n,o,t,r),r%=128,a=0;a=0;--s)cswap(e,t,a=r[s/8|0]>>(7&s)&1),add(t,e),add(e,e),cswap(e,t,a)}function scalarbase(e,t){var r=[gf(),gf(),gf(),gf()];set25519(r[0],u),set25519(r[1],h),set25519(r[2],o),M(r[3],u,h),scalarmult(e,r,t)}function crypto_sign_keypair(e,t,r){var a,n=new Uint8Array(64),o=[gf(),gf(),gf(),gf()];for(r||randombytes(t,32),crypto_hash(n,t,32),n[0]&=248,n[31]&=127,n[31]|=64,scalarbase(o,n),pack(e,o),a=0;a<32;a++)t[a+32]=e[a];return 0}var m=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function modL(e,t){var r,a,n,o;for(a=63;a>=32;--a){for(r=0,n=a-32,o=a-12;n>4)*m[n],r=t[n]>>8,t[n]&=255;for(n=0;n<32;n++)t[n]-=r*m[n];for(a=0;a<32;a++)t[a+1]+=t[a]>>8,e[a]=255&t[a]}function reduce(e){var t,r=new Float64Array(64);for(t=0;t<64;t++)r[t]=e[t];for(t=0;t<64;t++)e[t]=0;modL(e,r)}function crypto_sign(e,t,r,a){var n,o,s=new Uint8Array(64),c=new Uint8Array(64),d=new Uint8Array(64),u=new Float64Array(64),h=[gf(),gf(),gf(),gf()];crypto_hash(s,a,32),s[0]&=248,s[31]&=127,s[31]|=64;var l=r+64;for(n=0;n>7&&Z(e[0],n,e[0]),M(e[3],e[0],e[1]),0)}(b,a))return-1;for(s=0;s=0},e.sign.keyPair=function(){var e=new Uint8Array(v),t=new Uint8Array(x);return crypto_sign_keypair(e,t),{publicKey:e,secretKey:t}},e.sign.keyPair.fromSecretKey=function(e){if(checkArrayTypes(e),e.length!==x)throw new Error("bad secret key size");for(var t=new Uint8Array(v),r=0;r{var t=Math.pow(2,30)-1;e.exports=function(e,r){if("number"!=typeof e)throw new TypeError("Iterations not a number");if(e<0)throw new TypeError("Bad iterations");if("number"!=typeof r)throw new TypeError("Key length not a number");if(r<0||r>t||r!=r)throw new TypeError("Bad key length")}},(e,t,r)=>{var a,n=r(1);if(r.g.process&&r.g.process.browser)a="utf-8";else if(r.g.process&&r.g.process.version){a=parseInt(n.version.split(".")[0].slice(1),10)>=6?"utf-8":"binary"}else a="utf-8";e.exports=a},(e,t,r)=>{var a=r(997),n=r(563),o=r(564),s=r(19).Buffer,c=r(571),d=r(572),u=r(574),h=s.alloc(128),l={md5:16,sha1:20,sha224:28,sha256:32,sha384:48,sha512:64,rmd160:20,ripemd160:20};function Hmac(e,t,r){var c=function getDigest(e){function shaFunc(t){return o(e).update(t).digest()}function rmd160Func(e){return(new n).update(e).digest()}return"rmd160"===e||"ripemd160"===e?rmd160Func:"md5"===e?a:shaFunc}(e),d="sha512"===e||"sha384"===e?128:64;t.length>d?t=c(t):t.length{var a=r(19).Buffer;e.exports=function(e,t,r){if(a.isBuffer(e))return e;if("string"==typeof e)return a.from(e,t);if(ArrayBuffer.isView(e))return a.from(e.buffer);throw new TypeError(r+" must be a string, a Buffer, a typed array or a DataView")}},function(e,t,r){var a;!function(e,n,o){function Alea(e){var t=this,r=function Mash(){var e=4022871197;return function(t){t=String(t);for(var r=0;r>>0,e=(a*=e)>>>0,e+=4294967296*(a-=e)}return 2.3283064365386963e-10*(e>>>0)}}();t.next=function(){var e=2091639*t.s0+2.3283064365386963e-10*t.c;return t.s0=t.s1,t.s1=t.s2,t.s2=e-(t.c=0|e)},t.c=1,t.s0=r(" "),t.s1=r(" "),t.s2=r(" "),t.s0-=r(e),t.s0<0&&(t.s0+=1),t.s1-=r(e),t.s1<0&&(t.s1+=1),t.s2-=r(e),t.s2<0&&(t.s2+=1),r=null}function copy(e,t){return t.c=e.c,t.s0=e.s0,t.s1=e.s1,t.s2=e.s2,t}function impl(e,t){var r=new Alea(e),a=t&&t.state,n=r.next;return n.int32=function(){return 4294967296*r.next()|0},n.double=function(){return n()+11102230246251565e-32*(2097152*n()|0)},n.quick=n,a&&("object"==typeof a&©(a,r),n.state=function(){return copy(r,{})}),n}n&&n.exports?n.exports=impl:r.amdD&&r.amdO?void 0===(a=function(){return impl}.call(t,r,t,n))||(n.exports=a):this.alea=impl}(0,e=r.nmd(e),r.amdD)},function(e,t,r){var a;!function(e,n,o){function XorGen(e){var t=this,r="";t.x=0,t.y=0,t.z=0,t.w=0,t.next=function(){var e=t.x^t.x<<11;return t.x=t.y,t.y=t.z,t.z=t.w,t.w^=t.w>>>19^e^e>>>8},e===(0|e)?t.x=e:r+=e;for(var a=0;a>>0)/4294967296};return prng.double=function(){do{var e=((r.next()>>>11)+(r.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},prng.int32=r.next,prng.quick=prng,a&&("object"==typeof a&©(a,r),prng.state=function(){return copy(r,{})}),prng}n&&n.exports?n.exports=impl:r.amdD&&r.amdO?void 0===(a=function(){return impl}.call(t,r,t,n))||(n.exports=a):this.xor128=impl}(0,e=r.nmd(e),r.amdD)},function(e,t,r){var a;!function(e,n,o){function XorGen(e){var t=this,r="";t.next=function(){var e=t.x^t.x>>>2;return t.x=t.y,t.y=t.z,t.z=t.w,t.w=t.v,(t.d=t.d+362437|0)+(t.v=t.v^t.v<<4^e^e<<1)|0},t.x=0,t.y=0,t.z=0,t.w=0,t.v=0,e===(0|e)?t.x=e:r+=e;for(var a=0;a>>4),t.next()}function copy(e,t){return t.x=e.x,t.y=e.y,t.z=e.z,t.w=e.w,t.v=e.v,t.d=e.d,t}function impl(e,t){var r=new XorGen(e),a=t&&t.state,prng=function(){return(r.next()>>>0)/4294967296};return prng.double=function(){do{var e=((r.next()>>>11)+(r.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},prng.int32=r.next,prng.quick=prng,a&&("object"==typeof a&©(a,r),prng.state=function(){return copy(r,{})}),prng}n&&n.exports?n.exports=impl:r.amdD&&r.amdO?void 0===(a=function(){return impl}.call(t,r,t,n))||(n.exports=a):this.xorwow=impl}(0,e=r.nmd(e),r.amdD)},function(e,t,r){var a;!function(e,n,o){function XorGen(e){var t=this;t.next=function(){var e,r,a=t.x,n=t.i;return e=a[n],r=(e^=e>>>7)^e<<24,r^=(e=a[n+1&7])^e>>>10,r^=(e=a[n+3&7])^e>>>3,r^=(e=a[n+4&7])^e<<7,e=a[n+7&7],r^=(e^=e<<13)^e<<9,a[n]=r,t.i=n+1&7,r},function init(e,t){var r,a=[];if(t===(0|t))a[0]=t;else for(t=""+t,r=0;r0;--r)e.next()}(t,e)}function copy(e,t){return t.x=e.x.slice(),t.i=e.i,t}function impl(e,t){null==e&&(e=+new Date);var r=new XorGen(e),a=t&&t.state,prng=function(){return(r.next()>>>0)/4294967296};return prng.double=function(){do{var e=((r.next()>>>11)+(r.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},prng.int32=r.next,prng.quick=prng,a&&(a.x&©(a,r),prng.state=function(){return copy(r,{})}),prng}n&&n.exports?n.exports=impl:r.amdD&&r.amdO?void 0===(a=function(){return impl}.call(t,r,t,n))||(n.exports=a):this.xorshift7=impl}(0,e=r.nmd(e),r.amdD)},function(e,t,r){var a;!function(e,n,o){function XorGen(e){var t=this;t.next=function(){var e,r,a=t.w,n=t.X,o=t.i;return t.w=a=a+1640531527|0,r=n[o+34&127],e=n[o=o+1&127],r^=r<<13,e^=e<<17,r^=r>>>15,e^=e>>>12,r=n[o]=r^e,t.i=o,r+(a^a>>>16)|0},function init(e,t){var r,a,n,o,s,c=[],d=128;for(t===(0|t)?(a=t,t=null):(t+="\0",a=0,d=Math.max(d,t.length)),n=0,o=-32;o>>15,a^=a<<4,a^=a>>>13,o>=0&&(s=s+1640531527|0,n=0==(r=c[127&o]^=a+s)?n+1:0);for(n>=128&&(c[127&(t&&t.length||0)]=-1),n=127,o=512;o>0;--o)a=c[n+34&127],r=c[n=n+1&127],a^=a<<13,r^=r<<17,a^=a>>>15,r^=r>>>12,c[n]=a^r;e.w=s,e.X=c,e.i=n}(t,e)}function copy(e,t){return t.i=e.i,t.w=e.w,t.X=e.X.slice(),t}function impl(e,t){null==e&&(e=+new Date);var r=new XorGen(e),a=t&&t.state,prng=function(){return(r.next()>>>0)/4294967296};return prng.double=function(){do{var e=((r.next()>>>11)+(r.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},prng.int32=r.next,prng.quick=prng,a&&(a.X&©(a,r),prng.state=function(){return copy(r,{})}),prng}n&&n.exports?n.exports=impl:r.amdD&&r.amdO?void 0===(a=function(){return impl}.call(t,r,t,n))||(n.exports=a):this.xor4096=impl}(0,e=r.nmd(e),r.amdD)},function(e,t,r){var a;!function(e,n,o){function XorGen(e){var t=this,r="";t.next=function(){var e=t.b,r=t.c,a=t.d,n=t.a;return e=e<<25^e>>>7^r,r=r-a|0,a=a<<24^a>>>8^n,n=n-e|0,t.b=e=e<<20^e>>>12^r,t.c=r=r-a|0,t.d=a<<16^r>>>16^n,t.a=n-e|0},t.a=0,t.b=0,t.c=-1640531527,t.d=1367130551,e===Math.floor(e)?(t.a=e/4294967296|0,t.b=0|e):r+=e;for(var a=0;a>>0)/4294967296};return prng.double=function(){do{var e=((r.next()>>>11)+(r.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},prng.int32=r.next,prng.quick=prng,a&&("object"==typeof a&©(a,r),prng.state=function(){return copy(r,{})}),prng}n&&n.exports?n.exports=impl:r.amdD&&r.amdO?void 0===(a=function(){return impl}.call(t,r,t,n))||(n.exports=a):this.tychei=impl}(0,e=r.nmd(e),r.amdD)},function(e,t,r){"use strict";var a,n=this&&this.__extends||(a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])},function(e,t){function __(){this.constructor=e}a(e,t),e.prototype=null===t?Object.create(t):(__.prototype=t.prototype,new __)});t.__esModule=!0;var o=function(e){function Lock(){return e.call(this,1)||this}return n(Lock,e),Lock}(r(247).default);t.Lock=o},function(e,t,r){"use strict";var a=r(0).Buffer,n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.Address=void 0;var o=n(r(6)),s=n(r(48)),c=r(79),d=r(37),u=function(){function Address(e){o.default(20===e.length,"Invalid address length"),this.buf=e}return Address.zero=function(){return new Address(c.zeros(20))},Address.fromString=function(e){return o.default(d.isValidAddress(e),"Invalid address"),new Address(c.toBuffer(e))},Address.fromPublicKey=function(e){return o.default(a.isBuffer(e),"Public key should be Buffer"),new Address(d.pubToAddress(e))},Address.fromPrivateKey=function(e){return o.default(a.isBuffer(e),"Private key should be Buffer"),new Address(d.privateToAddress(e))},Address.generate=function(e,t){return o.default(s.default.isBN(t)),new Address(d.generateAddress(e.buf,t.toArrayLike(a)))},Address.generate2=function(e,t,r){return o.default(a.isBuffer(t)),o.default(a.isBuffer(r)),new Address(d.generateAddress2(e.buf,t,r))},Address.prototype.equals=function(e){return this.buf.equals(e.buf)},Address.prototype.isZero=function(){return this.equals(Address.zero())},Address.prototype.isPrecompileOrSystemAddress=function(){var e=new s.default(this.buf),t=new s.default(0),r=new s.default("ffff","hex");return e.gte(t)&&e.lte(r)},Address.prototype.toString=function(){return"0x"+this.buf.toString("hex")},Address.prototype.toBuffer=function(){return a.from(this.buf)},Address}();t.Address=u},function(e,t,r){"use strict";var a=r(0).Buffer,n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.hashPersonalMessage=t.isValidSignature=t.fromRpcSig=t.toCompactSig=t.toRpcSig=t.ecrecover=t.ecsign=void 0;var o=r(89),s=n(r(48)),c=r(79),d=r(64),u=r(372),h=r(248);function calculateSigRecovery(e,t){var r=h.toType(e,h.TypeOutput.BN);if(!t)return r.subn(27);var a=h.toType(t,h.TypeOutput.BN);return r.sub(a.muln(2).addn(35))}function isValidSigRecovery(e){var t=new s.default(e);return t.eqn(0)||t.eqn(1)}t.ecsign=function ecsign(e,t,r){var n=o.ecdsaSign(e,t),s=n.signature,c=n.recid,d=a.from(s.slice(0,32)),u=a.from(s.slice(32,64));if(!r||"number"==typeof r){if(r&&!Number.isSafeInteger(r))throw new Error("The provided number is greater than MAX_SAFE_INTEGER (please use an alternative input type)");return{r:d,s:u,v:r?c+(2*r+35):c+27}}return{r:d,s:u,v:h.toType(r,h.TypeOutput.BN).muln(2).addn(35).addn(c).toArrayLike(a)}},t.ecrecover=function(e,t,r,n,s){var d=a.concat([c.setLengthLeft(r,32),c.setLengthLeft(n,32)],64),u=calculateSigRecovery(t,s);if(!isValidSigRecovery(u))throw new Error("Invalid signature v value");var h=o.ecdsaRecover(d,u.toNumber(),e);return a.from(o.publicKeyConvert(h,!1).slice(1))},t.toRpcSig=function(e,t,r,n){if(!isValidSigRecovery(calculateSigRecovery(e,n)))throw new Error("Invalid signature v value");return c.bufferToHex(a.concat([c.setLengthLeft(t,32),c.setLengthLeft(r,32),c.toBuffer(e)]))},t.toCompactSig=function(e,t,r,n){if(!isValidSigRecovery(calculateSigRecovery(e,n)))throw new Error("Invalid signature v value");var o=h.toType(e,h.TypeOutput.Number),s=r;return(o>28&&o%2==1||1===o||28===o)&&((s=a.from(r))[0]|=128),c.bufferToHex(a.concat([c.setLengthLeft(t,32),c.setLengthLeft(s,32)]))},t.fromRpcSig=function(e){var t,r,a,n=c.toBuffer(e);if(n.length>=65)t=n.slice(0,32),r=n.slice(32,64),a=c.bufferToInt(n.slice(64));else{if(64!==n.length)throw new Error("Invalid signature length");t=n.slice(0,32),r=n.slice(32,64),a=c.bufferToInt(n.slice(32,33))>>7,r[0]&=127}return a<27&&(a+=27),{v:a,r:t,s:r}},t.isValidSignature=function(e,t,r,a,n){void 0===a&&(a=!0);var o=new s.default("7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0",16),c=new s.default("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141",16);if(32!==t.length||32!==r.length)return!1;if(!isValidSigRecovery(calculateSigRecovery(e,n)))return!1;var d=new s.default(t),u=new s.default(r);return!(d.isZero()||d.gt(c)||u.isZero()||u.gt(c))&&(!a||1!==u.cmp(o))},t.hashPersonalMessage=function(e){u.assertIsBuffer(e);var t=a.from("Ethereum Signed Message:\n"+e.length.toString(),"utf-8");return d.keccak(a.concat([t,e]))}},(e,t,r)=>{var a=r(585);function AbstractIterator(e){if("object"!=typeof e||null===e)throw new TypeError("First argument must be an abstract-leveldown compliant store");this.db=e,this._ended=!1,this._nexting=!1}AbstractIterator.prototype.next=function(e){var t=this;if("function"!=typeof e)throw new Error("next() requires a callback argument");return t._ended?(a(e,new Error("cannot call next() after end()")),t):t._nexting?(a(e,new Error("cannot call next() before previous next() has completed")),t):(t._nexting=!0,t._next((function(){t._nexting=!1,e.apply(null,arguments)})),t)},AbstractIterator.prototype._next=function(e){a(e)},AbstractIterator.prototype.seek=function(e){if(this._ended)throw new Error("cannot call seek() after end()");if(this._nexting)throw new Error("cannot call seek() before next() has completed");e=this.db._serializeKey(e),this._seek(e)},AbstractIterator.prototype._seek=function(e){},AbstractIterator.prototype.end=function(e){if("function"!=typeof e)throw new Error("end() requires a callback argument");if(this._ended)return a(e,new Error("end() already called on iterator"));this._ended=!0,this._end(e)},AbstractIterator.prototype._end=function(e){a(e)},AbstractIterator.prototype._nextTick=a,e.exports=AbstractIterator},(e,t,r)=>{e.exports=r(586)},(e,t,r)=>{"use strict";var a,n,o,s=[r(1011),r(1369),r(1370),r(1371),r(1372),r(1373)],c=-1,d=[],u=!1;function cleanUpNextTick(){a&&n&&(a=!1,n.length?d=n.concat(d):c=-1,d.length&&nextTick())}function nextTick(){if(!a){u=!1,a=!0;for(var e=d.length,t=setTimeout(cleanUpNextTick);e;){for(n=d,d=[];n&&++c1)for(var r=1;r{var a=r(585);function AbstractChainedBatch(e){if("object"!=typeof e||null===e)throw new TypeError("First argument must be an abstract-leveldown compliant store");this.db=e,this._operations=[],this._written=!1}AbstractChainedBatch.prototype._checkWritten=function(){if(this._written)throw new Error("write() already called on this batch")},AbstractChainedBatch.prototype.put=function(e,t){this._checkWritten();var r=this.db._checkKey(e)||this.db._checkValue(t);if(r)throw r;return e=this.db._serializeKey(e),t=this.db._serializeValue(t),this._put(e,t),this},AbstractChainedBatch.prototype._put=function(e,t){this._operations.push({type:"put",key:e,value:t})},AbstractChainedBatch.prototype.del=function(e){this._checkWritten();var t=this.db._checkKey(e);if(t)throw t;return e=this.db._serializeKey(e),this._del(e),this},AbstractChainedBatch.prototype._del=function(e){this._operations.push({type:"del",key:e})},AbstractChainedBatch.prototype.clear=function(){return this._checkWritten(),this._clear(),this},AbstractChainedBatch.prototype._clear=function(){this._operations=[]},AbstractChainedBatch.prototype.write=function(e,t){if(this._checkWritten(),"function"==typeof e&&(t=e),"function"!=typeof t)throw new Error("write() requires a callback argument");"object"==typeof e&&null!==e||(e={}),this._written=!0,this._write(e,t)},AbstractChainedBatch.prototype._write=function(e,t){this.db._batch(this._operations,e,t)},AbstractChainedBatch.prototype._nextTick=a,e.exports=AbstractChainedBatch},e=>{e.exports=function promisify(){var e,t=new Promise((function(t,r){e=function callback(e,a){e?r(e):t(a)}}));return e.promise=t,e}},(e,t,r)=>{var a=r(590);function AbstractIterator(e){if("object"!=typeof e||null===e)throw new TypeError("First argument must be an abstract-leveldown compliant store");this.db=e,this._ended=!1,this._nexting=!1}AbstractIterator.prototype.next=function(e){var t=this;if("function"!=typeof e)throw new Error("next() requires a callback argument");return t._ended?(a(e,new Error("cannot call next() after end()")),t):t._nexting?(a(e,new Error("cannot call next() before previous next() has completed")),t):(t._nexting=!0,t._next((function(){t._nexting=!1,e.apply(null,arguments)})),t)},AbstractIterator.prototype._next=function(e){a(e)},AbstractIterator.prototype.seek=function(e){if(this._ended)throw new Error("cannot call seek() after end()");if(this._nexting)throw new Error("cannot call seek() before next() has completed");e=this.db._serializeKey(e),this._seek(e)},AbstractIterator.prototype._seek=function(e){},AbstractIterator.prototype.end=function(e){if("function"!=typeof e)throw new Error("end() requires a callback argument");if(this._ended)return a(e,new Error("end() already called on iterator"));this._ended=!0,this._end(e)},AbstractIterator.prototype._end=function(e){a(e)},AbstractIterator.prototype._nextTick=a,e.exports=AbstractIterator},(e,t,r)=>{e.exports=r(586)},(e,t,r)=>{var a=r(590);function AbstractChainedBatch(e){if("object"!=typeof e||null===e)throw new TypeError("First argument must be an abstract-leveldown compliant store");this.db=e,this._operations=[],this._written=!1}AbstractChainedBatch.prototype._checkWritten=function(){if(this._written)throw new Error("write() already called on this batch")},AbstractChainedBatch.prototype.put=function(e,t){this._checkWritten();var r=this.db._checkKey(e)||this.db._checkValue(t);if(r)throw r;return e=this.db._serializeKey(e),t=this.db._serializeValue(t),this._put(e,t),this},AbstractChainedBatch.prototype._put=function(e,t){this._operations.push({type:"put",key:e,value:t})},AbstractChainedBatch.prototype.del=function(e){this._checkWritten();var t=this.db._checkKey(e);if(t)throw t;return e=this.db._serializeKey(e),this._del(e),this},AbstractChainedBatch.prototype._del=function(e){this._operations.push({type:"del",key:e})},AbstractChainedBatch.prototype.clear=function(){return this._checkWritten(),this._clear(),this},AbstractChainedBatch.prototype._clear=function(){this._operations=[]},AbstractChainedBatch.prototype.write=function(e,t){if(this._checkWritten(),"function"==typeof e&&(t=e),"function"!=typeof t)throw new Error("write() requires a callback argument");"object"==typeof e&&null!==e||(e={}),this._written=!0,this._write(e,t)},AbstractChainedBatch.prototype._write=function(e,t){this.db._batch(this._operations,e,t)},AbstractChainedBatch.prototype._nextTick=a,e.exports=AbstractChainedBatch},(e,t,r)=>{var a=r(0).Buffer;t.utf8=t["utf-8"]={encode:function(e){return isBinary(e)?e:String(e)},decode:identity,buffer:!1,type:"utf8"},t.json={encode:JSON.stringify,decode:JSON.parse,buffer:!1,type:"json"},t.binary={encode:function(e){return isBinary(e)?e:a.from(e)},decode:identity,buffer:!0,type:"binary"},t.none={encode:identity,decode:identity,buffer:!1,type:"id"},t.id=t.none;function identity(e){return e}function isBinary(e){return null==e||a.isBuffer(e)}["hex","ascii","base64","ucs2","ucs-2","utf16le","utf-16le"].forEach((function(e){t[e]={encode:function(t){return isBinary(t)?t:a.from(t,e)},decode:function(t){return t.toString(e)},buffer:!0,type:e}}))},(e,t,r)=>{var a=r(594);function AbstractIterator(e){if("object"!=typeof e||null===e)throw new TypeError("First argument must be an abstract-leveldown compliant store");this.db=e,this._ended=!1,this._nexting=!1}AbstractIterator.prototype.next=function(e){var t=this;if("function"!=typeof e)throw new Error("next() requires a callback argument");return t._ended?(a(e,new Error("cannot call next() after end()")),t):t._nexting?(a(e,new Error("cannot call next() before previous next() has completed")),t):(t._nexting=!0,t._next((function(){t._nexting=!1,e.apply(null,arguments)})),t)},AbstractIterator.prototype._next=function(e){a(e)},AbstractIterator.prototype.seek=function(e){if(this._ended)throw new Error("cannot call seek() after end()");if(this._nexting)throw new Error("cannot call seek() before next() has completed");e=this.db._serializeKey(e),this._seek(e)},AbstractIterator.prototype._seek=function(e){},AbstractIterator.prototype.end=function(e){if("function"!=typeof e)throw new Error("end() requires a callback argument");if(this._ended)return a(e,new Error("end() already called on iterator"));this._ended=!0,this._end(e)},AbstractIterator.prototype._end=function(e){a(e)},AbstractIterator.prototype._nextTick=a,e.exports=AbstractIterator},(e,t,r)=>{e.exports=r(595)},(e,t,r)=>{"use strict";var a,n,o,s=[r(1374),r(1375),r(1376),r(1377),r(1378)],c=-1,d=[],u=!1;function cleanUpNextTick(){a&&n&&(a=!1,n.length?d=n.concat(d):c=-1,d.length&&nextTick())}function nextTick(){if(!a){u=!1,a=!0;for(var e=d.length,t=setTimeout(cleanUpNextTick);e;){for(n=d,d=[];n&&++c1)for(var r=1;r{var a=r(594);function AbstractChainedBatch(e){if("object"!=typeof e||null===e)throw new TypeError("First argument must be an abstract-leveldown compliant store");this.db=e,this._operations=[],this._written=!1}AbstractChainedBatch.prototype._checkWritten=function(){if(this._written)throw new Error("write() already called on this batch")},AbstractChainedBatch.prototype.put=function(e,t){this._checkWritten();var r=this.db._checkKey(e)||this.db._checkValue(t);if(r)throw r;return e=this.db._serializeKey(e),t=this.db._serializeValue(t),this._put(e,t),this},AbstractChainedBatch.prototype._put=function(e,t){this._operations.push({type:"put",key:e,value:t})},AbstractChainedBatch.prototype.del=function(e){this._checkWritten();var t=this.db._checkKey(e);if(t)throw t;return e=this.db._serializeKey(e),this._del(e),this},AbstractChainedBatch.prototype._del=function(e){this._operations.push({type:"del",key:e})},AbstractChainedBatch.prototype.clear=function(){return this._checkWritten(),this._clear(),this},AbstractChainedBatch.prototype._clear=function(){this._operations=[]},AbstractChainedBatch.prototype.write=function(e,t){if(this._checkWritten(),"function"==typeof e&&(t=e),"function"!=typeof t)throw new Error("write() requires a callback argument");"object"==typeof e&&null!==e||(e={}),this._written=!0,this._write(e,t)},AbstractChainedBatch.prototype._write=function(e,t){this.db._batch(this._operations,e,t)},AbstractChainedBatch.prototype._nextTick=a,e.exports=AbstractChainedBatch},(e,t,r)=>{"use strict";var a=r(0).Buffer;function matchingNibbleLength(e,t){for(var r=0;e[r]===t[r]&&e.length>r;)r++;return r}Object.defineProperty(t,"__esModule",{value:!0}),t.doKeysMatch=t.matchingNibbleLength=t.nibblesToBuffer=t.bufferToNibbles=void 0,t.bufferToNibbles=function bufferToNibbles(e){for(var t=a.from(e),r=[],n=0;n>4,r[++o]=t[n]%16}return r},t.nibblesToBuffer=function nibblesToBuffer(e){for(var t=a.alloc(e.length/2),r=0;r>>0,e=(a*=e)>>>0,e+=4294967296*(a-=e)}return 2.3283064365386963e-10*(e>>>0)}}();t.next=function(){var e=2091639*t.s0+2.3283064365386963e-10*t.c;return t.s0=t.s1,t.s1=t.s2,t.s2=e-(t.c=0|e)},t.c=1,t.s0=r(" "),t.s1=r(" "),t.s2=r(" "),t.s0-=r(e),t.s0<0&&(t.s0+=1),t.s1-=r(e),t.s1<0&&(t.s1+=1),t.s2-=r(e),t.s2<0&&(t.s2+=1),r=null}function copy(e,t){return t.c=e.c,t.s0=e.s0,t.s1=e.s1,t.s2=e.s2,t}function impl(e,t){var r=new Alea(e),a=t&&t.state,n=r.next;return n.int32=function(){return 4294967296*r.next()|0},n.double=function(){return n()+11102230246251565e-32*(2097152*n()|0)},n.quick=n,a&&("object"==typeof a&©(a,r),n.state=function(){return copy(r,{})}),n}n&&n.exports?n.exports=impl:r.amdD&&r.amdO?void 0===(a=function(){return impl}.call(t,r,t,n))||(n.exports=a):this.alea=impl}(0,e=r.nmd(e),r.amdD)},function(e,t,r){var a;!function(e,n,o){function XorGen(e){var t=this,r="";t.x=0,t.y=0,t.z=0,t.w=0,t.next=function(){var e=t.x^t.x<<11;return t.x=t.y,t.y=t.z,t.z=t.w,t.w^=t.w>>>19^e^e>>>8},e===(0|e)?t.x=e:r+=e;for(var a=0;a>>0)/4294967296};return prng.double=function(){do{var e=((r.next()>>>11)+(r.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},prng.int32=r.next,prng.quick=prng,a&&("object"==typeof a&©(a,r),prng.state=function(){return copy(r,{})}),prng}n&&n.exports?n.exports=impl:r.amdD&&r.amdO?void 0===(a=function(){return impl}.call(t,r,t,n))||(n.exports=a):this.xor128=impl}(0,e=r.nmd(e),r.amdD)},function(e,t,r){var a;!function(e,n,o){function XorGen(e){var t=this,r="";t.next=function(){var e=t.x^t.x>>>2;return t.x=t.y,t.y=t.z,t.z=t.w,t.w=t.v,(t.d=t.d+362437|0)+(t.v=t.v^t.v<<4^e^e<<1)|0},t.x=0,t.y=0,t.z=0,t.w=0,t.v=0,e===(0|e)?t.x=e:r+=e;for(var a=0;a>>4),t.next()}function copy(e,t){return t.x=e.x,t.y=e.y,t.z=e.z,t.w=e.w,t.v=e.v,t.d=e.d,t}function impl(e,t){var r=new XorGen(e),a=t&&t.state,prng=function(){return(r.next()>>>0)/4294967296};return prng.double=function(){do{var e=((r.next()>>>11)+(r.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},prng.int32=r.next,prng.quick=prng,a&&("object"==typeof a&©(a,r),prng.state=function(){return copy(r,{})}),prng}n&&n.exports?n.exports=impl:r.amdD&&r.amdO?void 0===(a=function(){return impl}.call(t,r,t,n))||(n.exports=a):this.xorwow=impl}(0,e=r.nmd(e),r.amdD)},function(e,t,r){var a;!function(e,n,o){function XorGen(e){var t=this;t.next=function(){var e,r,a=t.x,n=t.i;return e=a[n],r=(e^=e>>>7)^e<<24,r^=(e=a[n+1&7])^e>>>10,r^=(e=a[n+3&7])^e>>>3,r^=(e=a[n+4&7])^e<<7,e=a[n+7&7],r^=(e^=e<<13)^e<<9,a[n]=r,t.i=n+1&7,r},function init(e,t){var r,a=[];if(t===(0|t))a[0]=t;else for(t=""+t,r=0;r0;--r)e.next()}(t,e)}function copy(e,t){return t.x=e.x.slice(),t.i=e.i,t}function impl(e,t){null==e&&(e=+new Date);var r=new XorGen(e),a=t&&t.state,prng=function(){return(r.next()>>>0)/4294967296};return prng.double=function(){do{var e=((r.next()>>>11)+(r.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},prng.int32=r.next,prng.quick=prng,a&&(a.x&©(a,r),prng.state=function(){return copy(r,{})}),prng}n&&n.exports?n.exports=impl:r.amdD&&r.amdO?void 0===(a=function(){return impl}.call(t,r,t,n))||(n.exports=a):this.xorshift7=impl}(0,e=r.nmd(e),r.amdD)},function(e,t,r){var a;!function(e,n,o){function XorGen(e){var t=this;t.next=function(){var e,r,a=t.w,n=t.X,o=t.i;return t.w=a=a+1640531527|0,r=n[o+34&127],e=n[o=o+1&127],r^=r<<13,e^=e<<17,r^=r>>>15,e^=e>>>12,r=n[o]=r^e,t.i=o,r+(a^a>>>16)|0},function init(e,t){var r,a,n,o,s,c=[],d=128;for(t===(0|t)?(a=t,t=null):(t+="\0",a=0,d=Math.max(d,t.length)),n=0,o=-32;o>>15,a^=a<<4,a^=a>>>13,o>=0&&(s=s+1640531527|0,n=0==(r=c[127&o]^=a+s)?n+1:0);for(n>=128&&(c[127&(t&&t.length||0)]=-1),n=127,o=512;o>0;--o)a=c[n+34&127],r=c[n=n+1&127],a^=a<<13,r^=r<<17,a^=a>>>15,r^=r>>>12,c[n]=a^r;e.w=s,e.X=c,e.i=n}(t,e)}function copy(e,t){return t.i=e.i,t.w=e.w,t.X=e.X.slice(),t}function impl(e,t){null==e&&(e=+new Date);var r=new XorGen(e),a=t&&t.state,prng=function(){return(r.next()>>>0)/4294967296};return prng.double=function(){do{var e=((r.next()>>>11)+(r.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},prng.int32=r.next,prng.quick=prng,a&&(a.X&©(a,r),prng.state=function(){return copy(r,{})}),prng}n&&n.exports?n.exports=impl:r.amdD&&r.amdO?void 0===(a=function(){return impl}.call(t,r,t,n))||(n.exports=a):this.xor4096=impl}(0,e=r.nmd(e),r.amdD)},function(e,t,r){var a;!function(e,n,o){function XorGen(e){var t=this,r="";t.next=function(){var e=t.b,r=t.c,a=t.d,n=t.a;return e=e<<25^e>>>7^r,r=r-a|0,a=a<<24^a>>>8^n,n=n-e|0,t.b=e=e<<20^e>>>12^r,t.c=r=r-a|0,t.d=a<<16^r>>>16^n,t.a=n-e|0},t.a=0,t.b=0,t.c=-1640531527,t.d=1367130551,e===Math.floor(e)?(t.a=e/4294967296|0,t.b=0|e):r+=e;for(var a=0;a>>0)/4294967296};return prng.double=function(){do{var e=((r.next()>>>11)+(r.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},prng.int32=r.next,prng.quick=prng,a&&("object"==typeof a&©(a,r),prng.state=function(){return copy(r,{})}),prng}n&&n.exports?n.exports=impl:r.amdD&&r.amdO?void 0===(a=function(){return impl}.call(t,r,t,n))||(n.exports=a):this.tychei=impl}(0,e=r.nmd(e),r.amdD)},(e,t,r)=>{"use strict";var a=r(38),n=r(605),o=r(43).Buffer,s=new Array(16);function MD5(){n.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878}function rotl(e,t){return e<>>32-t}function fnF(e,t,r,a,n,o,s){return rotl(e+(t&r|~t&a)+n+o|0,s)+t|0}function fnG(e,t,r,a,n,o,s){return rotl(e+(t&a|r&~a)+n+o|0,s)+t|0}function fnH(e,t,r,a,n,o,s){return rotl(e+(t^r^a)+n+o|0,s)+t|0}function fnI(e,t,r,a,n,o,s){return rotl(e+(r^(t|~a))+n+o|0,s)+t|0}a(MD5,n),MD5.prototype._update=function(){for(var e=s,t=0;t<16;++t)e[t]=this._block.readInt32LE(4*t);var r=this._a,a=this._b,n=this._c,o=this._d;r=fnF(r,a,n,o,e[0],3614090360,7),o=fnF(o,r,a,n,e[1],3905402710,12),n=fnF(n,o,r,a,e[2],606105819,17),a=fnF(a,n,o,r,e[3],3250441966,22),r=fnF(r,a,n,o,e[4],4118548399,7),o=fnF(o,r,a,n,e[5],1200080426,12),n=fnF(n,o,r,a,e[6],2821735955,17),a=fnF(a,n,o,r,e[7],4249261313,22),r=fnF(r,a,n,o,e[8],1770035416,7),o=fnF(o,r,a,n,e[9],2336552879,12),n=fnF(n,o,r,a,e[10],4294925233,17),a=fnF(a,n,o,r,e[11],2304563134,22),r=fnF(r,a,n,o,e[12],1804603682,7),o=fnF(o,r,a,n,e[13],4254626195,12),n=fnF(n,o,r,a,e[14],2792965006,17),r=fnG(r,a=fnF(a,n,o,r,e[15],1236535329,22),n,o,e[1],4129170786,5),o=fnG(o,r,a,n,e[6],3225465664,9),n=fnG(n,o,r,a,e[11],643717713,14),a=fnG(a,n,o,r,e[0],3921069994,20),r=fnG(r,a,n,o,e[5],3593408605,5),o=fnG(o,r,a,n,e[10],38016083,9),n=fnG(n,o,r,a,e[15],3634488961,14),a=fnG(a,n,o,r,e[4],3889429448,20),r=fnG(r,a,n,o,e[9],568446438,5),o=fnG(o,r,a,n,e[14],3275163606,9),n=fnG(n,o,r,a,e[3],4107603335,14),a=fnG(a,n,o,r,e[8],1163531501,20),r=fnG(r,a,n,o,e[13],2850285829,5),o=fnG(o,r,a,n,e[2],4243563512,9),n=fnG(n,o,r,a,e[7],1735328473,14),r=fnH(r,a=fnG(a,n,o,r,e[12],2368359562,20),n,o,e[5],4294588738,4),o=fnH(o,r,a,n,e[8],2272392833,11),n=fnH(n,o,r,a,e[11],1839030562,16),a=fnH(a,n,o,r,e[14],4259657740,23),r=fnH(r,a,n,o,e[1],2763975236,4),o=fnH(o,r,a,n,e[4],1272893353,11),n=fnH(n,o,r,a,e[7],4139469664,16),a=fnH(a,n,o,r,e[10],3200236656,23),r=fnH(r,a,n,o,e[13],681279174,4),o=fnH(o,r,a,n,e[0],3936430074,11),n=fnH(n,o,r,a,e[3],3572445317,16),a=fnH(a,n,o,r,e[6],76029189,23),r=fnH(r,a,n,o,e[9],3654602809,4),o=fnH(o,r,a,n,e[12],3873151461,11),n=fnH(n,o,r,a,e[15],530742520,16),r=fnI(r,a=fnH(a,n,o,r,e[2],3299628645,23),n,o,e[0],4096336452,6),o=fnI(o,r,a,n,e[7],1126891415,10),n=fnI(n,o,r,a,e[14],2878612391,15),a=fnI(a,n,o,r,e[5],4237533241,21),r=fnI(r,a,n,o,e[12],1700485571,6),o=fnI(o,r,a,n,e[3],2399980690,10),n=fnI(n,o,r,a,e[10],4293915773,15),a=fnI(a,n,o,r,e[1],2240044497,21),r=fnI(r,a,n,o,e[8],1873313359,6),o=fnI(o,r,a,n,e[15],4264355552,10),n=fnI(n,o,r,a,e[6],2734768916,15),a=fnI(a,n,o,r,e[13],1309151649,21),r=fnI(r,a,n,o,e[4],4149444226,6),o=fnI(o,r,a,n,e[11],3174756917,10),n=fnI(n,o,r,a,e[2],718787259,15),a=fnI(a,n,o,r,e[9],3951481745,21),this._a=this._a+r|0,this._b=this._b+a|0,this._c=this._c+n|0,this._d=this._d+o|0},MD5.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 e=o.allocUnsafe(16);return e.writeInt32LE(this._a,0),e.writeInt32LE(this._b,4),e.writeInt32LE(this._c,8),e.writeInt32LE(this._d,12),e},e.exports=MD5},(e,t,r)=>{"use strict";var a=r(43).Buffer,n=r(383).Transform;function HashBase(e){n.call(this),this._block=a.allocUnsafe(e),this._blockSize=e,this._blockOffset=0,this._length=[0,0,0,0],this._finalized=!1}r(38)(HashBase,n),HashBase.prototype._transform=function(e,t,r){var a=null;try{this.update(e,t)}catch(e){a=e}r(a)},HashBase.prototype._flush=function(e){var t=null;try{this.push(this.digest())}catch(e){t=e}e(t)},HashBase.prototype.update=function(e,t){if(function throwIfNotStringOrBuffer(e,t){if(!a.isBuffer(e)&&"string"!=typeof e)throw new TypeError(t+" must be a string or a buffer")}(e,"Data"),this._finalized)throw new Error("Digest already called");a.isBuffer(e)||(e=a.from(e,t));for(var r=this._block,n=0;this._blockOffset+e.length-n>=this._blockSize;){for(var o=this._blockOffset;o0;++s)this._length[s]+=c,(c=this._length[s]/4294967296|0)>0&&(this._length[s]-=4294967296*c);return this},HashBase.prototype._update=function(){throw new Error("_update is not implemented")},HashBase.prototype.digest=function(e){if(this._finalized)throw new Error("Digest already called");this._finalized=!0;var t=this._digest();void 0!==e&&(t=t.toString(e)),this._block.fill(0),this._blockOffset=0;for(var r=0;r<4;++r)this._length[r]=0;return t},HashBase.prototype._digest=function(){throw new Error("_digest is not implemented")},e.exports=HashBase},(e,t,r)=>{"use strict";var a,n=r(1);e.exports=Readable,Readable.ReadableState=ReadableState;r(32).EventEmitter;var o=function EElistenerCount(e,t){return e.listeners(t).length},s=r(1028),c=r(2).Buffer,d=r.g.Uint8Array||function(){};var u,h=r(85);u=h&&h.debuglog?h.debuglog("stream"):function debug(){};var l,b,g,p=r(1029),B=r(607),m=r(608).getHighWaterMark,I=r(249).a,y=I.ERR_INVALID_ARG_TYPE,v=I.ERR_STREAM_PUSH_AFTER_EOF,x=I.ERR_METHOD_NOT_IMPLEMENTED,C=I.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;r(38)(Readable,s);var Q=B.errorOrDestroy,w=["error","close","destroy","pause","resume"];function ReadableState(e,t,n){a=a||r(208),e=e||{},"boolean"!=typeof n&&(n=t instanceof a),this.objectMode=!!e.objectMode,n&&(this.objectMode=this.objectMode||!!e.readableObjectMode),this.highWaterMark=m(this,e,"readableHighWaterMark",n),this.buffer=new p,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&&(l||(l=r(610).a),this.decoder=new l(e.encoding),this.encoding=e.encoding)}function Readable(e){if(a=a||r(208),!(this instanceof Readable))return new Readable(e);var t=this instanceof a;this._readableState=new ReadableState(e,this,t),this.readable=!0,e&&("function"==typeof e.read&&(this._read=e.read),"function"==typeof e.destroy&&(this._destroy=e.destroy)),s.call(this)}function readableAddChunk(e,t,r,a,n){u("readableAddChunk",t);var o,s=e._readableState;if(null===t)s.reading=!1,function onEofChunk(e,t){if(u("onEofChunk"),t.ended)return;if(t.decoder){var r=t.decoder.end();r&&r.length&&(t.buffer.push(r),t.length+=t.objectMode?1:r.length)}t.ended=!0,t.sync?emitReadable(e):(t.needReadable=!1,t.emittedReadable||(t.emittedReadable=!0,emitReadable_(e)))}(e,s);else if(n||(o=function chunkInvalid(e,t){var r;(function _isUint8Array(e){return c.isBuffer(e)||e instanceof d})(t)||"string"==typeof t||void 0===t||e.objectMode||(r=new y("chunk",["string","Buffer","Uint8Array"],t));return r}(s,t)),o)Q(e,o);else if(s.objectMode||t&&t.length>0)if("string"==typeof t||s.objectMode||Object.getPrototypeOf(t)===c.prototype||(t=function _uint8ArrayToBuffer(e){return c.from(e)}(t)),a)s.endEmitted?Q(e,new C):addChunk(e,s,t,!0);else if(s.ended)Q(e,new v);else{if(s.destroyed)return!1;s.reading=!1,s.decoder&&!r?(t=s.decoder.write(t),s.objectMode||0!==t.length?addChunk(e,s,t,!1):maybeReadMore(e,s)):addChunk(e,s,t,!1)}else a||(s.reading=!1,maybeReadMore(e,s));return!s.ended&&(s.lengtht.highWaterMark&&(t.highWaterMark=function computeNewHighWaterMark(e){return e>=_?e=_:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function emitReadable(e){var t=e._readableState;u("emitReadable",t.needReadable,t.emittedReadable),t.needReadable=!1,t.emittedReadable||(u("emitReadable",t.flowing),t.emittedReadable=!0,n.nextTick(emitReadable_,e))}function emitReadable_(e){var t=e._readableState;u("emitReadable_",t.destroyed,t.length,t.ended),t.destroyed||!t.length&&!t.ended||(e.emit("readable"),t.emittedReadable=!1),t.needReadable=!t.flowing&&!t.ended&&t.length<=t.highWaterMark,flow(e)}function maybeReadMore(e,t){t.readingMore||(t.readingMore=!0,n.nextTick(maybeReadMore_,e,t))}function maybeReadMore_(e,t){for(;!t.reading&&!t.ended&&(t.length0,t.resumeScheduled&&!t.paused?t.flowing=!0:e.listenerCount("data")>0&&e.resume()}function nReadingNextTick(e){u("readable nexttick read 0"),e.read(0)}function resume_(e,t){u("resume",t.reading),t.reading||e.read(0),t.resumeScheduled=!1,e.emit("resume"),flow(e),t.flowing&&!t.reading&&e.read(0)}function flow(e){var t=e._readableState;for(u("flow",t.flowing);t.flowing&&null!==e.read(););}function fromList(e,t){return 0===t.length?null:(t.objectMode?r=t.buffer.shift():!e||e>=t.length?(r=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.first():t.buffer.concat(t.length),t.buffer.clear()):r=t.buffer.consume(e,t.decoder),r);var r}function endReadable(e){var t=e._readableState;u("endReadable",t.endEmitted),t.endEmitted||(t.ended=!0,n.nextTick(endReadableNT,t,e))}function endReadableNT(e,t){if(u("endReadableNT",e.endEmitted,e.length),!e.endEmitted&&0===e.length&&(e.endEmitted=!0,t.readable=!1,t.emit("end"),e.autoDestroy)){var r=t._writableState;(!r||r.autoDestroy&&r.finished)&&t.destroy()}}function indexOf(e,t){for(var r=0,a=e.length;r=t.highWaterMark:t.length>0)||t.ended))return u("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?endReadable(this):emitReadable(this),null;if(0===(e=howMuchToRead(e,t))&&t.ended)return 0===t.length&&endReadable(this),null;var a,n=t.needReadable;return u("need readable",n),(0===t.length||t.length-e0?fromList(e,t):null)?(t.needReadable=t.length<=t.highWaterMark,e=0):(t.length-=e,t.awaitDrain=0),0===t.length&&(t.ended||(t.needReadable=!0),r!==e&&t.ended&&endReadable(this)),null!==a&&this.emit("data",a),a},Readable.prototype._read=function(e){Q(this,new x("_read()"))},Readable.prototype.pipe=function(e,t){var r=this,a=this._readableState;switch(a.pipesCount){case 0:a.pipes=e;break;case 1:a.pipes=[a.pipes,e];break;default:a.pipes.push(e)}a.pipesCount+=1,u("pipe count=%d opts=%j",a.pipesCount,t);var s=(!t||!1!==t.end)&&e!==n.stdout&&e!==n.stderr?onend:unpipe;function onunpipe(t,n){u("onunpipe"),t===r&&n&&!1===n.hasUnpiped&&(n.hasUnpiped=!0,function cleanup(){u("cleanup"),e.removeListener("close",onclose),e.removeListener("finish",onfinish),e.removeListener("drain",c),e.removeListener("error",onerror),e.removeListener("unpipe",onunpipe),r.removeListener("end",onend),r.removeListener("end",unpipe),r.removeListener("data",ondata),d=!0,!a.awaitDrain||e._writableState&&!e._writableState.needDrain||c()}())}function onend(){u("onend"),e.end()}a.endEmitted?n.nextTick(s):r.once("end",s),e.on("unpipe",onunpipe);var c=function pipeOnDrain(e){return function pipeOnDrainFunctionResult(){var t=e._readableState;u("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&o(e,"data")&&(t.flowing=!0,flow(e))}}(r);e.on("drain",c);var d=!1;function ondata(t){u("ondata");var n=e.write(t);u("dest.write",n),!1===n&&((1===a.pipesCount&&a.pipes===e||a.pipesCount>1&&-1!==indexOf(a.pipes,e))&&!d&&(u("false write response, pause",a.awaitDrain),a.awaitDrain++),r.pause())}function onerror(t){u("onerror",t),unpipe(),e.removeListener("error",onerror),0===o(e,"error")&&Q(e,t)}function onclose(){e.removeListener("finish",onfinish),unpipe()}function onfinish(){u("onfinish"),e.removeListener("close",onclose),unpipe()}function unpipe(){u("unpipe"),r.unpipe(e)}return r.on("data",ondata),function prependListener(e,t,r){if("function"==typeof e.prependListener)return e.prependListener(t,r);e._events&&e._events[t]?Array.isArray(e._events[t])?e._events[t].unshift(r):e._events[t]=[r,e._events[t]]:e.on(t,r)}(e,"error",onerror),e.once("close",onclose),e.once("finish",onfinish),e.emit("pipe",r),a.flowing||(u("pipe resume"),r.resume()),e},Readable.prototype.unpipe=function(e){var t=this._readableState,r={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes||(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,r)),this;if(!e){var a=t.pipes,n=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var o=0;o0,!1!==a.flowing&&this.resume()):"readable"===e&&(a.endEmitted||a.readableListening||(a.readableListening=a.needReadable=!0,a.flowing=!1,a.emittedReadable=!1,u("on readable",a.length,a.reading),a.length?emitReadable(this):a.reading||n.nextTick(nReadingNextTick,this))),r},Readable.prototype.addListener=Readable.prototype.on,Readable.prototype.removeListener=function(e,t){var r=s.prototype.removeListener.call(this,e,t);return"readable"===e&&n.nextTick(updateReadableListening,this),r},Readable.prototype.removeAllListeners=function(e){var t=s.prototype.removeAllListeners.apply(this,arguments);return"readable"!==e&&void 0!==e||n.nextTick(updateReadableListening,this),t},Readable.prototype.resume=function(){var e=this._readableState;return e.flowing||(u("resume"),e.flowing=!e.readableListening,function resume(e,t){t.resumeScheduled||(t.resumeScheduled=!0,n.nextTick(resume_,e,t))}(this,e)),e.paused=!1,this},Readable.prototype.pause=function(){return u("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(u("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},Readable.prototype.wrap=function(e){var t=this,r=this._readableState,a=!1;for(var n in e.on("end",(function(){if(u("wrapped end"),r.decoder&&!r.ended){var e=r.decoder.end();e&&e.length&&t.push(e)}t.push(null)})),e.on("data",(function(n){(u("wrapped data"),r.decoder&&(n=r.decoder.write(n)),r.objectMode&&null==n)||(r.objectMode||n&&n.length)&&(t.push(n)||(a=!0,e.pause()))})),e)void 0===this[n]&&"function"==typeof e[n]&&(this[n]=function methodWrap(t){return function methodWrapReturnFunction(){return e[t].apply(e,arguments)}}(n));for(var o=0;o{"use strict";var a=r(1);function emitErrorAndCloseNT(e,t){emitErrorNT(e,t),emitCloseNT(e)}function emitCloseNT(e){e._writableState&&!e._writableState.emitClose||e._readableState&&!e._readableState.emitClose||e.emit("close")}function emitErrorNT(e,t){e.emit("error",t)}e.exports={destroy:function destroy(e,t){var r=this,n=this._readableState&&this._readableState.destroyed,o=this._writableState&&this._writableState.destroyed;return n||o?(t?t(e):e&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,a.nextTick(emitErrorNT,this,e)):a.nextTick(emitErrorNT,this,e)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,(function(e){!t&&e?r._writableState?r._writableState.errorEmitted?a.nextTick(emitCloseNT,r):(r._writableState.errorEmitted=!0,a.nextTick(emitErrorAndCloseNT,r,e)):a.nextTick(emitErrorAndCloseNT,r,e):t?(a.nextTick(emitCloseNT,r),t(e)):a.nextTick(emitCloseNT,r)})),this)},undestroy:function undestroy(){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 errorOrDestroy(e,t){var r=e._readableState,a=e._writableState;r&&r.autoDestroy||a&&a.autoDestroy?e.destroy(t):e.emit("error",t)}}},(e,t,r)=>{"use strict";var a=r(249).a.ERR_INVALID_OPT_VALUE;e.exports={getHighWaterMark:function getHighWaterMark(e,t,r,n){var o=function highWaterMarkFrom(e,t,r){return null!=e.highWaterMark?e.highWaterMark:t?e[r]:null}(t,n,r);if(null!=o){if(!isFinite(o)||Math.floor(o)!==o||o<0)throw new a(n?r:"highWaterMark",o);return Math.floor(o)}return e.objectMode?16:16384}}},(e,t,r)=>{"use strict";var a,n=r(1);function CorkedRequest(e){var t=this;this.next=null,this.entry=null,this.finish=function(){!function onCorkedFinish(e,t,r){var a=e.entry;e.entry=null;for(;a;){var n=a.callback;t.pendingcb--,n(r),a=a.next}t.corkedRequestsFree.next=e}(t,e)}}e.exports=Writable,Writable.WritableState=WritableState;var o={deprecate:r(1030)},s=r(1028),c=r(2).Buffer,d=r.g.Uint8Array||function(){};var u,h=r(607),l=r(608).getHighWaterMark,b=r(249).a,g=b.ERR_INVALID_ARG_TYPE,p=b.ERR_METHOD_NOT_IMPLEMENTED,B=b.ERR_MULTIPLE_CALLBACK,m=b.ERR_STREAM_CANNOT_PIPE,I=b.ERR_STREAM_DESTROYED,y=b.ERR_STREAM_NULL_VALUES,v=b.ERR_STREAM_WRITE_AFTER_END,x=b.ERR_UNKNOWN_ENCODING,C=h.errorOrDestroy;function nop(){}function WritableState(e,t,o){a=a||r(208),e=e||{},"boolean"!=typeof o&&(o=t instanceof a),this.objectMode=!!e.objectMode,o&&(this.objectMode=this.objectMode||!!e.writableObjectMode),this.highWaterMark=l(this,e,"writableHighWaterMark",o),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var s=!1===e.decodeStrings;this.decodeStrings=!s,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 onwrite(e,t){var r=e._writableState,a=r.sync,o=r.writecb;if("function"!=typeof o)throw new B;if(function onwriteStateUpdate(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}(r),t)!function onwriteError(e,t,r,a,o){--t.pendingcb,r?(n.nextTick(o,a),n.nextTick(finishMaybe,e,t),e._writableState.errorEmitted=!0,C(e,a)):(o(a),e._writableState.errorEmitted=!0,C(e,a),finishMaybe(e,t))}(e,r,a,t,o);else{var s=needFinish(r)||e.destroyed;s||r.corked||r.bufferProcessing||!r.bufferedRequest||clearBuffer(e,r),a?n.nextTick(afterWrite,e,r,s,o):afterWrite(e,r,s,o)}}(t,e)},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 CorkedRequest(this)}function Writable(e){var t=this instanceof(a=a||r(208));if(!t&&!u.call(Writable,this))return new Writable(e);this._writableState=new WritableState(e,this,t),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),s.call(this)}function doWrite(e,t,r,a,n,o,s){t.writelen=a,t.writecb=s,t.writing=!0,t.sync=!0,t.destroyed?t.onwrite(new I("write")):r?e._writev(n,t.onwrite):e._write(n,o,t.onwrite),t.sync=!1}function afterWrite(e,t,r,a){r||function onwriteDrain(e,t){0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}(e,t),t.pendingcb--,a(),finishMaybe(e,t)}function clearBuffer(e,t){t.bufferProcessing=!0;var r=t.bufferedRequest;if(e._writev&&r&&r.next){var a=t.bufferedRequestCount,n=new Array(a),o=t.corkedRequestsFree;o.entry=r;for(var s=0,c=!0;r;)n[s]=r,r.isBuf||(c=!1),r=r.next,s+=1;n.allBuffers=c,doWrite(e,t,!0,t.length,n,"",o.finish),t.pendingcb++,t.lastBufferedRequest=null,o.next?(t.corkedRequestsFree=o.next,o.next=null):t.corkedRequestsFree=new CorkedRequest(t),t.bufferedRequestCount=0}else{for(;r;){var d=r.chunk,u=r.encoding,h=r.callback;if(doWrite(e,t,!1,t.objectMode?1:d.length,d,u,h),r=r.next,t.bufferedRequestCount--,t.writing)break}null===r&&(t.lastBufferedRequest=null)}t.bufferedRequest=r,t.bufferProcessing=!1}function needFinish(e){return e.ending&&0===e.length&&null===e.bufferedRequest&&!e.finished&&!e.writing}function callFinal(e,t){e._final((function(r){t.pendingcb--,r&&C(e,r),t.prefinished=!0,e.emit("prefinish"),finishMaybe(e,t)}))}function finishMaybe(e,t){var r=needFinish(t);if(r&&(function prefinish(e,t){t.prefinished||t.finalCalled||("function"!=typeof e._final||t.destroyed?(t.prefinished=!0,e.emit("prefinish")):(t.pendingcb++,t.finalCalled=!0,n.nextTick(callFinal,e,t)))}(e,t),0===t.pendingcb&&(t.finished=!0,e.emit("finish"),t.autoDestroy))){var a=e._readableState;(!a||a.autoDestroy&&a.endEmitted)&&e.destroy()}return r}r(38)(Writable,s),WritableState.prototype.getBuffer=function getBuffer(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},function(){try{Object.defineProperty(WritableState.prototype,"buffer",{get:o.deprecate((function writableStateBufferGetter(){return this.getBuffer()}),"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(e){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(u=Function.prototype[Symbol.hasInstance],Object.defineProperty(Writable,Symbol.hasInstance,{value:function value(e){return!!u.call(this,e)||this===Writable&&(e&&e._writableState instanceof WritableState)}})):u=function realHasInstance(e){return e instanceof this},Writable.prototype.pipe=function(){C(this,new m)},Writable.prototype.write=function(e,t,r){var a=this._writableState,o=!1,s=!a.objectMode&&function _isUint8Array(e){return c.isBuffer(e)||e instanceof d}(e);return s&&!c.isBuffer(e)&&(e=function _uint8ArrayToBuffer(e){return c.from(e)}(e)),"function"==typeof t&&(r=t,t=null),s?t="buffer":t||(t=a.defaultEncoding),"function"!=typeof r&&(r=nop),a.ending?function writeAfterEnd(e,t){var r=new v;C(e,r),n.nextTick(t,r)}(this,r):(s||function validChunk(e,t,r,a){var o;return null===r?o=new y:"string"==typeof r||t.objectMode||(o=new g("chunk",["string","Buffer"],r)),!o||(C(e,o),n.nextTick(a,o),!1)}(this,a,e,r))&&(a.pendingcb++,o=function writeOrBuffer(e,t,r,a,n,o){if(!r){var s=function decodeChunk(e,t,r){e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=c.from(t,r));return t}(t,a,n);a!==s&&(r=!0,n="buffer",a=s)}var d=t.objectMode?1:a.length;t.length+=d;var u=t.length-1))throw new x(e);return this._writableState.defaultEncoding=e,this},Object.defineProperty(Writable.prototype,"writableBuffer",{enumerable:!1,get:function get(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(Writable.prototype,"writableHighWaterMark",{enumerable:!1,get:function get(){return this._writableState.highWaterMark}}),Writable.prototype._write=function(e,t,r){r(new p("_write()"))},Writable.prototype._writev=null,Writable.prototype.end=function(e,t,r){var a=this._writableState;return"function"==typeof e?(r=e,e=null,t=null):"function"==typeof t&&(r=t,t=null),null!=e&&this.write(e,t),a.corked&&(a.corked=1,this.uncork()),a.ending||function endWritable(e,t,r){t.ending=!0,finishMaybe(e,t),r&&(t.finished?n.nextTick(r):e.once("finish",r));t.ended=!0,e.writable=!1}(this,a,r),this},Object.defineProperty(Writable.prototype,"writableLength",{enumerable:!1,get:function get(){return this._writableState.length}}),Object.defineProperty(Writable.prototype,"destroyed",{enumerable:!1,get:function get(){return void 0!==this._writableState&&this._writableState.destroyed},set:function set(e){this._writableState&&(this._writableState.destroyed=e)}}),Writable.prototype.destroy=h.destroy,Writable.prototype._undestroy=h.undestroy,Writable.prototype._destroy=function(e,t){t(e)}},(e,t,r)=>{"use strict";var a=r(43).Buffer,n=a.isEncoding||function(e){switch((e=""+e)&&e.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 StringDecoder(e){var t;switch(this.encoding=function normalizeEncoding(e){var t=function _normalizeEncoding(e){if(!e)return"utf8";for(var t;;)switch(e){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 e;default:if(t)return;e=(""+e).toLowerCase(),t=!0}}(e);if("string"!=typeof t&&(a.isEncoding===n||!n(e)))throw new Error("Unknown encoding: "+e);return t||e}(e),this.encoding){case"utf16le":this.text=utf16Text,this.end=utf16End,t=4;break;case"utf8":this.fillLast=utf8FillLast,t=4;break;case"base64":this.text=base64Text,this.end=base64End,t=3;break;default:return this.write=simpleWrite,void(this.end=simpleEnd)}this.lastNeed=0,this.lastTotal=0,this.lastChar=a.allocUnsafe(t)}function utf8CheckByte(e){return e<=127?0:e>>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function utf8FillLast(e){var t=this.lastTotal-this.lastNeed,r=function utf8CheckExtraBytes(e,t,r){if(128!=(192&t[0]))return e.lastNeed=0,"�";if(e.lastNeed>1&&t.length>1){if(128!=(192&t[1]))return e.lastNeed=1,"�";if(e.lastNeed>2&&t.length>2&&128!=(192&t[2]))return e.lastNeed=2,"�"}}(this,e);return void 0!==r?r:this.lastNeed<=e.length?(e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(e.copy(this.lastChar,t,0,e.length),void(this.lastNeed-=e.length))}function utf16Text(e,t){if((e.length-t)%2==0){var r=e.toString("utf16le",t);if(r){var a=r.charCodeAt(r.length-1);if(a>=55296&&a<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",t,e.length-1)}function utf16End(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return t+this.lastChar.toString("utf16le",0,r)}return t}function base64Text(e,t){var r=(e.length-t)%3;return 0===r?e.toString("base64",t):(this.lastNeed=3-r,this.lastTotal=3,1===r?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString("base64",t,e.length-r))}function base64End(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function simpleWrite(e){return e.toString(this.encoding)}function simpleEnd(e){return e&&e.length?this.write(e):""}t.a=StringDecoder,StringDecoder.prototype.write=function(e){if(0===e.length)return"";var t,r;if(this.lastNeed){if(void 0===(t=this.fillLast(e)))return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r=0)return n>0&&(e.lastNeed=n-1),n;if(--a=0)return n>0&&(e.lastNeed=n-2),n;if(--a=0)return n>0&&(2===n?n=0:e.lastNeed=n-3),n;return 0}(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=r;var a=e.length-(r-this.lastNeed);return e.copy(this.lastChar,0,a),e.toString("utf8",t,a)},StringDecoder.prototype.fillLast=function(e){if(this.lastNeed<=e.length)return e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,e.length),this.lastNeed-=e.length}},(e,t,r)=>{"use strict";e.exports=Transform;var a=r(249).a,n=a.ERR_METHOD_NOT_IMPLEMENTED,o=a.ERR_MULTIPLE_CALLBACK,s=a.ERR_TRANSFORM_ALREADY_TRANSFORMING,c=a.ERR_TRANSFORM_WITH_LENGTH_0,d=r(208);function afterTransform(e,t){var r=this._transformState;r.transforming=!1;var a=r.writecb;if(null===a)return this.emit("error",new o);r.writechunk=null,r.writecb=null,null!=t&&this.push(t),a(e);var n=this._readableState;n.reading=!1,(n.needReadable||n.length{"use strict";var a=r(2).Buffer,n=r(38),o=r(605),s=new Array(16),c=[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],d=[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],u=[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],h=[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],l=[0,1518500249,1859775393,2400959708,2840853838],b=[1352829926,1548603684,1836072691,2053994217,0];function RIPEMD160(){o.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520}function rotl(e,t){return e<>>32-t}function fn1(e,t,r,a,n,o,s,c){return rotl(e+(t^r^a)+o+s|0,c)+n|0}function fn2(e,t,r,a,n,o,s,c){return rotl(e+(t&r|~t&a)+o+s|0,c)+n|0}function fn3(e,t,r,a,n,o,s,c){return rotl(e+((t|~r)^a)+o+s|0,c)+n|0}function fn4(e,t,r,a,n,o,s,c){return rotl(e+(t&a|r&~a)+o+s|0,c)+n|0}function fn5(e,t,r,a,n,o,s,c){return rotl(e+(t^(r|~a))+o+s|0,c)+n|0}n(RIPEMD160,o),RIPEMD160.prototype._update=function(){for(var e=s,t=0;t<16;++t)e[t]=this._block.readInt32LE(4*t);for(var r=0|this._a,a=0|this._b,n=0|this._c,o=0|this._d,g=0|this._e,p=0|this._a,B=0|this._b,m=0|this._c,I=0|this._d,y=0|this._e,v=0;v<80;v+=1){var x,C;v<16?(x=fn1(r,a,n,o,g,e[c[v]],l[0],u[v]),C=fn5(p,B,m,I,y,e[d[v]],b[0],h[v])):v<32?(x=fn2(r,a,n,o,g,e[c[v]],l[1],u[v]),C=fn4(p,B,m,I,y,e[d[v]],b[1],h[v])):v<48?(x=fn3(r,a,n,o,g,e[c[v]],l[2],u[v]),C=fn3(p,B,m,I,y,e[d[v]],b[2],h[v])):v<64?(x=fn4(r,a,n,o,g,e[c[v]],l[3],u[v]),C=fn2(p,B,m,I,y,e[d[v]],b[3],h[v])):(x=fn5(r,a,n,o,g,e[c[v]],l[4],u[v]),C=fn1(p,B,m,I,y,e[d[v]],b[4],h[v])),r=g,g=o,o=rotl(n,10),n=a,a=x,p=y,y=I,I=rotl(m,10),m=B,B=C}var Q=this._b+n+I|0;this._b=this._c+o+y|0,this._c=this._d+g+p|0,this._d=this._e+r+B|0,this._e=this._a+a+m|0,this._a=Q},RIPEMD160.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 e=a.alloc?a.alloc(20):new a(20);return e.writeInt32LE(this._a,0),e.writeInt32LE(this._b,4),e.writeInt32LE(this._c,8),e.writeInt32LE(this._d,12),e.writeInt32LE(this._e,16),e},e.exports=RIPEMD160},(e,t,r)=>{var a=e.exports=function SHA(e){e=e.toLowerCase();var t=a[e];if(!t)throw new Error(e+" is not supported (we accept pull requests)");return new t};a.sha=r(1035),a.sha1=r(1036),a.sha224=r(1037),a.sha256=r(614),a.sha384=r(1038),a.sha512=r(615)},(e,t,r)=>{var a=r(38),n=r(209),o=r(43).Buffer,s=[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],c=new Array(64);function Sha256(){this.init(),this._w=c,n.call(this,64,56)}function ch(e,t,r){return r^e&(t^r)}function maj(e,t,r){return e&t|r&(e|t)}function sigma0(e){return(e>>>2|e<<30)^(e>>>13|e<<19)^(e>>>22|e<<10)}function sigma1(e){return(e>>>6|e<<26)^(e>>>11|e<<21)^(e>>>25|e<<7)}function gamma0(e){return(e>>>7|e<<25)^(e>>>18|e<<14)^e>>>3}a(Sha256,n),Sha256.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},Sha256.prototype._update=function(e){for(var t,r=this._w,a=0|this._a,n=0|this._b,o=0|this._c,c=0|this._d,d=0|this._e,u=0|this._f,h=0|this._g,l=0|this._h,b=0;b<16;++b)r[b]=e.readInt32BE(4*b);for(;b<64;++b)r[b]=0|(((t=r[b-2])>>>17|t<<15)^(t>>>19|t<<13)^t>>>10)+r[b-7]+gamma0(r[b-15])+r[b-16];for(var g=0;g<64;++g){var p=l+sigma1(d)+ch(d,u,h)+s[g]+r[g]|0,B=sigma0(a)+maj(a,n,o)|0;l=h,h=u,u=d,d=c+p|0,c=o,o=n,n=a,a=p+B|0}this._a=a+this._a|0,this._b=n+this._b|0,this._c=o+this._c|0,this._d=c+this._d|0,this._e=d+this._e|0,this._f=u+this._f|0,this._g=h+this._g|0,this._h=l+this._h|0},Sha256.prototype._hash=function(){var e=o.allocUnsafe(32);return e.writeInt32BE(this._a,0),e.writeInt32BE(this._b,4),e.writeInt32BE(this._c,8),e.writeInt32BE(this._d,12),e.writeInt32BE(this._e,16),e.writeInt32BE(this._f,20),e.writeInt32BE(this._g,24),e.writeInt32BE(this._h,28),e},e.exports=Sha256},(e,t,r)=>{var a=r(38),n=r(209),o=r(43).Buffer,s=[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],c=new Array(160);function Sha512(){this.init(),this._w=c,n.call(this,128,112)}function Ch(e,t,r){return r^e&(t^r)}function maj(e,t,r){return e&t|r&(e|t)}function sigma0(e,t){return(e>>>28|t<<4)^(t>>>2|e<<30)^(t>>>7|e<<25)}function sigma1(e,t){return(e>>>14|t<<18)^(e>>>18|t<<14)^(t>>>9|e<<23)}function Gamma0(e,t){return(e>>>1|t<<31)^(e>>>8|t<<24)^e>>>7}function Gamma0l(e,t){return(e>>>1|t<<31)^(e>>>8|t<<24)^(e>>>7|t<<25)}function Gamma1(e,t){return(e>>>19|t<<13)^(t>>>29|e<<3)^e>>>6}function Gamma1l(e,t){return(e>>>19|t<<13)^(t>>>29|e<<3)^(e>>>6|t<<26)}function getCarry(e,t){return e>>>0>>0?1:0}a(Sha512,n),Sha512.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},Sha512.prototype._update=function(e){for(var t=this._w,r=0|this._ah,a=0|this._bh,n=0|this._ch,o=0|this._dh,c=0|this._eh,d=0|this._fh,u=0|this._gh,h=0|this._hh,l=0|this._al,b=0|this._bl,g=0|this._cl,p=0|this._dl,B=0|this._el,m=0|this._fl,I=0|this._gl,y=0|this._hl,v=0;v<32;v+=2)t[v]=e.readInt32BE(4*v),t[v+1]=e.readInt32BE(4*v+4);for(;v<160;v+=2){var x=t[v-30],C=t[v-30+1],Q=Gamma0(x,C),w=Gamma0l(C,x),_=Gamma1(x=t[v-4],C=t[v-4+1]),k=Gamma1l(C,x),N=t[v-14],D=t[v-14+1],U=t[v-32],G=t[v-32+1],T=w+D|0,L=Q+N+getCarry(T,w)|0;L=(L=L+_+getCarry(T=T+k|0,k)|0)+U+getCarry(T=T+G|0,G)|0,t[v]=L,t[v+1]=T}for(var P=0;P<160;P+=2){L=t[P],T=t[P+1];var q=maj(r,a,n),O=maj(l,b,g),H=sigma0(r,l),Y=sigma0(l,r),j=sigma1(c,B),J=sigma1(B,c),z=s[P],W=s[P+1],V=Ch(c,d,u),X=Ch(B,m,I),$=y+J|0,et=h+j+getCarry($,y)|0;et=(et=(et=et+V+getCarry($=$+X|0,X)|0)+z+getCarry($=$+W|0,W)|0)+L+getCarry($=$+T|0,T)|0;var tt=Y+O|0,rt=H+q+getCarry(tt,Y)|0;h=u,y=I,u=d,I=m,d=c,m=B,c=o+et+getCarry(B=p+$|0,p)|0,o=n,p=g,n=a,g=b,a=r,b=l,r=et+rt+getCarry(l=$+tt|0,$)|0}this._al=this._al+l|0,this._bl=this._bl+b|0,this._cl=this._cl+g|0,this._dl=this._dl+p|0,this._el=this._el+B|0,this._fl=this._fl+m|0,this._gl=this._gl+I|0,this._hl=this._hl+y|0,this._ah=this._ah+r+getCarry(this._al,l)|0,this._bh=this._bh+a+getCarry(this._bl,b)|0,this._ch=this._ch+n+getCarry(this._cl,g)|0,this._dh=this._dh+o+getCarry(this._dl,p)|0,this._eh=this._eh+c+getCarry(this._el,B)|0,this._fh=this._fh+d+getCarry(this._fl,m)|0,this._gh=this._gh+u+getCarry(this._gl,I)|0,this._hh=this._hh+h+getCarry(this._hl,y)|0},Sha512.prototype._hash=function(){var e=o.allocUnsafe(64);function writeInt64BE(t,r,a){e.writeInt32BE(t,a),e.writeInt32BE(r,a+4)}return writeInt64BE(this._ah,this._al,0),writeInt64BE(this._bh,this._bl,8),writeInt64BE(this._ch,this._cl,16),writeInt64BE(this._dh,this._dl,24),writeInt64BE(this._eh,this._el,32),writeInt64BE(this._fh,this._fl,40),writeInt64BE(this._gh,this._gl,48),writeInt64BE(this._hh,this._hl,56),e},e.exports=Sha512},e=>{var t=Math.pow(2,30)-1;e.exports=function(e,r){if("number"!=typeof e)throw new TypeError("Iterations not a number");if(e<0)throw new TypeError("Bad iterations");if("number"!=typeof r)throw new TypeError("Key length not a number");if(r<0||r>t||r!=r)throw new TypeError("Bad key length")}},(e,t,r)=>{var a,n=r(1);if(r.g.process&&r.g.process.browser)a="utf-8";else if(r.g.process&&r.g.process.version){a=parseInt(n.version.split(".")[0].slice(1),10)>=6?"utf-8":"binary"}else a="utf-8";e.exports=a},(e,t,r)=>{var a=r(1041),n=r(612),o=r(613),s=r(43).Buffer,c=r(616),d=r(617),u=r(619),h=s.alloc(128),l={md5:16,sha1:20,sha224:28,sha256:32,sha384:48,sha512:64,rmd160:20,ripemd160:20};function Hmac(e,t,r){var c=function getDigest(e){function shaFunc(t){return o(e).update(t).digest()}function rmd160Func(e){return(new n).update(e).digest()}return"rmd160"===e||"ripemd160"===e?rmd160Func:"md5"===e?a:shaFunc}(e),d="sha512"===e||"sha384"===e?128:64;t.length>d?t=c(t):t.length{var a=r(43).Buffer;e.exports=function(e,t,r){if(a.isBuffer(e))return e;if("string"==typeof e)return a.from(e,t);if(ArrayBuffer.isView(e))return a.from(e.buffer);throw new TypeError(r+" must be a string, a Buffer, a typed array or a DataView")}},(e,t,r)=>{"use strict";var a=r(1),n=65536,o=4294967295;var s=r(43).Buffer,c=r.g.crypto||r.g.msCrypto;c&&c.getRandomValues?e.exports=function randomBytes(e,t){if(e>o)throw new RangeError("requested too many random bytes");var r=s.allocUnsafe(e);if(e>0)if(e>n)for(var d=0;d{e.exports=function extend(){for(var e={},r=0;r{var a=r(623);function AbstractIterator(e){if("object"!=typeof e||null===e)throw new TypeError("First argument must be an abstract-leveldown compliant store");this.db=e,this._ended=!1,this._nexting=!1}AbstractIterator.prototype.next=function(e){var t=this;if("function"!=typeof e)throw new Error("next() requires a callback argument");return t._ended?(a(e,new Error("cannot call next() after end()")),t):t._nexting?(a(e,new Error("cannot call next() before previous next() has completed")),t):(t._nexting=!0,t._next((function(){t._nexting=!1,e.apply(null,arguments)})),t)},AbstractIterator.prototype._next=function(e){a(e)},AbstractIterator.prototype.seek=function(e){if(this._ended)throw new Error("cannot call seek() after end()");if(this._nexting)throw new Error("cannot call seek() before next() has completed");e=this.db._serializeKey(e),this._seek(e)},AbstractIterator.prototype._seek=function(e){},AbstractIterator.prototype.end=function(e){if("function"!=typeof e)throw new Error("end() requires a callback argument");if(this._ended)return a(e,new Error("end() already called on iterator"));this._ended=!0,this._end(e)},AbstractIterator.prototype._end=function(e){a(e)},AbstractIterator.prototype._nextTick=a,e.exports=AbstractIterator},(e,t,r)=>{e.exports=r(1050)},(e,t,r)=>{var a=r(623);function AbstractChainedBatch(e){if("object"!=typeof e||null===e)throw new TypeError("First argument must be an abstract-leveldown compliant store");this.db=e,this._operations=[],this._written=!1}AbstractChainedBatch.prototype._checkWritten=function(){if(this._written)throw new Error("write() already called on this batch")},AbstractChainedBatch.prototype.put=function(e,t){this._checkWritten();var r=this.db._checkKey(e)||this.db._checkValue(t);if(r)throw r;return e=this.db._serializeKey(e),t=this.db._serializeValue(t),this._put(e,t),this},AbstractChainedBatch.prototype._put=function(e,t){this._operations.push({type:"put",key:e,value:t})},AbstractChainedBatch.prototype.del=function(e){this._checkWritten();var t=this.db._checkKey(e);if(t)throw t;return e=this.db._serializeKey(e),this._del(e),this},AbstractChainedBatch.prototype._del=function(e){this._operations.push({type:"del",key:e})},AbstractChainedBatch.prototype.clear=function(){return this._checkWritten(),this._clear(),this},AbstractChainedBatch.prototype._clear=function(){this._operations=[]},AbstractChainedBatch.prototype.write=function(e,t){if(this._checkWritten(),"function"==typeof e&&(t=e),"function"!=typeof t)throw new Error("write() requires a callback argument");"object"==typeof e&&null!==e||(e={}),this._written=!0,this._write(e,t)},AbstractChainedBatch.prototype._write=function(e,t){this.db._batch(this._operations,e,t)},AbstractChainedBatch.prototype._nextTick=a,e.exports=AbstractChainedBatch},(e,t,r)=>{"use strict";var a=r(288),n={};e.exports=function createKeyRange(e){var t=a.lowerBound(e,n),r=a.upperBound(e,n),o=a.lowerBoundExclusive(e,n),s=a.upperBoundExclusive(e,n);return t!==n&&r!==n?IDBKeyRange.bound(t,r,o,s):t!==n?IDBKeyRange.lowerBound(t,o):r!==n?IDBKeyRange.upperBound(r,s):null}},(e,t,r)=>{"use strict";var a=r(385).a,n=function(){if(r.g.TextDecoder){var e=new TextDecoder("utf-8");return e.decode.bind(e)}return function ta2str(e){return ta2buf(e).toString()}}(),o=function(){if(r.g.TextDecoder){var e=new TextDecoder("utf-8");return e.decode.bind(e)}return function ab2str(e){return a.from(e).toString()}}();function ta2buf(e){var t=a.from(e.buffer);return e.byteLength===e.buffer.byteLength?t:t.slice(e.byteOffset,e.byteOffset+e.byteLength)}e.exports=function(e,t){return e instanceof Uint8Array?t?ta2buf(e):n(e):e instanceof ArrayBuffer?t?a.from(e):o(e):t?a.from(String(e)):String(e)}},function(e,t,r){!function(e,t){"use strict";function assert(e,t){if(!e)throw new Error(t||"Assertion failed")}function inherits(e,t){e.super_=t;var TempCtor=function(){};TempCtor.prototype=t.prototype,e.prototype=new TempCtor,e.prototype.constructor=e}function BN(e,t,r){if(BN.isBN(e))return e;this.negative=0,this.words=null,this.length=0,this.red=null,null!==e&&("le"!==t&&"be"!==t||(r=t,t=10),this._init(e||0,t||10,r||"be"))}var a;"object"==typeof e?e.exports=BN:t.BN=BN,BN.BN=BN,BN.wordSize=26;try{a="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:r(17).Buffer}catch(e){}function parseHex4Bits(e,t){var r=e.charCodeAt(t);return r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:r-48&15}function parseHexByte(e,t,r){var a=parseHex4Bits(e,r);return r-1>=t&&(a|=parseHex4Bits(e,r-1)<<4),a}function parseBase(e,t,r,a){for(var n=0,o=Math.min(e.length,r),s=t;s=49?c-49+10:c>=17?c-17+10:c}return n}BN.isBN=function isBN(e){return e instanceof BN||null!==e&&"object"==typeof e&&e.constructor.wordSize===BN.wordSize&&Array.isArray(e.words)},BN.max=function max(e,t){return e.cmp(t)>0?e:t},BN.min=function min(e,t){return e.cmp(t)<0?e:t},BN.prototype._init=function init(e,t,r){if("number"==typeof e)return this._initNumber(e,t,r);if("object"==typeof e)return this._initArray(e,t,r);"hex"===t&&(t=16),assert(t===(0|t)&&t>=2&&t<=36);var a=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&(a++,this.negative=1),a=0;a-=3)o=e[a]|e[a-1]<<8|e[a-2]<<16,this.words[n]|=o<>>26-s&67108863,(s+=24)>=26&&(s-=26,n++);else if("le"===r)for(a=0,n=0;a>>26-s&67108863,(s+=24)>=26&&(s-=26,n++);return this.strip()},BN.prototype._parseHex=function _parseHex(e,t,r){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var a=0;a=t;a-=2)n=parseHexByte(e,t,a)<=18?(o-=18,s+=1,this.words[s]|=n>>>26):o+=8;else for(a=(e.length-t)%2==0?t+1:t;a=18?(o-=18,s+=1,this.words[s]|=n>>>26):o+=8;this.strip()},BN.prototype._parseBase=function _parseBase(e,t,r){this.words=[0],this.length=1;for(var a=0,n=1;n<=67108863;n*=t)a++;a--,n=n/t|0;for(var o=e.length-r,s=o%a,c=Math.min(o,o-s)+r,d=0,u=r;u1&&0===this.words[this.length-1];)this.length--;return this._normSign()},BN.prototype._normSign=function _normSign(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},BN.prototype.inspect=function inspect(){return(this.red?""};var n=["","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"],o=[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],s=[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 smallMulTo(e,t,r){r.negative=t.negative^e.negative;var a=e.length+t.length|0;r.length=a,a=a-1|0;var n=0|e.words[0],o=0|t.words[0],s=n*o,c=67108863&s,d=s/67108864|0;r.words[0]=c;for(var u=1;u>>26,l=67108863&d,b=Math.min(u,t.length-1),g=Math.max(0,u-e.length+1);g<=b;g++){var p=u-g|0;h+=(s=(n=0|e.words[p])*(o=0|t.words[g])+l)/67108864|0,l=67108863&s}r.words[u]=0|l,d=0|h}return 0!==d?r.words[u]=0|d:r.length--,r.strip()}BN.prototype.toString=function toString(e,t){var r;if(t=0|t||1,16===(e=e||10)||"hex"===e){r="";for(var a=0,c=0,d=0;d>>24-a&16777215)||d!==this.length-1?n[6-h.length]+h+r:h+r,(a+=2)>=26&&(a-=26,d--)}for(0!==c&&(r=c.toString(16)+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(e===(0|e)&&e>=2&&e<=36){var l=o[e],b=s[e];r="";var g=this.clone();for(g.negative=0;!g.isZero();){var p=g.modn(b).toString(e);r=(g=g.idivn(b)).isZero()?p+r:n[l-p.length]+p+r}for(this.isZero()&&(r="0"+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}assert(!1,"Base should be between 2 and 36")},BN.prototype.toNumber=function toNumber(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&assert(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},BN.prototype.toJSON=function toJSON(){return this.toString(16)},BN.prototype.toBuffer=function toBuffer(e,t){return assert(void 0!==a),this.toArrayLike(a,e,t)},BN.prototype.toArray=function toArray(e,t){return this.toArrayLike(Array,e,t)},BN.prototype.toArrayLike=function toArrayLike(e,t,r){var a=this.byteLength(),n=r||Math.max(1,a);assert(a<=n,"byte array longer than desired length"),assert(n>0,"Requested array length <= 0"),this.strip();var o,s,c="le"===t,d=new e(n),u=this.clone();if(c){for(s=0;!u.isZero();s++)o=u.andln(255),u.iushrn(8),d[s]=o;for(;s=4096&&(r+=13,t>>>=13),t>=64&&(r+=7,t>>>=7),t>=8&&(r+=4,t>>>=4),t>=2&&(r+=2,t>>>=2),r+t},BN.prototype._zeroBits=function _zeroBits(e){if(0===e)return 26;var t=e,r=0;return 0==(8191&t)&&(r+=13,t>>>=13),0==(127&t)&&(r+=7,t>>>=7),0==(15&t)&&(r+=4,t>>>=4),0==(3&t)&&(r+=2,t>>>=2),0==(1&t)&&r++,r},BN.prototype.bitLength=function bitLength(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},BN.prototype.zeroBits=function zeroBits(){if(this.isZero())return 0;for(var e=0,t=0;te.length?this.clone().ior(e):e.clone().ior(this)},BN.prototype.uor=function uor(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},BN.prototype.iuand=function iuand(e){var t;t=this.length>e.length?e:this;for(var r=0;re.length?this.clone().iand(e):e.clone().iand(this)},BN.prototype.uand=function uand(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},BN.prototype.iuxor=function iuxor(e){var t,r;this.length>e.length?(t=this,r=e):(t=e,r=this);for(var a=0;ae.length?this.clone().ixor(e):e.clone().ixor(this)},BN.prototype.uxor=function uxor(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},BN.prototype.inotn=function inotn(e){assert("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),r=e%26;this._expand(t),r>0&&t--;for(var a=0;a0&&(this.words[a]=~this.words[a]&67108863>>26-r),this.strip()},BN.prototype.notn=function notn(e){return this.clone().inotn(e)},BN.prototype.setn=function setn(e,t){assert("number"==typeof e&&e>=0);var r=e/26|0,a=e%26;return this._expand(r+1),this.words[r]=t?this.words[r]|1<e.length?(r=this,a=e):(r=e,a=this);for(var n=0,o=0;o>>26;for(;0!==n&&o>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;oe.length?this.clone().iadd(e):e.clone().iadd(this)},BN.prototype.isub=function isub(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var r,a,n=this.cmp(e);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,a=e):(r=e,a=this);for(var o=0,s=0;s>26,this.words[s]=67108863&t;for(;0!==o&&s>26,this.words[s]=67108863&t;if(0===o&&s>>13,g=0|s[1],p=8191&g,B=g>>>13,m=0|s[2],I=8191&m,y=m>>>13,v=0|s[3],x=8191&v,C=v>>>13,Q=0|s[4],w=8191&Q,_=Q>>>13,k=0|s[5],N=8191&k,D=k>>>13,U=0|s[6],G=8191&U,T=U>>>13,L=0|s[7],P=8191&L,q=L>>>13,O=0|s[8],H=8191&O,Y=O>>>13,j=0|s[9],J=8191&j,z=j>>>13,W=0|c[0],V=8191&W,X=W>>>13,$=0|c[1],et=8191&$,tt=$>>>13,rt=0|c[2],at=8191&rt,it=rt>>>13,nt=0|c[3],ot=8191&nt,At=nt>>>13,st=0|c[4],ct=8191&st,dt=st>>>13,ut=0|c[5],ht=8191&ut,bt=ut>>>13,pt=0|c[6],Bt=8191&pt,mt=pt>>>13,It=0|c[7],Et=8191&It,yt=It>>>13,vt=0|c[8],xt=8191&vt,Ct=vt>>>13,Qt=0|c[9],wt=8191&Qt,Mt=Qt>>>13;r.negative=e.negative^t.negative,r.length=19;var _t=(u+(a=Math.imul(l,V))|0)+((8191&(n=(n=Math.imul(l,X))+Math.imul(b,V)|0))<<13)|0;u=((o=Math.imul(b,X))+(n>>>13)|0)+(_t>>>26)|0,_t&=67108863,a=Math.imul(p,V),n=(n=Math.imul(p,X))+Math.imul(B,V)|0,o=Math.imul(B,X);var kt=(u+(a=a+Math.imul(l,et)|0)|0)+((8191&(n=(n=n+Math.imul(l,tt)|0)+Math.imul(b,et)|0))<<13)|0;u=((o=o+Math.imul(b,tt)|0)+(n>>>13)|0)+(kt>>>26)|0,kt&=67108863,a=Math.imul(I,V),n=(n=Math.imul(I,X))+Math.imul(y,V)|0,o=Math.imul(y,X),a=a+Math.imul(p,et)|0,n=(n=n+Math.imul(p,tt)|0)+Math.imul(B,et)|0,o=o+Math.imul(B,tt)|0;var St=(u+(a=a+Math.imul(l,at)|0)|0)+((8191&(n=(n=n+Math.imul(l,it)|0)+Math.imul(b,at)|0))<<13)|0;u=((o=o+Math.imul(b,it)|0)+(n>>>13)|0)+(St>>>26)|0,St&=67108863,a=Math.imul(x,V),n=(n=Math.imul(x,X))+Math.imul(C,V)|0,o=Math.imul(C,X),a=a+Math.imul(I,et)|0,n=(n=n+Math.imul(I,tt)|0)+Math.imul(y,et)|0,o=o+Math.imul(y,tt)|0,a=a+Math.imul(p,at)|0,n=(n=n+Math.imul(p,it)|0)+Math.imul(B,at)|0,o=o+Math.imul(B,it)|0;var Nt=(u+(a=a+Math.imul(l,ot)|0)|0)+((8191&(n=(n=n+Math.imul(l,At)|0)+Math.imul(b,ot)|0))<<13)|0;u=((o=o+Math.imul(b,At)|0)+(n>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,a=Math.imul(w,V),n=(n=Math.imul(w,X))+Math.imul(_,V)|0,o=Math.imul(_,X),a=a+Math.imul(x,et)|0,n=(n=n+Math.imul(x,tt)|0)+Math.imul(C,et)|0,o=o+Math.imul(C,tt)|0,a=a+Math.imul(I,at)|0,n=(n=n+Math.imul(I,it)|0)+Math.imul(y,at)|0,o=o+Math.imul(y,it)|0,a=a+Math.imul(p,ot)|0,n=(n=n+Math.imul(p,At)|0)+Math.imul(B,ot)|0,o=o+Math.imul(B,At)|0;var Dt=(u+(a=a+Math.imul(l,ct)|0)|0)+((8191&(n=(n=n+Math.imul(l,dt)|0)+Math.imul(b,ct)|0))<<13)|0;u=((o=o+Math.imul(b,dt)|0)+(n>>>13)|0)+(Dt>>>26)|0,Dt&=67108863,a=Math.imul(N,V),n=(n=Math.imul(N,X))+Math.imul(D,V)|0,o=Math.imul(D,X),a=a+Math.imul(w,et)|0,n=(n=n+Math.imul(w,tt)|0)+Math.imul(_,et)|0,o=o+Math.imul(_,tt)|0,a=a+Math.imul(x,at)|0,n=(n=n+Math.imul(x,it)|0)+Math.imul(C,at)|0,o=o+Math.imul(C,it)|0,a=a+Math.imul(I,ot)|0,n=(n=n+Math.imul(I,At)|0)+Math.imul(y,ot)|0,o=o+Math.imul(y,At)|0,a=a+Math.imul(p,ct)|0,n=(n=n+Math.imul(p,dt)|0)+Math.imul(B,ct)|0,o=o+Math.imul(B,dt)|0;var Rt=(u+(a=a+Math.imul(l,ht)|0)|0)+((8191&(n=(n=n+Math.imul(l,bt)|0)+Math.imul(b,ht)|0))<<13)|0;u=((o=o+Math.imul(b,bt)|0)+(n>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,a=Math.imul(G,V),n=(n=Math.imul(G,X))+Math.imul(T,V)|0,o=Math.imul(T,X),a=a+Math.imul(N,et)|0,n=(n=n+Math.imul(N,tt)|0)+Math.imul(D,et)|0,o=o+Math.imul(D,tt)|0,a=a+Math.imul(w,at)|0,n=(n=n+Math.imul(w,it)|0)+Math.imul(_,at)|0,o=o+Math.imul(_,it)|0,a=a+Math.imul(x,ot)|0,n=(n=n+Math.imul(x,At)|0)+Math.imul(C,ot)|0,o=o+Math.imul(C,At)|0,a=a+Math.imul(I,ct)|0,n=(n=n+Math.imul(I,dt)|0)+Math.imul(y,ct)|0,o=o+Math.imul(y,dt)|0,a=a+Math.imul(p,ht)|0,n=(n=n+Math.imul(p,bt)|0)+Math.imul(B,ht)|0,o=o+Math.imul(B,bt)|0;var Ft=(u+(a=a+Math.imul(l,Bt)|0)|0)+((8191&(n=(n=n+Math.imul(l,mt)|0)+Math.imul(b,Bt)|0))<<13)|0;u=((o=o+Math.imul(b,mt)|0)+(n>>>13)|0)+(Ft>>>26)|0,Ft&=67108863,a=Math.imul(P,V),n=(n=Math.imul(P,X))+Math.imul(q,V)|0,o=Math.imul(q,X),a=a+Math.imul(G,et)|0,n=(n=n+Math.imul(G,tt)|0)+Math.imul(T,et)|0,o=o+Math.imul(T,tt)|0,a=a+Math.imul(N,at)|0,n=(n=n+Math.imul(N,it)|0)+Math.imul(D,at)|0,o=o+Math.imul(D,it)|0,a=a+Math.imul(w,ot)|0,n=(n=n+Math.imul(w,At)|0)+Math.imul(_,ot)|0,o=o+Math.imul(_,At)|0,a=a+Math.imul(x,ct)|0,n=(n=n+Math.imul(x,dt)|0)+Math.imul(C,ct)|0,o=o+Math.imul(C,dt)|0,a=a+Math.imul(I,ht)|0,n=(n=n+Math.imul(I,bt)|0)+Math.imul(y,ht)|0,o=o+Math.imul(y,bt)|0,a=a+Math.imul(p,Bt)|0,n=(n=n+Math.imul(p,mt)|0)+Math.imul(B,Bt)|0,o=o+Math.imul(B,mt)|0;var Ut=(u+(a=a+Math.imul(l,Et)|0)|0)+((8191&(n=(n=n+Math.imul(l,yt)|0)+Math.imul(b,Et)|0))<<13)|0;u=((o=o+Math.imul(b,yt)|0)+(n>>>13)|0)+(Ut>>>26)|0,Ut&=67108863,a=Math.imul(H,V),n=(n=Math.imul(H,X))+Math.imul(Y,V)|0,o=Math.imul(Y,X),a=a+Math.imul(P,et)|0,n=(n=n+Math.imul(P,tt)|0)+Math.imul(q,et)|0,o=o+Math.imul(q,tt)|0,a=a+Math.imul(G,at)|0,n=(n=n+Math.imul(G,it)|0)+Math.imul(T,at)|0,o=o+Math.imul(T,it)|0,a=a+Math.imul(N,ot)|0,n=(n=n+Math.imul(N,At)|0)+Math.imul(D,ot)|0,o=o+Math.imul(D,At)|0,a=a+Math.imul(w,ct)|0,n=(n=n+Math.imul(w,dt)|0)+Math.imul(_,ct)|0,o=o+Math.imul(_,dt)|0,a=a+Math.imul(x,ht)|0,n=(n=n+Math.imul(x,bt)|0)+Math.imul(C,ht)|0,o=o+Math.imul(C,bt)|0,a=a+Math.imul(I,Bt)|0,n=(n=n+Math.imul(I,mt)|0)+Math.imul(y,Bt)|0,o=o+Math.imul(y,mt)|0,a=a+Math.imul(p,Et)|0,n=(n=n+Math.imul(p,yt)|0)+Math.imul(B,Et)|0,o=o+Math.imul(B,yt)|0;var Gt=(u+(a=a+Math.imul(l,xt)|0)|0)+((8191&(n=(n=n+Math.imul(l,Ct)|0)+Math.imul(b,xt)|0))<<13)|0;u=((o=o+Math.imul(b,Ct)|0)+(n>>>13)|0)+(Gt>>>26)|0,Gt&=67108863,a=Math.imul(J,V),n=(n=Math.imul(J,X))+Math.imul(z,V)|0,o=Math.imul(z,X),a=a+Math.imul(H,et)|0,n=(n=n+Math.imul(H,tt)|0)+Math.imul(Y,et)|0,o=o+Math.imul(Y,tt)|0,a=a+Math.imul(P,at)|0,n=(n=n+Math.imul(P,it)|0)+Math.imul(q,at)|0,o=o+Math.imul(q,it)|0,a=a+Math.imul(G,ot)|0,n=(n=n+Math.imul(G,At)|0)+Math.imul(T,ot)|0,o=o+Math.imul(T,At)|0,a=a+Math.imul(N,ct)|0,n=(n=n+Math.imul(N,dt)|0)+Math.imul(D,ct)|0,o=o+Math.imul(D,dt)|0,a=a+Math.imul(w,ht)|0,n=(n=n+Math.imul(w,bt)|0)+Math.imul(_,ht)|0,o=o+Math.imul(_,bt)|0,a=a+Math.imul(x,Bt)|0,n=(n=n+Math.imul(x,mt)|0)+Math.imul(C,Bt)|0,o=o+Math.imul(C,mt)|0,a=a+Math.imul(I,Et)|0,n=(n=n+Math.imul(I,yt)|0)+Math.imul(y,Et)|0,o=o+Math.imul(y,yt)|0,a=a+Math.imul(p,xt)|0,n=(n=n+Math.imul(p,Ct)|0)+Math.imul(B,xt)|0,o=o+Math.imul(B,Ct)|0;var Tt=(u+(a=a+Math.imul(l,wt)|0)|0)+((8191&(n=(n=n+Math.imul(l,Mt)|0)+Math.imul(b,wt)|0))<<13)|0;u=((o=o+Math.imul(b,Mt)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,a=Math.imul(J,et),n=(n=Math.imul(J,tt))+Math.imul(z,et)|0,o=Math.imul(z,tt),a=a+Math.imul(H,at)|0,n=(n=n+Math.imul(H,it)|0)+Math.imul(Y,at)|0,o=o+Math.imul(Y,it)|0,a=a+Math.imul(P,ot)|0,n=(n=n+Math.imul(P,At)|0)+Math.imul(q,ot)|0,o=o+Math.imul(q,At)|0,a=a+Math.imul(G,ct)|0,n=(n=n+Math.imul(G,dt)|0)+Math.imul(T,ct)|0,o=o+Math.imul(T,dt)|0,a=a+Math.imul(N,ht)|0,n=(n=n+Math.imul(N,bt)|0)+Math.imul(D,ht)|0,o=o+Math.imul(D,bt)|0,a=a+Math.imul(w,Bt)|0,n=(n=n+Math.imul(w,mt)|0)+Math.imul(_,Bt)|0,o=o+Math.imul(_,mt)|0,a=a+Math.imul(x,Et)|0,n=(n=n+Math.imul(x,yt)|0)+Math.imul(C,Et)|0,o=o+Math.imul(C,yt)|0,a=a+Math.imul(I,xt)|0,n=(n=n+Math.imul(I,Ct)|0)+Math.imul(y,xt)|0,o=o+Math.imul(y,Ct)|0;var Lt=(u+(a=a+Math.imul(p,wt)|0)|0)+((8191&(n=(n=n+Math.imul(p,Mt)|0)+Math.imul(B,wt)|0))<<13)|0;u=((o=o+Math.imul(B,Mt)|0)+(n>>>13)|0)+(Lt>>>26)|0,Lt&=67108863,a=Math.imul(J,at),n=(n=Math.imul(J,it))+Math.imul(z,at)|0,o=Math.imul(z,it),a=a+Math.imul(H,ot)|0,n=(n=n+Math.imul(H,At)|0)+Math.imul(Y,ot)|0,o=o+Math.imul(Y,At)|0,a=a+Math.imul(P,ct)|0,n=(n=n+Math.imul(P,dt)|0)+Math.imul(q,ct)|0,o=o+Math.imul(q,dt)|0,a=a+Math.imul(G,ht)|0,n=(n=n+Math.imul(G,bt)|0)+Math.imul(T,ht)|0,o=o+Math.imul(T,bt)|0,a=a+Math.imul(N,Bt)|0,n=(n=n+Math.imul(N,mt)|0)+Math.imul(D,Bt)|0,o=o+Math.imul(D,mt)|0,a=a+Math.imul(w,Et)|0,n=(n=n+Math.imul(w,yt)|0)+Math.imul(_,Et)|0,o=o+Math.imul(_,yt)|0,a=a+Math.imul(x,xt)|0,n=(n=n+Math.imul(x,Ct)|0)+Math.imul(C,xt)|0,o=o+Math.imul(C,Ct)|0;var Pt=(u+(a=a+Math.imul(I,wt)|0)|0)+((8191&(n=(n=n+Math.imul(I,Mt)|0)+Math.imul(y,wt)|0))<<13)|0;u=((o=o+Math.imul(y,Mt)|0)+(n>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,a=Math.imul(J,ot),n=(n=Math.imul(J,At))+Math.imul(z,ot)|0,o=Math.imul(z,At),a=a+Math.imul(H,ct)|0,n=(n=n+Math.imul(H,dt)|0)+Math.imul(Y,ct)|0,o=o+Math.imul(Y,dt)|0,a=a+Math.imul(P,ht)|0,n=(n=n+Math.imul(P,bt)|0)+Math.imul(q,ht)|0,o=o+Math.imul(q,bt)|0,a=a+Math.imul(G,Bt)|0,n=(n=n+Math.imul(G,mt)|0)+Math.imul(T,Bt)|0,o=o+Math.imul(T,mt)|0,a=a+Math.imul(N,Et)|0,n=(n=n+Math.imul(N,yt)|0)+Math.imul(D,Et)|0,o=o+Math.imul(D,yt)|0,a=a+Math.imul(w,xt)|0,n=(n=n+Math.imul(w,Ct)|0)+Math.imul(_,xt)|0,o=o+Math.imul(_,Ct)|0;var qt=(u+(a=a+Math.imul(x,wt)|0)|0)+((8191&(n=(n=n+Math.imul(x,Mt)|0)+Math.imul(C,wt)|0))<<13)|0;u=((o=o+Math.imul(C,Mt)|0)+(n>>>13)|0)+(qt>>>26)|0,qt&=67108863,a=Math.imul(J,ct),n=(n=Math.imul(J,dt))+Math.imul(z,ct)|0,o=Math.imul(z,dt),a=a+Math.imul(H,ht)|0,n=(n=n+Math.imul(H,bt)|0)+Math.imul(Y,ht)|0,o=o+Math.imul(Y,bt)|0,a=a+Math.imul(P,Bt)|0,n=(n=n+Math.imul(P,mt)|0)+Math.imul(q,Bt)|0,o=o+Math.imul(q,mt)|0,a=a+Math.imul(G,Et)|0,n=(n=n+Math.imul(G,yt)|0)+Math.imul(T,Et)|0,o=o+Math.imul(T,yt)|0,a=a+Math.imul(N,xt)|0,n=(n=n+Math.imul(N,Ct)|0)+Math.imul(D,xt)|0,o=o+Math.imul(D,Ct)|0;var Ot=(u+(a=a+Math.imul(w,wt)|0)|0)+((8191&(n=(n=n+Math.imul(w,Mt)|0)+Math.imul(_,wt)|0))<<13)|0;u=((o=o+Math.imul(_,Mt)|0)+(n>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,a=Math.imul(J,ht),n=(n=Math.imul(J,bt))+Math.imul(z,ht)|0,o=Math.imul(z,bt),a=a+Math.imul(H,Bt)|0,n=(n=n+Math.imul(H,mt)|0)+Math.imul(Y,Bt)|0,o=o+Math.imul(Y,mt)|0,a=a+Math.imul(P,Et)|0,n=(n=n+Math.imul(P,yt)|0)+Math.imul(q,Et)|0,o=o+Math.imul(q,yt)|0,a=a+Math.imul(G,xt)|0,n=(n=n+Math.imul(G,Ct)|0)+Math.imul(T,xt)|0,o=o+Math.imul(T,Ct)|0;var Ht=(u+(a=a+Math.imul(N,wt)|0)|0)+((8191&(n=(n=n+Math.imul(N,Mt)|0)+Math.imul(D,wt)|0))<<13)|0;u=((o=o+Math.imul(D,Mt)|0)+(n>>>13)|0)+(Ht>>>26)|0,Ht&=67108863,a=Math.imul(J,Bt),n=(n=Math.imul(J,mt))+Math.imul(z,Bt)|0,o=Math.imul(z,mt),a=a+Math.imul(H,Et)|0,n=(n=n+Math.imul(H,yt)|0)+Math.imul(Y,Et)|0,o=o+Math.imul(Y,yt)|0,a=a+Math.imul(P,xt)|0,n=(n=n+Math.imul(P,Ct)|0)+Math.imul(q,xt)|0,o=o+Math.imul(q,Ct)|0;var Yt=(u+(a=a+Math.imul(G,wt)|0)|0)+((8191&(n=(n=n+Math.imul(G,Mt)|0)+Math.imul(T,wt)|0))<<13)|0;u=((o=o+Math.imul(T,Mt)|0)+(n>>>13)|0)+(Yt>>>26)|0,Yt&=67108863,a=Math.imul(J,Et),n=(n=Math.imul(J,yt))+Math.imul(z,Et)|0,o=Math.imul(z,yt),a=a+Math.imul(H,xt)|0,n=(n=n+Math.imul(H,Ct)|0)+Math.imul(Y,xt)|0,o=o+Math.imul(Y,Ct)|0;var jt=(u+(a=a+Math.imul(P,wt)|0)|0)+((8191&(n=(n=n+Math.imul(P,Mt)|0)+Math.imul(q,wt)|0))<<13)|0;u=((o=o+Math.imul(q,Mt)|0)+(n>>>13)|0)+(jt>>>26)|0,jt&=67108863,a=Math.imul(J,xt),n=(n=Math.imul(J,Ct))+Math.imul(z,xt)|0,o=Math.imul(z,Ct);var Jt=(u+(a=a+Math.imul(H,wt)|0)|0)+((8191&(n=(n=n+Math.imul(H,Mt)|0)+Math.imul(Y,wt)|0))<<13)|0;u=((o=o+Math.imul(Y,Mt)|0)+(n>>>13)|0)+(Jt>>>26)|0,Jt&=67108863;var Kt=(u+(a=Math.imul(J,wt))|0)+((8191&(n=(n=Math.imul(J,Mt))+Math.imul(z,wt)|0))<<13)|0;return u=((o=Math.imul(z,Mt))+(n>>>13)|0)+(Kt>>>26)|0,Kt&=67108863,d[0]=_t,d[1]=kt,d[2]=St,d[3]=Nt,d[4]=Dt,d[5]=Rt,d[6]=Ft,d[7]=Ut,d[8]=Gt,d[9]=Tt,d[10]=Lt,d[11]=Pt,d[12]=qt,d[13]=Ot,d[14]=Ht,d[15]=Yt,d[16]=jt,d[17]=Jt,d[18]=Kt,0!==u&&(d[19]=u,r.length++),r};function jumboMulTo(e,t,r){return(new FFTM).mulp(e,t,r)}function FFTM(e,t){this.x=e,this.y=t}Math.imul||(c=smallMulTo),BN.prototype.mulTo=function mulTo(e,t){var r=this.length+e.length;return 10===this.length&&10===e.length?c(this,e,t):r<63?smallMulTo(this,e,t):r<1024?function bigMulTo(e,t,r){r.negative=t.negative^e.negative,r.length=e.length+t.length;for(var a=0,n=0,o=0;o>>26)|0)>>>26,s&=67108863}r.words[o]=c,a=s,s=n}return 0!==a?r.words[o]=a:r.length--,r.strip()}(this,e,t):jumboMulTo(this,e,t)},FFTM.prototype.makeRBT=function makeRBT(e){for(var t=new Array(e),r=BN.prototype._countBits(e)-1,a=0;a>=1;return a},FFTM.prototype.permute=function permute(e,t,r,a,n,o){for(var s=0;s>>=1)n++;return 1<>>=13,r[2*o+1]=8191&n,n>>>=13;for(o=2*t;o>=26,t+=a/67108864|0,t+=n>>>26,this.words[r]=67108863&n}return 0!==t&&(this.words[r]=t,this.length++),this},BN.prototype.muln=function muln(e){return this.clone().imuln(e)},BN.prototype.sqr=function sqr(){return this.mul(this)},BN.prototype.isqr=function isqr(){return this.imul(this.clone())},BN.prototype.pow=function pow(e){var t=function toBitArray(e){for(var t=new Array(e.bitLength()),r=0;r>>n}return t}(e);if(0===t.length)return new BN(1);for(var r=this,a=0;a=0);var t,r=e%26,a=(e-r)/26,n=67108863>>>26-r<<26-r;if(0!==r){var o=0;for(t=0;t>>26-r}o&&(this.words[t]=o,this.length++)}if(0!==a){for(t=this.length-1;t>=0;t--)this.words[t+a]=this.words[t];for(t=0;t=0),a=t?(t-t%26)/26:0;var n=e%26,o=Math.min((e-n)/26,this.length),s=67108863^67108863>>>n<o)for(this.length-=o,d=0;d=0&&(0!==u||d>=a);d--){var h=0|this.words[d];this.words[d]=u<<26-n|h>>>n,u=h&s}return c&&0!==u&&(c.words[c.length++]=u),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},BN.prototype.ishrn=function ishrn(e,t,r){return assert(0===this.negative),this.iushrn(e,t,r)},BN.prototype.shln=function shln(e){return this.clone().ishln(e)},BN.prototype.ushln=function ushln(e){return this.clone().iushln(e)},BN.prototype.shrn=function shrn(e){return this.clone().ishrn(e)},BN.prototype.ushrn=function ushrn(e){return this.clone().iushrn(e)},BN.prototype.testn=function testn(e){assert("number"==typeof e&&e>=0);var t=e%26,r=(e-t)/26,a=1<=0);var t=e%26,r=(e-t)/26;if(assert(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==t&&r++,this.length=Math.min(r,this.length),0!==t){var a=67108863^67108863>>>t<=67108864;t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},BN.prototype.isubn=function isubn(e){if(assert("number"==typeof e),assert(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t>26)-(c/67108864|0),this.words[a+r]=67108863&n}for(;a>26,this.words[a+r]=67108863&n;if(0===s)return this.strip();for(assert(-1===s),s=0,a=0;a>26,this.words[a]=67108863&n;return this.negative=1,this.strip()},BN.prototype._wordDiv=function _wordDiv(e,t){var r=(this.length,e.length),a=this.clone(),n=e,o=0|n.words[n.length-1];0!==(r=26-this._countBits(o))&&(n=n.ushln(r),a.iushln(r),o=0|n.words[n.length-1]);var s,c=a.length-n.length;if("mod"!==t){(s=new BN(null)).length=c+1,s.words=new Array(s.length);for(var d=0;d=0;h--){var l=67108864*(0|a.words[n.length+h])+(0|a.words[n.length+h-1]);for(l=Math.min(l/o|0,67108863),a._ishlnsubmul(n,l,h);0!==a.negative;)l--,a.negative=0,a._ishlnsubmul(n,1,h),a.isZero()||(a.negative^=1);s&&(s.words[h]=l)}return s&&s.strip(),a.strip(),"div"!==t&&0!==r&&a.iushrn(r),{div:s||null,mod:a}},BN.prototype.divmod=function divmod(e,t,r){return assert(!e.isZero()),this.isZero()?{div:new BN(0),mod:new BN(0)}:0!==this.negative&&0===e.negative?(o=this.neg().divmod(e,t),"mod"!==t&&(a=o.div.neg()),"div"!==t&&(n=o.mod.neg(),r&&0!==n.negative&&n.iadd(e)),{div:a,mod:n}):0===this.negative&&0!==e.negative?(o=this.divmod(e.neg(),t),"mod"!==t&&(a=o.div.neg()),{div:a,mod:o.mod}):0!=(this.negative&e.negative)?(o=this.neg().divmod(e.neg(),t),"div"!==t&&(n=o.mod.neg(),r&&0!==n.negative&&n.isub(e)),{div:o.div,mod:n}):e.length>this.length||this.cmp(e)<0?{div:new BN(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new BN(this.modn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new BN(this.modn(e.words[0]))}:this._wordDiv(e,t);var a,n,o},BN.prototype.div=function div(e){return this.divmod(e,"div",!1).div},BN.prototype.mod=function mod(e){return this.divmod(e,"mod",!1).mod},BN.prototype.umod=function umod(e){return this.divmod(e,"mod",!0).mod},BN.prototype.divRound=function divRound(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var r=0!==t.div.negative?t.mod.isub(e):t.mod,a=e.ushrn(1),n=e.andln(1),o=r.cmp(a);return o<0||1===n&&0===o?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},BN.prototype.modn=function modn(e){assert(e<=67108863);for(var t=(1<<26)%e,r=0,a=this.length-1;a>=0;a--)r=(t*r+(0|this.words[a]))%e;return r},BN.prototype.idivn=function idivn(e){assert(e<=67108863);for(var t=0,r=this.length-1;r>=0;r--){var a=(0|this.words[r])+67108864*t;this.words[r]=a/e|0,t=a%e}return this.strip()},BN.prototype.divn=function divn(e){return this.clone().idivn(e)},BN.prototype.egcd=function egcd(e){assert(0===e.negative),assert(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var a=new BN(1),n=new BN(0),o=new BN(0),s=new BN(1),c=0;t.isEven()&&r.isEven();)t.iushrn(1),r.iushrn(1),++c;for(var d=r.clone(),u=t.clone();!t.isZero();){for(var h=0,l=1;0==(t.words[0]&l)&&h<26;++h,l<<=1);if(h>0)for(t.iushrn(h);h-- >0;)(a.isOdd()||n.isOdd())&&(a.iadd(d),n.isub(u)),a.iushrn(1),n.iushrn(1);for(var b=0,g=1;0==(r.words[0]&g)&&b<26;++b,g<<=1);if(b>0)for(r.iushrn(b);b-- >0;)(o.isOdd()||s.isOdd())&&(o.iadd(d),s.isub(u)),o.iushrn(1),s.iushrn(1);t.cmp(r)>=0?(t.isub(r),a.isub(o),n.isub(s)):(r.isub(t),o.isub(a),s.isub(n))}return{a:o,b:s,gcd:r.iushln(c)}},BN.prototype._invmp=function _invmp(e){assert(0===e.negative),assert(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var a,n=new BN(1),o=new BN(0),s=r.clone();t.cmpn(1)>0&&r.cmpn(1)>0;){for(var c=0,d=1;0==(t.words[0]&d)&&c<26;++c,d<<=1);if(c>0)for(t.iushrn(c);c-- >0;)n.isOdd()&&n.iadd(s),n.iushrn(1);for(var u=0,h=1;0==(r.words[0]&h)&&u<26;++u,h<<=1);if(u>0)for(r.iushrn(u);u-- >0;)o.isOdd()&&o.iadd(s),o.iushrn(1);t.cmp(r)>=0?(t.isub(r),n.isub(o)):(r.isub(t),o.isub(n))}return(a=0===t.cmpn(1)?n:o).cmpn(0)<0&&a.iadd(e),a},BN.prototype.gcd=function gcd(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),r=e.clone();t.negative=0,r.negative=0;for(var a=0;t.isEven()&&r.isEven();a++)t.iushrn(1),r.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=t.cmp(r);if(n<0){var o=t;t=r,r=o}else if(0===n||0===r.cmpn(1))break;t.isub(r)}return r.iushln(a)},BN.prototype.invm=function invm(e){return this.egcd(e).a.umod(e)},BN.prototype.isEven=function isEven(){return 0==(1&this.words[0])},BN.prototype.isOdd=function isOdd(){return 1==(1&this.words[0])},BN.prototype.andln=function andln(e){return this.words[0]&e},BN.prototype.bincn=function bincn(e){assert("number"==typeof e);var t=e%26,r=(e-t)/26,a=1<>>26,s&=67108863,this.words[o]=s}return 0!==n&&(this.words[o]=n,this.length++),this},BN.prototype.isZero=function isZero(){return 1===this.length&&0===this.words[0]},BN.prototype.cmpn=function cmpn(e){var t,r=e<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this.strip(),this.length>1)t=1;else{r&&(e=-e),assert(e<=67108863,"Number is too big");var a=0|this.words[0];t=a===e?0:ae.length)return 1;if(this.length=0;r--){var a=0|this.words[r],n=0|e.words[r];if(a!==n){an&&(t=1);break}}return t},BN.prototype.gtn=function gtn(e){return 1===this.cmpn(e)},BN.prototype.gt=function gt(e){return 1===this.cmp(e)},BN.prototype.gten=function gten(e){return this.cmpn(e)>=0},BN.prototype.gte=function gte(e){return this.cmp(e)>=0},BN.prototype.ltn=function ltn(e){return-1===this.cmpn(e)},BN.prototype.lt=function lt(e){return-1===this.cmp(e)},BN.prototype.lten=function lten(e){return this.cmpn(e)<=0},BN.prototype.lte=function lte(e){return this.cmp(e)<=0},BN.prototype.eqn=function eqn(e){return 0===this.cmpn(e)},BN.prototype.eq=function eq(e){return 0===this.cmp(e)},BN.red=function red(e){return new Red(e)},BN.prototype.toRed=function toRed(e){return assert(!this.red,"Already a number in reduction context"),assert(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},BN.prototype.fromRed=function fromRed(){return assert(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},BN.prototype._forceRed=function _forceRed(e){return this.red=e,this},BN.prototype.forceRed=function forceRed(e){return assert(!this.red,"Already a number in reduction context"),this._forceRed(e)},BN.prototype.redAdd=function redAdd(e){return assert(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},BN.prototype.redIAdd=function redIAdd(e){return assert(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},BN.prototype.redSub=function redSub(e){return assert(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},BN.prototype.redISub=function redISub(e){return assert(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},BN.prototype.redShl=function redShl(e){return assert(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},BN.prototype.redMul=function redMul(e){return assert(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},BN.prototype.redIMul=function redIMul(e){return assert(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},BN.prototype.redSqr=function redSqr(){return assert(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},BN.prototype.redISqr=function redISqr(){return assert(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},BN.prototype.redSqrt=function redSqrt(){return assert(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},BN.prototype.redInvm=function redInvm(){return assert(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},BN.prototype.redNeg=function redNeg(){return assert(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},BN.prototype.redPow=function redPow(e){return assert(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var d={k256:null,p224:null,p192:null,p25519:null};function MPrime(e,t){this.name=e,this.p=new BN(t,16),this.n=this.p.bitLength(),this.k=new BN(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function K256(){MPrime.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function P224(){MPrime.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function P192(){MPrime.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function P25519(){MPrime.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function Red(e){if("string"==typeof e){var t=BN._prime(e);this.m=t.p,this.prime=t}else assert(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function Mont(e){Red.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new BN(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)}MPrime.prototype._tmp=function _tmp(){var e=new BN(null);return e.words=new Array(Math.ceil(this.n/13)),e},MPrime.prototype.ireduce=function ireduce(e){var t,r=e;do{this.split(r,this.tmp),t=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(t>this.n);var a=t0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},MPrime.prototype.split=function split(e,t){e.iushrn(this.n,0,t)},MPrime.prototype.imulK=function imulK(e){return e.imul(this.k)},inherits(K256,MPrime),K256.prototype.split=function split(e,t){for(var r=4194303,a=Math.min(e.length,9),n=0;n>>22,o=s}o>>>=22,e.words[n-10]=o,0===o&&e.length>10?e.length-=10:e.length-=9},K256.prototype.imulK=function imulK(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,r=0;r>>=26,e.words[r]=n,t=a}return 0!==t&&(e.words[e.length++]=t),e},BN._prime=function prime(e){if(d[e])return d[e];var prime;if("k256"===e)prime=new K256;else if("p224"===e)prime=new P224;else if("p192"===e)prime=new P192;else{if("p25519"!==e)throw new Error("Unknown prime "+e);prime=new P25519}return d[e]=prime,prime},Red.prototype._verify1=function _verify1(e){assert(0===e.negative,"red works only with positives"),assert(e.red,"red works only with red numbers")},Red.prototype._verify2=function _verify2(e,t){assert(0==(e.negative|t.negative),"red works only with positives"),assert(e.red&&e.red===t.red,"red works only with red numbers")},Red.prototype.imod=function imod(e){return this.prime?this.prime.ireduce(e)._forceRed(this):e.umod(this.m)._forceRed(this)},Red.prototype.neg=function neg(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},Red.prototype.add=function add(e,t){this._verify2(e,t);var r=e.add(t);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},Red.prototype.iadd=function iadd(e,t){this._verify2(e,t);var r=e.iadd(t);return r.cmp(this.m)>=0&&r.isub(this.m),r},Red.prototype.sub=function sub(e,t){this._verify2(e,t);var r=e.sub(t);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},Red.prototype.isub=function isub(e,t){this._verify2(e,t);var r=e.isub(t);return r.cmpn(0)<0&&r.iadd(this.m),r},Red.prototype.shl=function shl(e,t){return this._verify1(e),this.imod(e.ushln(t))},Red.prototype.imul=function imul(e,t){return this._verify2(e,t),this.imod(e.imul(t))},Red.prototype.mul=function mul(e,t){return this._verify2(e,t),this.imod(e.mul(t))},Red.prototype.isqr=function isqr(e){return this.imul(e,e.clone())},Red.prototype.sqr=function sqr(e){return this.mul(e,e)},Red.prototype.sqrt=function sqrt(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(assert(t%2==1),3===t){var r=this.m.add(new BN(1)).iushrn(2);return this.pow(e,r)}for(var a=this.m.subn(1),n=0;!a.isZero()&&0===a.andln(1);)n++,a.iushrn(1);assert(!a.isZero());var o=new BN(1).toRed(this),s=o.redNeg(),c=this.m.subn(1).iushrn(1),d=this.m.bitLength();for(d=new BN(2*d*d).toRed(this);0!==this.pow(d,c).cmp(s);)d.redIAdd(s);for(var u=this.pow(d,a),h=this.pow(e,a.addn(1).iushrn(1)),l=this.pow(e,a),b=n;0!==l.cmp(o);){for(var g=l,p=0;0!==g.cmp(o);p++)g=g.redSqr();assert(p=0;a--){for(var d=t.words[a],u=c-1;u>=0;u--){var h=d>>u&1;n!==r[0]&&(n=this.sqr(n)),0!==h||0!==o?(o<<=1,o|=h,(4===++s||0===a&&0===u)&&(n=this.mul(n,r[o]),s=0,o=0)):s=0}c=26}return n},Red.prototype.convertTo=function convertTo(e){var t=e.umod(this.m);return t===e?t.clone():t},Red.prototype.convertFrom=function convertFrom(e){var t=e.clone();return t.red=null,t},BN.mont=function mont(e){return new Mont(e)},inherits(Mont,Red),Mont.prototype.convertTo=function convertTo(e){return this.imod(e.ushln(this.shift))},Mont.prototype.convertFrom=function convertFrom(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},Mont.prototype.imul=function imul(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var r=e.imul(t),a=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(a).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},Mont.prototype.mul=function mul(e,t){if(e.isZero()||t.isZero())return new BN(0)._forceRed(this);var r=e.mul(t),a=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(a).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},Mont.prototype.invm=function invm(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(e=r.nmd(e),this)},function(e,t,r){"use strict";var a=r(0).Buffer,n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var o=n(r(1065)),s=function(){function Cache(e){this._cache=new o.default(e)}return Cache.prototype.set=function(e,t){e instanceof a&&(e=e.toString("hex")),this._cache.set(e,t)},Cache.prototype.get=function(e){return e instanceof a&&(e=e.toString("hex")),this._cache.get(e)},Cache.prototype.del=function(e){e instanceof a&&(e=e.toString("hex")),this._cache.del(e)},Cache}();t.default=s},(e,t,r)=>{r(1069),r(1445),r(1090),r(1447);var a=r(392);e.exports=a.Set},(e,t,r)=>{var a=r(118),n=r(388),o="".split;e.exports=a((function(){return!Object("z").propertyIsEnumerable(0)}))?function(e){return"String"==n(e)?o.call(e,""):Object(e)}:Object},(e,t,r)=>{var a=r(145),n=r(118),o=r(632);e.exports=!a&&!n((function(){return 7!=Object.defineProperty(o("div"),"a",{get:function(){return 7}}).a}))},(e,t,r)=>{var a=r(104),n=r(119),o=a.document,s=n(o)&&n(o.createElement);e.exports=function(e){return s?o.createElement(e):{}}},(e,t,r)=>{var a=r(1074),n=r(391);e.exports=function(e){var t=a(e,"string");return n(t)?t:String(t)}},(e,t,r)=>{var a=r(635);e.exports=a&&!Symbol.sham&&"symbol"==typeof Symbol.iterator},(e,t,r)=>{var a=r(1075),n=r(118);e.exports=!!Object.getOwnPropertySymbols&&!n((function(){var e=Symbol();return!String(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&a&&a<41}))},(e,t,r)=>{var a=r(393),n=r(390);(e.exports=function(e,t){return n[e]||(n[e]=void 0!==t?t:{})})("versions",[]).push({version:"3.16.3",mode:a?"pure":"global",copyright:"© 2021 Denis Pushkarev (zloirock.ru)"})},(e,t,r)=>{"use strict";var a,n,o,s=r(118),c=r(638),d=r(169),u=r(120),h=r(105),l=r(393),b=h("iterator"),g=!1;[].keys&&("next"in(o=[].keys())?(n=c(c(o)))!==Object.prototype&&(a=n):g=!0);var p=null==a||s((function(){var e={};return a[b].call(e)!==e}));p&&(a={}),l&&!p||u(a,b)||d(a,b,(function(){return this})),e.exports={IteratorPrototype:a,BUGGY_SAFARI_ITERATORS:g}},(e,t,r)=>{var a=r(120),n=r(394),o=r(397),s=r(1081),c=o("IE_PROTO"),d=Object.prototype;e.exports=s?Object.getPrototypeOf:function(e){return e=n(e),a(e,c)?e[c]:"function"==typeof e.constructor&&e instanceof e.constructor?e.constructor.prototype:e instanceof Object?d:null}},(e,t,r)=>{var a,n=r(217),o=r(1082),s=r(402),c=r(292),d=r(1086),u=r(632),h=r(397),l=h("IE_PROTO"),EmptyConstructor=function(){},scriptTag=function(e){return"