Repository navigation
Expand file tree
/
Copy pathradiant.min.js
More file actions
46 lines (46 loc) · 399 KB
/
Copy pathradiant.min.js
File metadata and controls
46 lines (46 loc) · 399 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
var radiantjs=function(t){var e={};function r(i){if(e[i])return e[i].exports;var n=e[i]={i:i,l:!1,exports:{}};return t[i].call(n.exports,n,n.exports,r),n.l=!0,n.exports}return r.m=t,r.c=e,r.d=function(t,e,i){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:i})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var i=Object.create(null);if(r.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var n in t)r.d(i,n,function(e){return t[e]}.bind(null,n));return i},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=63)}([function(t,e,r){"use strict";(function(t){
/*!
* The buffer module from node.js, for the browser.
*
* @author Feross Aboukhadijeh <http://feross.org>
* @license MIT
*/
var i=r(64),n=r(65),s=r(66);function o(){return u.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function a(t,e){if(o()<e)throw new RangeError("Invalid typed array length");return u.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(e)).__proto__=u.prototype:(null===t&&(t=new u(e)),t.length=e),t}function u(t,e,r){if(!(u.TYPED_ARRAY_SUPPORT||this instanceof u))return new u(t,e,r);if("number"==typeof t){if("string"==typeof e)throw new Error("If encoding is specified then the first argument must be a string");return c(this,t)}return f(this,t,e,r)}function f(t,e,r,i){if("number"==typeof e)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer?function(t,e,r,i){if(e.byteLength,r<0||e.byteLength<r)throw new RangeError("'offset' is out of bounds");if(e.byteLength<r+(i||0))throw new RangeError("'length' is out of bounds");e=void 0===r&&void 0===i?new Uint8Array(e):void 0===i?new Uint8Array(e,r):new Uint8Array(e,r,i);u.TYPED_ARRAY_SUPPORT?(t=e).__proto__=u.prototype:t=d(t,e);return t}(t,e,r,i):"string"==typeof e?function(t,e,r){"string"==typeof r&&""!==r||(r="utf8");if(!u.isEncoding(r))throw new TypeError('"encoding" must be a valid string encoding');var i=0|l(e,r),n=(t=a(t,i)).write(e,r);n!==i&&(t=t.slice(0,n));return t}(t,e,r):function(t,e){if(u.isBuffer(e)){var r=0|p(e.length);return 0===(t=a(t,r)).length?t:(e.copy(t,0,0,r),t)}if(e){if("undefined"!=typeof ArrayBuffer&&e.buffer instanceof ArrayBuffer||"length"in e)return"number"!=typeof e.length||(i=e.length)!=i?a(t,0):d(t,e);if("Buffer"===e.type&&s(e.data))return d(t,e.data)}var i;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(t,e)}function h(t){if("number"!=typeof t)throw new TypeError('"size" argument must be a number');if(t<0)throw new RangeError('"size" argument must not be negative')}function c(t,e){if(h(e),t=a(t,e<0?0:0|p(e)),!u.TYPED_ARRAY_SUPPORT)for(var r=0;r<e;++r)t[r]=0;return t}function d(t,e){var r=e.length<0?0:0|p(e.length);t=a(t,r);for(var i=0;i<r;i+=1)t[i]=255&e[i];return t}function p(t){if(t>=o())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+o().toString(16)+" bytes");return 0|t}function l(t,e){if(u.isBuffer(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;"string"!=typeof t&&(t=""+t);var r=t.length;if(0===r)return 0;for(var i=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return K(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return z(t).length;default:if(i)return K(t).length;e=(""+e).toLowerCase(),i=!0}}function m(t,e,r){var i=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return T(this,e,r);case"utf8":case"utf-8":return P(this,e,r);case"ascii":return M(this,e,r);case"latin1":case"binary":return k(this,e,r);case"base64":return A(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return R(this,e,r);default:if(i)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),i=!0}}function b(t,e,r){var i=t[e];t[e]=t[r],t[r]=i}function g(t,e,r,i,n){if(0===t.length)return-1;if("string"==typeof r?(i=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=n?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(n)return-1;r=t.length-1}else if(r<0){if(!n)return-1;r=0}if("string"==typeof e&&(e=u.from(e,i)),u.isBuffer(e))return 0===e.length?-1:y(t,e,r,i,n);if("number"==typeof e)return e&=255,u.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?n?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):y(t,[e],r,i,n);throw new TypeError("val must be string, number or Buffer")}function y(t,e,r,i,n){var s,o=1,a=t.length,u=e.length;if(void 0!==i&&("ucs2"===(i=String(i).toLowerCase())||"ucs-2"===i||"utf16le"===i||"utf-16le"===i)){if(t.length<2||e.length<2)return-1;o=2,a/=2,u/=2,r/=2}function f(t,e){return 1===o?t[e]:t.readUInt16BE(e*o)}if(n){var h=-1;for(s=r;s<a;s++)if(f(t,s)===f(e,-1===h?0:s-h)){if(-1===h&&(h=s),s-h+1===u)return h*o}else-1!==h&&(s-=s-h),h=-1}else for(r+u>a&&(r=a-u),s=r;s>=0;s--){for(var c=!0,d=0;d<u;d++)if(f(t,s+d)!==f(e,d)){c=!1;break}if(c)return s}return-1}function v(t,e,r,i){r=Number(r)||0;var n=t.length-r;i?(i=Number(i))>n&&(i=n):i=n;var s=e.length;if(s%2!=0)throw new TypeError("Invalid hex string");i>s/2&&(i=s/2);for(var o=0;o<i;++o){var a=parseInt(e.substr(2*o,2),16);if(isNaN(a))return o;t[r+o]=a}return o}function _(t,e,r,i){return j(K(e,t.length-r),t,r,i)}function S(t,e,r,i){return j(function(t){for(var e=[],r=0;r<t.length;++r)e.push(255&t.charCodeAt(r));return e}(e),t,r,i)}function w(t,e,r,i){return S(t,e,r,i)}function I(t,e,r,i){return j(z(e),t,r,i)}function E(t,e,r,i){return j(function(t,e){for(var r,i,n,s=[],o=0;o<t.length&&!((e-=2)<0);++o)r=t.charCodeAt(o),i=r>>8,n=r%256,s.push(n),s.push(i);return s}(e,t.length-r),t,r,i)}function A(t,e,r){return 0===e&&r===t.length?i.fromByteArray(t):i.fromByteArray(t.slice(e,r))}function P(t,e,r){r=Math.min(t.length,r);for(var i=[],n=e;n<r;){var s,o,a,u,f=t[n],h=null,c=f>239?4:f>223?3:f>191?2:1;if(n+c<=r)switch(c){case 1:f<128&&(h=f);break;case 2:128==(192&(s=t[n+1]))&&(u=(31&f)<<6|63&s)>127&&(h=u);break;case 3:s=t[n+1],o=t[n+2],128==(192&s)&&128==(192&o)&&(u=(15&f)<<12|(63&s)<<6|63&o)>2047&&(u<55296||u>57343)&&(h=u);break;case 4:s=t[n+1],o=t[n+2],a=t[n+3],128==(192&s)&&128==(192&o)&&128==(192&a)&&(u=(15&f)<<18|(63&s)<<12|(63&o)<<6|63&a)>65535&&u<1114112&&(h=u)}null===h?(h=65533,c=1):h>65535&&(h-=65536,i.push(h>>>10&1023|55296),h=56320|1023&h),i.push(h),n+=c}return function(t){var e=t.length;if(e<=O)return String.fromCharCode.apply(String,t);var r="",i=0;for(;i<e;)r+=String.fromCharCode.apply(String,t.slice(i,i+=O));return r}(i)}e.Buffer=u,e.SlowBuffer=function(t){+t!=t&&(t=0);return u.alloc(+t)},e.INSPECT_MAX_BYTES=50,u.TYPED_ARRAY_SUPPORT=void 0!==t.TYPED_ARRAY_SUPPORT?t.TYPED_ARRAY_SUPPORT:function(){try{var t=new Uint8Array(1);return t.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===t.foo()&&"function"==typeof t.subarray&&0===t.subarray(1,1).byteLength}catch(t){return!1}}(),e.kMaxLength=o(),u.poolSize=8192,u._augment=function(t){return t.__proto__=u.prototype,t},u.from=function(t,e,r){return f(null,t,e,r)},u.TYPED_ARRAY_SUPPORT&&(u.prototype.__proto__=Uint8Array.prototype,u.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&u[Symbol.species]===u&&Object.defineProperty(u,Symbol.species,{value:null,configurable:!0})),u.alloc=function(t,e,r){return function(t,e,r,i){return h(e),e<=0?a(t,e):void 0!==r?"string"==typeof i?a(t,e).fill(r,i):a(t,e).fill(r):a(t,e)}(null,t,e,r)},u.allocUnsafe=function(t){return c(null,t)},u.allocUnsafeSlow=function(t){return c(null,t)},u.isBuffer=function(t){return!(null==t||!t._isBuffer)},u.compare=function(t,e){if(!u.isBuffer(t)||!u.isBuffer(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var r=t.length,i=e.length,n=0,s=Math.min(r,i);n<s;++n)if(t[n]!==e[n]){r=t[n],i=e[n];break}return r<i?-1:i<r?1:0},u.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},u.concat=function(t,e){if(!s(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return u.alloc(0);var r;if(void 0===e)for(e=0,r=0;r<t.length;++r)e+=t[r].length;var i=u.allocUnsafe(e),n=0;for(r=0;r<t.length;++r){var o=t[r];if(!u.isBuffer(o))throw new TypeError('"list" argument must be an Array of Buffers');o.copy(i,n),n+=o.length}return i},u.byteLength=l,u.prototype._isBuffer=!0,u.prototype.swap16=function(){var t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e<t;e+=2)b(this,e,e+1);return this},u.prototype.swap32=function(){var t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<t;e+=4)b(this,e,e+3),b(this,e+1,e+2);return this},u.prototype.swap64=function(){var t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<t;e+=8)b(this,e,e+7),b(this,e+1,e+6),b(this,e+2,e+5),b(this,e+3,e+4);return this},u.prototype.toString=function(){var t=0|this.length;return 0===t?"":0===arguments.length?P(this,0,t):m.apply(this,arguments)},u.prototype.equals=function(t){if(!u.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===u.compare(this,t)},u.prototype.inspect=function(){var t="",r=e.INSPECT_MAX_BYTES;return this.length>0&&(t=this.toString("hex",0,r).match(/.{2}/g).join(" "),this.length>r&&(t+=" ... ")),"<Buffer "+t+">"},u.prototype.compare=function(t,e,r,i,n){if(!u.isBuffer(t))throw new TypeError("Argument must be a Buffer");if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===i&&(i=0),void 0===n&&(n=this.length),e<0||r>t.length||i<0||n>this.length)throw new RangeError("out of range index");if(i>=n&&e>=r)return 0;if(i>=n)return-1;if(e>=r)return 1;if(this===t)return 0;for(var s=(n>>>=0)-(i>>>=0),o=(r>>>=0)-(e>>>=0),a=Math.min(s,o),f=this.slice(i,n),h=t.slice(e,r),c=0;c<a;++c)if(f[c]!==h[c]){s=f[c],o=h[c];break}return s<o?-1:o<s?1:0},u.prototype.includes=function(t,e,r){return-1!==this.indexOf(t,e,r)},u.prototype.indexOf=function(t,e,r){return g(this,t,e,r,!0)},u.prototype.lastIndexOf=function(t,e,r){return g(this,t,e,r,!1)},u.prototype.write=function(t,e,r,i){if(void 0===e)i="utf8",r=this.length,e=0;else if(void 0===r&&"string"==typeof e)i=e,r=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e|=0,isFinite(r)?(r|=0,void 0===i&&(i="utf8")):(i=r,r=void 0)}var n=this.length-e;if((void 0===r||r>n)&&(r=n),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");for(var s=!1;;)switch(i){case"hex":return v(this,t,e,r);case"utf8":case"utf-8":return _(this,t,e,r);case"ascii":return S(this,t,e,r);case"latin1":case"binary":return w(this,t,e,r);case"base64":return I(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return E(this,t,e,r);default:if(s)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),s=!0}},u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var O=4096;function M(t,e,r){var i="";r=Math.min(t.length,r);for(var n=e;n<r;++n)i+=String.fromCharCode(127&t[n]);return i}function k(t,e,r){var i="";r=Math.min(t.length,r);for(var n=e;n<r;++n)i+=String.fromCharCode(t[n]);return i}function T(t,e,r){var i=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>i)&&(r=i);for(var n="",s=e;s<r;++s)n+=F(t[s]);return n}function R(t,e,r){for(var i=t.slice(e,r),n="",s=0;s<i.length;s+=2)n+=String.fromCharCode(i[s]+256*i[s+1]);return n}function x(t,e,r){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>r)throw new RangeError("Trying to access beyond buffer length")}function N(t,e,r,i,n,s){if(!u.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>n||e<s)throw new RangeError('"value" argument is out of bounds');if(r+i>t.length)throw new RangeError("Index out of range")}function B(t,e,r,i){e<0&&(e=65535+e+1);for(var n=0,s=Math.min(t.length-r,2);n<s;++n)t[r+n]=(e&255<<8*(i?n:1-n))>>>8*(i?n:1-n)}function U(t,e,r,i){e<0&&(e=4294967295+e+1);for(var n=0,s=Math.min(t.length-r,4);n<s;++n)t[r+n]=e>>>8*(i?n:3-n)&255}function C(t,e,r,i,n,s){if(r+i>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function L(t,e,r,i,s){return s||C(t,0,r,4),n.write(t,e,r,i,23,4),r+4}function H(t,e,r,i,s){return s||C(t,0,r,8),n.write(t,e,r,i,52,8),r+8}u.prototype.slice=function(t,e){var r,i=this.length;if((t=~~t)<0?(t+=i)<0&&(t=0):t>i&&(t=i),(e=void 0===e?i:~~e)<0?(e+=i)<0&&(e=0):e>i&&(e=i),e<t&&(e=t),u.TYPED_ARRAY_SUPPORT)(r=this.subarray(t,e)).__proto__=u.prototype;else{var n=e-t;r=new u(n,void 0);for(var s=0;s<n;++s)r[s]=this[s+t]}return r},u.prototype.readUIntLE=function(t,e,r){t|=0,e|=0,r||x(t,e,this.length);for(var i=this[t],n=1,s=0;++s<e&&(n*=256);)i+=this[t+s]*n;return i},u.prototype.readUIntBE=function(t,e,r){t|=0,e|=0,r||x(t,e,this.length);for(var i=this[t+--e],n=1;e>0&&(n*=256);)i+=this[t+--e]*n;return i},u.prototype.readUInt8=function(t,e){return e||x(t,1,this.length),this[t]},u.prototype.readUInt16LE=function(t,e){return e||x(t,2,this.length),this[t]|this[t+1]<<8},u.prototype.readUInt16BE=function(t,e){return e||x(t,2,this.length),this[t]<<8|this[t+1]},u.prototype.readUInt32LE=function(t,e){return e||x(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},u.prototype.readUInt32BE=function(t,e){return e||x(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},u.prototype.readIntLE=function(t,e,r){t|=0,e|=0,r||x(t,e,this.length);for(var i=this[t],n=1,s=0;++s<e&&(n*=256);)i+=this[t+s]*n;return i>=(n*=128)&&(i-=Math.pow(2,8*e)),i},u.prototype.readIntBE=function(t,e,r){t|=0,e|=0,r||x(t,e,this.length);for(var i=e,n=1,s=this[t+--i];i>0&&(n*=256);)s+=this[t+--i]*n;return s>=(n*=128)&&(s-=Math.pow(2,8*e)),s},u.prototype.readInt8=function(t,e){return e||x(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},u.prototype.readInt16LE=function(t,e){e||x(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt16BE=function(t,e){e||x(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt32LE=function(t,e){return e||x(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},u.prototype.readInt32BE=function(t,e){return e||x(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},u.prototype.readFloatLE=function(t,e){return e||x(t,4,this.length),n.read(this,t,!0,23,4)},u.prototype.readFloatBE=function(t,e){return e||x(t,4,this.length),n.read(this,t,!1,23,4)},u.prototype.readDoubleLE=function(t,e){return e||x(t,8,this.length),n.read(this,t,!0,52,8)},u.prototype.readDoubleBE=function(t,e){return e||x(t,8,this.length),n.read(this,t,!1,52,8)},u.prototype.writeUIntLE=function(t,e,r,i){(t=+t,e|=0,r|=0,i)||N(this,t,e,r,Math.pow(2,8*r)-1,0);var n=1,s=0;for(this[e]=255&t;++s<r&&(n*=256);)this[e+s]=t/n&255;return e+r},u.prototype.writeUIntBE=function(t,e,r,i){(t=+t,e|=0,r|=0,i)||N(this,t,e,r,Math.pow(2,8*r)-1,0);var n=r-1,s=1;for(this[e+n]=255&t;--n>=0&&(s*=256);)this[e+n]=t/s&255;return e+r},u.prototype.writeUInt8=function(t,e,r){return t=+t,e|=0,r||N(this,t,e,1,255,0),u.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=255&t,e+1},u.prototype.writeUInt16LE=function(t,e,r){return t=+t,e|=0,r||N(this,t,e,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):B(this,t,e,!0),e+2},u.prototype.writeUInt16BE=function(t,e,r){return t=+t,e|=0,r||N(this,t,e,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):B(this,t,e,!1),e+2},u.prototype.writeUInt32LE=function(t,e,r){return t=+t,e|=0,r||N(this,t,e,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t):U(this,t,e,!0),e+4},u.prototype.writeUInt32BE=function(t,e,r){return t=+t,e|=0,r||N(this,t,e,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):U(this,t,e,!1),e+4},u.prototype.writeIntLE=function(t,e,r,i){if(t=+t,e|=0,!i){var n=Math.pow(2,8*r-1);N(this,t,e,r,n-1,-n)}var s=0,o=1,a=0;for(this[e]=255&t;++s<r&&(o*=256);)t<0&&0===a&&0!==this[e+s-1]&&(a=1),this[e+s]=(t/o>>0)-a&255;return e+r},u.prototype.writeIntBE=function(t,e,r,i){if(t=+t,e|=0,!i){var n=Math.pow(2,8*r-1);N(this,t,e,r,n-1,-n)}var s=r-1,o=1,a=0;for(this[e+s]=255&t;--s>=0&&(o*=256);)t<0&&0===a&&0!==this[e+s+1]&&(a=1),this[e+s]=(t/o>>0)-a&255;return e+r},u.prototype.writeInt8=function(t,e,r){return t=+t,e|=0,r||N(this,t,e,1,127,-128),u.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=255&t,e+1},u.prototype.writeInt16LE=function(t,e,r){return t=+t,e|=0,r||N(this,t,e,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):B(this,t,e,!0),e+2},u.prototype.writeInt16BE=function(t,e,r){return t=+t,e|=0,r||N(this,t,e,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):B(this,t,e,!1),e+2},u.prototype.writeInt32LE=function(t,e,r){return t=+t,e|=0,r||N(this,t,e,4,2147483647,-2147483648),u.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):U(this,t,e,!0),e+4},u.prototype.writeInt32BE=function(t,e,r){return t=+t,e|=0,r||N(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),u.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):U(this,t,e,!1),e+4},u.prototype.writeFloatLE=function(t,e,r){return L(this,t,e,!0,r)},u.prototype.writeFloatBE=function(t,e,r){return L(this,t,e,!1,r)},u.prototype.writeDoubleLE=function(t,e,r){return H(this,t,e,!0,r)},u.prototype.writeDoubleBE=function(t,e,r){return H(this,t,e,!1,r)},u.prototype.copy=function(t,e,r,i){if(r||(r=0),i||0===i||(i=this.length),e>=t.length&&(e=t.length),e||(e=0),i>0&&i<r&&(i=r),i===r)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("sourceStart out of bounds");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),t.length-e<i-r&&(i=t.length-e+r);var n,s=i-r;if(this===t&&r<e&&e<i)for(n=s-1;n>=0;--n)t[n+e]=this[n+r];else if(s<1e3||!u.TYPED_ARRAY_SUPPORT)for(n=0;n<s;++n)t[n+e]=this[n+r];else Uint8Array.prototype.set.call(t,this.subarray(r,r+s),e);return s},u.prototype.fill=function(t,e,r,i){if("string"==typeof t){if("string"==typeof e?(i=e,e=0,r=this.length):"string"==typeof r&&(i=r,r=this.length),1===t.length){var n=t.charCodeAt(0);n<256&&(t=n)}if(void 0!==i&&"string"!=typeof i)throw new TypeError("encoding must be a string");if("string"==typeof i&&!u.isEncoding(i))throw new TypeError("Unknown encoding: "+i)}else"number"==typeof t&&(t&=255);if(e<0||this.length<e||this.length<r)throw new RangeError("Out of range index");if(r<=e)return this;var s;if(e>>>=0,r=void 0===r?this.length:r>>>0,t||(t=0),"number"==typeof t)for(s=e;s<r;++s)this[s]=t;else{var o=u.isBuffer(t)?t:K(new u(t,i).toString()),a=o.length;for(s=0;s<r-e;++s)this[s+e]=o[s%a]}return this};var D=/[^+\/0-9A-Za-z-_]/g;function F(t){return t<16?"0"+t.toString(16):t.toString(16)}function K(t,e){var r;e=e||1/0;for(var i=t.length,n=null,s=[],o=0;o<i;++o){if((r=t.charCodeAt(o))>55295&&r<57344){if(!n){if(r>56319){(e-=3)>-1&&s.push(239,191,189);continue}if(o+1===i){(e-=3)>-1&&s.push(239,191,189);continue}n=r;continue}if(r<56320){(e-=3)>-1&&s.push(239,191,189),n=r;continue}r=65536+(n-55296<<10|r-56320)}else n&&(e-=3)>-1&&s.push(239,191,189);if(n=null,r<128){if((e-=1)<0)break;s.push(r)}else if(r<2048){if((e-=2)<0)break;s.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;s.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;s.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return s}function z(t){return i.toByteArray(function(t){if((t=function(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}(t).replace(D,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function j(t,e,r,i){for(var n=0;n<i&&!(n+r>=e.length||n>=t.length);++n)e[n+r]=t[n];return n}}).call(this,r(35))},function(t,e,r){"use strict";var i={isArray:t=>Array.isArray(t),isNumber:t=>"number"==typeof t,isObject:t=>t&&"object"==typeof t,isString:t=>"string"==typeof t,isUndefined:t=>void 0===t,isFunction:t=>"function"==typeof t,isNull:t=>null===t,isDate:t=>t instanceof Date,extend:(t,e)=>Object.assign(t,e),noop:()=>{},every:(t,e)=>t.every(e||(t=>t)),map:(t,e)=>Array.from(t).map(e||(t=>t)),includes:(t,e)=>t.includes(e),each:(t,e)=>t.forEach(e),clone:t=>Object.assign({},t),pick:(t,e)=>{const r={};return e.forEach(e=>{void 0!==t[e]&&(r[e]=t[e])}),r},values:t=>Object.values(t),filter:(t,e)=>t.filter(e),reduce:(t,e,r)=>t.reduce(e,r),without:(t,e)=>t.filter(t=>t!==e),shuffle:t=>{const e=t.slice(0);for(let t=e.length-1;t>0;t--){const r=Math.floor(Math.random()*(t+1));[e[t],e[r]]=[e[r],e[t]]}return e},difference:(t,e)=>t.filter(t=>!e.includes(t)),findIndex:(t,e)=>t.findIndex(e),some:(t,e)=>t.some(e),range:t=>[...Array(t).keys()]};t.exports=i},function(t,e,r){"use strict";var i=r(7),n=r(1);t.exports={checkState:function(t,e){if(!t)throw new i.InvalidState(e)},checkArgument:function(t,e,r,n){if(!t)throw new i.InvalidArgument(e,r,n)},checkArgumentType:function(t,e,s){if(s=s||"(unknown name)",n.isString(e)){if("Buffer"===e){var o=r(0);o.Buffer;if(!o.Buffer.isBuffer(t))throw new i.InvalidArgumentType(t,e,s)}else if(typeof t!==e)throw new i.InvalidArgumentType(t,e,s)}else if(!(t instanceof e))throw new i.InvalidArgumentType(t,e.name,s)}}},function(t,e,r){"use strict";(function(e){var i=r(68),n=r(2),s=r(1),o=function(t){for(var r=e.alloc(t.length),i=0;i<t.length;i++)r[i]=t[t.length-1-i];return r};i.Zero=new i(0),i.One=new i(1),i.Minus1=new i(-1),i.fromNumber=function(t){return n.checkArgument(s.isNumber(t)),new i(t)},i.fromString=function(t,e){return n.checkArgument(s.isString(t)),new i(t,e)},i.fromBuffer=function(t,e){void 0!==e&&"little"===e.endian&&(t=o(t));var r=t.toString("hex");return new i(r,16)},i.fromSM=function(t,r){var n;if(0===t.length)return i.fromBuffer(e.from([0]));var s="big";return r&&(s=r.endian),"little"===s&&(t=o(t)),128&t[0]?(t[0]=127&t[0],(n=i.fromBuffer(t)).neg().copy(n)):n=i.fromBuffer(t),n},i.prototype.toNumber=function(){return parseInt(this.toString(10),10)},i.prototype.toBuffer=function(t){var r,n;if(t&&t.size){var s=(n=this.toString(16,2)).length/2;r=e.from(n,"hex"),s===t.size||(s>t.size?r=i.trim(r,s):s<t.size&&(r=i.pad(r,s,t.size)))}else n=this.toString(16,2),r=e.from(n,"hex");return void 0!==t&&"little"===t.endian&&(r=o(r)),r},i.prototype.toSMBigEndian=function(){var t;return-1===this.cmp(i.Zero)?128&(t=this.neg().toBuffer())[0]?t=e.concat([e.from([128]),t]):t[0]=128|t[0]:128&(t=this.toBuffer())[0]&&(t=e.concat([e.from([0]),t])),1===t.length&0===t[0]&&(t=e.from([])),t},i.prototype.toSM=function(t){var e=t?t.endian:"big",r=this.toSMBigEndian();return"little"===e&&(r=o(r)),r},i.fromScriptNumBuffer=function(t,e,r){var s=r||Number.MAX_SAFE_INTEGER;if(n.checkArgument(t.length<=s,new Error("script number overflow")),e&&t.length>0&&0==(127&t[t.length-1])&&(t.length<=1||0==(128&t[t.length-2])))throw new Error("non-minimally encoded script number");return i.fromSM(t,{endian:"little"})},i.prototype.toScriptNumBuffer=function(){return this.toSM({endian:"little"})},i.trim=function(t,e){return t.slice(e-t.length,t.length)},i.pad=function(t,r,i){for(var n=e.alloc(i),s=0;s<t.length;s++)n[n.length-1-s]=t[t.length-1-s];for(s=0;s<i-r;s++)n[s]=0;return n},i.prototype.toHex=function(...t){return this.toBuffer(...t).toString("hex")},i.fromHex=function(t,...r){return i.fromBuffer(e.from(t,"hex"),...r)},t.exports=i}).call(this,r(0).Buffer)},function(t,e,r){"use strict";(function(e){var i=r(1),n=r(2),s=function(t){return!!i.isString(t)&&/^[0-9a-fA-F]+$/.test(t)};t.exports={isValidJSON:function(t){var e;if(!i.isString(t))return!1;try{e=JSON.parse(t)}catch(t){return!1}return"object"==typeof e},isHexa:s,isHexaString:s,defineImmutable:function(t,e){return Object.keys(e).forEach((function(r){Object.defineProperty(t,r,{configurable:!1,enumerable:!0,value:e[r]})})),t},isNaturalNumber:function(t){return"number"==typeof t&&isFinite(t)&&Math.floor(t)===t&&t>=0},integerAsBuffer:function(t){n.checkArgumentType(t,"number","integer");const r=e.allocUnsafe(4);return r.writeUInt32BE(t,0),r}}}).call(this,r(0).Buffer)},function(t,e,r){(function(e){try{e||(t.exports=r(39)),e&&e.browser?t.exports=r(39):t.exports=r(89)}catch(e){console.log("'could not detect 'process', defaulting to hash.browser"),t.exports=r(39)}}).call(this,r(29))},function(t,e,r){"use strict";var i=e,n=r(10),s=r(17),o=r(46);i.assert=s,i.toArray=o.toArray,i.zero2=o.zero2,i.toHex=o.toHex,i.encode=o.encode,i.getNAF=function(t,e,r){var i=new Array(Math.max(t.bitLength(),r)+1);i.fill(0);for(var n=1<<e+1,s=t.clone(),o=0;o<i.length;o++){var a,u=s.andln(n-1);s.isOdd()?(a=u>(n>>1)-1?(n>>1)-u:u,s.isubn(a)):a=0,i[o]=a,s.iushrn(1)}return i},i.getJSF=function(t,e){var r=[[],[]];t=t.clone(),e=e.clone();for(var i,n=0,s=0;t.cmpn(-n)>0||e.cmpn(-s)>0;){var o,a,u=t.andln(3)+n&3,f=e.andln(3)+s&3;3===u&&(u=-1),3===f&&(f=-1),o=0==(1&u)?0:3!==(i=t.andln(7)+n&7)&&5!==i||2!==f?u:-u,r[0].push(o),a=0==(1&f)?0:3!==(i=e.andln(7)+s&7)&&5!==i||2!==u?f:-f,r[1].push(a),2*n===o+1&&(n=1-n),2*s===a+1&&(s=1-s),t.iushrn(1),e.iushrn(1)}return r},i.cachedProperty=function(t,e,r){var i="_"+e;t.prototype[e]=function(){return void 0!==this[i]?this[i]:this[i]=r.call(this)}},i.parseBytes=function(t){return"string"==typeof t?i.toArray(t,"hex"):t},i.intFromLE=function(t){return new n(t,"hex","le")}},function(t,e,r){"use strict";var i=r(1);function n(t,e){return t.replace("{0}",e[0]).replace("{1}",e[1]).replace("{2}",e[2])}var s=function(t,e){var r=function(){if(i.isString(e.message))this.message=n(e.message,arguments);else{if(!i.isFunction(e.message))throw new Error("Invalid error definition for "+e.name);this.message=e.message.apply(null,arguments)}this.stack=this.message+"\n"+(new Error).stack};return(r.prototype=Object.create(t.prototype)).name=t.prototype.name+e.name,t[e.name]=r,e.errors&&o(r,e.errors),r},o=function(t,e){i.each(e,(function(e){s(t,e)}))},a={Error:function(){this.message="Internal error",this.stack=this.message+"\n"+(new Error).stack}};a.Error.prototype=Object.create(Error.prototype),a.Error.prototype.name="bsv.Error";var u,f=r(69);u=a.Error,o(u,f),t.exports=a.Error,t.exports.extend=function(t){return s(a.Error,t)}},function(t,e,r){"use strict";(function(e){var i=r(3),n=r(1),s=r(2),o=r(4),a=function t(e,r){if(!(this instanceof t))return new t(e,r);if(e instanceof i)this.set({r:e,s:r});else if(e){var n=e;this.set(n)}};a.prototype.set=function(t){return this.r=t.r||this.r||void 0,this.s=t.s||this.s||void 0,this.i=void 0!==t.i?t.i:this.i,this.compressed=void 0!==t.compressed?t.compressed:this.compressed,this.nhashtype=t.nhashtype||this.nhashtype||void 0,this},a.fromCompact=function(t){s.checkArgument(e.isBuffer(t),"Argument is expected to be a Buffer");var r=new a,n=!0,o=t.slice(0,1)[0]-27-4;o<0&&(n=!1,o+=4);var u=t.slice(1,33),f=t.slice(33,65);return s.checkArgument(0===o||1===o||2===o||3===o,new Error("i must be 0, 1, 2, or 3")),s.checkArgument(32===u.length,new Error("r must be 32 bytes")),s.checkArgument(32===f.length,new Error("s must be 32 bytes")),r.compressed=n,r.i=o,r.r=i.fromBuffer(u),r.s=i.fromBuffer(f),r},a.fromDER=a.fromBuffer=function(t,e){var r=a.parseDER(t,e),i=new a;return i.r=r.r,i.s=r.s,i},a.fromTxFormat=function(t){var e=t.readUInt8(t.length-1),r=t.slice(0,t.length-1),i=a.fromDER(r,!1);return i.nhashtype=e,i},a.fromString=function(t){var r=e.from(t,"hex");return a.fromDER(r)},a.parseDER=function(t,r){s.checkArgument(e.isBuffer(t),new Error("DER formatted signature should be a buffer")),n.isUndefined(r)&&(r=!0);var o=t[0];s.checkArgument(48===o,new Error("Header byte should be 0x30"));var a=t[1],u=t.slice(2).length;s.checkArgument(!r||a===u,new Error("Length byte should length of what follows")),a=a<u?a:u;var f=t[2];s.checkArgument(2===f,new Error("Integer byte for r should be 0x02"));var h=t[3],c=t.slice(4,4+h),d=i.fromBuffer(c),p=0===t[4];s.checkArgument(h===c.length,new Error("Length of r incorrect"));var l=t[4+h+0];s.checkArgument(2===l,new Error("Integer byte for s should be 0x02"));var m=t[4+h+1],b=t.slice(4+h+2,4+h+2+m),g=i.fromBuffer(b),y=0===t[4+h+2+2];s.checkArgument(m===b.length,new Error("Length of s incorrect"));var v=4+h+2+m;return s.checkArgument(a===v-2,new Error("Length of signature incorrect")),{header:o,length:a,rheader:f,rlength:h,rneg:p,rbuf:c,r:d,sheader:l,slength:m,sneg:y,sbuf:b,s:g}},a.prototype.toCompact=function(t,r){if(t="number"==typeof t?t:this.i,r="boolean"==typeof r?r:this.compressed,0!==t&&1!==t&&2!==t&&3!==t)throw new Error("i must be equal to 0, 1, 2, or 3");var i=t+27+4;!1===r&&(i-=4);var n=e.from([i]),s=this.r.toBuffer({size:32}),o=this.s.toBuffer({size:32});return e.concat([n,s,o])},a.prototype.toBuffer=a.prototype.toDER=function(){var t=this.r.toBuffer(),r=this.s.toBuffer(),i=!!(128&t[0]),n=!!(128&r[0]),s=i?e.concat([e.from([0]),t]):t,o=n?e.concat([e.from([0]),r]):r,a=s.length,u=o.length,f=2+a+2+u;return e.concat([e.from([48,f,2,a]),s,e.from([2,u]),o])},a.prototype.toString=function(){return this.toDER().toString("hex")},a.isTxDER=function(t){if(t.length<9)return!1;if(t.length>73)return!1;if(48!==t[0])return!1;if(t[1]!==t.length-3)return!1;var e=t[3];if(5+e>=t.length)return!1;var r=t[5+e];if(e+r+7!==t.length)return!1;var i=t.slice(4);if(2!==t[2])return!1;if(0===e)return!1;if(128&i[0])return!1;if(e>1&&0===i[0]&&!(128&i[1]))return!1;var n=t.slice(6+e);return 2===t[6+e-2]&&(0!==r&&(!(128&n[0])&&!(r>1&&0===n[0]&&!(128&n[1]))))},a.prototype.hasLowS=function(){return!this.s.lt(new i(1))&&!this.s.gt(new i("7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0","hex"))},a.prototype.hasDefinedHashtype=function(){if(!o.isNaturalNumber(this.nhashtype))return!1;var t=31&this.nhashtype;return!(t<a.SIGHASH_ALL||t>a.SIGHASH_SINGLE)},a.prototype.toTxFormat=function(){var t=this.toDER(),r=e.alloc(1);return r.writeUInt8(this.nhashtype,0),e.concat([t,r])},a.SIGHASH_ALL=1,a.SIGHASH_NONE=2,a.SIGHASH_SINGLE=3,a.SIGHASH_FORKID=64,a.SIGHASH_ANYONECANPAY=128,a.ALL=65,a.NONE=66,a.SINGLE=67,a.ANYONECANPAY_ALL=193,a.ANYONECANPAY_NONE=194,a.ANYONECANPAY_SINGLE=195,t.exports=a}).call(this,r(0).Buffer)},function(t,e,r){t.exports=r(54),t.exports.Interpreter=r(55),t.exports.Stack=r(57)},function(t,e,r){(function(t){!function(t,e){"use strict";function i(t,e){if(!t)throw new Error(e||"Assertion failed")}function n(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function s(t,e,r){if(s.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(r=e,e=10),this._init(t||0,e||10,r||"be"))}var o;"object"==typeof t?t.exports=s:e.BN=s,s.BN=s,s.wordSize=26;try{o=r(71).Buffer}catch(t){}function a(t,e,r){for(var i=0,n=Math.min(t.length,r),s=e;s<n;s++){var o=t.charCodeAt(s)-48;i<<=4,i|=o>=49&&o<=54?o-49+10:o>=17&&o<=22?o-17+10:15&o}return i}function u(t,e,r,i){for(var n=0,s=Math.min(t.length,r),o=e;o<s;o++){var a=t.charCodeAt(o)-48;n*=i,n+=a>=49?a-49+10:a>=17?a-17+10:a}return n}s.isBN=function(t){return t instanceof s||null!==t&&"object"==typeof t&&t.constructor.wordSize===s.wordSize&&Array.isArray(t.words)},s.max=function(t,e){return t.cmp(e)>0?t:e},s.min=function(t,e){return t.cmp(e)<0?t:e},s.prototype._init=function(t,e,r){if("number"==typeof t)return this._initNumber(t,e,r);if("object"==typeof t)return this._initArray(t,e,r);"hex"===e&&(e=16),i(e===(0|e)&&e>=2&&e<=36);var n=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&n++,16===e?this._parseHex(t,n):this._parseBase(t,e,n),"-"===t[0]&&(this.negative=1),this.strip(),"le"===r&&this._initArray(this.toArray(),e,r)},s.prototype._initNumber=function(t,e,r){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(i(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===r&&this._initArray(this.toArray(),e,r)},s.prototype._initArray=function(t,e,r){if(i("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var n=0;n<this.length;n++)this.words[n]=0;var s,o,a=0;if("be"===r)for(n=t.length-1,s=0;n>=0;n-=3)o=t[n]|t[n-1]<<8|t[n-2]<<16,this.words[s]|=o<<a&67108863,this.words[s+1]=o>>>26-a&67108863,(a+=24)>=26&&(a-=26,s++);else if("le"===r)for(n=0,s=0;n<t.length;n+=3)o=t[n]|t[n+1]<<8|t[n+2]<<16,this.words[s]|=o<<a&67108863,this.words[s+1]=o>>>26-a&67108863,(a+=24)>=26&&(a-=26,s++);return this.strip()},s.prototype._parseHex=function(t,e){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var r=0;r<this.length;r++)this.words[r]=0;var i,n,s=0;for(r=t.length-6,i=0;r>=e;r-=6)n=a(t,r,r+6),this.words[i]|=n<<s&67108863,this.words[i+1]|=n>>>26-s&4194303,(s+=24)>=26&&(s-=26,i++);r+6!==e&&(n=a(t,e,r+6),this.words[i]|=n<<s&67108863,this.words[i+1]|=n>>>26-s&4194303),this.strip()},s.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var i=0,n=1;n<=67108863;n*=e)i++;i--,n=n/e|0;for(var s=t.length-r,o=s%i,a=Math.min(s,s-o)+r,f=0,h=r;h<a;h+=i)f=u(t,h,h+i,e),this.imuln(n),this.words[0]+f<67108864?this.words[0]+=f:this._iaddn(f);if(0!==o){var c=1;for(f=u(t,h,t.length,e),h=0;h<o;h++)c*=e;this.imuln(c),this.words[0]+f<67108864?this.words[0]+=f:this._iaddn(f)}},s.prototype.copy=function(t){t.words=new Array(this.length);for(var e=0;e<this.length;e++)t.words[e]=this.words[e];t.length=this.length,t.negative=this.negative,t.red=this.red},s.prototype.clone=function(){var t=new s(null);return this.copy(t),t},s.prototype._expand=function(t){for(;this.length<t;)this.words[this.length++]=0;return this},s.prototype.strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},s.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},s.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var f=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],h=[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],c=[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 d(t,e,r){r.negative=e.negative^t.negative;var i=t.length+e.length|0;r.length=i,i=i-1|0;var n=0|t.words[0],s=0|e.words[0],o=n*s,a=67108863&o,u=o/67108864|0;r.words[0]=a;for(var f=1;f<i;f++){for(var h=u>>>26,c=67108863&u,d=Math.min(f,e.length-1),p=Math.max(0,f-t.length+1);p<=d;p++){var l=f-p|0;h+=(o=(n=0|t.words[l])*(s=0|e.words[p])+c)/67108864|0,c=67108863&o}r.words[f]=0|c,u=0|h}return 0!==u?r.words[f]=0|u:r.length--,r.strip()}s.prototype.toString=function(t,e){var r;if(e=0|e||1,16===(t=t||10)||"hex"===t){r="";for(var n=0,s=0,o=0;o<this.length;o++){var a=this.words[o],u=(16777215&(a<<n|s)).toString(16);r=0!==(s=a>>>24-n&16777215)||o!==this.length-1?f[6-u.length]+u+r:u+r,(n+=2)>=26&&(n-=26,o--)}for(0!==s&&(r=s.toString(16)+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(t===(0|t)&&t>=2&&t<=36){var d=h[t],p=c[t];r="";var l=this.clone();for(l.negative=0;!l.isZero();){var m=l.modn(p).toString(t);r=(l=l.idivn(p)).isZero()?m+r:f[d-m.length]+m+r}for(this.isZero()&&(r="0"+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}i(!1,"Base should be between 2 and 36")},s.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&i(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},s.prototype.toJSON=function(){return this.toString(16)},s.prototype.toBuffer=function(t,e){return i(void 0!==o),this.toArrayLike(o,t,e)},s.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},s.prototype.toArrayLike=function(t,e,r){var n=this.byteLength(),s=r||Math.max(1,n);i(n<=s,"byte array longer than desired length"),i(s>0,"Requested array length <= 0"),this.strip();var o,a,u="le"===e,f=new t(s),h=this.clone();if(u){for(a=0;!h.isZero();a++)o=h.andln(255),h.iushrn(8),f[a]=o;for(;a<s;a++)f[a]=0}else{for(a=0;a<s-n;a++)f[a]=0;for(a=0;!h.isZero();a++)o=h.andln(255),h.iushrn(8),f[s-a-1]=o}return f},Math.clz32?s.prototype._countBits=function(t){return 32-Math.clz32(t)}:s.prototype._countBits=function(t){var e=t,r=0;return e>=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},s.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 0==(8191&e)&&(r+=13,e>>>=13),0==(127&e)&&(r+=7,e>>>=7),0==(15&e)&&(r+=4,e>>>=4),0==(3&e)&&(r+=2,e>>>=2),0==(1&e)&&r++,r},s.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},s.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;e<this.length;e++){var r=this._zeroBits(this.words[e]);if(t+=r,26!==r)break}return t},s.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},s.prototype.toTwos=function(t){return 0!==this.negative?this.abs().inotn(t).iaddn(1):this.clone()},s.prototype.fromTwos=function(t){return this.testn(t-1)?this.notn(t).iaddn(1).ineg():this.clone()},s.prototype.isNeg=function(){return 0!==this.negative},s.prototype.neg=function(){return this.clone().ineg()},s.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},s.prototype.iuor=function(t){for(;this.length<t.length;)this.words[this.length++]=0;for(var e=0;e<t.length;e++)this.words[e]=this.words[e]|t.words[e];return this.strip()},s.prototype.ior=function(t){return i(0==(this.negative|t.negative)),this.iuor(t)},s.prototype.or=function(t){return this.length>t.length?this.clone().ior(t):t.clone().ior(this)},s.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},s.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;r<e.length;r++)this.words[r]=this.words[r]&t.words[r];return this.length=e.length,this.strip()},s.prototype.iand=function(t){return i(0==(this.negative|t.negative)),this.iuand(t)},s.prototype.and=function(t){return this.length>t.length?this.clone().iand(t):t.clone().iand(this)},s.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},s.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var i=0;i<r.length;i++)this.words[i]=e.words[i]^r.words[i];if(this!==e)for(;i<e.length;i++)this.words[i]=e.words[i];return this.length=e.length,this.strip()},s.prototype.ixor=function(t){return i(0==(this.negative|t.negative)),this.iuxor(t)},s.prototype.xor=function(t){return this.length>t.length?this.clone().ixor(t):t.clone().ixor(this)},s.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},s.prototype.inotn=function(t){i("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),r=t%26;this._expand(e),r>0&&e--;for(var n=0;n<e;n++)this.words[n]=67108863&~this.words[n];return r>0&&(this.words[n]=~this.words[n]&67108863>>26-r),this.strip()},s.prototype.notn=function(t){return this.clone().inotn(t)},s.prototype.setn=function(t,e){i("number"==typeof t&&t>=0);var r=t/26|0,n=t%26;return this._expand(r+1),this.words[r]=e?this.words[r]|1<<n:this.words[r]&~(1<<n),this.strip()},s.prototype.iadd=function(t){var e,r,i;if(0!==this.negative&&0===t.negative)return this.negative=0,e=this.isub(t),this.negative^=1,this._normSign();if(0===this.negative&&0!==t.negative)return t.negative=0,e=this.isub(t),t.negative=1,e._normSign();this.length>t.length?(r=this,i=t):(r=t,i=this);for(var n=0,s=0;s<i.length;s++)e=(0|r.words[s])+(0|i.words[s])+n,this.words[s]=67108863&e,n=e>>>26;for(;0!==n&&s<r.length;s++)e=(0|r.words[s])+n,this.words[s]=67108863&e,n=e>>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;s<r.length;s++)this.words[s]=r.words[s];return this},s.prototype.add=function(t){var e;return 0!==t.negative&&0===this.negative?(t.negative=0,e=this.sub(t),t.negative^=1,e):0===t.negative&&0!==this.negative?(this.negative=0,e=t.sub(this),this.negative=1,e):this.length>t.length?this.clone().iadd(t):t.clone().iadd(this)},s.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,i,n=this.cmp(t);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,i=t):(r=t,i=this);for(var s=0,o=0;o<i.length;o++)s=(e=(0|r.words[o])-(0|i.words[o])+s)>>26,this.words[o]=67108863&e;for(;0!==s&&o<r.length;o++)s=(e=(0|r.words[o])+s)>>26,this.words[o]=67108863&e;if(0===s&&o<r.length&&r!==this)for(;o<r.length;o++)this.words[o]=r.words[o];return this.length=Math.max(this.length,o),r!==this&&(this.negative=1),this.strip()},s.prototype.sub=function(t){return this.clone().isub(t)};var p=function(t,e,r){var i,n,s,o=t.words,a=e.words,u=r.words,f=0,h=0|o[0],c=8191&h,d=h>>>13,p=0|o[1],l=8191&p,m=p>>>13,b=0|o[2],g=8191&b,y=b>>>13,v=0|o[3],_=8191&v,S=v>>>13,w=0|o[4],I=8191&w,E=w>>>13,A=0|o[5],P=8191&A,O=A>>>13,M=0|o[6],k=8191&M,T=M>>>13,R=0|o[7],x=8191&R,N=R>>>13,B=0|o[8],U=8191&B,C=B>>>13,L=0|o[9],H=8191&L,D=L>>>13,F=0|a[0],K=8191&F,z=F>>>13,j=0|a[1],V=8191&j,q=j>>>13,Y=0|a[2],G=8191&Y,X=Y>>>13,Z=0|a[3],W=8191&Z,J=Z>>>13,Q=0|a[4],$=8191&Q,tt=Q>>>13,et=0|a[5],rt=8191&et,it=et>>>13,nt=0|a[6],st=8191&nt,ot=nt>>>13,at=0|a[7],ut=8191&at,ft=at>>>13,ht=0|a[8],ct=8191&ht,dt=ht>>>13,pt=0|a[9],lt=8191&pt,mt=pt>>>13;r.negative=t.negative^e.negative,r.length=19;var bt=(f+(i=Math.imul(c,K))|0)+((8191&(n=(n=Math.imul(c,z))+Math.imul(d,K)|0))<<13)|0;f=((s=Math.imul(d,z))+(n>>>13)|0)+(bt>>>26)|0,bt&=67108863,i=Math.imul(l,K),n=(n=Math.imul(l,z))+Math.imul(m,K)|0,s=Math.imul(m,z);var gt=(f+(i=i+Math.imul(c,V)|0)|0)+((8191&(n=(n=n+Math.imul(c,q)|0)+Math.imul(d,V)|0))<<13)|0;f=((s=s+Math.imul(d,q)|0)+(n>>>13)|0)+(gt>>>26)|0,gt&=67108863,i=Math.imul(g,K),n=(n=Math.imul(g,z))+Math.imul(y,K)|0,s=Math.imul(y,z),i=i+Math.imul(l,V)|0,n=(n=n+Math.imul(l,q)|0)+Math.imul(m,V)|0,s=s+Math.imul(m,q)|0;var yt=(f+(i=i+Math.imul(c,G)|0)|0)+((8191&(n=(n=n+Math.imul(c,X)|0)+Math.imul(d,G)|0))<<13)|0;f=((s=s+Math.imul(d,X)|0)+(n>>>13)|0)+(yt>>>26)|0,yt&=67108863,i=Math.imul(_,K),n=(n=Math.imul(_,z))+Math.imul(S,K)|0,s=Math.imul(S,z),i=i+Math.imul(g,V)|0,n=(n=n+Math.imul(g,q)|0)+Math.imul(y,V)|0,s=s+Math.imul(y,q)|0,i=i+Math.imul(l,G)|0,n=(n=n+Math.imul(l,X)|0)+Math.imul(m,G)|0,s=s+Math.imul(m,X)|0;var vt=(f+(i=i+Math.imul(c,W)|0)|0)+((8191&(n=(n=n+Math.imul(c,J)|0)+Math.imul(d,W)|0))<<13)|0;f=((s=s+Math.imul(d,J)|0)+(n>>>13)|0)+(vt>>>26)|0,vt&=67108863,i=Math.imul(I,K),n=(n=Math.imul(I,z))+Math.imul(E,K)|0,s=Math.imul(E,z),i=i+Math.imul(_,V)|0,n=(n=n+Math.imul(_,q)|0)+Math.imul(S,V)|0,s=s+Math.imul(S,q)|0,i=i+Math.imul(g,G)|0,n=(n=n+Math.imul(g,X)|0)+Math.imul(y,G)|0,s=s+Math.imul(y,X)|0,i=i+Math.imul(l,W)|0,n=(n=n+Math.imul(l,J)|0)+Math.imul(m,W)|0,s=s+Math.imul(m,J)|0;var _t=(f+(i=i+Math.imul(c,$)|0)|0)+((8191&(n=(n=n+Math.imul(c,tt)|0)+Math.imul(d,$)|0))<<13)|0;f=((s=s+Math.imul(d,tt)|0)+(n>>>13)|0)+(_t>>>26)|0,_t&=67108863,i=Math.imul(P,K),n=(n=Math.imul(P,z))+Math.imul(O,K)|0,s=Math.imul(O,z),i=i+Math.imul(I,V)|0,n=(n=n+Math.imul(I,q)|0)+Math.imul(E,V)|0,s=s+Math.imul(E,q)|0,i=i+Math.imul(_,G)|0,n=(n=n+Math.imul(_,X)|0)+Math.imul(S,G)|0,s=s+Math.imul(S,X)|0,i=i+Math.imul(g,W)|0,n=(n=n+Math.imul(g,J)|0)+Math.imul(y,W)|0,s=s+Math.imul(y,J)|0,i=i+Math.imul(l,$)|0,n=(n=n+Math.imul(l,tt)|0)+Math.imul(m,$)|0,s=s+Math.imul(m,tt)|0;var St=(f+(i=i+Math.imul(c,rt)|0)|0)+((8191&(n=(n=n+Math.imul(c,it)|0)+Math.imul(d,rt)|0))<<13)|0;f=((s=s+Math.imul(d,it)|0)+(n>>>13)|0)+(St>>>26)|0,St&=67108863,i=Math.imul(k,K),n=(n=Math.imul(k,z))+Math.imul(T,K)|0,s=Math.imul(T,z),i=i+Math.imul(P,V)|0,n=(n=n+Math.imul(P,q)|0)+Math.imul(O,V)|0,s=s+Math.imul(O,q)|0,i=i+Math.imul(I,G)|0,n=(n=n+Math.imul(I,X)|0)+Math.imul(E,G)|0,s=s+Math.imul(E,X)|0,i=i+Math.imul(_,W)|0,n=(n=n+Math.imul(_,J)|0)+Math.imul(S,W)|0,s=s+Math.imul(S,J)|0,i=i+Math.imul(g,$)|0,n=(n=n+Math.imul(g,tt)|0)+Math.imul(y,$)|0,s=s+Math.imul(y,tt)|0,i=i+Math.imul(l,rt)|0,n=(n=n+Math.imul(l,it)|0)+Math.imul(m,rt)|0,s=s+Math.imul(m,it)|0;var wt=(f+(i=i+Math.imul(c,st)|0)|0)+((8191&(n=(n=n+Math.imul(c,ot)|0)+Math.imul(d,st)|0))<<13)|0;f=((s=s+Math.imul(d,ot)|0)+(n>>>13)|0)+(wt>>>26)|0,wt&=67108863,i=Math.imul(x,K),n=(n=Math.imul(x,z))+Math.imul(N,K)|0,s=Math.imul(N,z),i=i+Math.imul(k,V)|0,n=(n=n+Math.imul(k,q)|0)+Math.imul(T,V)|0,s=s+Math.imul(T,q)|0,i=i+Math.imul(P,G)|0,n=(n=n+Math.imul(P,X)|0)+Math.imul(O,G)|0,s=s+Math.imul(O,X)|0,i=i+Math.imul(I,W)|0,n=(n=n+Math.imul(I,J)|0)+Math.imul(E,W)|0,s=s+Math.imul(E,J)|0,i=i+Math.imul(_,$)|0,n=(n=n+Math.imul(_,tt)|0)+Math.imul(S,$)|0,s=s+Math.imul(S,tt)|0,i=i+Math.imul(g,rt)|0,n=(n=n+Math.imul(g,it)|0)+Math.imul(y,rt)|0,s=s+Math.imul(y,it)|0,i=i+Math.imul(l,st)|0,n=(n=n+Math.imul(l,ot)|0)+Math.imul(m,st)|0,s=s+Math.imul(m,ot)|0;var It=(f+(i=i+Math.imul(c,ut)|0)|0)+((8191&(n=(n=n+Math.imul(c,ft)|0)+Math.imul(d,ut)|0))<<13)|0;f=((s=s+Math.imul(d,ft)|0)+(n>>>13)|0)+(It>>>26)|0,It&=67108863,i=Math.imul(U,K),n=(n=Math.imul(U,z))+Math.imul(C,K)|0,s=Math.imul(C,z),i=i+Math.imul(x,V)|0,n=(n=n+Math.imul(x,q)|0)+Math.imul(N,V)|0,s=s+Math.imul(N,q)|0,i=i+Math.imul(k,G)|0,n=(n=n+Math.imul(k,X)|0)+Math.imul(T,G)|0,s=s+Math.imul(T,X)|0,i=i+Math.imul(P,W)|0,n=(n=n+Math.imul(P,J)|0)+Math.imul(O,W)|0,s=s+Math.imul(O,J)|0,i=i+Math.imul(I,$)|0,n=(n=n+Math.imul(I,tt)|0)+Math.imul(E,$)|0,s=s+Math.imul(E,tt)|0,i=i+Math.imul(_,rt)|0,n=(n=n+Math.imul(_,it)|0)+Math.imul(S,rt)|0,s=s+Math.imul(S,it)|0,i=i+Math.imul(g,st)|0,n=(n=n+Math.imul(g,ot)|0)+Math.imul(y,st)|0,s=s+Math.imul(y,ot)|0,i=i+Math.imul(l,ut)|0,n=(n=n+Math.imul(l,ft)|0)+Math.imul(m,ut)|0,s=s+Math.imul(m,ft)|0;var Et=(f+(i=i+Math.imul(c,ct)|0)|0)+((8191&(n=(n=n+Math.imul(c,dt)|0)+Math.imul(d,ct)|0))<<13)|0;f=((s=s+Math.imul(d,dt)|0)+(n>>>13)|0)+(Et>>>26)|0,Et&=67108863,i=Math.imul(H,K),n=(n=Math.imul(H,z))+Math.imul(D,K)|0,s=Math.imul(D,z),i=i+Math.imul(U,V)|0,n=(n=n+Math.imul(U,q)|0)+Math.imul(C,V)|0,s=s+Math.imul(C,q)|0,i=i+Math.imul(x,G)|0,n=(n=n+Math.imul(x,X)|0)+Math.imul(N,G)|0,s=s+Math.imul(N,X)|0,i=i+Math.imul(k,W)|0,n=(n=n+Math.imul(k,J)|0)+Math.imul(T,W)|0,s=s+Math.imul(T,J)|0,i=i+Math.imul(P,$)|0,n=(n=n+Math.imul(P,tt)|0)+Math.imul(O,$)|0,s=s+Math.imul(O,tt)|0,i=i+Math.imul(I,rt)|0,n=(n=n+Math.imul(I,it)|0)+Math.imul(E,rt)|0,s=s+Math.imul(E,it)|0,i=i+Math.imul(_,st)|0,n=(n=n+Math.imul(_,ot)|0)+Math.imul(S,st)|0,s=s+Math.imul(S,ot)|0,i=i+Math.imul(g,ut)|0,n=(n=n+Math.imul(g,ft)|0)+Math.imul(y,ut)|0,s=s+Math.imul(y,ft)|0,i=i+Math.imul(l,ct)|0,n=(n=n+Math.imul(l,dt)|0)+Math.imul(m,ct)|0,s=s+Math.imul(m,dt)|0;var At=(f+(i=i+Math.imul(c,lt)|0)|0)+((8191&(n=(n=n+Math.imul(c,mt)|0)+Math.imul(d,lt)|0))<<13)|0;f=((s=s+Math.imul(d,mt)|0)+(n>>>13)|0)+(At>>>26)|0,At&=67108863,i=Math.imul(H,V),n=(n=Math.imul(H,q))+Math.imul(D,V)|0,s=Math.imul(D,q),i=i+Math.imul(U,G)|0,n=(n=n+Math.imul(U,X)|0)+Math.imul(C,G)|0,s=s+Math.imul(C,X)|0,i=i+Math.imul(x,W)|0,n=(n=n+Math.imul(x,J)|0)+Math.imul(N,W)|0,s=s+Math.imul(N,J)|0,i=i+Math.imul(k,$)|0,n=(n=n+Math.imul(k,tt)|0)+Math.imul(T,$)|0,s=s+Math.imul(T,tt)|0,i=i+Math.imul(P,rt)|0,n=(n=n+Math.imul(P,it)|0)+Math.imul(O,rt)|0,s=s+Math.imul(O,it)|0,i=i+Math.imul(I,st)|0,n=(n=n+Math.imul(I,ot)|0)+Math.imul(E,st)|0,s=s+Math.imul(E,ot)|0,i=i+Math.imul(_,ut)|0,n=(n=n+Math.imul(_,ft)|0)+Math.imul(S,ut)|0,s=s+Math.imul(S,ft)|0,i=i+Math.imul(g,ct)|0,n=(n=n+Math.imul(g,dt)|0)+Math.imul(y,ct)|0,s=s+Math.imul(y,dt)|0;var Pt=(f+(i=i+Math.imul(l,lt)|0)|0)+((8191&(n=(n=n+Math.imul(l,mt)|0)+Math.imul(m,lt)|0))<<13)|0;f=((s=s+Math.imul(m,mt)|0)+(n>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,i=Math.imul(H,G),n=(n=Math.imul(H,X))+Math.imul(D,G)|0,s=Math.imul(D,X),i=i+Math.imul(U,W)|0,n=(n=n+Math.imul(U,J)|0)+Math.imul(C,W)|0,s=s+Math.imul(C,J)|0,i=i+Math.imul(x,$)|0,n=(n=n+Math.imul(x,tt)|0)+Math.imul(N,$)|0,s=s+Math.imul(N,tt)|0,i=i+Math.imul(k,rt)|0,n=(n=n+Math.imul(k,it)|0)+Math.imul(T,rt)|0,s=s+Math.imul(T,it)|0,i=i+Math.imul(P,st)|0,n=(n=n+Math.imul(P,ot)|0)+Math.imul(O,st)|0,s=s+Math.imul(O,ot)|0,i=i+Math.imul(I,ut)|0,n=(n=n+Math.imul(I,ft)|0)+Math.imul(E,ut)|0,s=s+Math.imul(E,ft)|0,i=i+Math.imul(_,ct)|0,n=(n=n+Math.imul(_,dt)|0)+Math.imul(S,ct)|0,s=s+Math.imul(S,dt)|0;var Ot=(f+(i=i+Math.imul(g,lt)|0)|0)+((8191&(n=(n=n+Math.imul(g,mt)|0)+Math.imul(y,lt)|0))<<13)|0;f=((s=s+Math.imul(y,mt)|0)+(n>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,i=Math.imul(H,W),n=(n=Math.imul(H,J))+Math.imul(D,W)|0,s=Math.imul(D,J),i=i+Math.imul(U,$)|0,n=(n=n+Math.imul(U,tt)|0)+Math.imul(C,$)|0,s=s+Math.imul(C,tt)|0,i=i+Math.imul(x,rt)|0,n=(n=n+Math.imul(x,it)|0)+Math.imul(N,rt)|0,s=s+Math.imul(N,it)|0,i=i+Math.imul(k,st)|0,n=(n=n+Math.imul(k,ot)|0)+Math.imul(T,st)|0,s=s+Math.imul(T,ot)|0,i=i+Math.imul(P,ut)|0,n=(n=n+Math.imul(P,ft)|0)+Math.imul(O,ut)|0,s=s+Math.imul(O,ft)|0,i=i+Math.imul(I,ct)|0,n=(n=n+Math.imul(I,dt)|0)+Math.imul(E,ct)|0,s=s+Math.imul(E,dt)|0;var Mt=(f+(i=i+Math.imul(_,lt)|0)|0)+((8191&(n=(n=n+Math.imul(_,mt)|0)+Math.imul(S,lt)|0))<<13)|0;f=((s=s+Math.imul(S,mt)|0)+(n>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,i=Math.imul(H,$),n=(n=Math.imul(H,tt))+Math.imul(D,$)|0,s=Math.imul(D,tt),i=i+Math.imul(U,rt)|0,n=(n=n+Math.imul(U,it)|0)+Math.imul(C,rt)|0,s=s+Math.imul(C,it)|0,i=i+Math.imul(x,st)|0,n=(n=n+Math.imul(x,ot)|0)+Math.imul(N,st)|0,s=s+Math.imul(N,ot)|0,i=i+Math.imul(k,ut)|0,n=(n=n+Math.imul(k,ft)|0)+Math.imul(T,ut)|0,s=s+Math.imul(T,ft)|0,i=i+Math.imul(P,ct)|0,n=(n=n+Math.imul(P,dt)|0)+Math.imul(O,ct)|0,s=s+Math.imul(O,dt)|0;var kt=(f+(i=i+Math.imul(I,lt)|0)|0)+((8191&(n=(n=n+Math.imul(I,mt)|0)+Math.imul(E,lt)|0))<<13)|0;f=((s=s+Math.imul(E,mt)|0)+(n>>>13)|0)+(kt>>>26)|0,kt&=67108863,i=Math.imul(H,rt),n=(n=Math.imul(H,it))+Math.imul(D,rt)|0,s=Math.imul(D,it),i=i+Math.imul(U,st)|0,n=(n=n+Math.imul(U,ot)|0)+Math.imul(C,st)|0,s=s+Math.imul(C,ot)|0,i=i+Math.imul(x,ut)|0,n=(n=n+Math.imul(x,ft)|0)+Math.imul(N,ut)|0,s=s+Math.imul(N,ft)|0,i=i+Math.imul(k,ct)|0,n=(n=n+Math.imul(k,dt)|0)+Math.imul(T,ct)|0,s=s+Math.imul(T,dt)|0;var Tt=(f+(i=i+Math.imul(P,lt)|0)|0)+((8191&(n=(n=n+Math.imul(P,mt)|0)+Math.imul(O,lt)|0))<<13)|0;f=((s=s+Math.imul(O,mt)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,i=Math.imul(H,st),n=(n=Math.imul(H,ot))+Math.imul(D,st)|0,s=Math.imul(D,ot),i=i+Math.imul(U,ut)|0,n=(n=n+Math.imul(U,ft)|0)+Math.imul(C,ut)|0,s=s+Math.imul(C,ft)|0,i=i+Math.imul(x,ct)|0,n=(n=n+Math.imul(x,dt)|0)+Math.imul(N,ct)|0,s=s+Math.imul(N,dt)|0;var Rt=(f+(i=i+Math.imul(k,lt)|0)|0)+((8191&(n=(n=n+Math.imul(k,mt)|0)+Math.imul(T,lt)|0))<<13)|0;f=((s=s+Math.imul(T,mt)|0)+(n>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,i=Math.imul(H,ut),n=(n=Math.imul(H,ft))+Math.imul(D,ut)|0,s=Math.imul(D,ft),i=i+Math.imul(U,ct)|0,n=(n=n+Math.imul(U,dt)|0)+Math.imul(C,ct)|0,s=s+Math.imul(C,dt)|0;var xt=(f+(i=i+Math.imul(x,lt)|0)|0)+((8191&(n=(n=n+Math.imul(x,mt)|0)+Math.imul(N,lt)|0))<<13)|0;f=((s=s+Math.imul(N,mt)|0)+(n>>>13)|0)+(xt>>>26)|0,xt&=67108863,i=Math.imul(H,ct),n=(n=Math.imul(H,dt))+Math.imul(D,ct)|0,s=Math.imul(D,dt);var Nt=(f+(i=i+Math.imul(U,lt)|0)|0)+((8191&(n=(n=n+Math.imul(U,mt)|0)+Math.imul(C,lt)|0))<<13)|0;f=((s=s+Math.imul(C,mt)|0)+(n>>>13)|0)+(Nt>>>26)|0,Nt&=67108863;var Bt=(f+(i=Math.imul(H,lt))|0)+((8191&(n=(n=Math.imul(H,mt))+Math.imul(D,lt)|0))<<13)|0;return f=((s=Math.imul(D,mt))+(n>>>13)|0)+(Bt>>>26)|0,Bt&=67108863,u[0]=bt,u[1]=gt,u[2]=yt,u[3]=vt,u[4]=_t,u[5]=St,u[6]=wt,u[7]=It,u[8]=Et,u[9]=At,u[10]=Pt,u[11]=Ot,u[12]=Mt,u[13]=kt,u[14]=Tt,u[15]=Rt,u[16]=xt,u[17]=Nt,u[18]=Bt,0!==f&&(u[19]=f,r.length++),r};function l(t,e,r){return(new m).mulp(t,e,r)}function m(t,e){this.x=t,this.y=e}Math.imul||(p=d),s.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?p(this,t,e):r<63?d(this,t,e):r<1024?function(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var i=0,n=0,s=0;s<r.length-1;s++){var o=n;n=0;for(var a=67108863&i,u=Math.min(s,e.length-1),f=Math.max(0,s-t.length+1);f<=u;f++){var h=s-f,c=(0|t.words[h])*(0|e.words[f]),d=67108863&c;a=67108863&(d=d+a|0),n+=(o=(o=o+(c/67108864|0)|0)+(d>>>26)|0)>>>26,o&=67108863}r.words[s]=a,i=o,o=n}return 0!==i?r.words[s]=i:r.length--,r.strip()}(this,t,e):l(this,t,e)},m.prototype.makeRBT=function(t){for(var e=new Array(t),r=s.prototype._countBits(t)-1,i=0;i<t;i++)e[i]=this.revBin(i,r,t);return e},m.prototype.revBin=function(t,e,r){if(0===t||t===r-1)return t;for(var i=0,n=0;n<e;n++)i|=(1&t)<<e-n-1,t>>=1;return i},m.prototype.permute=function(t,e,r,i,n,s){for(var o=0;o<s;o++)i[o]=e[t[o]],n[o]=r[t[o]]},m.prototype.transform=function(t,e,r,i,n,s){this.permute(s,t,e,r,i,n);for(var o=1;o<n;o<<=1)for(var a=o<<1,u=Math.cos(2*Math.PI/a),f=Math.sin(2*Math.PI/a),h=0;h<n;h+=a)for(var c=u,d=f,p=0;p<o;p++){var l=r[h+p],m=i[h+p],b=r[h+p+o],g=i[h+p+o],y=c*b-d*g;g=c*g+d*b,b=y,r[h+p]=l+b,i[h+p]=m+g,r[h+p+o]=l-b,i[h+p+o]=m-g,p!==a&&(y=u*c-f*d,d=u*d+f*c,c=y)}},m.prototype.guessLen13b=function(t,e){var r=1|Math.max(e,t),i=1&r,n=0;for(r=r/2|0;r;r>>>=1)n++;return 1<<n+1+i},m.prototype.conjugate=function(t,e,r){if(!(r<=1))for(var i=0;i<r/2;i++){var n=t[i];t[i]=t[r-i-1],t[r-i-1]=n,n=e[i],e[i]=-e[r-i-1],e[r-i-1]=-n}},m.prototype.normalize13b=function(t,e){for(var r=0,i=0;i<e/2;i++){var n=8192*Math.round(t[2*i+1]/e)+Math.round(t[2*i]/e)+r;t[i]=67108863&n,r=n<67108864?0:n/67108864|0}return t},m.prototype.convert13b=function(t,e,r,n){for(var s=0,o=0;o<e;o++)s+=0|t[o],r[2*o]=8191&s,s>>>=13,r[2*o+1]=8191&s,s>>>=13;for(o=2*e;o<n;++o)r[o]=0;i(0===s),i(0==(-8192&s))},m.prototype.stub=function(t){for(var e=new Array(t),r=0;r<t;r++)e[r]=0;return e},m.prototype.mulp=function(t,e,r){var i=2*this.guessLen13b(t.length,e.length),n=this.makeRBT(i),s=this.stub(i),o=new Array(i),a=new Array(i),u=new Array(i),f=new Array(i),h=new Array(i),c=new Array(i),d=r.words;d.length=i,this.convert13b(t.words,t.length,o,i),this.convert13b(e.words,e.length,f,i),this.transform(o,s,a,u,i,n),this.transform(f,s,h,c,i,n);for(var p=0;p<i;p++){var l=a[p]*h[p]-u[p]*c[p];u[p]=a[p]*c[p]+u[p]*h[p],a[p]=l}return this.conjugate(a,u,i),this.transform(a,u,d,s,i,n),this.conjugate(d,s,i),this.normalize13b(d,i),r.negative=t.negative^e.negative,r.length=t.length+e.length,r.strip()},s.prototype.mul=function(t){var e=new s(null);return e.words=new Array(this.length+t.length),this.mulTo(t,e)},s.prototype.mulf=function(t){var e=new s(null);return e.words=new Array(this.length+t.length),l(this,t,e)},s.prototype.imul=function(t){return this.clone().mulTo(t,this)},s.prototype.imuln=function(t){i("number"==typeof t),i(t<67108864);for(var e=0,r=0;r<this.length;r++){var n=(0|this.words[r])*t,s=(67108863&n)+(67108863&e);e>>=26,e+=n/67108864|0,e+=s>>>26,this.words[r]=67108863&s}return 0!==e&&(this.words[r]=e,this.length++),this},s.prototype.muln=function(t){return this.clone().imuln(t)},s.prototype.sqr=function(){return this.mul(this)},s.prototype.isqr=function(){return this.imul(this.clone())},s.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r<e.length;r++){var i=r/26|0,n=r%26;e[r]=(t.words[i]&1<<n)>>>n}return e}(t);if(0===e.length)return new s(1);for(var r=this,i=0;i<e.length&&0===e[i];i++,r=r.sqr());if(++i<e.length)for(var n=r.sqr();i<e.length;i++,n=n.sqr())0!==e[i]&&(r=r.mul(n));return r},s.prototype.iushln=function(t){i("number"==typeof t&&t>=0);var e,r=t%26,n=(t-r)/26,s=67108863>>>26-r<<26-r;if(0!==r){var o=0;for(e=0;e<this.length;e++){var a=this.words[e]&s,u=(0|this.words[e])-a<<r;this.words[e]=u|o,o=a>>>26-r}o&&(this.words[e]=o,this.length++)}if(0!==n){for(e=this.length-1;e>=0;e--)this.words[e+n]=this.words[e];for(e=0;e<n;e++)this.words[e]=0;this.length+=n}return this.strip()},s.prototype.ishln=function(t){return i(0===this.negative),this.iushln(t)},s.prototype.iushrn=function(t,e,r){var n;i("number"==typeof t&&t>=0),n=e?(e-e%26)/26:0;var s=t%26,o=Math.min((t-s)/26,this.length),a=67108863^67108863>>>s<<s,u=r;if(n-=o,n=Math.max(0,n),u){for(var f=0;f<o;f++)u.words[f]=this.words[f];u.length=o}if(0===o);else if(this.length>o)for(this.length-=o,f=0;f<this.length;f++)this.words[f]=this.words[f+o];else this.words[0]=0,this.length=1;var h=0;for(f=this.length-1;f>=0&&(0!==h||f>=n);f--){var c=0|this.words[f];this.words[f]=h<<26-s|c>>>s,h=c&a}return u&&0!==h&&(u.words[u.length++]=h),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},s.prototype.ishrn=function(t,e,r){return i(0===this.negative),this.iushrn(t,e,r)},s.prototype.shln=function(t){return this.clone().ishln(t)},s.prototype.ushln=function(t){return this.clone().iushln(t)},s.prototype.shrn=function(t){return this.clone().ishrn(t)},s.prototype.ushrn=function(t){return this.clone().iushrn(t)},s.prototype.testn=function(t){i("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26,n=1<<e;return!(this.length<=r)&&!!(this.words[r]&n)},s.prototype.imaskn=function(t){i("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26;if(i(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==e&&r++,this.length=Math.min(r,this.length),0!==e){var n=67108863^67108863>>>e<<e;this.words[this.length-1]&=n}return this.strip()},s.prototype.maskn=function(t){return this.clone().imaskn(t)},s.prototype.iaddn=function(t){return i("number"==typeof t),i(t<67108864),t<0?this.isubn(-t):0!==this.negative?1===this.length&&(0|this.words[0])<t?(this.words[0]=t-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(t),this.negative=1,this):this._iaddn(t)},s.prototype._iaddn=function(t){this.words[0]+=t;for(var e=0;e<this.length&&this.words[e]>=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},s.prototype.isubn=function(t){if(i("number"==typeof t),i(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e<this.length&&this.words[e]<0;e++)this.words[e]+=67108864,this.words[e+1]-=1;return this.strip()},s.prototype.addn=function(t){return this.clone().iaddn(t)},s.prototype.subn=function(t){return this.clone().isubn(t)},s.prototype.iabs=function(){return this.negative=0,this},s.prototype.abs=function(){return this.clone().iabs()},s.prototype._ishlnsubmul=function(t,e,r){var n,s,o=t.length+r;this._expand(o);var a=0;for(n=0;n<t.length;n++){s=(0|this.words[n+r])+a;var u=(0|t.words[n])*e;a=((s-=67108863&u)>>26)-(u/67108864|0),this.words[n+r]=67108863&s}for(;n<this.length-r;n++)a=(s=(0|this.words[n+r])+a)>>26,this.words[n+r]=67108863&s;if(0===a)return this.strip();for(i(-1===a),a=0,n=0;n<this.length;n++)a=(s=-(0|this.words[n])+a)>>26,this.words[n]=67108863&s;return this.negative=1,this.strip()},s.prototype._wordDiv=function(t,e){var r=(this.length,t.length),i=this.clone(),n=t,o=0|n.words[n.length-1];0!==(r=26-this._countBits(o))&&(n=n.ushln(r),i.iushln(r),o=0|n.words[n.length-1]);var a,u=i.length-n.length;if("mod"!==e){(a=new s(null)).length=u+1,a.words=new Array(a.length);for(var f=0;f<a.length;f++)a.words[f]=0}var h=i.clone()._ishlnsubmul(n,1,u);0===h.negative&&(i=h,a&&(a.words[u]=1));for(var c=u-1;c>=0;c--){var d=67108864*(0|i.words[n.length+c])+(0|i.words[n.length+c-1]);for(d=Math.min(d/o|0,67108863),i._ishlnsubmul(n,d,c);0!==i.negative;)d--,i.negative=0,i._ishlnsubmul(n,1,c),i.isZero()||(i.negative^=1);a&&(a.words[c]=d)}return a&&a.strip(),i.strip(),"div"!==e&&0!==r&&i.iushrn(r),{div:a||null,mod:i}},s.prototype.divmod=function(t,e,r){return i(!t.isZero()),this.isZero()?{div:new s(0),mod:new s(0)}:0!==this.negative&&0===t.negative?(a=this.neg().divmod(t,e),"mod"!==e&&(n=a.div.neg()),"div"!==e&&(o=a.mod.neg(),r&&0!==o.negative&&o.iadd(t)),{div:n,mod:o}):0===this.negative&&0!==t.negative?(a=this.divmod(t.neg(),e),"mod"!==e&&(n=a.div.neg()),{div:n,mod:a.mod}):0!=(this.negative&t.negative)?(a=this.neg().divmod(t.neg(),e),"div"!==e&&(o=a.mod.neg(),r&&0!==o.negative&&o.isub(t)),{div:a.div,mod:o}):t.length>this.length||this.cmp(t)<0?{div:new s(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new s(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new s(this.modn(t.words[0]))}:this._wordDiv(t,e);var n,o,a},s.prototype.div=function(t){return this.divmod(t,"div",!1).div},s.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},s.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},s.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,i=t.ushrn(1),n=t.andln(1),s=r.cmp(i);return s<0||1===n&&0===s?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},s.prototype.modn=function(t){i(t<=67108863);for(var e=(1<<26)%t,r=0,n=this.length-1;n>=0;n--)r=(e*r+(0|this.words[n]))%t;return r},s.prototype.idivn=function(t){i(t<=67108863);for(var e=0,r=this.length-1;r>=0;r--){var n=(0|this.words[r])+67108864*e;this.words[r]=n/t|0,e=n%t}return this.strip()},s.prototype.divn=function(t){return this.clone().idivn(t)},s.prototype.egcd=function(t){i(0===t.negative),i(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var n=new s(1),o=new s(0),a=new s(0),u=new s(1),f=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++f;for(var h=r.clone(),c=e.clone();!e.isZero();){for(var d=0,p=1;0==(e.words[0]&p)&&d<26;++d,p<<=1);if(d>0)for(e.iushrn(d);d-- >0;)(n.isOdd()||o.isOdd())&&(n.iadd(h),o.isub(c)),n.iushrn(1),o.iushrn(1);for(var l=0,m=1;0==(r.words[0]&m)&&l<26;++l,m<<=1);if(l>0)for(r.iushrn(l);l-- >0;)(a.isOdd()||u.isOdd())&&(a.iadd(h),u.isub(c)),a.iushrn(1),u.iushrn(1);e.cmp(r)>=0?(e.isub(r),n.isub(a),o.isub(u)):(r.isub(e),a.isub(n),u.isub(o))}return{a:a,b:u,gcd:r.iushln(f)}},s.prototype._invmp=function(t){i(0===t.negative),i(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var n,o=new s(1),a=new s(0),u=r.clone();e.cmpn(1)>0&&r.cmpn(1)>0;){for(var f=0,h=1;0==(e.words[0]&h)&&f<26;++f,h<<=1);if(f>0)for(e.iushrn(f);f-- >0;)o.isOdd()&&o.iadd(u),o.iushrn(1);for(var c=0,d=1;0==(r.words[0]&d)&&c<26;++c,d<<=1);if(c>0)for(r.iushrn(c);c-- >0;)a.isOdd()&&a.iadd(u),a.iushrn(1);e.cmp(r)>=0?(e.isub(r),o.isub(a)):(r.isub(e),a.isub(o))}return(n=0===e.cmpn(1)?o:a).cmpn(0)<0&&n.iadd(t),n},s.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var i=0;e.isEven()&&r.isEven();i++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=e.cmp(r);if(n<0){var s=e;e=r,r=s}else if(0===n||0===r.cmpn(1))break;e.isub(r)}return r.iushln(i)},s.prototype.invm=function(t){return this.egcd(t).a.umod(t)},s.prototype.isEven=function(){return 0==(1&this.words[0])},s.prototype.isOdd=function(){return 1==(1&this.words[0])},s.prototype.andln=function(t){return this.words[0]&t},s.prototype.bincn=function(t){i("number"==typeof t);var e=t%26,r=(t-e)/26,n=1<<e;if(this.length<=r)return this._expand(r+1),this.words[r]|=n,this;for(var s=n,o=r;0!==s&&o<this.length;o++){var a=0|this.words[o];s=(a+=s)>>>26,a&=67108863,this.words[o]=a}return 0!==s&&(this.words[o]=s,this.length++),this},s.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},s.prototype.cmpn=function(t){var e,r=t<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this.strip(),this.length>1)e=1;else{r&&(t=-t),i(t<=67108863,"Number is too big");var n=0|this.words[0];e=n===t?0:n<t?-1:1}return 0!==this.negative?0|-e:e},s.prototype.cmp=function(t){if(0!==this.negative&&0===t.negative)return-1;if(0===this.negative&&0!==t.negative)return 1;var e=this.ucmp(t);return 0!==this.negative?0|-e:e},s.prototype.ucmp=function(t){if(this.length>t.length)return 1;if(this.length<t.length)return-1;for(var e=0,r=this.length-1;r>=0;r--){var i=0|this.words[r],n=0|t.words[r];if(i!==n){i<n?e=-1:i>n&&(e=1);break}}return e},s.prototype.gtn=function(t){return 1===this.cmpn(t)},s.prototype.gt=function(t){return 1===this.cmp(t)},s.prototype.gten=function(t){return this.cmpn(t)>=0},s.prototype.gte=function(t){return this.cmp(t)>=0},s.prototype.ltn=function(t){return-1===this.cmpn(t)},s.prototype.lt=function(t){return-1===this.cmp(t)},s.prototype.lten=function(t){return this.cmpn(t)<=0},s.prototype.lte=function(t){return this.cmp(t)<=0},s.prototype.eqn=function(t){return 0===this.cmpn(t)},s.prototype.eq=function(t){return 0===this.cmp(t)},s.red=function(t){return new w(t)},s.prototype.toRed=function(t){return i(!this.red,"Already a number in reduction context"),i(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},s.prototype.fromRed=function(){return i(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},s.prototype._forceRed=function(t){return this.red=t,this},s.prototype.forceRed=function(t){return i(!this.red,"Already a number in reduction context"),this._forceRed(t)},s.prototype.redAdd=function(t){return i(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},s.prototype.redIAdd=function(t){return i(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},s.prototype.redSub=function(t){return i(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},s.prototype.redISub=function(t){return i(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},s.prototype.redShl=function(t){return i(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},s.prototype.redMul=function(t){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},s.prototype.redIMul=function(t){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},s.prototype.redSqr=function(){return i(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},s.prototype.redISqr=function(){return i(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},s.prototype.redSqrt=function(){return i(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},s.prototype.redInvm=function(){return i(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},s.prototype.redNeg=function(){return i(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},s.prototype.redPow=function(t){return i(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var b={k256:null,p224:null,p192:null,p25519:null};function g(t,e){this.name=t,this.p=new s(e,16),this.n=this.p.bitLength(),this.k=new s(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function y(){g.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function v(){g.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function _(){g.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function S(){g.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function w(t){if("string"==typeof t){var e=s._prime(t);this.m=e.p,this.prime=e}else i(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function I(t){w.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new s(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)}g.prototype._tmp=function(){var t=new s(null);return t.words=new Array(Math.ceil(this.n/13)),t},g.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(e>this.n);var i=e<this.n?-1:r.ucmp(this.p);return 0===i?(r.words[0]=0,r.length=1):i>0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},g.prototype.split=function(t,e){t.iushrn(this.n,0,e)},g.prototype.imulK=function(t){return t.imul(this.k)},n(y,g),y.prototype.split=function(t,e){for(var r=Math.min(t.length,9),i=0;i<r;i++)e.words[i]=t.words[i];if(e.length=r,t.length<=9)return t.words[0]=0,void(t.length=1);var n=t.words[9];for(e.words[e.length++]=4194303&n,i=10;i<t.length;i++){var s=0|t.words[i];t.words[i-10]=(4194303&s)<<4|n>>>22,n=s}n>>>=22,t.words[i-10]=n,0===n&&t.length>10?t.length-=10:t.length-=9},y.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r<t.length;r++){var i=0|t.words[r];e+=977*i,t.words[r]=67108863&e,e=64*i+(e/67108864|0)}return 0===t.words[t.length-1]&&(t.length--,0===t.words[t.length-1]&&t.length--),t},n(v,g),n(_,g),n(S,g),S.prototype.imulK=function(t){for(var e=0,r=0;r<t.length;r++){var i=19*(0|t.words[r])+e,n=67108863&i;i>>>=26,t.words[r]=n,e=i}return 0!==e&&(t.words[t.length++]=e),t},s._prime=function(t){if(b[t])return b[t];var e;if("k256"===t)e=new y;else if("p224"===t)e=new v;else if("p192"===t)e=new _;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new S}return b[t]=e,e},w.prototype._verify1=function(t){i(0===t.negative,"red works only with positives"),i(t.red,"red works only with red numbers")},w.prototype._verify2=function(t,e){i(0==(t.negative|e.negative),"red works only with positives"),i(t.red&&t.red===e.red,"red works only with red numbers")},w.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},w.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},w.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},w.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},w.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},w.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},w.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},w.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},w.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},w.prototype.isqr=function(t){return this.imul(t,t.clone())},w.prototype.sqr=function(t){return this.mul(t,t)},w.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(i(e%2==1),3===e){var r=this.m.add(new s(1)).iushrn(2);return this.pow(t,r)}for(var n=this.m.subn(1),o=0;!n.isZero()&&0===n.andln(1);)o++,n.iushrn(1);i(!n.isZero());var a=new s(1).toRed(this),u=a.redNeg(),f=this.m.subn(1).iushrn(1),h=this.m.bitLength();for(h=new s(2*h*h).toRed(this);0!==this.pow(h,f).cmp(u);)h.redIAdd(u);for(var c=this.pow(h,n),d=this.pow(t,n.addn(1).iushrn(1)),p=this.pow(t,n),l=o;0!==p.cmp(a);){for(var m=p,b=0;0!==m.cmp(a);b++)m=m.redSqr();i(b<l);var g=this.pow(c,new s(1).iushln(l-b-1));d=d.redMul(g),c=g.redSqr(),p=p.redMul(c),l=b}return d},w.prototype.invm=function(t){var e=t._invmp(this.m);return 0!==e.negative?(e.negative=0,this.imod(e).redNeg()):this.imod(e)},w.prototype.pow=function(t,e){if(e.isZero())return new s(1).toRed(this);if(0===e.cmpn(1))return t.clone();var r=new Array(16);r[0]=new s(1).toRed(this),r[1]=t;for(var i=2;i<r.length;i++)r[i]=this.mul(r[i-1],t);var n=r[0],o=0,a=0,u=e.bitLength()%26;for(0===u&&(u=26),i=e.length-1;i>=0;i--){for(var f=e.words[i],h=u-1;h>=0;h--){var c=f>>h&1;n!==r[0]&&(n=this.sqr(n)),0!==c||0!==o?(o<<=1,o|=c,(4===++a||0===i&&0===h)&&(n=this.mul(n,r[o]),a=0,o=0)):a=0}u=26}return n},w.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},w.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},s.mont=function(t){return new I(t)},n(I,w),I.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},I.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},I.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),s=n;return n.cmp(this.m)>=0?s=n.isub(this.m):n.cmpn(0)<0&&(s=n.iadd(this.m)),s._forceRed(this)},I.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new s(0)._forceRed(this);var r=t.mul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).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)},I.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t,this)}).call(this,r(43)(t))},function(t,e,r){"use strict";var i=r(17),n=r(18);function s(t,e){return 55296==(64512&t.charCodeAt(e))&&(!(e<0||e+1>=t.length)&&56320==(64512&t.charCodeAt(e+1)))}function o(t){return(t>>>24|t>>>8&65280|t<<8&16711680|(255&t)<<24)>>>0}function a(t){return 1===t.length?"0"+t:t}function u(t){return 7===t.length?"0"+t:6===t.length?"00"+t:5===t.length?"000"+t:4===t.length?"0000"+t:3===t.length?"00000"+t:2===t.length?"000000"+t:1===t.length?"0000000"+t:t}e.inherits=n,e.toArray=function(t,e){if(Array.isArray(t))return t.slice();if(!t)return[];var r=[];if("string"==typeof t)if(e){if("hex"===e)for((t=t.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(t="0"+t),n=0;n<t.length;n+=2)r.push(parseInt(t[n]+t[n+1],16))}else for(var i=0,n=0;n<t.length;n++){var o=t.charCodeAt(n);o<128?r[i++]=o:o<2048?(r[i++]=o>>6|192,r[i++]=63&o|128):s(t,n)?(o=65536+((1023&o)<<10)+(1023&t.charCodeAt(++n)),r[i++]=o>>18|240,r[i++]=o>>12&63|128,r[i++]=o>>6&63|128,r[i++]=63&o|128):(r[i++]=o>>12|224,r[i++]=o>>6&63|128,r[i++]=63&o|128)}else for(n=0;n<t.length;n++)r[n]=0|t[n];return r},e.toHex=function(t){for(var e="",r=0;r<t.length;r++)e+=a(t[r].toString(16));return e},e.htonl=o,e.toHex32=function(t,e){for(var r="",i=0;i<t.length;i++){var n=t[i];"little"===e&&(n=o(n)),r+=u(n.toString(16))}return r},e.zero2=a,e.zero8=u,e.join32=function(t,e,r,n){var s=r-e;i(s%4==0);for(var o=new Array(s/4),a=0,u=e;a<o.length;a++,u+=4){var f;f="big"===n?t[u]<<24|t[u+1]<<16|t[u+2]<<8|t[u+3]:t[u+3]<<24|t[u+2]<<16|t[u+1]<<8|t[u],o[a]=f>>>0}return o},e.split32=function(t,e){for(var r=new Array(4*t.length),i=0,n=0;i<t.length;i++,n+=4){var s=t[i];"big"===e?(r[n]=s>>>24,r[n+1]=s>>>16&255,r[n+2]=s>>>8&255,r[n+3]=255&s):(r[n+3]=s>>>24,r[n+2]=s>>>16&255,r[n+1]=s>>>8&255,r[n]=255&s)}return r},e.rotr32=function(t,e){return t>>>e|t<<32-e},e.rotl32=function(t,e){return t<<e|t>>>32-e},e.sum32=function(t,e){return t+e>>>0},e.sum32_3=function(t,e,r){return t+e+r>>>0},e.sum32_4=function(t,e,r,i){return t+e+r+i>>>0},e.sum32_5=function(t,e,r,i,n){return t+e+r+i+n>>>0},e.sum64=function(t,e,r,i){var n=t[e],s=i+t[e+1]>>>0,o=(s<i?1:0)+r+n;t[e]=o>>>0,t[e+1]=s},e.sum64_hi=function(t,e,r,i){return(e+i>>>0<e?1:0)+t+r>>>0},e.sum64_lo=function(t,e,r,i){return e+i>>>0},e.sum64_4_hi=function(t,e,r,i,n,s,o,a){var u=0,f=e;return u+=(f=f+i>>>0)<e?1:0,u+=(f=f+s>>>0)<s?1:0,t+r+n+o+(u+=(f=f+a>>>0)<a?1:0)>>>0},e.sum64_4_lo=function(t,e,r,i,n,s,o,a){return e+i+s+a>>>0},e.sum64_5_hi=function(t,e,r,i,n,s,o,a,u,f){var h=0,c=e;return h+=(c=c+i>>>0)<e?1:0,h+=(c=c+s>>>0)<s?1:0,h+=(c=c+a>>>0)<a?1:0,t+r+n+o+u+(h+=(c=c+f>>>0)<f?1:0)>>>0},e.sum64_5_lo=function(t,e,r,i,n,s,o,a,u,f){return e+i+s+a+f>>>0},e.rotr64_hi=function(t,e,r){return(e<<32-r|t>>>r)>>>0},e.rotr64_lo=function(t,e,r){return(t<<32-r|e>>>r)>>>0},e.shr64_hi=function(t,e,r){return t>>>r},e.shr64_lo=function(t,e,r){return(t<<32-r|e>>>r)>>>0}},function(t,e,r){"use strict";(function(e){var i=r(3),n=r(20),s=r(5),o=r(4),a=r(19),u=r(1),f=r(2);function h(t,e){if(!(this instanceof h))return new h(t,e);if(f.checkArgument(t,"First argument is required, please include public key data."),t instanceof h)return t;e=e||{};var r=this._classifyArgs(t,e);return r.point.validate(),o.defineImmutable(this,{point:r.point,compressed:r.compressed,network:r.network||a.defaultNetwork}),this}h.prototype._classifyArgs=function(t,r){var i={compressed:u.isUndefined(r.compressed)||r.compressed};if(t instanceof n)i.point=t;else if(t.x&&t.y)i=h._transformObject(t);else if("string"==typeof t)i=h._transformDER(e.from(t,"hex"));else if(h._isBuffer(t))i=h._transformDER(t);else{if(!h._isPrivateKey(t))throw new TypeError("First argument is an unrecognized data format.");i=h._transformPrivateKey(t)}return i.network||(i.network=u.isUndefined(r.network)?void 0:a.get(r.network)),i},h._isPrivateKey=function(t){return t instanceof r(30)},h._isBuffer=function(t){return t instanceof e||t instanceof Uint8Array},h._transformPrivateKey=function(t){f.checkArgument(h._isPrivateKey(t),"Must be an instance of PrivateKey");var e={};return e.point=n.getG().mul(t.bn),e.compressed=t.compressed,e.network=t.network,e},h._transformDER=function(t,e){f.checkArgument(h._isBuffer(t),"Must be a buffer of DER encoded public key");var r,s,o,a,c={};if(e=!!u.isUndefined(e)||e,4!==t[0]&&(e||6!==t[0]&&7!==t[0]))if(3===t[0])o=t.slice(1),r=new i(o),(c=h._transformX(!0,r)).compressed=!0;else{if(2!==t[0])throw new TypeError("Invalid DER format public key");o=t.slice(1),r=new i(o),(c=h._transformX(!1,r)).compressed=!0}else{if(o=t.slice(1,33),a=t.slice(33,65),32!==o.length||32!==a.length||65!==t.length)throw new TypeError("Length of x and y must be 32 bytes");r=new i(o),s=new i(a),c.point=new n(r,s),c.compressed=!1}return c},h._transformX=function(t,e){f.checkArgument("boolean"==typeof t,"Must specify whether y is odd or not (true or false)");var r={};return r.point=n.fromX(t,e),r},h._transformObject=function(t){var e=new i(t.x,"hex"),r=new i(t.y,"hex");return new h(new n(e,r),{compressed:t.compressed})},h.fromPrivateKey=function(t){f.checkArgument(h._isPrivateKey(t),"Must be an instance of PrivateKey");var e=h._transformPrivateKey(t);return new h(e.point,{compressed:e.compressed,network:e.network})},h.fromDER=h.fromBuffer=function(t,e){f.checkArgument(h._isBuffer(t),"Must be a buffer of DER encoded public key");var r=h._transformDER(t,e);return new h(r.point,{compressed:r.compressed})},h.fromPoint=function(t,e){return f.checkArgument(t instanceof n,"First argument must be an instance of Point."),new h(t,{compressed:e})},h.fromHex=h.fromString=function(t,r){var i=e.from(t,r||"hex"),n=h._transformDER(i);return new h(n.point,{compressed:n.compressed})},h.fromX=function(t,e){var r=h._transformX(t,e);return new h(r.point,{compressed:r.compressed})},h.getValidationError=function(t){var e;try{new h(t)}catch(t){e=t}return e},h.isValid=function(t){return!h.getValidationError(t)},h.prototype.toObject=h.prototype.toJSON=function(){return{x:this.point.getX().toString("hex",2),y:this.point.getY().toString("hex",2),compressed:this.compressed}},h.prototype.toBuffer=h.prototype.toDER=function(){var t,r=this.point.getX(),i=this.point.getY(),n=r.toBuffer({size:32}),s=i.toBuffer({size:32});return this.compressed?(t=s[s.length-1]%2?e.from([3]):e.from([2]),e.concat([t,n])):(t=e.from([4]),e.concat([t,n,s]))},h.prototype._getID=function(){return s.sha256ripemd160(this.toBuffer())},h.prototype.toAddress=function(t){return r(21).fromPublicKey(this,t||this.network)},h.prototype.toString=h.prototype.toHex=function(){return this.toDER().toString("hex")},h.prototype.inspect=function(){return"<PublicKey: "+this.toHex()+(this.compressed?"":", uncompressed")+">"},t.exports=h}).call(this,r(0).Buffer)},function(t,e,r){"use strict";(function(e){var i=r(40);const n=r(96),s=r(97),o=r(98),a=r(99),u=r(100);class f{constructor(t){t?this.set(t):(this.buffers=[],this.length=0)}write(t){return this.buffers.push(t),this.length+=t.length,this}set(t){return this.buffers=t.buffers||t.bufs||this.buffers||[],this.length=this.buffers.reduce((function(t,e){return t+e.length}),0),this}concat(){return this.toBuffer()}toBuffer(){if(1===this.buffers.length)return e.from(this.buffers[0]);const t=new Uint8Array(this.length);let r=0;return this.buffers.forEach(e=>{t.set(e,r),r+=e.length}),e.from(t)}writeReverse(t){return i(e.isBuffer(t)),this.write(e.from(t).reverse()),this}writeUInt16LE(t){return s(this,t),this}writeUInt16BE(t){var e=new f;return e.writeUInt16LE(t),this.writeReverse(e.toBuffer()),this}writeUInt32LE(t){return o(this,t),this}writeUInt32BE(t){var e=new f;return e.writeUInt32LE(t),this.writeReverse(e.toBuffer()),this}writeUInt8(t){return n(this,t),this}writeUInt64LEBN(t){var e=t.toBuffer({size:8});return this.writeReverse(e),this}writeUInt64BEBN(t){var e=new f;return e.writeUInt64LEBN(t),this.writeReverse(e.toBuffer()),this}writeVarintNum(t){return u(this,t),this}writeInt32LE(t){return a(this,t),this}static varintBufNum(t){var e=new f;return e.writeVarintNum(t),e.toBuffer()}writeVarintBN(t){var e=t.toNumber();if(e<253)n(this,e);else if(e<65536)n(this,253),s(this,e);else if(e<4294967296)n(this,254),o(this,e);else{var r=new f;r.writeUInt8(255),r.writeUInt64LEBN(t);var i=r.toBuffer();this.write(i)}return this}}t.exports=f}).call(this,r(0).Buffer)},function(t,e,r){"use strict";(function(e){var i=r(1),n=r(2),s=r(3),o=function t(r){if(!(this instanceof t))return new t(r);if(!i.isUndefined(r))if(e.isBuffer(r))this.set({buf:r});else if(i.isString(r)){var n=e.from(r,"hex");if(2*n.length!==r.length)throw new TypeError("Invalid hex string");this.set({buf:n})}else{if(!i.isObject(r))throw new TypeError("Unrecognized argument for BufferReader");var s=r;this.set(s)}};o.prototype.set=function(t){return this.buf=t.buf||this.buf||void 0,this.pos=t.pos||this.pos||0,this},o.prototype.eof=function(){return this.pos>=this.buf.length},o.prototype.finished=o.prototype.eof,o.prototype.read=function(t){n.checkArgument(!i.isUndefined(t),"Must specify a length");var e=this.buf.slice(this.pos,this.pos+t);return this.pos=this.pos+t,e},o.prototype.readAll=function(){var t=this.buf.slice(this.pos,this.buf.length);return this.pos=this.buf.length,t},o.prototype.readUInt8=function(){var t=this.buf.readUInt8(this.pos);return this.pos=this.pos+1,t},o.prototype.readUInt16BE=function(){var t=this.buf.readUInt16BE(this.pos);return this.pos=this.pos+2,t},o.prototype.readUInt16LE=function(){var t=this.buf.readUInt16LE(this.pos);return this.pos=this.pos+2,t},o.prototype.readUInt32BE=function(){var t=this.buf.readUInt32BE(this.pos);return this.pos=this.pos+4,t},o.prototype.readUInt32LE=function(){var t=this.buf.readUInt32LE(this.pos);return this.pos=this.pos+4,t},o.prototype.readInt32LE=function(){var t=this.buf.readInt32LE(this.pos);return this.pos=this.pos+4,t},o.prototype.readUInt64BEBN=function(){var t=this.buf.slice(this.pos,this.pos+8),e=s.fromBuffer(t);return this.pos=this.pos+8,e},o.prototype.readUInt64LEBN=function(){var t,e=this.buf.readUInt32LE(this.pos),r=4294967296*this.buf.readUInt32LE(this.pos+4)+e;if(r<=9007199254740991)t=new s(r);else{var i=Array.prototype.slice.call(this.buf,this.pos,this.pos+8);t=new s(i,10,"le")}return this.pos=this.pos+8,t},o.prototype.readVarintNum=function(){var t=this.readUInt8();switch(t){case 253:return this.readUInt16LE();case 254:return this.readUInt32LE();case 255:var e=this.readUInt64LEBN().toNumber();if(e<=Math.pow(2,53))return e;throw new Error("number too large to retain precision - use readVarintBN");default:return t}},o.prototype.readVarLengthBuffer=function(){var t=this.readVarintNum(),e=this.read(t);return n.checkState(e.length===t,"Invalid length while reading varlength buffer. Expected to read: "+t+" and read "+e.length),e},o.prototype.readVarintBuf=function(){switch(this.buf.readUInt8(this.pos)){case 253:return this.read(3);case 254:return this.read(5);case 255:return this.read(9);default:return this.read(1)}},o.prototype.readVarintBN=function(){var t=this.readUInt8();switch(t){case 253:return new s(this.readUInt16LE());case 254:return new s(this.readUInt32LE());case 255:return this.readUInt64LEBN();default:return new s(t)}},o.prototype.reverse=function(){for(var t=e.alloc(this.buf.length),r=0;r<t.length;r++)t[r]=this.buf[this.buf.length-1-r];return this.buf=t,this},o.prototype.readReverse=function(t){i.isUndefined(t)&&(t=this.buf.length);var r=this.buf.slice(this.pos,this.pos+t);return this.pos=this.pos+t,e.from(r).reverse()},o.prototype.remaining=function(){return this.buf.length-this.pos},t.exports=o}).call(this,r(0).Buffer)},function(t,e,r){"use strict";const i=r(0).Buffer;var n=r(8),s=r(9),o=r(16),a=r(14),u=r(13),f=r(3),h=r(5),c=r(44),d=r(2),p=r(55),l=r(1),m=i.from("0000000000000000000000000000000000000000000000000000000000000001","hex"),b=p.SCRIPT_ENABLE_SIGHASH_FORKID,g=function(t,e){const r=i.from("0000000000000000000000000000000000000000000000000000000000000000","hex"),n=new u,o=void 0===e?0:e,a=void 0===e?t.outputs.length-1:e;for(let e=o;e<=a;e++){const o=t.outputs[e];n.writeUInt64LEBN(o._satoshisBN);var f=h.sha256sha256(i.from(o._scriptBuffer));n.write(f);let a=new Map,u=new Map;if(s.getPushRefsFromScriptBuffer(i.from(o._scriptBuffer),a,u),n.writeUInt32LE(a.size),a.size){let t;new Map([...a.entries()].sort((t,e)=>String(t[0]).localeCompare(e[0]))).forEach((e,r)=>{t=t?i.concat([t,e]):e});const e=h.sha256sha256(t);n.write(e)}else n.write(r)}const c=n.toBuffer();return h.sha256sha256(c)};function y(t,e){var r=new u;l.isUndefined(e)?l.each(t.outputs,(function(t){t.toBufferWriter(r)})):t.outputs[e].toBufferWriter(r);var i=r.toBuffer();return h.sha256sha256(i)}function v(t){var e=new u;l.each(t.inputs,(function(t){e.writeReverse(t.prevTxId),e.writeUInt32LE(t.outputIndex)}));var r=e.toBuffer();return h.sha256sha256(r)}function _(t){var e=new u;l.each(t.inputs,(function(t){e.writeUInt32LE(t.sequenceNumber)}));var r=e.toBuffer();return h.sha256sha256(r)}var S=function(t,e,a,h,c,S){var w=r(58),I=r(42);l.isUndefined(S)&&(S=b);var E,A=w.shallowCopy(t);(h=new s(h),S&p.SCRIPT_ENABLE_REPLAY_PROTECTION)&&(e=(16711680|57005^e>>8)<<8|255&e);if(e&n.SIGHASH_FORKID&&S&p.SCRIPT_ENABLE_SIGHASH_FORKID)return function(t,e,r,s,o){var a=t.inputs[r];d.checkArgument(o instanceof f,"For ForkId=0 signatures, satoshis or complete input must be provided");var h=i.alloc(32),c=i.alloc(32),p=i.alloc(32),l=i.alloc(32);e&n.SIGHASH_ANYONECANPAY||(h=v(t)),e&n.SIGHASH_ANYONECANPAY||(31&e)===n.SIGHASH_SINGLE||(31&e)===n.SIGHASH_NONE||(c=_(t)),(31&e)!==n.SIGHASH_SINGLE&&(31&e)!==n.SIGHASH_NONE?(p=y(t),l=g(t)):(31&e)===n.SIGHASH_SINGLE&&r<t.outputs.length&&(p=y(t,r),l=g(t,r));var m=new u;m.writeInt32LE(t.version),m.write(h),m.write(c),m.writeReverse(a.prevTxId),m.writeUInt32LE(a.outputIndex),m.writeVarintNum(s.toBuffer().length),m.write(s.toBuffer()),m.writeUInt64LEBN(o);var b=a.sequenceNumber;return m.writeUInt32LE(b),m.write(l),m.write(p),m.writeUInt32LE(t.nLockTime),m.writeUInt32LE(e>>>0),m.toBuffer()}(A,e,a,h,c);for(h.removeCodeseparators(),E=0;E<A.inputs.length;E++)A.inputs[E]=new I(A.inputs[E]).setScript(s.empty());if(A.inputs[a]=new I(A.inputs[a]).setScript(h),(31&e)===n.SIGHASH_NONE||(31&e)===n.SIGHASH_SINGLE)for(E=0;E<A.inputs.length;E++)E!==a&&(A.inputs[E].sequenceNumber=0);if((31&e)===n.SIGHASH_NONE)A.outputs=[];else if((31&e)===n.SIGHASH_SINGLE){if(a>=A.outputs.length)return m;for(A.outputs.length=a+1,E=0;E<a;E++)A.outputs[E]=new o({satoshis:f.fromBuffer(i.from("ffffffffffffffff","hex")),script:s.empty()})}return e&n.SIGHASH_ANYONECANPAY&&(A.inputs=[A.inputs[a]]),(new u).write(A.toBuffer()).writeInt32LE(e).toBuffer()},w=function(t,e,r,i,n,s){var o=S(t,e,r,i,n,s);if(0===o.compare(m))return o;var u=h.sha256sha256(o);return u=new a(u).readReverse()};t.exports={sighashPreimage:S,sighash:w,GetOutputsHash:y,GetSequenceHash:_,GetPrevoutHash:v,GetHashPrevoutInputs:function(t){var e=new u;for(const n of t.inputs){e.writeReverse(n.prevTxId),e.writeUInt32LE(n.outputIndex);var r=h.sha256sha256(i.from(n._scriptBuffer));e.write(r)}var n=e.toBuffer();return h.sha256sha256(n)},GetHashOutputHashes:g,sign:function(t,e,r,i,n,s,o){var a=w(t,r,i,n,s,o);return c.sign(a,e,"little").set({nhashtype:r})},verify:function(t,e,r,i,n,s,o){d.checkArgument(!l.isUndefined(t)),d.checkArgument(!l.isUndefined(e)&&!l.isUndefined(e.nhashtype));var a=w(t,e.nhashtype,i,n,s,o);return c.verify(a,e,r,"little")}}},function(t,e,r){"use strict";var i=r(1),n=r(3),s=r(0);const o=s.Buffer;var a=r(4),u=r(13),f=r(24),h=r(9),c=r(2),d=r(7);function p(t){if(!(this instanceof p))return new p(t);if(!i.isObject(t))throw new TypeError("Unrecognized argument for Output");var e;this.satoshis=t.satoshis,o.isBuffer(t.script)?this._scriptBuffer=t.script:(e=i.isString(t.script)&&a.isHexa(t.script)?s.Buffer.from(t.script,"hex"):t.script,this.setScript(e))}Object.defineProperty(p.prototype,"script",{configurable:!1,enumerable:!0,get:function(){return this._script?this._script:(this.setScriptFromBuffer(this._scriptBuffer),this._script)}}),Object.defineProperty(p.prototype,"satoshis",{configurable:!1,enumerable:!0,get:function(){return this._satoshis},set:function(t){t instanceof n?(this._satoshisBN=t,this._satoshis=t.toNumber()):i.isString(t)?(this._satoshis=parseInt(t),this._satoshisBN=n.fromNumber(this._satoshis)):(c.checkArgument(a.isNaturalNumber(t),"Output satoshis is not a natural number"),this._satoshisBN=n.fromNumber(t),this._satoshis=t),c.checkState(a.isNaturalNumber(this._satoshis),"Output satoshis is not a natural number")}}),p.prototype.invalidSatoshis=function(){return this._satoshis>9007199254740991?"transaction txout satoshis greater than max safe integer":this._satoshis!==this._satoshisBN.toNumber()?"transaction txout satoshis has corrupted value":this._satoshis<0&&"transaction txout negative"},Object.defineProperty(p.prototype,"satoshisBN",{configurable:!1,enumerable:!0,get:function(){return this._satoshisBN},set:function(t){this._satoshisBN=t,this._satoshis=t.toNumber(),c.checkState(a.isNaturalNumber(this._satoshis),"Output satoshis is not a natural number")}}),p.prototype.toObject=p.prototype.toJSON=function(){var t={satoshis:this.satoshis};return t.script=this._scriptBuffer.toString("hex"),t},p.fromObject=function(t){return new p(t)},p.prototype.setScriptFromBuffer=function(t){this._scriptBuffer=t;try{this._script=h.fromBuffer(this._scriptBuffer),this._script._isOutput=!0}catch(t){if(!(t instanceof d.Script.InvalidBuffer))throw t;this._script=null}},p.prototype.setScript=function(t){if(t instanceof h)this._scriptBuffer=t.toBuffer(),this._script=t,this._script._isOutput=!0;else if(i.isString(t))this._script=h.fromString(t),this._scriptBuffer=this._script.toBuffer(),this._script._isOutput=!0;else{if(!o.isBuffer(t))throw new TypeError("Invalid argument type: script");this.setScriptFromBuffer(t)}return this},p.prototype.inspect=function(){var t;return t=this.script?this.script.inspect():this._scriptBuffer.toString("hex"),"<Output ("+this.satoshis+" sats) "+t+">"},p.fromBufferReader=function(t){var e={};e.satoshis=t.readUInt64LEBN();var r=t.readVarintNum();return e.script=0!==r?t.read(r):s.Buffer.from([]),new p(e)},p.prototype.toBufferWriter=function(t){t||(t=new u),t.writeUInt64LEBN(this._satoshisBN);var e=this._scriptBuffer;return t.writeVarintNum(e.length),t.write(e),t},p.prototype.getSize=function(){var t=this.script.toBuffer().length;return 8+f(t).toBuffer().length+t},t.exports=p},function(t,e){function r(t,e){if(!t)throw new Error(e||"Assertion failed")}t.exports=r,r.equal=function(t,e,r){if(t!=e)throw new Error(r||"Assertion failed: "+t+" != "+e)}},function(t,e){"function"==typeof Object.create?t.exports=function(t,e){t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})}:t.exports=function(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}},function(t,e,r){"use strict";var i=r(1),n=r(4),s=[],o={};function a(){}function u(t,e){if(~s.indexOf(t))return t;if(!e)return o[t];i.isArray(e)||(e=[e]);for(var r=0;r<s.length;r++){var n=s[r],a=i.pick(n,e);if(~i.values(a).indexOf(t))return n}}function f(t){for(var e=[],r=0;r<t.length;r++)e.push(31&t.charCodeAt(r));return e}function h(t){var e=new a;n.defineImmutable(e,{name:t.name,alias:t.alias,pubkeyhash:t.pubkeyhash,privatekey:t.privatekey,scripthash:t.scripthash,xpubkey:t.xpubkey,xprivkey:t.xprivkey});var r=t.indexBy||Object.keys(t);return t.cashAddrPrefix&&i.extend(e,{cashAddrPrefix:t.cashAddrPrefix,cashAddrPrefixArray:f(t.cashAddrPrefix)}),t.networkMagic&&i.extend(e,{networkMagic:n.integerAsBuffer(t.networkMagic)}),t.port&&i.extend(e,{port:t.port}),t.dnsSeeds&&i.extend(e,{dnsSeeds:t.dnsSeeds}),s.push(e),function(t,e){for(var r=0;r<e.length;r++){var n=e[r],s=t[n];i.isUndefined(s)||i.isObject(s)||(o[s]=t)}}(e,r),e}a.prototype.toString=function(){return this.name};var c=["seed.bitcoinsv.org","seed.bitcoinunlimited.info"],d={PORT:18333,NETWORK_MAGIC:4108710900,DNS_SEEDS:c,PREFIX:"testnet",CASHADDRPREFIX:"bchtest"},p={PORT:18444,NETWORK_MAGIC:3669344250,DNS_SEEDS:[],PREFIX:"regtest",CASHADDRPREFIX:"bchreg"},l={PORT:9333,NETWORK_MAGIC:4224632057,DNS_SEEDS:["stn-seed.bitcoinsv.io"],PREFIX:"stn",CASHADDRPREFIX:"bsvstn"},m={name:"livenet",alias:"mainnet",prefix:"bitcoin",cashAddrPrefix:"bitcoincash",pubkeyhash:0,privatekey:128,scripthash:5,xpubkey:76067358,xprivkey:76066276,networkMagic:3823236072,port:8333,dnsSeeds:c},b={name:"testnet",prefix:d.PREFIX,cashAddrPrefix:d.CASHADDRPREFIX,pubkeyhash:111,privatekey:239,scripthash:196,xpubkey:70617039,xprivkey:70615956,networkMagic:d.NETWORK_MAGIC},g={name:"regtest",prefix:p.PREFIX,cashAddrPrefix:p.CASHADDRPREFIX,pubkeyhash:111,privatekey:239,scripthash:196,xpubkey:70617039,xprivkey:70615956,networkMagic:p.NETWORK_MAGIC,port:p.PORT,dnsSeeds:[],indexBy:["port","name","cashAddrPrefix","networkMagic"]},y={name:"stn",prefix:l.PREFIX,cashAddrPrefix:l.CASHADDRPREFIX,pubkeyhash:111,privatekey:239,scripthash:196,xpubkey:70617039,xprivkey:70615956,networkMagic:l.NETWORK_MAGIC,indexBy:["port","name","cashAddrPrefix","networkMagic"]};h(b),h(y),h(g),h(m);var v=u("livenet"),_=u("regtest"),S=u("testnet"),w=u("stn");Object.defineProperty(S,"port",{enumerable:!0,configurable:!1,get:function(){return this.regtestEnabled?p.PORT:this.stnEnabled?l.PORT:d.PORT}}),Object.defineProperty(S,"networkMagic",{enumerable:!0,configurable:!1,get:function(){return this.regtestEnabled?n.integerAsBuffer(p.NETWORK_MAGIC):this.stnEnabled?n.integerAsBuffer(l.NETWORK_MAGIC):n.integerAsBuffer(d.NETWORK_MAGIC)}}),Object.defineProperty(S,"dnsSeeds",{enumerable:!0,configurable:!1,get:function(){return this.regtestEnabled?p.DNS_SEEDS:this.stnEnabled?l.DNS_SEEDS:d.DNS_SEEDS}}),Object.defineProperty(S,"cashAddrPrefix",{enumerable:!0,configurable:!1,get:function(){return this.regtestEnabled?p.CASHADDRPREFIX:this.stnEnabled?l.CASHADDRPREFIX:d.CASHADDRPREFIX}}),Object.defineProperty(S,"cashAddrPrefixArray",{enumerable:!0,configurable:!1,get:function(){return this.regtestEnabled?f(p.CASHADDRPREFIX):this.stnEnabled?l.cashAddrPrefixToArray(l.CASHADDRPREFIX):f(d.CASHADDRPREFIX)}}),t.exports={add:h,remove:function(t){for(var e=0;e<s.length;e++)s[e]===t&&s.splice(e,1);!function(t,e){for(var r=0;r<e.length;r++){var i=e[r];o[i]===t&&delete o[i]}}(t,Object.keys(o))},defaultNetwork:v,livenet:v,mainnet:v,testnet:S,regtest:_,stn:w,get:u,enableRegtest:function(){S.regtestEnabled=!0},disableRegtest:function(){S.regtestEnabled=!1},enableStn:function(){S.stnEnabled=!0},disableStn:function(){S.stnEnabled=!1}}},function(t,e,r){"use strict";(function(e){var i=r(3),n=new(0,r(45).ec)("secp256k1"),s=n.curve.point.bind(n.curve),o=n.curve.pointFromX.bind(n.curve),a=function(t,e,r){try{var i=s(t,e,r)}catch(t){throw new Error("Invalid Point")}return i.validate(),i};a.prototype=Object.getPrototypeOf(n.curve.point()),a.fromX=function(t,e){try{var r=o(e,t)}catch(t){throw new Error("Invalid X")}return r.validate(),r},a.getG=function(){return n.curve.g},a.getN=function(){return new i(n.curve.n.toArray())},a.prototype._getX||(a.prototype._getX=a.prototype.getX),a.prototype.getX=function(){return new i(this._getX().toArray())},a.prototype._getY||(a.prototype._getY=a.prototype.getY),a.prototype.getY=function(){return new i(this._getY().toArray())},a.prototype.validate=function(){if(this.isInfinity())throw new Error("Point cannot be equal to Infinity");var t;try{t=o(this.getX(),this.getY().isOdd())}catch(t){throw new Error("Point does not lie on the curve")}if(0!==t.y.cmp(this.y))throw new Error("Invalid y value for curve.");if(!this.mul(a.getN()).isInfinity())throw new Error("Point times N must be infinity");return this},a.pointToCompressed=function(t){var r,i=t.getX().toBuffer({size:32}),n=t.getY().toBuffer({size:32});return r=n[n.length-1]%2?e.from([3]):e.from([2]),e.concat([r,i])},a.pointFromCompressed=function(t){if(33!==t.length)throw new Error("invalid buffer length");let e,r=t[0];if(3===r)e=!0;else{if(2!==r)throw new Error("invalid value of compressed prefix");e=!1}let n=t.slice(1,33),s=i.fromBuffer(n);return a.fromX(e,s)},a.prototype.toBuffer=function(){return a.pointToCompressed(this)},a.prototype.toHex=function(){return this.toBuffer().toString("hex")},a.fromBuffer=function(t){return a.pointFromCompressed(t)},a.fromHex=function(t){return a.fromBuffer(e.from(t,"hex"))},t.exports=a}).call(this,r(0).Buffer)},function(t,e,r){"use strict";(function(e){var i=r(1),n=r(2),s=r(7),o=r(23),a=r(19),u=r(5),f=r(4),h=r(12);function c(t,e,r){if(!(this instanceof c))return new c(t,e,r);if(i.isArray(t)&&i.isNumber(e))return c.createMultisig(t,e,r);if(t instanceof c)return t;if(n.checkArgument(t,"First argument is required, please include address data.","guide/address.html"),e&&!a.get(e))throw new TypeError('Second argument must be "livenet", "testnet", or "regtest".');if(r&&r!==c.PayToPublicKeyHash&&r!==c.PayToScriptHash)throw new TypeError('Third argument must be "pubkeyhash" or "scripthash".');var s=this._classifyArguments(t,e,r);return s.network=s.network||a.get(e)||a.defaultNetwork,s.type=s.type||r||c.PayToPublicKeyHash,f.defineImmutable(this,{hashBuffer:s.hashBuffer,network:s.network,type:s.type}),this}c.prototype._classifyArguments=function(t,r,n){if((t instanceof e||t instanceof Uint8Array)&&20===t.length)return c._transformHash(t);if((t instanceof e||t instanceof Uint8Array)&&21===t.length)return c._transformBuffer(t,r,n);if(t instanceof h)return c._transformPublicKey(t);if(t instanceof d)return c._transformScript(t,r);if("string"==typeof t)return c._transformString(t,r,n);if(i.isObject(t))return c._transformObject(t);throw new TypeError("First argument is an unrecognized data format.")},c.PayToPublicKeyHash="pubkeyhash",c.PayToScriptHash="scripthash",c._transformHash=function(t){var r={};if(!(t instanceof e||t instanceof Uint8Array))throw new TypeError("Address supplied is not a buffer.");if(20!==t.length)throw new TypeError("Address hashbuffers must be exactly 20 bytes.");return r.hashBuffer=t,r},c._transformObject=function(t){return n.checkArgument(t.hash||t.hashBuffer,"Must provide a `hash` or `hashBuffer` property"),n.checkArgument(t.type,"Must provide a `type` property"),{hashBuffer:t.hash?e.from(t.hash,"hex"):t.hashBuffer,network:a.get(t.network)||a.defaultNetwork,type:t.type}},c._classifyFromVersion=function(t){var e={},r=a.get(t[0],"pubkeyhash"),i=a.get(t[0],"scripthash");return r?(e.network=r,e.type=c.PayToPublicKeyHash):i&&(e.network=i,e.type=c.PayToScriptHash),e},c._transformBuffer=function(t,r,i){var n={};if(!(t instanceof e||t instanceof Uint8Array))throw new TypeError("Address supplied is not a buffer.");if(21!==t.length)throw new TypeError("Address buffers must be exactly 21 bytes.");var s=a.get(r),o=c._classifyFromVersion(t);if(r&&!s)throw new TypeError("Unknown network");if(!o.network||s&&s!==o.network)throw new TypeError("Address has mismatched network type.");if(!o.type||i&&i!==o.type)throw new TypeError("Address has mismatched type.");return n.hashBuffer=e.from(t.slice(1)),n.network=o.network,n.type=o.type,n},c._transformPublicKey=function(t){var e={};if(!(t instanceof h))throw new TypeError("Address must be an instance of PublicKey.");return e.hashBuffer=u.sha256ripemd160(t.toBuffer()),e.type=c.PayToPublicKeyHash,e},c._transformScript=function(t,e){n.checkArgument(t instanceof d,"script must be a Script instance");var r=t.getAddressInfo(e);if(!r)throw new s.Script.CantDeriveAddress(t);return r},c.createMultisig=function(t,e,r){return r=r||t[0].network||a.defaultNetwork,c.payingTo(d.buildMultisigOut(t,e),r)},c._transformString=function(t,e,r){if("string"!=typeof t)throw new TypeError("data parameter supplied is not a string.");if(t.length<27)throw new Error("Invalid Address string provided");t=t.trim();var i=a.get(e);if(e&&!i)throw new TypeError("Unknown network");var n=o.decode(t);return c._transformBuffer(n,e,r)},c.fromPublicKey=function(t,e){var r=c._transformPublicKey(t);return e=e||a.defaultNetwork,new c(r.hashBuffer,e,r.type)},c.fromPrivateKey=function(t,e){let r=h.fromPrivateKey(t);return e=e||t.network||a.defaultNetwork,c.fromPublicKey(r,e)},c.fromPublicKeyHash=function(t,e){var r=c._transformHash(t);return new c(r.hashBuffer,e,c.PayToPublicKeyHash)},c.fromScriptHash=function(t,e){n.checkArgument(t,"hash parameter is required");var r=c._transformHash(t);return new c(r.hashBuffer,e,c.PayToScriptHash)},c.payingTo=function(t,e){return n.checkArgument(t,"script is required"),n.checkArgument(t instanceof d,"script must be instance of Script"),c.fromScriptHash(u.sha256ripemd160(t.toBuffer()),e)},c.fromScript=function(t,e){n.checkArgument(t instanceof d,"script must be a Script instance");var r=c._transformScript(t,e);return new c(r.hashBuffer,e,r.type)},c.fromBuffer=function(t,e,r){var i=c._transformBuffer(t,e,r);return new c(i.hashBuffer,i.network,i.type)},c.fromHex=function(t,r,i){return c.fromBuffer(e.from(t,"hex"),r,i)},c.fromString=function(t,e,r){var i=c._transformString(t,e,r);return new c(i.hashBuffer,i.network,i.type)},c.fromObject=function(t){return n.checkState(f.isHexa(t.hash),'Unexpected hash property, "'+t.hash+'", expected to be hex.'),new c(e.from(t.hash,"hex"),t.network,t.type)},c.getValidationError=function(t,e,r){var i;try{new c(t,e,r)}catch(t){i=t}return i},c.isValid=function(t,e,r){return!c.getValidationError(t,e,r)},c.prototype.isPayToPublicKeyHash=function(){return this.type===c.PayToPublicKeyHash},c.prototype.isPayToScriptHash=function(){return this.type===c.PayToScriptHash},c.prototype.toBuffer=function(){var t=e.from([this.network[this.type]]);return e.concat([t,this.hashBuffer])},c.prototype.toHex=function(){return this.toBuffer().toString("hex")},c.prototype.toObject=c.prototype.toJSON=function(){return{hash:this.hashBuffer.toString("hex"),type:this.type,network:this.network.toString()}},c.prototype.inspect=function(){return"<Address: "+this.toString()+", type: "+this.type+", network: "+this.network+">"},c.prototype.toString=function(){return o.encode(this.toBuffer())},t.exports=c;var d=r(9)}).call(this,r(0).Buffer)},function(t,e,r){"use strict";var i=r(11),n=r(17);function s(){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}e.BlockHash=s,s.prototype.update=function(t,e){if(t=i.toArray(t,e),this.pending?this.pending=this.pending.concat(t):this.pending=t,this.pendingTotal+=t.length,this.pending.length>=this._delta8){var r=(t=this.pending).length%this._delta8;this.pending=t.slice(t.length-r,t.length),0===this.pending.length&&(this.pending=null),t=i.join32(t,0,t.length-r,this.endian);for(var n=0;n<t.length;n+=this._delta32)this._update(t,n,n+this._delta32)}return this},s.prototype.digest=function(t){return this.update(this._pad()),n(null===this.pending),this._digest(t)},s.prototype._pad=function(){var t=this.pendingTotal,e=this._delta8,r=e-(t+this.padLength)%e,i=new Array(r+this.padLength);i[0]=128;for(var n=1;n<r;n++)i[n]=0;if(t<<=3,"big"===this.endian){for(var s=8;s<this.padLength;s++)i[n++]=0;i[n++]=0,i[n++]=0,i[n++]=0,i[n++]=0,i[n++]=t>>>24&255,i[n++]=t>>>16&255,i[n++]=t>>>8&255,i[n++]=255&t}else for(i[n++]=255&t,i[n++]=t>>>8&255,i[n++]=t>>>16&255,i[n++]=t>>>24&255,i[n++]=0,i[n++]=0,i[n++]=0,i[n++]=0,s=8;s<this.padLength;s++)i[n++]=0;return i}},function(t,e,r){"use strict";var i=r(1),n=r(31),s=r(0);const o=s.Buffer;var a=r(5).sha256sha256,u=function t(e){if(!(this instanceof t))return new t(e);if(o.isBuffer(e)){var r=e;this.fromBuffer(r)}else if("string"==typeof e){var i=e;this.fromString(i)}};u.prototype.set=function(t){return this.buf=t.buf||this.buf||void 0,this},u.validChecksum=function(t,e){return i.isString(t)&&(t=s.Buffer.from(n.decode(t))),i.isString(e)&&(e=s.Buffer.from(n.decode(e))),e||(e=t.slice(-4),t=t.slice(0,-4)),u.checksum(t).toString("hex")===e.toString("hex")},u.decode=function(t){if("string"!=typeof t)throw new Error("Input must be a string");var e=o.from(n.decode(t));if(e.length<4)throw new Error("Input string too short");var r=o.from(e.slice(0,-4)),i=o.from(e.slice(-4)),s=a(r),u=o.from(s.slice(0,4));if(i.toString("hex")!==u.toString("hex"))throw new Error("Checksum mismatch");return r},u.checksum=function(t){return a(o.from(t)).slice(0,4)},u.encode=function(t){if(!o.isBuffer(t))throw new Error("Input must be a buffer");var e=o.alloc(t.length+4),r=u.checksum(t);return t.copy(e),r.copy(e,t.length),n.encode(e)},u.prototype.fromBuffer=function(t){return this.buf=t,this},u.fromBuffer=function(t){return(new u).fromBuffer(t)},u.fromHex=function(t){return u.fromBuffer(o.from(t,"hex"))},u.prototype.fromString=function(t){var e=u.decode(t);return this.buf=e,this},u.fromString=function(t){var e=u.decode(t);return new n(e)},u.prototype.toBuffer=function(){return this.buf},u.prototype.toHex=function(){return this.toBuffer().toString("hex")},u.prototype.toString=function(){return u.encode(this.buf)},t.exports=u},function(t,e,r){"use strict";(function(e){var i=r(13),n=r(14),s=r(3),o=function t(r){if(!(this instanceof t))return new t(r);if(e.isBuffer(r))this.buf=r;else if("number"==typeof r){var i=r;this.fromNumber(i)}else if(r instanceof s){var n=r;this.fromBN(n)}else if(r){var o=r;this.set(o)}};o.prototype.set=function(t){return this.buf=t.buf||this.buf,this},o.prototype.fromString=function(t){return this.set({buf:e.from(t,"hex")}),this},o.prototype.toString=function(){return this.buf.toString("hex")},o.prototype.fromBuffer=function(t){return this.buf=t,this},o.prototype.fromBufferReader=function(t){return this.buf=t.readVarintBuf(),this},o.prototype.fromBN=function(t){var e=new i;return this.buf=e.writeVarintBN(t).toBuffer(),this},o.prototype.fromNumber=function(t){var e=new i;return this.buf=e.writeVarintNum(t).toBuffer(),this},o.prototype.toBuffer=function(){return this.buf},o.prototype.toBN=function(){return n(this.buf).readVarintBN()},o.prototype.toNumber=function(){return n(this.buf).readVarintNum()},t.exports=o}).call(this,r(0).Buffer)},function(t,e,r){"use strict";var i=r(1),n=r(2),s=r(7),o=r(13),a=r(0);const u=a.Buffer;var f=r(4),h=r(9),c=r(15),d=r(16);function p(t){return this instanceof p?t?this._fromObject(t):void 0:new p(t)}p.MAXINT=4294967295,p.DEFAULT_SEQNUMBER=4294967295,p.DEFAULT_LOCKTIME_SEQNUMBER=4294967294,p.DEFAULT_RBF_SEQNUMBER=4294967293,p.BASE_SIZE=40,Object.defineProperty(p.prototype,"script",{configurable:!1,enumerable:!0,get:function(){return this.isNull()?null:(this._script||(this._script=new h(this._scriptBuffer),this._script._isInput=!0),this._script)}}),p.fromObject=function(t){return n.checkArgument(i.isObject(t)),(new p)._fromObject(t)},p.prototype._fromObject=function(t){var e;if(e=i.isString(t.prevTxId)&&f.isHexa(t.prevTxId)?a.Buffer.from(t.prevTxId,"hex"):t.prevTxId,this.output=t.output?t.output instanceof d?t.output:new d(t.output):void 0,this.prevTxId=e||t.txidbuf,this.outputIndex=i.isUndefined(t.outputIndex)?t.txoutnum:t.outputIndex,this.sequenceNumber=i.isUndefined(t.sequenceNumber)?i.isUndefined(t.seqnum)?4294967295:t.seqnum:t.sequenceNumber,i.isUndefined(t.script)&&i.isUndefined(t.scriptBuffer))throw new s.Transaction.Input.MissingScript;return this.setScript(t.scriptBuffer||t.script),this},p.prototype.toObject=p.prototype.toJSON=function(){var t={prevTxId:this.prevTxId.toString("hex"),outputIndex:this.outputIndex,sequenceNumber:this.sequenceNumber,script:this._scriptBuffer.toString("hex")};return this.script&&(t.scriptString=this.script.toString()),this.output&&(t.output=this.output.toObject()),t},p.fromBufferReader=function(t){var e=new p;return e.prevTxId=t.readReverse(32),e.outputIndex=t.readUInt32LE(),e._scriptBuffer=t.readVarLengthBuffer(),e.sequenceNumber=t.readUInt32LE(),e},p.prototype.toBufferWriter=function(t){t||(t=new o),t.writeReverse(this.prevTxId),t.writeUInt32LE(this.outputIndex);var e=this._scriptBuffer;return t.writeVarintNum(e.length),t.write(e),t.writeUInt32LE(this.sequenceNumber),t},p.prototype.setScript=function(t){if(this._script=null,t instanceof h)this._script=t,this._script._isInput=!0,this._scriptBuffer=t.toBuffer();else if(null===t)this._script=h.empty(),this._script._isInput=!0,this._scriptBuffer=this._script.toBuffer();else if(f.isHexa(t))this._scriptBuffer=a.Buffer.from(t,"hex");else if(i.isString(t))this._script=new h(t),this._script._isInput=!0,this._scriptBuffer=this._script.toBuffer();else{if(!u.isBuffer(t))throw new TypeError("Invalid argument type: script");this._scriptBuffer=a.Buffer.from(t)}return this},p.prototype.getSignatures=function(){return[]},p.prototype.isFullySigned=function(){throw new s.AbstractMethodInvoked("Input#isFullySigned")},p.prototype.isFinal=function(){return this.sequenceNumber===p.MAXINT},p.prototype.addSignature=function(){},p.prototype.clearSignatures=function(){},p.prototype.isValidSignature=function(t,e){return e.signature.nhashtype=e.sigtype,c.verify(t,e.signature,e.publicKey,e.inputIndex,this.output.script,this.output.satoshisBN)},p.prototype.isNull=function(){return"0000000000000000000000000000000000000000000000000000000000000000"===this.prevTxId.toString("hex")&&4294967295===this.outputIndex},p.prototype._estimateSize=function(){return this.toBufferWriter().toBuffer().length},t.exports=p},function(t,e,r){"use strict";(function(e){var i=r(1),n=r(2),s=r(18),o=r(4),a=r(12),u=r(7),f=r(8);function h(t){if(!(this instanceof h))return new h(t);if(t instanceof h)return t;if(i.isObject(t))return this._fromObject(t);throw new u.InvalidArgument("TransactionSignatures must be instantiated from an object")}s(h,f),h.prototype._fromObject=function(t){return this._checkObjectArgs(t),this.publicKey=new a(t.publicKey),this.prevTxId=e.isBuffer(t.prevTxId)?t.prevTxId:e.from(t.prevTxId,"hex"),this.outputIndex=t.outputIndex,this.inputIndex=t.inputIndex,this.signature=t.signature instanceof f?t.signature:e.isBuffer(t.signature)?f.fromBuffer(t.signature):f.fromString(t.signature),this.sigtype=t.sigtype,this},h.prototype._checkObjectArgs=function(t){n.checkArgument(a(t.publicKey),"publicKey"),n.checkArgument(!i.isUndefined(t.inputIndex),"inputIndex"),n.checkArgument(!i.isUndefined(t.outputIndex),"outputIndex"),n.checkState(i.isNumber(t.inputIndex),"inputIndex must be a number"),n.checkState(i.isNumber(t.outputIndex),"outputIndex must be a number"),n.checkArgument(t.signature,"signature"),n.checkArgument(t.prevTxId,"prevTxId"),n.checkState(t.signature instanceof f||e.isBuffer(t.signature)||o.isHexa(t.signature),"signature must be a buffer or hexa value"),n.checkState(e.isBuffer(t.prevTxId)||o.isHexa(t.prevTxId),"prevTxId must be a buffer or hexa value"),n.checkArgument(t.sigtype,"sigtype"),n.checkState(i.isNumber(t.sigtype),"sigtype must be a number")},h.prototype.toObject=h.prototype.toJSON=function(){return{publicKey:this.publicKey.toString(),prevTxId:this.prevTxId.toString("hex"),outputIndex:this.outputIndex,inputIndex:this.inputIndex,signature:this.signature.toString(),sigtype:this.sigtype}},h.fromObject=function(t){return n.checkArgument(t),new h(t)},t.exports=h}).call(this,r(0).Buffer)},function(t,e,r){"use strict";var i=r(10),n=r(6),s=n.getNAF,o=n.getJSF,a=n.assert;function u(t,e){this.type=t,this.p=new i(e.p,16),this.red=e.prime?i.red(e.prime):i.mont(this.p),this.zero=new i(0).toRed(this.red),this.one=new i(1).toRed(this.red),this.two=new i(2).toRed(this.red),this.n=e.n&&new i(e.n,16),this.g=e.g&&this.pointFromJSON(e.g,e.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var r=this.n&&this.p.div(this.n);!r||r.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}function f(t,e){this.curve=t,this.type=e,this.precomputed=null}t.exports=u,u.prototype.point=function(){throw new Error("Not implemented")},u.prototype.validate=function(){throw new Error("Not implemented")},u.prototype._fixedNafMul=function(t,e){a(t.precomputed);var r=t._getDoubles(),i=s(e,1,this._bitLength),n=(1<<r.step+1)-(r.step%2==0?2:1);n/=3;var o,u,f=[];for(o=0;o<i.length;o+=r.step){u=0;for(var h=o+r.step-1;h>=o;h--)u=(u<<1)+i[h];f.push(u)}for(var c=this.jpoint(null,null,null),d=this.jpoint(null,null,null),p=n;p>0;p--){for(o=0;o<f.length;o++)(u=f[o])===p?d=d.mixedAdd(r.points[o]):u===-p&&(d=d.mixedAdd(r.points[o].neg()));c=c.add(d)}return c.toP()},u.prototype._wnafMul=function(t,e){var r=4,i=t._getNAFPoints(r);r=i.wnd;for(var n=i.points,o=s(e,r,this._bitLength),u=this.jpoint(null,null,null),f=o.length-1;f>=0;f--){for(var h=0;f>=0&&0===o[f];f--)h++;if(f>=0&&h++,u=u.dblp(h),f<0)break;var c=o[f];a(0!==c),u="affine"===t.type?c>0?u.mixedAdd(n[c-1>>1]):u.mixedAdd(n[-c-1>>1].neg()):c>0?u.add(n[c-1>>1]):u.add(n[-c-1>>1].neg())}return"affine"===t.type?u.toP():u},u.prototype._wnafMulAdd=function(t,e,r,i,n){var a,u,f,h=this._wnafT1,c=this._wnafT2,d=this._wnafT3,p=0;for(a=0;a<i;a++){var l=(f=e[a])._getNAFPoints(t);h[a]=l.wnd,c[a]=l.points}for(a=i-1;a>=1;a-=2){var m=a-1,b=a;if(1===h[m]&&1===h[b]){var g=[e[m],null,null,e[b]];0===e[m].y.cmp(e[b].y)?(g[1]=e[m].add(e[b]),g[2]=e[m].toJ().mixedAdd(e[b].neg())):0===e[m].y.cmp(e[b].y.redNeg())?(g[1]=e[m].toJ().mixedAdd(e[b]),g[2]=e[m].add(e[b].neg())):(g[1]=e[m].toJ().mixedAdd(e[b]),g[2]=e[m].toJ().mixedAdd(e[b].neg()));var y=[-3,-1,-5,-7,0,7,5,1,3],v=o(r[m],r[b]);for(p=Math.max(v[0].length,p),d[m]=new Array(p),d[b]=new Array(p),u=0;u<p;u++){var _=0|v[0][u],S=0|v[1][u];d[m][u]=y[3*(_+1)+(S+1)],d[b][u]=0,c[m]=g}}else d[m]=s(r[m],h[m],this._bitLength),d[b]=s(r[b],h[b],this._bitLength),p=Math.max(d[m].length,p),p=Math.max(d[b].length,p)}var w=this.jpoint(null,null,null),I=this._wnafT4;for(a=p;a>=0;a--){for(var E=0;a>=0;){var A=!0;for(u=0;u<i;u++)I[u]=0|d[u][a],0!==I[u]&&(A=!1);if(!A)break;E++,a--}if(a>=0&&E++,w=w.dblp(E),a<0)break;for(u=0;u<i;u++){var P=I[u];0!==P&&(P>0?f=c[u][P-1>>1]:P<0&&(f=c[u][-P-1>>1].neg()),w="affine"===f.type?w.mixedAdd(f):w.add(f))}}for(a=0;a<i;a++)c[a]=null;return n?w:w.toP()},u.BasePoint=f,f.prototype.eq=function(){throw new Error("Not implemented")},f.prototype.validate=function(){return this.curve.validate(this)},u.prototype.decodePoint=function(t,e){t=n.toArray(t,e);var r=this.p.byteLength();if((4===t[0]||6===t[0]||7===t[0])&&t.length-1==2*r)return 6===t[0]?a(t[t.length-1]%2==0):7===t[0]&&a(t[t.length-1]%2==1),this.point(t.slice(1,1+r),t.slice(1+r,1+2*r));if((2===t[0]||3===t[0])&&t.length-1===r)return this.pointFromX(t.slice(1,1+r),3===t[0]);throw new Error("Unknown point format")},f.prototype.encodeCompressed=function(t){return this.encode(t,!0)},f.prototype._encode=function(t){var e=this.curve.p.byteLength(),r=this.getX().toArray("be",e);return t?[this.getY().isEven()?2:3].concat(r):[4].concat(r,this.getY().toArray("be",e))},f.prototype.encode=function(t,e){return n.encode(this._encode(e),t)},f.prototype.precompute=function(t){if(this.precomputed)return this;var e={doubles:null,naf:null,beta:null};return e.naf=this._getNAFPoints(8),e.doubles=this._getDoubles(4,t),e.beta=this._getBeta(),this.precomputed=e,this},f.prototype._hasDoubles=function(t){if(!this.precomputed)return!1;var e=this.precomputed.doubles;return!!e&&e.points.length>=Math.ceil((t.bitLength()+1)/e.step)},f.prototype._getDoubles=function(t,e){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var r=[this],i=this,n=0;n<e;n+=t){for(var s=0;s<t;s++)i=i.dbl();r.push(i)}return{step:t,points:r}},f.prototype._getNAFPoints=function(t){if(this.precomputed&&this.precomputed.naf)return this.precomputed.naf;for(var e=[this],r=(1<<t)-1,i=1===r?null:this.dbl(),n=1;n<r;n++)e[n]=e[n-1].add(i);return{wnd:t,points:e}},f.prototype._getBeta=function(){return null},f.prototype.dblp=function(t){for(var e=this,r=0;r<t;r++)e=e.dbl();return e}},function(t,e,r){var i=e;i.utils=r(11),i.common=r(22),i.sha=r(75),i.ripemd=r(79),i.hmac=r(80),i.sha1=i.sha.sha1,i.sha256=i.sha.sha256,i.sha224=i.sha.sha224,i.sha384=i.sha.sha384,i.sha512=i.sha.sha512,i.ripemd160=i.ripemd.ripemd160},function(t,e){var r,i,n=t.exports={};function s(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function a(t){if(r===setTimeout)return setTimeout(t,0);if((r===s||!r)&&setTimeout)return r=setTimeout,setTimeout(t,0);try{return r(t,0)}catch(e){try{return r.call(null,t,0)}catch(e){return r.call(this,t,0)}}}!function(){try{r="function"==typeof setTimeout?setTimeout:s}catch(t){r=s}try{i="function"==typeof clearTimeout?clearTimeout:o}catch(t){i=o}}();var u,f=[],h=!1,c=-1;function d(){h&&u&&(h=!1,u.length?f=u.concat(f):c=-1,f.length&&p())}function p(){if(!h){var t=a(d);h=!0;for(var e=f.length;e;){for(u=f,f=[];++c<e;)u&&u[c].run();c=-1,e=f.length}u=null,h=!1,function(t){if(i===clearTimeout)return clearTimeout(t);if((i===o||!i)&&clearTimeout)return i=clearTimeout,clearTimeout(t);try{i(t)}catch(e){try{return i.call(null,t)}catch(e){return i.call(this,t)}}}(t)}}function l(t,e){this.fun=t,this.array=e}function m(){}n.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)e[r-1]=arguments[r];f.push(new l(t,e)),1!==f.length||h||a(p)},l.prototype.run=function(){this.fun.apply(null,this.array)},n.title="browser",n.browser=!0,n.env={},n.argv=[],n.version="",n.versions={},n.on=m,n.addListener=m,n.once=m,n.off=m,n.removeListener=m,n.removeAllListeners=m,n.emit=m,n.prependListener=m,n.prependOnceListener=m,n.listeners=function(t){return[]},n.binding=function(t){throw new Error("process.binding is not supported")},n.cwd=function(){return"/"},n.chdir=function(t){throw new Error("process.chdir is not supported")},n.umask=function(){return 0}},function(t,e,r){"use strict";(function(e){var i=r(1),n=r(21),s=r(23),o=r(3),a=r(4),u=r(19),f=r(20),h=r(12),c=r(33),d=r(2);function p(t,e){if(!(this instanceof p))return new p(t,e);if(t instanceof p)return t;var r=this._classifyArguments(t,e);if(!r.bn||0===r.bn.cmp(new o(0)))throw new TypeError("Number can not be equal to zero, undefined, null or false");if(!r.bn.lt(f.getN()))throw new TypeError("Number must be less than N");if(void 0===r.network)throw new TypeError('Must specify the network ("livenet" or "testnet")');return a.defineImmutable(this,{bn:r.bn,compressed:r.compressed,network:r.network}),Object.defineProperty(this,"publicKey",{configurable:!1,enumerable:!0,get:this.toPublicKey.bind(this)}),this}p.prototype._classifyArguments=function(t,r){var n={compressed:!0,network:r?u.get(r):u.defaultNetwork};if(i.isUndefined(t)||i.isNull(t))n.bn=p._getRandomBN();else if(t instanceof o)n.bn=t;else if(t instanceof e||t instanceof Uint8Array)n=p._transformBuffer(t,r);else if(t.bn&&t.network)n=p._transformObject(t);else if(!r&&u.get(t))n.bn=p._getRandomBN(),n.network=u.get(t);else{if("string"!=typeof t)throw new TypeError("First argument is an unrecognized data type.");a.isHexa(t)?n.bn=new o(e.from(t,"hex")):n=p._transformWIF(t,r)}return n},p._getRandomBN=function(){var t,e;do{var r=c.getRandomBuffer(32);t=(e=o.fromBuffer(r)).lt(f.getN())}while(!t);return e},p._transformBuffer=function(t,e){var r={};if(32===t.length)return p._transformBNBuffer(t,e);if(r.network=u.get(t[0],"privatekey"),!r.network)throw new Error("Invalid network");if(e&&r.network!==u.get(e))throw new TypeError("Private key network mismatch");if(34===t.length&&1===t[33])r.compressed=!0;else{if(33!==t.length)throw new Error("Length of buffer must be 33 (uncompressed) or 34 (compressed)");r.compressed=!1}return r.bn=o.fromBuffer(t.slice(1,33)),r},p._transformBNBuffer=function(t,e){var r={};return r.network=u.get(e)||u.defaultNetwork,r.bn=o.fromBuffer(t),r.compressed=!1,r},p._transformWIF=function(t,e){return p._transformBuffer(s.decode(t),e)},p.fromBuffer=function(t,e){return new p(t,e)},p.fromHex=function(t,r){return p.fromBuffer(e.from(t,"hex"),r)},p._transformObject=function(t){return{bn:new o(t.bn,"hex"),network:u.get(t.network),compressed:t.compressed}},p.fromString=p.fromWIF=function(t){return d.checkArgument(i.isString(t),"First argument is expected to be a string."),new p(t)},p.fromObject=p.fromJSON=function(t){return d.checkArgument(i.isObject(t),"First argument is expected to be an object."),new p(t)},p.fromRandom=function(t){var e=p._getRandomBN();return new p(e,t)},p.getValidationError=function(t,e){var r;try{new p(t,e)}catch(t){r=t}return r},p.isValid=function(t,e){return!!t&&!p.getValidationError(t,e)},p.prototype.toString=function(){return this.toWIF()},p.prototype.toWIF=function(){var t,r=this.network;return t=this.compressed?e.concat([e.from([r.privatekey]),this.bn.toBuffer({size:32}),e.from([1])]):e.concat([e.from([r.privatekey]),this.bn.toBuffer({size:32})]),s.encode(t)},p.prototype.toBigNumber=function(){return this.bn},p.prototype.toBuffer=function(){return this.bn.toBuffer({size:32})},p.prototype.toHex=function(){return this.toBuffer().toString("hex")},p.prototype.toPublicKey=function(){return this._pubkey||(this._pubkey=h.fromPrivateKey(this)),this._pubkey},p.prototype.toAddress=function(t){var e=this.toPublicKey();return n.fromPublicKey(e,t||this.network)},p.prototype.toObject=p.prototype.toJSON=function(){return{bn:this.bn.toString("hex"),compressed:this.compressed,network:this.network.toString()}},p.prototype.inspect=function(){var t=this.compressed?"":", uncompressed";return"<PrivateKey: "+this.toHex()+", network: "+this.network+t+">"},t.exports=p}).call(this,r(0).Buffer)},function(t,e,r){"use strict";var i=r(1),n=r(53),s=r(0);const o=s.Buffer;var a="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz".split(""),u=function t(e){if(!(this instanceof t))return new t(e);if(o.isBuffer(e)){var r=e;this.fromBuffer(r)}else if("string"==typeof e){var i=e;this.fromString(i)}};u.validCharacters=function(t){return s.Buffer.isBuffer(t)&&(t=t.toString()),i.every(i.map(t,(function(t){return i.includes(a,t)})))},u.prototype.set=function(t){return this.buf=t.buf||this.buf||void 0,this},u.encode=function(t){if(!s.Buffer.isBuffer(t))throw new Error("Input should be a buffer");return n.encode(t)},u.decode=function(t){if("string"!=typeof t)throw new Error("Input should be a string");return o.from(n.decode(t))},u.prototype.fromBuffer=function(t){return this.buf=t,this},u.fromBuffer=function(t){return(new u).fromBuffer(t)},u.fromHex=function(t){return u.fromBuffer(o.from(t,"hex"))},u.prototype.fromString=function(t){var e=u.decode(t);return this.buf=e,this},u.fromString=function(t){return(new u).fromString(t)},u.prototype.toBuffer=function(){return this.buf},u.prototype.toHex=function(){return this.toBuffer().toString("hex")},u.prototype.toString=function(){return u.encode(this.buf)},t.exports=u},function(t,e,r){t.exports=r(58),t.exports.Input=r(42),t.exports.Output=r(16),t.exports.UnspentOutput=r(59),t.exports.Signature=r(26),t.exports.Sighash=r(15)},function(t,e,r){"use strict";(function(e,i){function n(){}n.getRandomBuffer=function(t){return e.browser?n.getRandomBufferBrowser(t):n.getRandomBufferNode(t)},n.getRandomBufferNode=function(t){return r(36).randomBytes(t)},n.getRandomBufferBrowser=function(t){if(!window.crypto&&!window.msCrypto)throw new Error("window.crypto not available");var e;if(window.crypto&&window.crypto.getRandomValues)e=window.crypto;else{if(!window.msCrypto||!window.msCrypto.getRandomValues)throw new Error("window.crypto.getRandomValues not available");e=window.msCrypto}var r=new Uint8Array(t);return e.getRandomValues(r),i.from(r)},t.exports=n}).call(this,r(29),r(0).Buffer)},function(t,e,r){"use strict";(function(e){const i=r(1),n=r(3),s=r(14),o=r(13),a=r(5),u=r(2),f=function t(e){if(!(this instanceof t))return new t(e);const r=t._from(e);return this.version=r.version,this.prevHash=r.prevHash,this.merkleRoot=r.merkleRoot,this.time=r.time,this.timestamp=r.time,this.bits=r.bits,this.nonce=r.nonce,r.hash&&u.checkState(this.hash===r.hash,"Argument object hash property does not match block hash."),this};f._from=function(t){if(!t)throw new TypeError("Invalid argument for Block");let r={};if(e.isBuffer(t))r=f._fromBufferReader(s(t));else{if(!i.isObject(t))throw new TypeError("Unrecognized argument for BlockHeader");r=f._fromObject(t)}return r},f._fromObject=function(t){u.checkArgument(t,"data is required");let r=t.prevHash,n=t.merkleRoot;return i.isString(t.prevHash)&&(r=e.from(t.prevHash,"hex").reverse()),i.isString(t.merkleRoot)&&(n=e.from(t.merkleRoot,"hex").reverse()),{hash:t.hash,version:t.version,prevHash:r,merkleRoot:n,time:t.time,timestamp:t.time,bits:t.bits,nonce:t.nonce}},f.fromObject=function(t){const e=f._fromObject(t);return new f(e)},f.fromRawBlock=function(t){e.isBuffer(t)||(t=e.from(t,"binary"));const r=s(t);r.pos=f.Constants.START_OF_HEADER;const i=f._fromBufferReader(r);return new f(i)},f.fromBuffer=function(t){const e=f._fromBufferReader(s(t));return new f(e)},f.fromString=function(t){const r=e.from(t,"hex");return f.fromBuffer(r)},f._fromBufferReader=function(t){return{version:t.readInt32LE(),prevHash:t.read(32),merkleRoot:t.read(32),time:t.readUInt32LE(),bits:t.readUInt32LE(),nonce:t.readUInt32LE()}},f.fromBufferReader=function(t){const e=f._fromBufferReader(t);return new f(e)},f.prototype.toObject=f.prototype.toJSON=function(){return{hash:this.hash,version:this.version,prevHash:e.from(this.prevHash).reverse().toString("hex"),merkleRoot:e.from(this.merkleRoot).reverse().toString("hex"),time:this.time,bits:this.bits,nonce:this.nonce}},f.prototype.toBuffer=function(){return this.toBufferWriter().concat()},f.prototype.toString=function(){return this.toBuffer().toString("hex")},f.prototype.toBufferWriter=function(t){return t||(t=new o),t.writeInt32LE(this.version),t.write(this.prevHash),t.write(this.merkleRoot),t.writeUInt32LE(this.time),t.writeUInt32LE(this.bits),t.writeUInt32LE(this.nonce),t},f.prototype.getTargetDifficulty=function(t){t=t||this.bits;let e=new n(16777215&t),r=8*((t>>>24)-3);for(;r-- >0;)e=e.mul(new n(2));return e},f.prototype.getDifficulty=function(){const t=this.getTargetDifficulty(486604799).mul(new n(Math.pow(10,8))),e=this.getTargetDifficulty();let r=t.div(e).toString(10);const i=r.length-8;return r=r.slice(0,i)+"."+r.slice(i),parseFloat(r)},f.prototype._getHash=function(){const t=this.toBuffer();return a.sha512_256sha512_256(t)};const h={configurable:!1,enumerable:!0,get:function(){return this._id||(this._id=s(this._getHash()).readReverse().toString("hex")),this._id},set:i.noop};Object.defineProperty(f.prototype,"id",h),Object.defineProperty(f.prototype,"hash",h),f.prototype.validTimestamp=function(){const t=Math.round((new Date).getTime()/1e3);return this.time<=t+f.Constants.MAX_TIME_OFFSET},f.prototype.validProofOfWork=function(){const t=new n(this.id,"hex"),e=this.getTargetDifficulty();return t.cmp(e)<=0},f.prototype.inspect=function(){return"<BlockHeader "+this.id+">"},f.Constants={START_OF_HEADER:8,MAX_TIME_OFFSET:7200,LARGEST_HASH:new n("10000000000000000000000000000000000000000000000000000000000000000","hex")},t.exports=f}).call(this,r(0).Buffer)},function(t,e){var r;r=function(){return this}();try{r=r||new Function("return this")()}catch(t){"object"==typeof window&&(r=window)}t.exports=r},function(t,e){t.exports=crypto},function(t,e){"function"==typeof Object.create?t.exports=function(t,e){e&&(t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:t.exports=function(t,e){if(e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}}},function(t,e,r){"use strict";var i,n=e,s=r(28),o=r(48),a=r(6).assert;function u(t){"short"===t.type?this.curve=new o.short(t):"edwards"===t.type?this.curve=new o.edwards(t):this.curve=new o.mont(t),this.g=this.curve.g,this.n=this.curve.n,this.hash=t.hash,a(this.g.validate(),"Invalid curve"),a(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function f(t,e){Object.defineProperty(n,t,{configurable:!0,enumerable:!0,get:function(){var r=new u(e);return Object.defineProperty(n,t,{configurable:!0,enumerable:!0,value:r}),r}})}n.PresetCurve=u,f("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:s.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),f("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:s.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),f("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:s.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),f("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:s.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"]}),f("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:s.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"]}),f("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:s.sha256,gRed:!1,g:["9"]}),f("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:s.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});try{i=r(81)}catch(t){i=void 0}f("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:s.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",i]})},function(t,e,r){"use strict";const i=r(0).Buffer;var n=r(28),s=r(2),o=t.exports;o.sha1=function(t){return s.checkArgument(i.isBuffer(t)),i.from(n.sha1().update(t).digest("hex"),"hex")},o.sha1.blocksize=512,o.sha256=function(t){return s.checkArgument(i.isBuffer(t)),i.from(n.sha256().update(t).digest("hex"),"hex")},o.sha256.blocksize=512,o.sha256sha256=function(t){return s.checkArgument(i.isBuffer(t)),o.sha256(o.sha256(t))},o.ripemd160=function(t){return s.checkArgument(i.isBuffer(t)),i.from(n.ripemd160().update(t).digest("hex"),"hex")},o.sha256ripemd160=function(t){return s.checkArgument(i.isBuffer(t)),o.ripemd160(o.sha256(t))},o.sha512=function(t){return s.checkArgument(i.isBuffer(t)),i.from(n.sha512().update(t).digest("hex"),"hex")},o.sha512.blocksize=1024,o.hmac=function(t,e,r){s.checkArgument(i.isBuffer(e)),s.checkArgument(i.isBuffer(r)),s.checkArgument(t.blocksize);var n=t.blocksize/8;if(r.length>n)r=t(r);else if(r<n){var o=i.alloc(n);o.fill(0),r.copy(o),r=o}var a=i.alloc(n);a.fill(92);var u=i.alloc(n);u.fill(54);for(var f=i.alloc(n),h=i.alloc(n),c=0;c<n;c++)f[c]=a[c]^r[c],h[c]=u[c]^r[c];return t(i.concat([f,t(i.concat([h,e]))]))},o.sha256hmac=function(t,e){return o.hmac(o.sha256,t,e)},o.sha512hmac=function(t,e){return o.hmac(o.sha512,t,e)}},function(t,e,r){"use strict";(function(e){var i=r(93);
/*!
* The buffer module from node.js, for the browser.
*
* @author Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
* @license MIT
*/function n(t,e){if(t===e)return 0;for(var r=t.length,i=e.length,n=0,s=Math.min(r,i);n<s;++n)if(t[n]!==e[n]){r=t[n],i=e[n];break}return r<i?-1:i<r?1:0}function s(t){return e.Buffer&&"function"==typeof e.Buffer.isBuffer?e.Buffer.isBuffer(t):!(null==t||!t._isBuffer)}var o=r(94),a=Object.prototype.hasOwnProperty,u=Array.prototype.slice,f="foo"===function(){}.name;function h(t){return Object.prototype.toString.call(t)}function c(t){return!s(t)&&("function"==typeof e.ArrayBuffer&&("function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(t):!!t&&(t instanceof DataView||!!(t.buffer&&t.buffer instanceof ArrayBuffer))))}var d=t.exports=y,p=/\s*function\s+([^\(\s]*)\s*/;function l(t){if(o.isFunction(t)){if(f)return t.name;var e=t.toString().match(p);return e&&e[1]}}function m(t,e){return"string"==typeof t?t.length<e?t:t.slice(0,e):t}function b(t){if(f||!o.isFunction(t))return o.inspect(t);var e=l(t);return"[Function"+(e?": "+e:"")+"]"}function g(t,e,r,i,n){throw new d.AssertionError({message:r,actual:t,expected:e,operator:i,stackStartFunction:n})}function y(t,e){t||g(t,!0,e,"==",d.ok)}function v(t,e,r,i){if(t===e)return!0;if(s(t)&&s(e))return 0===n(t,e);if(o.isDate(t)&&o.isDate(e))return t.getTime()===e.getTime();if(o.isRegExp(t)&&o.isRegExp(e))return t.source===e.source&&t.global===e.global&&t.multiline===e.multiline&&t.lastIndex===e.lastIndex&&t.ignoreCase===e.ignoreCase;if(null!==t&&"object"==typeof t||null!==e&&"object"==typeof e){if(c(t)&&c(e)&&h(t)===h(e)&&!(t instanceof Float32Array||t instanceof Float64Array))return 0===n(new Uint8Array(t.buffer),new Uint8Array(e.buffer));if(s(t)!==s(e))return!1;var a=(i=i||{actual:[],expected:[]}).actual.indexOf(t);return-1!==a&&a===i.expected.indexOf(e)||(i.actual.push(t),i.expected.push(e),function(t,e,r,i){if(null==t||null==e)return!1;if(o.isPrimitive(t)||o.isPrimitive(e))return t===e;if(r&&Object.getPrototypeOf(t)!==Object.getPrototypeOf(e))return!1;var n=_(t),s=_(e);if(n&&!s||!n&&s)return!1;if(n)return t=u.call(t),e=u.call(e),v(t,e,r);var a,f,h=I(t),c=I(e);if(h.length!==c.length)return!1;for(h.sort(),c.sort(),f=h.length-1;f>=0;f--)if(h[f]!==c[f])return!1;for(f=h.length-1;f>=0;f--)if(a=h[f],!v(t[a],e[a],r,i))return!1;return!0}(t,e,r,i))}return r?t===e:t==e}function _(t){return"[object Arguments]"==Object.prototype.toString.call(t)}function S(t,e){if(!t||!e)return!1;if("[object RegExp]"==Object.prototype.toString.call(e))return e.test(t);try{if(t instanceof e)return!0}catch(t){}return!Error.isPrototypeOf(e)&&!0===e.call({},t)}function w(t,e,r,i){var n;if("function"!=typeof e)throw new TypeError('"block" argument must be a function');"string"==typeof r&&(i=r,r=null),n=function(t){var e;try{t()}catch(t){e=t}return e}(e),i=(r&&r.name?" ("+r.name+").":".")+(i?" "+i:"."),t&&!n&&g(n,r,"Missing expected exception"+i);var s="string"==typeof i,a=!t&&n&&!r;if((!t&&o.isError(n)&&s&&S(n,r)||a)&&g(n,r,"Got unwanted exception"+i),t&&n&&r&&!S(n,r)||!t&&n)throw n}d.AssertionError=function(t){this.name="AssertionError",this.actual=t.actual,this.expected=t.expected,this.operator=t.operator,t.message?(this.message=t.message,this.generatedMessage=!1):(this.message=function(t){return m(b(t.actual),128)+" "+t.operator+" "+m(b(t.expected),128)}(this),this.generatedMessage=!0);var e=t.stackStartFunction||g;if(Error.captureStackTrace)Error.captureStackTrace(this,e);else{var r=new Error;if(r.stack){var i=r.stack,n=l(e),s=i.indexOf("\n"+n);if(s>=0){var o=i.indexOf("\n",s+1);i=i.substring(o+1)}this.stack=i}}},o.inherits(d.AssertionError,Error),d.fail=g,d.ok=y,d.equal=function(t,e,r){t!=e&&g(t,e,r,"==",d.equal)},d.notEqual=function(t,e,r){t==e&&g(t,e,r,"!=",d.notEqual)},d.deepEqual=function(t,e,r){v(t,e,!1)||g(t,e,r,"deepEqual",d.deepEqual)},d.deepStrictEqual=function(t,e,r){v(t,e,!0)||g(t,e,r,"deepStrictEqual",d.deepStrictEqual)},d.notDeepEqual=function(t,e,r){v(t,e,!1)&&g(t,e,r,"notDeepEqual",d.notDeepEqual)},d.notDeepStrictEqual=function t(e,r,i){v(e,r,!0)&&g(e,r,i,"notDeepStrictEqual",t)},d.strictEqual=function(t,e,r){t!==e&&g(t,e,r,"===",d.strictEqual)},d.notStrictEqual=function(t,e,r){t===e&&g(t,e,r,"!==",d.notStrictEqual)},d.throws=function(t,e,r){w(!0,t,e,r)},d.doesNotThrow=function(t,e,r){w(!1,t,e,r)},d.ifError=function(t){if(t)throw t},d.strict=i((function t(e,r){e||g(e,!0,r,"==",t)}),d,{equal:d.strictEqual,deepEqual:d.deepStrictEqual,notEqual:d.notStrictEqual,notDeepEqual:d.notDeepStrictEqual}),d.strict.strict=d.strict;var I=Object.keys||function(t){var e=[];for(var r in t)a.call(t,r)&&e.push(r);return e}}).call(this,r(35))},function(t,e,r){"use strict";(function(e){var i=r(1),n=r(2),s=r(4);function o(t){if(!(this instanceof o))return new o(t);var e;if(i.isNumber(t))e=t;else{if(!i.isString(t))throw new TypeError('Unrecognized num type: "'+typeof t+'" for Opcode');e=o.map[t]}return s.defineImmutable(this,{num:e}),this}for(var a in o.fromBuffer=function(t){return n.checkArgument(e.isBuffer(t)),new o(Number("0x"+t.toString("hex")))},o.fromNumber=function(t){return n.checkArgument(i.isNumber(t)),new o(t)},o.fromString=function(t){n.checkArgument(i.isString(t));var e=o.map[t];if(void 0===e)throw new TypeError("Invalid opcodestr");return new o(e)},o.prototype.toHex=function(){return this.num.toString(16)},o.prototype.toBuffer=function(){return e.from(this.toHex(),"hex")},o.prototype.toNumber=function(){return this.num},o.prototype.toString=function(){var t=o.reverseMap[this.num];if(void 0===t)throw new Error("Opcode does not have a string representation");return t},o.smallInt=function(t){return n.checkArgument(i.isNumber(t),"Invalid Argument: n should be number"),n.checkArgument(t>=0&&t<=16,"Invalid Argument: n must be between 0 and 16"),0===t?o("OP_0"):new o(o.map.OP_1+t-1)},o.map={OP_FALSE:0,OP_0:0,OP_PUSHDATA1:76,OP_PUSHDATA2:77,OP_PUSHDATA4:78,OP_1NEGATE:79,OP_RESERVED:80,OP_TRUE:81,OP_1:81,OP_2:82,OP_3:83,OP_4:84,OP_5:85,OP_6:86,OP_7:87,OP_8:88,OP_9:89,OP_10:90,OP_11:91,OP_12:92,OP_13:93,OP_14:94,OP_15:95,OP_16:96,OP_NOP:97,OP_VER:98,OP_IF:99,OP_NOTIF:100,OP_VERIF:101,OP_VERNOTIF:102,OP_ELSE:103,OP_ENDIF:104,OP_VERIFY:105,OP_RETURN:106,OP_TOALTSTACK:107,OP_FROMALTSTACK:108,OP_2DROP:109,OP_2DUP:110,OP_3DUP:111,OP_2OVER:112,OP_2ROT:113,OP_2SWAP:114,OP_IFDUP:115,OP_DEPTH:116,OP_DROP:117,OP_DUP:118,OP_NIP:119,OP_OVER:120,OP_PICK:121,OP_ROLL:122,OP_ROT:123,OP_SWAP:124,OP_TUCK:125,OP_CAT:126,OP_SPLIT:127,OP_NUM2BIN:128,OP_BIN2NUM:129,OP_SIZE:130,OP_INVERT:131,OP_AND:132,OP_OR:133,OP_XOR:134,OP_EQUAL:135,OP_EQUALVERIFY:136,OP_RESERVED1:137,OP_RESERVED2:138,OP_1ADD:139,OP_1SUB:140,OP_2MUL:141,OP_2DIV:142,OP_NEGATE:143,OP_ABS:144,OP_NOT:145,OP_0NOTEQUAL:146,OP_ADD:147,OP_SUB:148,OP_MUL:149,OP_DIV:150,OP_MOD:151,OP_LSHIFT:152,OP_RSHIFT:153,OP_BOOLAND:154,OP_BOOLOR:155,OP_NUMEQUAL:156,OP_NUMEQUALVERIFY:157,OP_NUMNOTEQUAL:158,OP_LESSTHAN:159,OP_GREATERTHAN:160,OP_LESSTHANOREQUAL:161,OP_GREATERTHANOREQUAL:162,OP_MIN:163,OP_MAX:164,OP_WITHIN:165,OP_RIPEMD160:166,OP_SHA1:167,OP_SHA256:168,OP_HASH160:169,OP_HASH256:170,OP_CODESEPARATOR:171,OP_CHECKSIG:172,OP_CHECKSIGVERIFY:173,OP_CHECKMULTISIG:174,OP_CHECKMULTISIGVERIFY:175,OP_CHECKLOCKTIMEVERIFY:177,OP_CHECKSEQUENCEVERIFY:178,OP_NOP1:176,OP_NOP2:177,OP_NOP3:178,OP_NOP4:179,OP_NOP5:180,OP_NOP6:181,OP_NOP7:182,OP_NOP8:183,OP_NOP9:184,OP_NOP10:185,OP_CHECKDATASIG:186,OP_CHECKDATASIGVERIFY:187,OP_REVERSEBYTES:188,OP_STATESEPERATOR:189,OP_STATESEPERATORINDEX_UTXO:190,OP_STATESEPERATORINDEX_OUTPUT:191,OP_SHA512_256:206,OP_HASH512_256:207,OP_PUSHINPUTREF:208,OP_REQUIREINPUTREF:209,OP_DISALLOWPUSHINPUTREF:210,OP_DISALLOWPUSHINPUTREFSIBLING:211,OP_REFHASHDATASUMMARY_UTXO:212,OP_REFHASHVALUESUM_UTXOS:213,OP_REFHASHDATASUMMARY_OUTPUT:214,OP_REFHASHVALUESUM_OUTPUTS:215,OP_PUSHINPUTREFSINGLETON:216,OP_REFTYPE_UTXO:217,OP_REFTYPE_OUTPUT:218,OP_REFVALUESUM_UTXOS:219,OP_REFVALUESUM_OUTPUTS:220,OP_REFOUTPUTCOUNT_UTXOS:221,OP_REFOUTPUTCOUNT_OUTPUTS:222,OP_REFOUTPUTCOUNTZEROVALUED_UTXOS:223,OP_REFOUTPUTCOUNTZEROVALUED_OUTPUTS:224,OP_REFDATASUMMARY_UTXO:225,OP_REFDATASUMMARY_OUTPUT:226,OP_CODESCRIPTHASHVALUESUM_UTXOS:227,OP_CODESCRIPTHASHVALUESUM_OUTPUTS:228,OP_CODESCRIPTHASHOUTPUTCOUNT_UTXOS:229,OP_CODESCRIPTHASHOUTPUTCOUNT_OUTPUTS:230,OP_CODESCRIPTHASHZEROVALUEDOUTPUTCOUNT_UTXOS:231,OP_CODESCRIPTHASHZEROVALUEDOUTPUTCOUNT_OUTPUTS:232,OP_CODESCRIPTBYTECODE_UTXO:233,OP_CODESCRIPTBYTECODE_OUTPUT:234,OP_STATECRIPTBYTECODE_UTXO:235,OP_STATECRIPTBYTECODE_OUTPUT:236,OP_PUBKEYHASH:253,OP_PUBKEY:254,OP_INVALIDOPCODE:255},o.reverseMap=[],o.map)o.reverseMap[o.map[a]]=a;i.extend(o,o.map),o.isSmallIntOp=function(t){return t instanceof o&&(t=t.toNumber()),t===o.map.OP_0||t>=o.map.OP_1&&t<=o.map.OP_16},o.prototype.inspect=function(){return"<Opcode: "+this.toString()+", hex: "+this.toHex()+", decimal: "+this.num+">"},t.exports=o}).call(this,r(0).Buffer)},function(t,e,r){t.exports=r(25),t.exports.PublicKey=r(105),t.exports.PublicKeyHash=r(106),t.exports.MultiSig=r(107),t.exports.MultiSigScriptHash=r(108)},function(t,e){t.exports=function(t){return t.webpackPolyfill||(t.deprecate=function(){},t.paths=[],t.children||(t.children=[]),Object.defineProperty(t,"loaded",{enumerable:!0,get:function(){return t.l}}),Object.defineProperty(t,"id",{enumerable:!0,get:function(){return t.i}}),t.webpackPolyfill=1),t}},function(t,e,r){"use strict";(function(e){var i=r(3),n=r(20),s=r(8),o=r(12),a=r(33),u=r(5),f=r(1),h=r(2),c=function t(e){if(!(this instanceof t))return new t(e);e&&this.set(e)};c.prototype.set=function(t){return this.hashbuf=t.hashbuf||this.hashbuf,this.endian=t.endian||this.endian,this.privkey=t.privkey||this.privkey,this.pubkey=t.pubkey||(this.privkey?this.privkey.publicKey:this.pubkey),this.sig=t.sig||this.sig,this.k=t.k||this.k,this.verified=t.verified||this.verified,this},c.prototype.privkey2pubkey=function(){this.pubkey=this.privkey.toPublicKey()},c.prototype.calci=function(){for(var t=0;t<4;t++){var e;this.sig.i=t;try{e=this.toPublicKey()}catch(t){console.error(t);continue}if(e.point.eq(this.pubkey.point))return this.sig.compressed=this.pubkey.compressed,this}throw this.sig.i=void 0,new Error("Unable to find valid recovery factor")},c.fromString=function(t){var e=JSON.parse(t);return new c(e)},c.prototype.randomK=function(){var t,e=n.getN();do{t=i.fromBuffer(a.getRandomBuffer(32))}while(!t.lt(e)||!t.gt(i.Zero));return this.k=t,this},c.prototype.deterministicK=function(t){f.isUndefined(t)&&(t=0);var r=e.alloc(32);r.fill(1);var s=e.alloc(32);s.fill(0);var o=this.privkey.bn.toBuffer({size:32}),a="little"===this.endian?e.from(this.hashbuf).reverse():this.hashbuf;s=u.sha256hmac(e.concat([r,e.from([0]),o,a]),s),r=u.sha256hmac(r,s),s=u.sha256hmac(e.concat([r,e.from([1]),o,a]),s),r=u.sha256hmac(r,s),r=u.sha256hmac(r,s);for(var h=i.fromBuffer(r),c=n.getN(),d=0;d<t||!h.lt(c)||!h.gt(i.Zero);d++)s=u.sha256hmac(e.concat([r,e.from([0])]),s),r=u.sha256hmac(r,s),r=u.sha256hmac(r,s),h=i.fromBuffer(r);return this.k=h,this},c.prototype.toPublicKey=function(){var t=this.sig.i;h.checkArgument(0===t||1===t||2===t||3===t,new Error("i must be equal to 0, 1, 2, or 3"));var e=i.fromBuffer(this.hashbuf),r=this.sig.r,s=this.sig.s,a=1&t,u=t>>1,f=n.getN(),c=n.getG(),d=u?r.add(f):r,p=n.fromX(a,d);if(!p.mul(f).isInfinity())throw new Error("nR is not a valid curve point");var l=e.neg().umod(f),m=r.invm(f),b=p.mul(s).add(c.mul(l)).mul(m);return o.fromPoint(b,this.sig.compressed)},c.prototype.sigError=function(){if(!e.isBuffer(this.hashbuf)||32!==this.hashbuf.length)return"hashbuf must be a 32 byte buffer";var t=this.sig.r,r=this.sig.s;if(!(t.gt(i.Zero)&&t.lt(n.getN())&&r.gt(i.Zero)&&r.lt(n.getN())))return"r and s not in range";var s=i.fromBuffer(this.hashbuf,this.endian?{endian:this.endian}:void 0),o=n.getN(),a=r.invm(o),u=a.mul(s).umod(o),f=a.mul(t).umod(o),h=n.getG().mulAdd(u,this.pubkey.point,f);return h.isInfinity()?"p is infinity":0!==h.getX().umod(o).cmp(t)&&"Invalid signature"},c.toLowS=function(t){return t.gt(i.fromBuffer(e.from("7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0","hex")))&&(t=n.getN().sub(t)),t},c.prototype._findSignature=function(t,e){var r,s,o,a,u=n.getN(),f=n.getG(),h=0;do{(!this.k||h>0)&&this.deterministicK(h),h++,r=this.k,s=f.mul(r),o=new i(1).mul(s.x.umod(u)),a=r.invm(u).mul(e.add(t.mul(o))).umod(u)}while(o.cmp(i.Zero)<=0||a.cmp(i.Zero)<=0);return{s:a=c.toLowS(a),r:o}},c.prototype.sign=function(){var t=this.hashbuf,r=this.privkey,n=r.bn;h.checkState(t&&r&&n,new Error("invalid parameters")),h.checkState(e.isBuffer(t)&&32===t.length,new Error("hashbuf must be a 32 byte buffer"));var o=i.fromBuffer(t,this.endian?{endian:this.endian}:void 0),a=this._findSignature(n,o);return a.compressed=this.pubkey.compressed,this.sig=new s(a),this},c.prototype.signRandomK=function(){return this.randomK(),this.sign()},c.prototype.toString=function(){var t={};return this.hashbuf&&(t.hashbuf=this.hashbuf.toString("hex")),this.privkey&&(t.privkey=this.privkey.toString()),this.pubkey&&(t.pubkey=this.pubkey.toString()),this.sig&&(t.sig=this.sig.toString()),this.k&&(t.k=this.k.toString()),JSON.stringify(t)},c.prototype.verify=function(){return this.sigError()?this.verified=!1:this.verified=!0,this},c.sign=function(t,e,r){return c().set({hashbuf:t,endian:r,privkey:e}).sign().sig},c.signWithCalcI=function(t,e,r){return c().set({hashbuf:t,endian:r,privkey:e}).sign().calci().sig},c.signRandomK=function(t,e,r){return c().set({hashbuf:t,endian:r,privkey:e}).signRandomK().sig},c.verify=function(t,e,r,i){return c().set({hashbuf:t,endian:i,sig:e,pubkey:r}).verify().verified},t.exports=c}).call(this,r(0).Buffer)},function(t,e,r){"use strict";var i=e;i.version=r(70).version,i.utils=r(6),i.rand=r(47),i.curve=r(48),i.curves=r(38),i.ec=r(82),i.eddsa=r(86)},function(t,e,r){"use strict";var i=e;function n(t){return 1===t.length?"0"+t:t}function s(t){for(var e="",r=0;r<t.length;r++)e+=n(t[r].toString(16));return e}i.toArray=function(t,e){if(Array.isArray(t))return t.slice();if(!t)return[];var r=[];if("string"!=typeof t){for(var i=0;i<t.length;i++)r[i]=0|t[i];return r}if("hex"===e){(t=t.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(t="0"+t);for(i=0;i<t.length;i+=2)r.push(parseInt(t[i]+t[i+1],16))}else for(i=0;i<t.length;i++){var n=t.charCodeAt(i),s=n>>8,o=255&n;s?r.push(s,o):r.push(o)}return r},i.zero2=n,i.toHex=s,i.encode=function(t,e){return"hex"===e?s(t):t}},function(t,e,r){var i;function n(t){this.rand=t}if(t.exports=function(t){return i||(i=new n(null)),i.generate(t)},t.exports.Rand=n,n.prototype.generate=function(t){return this._rand(t)},n.prototype._rand=function(t){if(this.rand.getBytes)return this.rand.getBytes(t);for(var e=new Uint8Array(t),r=0;r<e.length;r++)e[r]=this.rand.getByte();return e},"object"==typeof self)self.crypto&&self.crypto.getRandomValues?n.prototype._rand=function(t){var e=new Uint8Array(t);return self.crypto.getRandomValues(e),e}:self.msCrypto&&self.msCrypto.getRandomValues?n.prototype._rand=function(t){var e=new Uint8Array(t);return self.msCrypto.getRandomValues(e),e}:"object"==typeof window&&(n.prototype._rand=function(){throw new Error("Not implemented yet")});else try{var s=r(36);if("function"!=typeof s.randomBytes)throw new Error("Not supported");n.prototype._rand=function(t){return s.randomBytes(t)}}catch(t){}},function(t,e,r){"use strict";var i=e;i.base=r(27),i.short=r(72),i.mont=r(73),i.edwards=r(74)},function(t,e,r){"use strict";var i=r(11).rotr32;function n(t,e,r){return t&e^~t&r}function s(t,e,r){return t&e^t&r^e&r}function o(t,e,r){return t^e^r}e.ft_1=function(t,e,r,i){return 0===t?n(e,r,i):1===t||3===t?o(e,r,i):2===t?s(e,r,i):void 0},e.ch32=n,e.maj32=s,e.p32=o,e.s0_256=function(t){return i(t,2)^i(t,13)^i(t,22)},e.s1_256=function(t){return i(t,6)^i(t,11)^i(t,25)},e.g0_256=function(t){return i(t,7)^i(t,18)^t>>>3},e.g1_256=function(t){return i(t,17)^i(t,19)^t>>>10}},function(t,e,r){"use strict";var i=r(11),n=r(22),s=r(49),o=r(17),a=i.sum32,u=i.sum32_4,f=i.sum32_5,h=s.ch32,c=s.maj32,d=s.s0_256,p=s.s1_256,l=s.g0_256,m=s.g1_256,b=n.BlockHash,g=[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 y(){if(!(this instanceof y))return new y;b.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=g,this.W=new Array(64)}i.inherits(y,b),t.exports=y,y.blockSize=512,y.outSize=256,y.hmacStrength=192,y.padLength=64,y.prototype._update=function(t,e){for(var r=this.W,i=0;i<16;i++)r[i]=t[e+i];for(;i<r.length;i++)r[i]=u(m(r[i-2]),r[i-7],l(r[i-15]),r[i-16]);var n=this.h[0],s=this.h[1],b=this.h[2],g=this.h[3],y=this.h[4],v=this.h[5],_=this.h[6],S=this.h[7];for(o(this.k.length===r.length),i=0;i<r.length;i++){var w=f(S,p(y),h(y,v,_),this.k[i],r[i]),I=a(d(n),c(n,s,b));S=_,_=v,v=y,y=a(g,w),g=b,b=s,s=n,n=a(w,I)}this.h[0]=a(this.h[0],n),this.h[1]=a(this.h[1],s),this.h[2]=a(this.h[2],b),this.h[3]=a(this.h[3],g),this.h[4]=a(this.h[4],y),this.h[5]=a(this.h[5],v),this.h[6]=a(this.h[6],_),this.h[7]=a(this.h[7],S)},y.prototype._digest=function(t){return"hex"===t?i.toHex32(this.h,"big"):i.split32(this.h,"big")}},function(t,e,r){"use strict";var i=r(11),n=r(22),s=r(17),o=i.rotr64_hi,a=i.rotr64_lo,u=i.shr64_hi,f=i.shr64_lo,h=i.sum64,c=i.sum64_hi,d=i.sum64_lo,p=i.sum64_4_hi,l=i.sum64_4_lo,m=i.sum64_5_hi,b=i.sum64_5_lo,g=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 v(){if(!(this instanceof v))return new v;g.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 _(t,e,r,i,n){var s=t&r^~t&n;return s<0&&(s+=4294967296),s}function S(t,e,r,i,n,s){var o=e&i^~e&s;return o<0&&(o+=4294967296),o}function w(t,e,r,i,n){var s=t&r^t&n^r&n;return s<0&&(s+=4294967296),s}function I(t,e,r,i,n,s){var o=e&i^e&s^i&s;return o<0&&(o+=4294967296),o}function E(t,e){var r=o(t,e,28)^o(e,t,2)^o(e,t,7);return r<0&&(r+=4294967296),r}function A(t,e){var r=a(t,e,28)^a(e,t,2)^a(e,t,7);return r<0&&(r+=4294967296),r}function P(t,e){var r=o(t,e,14)^o(t,e,18)^o(e,t,9);return r<0&&(r+=4294967296),r}function O(t,e){var r=a(t,e,14)^a(t,e,18)^a(e,t,9);return r<0&&(r+=4294967296),r}function M(t,e){var r=o(t,e,1)^o(t,e,8)^u(t,e,7);return r<0&&(r+=4294967296),r}function k(t,e){var r=a(t,e,1)^a(t,e,8)^f(t,e,7);return r<0&&(r+=4294967296),r}function T(t,e){var r=o(t,e,19)^o(e,t,29)^u(t,e,6);return r<0&&(r+=4294967296),r}function R(t,e){var r=a(t,e,19)^a(e,t,29)^f(t,e,6);return r<0&&(r+=4294967296),r}i.inherits(v,g),t.exports=v,v.blockSize=1024,v.outSize=512,v.hmacStrength=192,v.padLength=128,v.prototype._prepareBlock=function(t,e){for(var r=this.W,i=0;i<32;i++)r[i]=t[e+i];for(;i<r.length;i+=2){var n=T(r[i-4],r[i-3]),s=R(r[i-4],r[i-3]),o=r[i-14],a=r[i-13],u=M(r[i-30],r[i-29]),f=k(r[i-30],r[i-29]),h=r[i-32],c=r[i-31];r[i]=p(n,s,o,a,u,f,h,c),r[i+1]=l(n,s,o,a,u,f,h,c)}},v.prototype._update=function(t,e){this._prepareBlock(t,e);var r=this.W,i=this.h[0],n=this.h[1],o=this.h[2],a=this.h[3],u=this.h[4],f=this.h[5],p=this.h[6],l=this.h[7],g=this.h[8],y=this.h[9],v=this.h[10],M=this.h[11],k=this.h[12],T=this.h[13],R=this.h[14],x=this.h[15];s(this.k.length===r.length);for(var N=0;N<r.length;N+=2){var B=R,U=x,C=P(g,y),L=O(g,y),H=_(g,y,v,M,k),D=S(g,y,v,M,k,T),F=this.k[N],K=this.k[N+1],z=r[N],j=r[N+1],V=m(B,U,C,L,H,D,F,K,z,j),q=b(B,U,C,L,H,D,F,K,z,j);B=E(i,n),U=A(i,n),C=w(i,n,o,a,u),L=I(i,n,o,a,u,f);var Y=c(B,U,C,L),G=d(B,U,C,L);R=k,x=T,k=v,T=M,v=g,M=y,g=c(p,l,V,q),y=d(l,l,V,q),p=u,l=f,u=o,f=a,o=i,a=n,i=c(V,q,Y,G),n=d(V,q,Y,G)}h(this.h,0,i,n),h(this.h,2,o,a),h(this.h,4,u,f),h(this.h,6,p,l),h(this.h,8,g,y),h(this.h,10,v,M),h(this.h,12,k,T),h(this.h,14,R,x)},v.prototype._digest=function(t){return"hex"===t?i.toHex32(this.h,"big"):i.split32(this.h,"big")}},function(t,e,r){(function(e,i){var n;
/*
* [js-sha512]{@link https://github.com/emn178/js-sha512}
*
* @version 0.8.0
* @author Chen, Yi-Cyuan [emn178@gmail.com]
* @copyright Chen, Yi-Cyuan 2014-2018
* @license MIT
*/!function(){"use strict";var s="input is invalid type",o="object"==typeof window,a=o?window:{};a.JS_SHA512_NO_WINDOW&&(o=!1);var u=!o&&"object"==typeof self;!a.JS_SHA512_NO_NODE_JS&&"object"==typeof e&&e.versions&&e.versions.node?a=i:u&&(a=self);var f=!a.JS_SHA512_NO_COMMON_JS&&"object"==typeof t&&t.exports,h=r(90),c=!a.JS_SHA512_NO_ARRAY_BUFFER&&"undefined"!=typeof ArrayBuffer,d="0123456789abcdef".split(""),p=[-2147483648,8388608,32768,128],l=[24,16,8,0],m=[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],b=["hex","array","digest","arrayBuffer"],g=[];!a.JS_SHA512_NO_NODE_JS&&Array.isArray||(Array.isArray=function(t){return"[object Array]"===Object.prototype.toString.call(t)}),!c||!a.JS_SHA512_NO_ARRAY_BUFFER_IS_VIEW&&ArrayBuffer.isView||(ArrayBuffer.isView=function(t){return"object"==typeof t&&t.buffer&&t.buffer.constructor===ArrayBuffer});var y=function(t,e){return function(r){return new w(e,!0).update(r)[t]()}},v=function(t){var e=y("hex",t);e.create=function(){return new w(t)},e.update=function(t){return e.create().update(t)};for(var r=0;r<b.length;++r){var i=b[r];e[i]=y(i,t)}return e},_=function(t,e){return function(r,i){return new I(r,e,!0).update(i)[t]()}},S=function(t){var e=_("hex",t);e.create=function(e){return new I(e,t)},e.update=function(t,r){return e.create(t).update(r)};for(var r=0;r<b.length;++r){var i=b[r];e[i]=_(i,t)}return e};function w(t,e){e?(g[0]=g[1]=g[2]=g[3]=g[4]=g[5]=g[6]=g[7]=g[8]=g[9]=g[10]=g[11]=g[12]=g[13]=g[14]=g[15]=g[16]=g[17]=g[18]=g[19]=g[20]=g[21]=g[22]=g[23]=g[24]=g[25]=g[26]=g[27]=g[28]=g[29]=g[30]=g[31]=g[32]=0,this.blocks=g):this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],384==t?(this.h0h=3418070365,this.h0l=3238371032,this.h1h=1654270250,this.h1l=914150663,this.h2h=2438529370,this.h2l=812702999,this.h3h=355462360,this.h3l=4144912697,this.h4h=1731405415,this.h4l=4290775857,this.h5h=2394180231,this.h5l=1750603025,this.h6h=3675008525,this.h6l=1694076839,this.h7h=1203062813,this.h7l=3204075428):256==t?(this.h0h=573645204,this.h0l=4230739756,this.h1h=2673172387,this.h1l=3360449730,this.h2h=596883563,this.h2l=1867755857,this.h3h=2520282905,this.h3l=1497426621,this.h4h=2519219938,this.h4l=2827943907,this.h5h=3193839141,this.h5l=1401305490,this.h6h=721525244,this.h6l=746961066,this.h7h=246885852,this.h7l=2177182882):224==t?(this.h0h=2352822216,this.h0l=424955298,this.h1h=1944164710,this.h1l=2312950998,this.h2h=502970286,this.h2l=855612546,this.h3h=1738396948,this.h3l=1479516111,this.h4h=258812777,this.h4l=2077511080,this.h5h=2011393907,this.h5l=79989058,this.h6h=1067287976,this.h6l=1780299464,this.h7h=286451373,this.h7l=2446758561):(this.h0h=1779033703,this.h0l=4089235720,this.h1h=3144134277,this.h1l=2227873595,this.h2h=1013904242,this.h2l=4271175723,this.h3h=2773480762,this.h3l=1595750129,this.h4h=1359893119,this.h4l=2917565137,this.h5h=2600822924,this.h5l=725511199,this.h6h=528734635,this.h6l=4215389547,this.h7h=1541459225,this.h7l=327033209),this.bits=t,this.block=this.start=this.bytes=this.hBytes=0,this.finalized=this.hashed=!1}function I(t,e,r){var i,n=typeof t;if("string"!==n){if("object"!==n)throw new Error(s);if(null===t)throw new Error(s);if(c&&t.constructor===ArrayBuffer)t=new Uint8Array(t);else if(!(Array.isArray(t)||c&&ArrayBuffer.isView(t)))throw new Error(s);i=!0}var o=t.length;if(!i){for(var a,u=[],f=(o=t.length,0),h=0;h<o;++h)(a=t.charCodeAt(h))<128?u[f++]=a:a<2048?(u[f++]=192|a>>6,u[f++]=128|63&a):a<55296||a>=57344?(u[f++]=224|a>>12,u[f++]=128|a>>6&63,u[f++]=128|63&a):(a=65536+((1023&a)<<10|1023&t.charCodeAt(++h)),u[f++]=240|a>>18,u[f++]=128|a>>12&63,u[f++]=128|a>>6&63,u[f++]=128|63&a);t=u}t.length>128&&(t=new w(e,!0).update(t).array());var d=[],p=[];for(h=0;h<128;++h){var l=t[h]||0;d[h]=92^l,p[h]=54^l}w.call(this,e,r),this.update(p),this.oKeyPad=d,this.inner=!0,this.sharedMemory=r}w.prototype.update=function(t){if(this.finalized)throw new Error("finalize already called");var e,r=typeof t;if("string"!==r){if("object"!==r)throw new Error(s);if(null===t)throw new Error(s);if(c&&t.constructor===ArrayBuffer)t=new Uint8Array(t);else if(!(Array.isArray(t)||c&&ArrayBuffer.isView(t)))throw new Error(s);e=!0}for(var i,n,o=0,a=t.length,u=this.blocks;o<a;){if(this.hashed&&(this.hashed=!1,u[0]=this.block,u[1]=u[2]=u[3]=u[4]=u[5]=u[6]=u[7]=u[8]=u[9]=u[10]=u[11]=u[12]=u[13]=u[14]=u[15]=u[16]=u[17]=u[18]=u[19]=u[20]=u[21]=u[22]=u[23]=u[24]=u[25]=u[26]=u[27]=u[28]=u[29]=u[30]=u[31]=u[32]=0),e)for(n=this.start;o<a&&n<128;++o)u[n>>2]|=t[o]<<l[3&n++];else for(n=this.start;o<a&&n<128;++o)(i=t.charCodeAt(o))<128?u[n>>2]|=i<<l[3&n++]:i<2048?(u[n>>2]|=(192|i>>6)<<l[3&n++],u[n>>2]|=(128|63&i)<<l[3&n++]):i<55296||i>=57344?(u[n>>2]|=(224|i>>12)<<l[3&n++],u[n>>2]|=(128|i>>6&63)<<l[3&n++],u[n>>2]|=(128|63&i)<<l[3&n++]):(i=65536+((1023&i)<<10|1023&t.charCodeAt(++o)),u[n>>2]|=(240|i>>18)<<l[3&n++],u[n>>2]|=(128|i>>12&63)<<l[3&n++],u[n>>2]|=(128|i>>6&63)<<l[3&n++],u[n>>2]|=(128|63&i)<<l[3&n++]);this.lastByteIndex=n,this.bytes+=n-this.start,n>=128?(this.block=u[32],this.start=n-128,this.hash(),this.hashed=!0):this.start=n}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296<<0,this.bytes=this.bytes%4294967296),this},w.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var t=this.blocks,e=this.lastByteIndex;t[32]=this.block,t[e>>2]|=p[3&e],this.block=t[32],e>=112&&(this.hashed||this.hash(),t[0]=this.block,t[1]=t[2]=t[3]=t[4]=t[5]=t[6]=t[7]=t[8]=t[9]=t[10]=t[11]=t[12]=t[13]=t[14]=t[15]=t[16]=t[17]=t[18]=t[19]=t[20]=t[21]=t[22]=t[23]=t[24]=t[25]=t[26]=t[27]=t[28]=t[29]=t[30]=t[31]=t[32]=0),t[30]=this.hBytes<<3|this.bytes>>>29,t[31]=this.bytes<<3,this.hash()}},w.prototype.hash=function(){var t,e,r,i,n,s,o,a,u,f,h,c,d,p,l,b,g,y,v,_,S,w,I,E,A,P=this.h0h,O=this.h0l,M=this.h1h,k=this.h1l,T=this.h2h,R=this.h2l,x=this.h3h,N=this.h3l,B=this.h4h,U=this.h4l,C=this.h5h,L=this.h5l,H=this.h6h,D=this.h6l,F=this.h7h,K=this.h7l,z=this.blocks;for(t=32;t<160;t+=2)e=((_=z[t-30])>>>1|(S=z[t-29])<<31)^(_>>>8|S<<24)^_>>>7,r=(S>>>1|_<<31)^(S>>>8|_<<24)^(S>>>7|_<<25),i=((_=z[t-4])>>>19|(S=z[t-3])<<13)^(S>>>29|_<<3)^_>>>6,n=(S>>>19|_<<13)^(_>>>29|S<<3)^(S>>>6|_<<26),_=z[t-32],S=z[t-31],u=((w=z[t-14])>>>16)+(_>>>16)+(e>>>16)+(i>>>16)+((a=(65535&w)+(65535&_)+(65535&e)+(65535&i)+((o=((I=z[t-13])>>>16)+(S>>>16)+(r>>>16)+(n>>>16)+((s=(65535&I)+(65535&S)+(65535&r)+(65535&n))>>>16))>>>16))>>>16),z[t]=u<<16|65535&a,z[t+1]=o<<16|65535&s;var j=P,V=O,q=M,Y=k,G=T,X=R,Z=x,W=N,J=B,Q=U,$=C,tt=L,et=H,rt=D,it=F,nt=K;for(b=q&G,g=Y&X,t=0;t<160;t+=8)e=(j>>>28|V<<4)^(V>>>2|j<<30)^(V>>>7|j<<25),r=(V>>>28|j<<4)^(j>>>2|V<<30)^(j>>>7|V<<25),i=(J>>>14|Q<<18)^(J>>>18|Q<<14)^(Q>>>9|J<<23),n=(Q>>>14|J<<18)^(Q>>>18|J<<14)^(J>>>9|Q<<23),y=(f=j&q)^j&G^b,v=(h=V&Y)^V&X^g,E=J&$^~J&et,A=Q&tt^~Q&rt,_=z[t],S=z[t+1],_=(u=((w=m[t])>>>16)+(_>>>16)+(E>>>16)+(i>>>16)+(it>>>16)+((a=(65535&w)+(65535&_)+(65535&E)+(65535&i)+(65535&it)+((o=((I=m[t+1])>>>16)+(S>>>16)+(A>>>16)+(n>>>16)+(nt>>>16)+((s=(65535&I)+(65535&S)+(65535&A)+(65535&n)+(65535&nt))>>>16))>>>16))>>>16))<<16|65535&a,S=o<<16|65535&s,w=(u=(y>>>16)+(e>>>16)+((a=(65535&y)+(65535&e)+((o=(v>>>16)+(r>>>16)+((s=(65535&v)+(65535&r))>>>16))>>>16))>>>16))<<16|65535&a,I=o<<16|65535&s,it=(u=(Z>>>16)+(_>>>16)+((a=(65535&Z)+(65535&_)+((o=(W>>>16)+(S>>>16)+((s=(65535&W)+(65535&S))>>>16))>>>16))>>>16))<<16|65535&a,nt=o<<16|65535&s,e=((Z=(u=(w>>>16)+(_>>>16)+((a=(65535&w)+(65535&_)+((o=(I>>>16)+(S>>>16)+((s=(65535&I)+(65535&S))>>>16))>>>16))>>>16))<<16|65535&a)>>>28|(W=o<<16|65535&s)<<4)^(W>>>2|Z<<30)^(W>>>7|Z<<25),r=(W>>>28|Z<<4)^(Z>>>2|W<<30)^(Z>>>7|W<<25),i=(it>>>14|nt<<18)^(it>>>18|nt<<14)^(nt>>>9|it<<23),n=(nt>>>14|it<<18)^(nt>>>18|it<<14)^(it>>>9|nt<<23),y=(c=Z&j)^Z&q^f,v=(d=W&V)^W&Y^h,E=it&J^~it&$,A=nt&Q^~nt&tt,_=z[t+2],S=z[t+3],_=(u=((w=m[t+2])>>>16)+(_>>>16)+(E>>>16)+(i>>>16)+(et>>>16)+((a=(65535&w)+(65535&_)+(65535&E)+(65535&i)+(65535&et)+((o=((I=m[t+3])>>>16)+(S>>>16)+(A>>>16)+(n>>>16)+(rt>>>16)+((s=(65535&I)+(65535&S)+(65535&A)+(65535&n)+(65535&rt))>>>16))>>>16))>>>16))<<16|65535&a,S=o<<16|65535&s,w=(u=(y>>>16)+(e>>>16)+((a=(65535&y)+(65535&e)+((o=(v>>>16)+(r>>>16)+((s=(65535&v)+(65535&r))>>>16))>>>16))>>>16))<<16|65535&a,I=o<<16|65535&s,et=(u=(G>>>16)+(_>>>16)+((a=(65535&G)+(65535&_)+((o=(X>>>16)+(S>>>16)+((s=(65535&X)+(65535&S))>>>16))>>>16))>>>16))<<16|65535&a,rt=o<<16|65535&s,e=((G=(u=(w>>>16)+(_>>>16)+((a=(65535&w)+(65535&_)+((o=(I>>>16)+(S>>>16)+((s=(65535&I)+(65535&S))>>>16))>>>16))>>>16))<<16|65535&a)>>>28|(X=o<<16|65535&s)<<4)^(X>>>2|G<<30)^(X>>>7|G<<25),r=(X>>>28|G<<4)^(G>>>2|X<<30)^(G>>>7|X<<25),i=(et>>>14|rt<<18)^(et>>>18|rt<<14)^(rt>>>9|et<<23),n=(rt>>>14|et<<18)^(rt>>>18|et<<14)^(et>>>9|rt<<23),y=(p=G&Z)^G&j^c,v=(l=X&W)^X&V^d,E=et&it^~et&J,A=rt&nt^~rt&Q,_=z[t+4],S=z[t+5],_=(u=((w=m[t+4])>>>16)+(_>>>16)+(E>>>16)+(i>>>16)+($>>>16)+((a=(65535&w)+(65535&_)+(65535&E)+(65535&i)+(65535&$)+((o=((I=m[t+5])>>>16)+(S>>>16)+(A>>>16)+(n>>>16)+(tt>>>16)+((s=(65535&I)+(65535&S)+(65535&A)+(65535&n)+(65535&tt))>>>16))>>>16))>>>16))<<16|65535&a,S=o<<16|65535&s,w=(u=(y>>>16)+(e>>>16)+((a=(65535&y)+(65535&e)+((o=(v>>>16)+(r>>>16)+((s=(65535&v)+(65535&r))>>>16))>>>16))>>>16))<<16|65535&a,I=o<<16|65535&s,$=(u=(q>>>16)+(_>>>16)+((a=(65535&q)+(65535&_)+((o=(Y>>>16)+(S>>>16)+((s=(65535&Y)+(65535&S))>>>16))>>>16))>>>16))<<16|65535&a,tt=o<<16|65535&s,e=((q=(u=(w>>>16)+(_>>>16)+((a=(65535&w)+(65535&_)+((o=(I>>>16)+(S>>>16)+((s=(65535&I)+(65535&S))>>>16))>>>16))>>>16))<<16|65535&a)>>>28|(Y=o<<16|65535&s)<<4)^(Y>>>2|q<<30)^(Y>>>7|q<<25),r=(Y>>>28|q<<4)^(q>>>2|Y<<30)^(q>>>7|Y<<25),i=($>>>14|tt<<18)^($>>>18|tt<<14)^(tt>>>9|$<<23),n=(tt>>>14|$<<18)^(tt>>>18|$<<14)^($>>>9|tt<<23),y=(b=q&G)^q&Z^p,v=(g=Y&X)^Y&W^l,E=$&et^~$&it,A=tt&rt^~tt&nt,_=z[t+6],S=z[t+7],_=(u=((w=m[t+6])>>>16)+(_>>>16)+(E>>>16)+(i>>>16)+(J>>>16)+((a=(65535&w)+(65535&_)+(65535&E)+(65535&i)+(65535&J)+((o=((I=m[t+7])>>>16)+(S>>>16)+(A>>>16)+(n>>>16)+(Q>>>16)+((s=(65535&I)+(65535&S)+(65535&A)+(65535&n)+(65535&Q))>>>16))>>>16))>>>16))<<16|65535&a,S=o<<16|65535&s,w=(u=(y>>>16)+(e>>>16)+((a=(65535&y)+(65535&e)+((o=(v>>>16)+(r>>>16)+((s=(65535&v)+(65535&r))>>>16))>>>16))>>>16))<<16|65535&a,I=o<<16|65535&s,J=(u=(j>>>16)+(_>>>16)+((a=(65535&j)+(65535&_)+((o=(V>>>16)+(S>>>16)+((s=(65535&V)+(65535&S))>>>16))>>>16))>>>16))<<16|65535&a,Q=o<<16|65535&s,j=(u=(w>>>16)+(_>>>16)+((a=(65535&w)+(65535&_)+((o=(I>>>16)+(S>>>16)+((s=(65535&I)+(65535&S))>>>16))>>>16))>>>16))<<16|65535&a,V=o<<16|65535&s;u=(P>>>16)+(j>>>16)+((a=(65535&P)+(65535&j)+((o=(O>>>16)+(V>>>16)+((s=(65535&O)+(65535&V))>>>16))>>>16))>>>16),this.h0h=u<<16|65535&a,this.h0l=o<<16|65535&s,u=(M>>>16)+(q>>>16)+((a=(65535&M)+(65535&q)+((o=(k>>>16)+(Y>>>16)+((s=(65535&k)+(65535&Y))>>>16))>>>16))>>>16),this.h1h=u<<16|65535&a,this.h1l=o<<16|65535&s,u=(T>>>16)+(G>>>16)+((a=(65535&T)+(65535&G)+((o=(R>>>16)+(X>>>16)+((s=(65535&R)+(65535&X))>>>16))>>>16))>>>16),this.h2h=u<<16|65535&a,this.h2l=o<<16|65535&s,u=(x>>>16)+(Z>>>16)+((a=(65535&x)+(65535&Z)+((o=(N>>>16)+(W>>>16)+((s=(65535&N)+(65535&W))>>>16))>>>16))>>>16),this.h3h=u<<16|65535&a,this.h3l=o<<16|65535&s,u=(B>>>16)+(J>>>16)+((a=(65535&B)+(65535&J)+((o=(U>>>16)+(Q>>>16)+((s=(65535&U)+(65535&Q))>>>16))>>>16))>>>16),this.h4h=u<<16|65535&a,this.h4l=o<<16|65535&s,u=(C>>>16)+($>>>16)+((a=(65535&C)+(65535&$)+((o=(L>>>16)+(tt>>>16)+((s=(65535&L)+(65535&tt))>>>16))>>>16))>>>16),this.h5h=u<<16|65535&a,this.h5l=o<<16|65535&s,u=(H>>>16)+(et>>>16)+((a=(65535&H)+(65535&et)+((o=(D>>>16)+(rt>>>16)+((s=(65535&D)+(65535&rt))>>>16))>>>16))>>>16),this.h6h=u<<16|65535&a,this.h6l=o<<16|65535&s,u=(F>>>16)+(it>>>16)+((a=(65535&F)+(65535&it)+((o=(K>>>16)+(nt>>>16)+((s=(65535&K)+(65535&nt))>>>16))>>>16))>>>16),this.h7h=u<<16|65535&a,this.h7l=o<<16|65535&s},w.prototype.hex=function(){this.finalize();var t=this.h0h,e=this.h0l,r=this.h1h,i=this.h1l,n=this.h2h,s=this.h2l,o=this.h3h,a=this.h3l,u=this.h4h,f=this.h4l,h=this.h5h,c=this.h5l,p=this.h6h,l=this.h6l,m=this.h7h,b=this.h7l,g=this.bits,y=d[t>>28&15]+d[t>>24&15]+d[t>>20&15]+d[t>>16&15]+d[t>>12&15]+d[t>>8&15]+d[t>>4&15]+d[15&t]+d[e>>28&15]+d[e>>24&15]+d[e>>20&15]+d[e>>16&15]+d[e>>12&15]+d[e>>8&15]+d[e>>4&15]+d[15&e]+d[r>>28&15]+d[r>>24&15]+d[r>>20&15]+d[r>>16&15]+d[r>>12&15]+d[r>>8&15]+d[r>>4&15]+d[15&r]+d[i>>28&15]+d[i>>24&15]+d[i>>20&15]+d[i>>16&15]+d[i>>12&15]+d[i>>8&15]+d[i>>4&15]+d[15&i]+d[n>>28&15]+d[n>>24&15]+d[n>>20&15]+d[n>>16&15]+d[n>>12&15]+d[n>>8&15]+d[n>>4&15]+d[15&n]+d[s>>28&15]+d[s>>24&15]+d[s>>20&15]+d[s>>16&15]+d[s>>12&15]+d[s>>8&15]+d[s>>4&15]+d[15&s]+d[o>>28&15]+d[o>>24&15]+d[o>>20&15]+d[o>>16&15]+d[o>>12&15]+d[o>>8&15]+d[o>>4&15]+d[15&o];return g>=256&&(y+=d[a>>28&15]+d[a>>24&15]+d[a>>20&15]+d[a>>16&15]+d[a>>12&15]+d[a>>8&15]+d[a>>4&15]+d[15&a]),g>=384&&(y+=d[u>>28&15]+d[u>>24&15]+d[u>>20&15]+d[u>>16&15]+d[u>>12&15]+d[u>>8&15]+d[u>>4&15]+d[15&u]+d[f>>28&15]+d[f>>24&15]+d[f>>20&15]+d[f>>16&15]+d[f>>12&15]+d[f>>8&15]+d[f>>4&15]+d[15&f]+d[h>>28&15]+d[h>>24&15]+d[h>>20&15]+d[h>>16&15]+d[h>>12&15]+d[h>>8&15]+d[h>>4&15]+d[15&h]+d[c>>28&15]+d[c>>24&15]+d[c>>20&15]+d[c>>16&15]+d[c>>12&15]+d[c>>8&15]+d[c>>4&15]+d[15&c]),512==g&&(y+=d[p>>28&15]+d[p>>24&15]+d[p>>20&15]+d[p>>16&15]+d[p>>12&15]+d[p>>8&15]+d[p>>4&15]+d[15&p]+d[l>>28&15]+d[l>>24&15]+d[l>>20&15]+d[l>>16&15]+d[l>>12&15]+d[l>>8&15]+d[l>>4&15]+d[15&l]+d[m>>28&15]+d[m>>24&15]+d[m>>20&15]+d[m>>16&15]+d[m>>12&15]+d[m>>8&15]+d[m>>4&15]+d[15&m]+d[b>>28&15]+d[b>>24&15]+d[b>>20&15]+d[b>>16&15]+d[b>>12&15]+d[b>>8&15]+d[b>>4&15]+d[15&b]),y},w.prototype.toString=w.prototype.hex,w.prototype.digest=function(){this.finalize();var t=this.h0h,e=this.h0l,r=this.h1h,i=this.h1l,n=this.h2h,s=this.h2l,o=this.h3h,a=this.h3l,u=this.h4h,f=this.h4l,h=this.h5h,c=this.h5l,d=this.h6h,p=this.h6l,l=this.h7h,m=this.h7l,b=this.bits,g=[t>>24&255,t>>16&255,t>>8&255,255&t,e>>24&255,e>>16&255,e>>8&255,255&e,r>>24&255,r>>16&255,r>>8&255,255&r,i>>24&255,i>>16&255,i>>8&255,255&i,n>>24&255,n>>16&255,n>>8&255,255&n,s>>24&255,s>>16&255,s>>8&255,255&s,o>>24&255,o>>16&255,o>>8&255,255&o];return b>=256&&g.push(a>>24&255,a>>16&255,a>>8&255,255&a),b>=384&&g.push(u>>24&255,u>>16&255,u>>8&255,255&u,f>>24&255,f>>16&255,f>>8&255,255&f,h>>24&255,h>>16&255,h>>8&255,255&h,c>>24&255,c>>16&255,c>>8&255,255&c),512==b&&g.push(d>>24&255,d>>16&255,d>>8&255,255&d,p>>24&255,p>>16&255,p>>8&255,255&p,l>>24&255,l>>16&255,l>>8&255,255&l,m>>24&255,m>>16&255,m>>8&255,255&m),g},w.prototype.array=w.prototype.digest,w.prototype.arrayBuffer=function(){this.finalize();var t=this.bits,e=new ArrayBuffer(t/8),r=new DataView(e);return r.setUint32(0,this.h0h),r.setUint32(4,this.h0l),r.setUint32(8,this.h1h),r.setUint32(12,this.h1l),r.setUint32(16,this.h2h),r.setUint32(20,this.h2l),r.setUint32(24,this.h3h),t>=256&&r.setUint32(28,this.h3l),t>=384&&(r.setUint32(32,this.h4h),r.setUint32(36,this.h4l),r.setUint32(40,this.h5h),r.setUint32(44,this.h5l)),512==t&&(r.setUint32(48,this.h6h),r.setUint32(52,this.h6l),r.setUint32(56,this.h7h),r.setUint32(60,this.h7l)),e},w.prototype.clone=function(){var t=new w(this.bits,!1);return this.copyTo(t),t},w.prototype.copyTo=function(t){var e=0,r=["h0h","h0l","h1h","h1l","h2h","h2l","h3h","h3l","h4h","h4l","h5h","h5l","h6h","h6l","h7h","h7l","start","bytes","hBytes","finalized","hashed","lastByteIndex"];for(e=0;e<r.length;++e)t[r[e]]=this[r[e]];for(e=0;e<this.blocks.length;++e)t.blocks[e]=this.blocks[e]},I.prototype=new w,I.prototype.finalize=function(){if(w.prototype.finalize.call(this),this.inner){this.inner=!1;var t=this.array();w.call(this,this.bits,this.sharedMemory),this.update(this.oKeyPad),this.update(t),w.prototype.finalize.call(this)}},I.prototype.clone=function(){var t=new I([],this.bits,!1);this.copyTo(t),t.inner=this.inner;for(var e=0;e<this.oKeyPad.length;++e)t.oKeyPad[e]=this.oKeyPad[e];return t};var E=v(512);E.sha512=E,E.sha384=v(384),E.sha512_256=v(256),E.sha512_224=v(224),E.sha512.hmac=S(512),E.sha384.hmac=S(384),E.sha512_256.hmac=S(256),E.sha512_224.hmac=S(224),f?t.exports=E:(a.sha512=E.sha512,a.sha384=E.sha384,a.sha512_256=E.sha512_256,a.sha512_224=E.sha512_224,h&&(void 0===(n=function(){return E}.call(E,r,E,t))||(t.exports=n)))}()}).call(this,r(29),r(35))},function(t,e,r){var i=r(91);t.exports=i("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz")},function(t,e,r){"use strict";var i=r(21),n=r(14),s=r(13),o=r(5),a=r(41),u=r(12),f=r(8),h=r(19),c=r(2),d=r(1),p=r(7),l=r(0);const m=l.Buffer;var b=r(4),g=function t(e){return this instanceof t?(this.chunks=[],m.isBuffer(e)?t.fromBuffer(e):e instanceof i?t.fromAddress(e):e instanceof t?t.fromBuffer(e.toBuffer()):d.isString(e)?t.fromString(e):void(d.isObject(e)&&d.isArray(e.chunks)&&this.set(e))):new t(e)};g.prototype.set=function(t){return c.checkArgument(d.isObject(t)),c.checkArgument(d.isArray(t.chunks)),this.chunks=t.chunks,this},g.getPushRefsFromScriptBuffer=function(t,e,r){var i=new g;i.chunks=[];const s=new Map;for(var o=new n(t);!o.finished();)try{var u,f,h=o.readUInt8();h>0&&h<a.OP_PUSHDATA1?(u=h,i.chunks.push({buf:o.read(u),len:u,opcodenum:h})):h===a.OP_PUSHDATA1?(u=o.readUInt8(),f=o.read(u),i.chunks.push({buf:f,len:u,opcodenum:h})):h===a.OP_PUSHDATA2?(u=o.readUInt16LE(),f=o.read(u),i.chunks.push({buf:f,len:u,opcodenum:h})):h===a.OP_PUSHDATA4?(u=o.readUInt32LE(),f=o.read(u),i.chunks.push({buf:f,len:u,opcodenum:h})):h===a.OP_PUSHINPUTREF||h===a.OP_DISALLOWPUSHINPUTREF||h===a.OP_DISALLOWPUSHINPUTREFSIBLING||h===a.OP_REQUIREINPUTREF||h===a.OP_PUSHINPUTREFSINGLETON?(f=o.read(36),i.chunks.push({buf:f,len:u,opcodenum:h}),h===a.OP_PUSHINPUTREF||h===a.OP_PUSHINPUTREFSINGLETON?e.set(f.toString("hex"),f):h===a.OP_DISALLOWPUSHINPUTREF?s.set(f.toString("hex"),f):h===a.OP_REQUIREINPUTREF&&r.set(f.toString("hex"),f)):i.chunks.push({opcodenum:h})}catch(t){throw console.log(t),t}return s.forEach((function(t,r){if(e.get(r))throw new Error("Disallowed ref appears in same output: "+r)})),i},g.fromBuffer=function(t){var e=new g;e.chunks=[];for(var r=new n(t);!r.finished();)try{var i,s,o=r.readUInt8();o>0&&o<a.OP_PUSHDATA1?(i=o,e.chunks.push({buf:r.read(i),len:i,opcodenum:o})):o===a.OP_PUSHDATA1?(i=r.readUInt8(),s=r.read(i),e.chunks.push({buf:s,len:i,opcodenum:o})):o===a.OP_PUSHDATA2?(i=r.readUInt16LE(),s=r.read(i),e.chunks.push({buf:s,len:i,opcodenum:o})):o===a.OP_PUSHDATA4?(i=r.readUInt32LE(),s=r.read(i),e.chunks.push({buf:s,len:i,opcodenum:o})):o===a.OP_PUSHINPUTREF||o===a.OP_REQUIREINPUTREF||o===a.OP_DISALLOWPUSHINPUTREF||o===a.OP_DISALLOWPUSHINPUTREFSIBLING||o===a.OP_PUSHINPUTREFSINGLETON?(i=36,s=r.read(i),e.chunks.push({buf:s,len:i,opcodenum:o})):e.chunks.push({opcodenum:o})}catch(e){if(e instanceof RangeError)throw new p.Script.InvalidBuffer(t.toString("hex"));throw e}return e},g.prototype.toBuffer=function(){for(var t=new s,e=0;e<this.chunks.length;e++){var r=this.chunks[e],i=r.opcodenum;t.writeUInt8(r.opcodenum),r.buf&&(i<a.OP_PUSHDATA1?t.write(r.buf):i===a.OP_PUSHDATA1?(t.writeUInt8(r.len),t.write(r.buf)):i===a.OP_PUSHDATA2?(t.writeUInt16LE(r.len),t.write(r.buf)):i===a.OP_PUSHDATA4?(t.writeUInt32LE(r.len),t.write(r.buf)):i!==a.OP_PUSHINPUTREF&&i!==a.OP_REQUIREINPUTREF&&i!==a.OP_DISALLOWPUSHINPUTREF&&i!==a.OP_DISALLOWPUSHINPUTREFSIBLING&&i!==a.OP_PUSHINPUTREFSINGLETON||t.write(r.buf))}return t.concat()},g.fromASM=function(t){var e=new g;e.chunks=[];for(var r=t.split(" "),i=0;i<r.length;){var n=r[i],s=a(n).toNumber();if("0"===n)s=0,e.chunks.push({opcodenum:s}),i+=1;else if("-1"===n)s=a.OP_1NEGATE,e.chunks.push({opcodenum:s}),i+=1;else if(d.isUndefined(s)){if((o=m.from(r[i],"hex")).toString("hex")!==r[i])throw new Error("invalid hex string in script");(u=o.length)>=0&&u<a.OP_PUSHDATA1?s=u:u<Math.pow(2,8)?s=a.OP_PUSHDATA1:u<Math.pow(2,16)?s=a.OP_PUSHDATA2:u<Math.pow(2,32)&&(s=a.OP_PUSHDATA4),e.chunks.push({buf:o,len:o.length,opcodenum:s}),i+=1}else{if(s===a.OP_PUSHINPUTREF||s===a.OP_REQUIREINPUTREF||s===a.OP_DISALLOWPUSHINPUTREF||s===a.OP_DISALLOWPUSHINPUTREFSIBLING||s===a.OP_PUSHINPUTREFSINGLETON){var o;if((o=m.from(r[i+1],"hex")).toString("hex")!==r[i+1])throw new Error("invalid hex string in script 1");var u=o.length;if(36!==o.length)throw new"Invalid induction op code must be 36 bytes";e.chunks.push({buf:o,len:o.length,opcodenum:s}),i+=1}else e.chunks.push({opcodenum:s});i+=1}}return e},g.fromHex=function(t){return new g(l.Buffer.from(t,"hex"))},g.fromString=function(t){if(b.isHexa(t)||0===t.length)return new g(l.Buffer.from(t,"hex"));var e=new g;e.chunks=[];for(var r=t.split(" "),i=0;i<r.length;){var n=r[i],s=a(n).toNumber();if(d.isUndefined(s)){if(!((s=parseInt(n))>0&&s<a.OP_PUSHDATA1))throw new Error("Invalid script: "+JSON.stringify(t));e.chunks.push({buf:m.from(r[i+1].slice(2),"hex"),len:s,opcodenum:s}),i+=2}else if(s===a.OP_PUSHDATA1||s===a.OP_PUSHDATA2||s===a.OP_PUSHDATA4){if("0x"!==r[i+2].slice(0,2))throw new Error("Pushdata data must start with 0x");e.chunks.push({buf:m.from(r[i+2].slice(2),"hex"),len:parseInt(r[i+1]),opcodenum:s}),i+=3}else if(s===a.OP_PUSHINPUTREF||s===a.OP_REQUIREINPUTREF||s===a.OP_DISALLOWPUSHINPUTREF||s===a.OP_DISALLOWPUSHINPUTREFSIBLING||s===a.OP_PUSHINPUTREFSINGLETON){if("0x"!==r[i+1].slice(0,2))throw new Error("OP_PUSHINPUTREF or OP_REQUIREINPUTREF or OP_DISALLOWPUSHINPUTREF or OP_DISALLOWPUSHINPUTREFSIBLING or OP_PUSHINPUTREFSINGLETON data must start with 0x");e.chunks.push({buf:m.from(r[i+1].slice(2),"hex"),len:36,opcodenum:s}),i+=2}else e.chunks.push({opcodenum:s}),i+=1}return e},g.prototype._chunkToString=function(t,e){var r=t.opcodenum,i="asm"===e,n="";if(t.buf){if(i||r!==a.OP_PUSHDATA1&&r!==a.OP_PUSHDATA2&&r!==a.OP_PUSHDATA4||(n=n+" "+a(r).toString()),i||r!==a.OP_PUSHINPUTREF&&r!==a.OP_REQUIREINPUTREF&&r!==a.OP_DISALLOWPUSHINPUTREF&&r!==a.OP_DISALLOWPUSHINPUTREFSIBLING&&r!==a.OP_PUSHINPUTREFSINGLETON||(n=n+" "+a(r).toString()),t.len>0)if(r===a.OP_PUSHINPUTREF||r===a.OP_REQUIREINPUTREF||r===a.OP_DISALLOWPUSHINPUTREF||r===a.OP_DISALLOWPUSHINPUTREFSIBLING||r===a.OP_PUSHINPUTREFSINGLETON){if(36!==t.len)throw new Error("Expected 36 bytes for induction op code");n=i?n+" "+a(r).toString()+" "+t.buf.toString("hex"):n+" 0x"+t.buf.toString("hex")}else n=i?n+" "+t.buf.toString("hex"):n+" "+t.len+" 0x"+t.buf.toString("hex")}else if(void 0!==a.reverseMap[r])i?0===r?n+=" 0":79===r?n+=" -1":n=n+" "+a(r).toString():n=n+" "+a(r).toString();else{var s=r.toString(16);s.length%2!=0&&(s="0"+s),n=i?n+" "+s:n+" 0x"+s}return n},g.prototype.toASM=function(){for(var t="",e=0;e<this.chunks.length;e++){var r=this.chunks[e];t+=this._chunkToString(r,"asm")}return t.substr(1)},g.prototype.toString=function(){for(var t="",e=0;e<this.chunks.length;e++){var r=this.chunks[e];t+=this._chunkToString(r)}return t.substr(1)},g.prototype.toHex=function(){return this.toBuffer().toString("hex")},g.prototype.inspect=function(){return"<Script: "+this.toString()+">"},g.prototype.isPublicKeyHashOut=function(){return!(5!==this.chunks.length||this.chunks[0].opcodenum!==a.OP_DUP||this.chunks[1].opcodenum!==a.OP_HASH160||!this.chunks[2].buf||20!==this.chunks[2].buf.length||this.chunks[3].opcodenum!==a.OP_EQUALVERIFY||this.chunks[4].opcodenum!==a.OP_CHECKSIG)},g.prototype.isPublicKeyHashIn=function(){if(2===this.chunks.length){var t=this.chunks[0].buf,e=this.chunks[1].buf;if(t&&t.length&&48===t[0]&&e&&e.length){var r=e[0];if((4===r||6===r||7===r)&&65===e.length)return!0;if((3===r||2===r)&&33===e.length)return!0}}return!1},g.prototype.getPublicKey=function(){return c.checkState(this.isPublicKeyOut(),"Can't retrieve PublicKey from a non-PK output"),this.chunks[0].buf},g.prototype.getPublicKeyHash=function(){return c.checkState(this.isPublicKeyHashOut(),"Can't retrieve PublicKeyHash from a non-PKH output"),this.chunks[2].buf},g.prototype.isPublicKeyOut=function(){if(2===this.chunks.length&&this.chunks[0].buf&&this.chunks[0].buf.length&&this.chunks[1].opcodenum===a.OP_CHECKSIG){var t=this.chunks[0].buf,e=t[0],r=!1;if((4!==e&&6!==e&&7!==e||65!==t.length)&&(3!==e&&2!==e||33!==t.length)||(r=!0),r)return u.isValid(t)}return!1},g.prototype.isPublicKeyIn=function(){if(1===this.chunks.length){var t=this.chunks[0].buf;if(t&&t.length&&48===t[0])return!0}return!1},g.prototype.isScriptHashOut=function(){var t=this.toBuffer();return 23===t.length&&t[0]===a.OP_HASH160&&20===t[1]&&t[t.length-1]===a.OP_EQUAL},g.prototype.isScriptHashIn=function(){if(this.chunks.length<=1)return!1;var t,e=this.chunks[this.chunks.length-1].buf;if(!e)return!1;try{t=g.fromBuffer(e)}catch(t){if(t instanceof p.Script.InvalidBuffer)return!1;throw t}return t.classify()!==g.types.UNKNOWN},g.prototype.isMultisigOut=function(){return this.chunks.length>3&&a.isSmallIntOp(this.chunks[0].opcodenum)&&this.chunks.slice(1,this.chunks.length-2).every((function(t){return t.buf&&m.isBuffer(t.buf)}))&&a.isSmallIntOp(this.chunks[this.chunks.length-2].opcodenum)&&this.chunks[this.chunks.length-1].opcodenum===a.OP_CHECKMULTISIG},g.prototype.isMultisigIn=function(){return this.chunks.length>=2&&0===this.chunks[0].opcodenum&&this.chunks.slice(1,this.chunks.length).every((function(t){return t.buf&&m.isBuffer(t.buf)&&f.isTxDER(t.buf)}))},g.prototype.isDataOut=function(){if(!(this.chunks.length>=1&&this.chunks[0].opcodenum===a.OP_RETURN))return!1;var t=this.chunks.slice(1);return new g({chunks:t}).isPushOnly()},g.prototype.isSafeDataOut=function(){if(this.chunks.length<2)return!1;if(this.chunks[0].opcodenum!==a.OP_FALSE)return!1;var t=this.chunks.slice(1);return new g({chunks:t}).isDataOut()},g.prototype.getData=function(){if(this.isSafeDataOut())return this.chunks.slice(2).map(t=>t.buf);if(this.isDataOut()||this.isScriptHashOut())return d.isUndefined(this.chunks[1])?m.alloc(0):m.from(this.chunks[1].buf);if(this.isPublicKeyHashOut())return m.from(this.chunks[2].buf);throw new Error("Unrecognized script type to get data from")},g.prototype.isPushOnly=function(){return d.every(this.chunks,(function(t){return t.opcodenum<=a.OP_16||t.opcodenum===a.OP_PUSHDATA1||t.opcodenum===a.OP_PUSHDATA2||t.opcodenum===a.OP_PUSHDATA4}))},(g.types={}).UNKNOWN="Unknown",g.types.PUBKEY_OUT="Pay to public key",g.types.PUBKEY_IN="Spend from public key",g.types.PUBKEYHASH_OUT="Pay to public key hash",g.types.PUBKEYHASH_IN="Spend from public key hash",g.types.SCRIPTHASH_OUT="Pay to script hash",g.types.SCRIPTHASH_IN="Spend from script hash",g.types.MULTISIG_OUT="Pay to multisig",g.types.MULTISIG_IN="Spend from multisig",g.types.DATA_OUT="Data push",g.types.SAFE_DATA_OUT="Safe data push",g.OP_RETURN_STANDARD_SIZE=220,g.prototype.classify=function(){if(this._isInput)return this.classifyInput();if(this._isOutput)return this.classifyOutput();var t=this.classifyOutput();return t!==g.types.UNKNOWN?t:this.classifyInput()},(g.outputIdentifiers={}).PUBKEY_OUT=g.prototype.isPublicKeyOut,g.outputIdentifiers.PUBKEYHASH_OUT=g.prototype.isPublicKeyHashOut,g.outputIdentifiers.MULTISIG_OUT=g.prototype.isMultisigOut,g.outputIdentifiers.SCRIPTHASH_OUT=g.prototype.isScriptHashOut,g.outputIdentifiers.DATA_OUT=g.prototype.isDataOut,g.outputIdentifiers.SAFE_DATA_OUT=g.prototype.isSafeDataOut,g.prototype.classifyOutput=function(){for(var t in g.outputIdentifiers)if(g.outputIdentifiers[t].bind(this)())return g.types[t];return g.types.UNKNOWN},(g.inputIdentifiers={}).PUBKEY_IN=g.prototype.isPublicKeyIn,g.inputIdentifiers.PUBKEYHASH_IN=g.prototype.isPublicKeyHashIn,g.inputIdentifiers.MULTISIG_IN=g.prototype.isMultisigIn,g.inputIdentifiers.SCRIPTHASH_IN=g.prototype.isScriptHashIn,g.prototype.classifyInput=function(){for(var t in g.inputIdentifiers)if(g.inputIdentifiers[t].bind(this)())return g.types[t];return g.types.UNKNOWN},g.prototype.isStandard=function(){return this.classify()!==g.types.UNKNOWN},g.prototype.prepend=function(t){return this._addByType(t,!0),this},g.prototype.equals=function(t){if(c.checkState(t instanceof g,"Must provide another script"),this.chunks.length!==t.chunks.length)return!1;var e;for(e=0;e<this.chunks.length;e++){if(m.isBuffer(this.chunks[e].buf)&&!m.isBuffer(t.chunks[e].buf))return!1;if(m.isBuffer(this.chunks[e].buf)&&!this.chunks[e].buf.equals(t.chunks[e].buf))return!1;if(this.chunks[e].opcodenum!==t.chunks[e].opcodenum)return!1}return!0},g.prototype.add=function(t){return this._addByType(t,!1),this},g.prototype._addByType=function(t,e){if("string"==typeof t)this._addOpcode(t,e);else if("number"==typeof t)this._addOpcode(t,e);else if(t instanceof a)this._addOpcode(t,e);else if(m.isBuffer(t))this._addBuffer(t,e);else if(t instanceof g)this.chunks=this.chunks.concat(t.chunks);else{if("object"!=typeof t)throw new Error("Invalid script chunk");this._insertAtPosition(t,e)}},g.prototype._insertAtPosition=function(t,e){e?this.chunks.unshift(t):this.chunks.push(t)},g.prototype._addOpcode=function(t,e){var r;return r="number"==typeof t?t:t instanceof a?t.toNumber():a(t).toNumber(),this._insertAtPosition({opcodenum:r},e),this},g.prototype._addBuffer=function(t,e){var r,i=t.length;if(i>=0&&i<a.OP_PUSHDATA1)r=i;else if(i<Math.pow(2,8))r=a.OP_PUSHDATA1;else if(i<Math.pow(2,16))r=a.OP_PUSHDATA2;else{if(!(i<Math.pow(2,32)))throw new Error("You can't push that much data");r=a.OP_PUSHDATA4}return this._insertAtPosition({buf:t,len:i,opcodenum:r},e),this},g.prototype.removeCodeseparators=function(){for(var t=[],e=0;e<this.chunks.length;e++)this.chunks[e].opcodenum!==a.OP_CODESEPARATOR&&t.push(this.chunks[e]);return this.chunks=t,this},g.prototype.subScript=function(t){for(var e=0,r=0;r<this.chunks.length;r++)if(this.chunks[r].opcodenum===a.OP_CODESEPARATOR){if(e===t)return(new g).set({chunks:this.chunks.slice(r+1)});e++}return(new g).set({chunks:this.chunks.slice(0)})},g.buildMultisigOut=function(t,e,r){c.checkArgument(e<=t.length,"Number of required signatures must be less than or equal to the number of public keys"),r=r||{};var i=new g;i.add(a.smallInt(e));var n=t=d.map(t,u);r.noSorting||(n=t.map(t=>t.toString("hex")).sort().map(t=>new u(t)));for(var s=0;s<n.length;s++){var o=n[s];i.add(o.toBuffer())}return i.add(a.smallInt(t.length)),i.add(a.OP_CHECKMULTISIG),i},g.buildMultisigIn=function(t,e,r,i){c.checkArgument(d.isArray(t)),c.checkArgument(d.isNumber(e)),c.checkArgument(d.isArray(r)),i=i||{};var n=new g;return n.add(a.OP_0),d.each(r,(function(t){c.checkArgument(m.isBuffer(t),"Signatures must be an array of Buffers"),n.add(t)})),n},g.buildP2SHMultisigIn=function(t,e,r,i){c.checkArgument(d.isArray(t)),c.checkArgument(d.isNumber(e)),c.checkArgument(d.isArray(r)),i=i||{};var n=new g;return n.add(a.OP_0),d.each(r,(function(t){c.checkArgument(m.isBuffer(t),"Signatures must be an array of Buffers"),n.add(t)})),n.add((i.cachedMultisig||g.buildMultisigOut(t,e,i)).toBuffer()),n},g.buildPublicKeyHashOut=function(t){c.checkArgument(!d.isUndefined(t)),c.checkArgument(t instanceof u||t instanceof i||d.isString(t)),t instanceof u?t=t.toAddress():d.isString(t)&&(t=new i(t));var e=new g;return e.add(a.OP_DUP).add(a.OP_HASH160).add(t.hashBuffer).add(a.OP_EQUALVERIFY).add(a.OP_CHECKSIG),e._network=t.network,e},g.buildPublicKeyOut=function(t){c.checkArgument(t instanceof u);var e=new g;return e.add(t.toBuffer()).add(a.OP_CHECKSIG),e},g.buildDataOut=function(t,e){c.checkArgument(d.isUndefined(t)||d.isString(t)||d.isArray(t)||m.isBuffer(t));var r=t;d.isArray(r)||(r=[t]);var i=new g;i.add(a.OP_RETURN);for(let t of r)c.checkArgument(d.isUndefined(t)||d.isString(t)||m.isBuffer(t)),d.isString(t)&&(t=m.from(t,e)),d.isUndefined(t)||i.add(t);return i},g.buildSafeDataOut=function(t,e){var r=g.buildDataOut(t,e),i=new g;return i.add(a.OP_FALSE),i.add(r),i},g.buildScriptHashOut=function(t){c.checkArgument(t instanceof g||t instanceof i&&t.isPayToScriptHash());var e=new g;return e.add(a.OP_HASH160).add(t instanceof i?t.hashBuffer:o.sha256ripemd160(t.toBuffer())).add(a.OP_EQUAL),e._network=t._network||t.network,e},g.buildPublicKeyIn=function(t,e){c.checkArgument(t instanceof f||m.isBuffer(t)),c.checkArgument(d.isUndefined(e)||d.isNumber(e)),t instanceof f&&(t=t.toBuffer());var r=new g;return r.add(m.concat([t,m.from([255&(e||f.SIGHASH_ALL)])])),r},g.buildPublicKeyHashIn=function(t,e,r){return c.checkArgument(e instanceof f||m.isBuffer(e)),c.checkArgument(d.isUndefined(r)||d.isNumber(r)),e instanceof f&&(e=e.toBuffer()),(new g).add(m.concat([e,m.from([255&(r||f.SIGHASH_ALL)])])).add(new u(t).toBuffer())},g.empty=function(){return new g},g.prototype.toScriptHashOut=function(){return g.buildScriptHashOut(this)},g.fromAddress=function(t){if((t=i(t)).isPayToScriptHash())return g.buildScriptHashOut(t);if(t.isPayToPublicKeyHash())return g.buildPublicKeyHashOut(t);throw new p.Script.UnrecognizedAddress(t)},g.prototype.getAddressInfo=function(t){if(this._isInput)return this._getInputAddressInfo();if(this._isOutput)return this._getOutputAddressInfo();var e=this._getOutputAddressInfo();return e||this._getInputAddressInfo()},g.prototype._getOutputAddressInfo=function(){var t={};if(this.isScriptHashOut())t.hashBuffer=this.getData(),t.type=i.PayToScriptHash;else{if(!this.isPublicKeyHashOut())return!1;t.hashBuffer=this.getData(),t.type=i.PayToPublicKeyHash}return t},g.prototype._getInputAddressInfo=function(){var t={};if(this.isPublicKeyHashIn())t.hashBuffer=o.sha256ripemd160(this.chunks[1].buf),t.type=i.PayToPublicKeyHash;else{if(!this.isScriptHashIn())return!1;t.hashBuffer=o.sha256ripemd160(this.chunks[this.chunks.length-1].buf),t.type=i.PayToScriptHash}return t},g.prototype.toAddress=function(t){var e=this.getAddressInfo();return!!e&&(e.network=h.get(t)||this._network||h.defaultNetwork,new i(e))},g.prototype.findAndDelete=function(t){for(var e=t.toBuffer().toString("hex"),r=0;r<this.chunks.length;r++){e===g({chunks:[this.chunks[r]]}).toBuffer().toString("hex")&&this.chunks.splice(r,1)}return this},g.prototype.checkMinimalPush=function(t){var e=this.chunks[t],r=e.buf,i=e.opcodenum;return!r||(0===r.length?i===a.OP_0:1===r.length&&r[0]>=1&&r[0]<=16?i===a.OP_1+(r[0]-1):1===r.length&&129===r[0]?i===a.OP_1NEGATE:r.length<=75?i===r.length:r.length<=255?i===a.OP_PUSHDATA1:!(r.length<=65535)||i===a.OP_PUSHDATA2)},g.prototype._decodeOP_N=function(t){if(t===a.OP_0)return 0;if(t>=a.OP_1&&t<=a.OP_16)return t-(a.OP_1-1);throw new Error("Invalid opcode: "+JSON.stringify(t))},g.prototype.getSignatureOperationsCount=function(t){t=!!d.isUndefined(t)||t;var e=this,r=0,i=a.OP_INVALIDOPCODE;return d.each(e.chunks,(function(n){var s=n.opcodenum;s===a.OP_CHECKSIG||s===a.OP_CHECKSIGVERIFY?r++:s!==a.OP_CHECKMULTISIG&&s!==a.OP_CHECKMULTISIGVERIFY||(t&&i>=a.OP_1&&i<=a.OP_16?r+=e._decodeOP_N(i):r+=20),i=s})),r},t.exports=g},function(t,e,r){"use strict";(function(e){var i=r(1),n=r(54),s=r(41),o=r(3),a=r(5),u=r(8),f=r(12),h=(r(101),r(57)),c=(r(52),function t(e){if(!(this instanceof t))return new t(e);e?(this.initialize(),this.set(e)):this.initialize()});c.prototype.verify=function(t,e,s,o,a,u,f){var h,d=r(32);if(i.isUndefined(s)&&(s=new d),i.isUndefined(o)&&(o=0),i.isUndefined(a)&&(a=0),a&c.SCRIPT_ENABLE_SIGHASH_FORKID&&(a|=c.SCRIPT_VERIFY_STRICTENC,!u))throw new Error("internal error - need satoshisBN to verify FORKID transactions");if(this.set({script:t,tx:s,nin:o,flags:a,satoshisBN:u,sighashScript:f}),0!=(a&c.SCRIPT_VERIFY_SIGPUSHONLY)&&!t.isPushOnly())return this.errstr="SCRIPT_ERR_SIG_PUSHONLY",!1;if(!this.evaluate("scriptSig"))return!1;a&c.SCRIPT_VERIFY_P2SH&&(h=this.stack.copy());var p=this.stack;if(this.initialize(),this.set({script:e,stack:p,tx:s,nin:o,flags:a,satoshisBN:u,sighashScript:f}),!this.evaluate("scriptPubkey"))return!1;if(0===this.stack.length)return this.errstr="SCRIPT_ERR_EVAL_FALSE_NO_RESULT",!1;var l=this.stack.stacktop(-1);if(!c.castToBool(l))return this.errstr="SCRIPT_ERR_EVAL_FALSE_IN_STACK",!1;if(a&c.SCRIPT_VERIFY_P2SH&&e.isScriptHashOut()){if(!t.isPushOnly())return this.errstr="SCRIPT_ERR_SIG_PUSHONLY",!1;if(0===h.length)throw new Error("internal error - stack copy empty");var m=h.stacktop(-1),b=n.fromBuffer(m);if(h.pop(),this.initialize(),this.set({script:b,stack:h,tx:s,nin:o,flags:a,satoshisBN:u}),!this.evaluate())return!1;if(0===h.length)return this.errstr="SCRIPT_ERR_EVAL_FALSE_NO_P2SH_STACK",!1;if(!c.castToBool(h.stacktop(-1)))return this.errstr="SCRIPT_ERR_EVAL_FALSE_IN_P2SH_STACK",!1}return 0==(a&c.SCRIPT_VERIFY_CLEANSTACK)||1===this.stack.length||(this.errstr="SCRIPT_ERR_CLEANSTACK",!1)},t.exports=c,c.prototype.initialize=function(t){this.stack=new h([]),this.altstack=new h([]),this.pc=0,this.pbegincodehash=0,this.nOpCount=0,this.vfExec=[],this.errstr="",this.flags=0,this.nonTopLevelReturnAfterGenesis=!1},c.prototype.set=function(t){this.script=t.script||this.script,this.tx=t.tx||this.tx,this.nin=void 0!==t.nin?t.nin:this.nin,this.satoshisBN=t.satoshisBN||this.satoshisBN,this.stack=t.stack||this.stack,this.altstack=t.altstack||this.altstack,this.pc=void 0!==t.pc?t.pc:this.pc,this.pbegincodehash=void 0!==t.pbegincodehash?t.pbegincodehash:this.pbegincodehash,this.nOpCount=void 0!==t.nOpCount?t.nOpCount:this.nOpCount,this.vfExec=t.vfExec||this.vfExec,this.errstr=t.errstr||this.errstr,this.flags=void 0!==t.flags?t.flags:this.flags,this.sighashScript=t.sighashScript||this.sighashScript},c.prototype.subscript=function(){return this.sighashScript?(new n).set({chunks:this.sighashScript.chunks}):(new n).set({chunks:this.script.chunks.slice(this.pbegincodehash)})},c.getTrue=()=>e.from([1]),c.getFalse=()=>e.from([]),c.MAX_SCRIPT_ELEMENT_SIZE=520,c.MAXIMUM_ELEMENT_SIZE=4,c.LOCKTIME_THRESHOLD=5e8,c.LOCKTIME_THRESHOLD_BN=new o(c.LOCKTIME_THRESHOLD),c.SCRIPT_VERIFY_NONE=0,c.SCRIPT_VERIFY_P2SH=1,c.SCRIPT_VERIFY_STRICTENC=2,c.SCRIPT_VERIFY_DERSIG=4,c.SCRIPT_VERIFY_LOW_S=8,c.SCRIPT_VERIFY_NULLDUMMY=16,c.SCRIPT_VERIFY_SIGPUSHONLY=32,c.SCRIPT_VERIFY_MINIMALDATA=64,c.SCRIPT_VERIFY_DISCOURAGE_UPGRADABLE_NOPS=128,c.SCRIPT_VERIFY_CLEANSTACK=256,c.SCRIPT_VERIFY_CHECKLOCKTIMEVERIFY=512,c.SCRIPT_VERIFY_CHECKSEQUENCEVERIFY=1024,c.SCRIPT_VERIFY_MINIMALIF=8192,c.SCRIPT_VERIFY_NULLFAIL=16384,c.SCRIPT_VERIFY_COMPRESSED_PUBKEYTYPE=32768,c.SCRIPT_ENABLE_SIGHASH_FORKID=65536,c.SCRIPT_ENABLE_REPLAY_PROTECTION=1<<17,c.SCRIPT_ENABLE_MONOLITH_OPCODES=1<<18,c.SCRIPT_ENABLE_MAGNETIC_OPCODES=1<<19,c.SEQUENCE_LOCKTIME_DISABLE_FLAG=1<<31,c.SEQUENCE_LOCKTIME_TYPE_FLAG=1<<22,c.SEQUENCE_LOCKTIME_MASK=65535,c.MAX_SCRIPT_SIZE=Number.MAX_SAFE_INTEGER,c.MAX_OPCODE_COUNT=Number.MAX_SAFE_INTEGER,c.castToBool=function(t){for(var e=0;e<t.length;e++)if(0!==t[e])return e!==t.length-1||128!==t[e];return!1},c.prototype.checkSignatureEncoding=function(t){var e;if(0===t.length)return!0;if(0!=(this.flags&(c.SCRIPT_VERIFY_DERSIG|c.SCRIPT_VERIFY_LOW_S|c.SCRIPT_VERIFY_STRICTENC))&&!u.isTxDER(t))return this.errstr="SCRIPT_ERR_SIG_DER_INVALID_FORMAT",!1;if(0!=(this.flags&c.SCRIPT_VERIFY_LOW_S)){if(!(e=u.fromTxFormat(t)).hasLowS())return this.errstr="SCRIPT_ERR_SIG_DER_HIGH_S",!1}else if(0!=(this.flags&c.SCRIPT_VERIFY_STRICTENC)){if(!(e=u.fromTxFormat(t)).hasDefinedHashtype())return this.errstr="SCRIPT_ERR_SIG_HASHTYPE",!1;if(!(this.flags&c.SCRIPT_ENABLE_SIGHASH_FORKID)&&e.nhashtype&u.SIGHASH_FORKID)return this.errstr="SCRIPT_ERR_ILLEGAL_FORKID",!1;if(this.flags&c.SCRIPT_ENABLE_SIGHASH_FORKID&&!(e.nhashtype&u.SIGHASH_FORKID))return this.errstr="SCRIPT_ERR_MUST_USE_FORKID",!1}return!0},c.prototype.checkPubkeyEncoding=function(t){return!(0!=(this.flags&c.SCRIPT_VERIFY_STRICTENC)&&!f.isValid(t))||(this.errstr="SCRIPT_ERR_PUBKEYTYPE",!1)},c._isMinimallyEncoded=function(t,e){return e=e||c.MAXIMUM_ELEMENT_SIZE,!(t.length>e)&&!(t.length>0&&0==(127&t[t.length-1])&&(t.length<=1||0==(128&t[t.length-2])))},c._minimallyEncode=function(t){if(0===t.length)return t;var r=t[t.length-1];if(127&r)return t;if(1===t.length)return e.from("");if(128&t[t.length-2])return t;for(var i=t.length-1;i>0;i--)if(0!==t[i-1])return 128&t[i-1]?t[i++]=r:t[i-1]|=r,t.slice(0,i);return e.from("")},c.prototype.evaluate=function(t){if(this.script.toBuffer().length>c.MAX_SCRIPT_SIZE)return this.errstr="SCRIPT_ERR_SCRIPT_SIZE",!1;try{for(;this.pc<this.script.chunks.length;){let r={pc:this.pc,fExec:-1===this.vfExec.indexOf(!1),opcode:s.fromNumber(this.script.chunks[this.pc].opcodenum)};var e=this.step(t);if(this._callbackStep(r),!e)return!1}if(this.stack.length+this.altstack.length>1e3)return this.errstr="SCRIPT_ERR_STACK_SIZE",!1}catch(t){return this.errstr="SCRIPT_ERR_UNKNOWN_ERROR: "+t,!1}return!(this.vfExec.length>0)||(this.errstr="SCRIPT_ERR_UNBALANCED_CONDITIONAL",!1)},c.prototype._callbackStep=function(t){if("function"==typeof this.stepListener)try{this.stepListener(t)}catch(t){console.log(`Error in Step callback:${t}`)}},c.prototype._callbackStack=function(t,e,r){if("function"==typeof this.stackListener)try{this.stackListener(t,e,r)}catch(t){var i=this.script.chunks[e];console.error(`Error: ${t} in _updateStack pc: ${e}, opcode ${s.fromNumber(i.opcodenum).toSafeString()}`)}},c.prototype.checkLockTime=function(t){return!!(this.tx.nLockTime<c.LOCKTIME_THRESHOLD&&t.lt(c.LOCKTIME_THRESHOLD_BN)||this.tx.nLockTime>=c.LOCKTIME_THRESHOLD&&t.gte(c.LOCKTIME_THRESHOLD_BN))&&(!t.gt(new o(this.tx.nLockTime))&&!this.tx.inputs[this.nin].isFinal())},c.prototype.checkSequence=function(t){var e=this.tx.inputs[this.nin].sequenceNumber;if(this.tx.version<2)return!1;if(e&c.SEQUENCE_LOCKTIME_DISABLE_FLAG)return!1;var r=c.SEQUENCE_LOCKTIME_TYPE_FLAG|c.SEQUENCE_LOCKTIME_MASK,i=new o(e&r),n=t.and(r),s=new o(c.SEQUENCE_LOCKTIME_TYPE_FLAG);return!!(i.lt(s)&&n.lt(s)||i.gte(s)&&n.gte(s))&&!n.gt(i)},c.prototype.step=function(t){var r=this;function h(t){return r.stack.stacktop(t)}function d(t){return r.stack.vartop(t)}var p,l,m,b,g,y,v,_,S,w,I,E,A,P,O,M,k,T,R,x,N=0!=(this.flags&c.SCRIPT_VERIFY_MINIMALDATA),B=this.script.chunks[this.pc];this.pc++;var U=B.opcodenum;if(i.isUndefined(U))return this.errstr="SCRIPT_ERR_UNDEFINED_OPCODE",!1;if(B.buf&&B.buf.length>c.MAX_SCRIPT_ELEMENT_SIZE)return this.errstr="SCRIPT_ERR_PUSH_SIZE",!1;var C=-1===this.vfExec.indexOf(!1)&&(!this.nonTopLevelReturnAfterGenesis||U===s.OP_RETURN);if(U>s.OP_16&&++this.nOpCount>c.MAX_OPCODE_COUNT)return this.errstr="SCRIPT_ERR_OP_COUNT",!1;if(function(t){switch(t){case s.OP_2MUL:case s.OP_2DIV:return!0;case s.OP_INVERT:case s.OP_MUL:case s.OP_LSHIFT:case s.OP_RSHIFT:if(0==(r.flags&c.SCRIPT_ENABLE_MAGNETIC_OPCODES))return!0;break;case s.OP_DIV:case s.OP_MOD:case s.OP_SPLIT:case s.OP_CAT:case s.OP_AND:case s.OP_OR:case s.OP_XOR:case s.OP_BIN2NUM:case s.OP_NUM2BIN:if(0==(r.flags&c.SCRIPT_ENABLE_MONOLITH_OPCODES))return!0}return!1}(U))return this.errstr="SCRIPT_ERR_DISABLED_OPCODE",!1;if(C&&U>=0&&U<=s.OP_PUSHDATA4){if(N&&!this.script.checkMinimalPush(this.pc-1))return this.errstr="SCRIPT_ERR_MINIMALDATA",!1;if(B.buf){if(B.len!==B.buf.length)throw new Error(`Length of push value not equal to length of data (${B.len},${B.buf.length})`);this.stack.push(B.buf)}else this.stack.push(c.getFalse())}else if(C||s.OP_IF<=U&&U<=s.OP_ENDIF)switch(U){case s.OP_1NEGATE:case s.OP_1:case s.OP_2:case s.OP_3:case s.OP_4:case s.OP_5:case s.OP_6:case s.OP_7:case s.OP_8:case s.OP_9:case s.OP_10:case s.OP_11:case s.OP_12:case s.OP_13:case s.OP_14:case s.OP_15:case s.OP_16:g=U-(s.OP_1-1),p=new o(g).toScriptNumBuffer(),this.stack.push(p);break;case s.OP_NOP:break;case s.OP_NOP2:case s.OP_CHECKLOCKTIMEVERIFY:if(!(this.flags&c.SCRIPT_VERIFY_CHECKLOCKTIMEVERIFY)){if(this.flags&c.SCRIPT_VERIFY_DISCOURAGE_UPGRADABLE_NOPS)return this.errstr="SCRIPT_ERR_DISCOURAGE_UPGRADABLE_NOPS",!1;break}if(this.stack.length<1)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;var L=o.fromScriptNumBuffer(this.stack.stacktop(-1),N,5);if(L.lt(new o(0)))return this.errstr="SCRIPT_ERR_NEGATIVE_LOCKTIME",!1;if(!this.checkLockTime(L))return this.errstr="SCRIPT_ERR_UNSATISFIED_LOCKTIME",!1;break;case s.OP_NOP3:case s.OP_CHECKSEQUENCEVERIFY:if(!(this.flags&c.SCRIPT_VERIFY_CHECKSEQUENCEVERIFY)){if(this.flags&c.SCRIPT_VERIFY_DISCOURAGE_UPGRADABLE_NOPS)return this.errstr="SCRIPT_ERR_DISCOURAGE_UPGRADABLE_NOPS",!1;break}if(this.stack.length<1)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;var H=o.fromScriptNumBuffer(h(-1),N,5);if(H.lt(new o(0)))return this.errstr="SCRIPT_ERR_NEGATIVE_LOCKTIME",!1;if(0!=(H&c.SEQUENCE_LOCKTIME_DISABLE_FLAG))break;if(!this.checkSequence(H))return this.errstr="SCRIPT_ERR_UNSATISFIED_LOCKTIME",!1;break;case s.OP_NOP1:case s.OP_NOP4:case s.OP_NOP5:case s.OP_NOP6:case s.OP_NOP7:case s.OP_NOP8:case s.OP_NOP9:case s.OP_NOP10:if(this.flags&c.SCRIPT_VERIFY_DISCOURAGE_UPGRADABLE_NOPS)return this.errstr="SCRIPT_ERR_DISCOURAGE_UPGRADABLE_NOPS",!1;break;case s.OP_IF:case s.OP_NOTIF:if(M=!1,C){if(this.stack.length<1)return this.errstr="SCRIPT_ERR_UNBALANCED_CONDITIONAL",!1;if(p=h(-1),this.flags&c.SCRIPT_VERIFY_MINIMALIF){if(p.length>1)return this.errstr="SCRIPT_ERR_MINIMALIF",!1;if(1===p.length&&1!==p[0])return this.errstr="SCRIPT_ERR_MINIMALIF",!1}M=c.castToBool(p),U===s.OP_NOTIF&&(M=!M),this.stack.pop()}this.vfExec.push(M);break;case s.OP_ELSE:if(0===this.vfExec.length)return this.errstr="SCRIPT_ERR_UNBALANCED_CONDITIONAL",!1;this.vfExec[this.vfExec.length-1]=!this.vfExec[this.vfExec.length-1];break;case s.OP_ENDIF:if(0===this.vfExec.length)return this.errstr="SCRIPT_ERR_UNBALANCED_CONDITIONAL",!1;this.vfExec.pop();break;case s.OP_VERIFY:if(this.stack.length<1)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;if(p=h(-1),!(M=c.castToBool(p)))return this.errstr="SCRIPT_ERR_VERIFY",!1;this.stack.pop();break;case s.OP_RETURN:if(0!=(this.flags&c.SCRIPT_VERIFY_P2SH))return!1;if(0===this.vfExec.length)return this.pc=this.script.chunks.length,!0;this.nonTopLevelReturnAfterGenesis=!0;break;case s.OP_TOALTSTACK:if(this.stack.length<1)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;T=d(-1),this.altstack.push(this.stack.pop(),T);break;case s.OP_FROMALTSTACK:if(this.altstack.length<1)return this.errstr="SCRIPT_ERR_INVALID_ALTSTACK_OPERATION",!1;const t=this.altstack.vartop(-1);this.stack.push(this.altstack.pop(),t);break;case s.OP_2DROP:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;this.stack.pop(),this.stack.pop();break;case s.OP_2DUP:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;l=h(-2),m=h(-1),T=d(-2),R=d(-1),this.stack.push(e.from(l),`$${T}`),this.stack.push(e.from(m),`$${R}`);break;case s.OP_3DUP:if(this.stack.length<3)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;l=h(-3),m=h(-2);var D=h(-1);T=d(-3),R=d(-2),x=d(-1),this.stack.push(e.from(l),`$${T}`),this.stack.push(e.from(m),`$${R}`),this.stack.push(e.from(D),`$${x}`);break;case s.OP_2OVER:if(this.stack.length<4)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;l=h(-4),m=h(-3),T=d(-4),R=d(-3),this.stack.push(e.from(l),`$${T}`),this.stack.push(e.from(m),`$${R}`);break;case s.OP_2ROT:if(this.stack.length<6)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;T=d(-6),R=d(-5),b=this.stack.splice(this.stack.length-6,2),this.stack.push(b[0],T),this.stack.push(b[1],R);break;case s.OP_2SWAP:if(this.stack.length<4)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;T=d(-4),R=d(-3),b=this.stack.splice(this.stack.length-4,2),this.stack.push(b[0],T),this.stack.push(b[1],R);break;case s.OP_IFDUP:if(this.stack.length<1)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;p=h(-1),(M=c.castToBool(p))&&(T=d(-1),this.stack.push(e.from(p),`$${T}`));break;case s.OP_DEPTH:p=new o(this.stack.length).toScriptNumBuffer(),this.stack.push(p,"$depth");break;case s.OP_DROP:if(this.stack.length<1)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;this.stack.pop();break;case s.OP_DUP:if(this.stack.length<1)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;T=d(-1),this.stack.push(e.from(h(-1)),`$${T}`);break;case s.OP_NIP:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;this.stack.splice(this.stack.length-2,1);break;case s.OP_OVER:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;R=d(-2),this.stack.push(e.from(h(-2)),`$${R}`);break;case s.OP_PICK:case s.OP_ROLL:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;if(p=h(-1),g=(_=o.fromScriptNumBuffer(p,N,4)).toNumber(),this.stack.pop(),g<0||g>=this.stack.length)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;p=h(-g-1),T=d(-g-1),U===s.OP_ROLL?(this.stack.splice(this.stack.length-g-1,1),this.stack.push(e.from(p),T)):this.stack.push(e.from(p),`$${T}`);break;case s.OP_ROT:if(this.stack.length<3)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;y=h(-3),v=h(-2);var F=h(-1);T=d(-3),R=d(-2),x=d(-1),this.stack.write(-3,v),this.stack.write(-2,F),this.stack.write(-1,y),this.stack.updateTopVars([T,x,R]);break;case s.OP_SWAP:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;y=h(-2),v=h(-1),T=d(-2),R=d(-1),this.stack.write(-2,v),this.stack.write(-1,y),this.stack.updateTopVars([T,R]);break;case s.OP_TUCK:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;T=d(-2),R=d(-1),this.stack.splice(this.stack.length-2,0,e.from(h(-1))),this.stack.updateTopVars([R,T,`$${R}`]);break;case s.OP_SIZE:if(this.stack.length<1)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;_=new o(h(-1).length),this.stack.push(_.toScriptNumBuffer(),"$size");break;case s.OP_AND:case s.OP_OR:case s.OP_XOR:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;if(l=h(-2),m=h(-1),l.length!==m.length)return this.errstr="SCRIPT_ERR_INVALID_OPERAND_SIZE",!1;switch(U){case s.OP_AND:for(let t=0;t<l.length;t++)l[t]&=m[t];break;case s.OP_OR:for(let t=0;t<l.length;t++)l[t]|=m[t];break;case s.OP_XOR:for(let t=0;t<l.length;t++)l[t]^=m[t]}this.stack.pop();break;case s.OP_INVERT:this.stack.length<1&&(this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION"),p=h(-1);for(let t=0;t<p.length;t++)p[t]=~p[t];break;case s.OP_LSHIFT:case s.OP_RSHIFT:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;if(0===(l=h(-2)).length)this.stack.pop();else{if(S=new o(l),(g=(w=o.fromScriptNumBuffer(h(-1),N,4)).toNumber())<0)return this.errstr="SCRIPT_ERR_INVALID_NUMBER_RANGE",!1;let t;this.stack.pop(),this.stack.pop(),U===s.OP_LSHIFT&&(t=S.ushln(g)),U===s.OP_RSHIFT&&(t=S.ushrn(g));let r=function(t,r){let i=t;for(;i.length<r;)i=e.concat([e.from([0]),i]);return i}(e.from(t.toArray().slice(-1*l.length)),l.length);this.stack.push(r)}break;case s.OP_EQUAL:case s.OP_EQUALVERIFY:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;l=h(-2),m=h(-1);var K=l.toString("hex")===m.toString("hex");if(this.stack.pop(),this.stack.pop(),this.stack.push(K?c.getTrue():c.getFalse()),U===s.OP_EQUALVERIFY){if(!K)return this.errstr="SCRIPT_ERR_EQUALVERIFY",!1;this.stack.pop()}break;case s.OP_1ADD:case s.OP_1SUB:case s.OP_NEGATE:case s.OP_ABS:case s.OP_NOT:case s.OP_0NOTEQUAL:if(this.stack.length<1)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;switch(p=h(-1),_=o.fromScriptNumBuffer(p,N),U){case s.OP_1ADD:_=_.add(o.One);break;case s.OP_1SUB:_=_.sub(o.One);break;case s.OP_NEGATE:_=_.neg();break;case s.OP_ABS:_.cmp(o.Zero)<0&&(_=_.neg());break;case s.OP_NOT:_=new o((0===_.cmp(o.Zero))+0);break;case s.OP_0NOTEQUAL:_=new o((0!==_.cmp(o.Zero))+0)}this.stack.pop(),this.stack.push(_.toScriptNumBuffer());break;case s.OP_ADD:case s.OP_SUB:case s.OP_MUL:case s.OP_MOD:case s.OP_DIV:case s.OP_BOOLAND:case s.OP_BOOLOR:case s.OP_NUMEQUAL:case s.OP_NUMEQUALVERIFY:case s.OP_NUMNOTEQUAL:case s.OP_LESSTHAN:case s.OP_GREATERTHAN:case s.OP_LESSTHANOREQUAL:case s.OP_GREATERTHANOREQUAL:case s.OP_MIN:case s.OP_MAX:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;switch(S=o.fromScriptNumBuffer(h(-2),N),w=o.fromScriptNumBuffer(h(-1),N),_=new o(0),U){case s.OP_ADD:_=S.add(w);break;case s.OP_SUB:_=S.sub(w);break;case s.OP_MUL:_=S.mul(w);break;case s.OP_DIV:if(0===w)return this.errstr="SCRIPT_ERR_DIV_BY_ZERO",!1;_=S.div(w);break;case s.OP_MOD:if(0===w)return this.errstr="SCRIPT_ERR_DIV_BY_ZERO",!1;_=S.mod(w);break;case s.OP_BOOLAND:_=new o((0!==S.cmp(o.Zero)&&0!==w.cmp(o.Zero))+0);break;case s.OP_BOOLOR:_=new o((0!==S.cmp(o.Zero)||0!==w.cmp(o.Zero))+0);break;case s.OP_NUMEQUAL:case s.OP_NUMEQUALVERIFY:_=new o((0===S.cmp(w))+0);break;case s.OP_NUMNOTEQUAL:_=new o((0!==S.cmp(w))+0);break;case s.OP_LESSTHAN:_=new o((S.cmp(w)<0)+0);break;case s.OP_GREATERTHAN:_=new o((S.cmp(w)>0)+0);break;case s.OP_LESSTHANOREQUAL:_=new o((S.cmp(w)<=0)+0);break;case s.OP_GREATERTHANOREQUAL:_=new o((S.cmp(w)>=0)+0);break;case s.OP_MIN:_=S.cmp(w)<0?S:w;break;case s.OP_MAX:_=S.cmp(w)>0?S:w}if(this.stack.pop(),this.stack.pop(),this.stack.push(_.toScriptNumBuffer()),U===s.OP_NUMEQUALVERIFY){if(!c.castToBool(h(-1)))return this.errstr="SCRIPT_ERR_NUMEQUALVERIFY",!1;this.stack.pop()}break;case s.OP_WITHIN:if(this.stack.length<3)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;S=o.fromScriptNumBuffer(h(-3),N),w=o.fromScriptNumBuffer(h(-2),N);var z=o.fromScriptNumBuffer(h(-1),N);M=w.cmp(S)<=0&&S.cmp(z)<0,this.stack.pop(),this.stack.pop(),this.stack.pop(),this.stack.push(M?c.getTrue():c.getFalse());break;case s.OP_RIPEMD160:case s.OP_SHA1:case s.OP_SHA256:case s.OP_HASH160:case s.OP_HASH256:if(this.stack.length<1)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;var j;p=h(-1),U===s.OP_RIPEMD160?j=a.ripemd160(p):U===s.OP_SHA1?j=a.sha1(p):U===s.OP_SHA256?j=a.sha256(p):U===s.OP_HASH160?j=a.sha256ripemd160(p):U===s.OP_HASH256?j=a.sha256sha256(p):U===s.OP_SHA512_256?j=a.sha512_256(p):U===s.OP_HASH512_256&&(j=a.sha512_256sha512_256(p)),this.stack.pop(),this.stack.push(j);break;case s.OP_CODESEPARATOR:this.pbegincodehash=this.pc;break;case s.OP_CHECKSIG:case s.OP_CHECKSIGVERIFY:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;if(I=h(-2),E=h(-1),!this.checkSignatureEncoding(I)||!this.checkPubkeyEncoding(E))return!1;A=this.subscript();var V=(new n).add(I);A.findAndDelete(V);try{P=u.fromTxFormat(I),O=f.fromBuffer(E,!1),k=this.tx.verifySignature(P,O,this.nin,A,this.satoshisBN,this.flags)}catch(t){k=!1}if(!k&&this.flags&c.SCRIPT_VERIFY_NULLFAIL&&I.length)return this.errstr="SCRIPT_ERR_NULLFAIL",!1;if(this.stack.pop(),this.stack.pop(),this.stack.push(k?c.getTrue():c.getFalse()),U===s.OP_CHECKSIGVERIFY){if(!k)return this.errstr="SCRIPT_ERR_CHECKSIGVERIFY",!1;this.stack.pop()}break;case s.OP_CHECKMULTISIG:case s.OP_CHECKMULTISIGVERIFY:var q=1;if(this.stack.length<q)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;var Y=o.fromScriptNumBuffer(h(-q),N).toNumber();if(Y<0||Y>20)return this.errstr="SCRIPT_ERR_PUBKEY_COUNT",!1;if(this.nOpCount+=Y,this.nOpCount>c.MAX_OPCODE_COUNT)return this.errstr="SCRIPT_ERR_OP_COUNT",!1;var G=++q;q+=Y;var X=Y+2;if(this.stack.length<q)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;var Z=o.fromScriptNumBuffer(h(-q),N).toNumber();if(Z<0||Z>Y)return this.errstr="SCRIPT_ERR_SIG_COUNT",!1;var W=++q;if(q+=Z,this.stack.length<q)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;A=this.subscript();for(var J=0;J<Z;J++)I=h(-W-J),A.findAndDelete((new n).add(I));for(k=!0;k&&Z>0;){if(I=h(-W),E=h(-G),!this.checkSignatureEncoding(I)||!this.checkPubkeyEncoding(E))return!1;var Q;try{P=u.fromTxFormat(I),O=f.fromBuffer(E,!1),Q=this.tx.verifySignature(P,O,this.nin,A,this.satoshisBN,this.flags)}catch(t){Q=!1}Q&&(W++,Z--),G++,Z>--Y&&(k=!1)}for(;q-- >1;){if(!k&&this.flags&c.SCRIPT_VERIFY_NULLFAIL&&!X&&h(-1).length)return this.errstr="SCRIPT_ERR_NULLFAIL",!1;X>0&&X--,this.stack.pop()}if(this.stack.length<1)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;if(this.flags&c.SCRIPT_VERIFY_NULLDUMMY&&h(-1).length)return this.errstr="SCRIPT_ERR_SIG_NULLDUMMY",!1;if(this.stack.pop(),this.stack.push(k?c.getTrue():c.getFalse()),U===s.OP_CHECKMULTISIGVERIFY){if(!k)return this.errstr="SCRIPT_ERR_CHECKMULTISIGVERIFY",!1;this.stack.pop()}break;case s.OP_CAT:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;if(l=h(-2),m=h(-1),l.length+m.length>c.MAX_SCRIPT_ELEMENT_SIZE)return this.errstr="SCRIPT_ERR_PUSH_SIZE",!1;this.stack.write(-2,e.concat([l,m])),this.stack.pop();break;case s.OP_SPLIT:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;l=h(-2);var $=o.fromScriptNumBuffer(h(-1),N).toNumber();if($<0||$>l.length)return this.errstr="SCRIPT_ERR_INVALID_SPLIT_RANGE",!1;var tt=e.from(l);this.stack.write(-2,tt.slice(0,$)),this.stack.write(-1,tt.slice($));break;case s.OP_NUM2BIN:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;var et=o.fromScriptNumBuffer(h(-1),N).toNumber();if(et>c.MAX_SCRIPT_ELEMENT_SIZE)return this.errstr="SCRIPT_ERR_PUSH_SIZE",!1;this.stack.pop();var rt=h(-1);if((rt=c._minimallyEncode(rt)).length>et)return this.errstr="SCRIPT_ERR_IMPOSSIBLE_ENCODING",!1;if(rt.length===et){this.stack.write(-1,rt);break}var it=0;rt.length>0&&(it=128&rt[rt.length-1],rt[rt.length-1]&=127);var nt=e.alloc(et);rt.copy(nt,0);for(var st=rt.length-1;st++<et-2;)nt[st]=0;nt[st]=it,this.stack.write(-1,nt);break;case s.OP_BIN2NUM:if(this.stack.length<1)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;if(l=h(-1),m=c._minimallyEncode(l),this.stack.write(-1,m),!c._isMinimallyEncoded(m))return this.errstr="SCRIPT_ERR_INVALID_NUMBER_RANGE",!1;break;case s.OP_CHECKDATASIG:case s.OP_CHECKDATASIGVERIFY:case s.OP_REVERSEBYTES:case s.OP_STATESEPERATOR:case s.OP_STATESEPERATORINDEX_UTXO:case s.OP_STATESEPERATORINDEX_OUTPUT:case s.OP_PUSHINPUTREF:case s.OP_REQUIREINPUTREF:case s.OP_DISALLOWPUSHINPUTREF:case s.OP_DISALLOWPUSHINPUTREFSIBLING:case s.OP_REFHASHDATASUMMARY_UTXO:case s.OP_REFHASHDATASUMMARY_OUTPUT:case s.OP_REFHASHVALUESUM_UTXOS:case s.OP_REFHASHVALUESUM_OUTPUTS:case s.OP_PUSHINPUTREFSINGLETON:case s.OP_REFTYPE_UTXO:case s.OP_REFTYPE_OUTPUT:case s.OP_REFVALUESUM_UTXOS:case s.OP_REFVALUESUM_OUTPUTS:case s.OP_REFOUTPUTCOUNT_UTXOS:case s.OP_REFOUTPUTCOUNT_OUTPUTS:case s.OP_REFOUTPUTCOUNTZEROVALUED_UTXOS:case s.OP_REFOUTPUTCOUNTZEROVALUED_OUTPUTS:case s.OP_REFDATASUMMARY_UTXO:case s.OP_REFDATASUMMARY_OUTPUT:case s.OP_CODESCRIPTHASHVALUESUM_UTXOS:case s.OP_CODESCRIPTHASHVALUESUM_OUTPUTS:case s.OP_CODESCRIPTHASHOUTPUTCOUNT_UTXOS:case s.OP_CODESCRIPTHASHOUTPUTCOUNT_OUTPUTS:case s.OP_CODESCRIPTHASHZEROVALUEDOUTPUTCOUNT_UTXOS:case s.OP_CODESCRIPTHASHZEROVALUEDOUTPUTCOUNT_OUTPUTS:case s.OP_CODESCRIPTHASH_UTXO:case s.OP_CODESCRIPTHASH_OUTPUT:break;default:return this.errstr="SCRIPT_ERR_BAD_OPCODE",!1}return-1===this.vfExec.indexOf(!1)&&this._callbackStack(this.stack,this.pc,t),!0}}).call(this,r(0).Buffer)},function(t,e){var r=Object.prototype.toString;function i(t){return"function"==typeof t.constructor?t.constructor.name:null}t.exports=function(t){if(void 0===t)return"undefined";if(null===t)return"null";var e=typeof t;if("boolean"===e)return"boolean";if("string"===e)return"string";if("number"===e)return"number";if("symbol"===e)return"symbol";if("function"===e)return"GeneratorFunction"===i(t)?"generatorfunction":"function";if(function(t){return Array.isArray?Array.isArray(t):t instanceof Array}(t))return"array";if(function(t){if(t.constructor&&"function"==typeof t.constructor.isBuffer)return t.constructor.isBuffer(t);return!1}(t))return"buffer";if(function(t){try{if("number"==typeof t.length&&"function"==typeof t.callee)return!0}catch(t){if(-1!==t.message.indexOf("callee"))return!0}return!1}(t))return"arguments";if(function(t){return t instanceof Date||"function"==typeof t.toDateString&&"function"==typeof t.getDate&&"function"==typeof t.setDate}(t))return"date";if(function(t){return t instanceof Error||"string"==typeof t.message&&t.constructor&&"number"==typeof t.constructor.stackTraceLimit}(t))return"error";if(function(t){return t instanceof RegExp||"string"==typeof t.flags&&"boolean"==typeof t.ignoreCase&&"boolean"==typeof t.multiline&&"boolean"==typeof t.global}(t))return"regexp";switch(i(t)){case"Symbol":return"symbol";case"Promise":return"promise";case"WeakMap":return"weakmap";case"WeakSet":return"weakset";case"Map":return"map";case"Set":return"set";case"Int8Array":return"int8array";case"Uint8Array":return"uint8array";case"Uint8ClampedArray":return"uint8clampedarray";case"Int16Array":return"int16array";case"Uint16Array":return"uint16array";case"Int32Array":return"int32array";case"Uint32Array":return"uint32array";case"Float32Array":return"float32array";case"Float64Array":return"float64array"}if(function(t){return"function"==typeof t.throw&&"function"==typeof t.return&&"function"==typeof t.next}(t))return"generator";switch(e=r.call(t)){case"[object Object]":return"object";case"[object Map Iterator]":return"mapiterator";case"[object Set Iterator]":return"setiterator";case"[object String Iterator]":return"stringiterator";case"[object Array Iterator]":return"arrayiterator"}return e.slice(8,-1).toLowerCase().replace(/\s/g,"")}},function(t,e,r){"use strict";var i=function(t,e){this.stack=t,this.varStack=e||[]};function n(t){return t.reduce((function(t,e){return t+("0"+(255&e).toString(16)).slice(-2)}),"")}t.exports=i,i.prototype.pushVar=function(t){this.varStack.push(t||"$tmp")},i.prototype.popVar=function(){this.varStack.pop()},i.prototype.push=function(t,e){this.pushVar(e),this.stack.push(t),this.checkConsistency()},i.prototype.pop=function(){this.popVar();let t=this.stack.pop();return this.checkConsistency(),t},i.prototype.updateTopVars=function(t){if(t.length>this.varStack.length)throw new Error(`updateTopVars fail, stack: ${this.stack.length}, varStack: ${this.varStack.length}, vars:${t.length}`);t=t.reverse(),this.varStack.splice(this.varStack.length-t.length,t.length,...t)},i.prototype.stacktop=function(t){return this.stack[this.stack.length+t]},i.prototype.vartop=function(t){return this.varStack[this.varStack.length+t]},i.prototype.slice=function(t,e){return this.stack.slice(t,e)},i.prototype.splice=function(t,e,...r){return this.varStack.splice(t,e,...r),this.stack.splice(t,e,...r)},i.prototype.write=function(t,e){this.stack[this.stack.length+t]=e},i.prototype.copy=function(){return new i(this.stack.slice()||[],this.varStack.slice()||[])},i.prototype.printVarStack=function(){let t=this.varStack.map((t,e)=>({name:t,value:n(this.rawstack[e].data)}));console.log(JSON.stringify(t,null,4))},i.prototype.checkConsistency=function(){if(this.stack.length!==this.varStack.length)throw this.printVarStack(),new Error(`checkConsistency fail, stack: ${this.stack.length}, varStack:${this.varStack.length}`)},i.prototype.checkConsistencyWithVars=function(t){if(this.stack.length<t.length)throw this.printVarStack(),new Error(`checkConsistencyWithVars fail, stack: ${this.stack.length}, varStack:${t.length}`)},Object.defineProperty(i.prototype,"length",{get:function(){return this.stack.length}}),Object.defineProperty(i.prototype,"rawstack",{get:function(){return this.stack}})},function(t,e,r){"use strict";var i=r(1),n=r(2),s=r(0);const o=s.Buffer;var a=r(7),u=r(4),f=r(14),h=r(13),c=r(24),d=r(5),p=r(8),l=r(15),m=r(21),b=r(59),g=r(42),y=g.PublicKeyHash,v=g.PublicKey,_=g.MultiSigScriptHash,S=g.MultiSig,w=r(16),I=r(9),E=r(30),A=r(3);function P(t){if(!(this instanceof P))return new P(t);if(this.inputs=[],this.outputs=[],this._inputAmount=void 0,this._outputAmount=void 0,this.unlockScriptCallbackMap=new Map,this.outputCallbackMap=new Map,this._privateKey=void 0,this._sigType=void 0,this.isSeal=!1,t){if(t instanceof P)return P.shallowCopy(t);if(u.isHexa(t))this.fromString(t);else if(o.isBuffer(t))this.fromBuffer(t);else{if(!i.isObject(t))throw new a.InvalidArgument("Must provide an object or string to deserialize a transaction");this.fromObject(t)}}else this._newTransaction()}P.DUST_AMOUNT=1,P.FEE_SECURITY_MARGIN=150,P.MAX_MONEY="2100000000000000000",P.NLOCKTIME_BLOCKHEIGHT_LIMIT=5e8,P.NLOCKTIME_MAX_VALUE=4294967295,P.FEE_PER_KB=1e6,P.CHANGE_OUTPUT_MAX_SIZE=62,P.shallowCopy=function(t){return new P(t.toBuffer())};var O={configurable:!1,enumerable:!0,get:function(){return this._hash=new f(this._getHash()).readReverse().toString("hex"),this._hash}};Object.defineProperty(P.prototype,"hash",O),Object.defineProperty(P.prototype,"id",O);var M={configurable:!1,enumerable:!0,get:function(){return this._getInputAmount()}};Object.defineProperty(P.prototype,"inputAmount",M),M.get=function(){return this._getOutputAmount()},Object.defineProperty(P.prototype,"outputAmount",M),P.prototype._getHash=function(){return 3===this.version?this.getHashV3():d.sha256sha256(this.toBuffer())},P.prototype.getHashV3=function(){if(3!==this.version)throw new Error("Must be v3");const t=new h;let e=o.allocUnsafe(4);return e.writeUInt32LE(this.version),t.write(e),e=o.allocUnsafe(4),e.writeUInt32LE(this.inputs.length),t.write(e),t.write(l.GetHashPrevoutInputs(this)),t.write(l.GetSequenceHash(this)),e=o.allocUnsafe(4),e.writeUInt32LE(this.outputs.length),t.write(e),t.write(l.GetHashOutputHashes(this)),e=o.allocUnsafe(4),e.writeUInt32LE(this.nLockTime),t.write(e),d.sha256sha256(t.toBuffer())},P.prototype.serialize=function(t){return!0===t||t&&t.disableAll?this.uncheckedSerialize():this.checkedSerialize(t)},P.prototype.uncheckedSerialize=P.prototype.toString=function(){return this.toBuffer().toString("hex")},P.prototype.checkedSerialize=function(t){var e=this.getSerializationError(t);if(e)throw e.message+=" - For more information please see: https://bsv.io/api/lib/transaction#serialization-checks",e;return this.uncheckedSerialize()},P.prototype.invalidSatoshis=function(){for(var t=!1,e=0;e<this.outputs.length;e++)this.outputs[e].invalidSatoshis()&&(t=!0);return t},P.prototype.getSerializationError=function(t){if(t=t||{},this.invalidSatoshis())return new a.Transaction.InvalidSatoshis;var e,r=this._getUnspentValue();return r<0?t.disableMoreOutputThanInput||(e=new a.Transaction.InvalidOutputAmountSum):e=this._hasFeeError(t,r),e||this._hasDustOutputs(t)||this._isMissingSignatures(t)},P.prototype._hasFeeError=function(t,e){if(!i.isUndefined(this._fee)&&this._fee!==e)return new a.Transaction.FeeError.Different("Unspent value is "+e+" but specified fee is "+this._fee);if(!t.disableLargeFees){var r=Math.floor(P.FEE_SECURITY_MARGIN*this._estimateFee());if(e>r)return this._missingChange()?new a.Transaction.ChangeAddressMissing("Fee is too large and no change address was provided"):new a.Transaction.FeeError.TooLarge("expected less than "+r+" but got "+e)}},P.prototype._missingChange=function(){return!this._changeScript},P.prototype._hasDustOutputs=function(t){var e,r;if(!t.disableDustOutputs)for(e in this.outputs)if((r=this.outputs[e]).satoshis<P.DUST_AMOUNT&&!r.script.isDataOut()&&!r.script.isSafeDataOut())return new a.Transaction.DustOutputs},P.prototype._isMissingSignatures=function(t){if(!t.disableIsFullySigned)return this.isFullySigned()?void 0:new a.Transaction.MissingSignatures},P.prototype.inspect=function(){return"<Transaction: "+this.uncheckedSerialize()+">"},P.prototype.toBuffer=function(){var t=new h;return this.toBufferWriter(t).toBuffer()},P.prototype.toBufferWriter=function(t){return t.writeInt32LE(this.version),t.writeVarintNum(this.inputs.length),i.each(this.inputs,(function(e){e.toBufferWriter(t)})),t.writeVarintNum(this.outputs.length),i.each(this.outputs,(function(e){e.toBufferWriter(t)})),t.writeUInt32LE(this.nLockTime),t},P.prototype.fromBuffer=function(t){var e=new f(t);return this.fromBufferReader(e)},P.prototype.fromBufferReader=function(t){var e,r,i;for(n.checkArgument(!t.finished(),"No transaction data received"),this.version=t.readInt32LE(),r=t.readVarintNum(),e=0;e<r;e++){var s=g.fromBufferReader(t);this.inputs.push(s)}for(i=t.readVarintNum(),e=0;e<i;e++)this.outputs.push(w.fromBufferReader(t));return this.nLockTime=t.readUInt32LE(),this},P.prototype.toObject=P.prototype.toJSON=function(){var t=[];this.inputs.forEach((function(e){t.push(e.toObject())}));var e=[];this.outputs.forEach((function(t){e.push(t.toObject())}));var r={hash:this.hash,version:this.version,inputs:t,outputs:e,nLockTime:this.nLockTime};return this._changeScript&&(r.changeScript=this._changeScript.toString()),i.isUndefined(this._changeIndex)||(r.changeIndex=this._changeIndex),i.isUndefined(this._fee)||(r.fee=this._fee),r},P.prototype.fromObject=function(t){n.checkArgument(i.isObject(t)||t instanceof P);var e,r=this;return e=t instanceof P?e.toObject():t,i.each(e.inputs,(function(t){if(t.output&&t.output.script){var e,i=new I(t.output.script);if(i.isPublicKeyHashOut())e=new g.PublicKeyHash(t);else if(i.isScriptHashOut()&&t.publicKeys&&t.threshold)e=new g.MultiSigScriptHash(t,t.publicKeys,t.threshold,t.signatures);else{if(!i.isPublicKeyOut())throw new a.Transaction.Input.UnsupportedScript(t.output.script);e=new g.PublicKey(t)}r.addInput(e)}else r.uncheckedAddInput(new g(t))})),i.each(e.outputs,(function(t){r.addOutput(new w(t))})),e.changeIndex&&(this._changeIndex=e.changeIndex),e.changeScript&&(this._changeScript=new I(e.changeScript)),e.fee&&(this._fee=e.fee),this.nLockTime=e.nLockTime,this.version=e.version,this._checkConsistency(t),this},P.prototype._checkConsistency=function(t){i.isUndefined(this._changeIndex)||(n.checkState(this._changeScript,"Change script is expected."),n.checkState(this.outputs[this._changeIndex],"Change index points to undefined output."),n.checkState(this.outputs[this._changeIndex].script.toString()===this._changeScript.toString(),"Change output has an unexpected script.")),t&&t.hash&&n.checkState(t.hash===this.hash,"Hash in object does not match transaction hash.")},P.prototype.lockUntilDate=function(t){if(n.checkArgument(t),i.isNumber(t)&&t<P.NLOCKTIME_BLOCKHEIGHT_LIMIT)throw new a.Transaction.LockTimeTooEarly;i.isDate(t)&&(t=t.getTime()/1e3);for(var e=0;e<this.inputs.length;e++)this.inputs[e].sequenceNumber===g.DEFAULT_SEQNUMBER&&(this.inputs[e].sequenceNumber=g.DEFAULT_LOCKTIME_SEQNUMBER);return this.nLockTime=t,this},P.prototype.lockUntilBlockHeight=function(t){if(n.checkArgument(i.isNumber(t)),t>=P.NLOCKTIME_BLOCKHEIGHT_LIMIT)throw new a.Transaction.BlockHeightTooHigh;if(t<0)throw new a.Transaction.NLockTimeOutOfRange;for(var e=0;e<this.inputs.length;e++)this.inputs[e].sequenceNumber===g.DEFAULT_SEQNUMBER&&(this.inputs[e].sequenceNumber=g.DEFAULT_LOCKTIME_SEQNUMBER);return this.nLockTime=t,this},P.prototype.getLockTime=function(){return this.nLockTime?this.nLockTime<P.NLOCKTIME_BLOCKHEIGHT_LIMIT?this.nLockTime:new Date(1e3*this.nLockTime):null},P.prototype.fromString=function(t){this.fromBuffer(s.Buffer.from(t,"hex"))},P.prototype._newTransaction=function(){this.version=1,this.nLockTime=0},P.prototype.from=function(t,e,r){if(i.isArray(t)){var n=this;return i.each(t,(function(t){n.from(t,e,r)})),this}return i.some(this.inputs,(function(e){return e.prevTxId.toString("hex")===t.txId&&e.outputIndex===t.outputIndex}))?this:(e&&r?this._fromMultisigUtxo(t,e,r):this._fromNonP2SH(t),this)},P.prototype._fromNonP2SH=function(t){var e;e=(t=new b(t)).script.isPublicKeyHashOut()?y:t.script.isPublicKeyOut()?v:g,this.addInput(new e({output:new w({script:t.script,satoshis:t.satoshis}),prevTxId:t.txId,outputIndex:t.outputIndex,script:I.empty()}))},P.prototype._fromMultisigUtxo=function(t,e,r){var i;if(n.checkArgument(r<=e.length,"Number of required signatures must be greater than the number of public keys"),(t=new b(t)).script.isMultisigOut())i=S;else{if(!t.script.isScriptHashOut())throw new Error("@TODO");i=_}this.addInput(new i({output:new w({script:t.script,satoshis:t.satoshis}),prevTxId:t.txId,outputIndex:t.outputIndex,script:I.empty()},e,r))},P.prototype.addInput=function(t,e,r){if(n.checkArgumentType(t,g,"input"),!t.output&&(i.isUndefined(e)||i.isUndefined(r)))throw new a.Transaction.NeedMoreInfo("Need information about the UTXO script and satoshis");return t.output||!e||i.isUndefined(r)||(e=e instanceof I?e:new I(e),n.checkArgumentType(r,"number","satoshis"),t.output=new w({script:e,satoshis:r})),this.uncheckedAddInput(t)},P.prototype.uncheckedAddInput=function(t){return n.checkArgumentType(t,g,"input"),this.inputs.push(t),this._inputAmount=void 0,this._updateChangeOutput(),this},P.prototype.hasAllUtxoInfo=function(){return i.every(this.inputs.map((function(t){return!!t.output})))},P.prototype.fee=function(t){return n.checkArgument(i.isNumber(t),"amount must be a number"),this._fee=t,this._updateChangeOutput(),this},P.prototype.feePerKb=function(t){return n.checkArgument(i.isNumber(t),"amount must be a number"),this._feePerKb=t,this._updateChangeOutput(),this},P.prototype.change=function(t){return n.checkArgument(t,"address is required"),this._changeScript=I.fromAddress(t),this._updateChangeOutput(),this},P.prototype.getChangeOutput=function(){return i.isUndefined(this._changeIndex)?null:this.outputs[this._changeIndex]},P.prototype.to=function(t,e){if(i.isArray(t)){var r=this;return i.each(t,(function(t){r.to(t.address,t.satoshis)})),this}return n.checkArgument(u.isNaturalNumber(e),"Amount is expected to be a positive integer"),this.addOutput(new w({script:I(new m(t)),satoshis:e})),this},P.prototype.addData=function(t){return this.addOutput(new w({script:I.buildDataOut(t),satoshis:0})),this},P.prototype.addSafeData=function(t){return this.addOutput(new w({script:I.buildSafeDataOut(t),satoshis:0})),this},P.prototype.addOutput=function(t){return n.checkArgumentType(t,w,"output"),this._addOutput(t),this._updateChangeOutput(),this},P.prototype.clearOutputs=function(){return this.outputs=[],this._clearSignatures(),this._outputAmount=void 0,this._changeIndex=void 0,this._updateChangeOutput(),this},P.prototype._addOutput=function(t){this.outputs.push(t),this._outputAmount=void 0},P.prototype._getOutputAmount=function(){if(i.isUndefined(this._outputAmount)){var t=this;this._outputAmount=0,i.each(this.outputs,(function(e){t._outputAmount+=e.satoshis}))}return this._outputAmount},P.prototype._getInputAmount=function(){if(i.isUndefined(this._inputAmount)){var t=this;this._inputAmount=0,i.each(this.inputs,(function(e){if(i.isUndefined(e.output))throw new a.Transaction.Input.MissingPreviousOutput;t._inputAmount+=e.output.satoshis}))}return this._inputAmount},P.prototype._updateChangeOutput=function(){if(this.isSeal)throw new a.Transaction.TransactionAlreadySealed;if(this._changeScript){this._clearSignatures(),i.isUndefined(this._changeIndex)||this._removeOutput(this._changeIndex),this._changeIndex=this.outputs.length,this._addOutput(new w({script:this._changeScript,satoshis:0}));var t=this._getUnspentValue()-this.getFee();this._removeOutput(this._changeIndex),this._changeIndex=void 0,t>=P.DUST_AMOUNT&&(this._changeIndex=this.outputs.length,this._addOutput(new w({script:this._changeScript,satoshis:t})))}},P.prototype.getFee=function(){return this.isCoinbase()?0:i.isUndefined(this._fee)?this._changeScript?this._estimateFee():this._getUnspentValue():this._fee},P.prototype._estimateFee=function(){var t=this._estimateSize();return Math.ceil(t/1e3*(this._feePerKb||P.FEE_PER_KB))},P.prototype._getUnspentValue=function(){return this._getInputAmount()-this._getOutputAmount()},P.prototype._clearSignatures=function(){i.each(this.inputs,(function(t){t.clearSignatures()}))},P.prototype._estimateSize=function(){var t=8;return t+=c(this.inputs.length).toBuffer().length,t+=c(this.outputs.length).toBuffer().length,i.each(this.inputs,(function(e){t+=e._estimateSize()})),i.each(this.outputs,(function(e){t+=e.getSize()})),t},P.prototype._removeOutput=function(t){var e=this.outputs[t];this.outputs=i.without(this.outputs,e),this._outputAmount=void 0},P.prototype.removeOutput=function(t){this._removeOutput(t),this._updateChangeOutput()},P.prototype.sort=function(){return this.sortInputs((function(t){var e=Array.prototype.concat.apply([],t);return e.sort((function(t,e){return t.prevTxId.compare(e.prevTxId)||t.outputIndex-e.outputIndex})),e})),this.sortOutputs((function(t){var e=Array.prototype.concat.apply([],t);return e.sort((function(t,e){return t.satoshis-e.satoshis||t.script.toBuffer().compare(e.script.toBuffer())})),e})),this},P.prototype.shuffleOutputs=function(){return this.sortOutputs(i.shuffle)},P.prototype.sortOutputs=function(t){var e=t(this.outputs);return this._newOutputOrder(e)},P.prototype.sortInputs=function(t){return this.inputs=t(this.inputs),this._clearSignatures(),this},P.prototype._newOutputOrder=function(t){if(this.outputs.length!==t.length||0!==i.difference(this.outputs,t).length)throw new a.Transaction.InvalidSorting;if(!i.isUndefined(this._changeIndex)){var e=this.outputs[this._changeIndex];this._changeIndex=t.indexOf(e)}return this.outputs=t,this},P.prototype.removeInput=function(t,e){var r;if((r=!e&&i.isNumber(t)?t:i.findIndex(this.inputs,(function(r){return r.prevTxId.toString("hex")===t&&r.outputIndex===e})))<0||r>=this.inputs.length)throw new a.Transaction.InvalidIndex(r,this.inputs.length);var n=this.inputs[r];this.inputs=i.without(this.inputs,n),this._inputAmount=void 0,this._updateChangeOutput()},P.prototype.sign=function(t,e){n.checkState(this.hasAllUtxoInfo(),"Not all utxo information is available to sign the transaction.");var r=this;return i.isArray(t)?(i.each(t,(function(t){r.sign(t,e)})),this):(i.each(this.getSignatures(t,e),(function(t){r.applySignature(t)})),this._privateKey=t,this._sigType=e,this)},P.prototype.getSignatures=function(t,e){t=new E(t),e=e||p.SIGHASH_ALL|p.SIGHASH_FORKID;var r=this,n=[],s=d.sha256ripemd160(t.publicKey.toBuffer());return i.each(this.inputs,(function(o,a){i.each(o.getSignatures(r,t,a,e,s),(function(t){n.push(t)}))})),n},P.prototype.applySignature=function(t){return this.inputs[t.inputIndex].addSignature(this,t),this},P.prototype.isFullySigned=function(){return i.each(this.inputs,(function(t){if(t.isFullySigned===g.prototype.isFullySigned)throw new a.Transaction.UnableToVerifySignature("Unrecognized script kind, or not enough information to execute script.This usually happens when creating a transaction from a serialized transaction")})),i.every(i.map(this.inputs,(function(t){return t.isFullySigned()})))},P.prototype.isValidSignature=function(t){if(this.inputs[t.inputIndex].isValidSignature===g.prototype.isValidSignature)throw new a.Transaction.UnableToVerifySignature("Unrecognized script kind, or not enough information to execute script.This usually happens when creating a transaction from a serialized transaction");return this.inputs[t.inputIndex].isValidSignature(this,t)},P.prototype.verifySignature=function(t,e,r,i,n,s){return l.verify(this,t,e,r,i,n,s)},P.prototype.verify=function(){if(0===this.inputs.length)return"transaction txins empty";if(0===this.outputs.length)return"transaction txouts empty";for(var t=new A(0),e=0;e<this.outputs.length;e++){var r=this.outputs[e];if(r.invalidSatoshis())return"transaction txout "+e+" satoshis is invalid";if(r._satoshisBN.gt(new A(P.MAX_MONEY,10)))return"transaction txout "+e+" greater than MAX_MONEY";if((t=t.add(r._satoshisBN)).gt(new A(P.MAX_MONEY)))return"transaction txout "+e+" total output greater than MAX_MONEY"}if(this.toBuffer().length>1e6)return"transaction over the maximum block size";var n={};for(e=0;e<this.inputs.length;e++){var s=this.inputs[e],o=s.prevTxId+":"+s.outputIndex;if(!i.isUndefined(n[o]))return"transaction input "+e+" duplicate input";n[o]=!0}if(this.isCoinbase()){var a=this.inputs[0]._scriptBuffer;if(a.length<2||a.length>100)return"coinbase transaction script size invalid"}else for(e=0;e<this.inputs.length;e++)if(this.inputs[e].isNull())return"transaction input "+e+" has null input";return!0},P.prototype.isCoinbase=function(){return 1===this.inputs.length&&this.inputs[0].isNull()},P.prototype.setInputScript=function(t,e){return e instanceof Function?(this.unlockScriptCallbackMap.set(t,e),this.inputs[t].setScript(e(this,this.inputs[t].output))):this.inputs[t].setScript(e),this._updateChangeOutput(),this},P.prototype.setInputSequence=function(t,e){return this.inputs[t].sequenceNumber=e,this},P.prototype.setOutput=function(t,e){return e instanceof Function?(this.outputCallbackMap.set(t,e),this.outputs[t]=e(this)):this.outputs[t]=e,this._updateChangeOutput(),this},P.prototype.seal=function(){const t=this;return this.outputCallbackMap.forEach((function(e,r){t.outputs[r]=e(t)})),this.unlockScriptCallbackMap.forEach((function(e,r){t.inputs[r].setScript(e(t,t.inputs[r].output))})),this._privateKey&&this.sign(this._privateKey,this._sigType),this.isSeal=!0,this},P.prototype.setLockTime=function(t){return this.nLockTime=t,this},P.prototype.getChangeAmount=function(){return i.isUndefined(this._changeIndex)?0:this.outputs[this._changeIndex].satoshis},P.prototype.getEstimateFee=function(){return this._estimateFee()},P.prototype.checkFeeRate=function(t){return this._getUnspentValue()/this._estimateSize()>=(t||this._feePerKb||P.FEE_PER_KB)/1e3},P.prototype.prevouts=function(){var t=new h;return i.each(this.inputs,(function(e){t.writeReverse(e.prevTxId),t.writeUInt32LE(e.outputIndex)})),t.toBuffer().toString("hex")},t.exports=P},function(t,e,r){"use strict";var i=r(1),n=r(2),s=r(4),o=r(9),a=r(21);function u(t){if(!(this instanceof u))return new u(t);n.checkArgument(i.isObject(t),"Must provide an object from where to extract data");var e=t.address?new a(t.address):void 0,r=t.txid?t.txid:t.txId;if(!r||!s.isHexaString(r)||r.length>64)throw new Error("Invalid TXID in object",t);var f=i.isUndefined(t.vout)?t.outputIndex:t.vout;if(!i.isNumber(f))throw new Error("Invalid outputIndex, received "+f);n.checkArgument(!i.isUndefined(t.scriptPubKey)||!i.isUndefined(t.script),"Must provide the scriptPubKey for that output!");var h=new o(t.scriptPubKey||t.script);n.checkArgument(!i.isUndefined(t.amount)||!i.isUndefined(t.satoshis),"Must provide an amount for the output");var c=i.isUndefined(t.amount)?t.satoshis:Math.round(1e8*t.amount);n.checkArgument(i.isNumber(c),"Amount must be a number"),s.defineImmutable(this,{address:e,txId:r,outputIndex:f,script:h,satoshis:c})}u.prototype.inspect=function(){return"<UnspentOutput: "+this.txId+":"+this.outputIndex+", satoshis: "+this.satoshis+", address: "+this.address+">"},u.prototype.toString=function(){return this.txId+":"+this.outputIndex},u.fromObject=function(t){return new u(t)},u.prototype.toObject=u.prototype.toJSON=function(){return{address:this.address?this.address.toString():void 0,txid:this.txId,vout:this.outputIndex,scriptPubKey:this.script.toBuffer().toString("hex"),amount:Number.parseFloat((this.satoshis/1e8).toFixed(8))}},t.exports=u},function(t,e,r){"use strict";(function(e){const i=r(1),n=r(34),s=r(14),o=r(13),a=r(5),u=r(32),f=r(7),h=r(2);function c(t){if(!(this instanceof c))return new c(t);let r={};if(e.isBuffer(t))r=c._fromBufferReader(s(t));else{if(!i.isObject(t))throw new TypeError("Unrecognized argument for MerkleBlock");{let e;e=t.header instanceof n?t.header:n.fromObject(t.header),r={header:e,numTransactions:t.numTransactions,hashes:t.hashes,flags:t.flags}}}return i.extend(this,r),this._flagBitsUsed=0,this._hashesUsed=0,this}c.fromBuffer=function(t){return c.fromBufferReader(s(t))},c.fromBufferReader=function(t){return new c(c._fromBufferReader(t))},c.prototype.toBuffer=function(){return this.toBufferWriter().concat()},c.prototype.toBufferWriter=function(t){t||(t=new o),t.write(this.header.toBuffer()),t.writeUInt32LE(this.numTransactions),t.writeVarintNum(this.hashes.length);for(let r=0;r<this.hashes.length;r++)t.write(e.from(this.hashes[r],"hex"));t.writeVarintNum(this.flags.length);for(let e=0;e<this.flags.length;e++)t.writeUInt8(this.flags[e]);return t},c.prototype.toObject=c.prototype.toJSON=function(){return{header:this.header.toObject(),numTransactions:this.numTransactions,hashes:this.hashes,flags:this.flags}},c.prototype.validMerkleTree=function(){if(h.checkState(i.isArray(this.flags),"MerkleBlock flags is not an array"),h.checkState(i.isArray(this.hashes),"MerkleBlock hashes is not an array"),this.hashes.length>this.numTransactions)return!1;if(8*this.flags.length<this.hashes.length)return!1;const t=this._calcTreeHeight(),e={hashesUsed:0,flagBitsUsed:0},r=this._traverseMerkleTree(t,0,e);return e.hashesUsed===this.hashes.length&&r.equals(this.header.merkleRoot)},c.prototype.filterdTxsHash=function(){throw new Error("filterdTxsHash has been deprecated. use filteredTxsHash.")},c.prototype.filteredTxsHash=function(){if(h.checkState(i.isArray(this.flags),"MerkleBlock flags is not an array"),h.checkState(i.isArray(this.hashes),"MerkleBlock hashes is not an array"),this.hashes.length>this.numTransactions)throw new f.MerkleBlock.InvalidMerkleTree;if(8*this.flags.length<this.hashes.length)throw new f.MerkleBlock.InvalidMerkleTree;if(1===this.hashes.length)return[];const t=this._calcTreeHeight(),e={hashesUsed:0,flagBitsUsed:0},r=this._traverseMerkleTree(t,0,e,!0);if(e.hashesUsed!==this.hashes.length)throw new f.MerkleBlock.InvalidMerkleTree;return r},c.prototype._traverseMerkleTree=function(t,r,i,n){if((i=i||{}).txs=i.txs||[],i.flagBitsUsed=i.flagBitsUsed||0,i.hashesUsed=i.hashesUsed||0,n=n||!1,i.flagBitsUsed>8*this.flags.length)return null;const s=this.flags[i.flagBitsUsed>>3]>>>(7&i.flagBitsUsed++)&1;if(0!==t&&s){const s=this._traverseMerkleTree(t-1,2*r,i);let o=s;return 2*r+1<this._calcTreeWidth(t-1)&&(o=this._traverseMerkleTree(t-1,2*r+1,i)),n?i.txs:a.sha256sha256(e.concat([s,o]))}{if(i.hashesUsed>=this.hashes.length)return null;const r=this.hashes[i.hashesUsed++];return 0===t&&s&&i.txs.push(r),e.from(r,"hex")}},c.prototype._calcTreeWidth=function(t){return this.numTransactions+(1<<t)-1>>t},c.prototype._calcTreeHeight=function(){let t=0;for(;this._calcTreeWidth(t)>1;)t++;return t},c.prototype.hasTransaction=function(t){h.checkArgument(!i.isUndefined(t),"tx cannot be undefined"),h.checkArgument(t instanceof u||"string"==typeof t,'Invalid tx given, tx must be a "string" or "Transaction"');let r=t;t instanceof u&&(r=e.from(t.id,"hex").reverse().toString("hex"));const n=[],s=this._calcTreeHeight();return this._traverseMerkleTree(s,0,{txs:n}),-1!==n.indexOf(r)},c._fromBufferReader=function(t){h.checkState(!t.finished(),"No merkleblock data received");const e={};e.header=n.fromBufferReader(t),e.numTransactions=t.readUInt32LE();const r=t.readVarintNum();e.hashes=[];for(let i=0;i<r;i++)e.hashes.push(t.read(32).toString("hex"));const i=t.readVarintNum();e.flags=[];for(let r=0;r<i;r++)e.flags.push(t.readUInt8());return e},c.fromObject=function(t){return new c(t)},t.exports=c}).call(this,r(0).Buffer)},function(t,e,r){"use strict";var i=r(40),n=r(0);const s=n.Buffer;var o=r(1),a=r(2),u=r(3),f=r(31),h=r(23),c=r(5),d=r(19),p=r(20),l=r(30),m=r(33),b=r(7),g=b.HDPrivateKey,y=r(4);function v(t){if(t instanceof v)return t;if(!(this instanceof v))return new v(t);if(!t)return this._generateRandomly();if(d.get(t))return this._generateRandomly(t);if(o.isString(t)||s.isBuffer(t))if(v.isValidSerialized(t))this._buildFromSerialized(t);else if(y.isValidJSON(t))this._buildFromJSON(t);else{if(!s.isBuffer(t)||!v.isValidSerialized(t.toString()))throw v.getSerializedError(t);this._buildFromSerialized(t.toString())}else{if(!o.isObject(t))throw new g.UnrecognizedArgument(t);this._buildFromObject(t)}}v.fromRandom=function(){return new v},v.isValidPath=function(t,e){if(o.isString(t)){var r=v._getDerivationIndexes(t);return null!==r&&o.every(r,v.isValidPath)}return!!o.isNumber(t)&&(t<v.Hardened&&!0===e&&(t+=v.Hardened),t>=0&&t<v.MaxIndex)},v._getDerivationIndexes=function(t){var e=t.split("/");if(o.includes(v.RootElementAlias,t))return[];if(!o.includes(v.RootElementAlias,e[0]))return null;var r=e.slice(1).map((function(t){var e="'"===t.slice(-1);if(e&&(t=t.slice(0,-1)),!t||"-"===t[0])return NaN;var r=+t;return e&&(r+=v.Hardened),r}));return o.some(r,isNaN)?null:r},v.prototype.derive=function(){throw new Error("derive has been deprecated. use deriveChild or, for the old way, deriveNonCompliantChild.")},v.prototype.deriveChild=function(t,e){if(o.isNumber(t))return this._deriveWithNumber(t,e);if(o.isString(t))return this._deriveFromString(t);throw new g.InvalidDerivationArgument(t)},v.prototype.deriveNonCompliantChild=function(t,e){if(o.isNumber(t))return this._deriveWithNumber(t,e,!0);if(o.isString(t))return this._deriveFromString(t,!0);throw new g.InvalidDerivationArgument(t)},v.prototype._deriveWithNumber=function(t,e,r){if(!v.isValidPath(t,e))throw new g.InvalidPath(t);e=t>=v.Hardened||e,t<v.Hardened&&!0===e&&(t+=v.Hardened);var o,a=y.integerAsBuffer(t);if(e&&r){var f=this.privateKey.bn.toBuffer();o=s.concat([n.Buffer.from([0]),f,a])}else if(e){var h=this.privateKey.bn.toBuffer({size:32});i(32===h.length,"length of private key buffer is expected to be 32 bytes"),o=s.concat([n.Buffer.from([0]),h,a])}else o=s.concat([this.publicKey.toBuffer(),a]);var d=c.sha512hmac(o,this._buffers.chainCode),m=u.fromBuffer(d.slice(0,32),{size:32}),b=d.slice(32,64),_=m.add(this.privateKey.toBigNumber()).umod(p.getN()).toBuffer({size:32});return l.isValid(_)?new v({network:this.network,depth:this.depth+1,parentFingerPrint:this.fingerPrint,childIndex:t,chainCode:b,privateKey:_}):this._deriveWithNumber(t+1,null,r)},v.prototype._deriveFromString=function(t,e){if(!v.isValidPath(t))throw new g.InvalidPath(t);return v._getDerivationIndexes(t).reduce((function(t,r){return t._deriveWithNumber(r,null,e)}),this)},v.isValidSerialized=function(t,e){return!v.getSerializedError(t,e)},v.getSerializedError=function(t,e){if(!o.isString(t)&&!s.isBuffer(t))return new g.UnrecognizedArgument("Expected string or buffer");if(!f.validCharacters(t))return new b.InvalidB58Char("(unknown)",t);try{t=h.decode(t)}catch(e){return new b.InvalidB58Checksum(t)}if(t.length!==v.DataLength)return new g.InvalidLength(t);if(!o.isUndefined(e)){var r=v._validateNetwork(t,e);if(r)return r}return null},v._validateNetwork=function(t,e){var r=d.get(e);if(!r)return new b.InvalidNetworkArgument(e);var i=t.slice(0,4);return i.readUInt32BE(0)!==r.xprivkey?new b.InvalidNetwork(i):null},v.fromString=function(t){return a.checkArgument(o.isString(t),"No valid string was provided"),new v(t)},v.fromObject=function(t){return a.checkArgument(o.isObject(t),"No valid argument was provided"),new v(t)},v.prototype._buildFromJSON=function(t){return this._buildFromObject(JSON.parse(t))},v.prototype._buildFromObject=function(t){var e={version:t.network?y.integerAsBuffer(d.get(t.network).xprivkey):t.version,depth:o.isNumber(t.depth)?s.from([255&t.depth]):t.depth,parentFingerPrint:o.isNumber(t.parentFingerPrint)?y.integerAsBuffer(t.parentFingerPrint):t.parentFingerPrint,childIndex:o.isNumber(t.childIndex)?y.integerAsBuffer(t.childIndex):t.childIndex,chainCode:o.isString(t.chainCode)?s.from(t.chainCode,"hex"):t.chainCode,privateKey:o.isString(t.privateKey)&&y.isHexa(t.privateKey)?s.from(t.privateKey,"hex"):t.privateKey,checksum:t.checksum?t.checksum.length?t.checksum:y.integerAsBuffer(t.checksum):void 0};return this._buildFromBuffers(e)},v.prototype._buildFromSerialized=function(t){var e=h.decode(t),r={version:e.slice(v.VersionStart,v.VersionEnd),depth:e.slice(v.DepthStart,v.DepthEnd),parentFingerPrint:e.slice(v.ParentFingerPrintStart,v.ParentFingerPrintEnd),childIndex:e.slice(v.ChildIndexStart,v.ChildIndexEnd),chainCode:e.slice(v.ChainCodeStart,v.ChainCodeEnd),privateKey:e.slice(v.PrivateKeyStart,v.PrivateKeyEnd),checksum:e.slice(v.ChecksumStart,v.ChecksumEnd),xprivkey:t};return this._buildFromBuffers(r)},v.prototype._generateRandomly=function(t){return v.fromSeed(m.getRandomBuffer(64),t)},v.fromSeed=function(t,e){if(y.isHexaString(t)&&(t=s.from(t,"hex")),!s.isBuffer(t))throw new g.InvalidEntropyArgument(t);if(t.length<16)throw new g.InvalidEntropyArgument.NotEnoughEntropy(t);if(t.length>64)throw new g.InvalidEntropyArgument.TooMuchEntropy(t);var r=c.sha512hmac(t,n.Buffer.from("Bitcoin seed"));return new v({network:d.get(e)||d.defaultNetwork,depth:0,parentFingerPrint:0,childIndex:0,privateKey:r.slice(0,32),chainCode:r.slice(32,64)})},v.prototype._calcHDPublicKey=function(){if(!this._hdPublicKey){var t=r(62);this._hdPublicKey=new t(this)}},v.prototype._buildFromBuffers=function(t){v._validateBufferArguments(t),y.defineImmutable(this,{_buffers:t});var e=[t.version,t.depth,t.parentFingerPrint,t.childIndex,t.chainCode,s.alloc(1),t.privateKey],r=n.Buffer.concat(e);if(t.checksum&&t.checksum.length){if(t.checksum.toString()!==h.checksum(r).toString())throw new b.InvalidB58Checksum(r)}else t.checksum=h.checksum(r);var i,o=d.get(t.version.readUInt32BE(0));i=h.encode(n.Buffer.concat(e)),t.xprivkey=s.from(i);var a=new l(u.fromBuffer(t.privateKey),o),f=a.toPublicKey(),p=v.ParentFingerPrintSize,m=c.sha256ripemd160(f.toBuffer()).slice(0,p);return y.defineImmutable(this,{xprivkey:i,network:o,depth:t.depth[0],privateKey:a,publicKey:f,fingerPrint:m}),this._hdPublicKey=null,Object.defineProperty(this,"hdPublicKey",{configurable:!1,enumerable:!0,get:function(){return this._calcHDPublicKey(),this._hdPublicKey}}),Object.defineProperty(this,"xpubkey",{configurable:!1,enumerable:!0,get:function(){return this._calcHDPublicKey(),this._hdPublicKey.xpubkey}}),this},v._validateBufferArguments=function(t){var e=function(e,r){var n=t[e];i(s.isBuffer(n),e+" argument is not a buffer"),i(n.length===r,e+" has not the expected size: found "+n.length+", expected "+r)};e("version",v.VersionSize),e("depth",v.DepthSize),e("parentFingerPrint",v.ParentFingerPrintSize),e("childIndex",v.ChildIndexSize),e("chainCode",v.ChainCodeSize),e("privateKey",v.PrivateKeySize),t.checksum&&t.checksum.length&&e("checksum",v.CheckSumSize)},v.prototype.toString=function(){return this.xprivkey},v.prototype.inspect=function(){return"<HDPrivateKey: "+this.xprivkey+">"},v.prototype.toObject=v.prototype.toJSON=function(){return{network:d.get(this._buffers.version.readUInt32BE(0),"xprivkey").name,depth:this._buffers.depth[0],fingerPrint:this.fingerPrint.readUInt32BE(0),parentFingerPrint:this._buffers.parentFingerPrint.readUInt32BE(0),childIndex:this._buffers.childIndex.readUInt32BE(0),chainCode:this._buffers.chainCode.toString("hex"),privateKey:this.privateKey.toBuffer().toString("hex"),checksum:this._buffers.checksum.readUInt32BE(0),xprivkey:this.xprivkey}},v.fromBuffer=function(t){return new v(t.toString())},v.fromHex=function(t){return v.fromBuffer(s.from(t,"hex"))},v.prototype.toBuffer=function(){return s.from(this.toString())},v.prototype.toHex=function(){return this.toBuffer().toString("hex")},v.DefaultDepth=0,v.DefaultFingerprint=0,v.DefaultChildIndex=0,v.Hardened=2147483648,v.MaxIndex=2*v.Hardened,v.RootElementAlias=["m","M","m'","M'"],v.VersionSize=4,v.DepthSize=1,v.ParentFingerPrintSize=4,v.ChildIndexSize=4,v.ChainCodeSize=32,v.PrivateKeySize=32,v.CheckSumSize=4,v.DataLength=78,v.SerializedByteSize=82,v.VersionStart=0,v.VersionEnd=v.VersionStart+v.VersionSize,v.DepthStart=v.VersionEnd,v.DepthEnd=v.DepthStart+v.DepthSize,v.ParentFingerPrintStart=v.DepthEnd,v.ParentFingerPrintEnd=v.ParentFingerPrintStart+v.ParentFingerPrintSize,v.ChildIndexStart=v.ParentFingerPrintEnd,v.ChildIndexEnd=v.ChildIndexStart+v.ChildIndexSize,v.ChainCodeStart=v.ChildIndexEnd,v.ChainCodeEnd=v.ChainCodeStart+v.ChainCodeSize,v.PrivateKeyStart=v.ChainCodeEnd+1,v.PrivateKeyEnd=v.PrivateKeyStart+v.PrivateKeySize,v.ChecksumStart=v.PrivateKeyEnd,v.ChecksumEnd=v.ChecksumStart+v.CheckSumSize,i(v.ChecksumEnd===v.SerializedByteSize),t.exports=v},function(t,e,r){"use strict";(function(e){var i=r(1),n=r(2),s=r(3),o=r(31),a=r(23),u=r(5),f=r(61),h=r(19),c=r(20),d=r(12),p=r(7),l=p,m=p.HDPublicKey,b=r(40),g=r(4);function y(t){if(t instanceof y)return t;if(!(this instanceof y))return new y(t);if(t){if(i.isString(t)||e.isBuffer(t)){var r=y.getSerializedError(t);if(r){if(e.isBuffer(t)&&!y.getSerializedError(t.toString()))return this._buildFromSerialized(t.toString());if(r instanceof m.ArgumentIsPrivateExtended)return new f(t).hdPublicKey;throw r}return this._buildFromSerialized(t)}if(i.isObject(t))return t instanceof f?this._buildFromPrivate(t):this._buildFromObject(t);throw new m.UnrecognizedArgument(t)}throw new m.MustSupplyArgument}y.fromHDPrivateKey=function(t){return new y(t)},y.isValidPath=function(t){if(i.isString(t)){var e=f._getDerivationIndexes(t);return null!==e&&i.every(e,y.isValidPath)}return!!i.isNumber(t)&&(t>=0&&t<y.Hardened)},y.prototype.derive=function(){throw new Error("derive has been deprecated. use deriveChild or, for the old way, deriveNonCompliantChild.")},y.prototype.deriveChild=function(t,e){if(i.isNumber(t))return this._deriveWithNumber(t,e);if(i.isString(t))return this._deriveFromString(t);throw new m.InvalidDerivationArgument(t)},y.prototype._deriveWithNumber=function(t,r){if(t>=y.Hardened||r)throw new m.InvalidIndexCantDeriveHardened;if(t<0)throw new m.InvalidPath(t);var i,n=g.integerAsBuffer(t),o=e.concat([this.publicKey.toBuffer(),n]),a=u.sha512hmac(o,this._buffers.chainCode),f=s.fromBuffer(a.slice(0,32),{size:32}),h=a.slice(32,64);try{i=d.fromPoint(c.getG().mul(f).add(this.publicKey.point))}catch(e){return this._deriveWithNumber(t+1)}return new y({network:this.network,depth:this.depth+1,parentFingerPrint:this.fingerPrint,childIndex:t,chainCode:h,publicKey:i})},y.prototype._deriveFromString=function(t){if(i.includes(t,"'"))throw new m.InvalidIndexCantDeriveHardened;if(!y.isValidPath(t))throw new m.InvalidPath(t);return f._getDerivationIndexes(t).reduce((function(t,e){return t._deriveWithNumber(e)}),this)},y.isValidSerialized=function(t,e){return i.isNull(y.getSerializedError(t,e))},y.getSerializedError=function(t,r){if(!i.isString(t)&&!e.isBuffer(t))return new m.UnrecognizedArgument("expected buffer or string");if(!o.validCharacters(t))return new l.InvalidB58Char("(unknown)",t);try{t=a.decode(t)}catch(e){return new l.InvalidB58Checksum(t)}if(t.length!==y.DataSize)return new m.InvalidLength(t);if(!i.isUndefined(r)){var n=y._validateNetwork(t,r);if(n)return n}var s=t.readUInt32BE(0);return s===h.livenet.xprivkey||s===h.testnet.xprivkey?new m.ArgumentIsPrivateExtended:null},y._validateNetwork=function(t,e){var r=h.get(e);if(!r)return new l.InvalidNetworkArgument(e);var i=t.slice(y.VersionStart,y.VersionEnd);return i.readUInt32BE(0)!==r.xpubkey?new l.InvalidNetwork(i):null},y.prototype._buildFromPrivate=function(t){var e=i.clone(t._buffers),r=c.getG().mul(s.fromBuffer(e.privateKey));return e.publicKey=c.pointToCompressed(r),e.version=g.integerAsBuffer(h.get(e.version.readUInt32BE(0)).xpubkey),e.privateKey=void 0,e.checksum=void 0,e.xprivkey=void 0,this._buildFromBuffers(e)},y.prototype._buildFromObject=function(t){var r={version:t.network?g.integerAsBuffer(h.get(t.network).xpubkey):t.version,depth:i.isNumber(t.depth)?e.from([255&t.depth]):t.depth,parentFingerPrint:i.isNumber(t.parentFingerPrint)?g.integerAsBuffer(t.parentFingerPrint):t.parentFingerPrint,childIndex:i.isNumber(t.childIndex)?g.integerAsBuffer(t.childIndex):t.childIndex,chainCode:i.isString(t.chainCode)?e.from(t.chainCode,"hex"):t.chainCode,publicKey:i.isString(t.publicKey)?e.from(t.publicKey,"hex"):e.isBuffer(t.publicKey)?t.publicKey:t.publicKey.toBuffer(),checksum:i.isNumber(t.checksum)?g.integerAsBuffer(t.checksum):t.checksum};return this._buildFromBuffers(r)},y.prototype._buildFromSerialized=function(t){var e=a.decode(t),r={version:e.slice(y.VersionStart,y.VersionEnd),depth:e.slice(y.DepthStart,y.DepthEnd),parentFingerPrint:e.slice(y.ParentFingerPrintStart,y.ParentFingerPrintEnd),childIndex:e.slice(y.ChildIndexStart,y.ChildIndexEnd),chainCode:e.slice(y.ChainCodeStart,y.ChainCodeEnd),publicKey:e.slice(y.PublicKeyStart,y.PublicKeyEnd),checksum:e.slice(y.ChecksumStart,y.ChecksumEnd),xpubkey:t};return this._buildFromBuffers(r)},y.prototype._buildFromBuffers=function(t){y._validateBufferArguments(t),g.defineImmutable(this,{_buffers:t});var r=[t.version,t.depth,t.parentFingerPrint,t.childIndex,t.chainCode,t.publicKey],i=e.concat(r),n=a.checksum(i);if(t.checksum&&t.checksum.length){if(t.checksum.toString("hex")!==n.toString("hex"))throw new l.InvalidB58Checksum(i,n)}else t.checksum=n;var s,o=h.get(t.version.readUInt32BE(0));s=a.encode(e.concat(r)),t.xpubkey=e.from(s);var f=new d(t.publicKey,{network:o}),c=y.ParentFingerPrintSize,p=u.sha256ripemd160(f.toBuffer()).slice(0,c);return g.defineImmutable(this,{xpubkey:s,network:o,depth:t.depth[0],publicKey:f,fingerPrint:p}),this},y._validateBufferArguments=function(t){var r=function(r,i){var n=t[r];b(e.isBuffer(n),r+" argument is not a buffer, it's "+typeof n),b(n.length===i,r+" has not the expected size: found "+n.length+", expected "+i)};r("version",y.VersionSize),r("depth",y.DepthSize),r("parentFingerPrint",y.ParentFingerPrintSize),r("childIndex",y.ChildIndexSize),r("chainCode",y.ChainCodeSize),r("publicKey",y.PublicKeySize),t.checksum&&t.checksum.length&&r("checksum",y.CheckSumSize)},y.fromString=function(t){return n.checkArgument(i.isString(t),"No valid string was provided"),new y(t)},y.fromObject=function(t){return n.checkArgument(i.isObject(t),"No valid argument was provided"),new y(t)},y.prototype.toString=function(){return this.xpubkey},y.prototype.inspect=function(){return"<HDPublicKey: "+this.xpubkey+">"},y.prototype.toObject=y.prototype.toJSON=function(){return{network:h.get(this._buffers.version.readUInt32BE(0)).name,depth:this._buffers.depth[0],fingerPrint:this.fingerPrint.readUInt32BE(0),parentFingerPrint:this._buffers.parentFingerPrint.readUInt32BE(0),childIndex:this._buffers.childIndex.readUInt32BE(0),chainCode:this._buffers.chainCode.toString("hex"),publicKey:this.publicKey.toString(),checksum:this._buffers.checksum.readUInt32BE(0),xpubkey:this.xpubkey}},y.fromBuffer=function(t){return new y(t)},y.fromHex=function(t){return y.fromBuffer(e.from(t,"hex"))},y.prototype.toBuffer=function(){return e.from(this._buffers.xpubkey)},y.prototype.toHex=function(){return this.toBuffer().toString("hex")},y.Hardened=2147483648,y.RootElementAlias=["m","M"],y.VersionSize=4,y.DepthSize=1,y.ParentFingerPrintSize=4,y.ChildIndexSize=4,y.ChainCodeSize=32,y.PublicKeySize=33,y.CheckSumSize=4,y.DataSize=78,y.SerializedByteSize=82,y.VersionStart=0,y.VersionEnd=y.VersionStart+y.VersionSize,y.DepthStart=y.VersionEnd,y.DepthEnd=y.DepthStart+y.DepthSize,y.ParentFingerPrintStart=y.DepthEnd,y.ParentFingerPrintEnd=y.ParentFingerPrintStart+y.ParentFingerPrintSize,y.ChildIndexStart=y.ParentFingerPrintEnd,y.ChildIndexEnd=y.ChildIndexStart+y.ChildIndexSize,y.ChainCodeStart=y.ChildIndexEnd,y.ChainCodeEnd=y.ChainCodeStart+y.ChainCodeSize,y.PublicKeyStart=y.ChainCodeEnd,y.PublicKeyEnd=y.PublicKeyStart+y.PublicKeySize,y.ChecksumStart=y.PublicKeyEnd,y.ChecksumEnd=y.ChecksumStart+y.CheckSumSize,b(y.PublicKeyEnd===y.DataSize),b(y.ChecksumEnd===y.SerializedByteSize),t.exports=y}).call(this,r(0).Buffer)},function(t,e,r){"use strict";(function(e){var i=t.exports;i.version="v"+r(67).version,i.versionGuard=function(t){if(void 0!==t){console.warn("\n More than one instance of radiantjs found.\n Please make sure to require radiantjs and check that submodules do\n not also include their own radiantjs dependency.")}};var n=n||{};i.versionGuard(n._radiantjs),n._radiantjs=i.version,i.crypto={},i.crypto.BN=r(3),i.crypto.ECDSA=r(44),i.crypto.Hash=r(5),i.crypto.Random=r(33),i.crypto.Point=r(20),i.crypto.Signature=r(8),i.encoding={},i.encoding.Base58=r(31),i.encoding.Base58Check=r(23),i.encoding.BufferReader=r(14),i.encoding.BufferWriter=r(13),i.encoding.Varint=r(24),i.util={},i.util.js=r(4),i.util.preconditions=r(2),i.errors=r(7),i.Address=r(21),i.Block=r(109),i.MerkleBlock=r(60),i.BlockHeader=r(34),i.HDPrivateKey=r(61),i.HDPublicKey=r(62),i.Networks=r(19),i.Opcode=r(41),i.PrivateKey=r(30),i.PublicKey=r(12),i.Script=r(9),i.Transaction=r(32),i.deps={},i.deps.bnjs=r(10),i.deps.bs58=r(53),i.deps.Buffer=e,i.deps.elliptic=r(45),i.deps._=r(1),i.Transaction.sighash=r(15)}).call(this,r(0).Buffer)},function(t,e,r){"use strict";e.byteLength=function(t){var e=f(t),r=e[0],i=e[1];return 3*(r+i)/4-i},e.toByteArray=function(t){var e,r,i=f(t),o=i[0],a=i[1],u=new s(function(t,e,r){return 3*(e+r)/4-r}(0,o,a)),h=0,c=a>0?o-4:o;for(r=0;r<c;r+=4)e=n[t.charCodeAt(r)]<<18|n[t.charCodeAt(r+1)]<<12|n[t.charCodeAt(r+2)]<<6|n[t.charCodeAt(r+3)],u[h++]=e>>16&255,u[h++]=e>>8&255,u[h++]=255&e;2===a&&(e=n[t.charCodeAt(r)]<<2|n[t.charCodeAt(r+1)]>>4,u[h++]=255&e);1===a&&(e=n[t.charCodeAt(r)]<<10|n[t.charCodeAt(r+1)]<<4|n[t.charCodeAt(r+2)]>>2,u[h++]=e>>8&255,u[h++]=255&e);return u},e.fromByteArray=function(t){for(var e,r=t.length,n=r%3,s=[],o=0,a=r-n;o<a;o+=16383)s.push(h(t,o,o+16383>a?a:o+16383));1===n?(e=t[r-1],s.push(i[e>>2]+i[e<<4&63]+"==")):2===n&&(e=(t[r-2]<<8)+t[r-1],s.push(i[e>>10]+i[e>>4&63]+i[e<<2&63]+"="));return s.join("")};for(var i=[],n=[],s="undefined"!=typeof Uint8Array?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,u=o.length;a<u;++a)i[a]=o[a],n[o.charCodeAt(a)]=a;function f(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");return-1===r&&(r=e),[r,r===e?0:4-r%4]}function h(t,e,r){for(var n,s,o=[],a=e;a<r;a+=3)n=(t[a]<<16&16711680)+(t[a+1]<<8&65280)+(255&t[a+2]),o.push(i[(s=n)>>18&63]+i[s>>12&63]+i[s>>6&63]+i[63&s]);return o.join("")}n["-".charCodeAt(0)]=62,n["_".charCodeAt(0)]=63},function(t,e){e.read=function(t,e,r,i,n){var s,o,a=8*n-i-1,u=(1<<a)-1,f=u>>1,h=-7,c=r?n-1:0,d=r?-1:1,p=t[e+c];for(c+=d,s=p&(1<<-h)-1,p>>=-h,h+=a;h>0;s=256*s+t[e+c],c+=d,h-=8);for(o=s&(1<<-h)-1,s>>=-h,h+=i;h>0;o=256*o+t[e+c],c+=d,h-=8);if(0===s)s=1-f;else{if(s===u)return o?NaN:1/0*(p?-1:1);o+=Math.pow(2,i),s-=f}return(p?-1:1)*o*Math.pow(2,s-i)},e.write=function(t,e,r,i,n,s){var o,a,u,f=8*s-n-1,h=(1<<f)-1,c=h>>1,d=23===n?Math.pow(2,-24)-Math.pow(2,-77):0,p=i?0:s-1,l=i?1:-1,m=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,o=h):(o=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-o))<1&&(o--,u*=2),(e+=o+c>=1?d/u:d*Math.pow(2,1-c))*u>=2&&(o++,u/=2),o+c>=h?(a=0,o=h):o+c>=1?(a=(e*u-1)*Math.pow(2,n),o+=c):(a=e*Math.pow(2,c-1)*Math.pow(2,n),o=0));n>=8;t[r+p]=255&a,p+=l,a/=256,n-=8);for(o=o<<n|a,f+=n;f>0;t[r+p]=255&o,p+=l,o/=256,f-=8);t[r+p-l]|=128*m}},function(t,e){var r={}.toString;t.exports=Array.isArray||function(t){return"[object Array]"==r.call(t)}},function(t){t.exports={name:"@radiantblockchain/radiantjs",description:"Javascript library for Radiant Blockchain (RXD)",version:"1.9.5",author:"Radiant Blockchain <radiantblockchain@protonmail.com>",main:"index.js",scripts:{lint:"standard",lint_test:"standard && mocha",test:"mocha",radiant:'mocha --grep="radiant"',exact_match:'mocha --grep="exact_match"',coverage:"nyc --reporter=text npm run test","build-radiant":"NODE_OPTIONS=--openssl-legacy-provider webpack index.js --config webpack.config.js","build-ecies":"NODE_OPTIONS=--openssl-legacy-provider webpack ecies/index.js --config webpack.subproject.config.js --output-library radiantEcies -o radiant-ecies.min.js","build-message":"NODE_OPTIONS=--openssl-legacy-provider webpack message/index.js --config webpack.subproject.config.js --output-library radiantMessage -o radiant-message.min.js","build-mnemonic":"NODE_OPTIONS=--openssl-legacy-provider webpack mnemonic/index.js --config webpack.subproject.config.js --output-library radiantMnemonic -o radiant-mnemonic.min.js",build:"yarn build-radiant && yarn build-ecies && yarn build-message && yarn build-mnemonic",prepublishOnly:"yarn build"},unpkg:"radiant.min.js",keywords:["radiant","radiant-blockchain","transaction","address","p2p","ecies","cryptocurrency","blockchain","payment"],repository:{type:"git",url:"https://github.com/radiantblockchain/radiantjs"},browser:{request:"browser-request"},dependencies:{"aes-js":"^3.1.2","bn.js":"=4.11.9",bs58:"=4.0.1",buffer:"^6.0.3","clone-deep":"^4.0.1",elliptic:"6.5.4","hash.js":"^1.1.7",inherits:"2.0.3","js-sha512":"^0.8.0",unorm:"1.4.1"},devDependencies:{brfs:"2.0.1",chai:"4.2.0",mocha:"^8.4.0",nyc:"^14.1.1",sinon:"7.2.3",standard:"12.0.1",webpack:"4.29.3","webpack-cli":"^3.3.12"},license:"MIT",standard:{globals:["afterEach","beforeEach","describe","it"],ignore:["dist/**"]}}},function(t,e,r){(function(t){!function(t,e){"use strict";function i(t,e){if(!t)throw new Error(e||"Assertion failed")}function n(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function s(t,e,r){if(s.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(r=e,e=10),this._init(t||0,e||10,r||"be"))}var o;"object"==typeof t?t.exports=s:e.BN=s,s.BN=s,s.wordSize=26;try{o=r(0).Buffer}catch(t){}function a(t,e,r){for(var i=0,n=Math.min(t.length,r),s=e;s<n;s++){var o=t.charCodeAt(s)-48;i<<=4,i|=o>=49&&o<=54?o-49+10:o>=17&&o<=22?o-17+10:15&o}return i}function u(t,e,r,i){for(var n=0,s=Math.min(t.length,r),o=e;o<s;o++){var a=t.charCodeAt(o)-48;n*=i,n+=a>=49?a-49+10:a>=17?a-17+10:a}return n}s.isBN=function(t){return t instanceof s||null!==t&&"object"==typeof t&&t.constructor.wordSize===s.wordSize&&Array.isArray(t.words)},s.max=function(t,e){return t.cmp(e)>0?t:e},s.min=function(t,e){return t.cmp(e)<0?t:e},s.prototype._init=function(t,e,r){if("number"==typeof t)return this._initNumber(t,e,r);if("object"==typeof t)return this._initArray(t,e,r);"hex"===e&&(e=16),i(e===(0|e)&&e>=2&&e<=36);var n=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&n++,16===e?this._parseHex(t,n):this._parseBase(t,e,n),"-"===t[0]&&(this.negative=1),this.strip(),"le"===r&&this._initArray(this.toArray(),e,r)},s.prototype._initNumber=function(t,e,r){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(i(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===r&&this._initArray(this.toArray(),e,r)},s.prototype._initArray=function(t,e,r){if(i("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var n=0;n<this.length;n++)this.words[n]=0;var s,o,a=0;if("be"===r)for(n=t.length-1,s=0;n>=0;n-=3)o=t[n]|t[n-1]<<8|t[n-2]<<16,this.words[s]|=o<<a&67108863,this.words[s+1]=o>>>26-a&67108863,(a+=24)>=26&&(a-=26,s++);else if("le"===r)for(n=0,s=0;n<t.length;n+=3)o=t[n]|t[n+1]<<8|t[n+2]<<16,this.words[s]|=o<<a&67108863,this.words[s+1]=o>>>26-a&67108863,(a+=24)>=26&&(a-=26,s++);return this.strip()},s.prototype._parseHex=function(t,e){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var r=0;r<this.length;r++)this.words[r]=0;var i,n,s=0;for(r=t.length-6,i=0;r>=e;r-=6)n=a(t,r,r+6),this.words[i]|=n<<s&67108863,this.words[i+1]|=n>>>26-s&4194303,(s+=24)>=26&&(s-=26,i++);r+6!==e&&(n=a(t,e,r+6),this.words[i]|=n<<s&67108863,this.words[i+1]|=n>>>26-s&4194303),this.strip()},s.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var i=0,n=1;n<=67108863;n*=e)i++;i--,n=n/e|0;for(var s=t.length-r,o=s%i,a=Math.min(s,s-o)+r,f=0,h=r;h<a;h+=i)f=u(t,h,h+i,e),this.imuln(n),this.words[0]+f<67108864?this.words[0]+=f:this._iaddn(f);if(0!==o){var c=1;for(f=u(t,h,t.length,e),h=0;h<o;h++)c*=e;this.imuln(c),this.words[0]+f<67108864?this.words[0]+=f:this._iaddn(f)}},s.prototype.copy=function(t){t.words=new Array(this.length);for(var e=0;e<this.length;e++)t.words[e]=this.words[e];t.length=this.length,t.negative=this.negative,t.red=this.red},s.prototype.clone=function(){var t=new s(null);return this.copy(t),t},s.prototype._expand=function(t){for(;this.length<t;)this.words[this.length++]=0;return this},s.prototype.strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},s.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},s.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var f=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],h=[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],c=[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 d(t,e,r){r.negative=e.negative^t.negative;var i=t.length+e.length|0;r.length=i,i=i-1|0;var n=0|t.words[0],s=0|e.words[0],o=n*s,a=67108863&o,u=o/67108864|0;r.words[0]=a;for(var f=1;f<i;f++){for(var h=u>>>26,c=67108863&u,d=Math.min(f,e.length-1),p=Math.max(0,f-t.length+1);p<=d;p++){var l=f-p|0;h+=(o=(n=0|t.words[l])*(s=0|e.words[p])+c)/67108864|0,c=67108863&o}r.words[f]=0|c,u=0|h}return 0!==u?r.words[f]=0|u:r.length--,r.strip()}s.prototype.toString=function(t,e){var r;if(e=0|e||1,16===(t=t||10)||"hex"===t){r="";for(var n=0,s=0,o=0;o<this.length;o++){var a=this.words[o],u=(16777215&(a<<n|s)).toString(16);s=a>>>24-n&16777215,(n+=2)>=26&&(n-=26,o--),r=0!==s||o!==this.length-1?f[6-u.length]+u+r:u+r}for(0!==s&&(r=s.toString(16)+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(t===(0|t)&&t>=2&&t<=36){var d=h[t],p=c[t];r="";var l=this.clone();for(l.negative=0;!l.isZero();){var m=l.modn(p).toString(t);r=(l=l.idivn(p)).isZero()?m+r:f[d-m.length]+m+r}for(this.isZero()&&(r="0"+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}i(!1,"Base should be between 2 and 36")},s.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&i(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},s.prototype.toJSON=function(){return this.toString(16)},s.prototype.toBuffer=function(t,e){return i(void 0!==o),this.toArrayLike(o,t,e)},s.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},s.prototype.toArrayLike=function(t,e,r){var n=this.byteLength(),s=r||Math.max(1,n);i(n<=s,"byte array longer than desired length"),i(s>0,"Requested array length <= 0"),this.strip();var o,a,u="le"===e,f=new t(s),h=this.clone();if(u){for(a=0;!h.isZero();a++)o=h.andln(255),h.iushrn(8),f[a]=o;for(;a<s;a++)f[a]=0}else{for(a=0;a<s-n;a++)f[a]=0;for(a=0;!h.isZero();a++)o=h.andln(255),h.iushrn(8),f[s-a-1]=o}return f},Math.clz32?s.prototype._countBits=function(t){return 32-Math.clz32(t)}:s.prototype._countBits=function(t){var e=t,r=0;return e>=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},s.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 0==(8191&e)&&(r+=13,e>>>=13),0==(127&e)&&(r+=7,e>>>=7),0==(15&e)&&(r+=4,e>>>=4),0==(3&e)&&(r+=2,e>>>=2),0==(1&e)&&r++,r},s.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},s.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;e<this.length;e++){var r=this._zeroBits(this.words[e]);if(t+=r,26!==r)break}return t},s.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},s.prototype.toTwos=function(t){return 0!==this.negative?this.abs().inotn(t).iaddn(1):this.clone()},s.prototype.fromTwos=function(t){return this.testn(t-1)?this.notn(t).iaddn(1).ineg():this.clone()},s.prototype.isNeg=function(){return 0!==this.negative},s.prototype.neg=function(){return this.clone().ineg()},s.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},s.prototype.iuor=function(t){for(;this.length<t.length;)this.words[this.length++]=0;for(var e=0;e<t.length;e++)this.words[e]=this.words[e]|t.words[e];return this.strip()},s.prototype.ior=function(t){return i(0==(this.negative|t.negative)),this.iuor(t)},s.prototype.or=function(t){return this.length>t.length?this.clone().ior(t):t.clone().ior(this)},s.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},s.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;r<e.length;r++)this.words[r]=this.words[r]&t.words[r];return this.length=e.length,this.strip()},s.prototype.iand=function(t){return i(0==(this.negative|t.negative)),this.iuand(t)},s.prototype.and=function(t){return this.length>t.length?this.clone().iand(t):t.clone().iand(this)},s.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},s.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var i=0;i<r.length;i++)this.words[i]=e.words[i]^r.words[i];if(this!==e)for(;i<e.length;i++)this.words[i]=e.words[i];return this.length=e.length,this.strip()},s.prototype.ixor=function(t){return i(0==(this.negative|t.negative)),this.iuxor(t)},s.prototype.xor=function(t){return this.length>t.length?this.clone().ixor(t):t.clone().ixor(this)},s.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},s.prototype.inotn=function(t){i("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),r=t%26;this._expand(e),r>0&&e--;for(var n=0;n<e;n++)this.words[n]=67108863&~this.words[n];return r>0&&(this.words[n]=~this.words[n]&67108863>>26-r),this.strip()},s.prototype.notn=function(t){return this.clone().inotn(t)},s.prototype.setn=function(t,e){i("number"==typeof t&&t>=0);var r=t/26|0,n=t%26;return this._expand(r+1),this.words[r]=e?this.words[r]|1<<n:this.words[r]&~(1<<n),this.strip()},s.prototype.iadd=function(t){var e,r,i;if(0!==this.negative&&0===t.negative)return this.negative=0,e=this.isub(t),this.negative^=1,this._normSign();if(0===this.negative&&0!==t.negative)return t.negative=0,e=this.isub(t),t.negative=1,e._normSign();this.length>t.length?(r=this,i=t):(r=t,i=this);for(var n=0,s=0;s<i.length;s++)e=(0|r.words[s])+(0|i.words[s])+n,this.words[s]=67108863&e,n=e>>>26;for(;0!==n&&s<r.length;s++)e=(0|r.words[s])+n,this.words[s]=67108863&e,n=e>>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;s<r.length;s++)this.words[s]=r.words[s];return this},s.prototype.add=function(t){var e;return 0!==t.negative&&0===this.negative?(t.negative=0,e=this.sub(t),t.negative^=1,e):0===t.negative&&0!==this.negative?(this.negative=0,e=t.sub(this),this.negative=1,e):this.length>t.length?this.clone().iadd(t):t.clone().iadd(this)},s.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,i,n=this.cmp(t);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,i=t):(r=t,i=this);for(var s=0,o=0;o<i.length;o++)s=(e=(0|r.words[o])-(0|i.words[o])+s)>>26,this.words[o]=67108863&e;for(;0!==s&&o<r.length;o++)s=(e=(0|r.words[o])+s)>>26,this.words[o]=67108863&e;if(0===s&&o<r.length&&r!==this)for(;o<r.length;o++)this.words[o]=r.words[o];return this.length=Math.max(this.length,o),r!==this&&(this.negative=1),this.strip()},s.prototype.sub=function(t){return this.clone().isub(t)};var p=function(t,e,r){var i,n,s,o=t.words,a=e.words,u=r.words,f=0,h=0|o[0],c=8191&h,d=h>>>13,p=0|o[1],l=8191&p,m=p>>>13,b=0|o[2],g=8191&b,y=b>>>13,v=0|o[3],_=8191&v,S=v>>>13,w=0|o[4],I=8191&w,E=w>>>13,A=0|o[5],P=8191&A,O=A>>>13,M=0|o[6],k=8191&M,T=M>>>13,R=0|o[7],x=8191&R,N=R>>>13,B=0|o[8],U=8191&B,C=B>>>13,L=0|o[9],H=8191&L,D=L>>>13,F=0|a[0],K=8191&F,z=F>>>13,j=0|a[1],V=8191&j,q=j>>>13,Y=0|a[2],G=8191&Y,X=Y>>>13,Z=0|a[3],W=8191&Z,J=Z>>>13,Q=0|a[4],$=8191&Q,tt=Q>>>13,et=0|a[5],rt=8191&et,it=et>>>13,nt=0|a[6],st=8191&nt,ot=nt>>>13,at=0|a[7],ut=8191&at,ft=at>>>13,ht=0|a[8],ct=8191&ht,dt=ht>>>13,pt=0|a[9],lt=8191&pt,mt=pt>>>13;r.negative=t.negative^e.negative,r.length=19;var bt=(f+(i=Math.imul(c,K))|0)+((8191&(n=(n=Math.imul(c,z))+Math.imul(d,K)|0))<<13)|0;f=((s=Math.imul(d,z))+(n>>>13)|0)+(bt>>>26)|0,bt&=67108863,i=Math.imul(l,K),n=(n=Math.imul(l,z))+Math.imul(m,K)|0,s=Math.imul(m,z);var gt=(f+(i=i+Math.imul(c,V)|0)|0)+((8191&(n=(n=n+Math.imul(c,q)|0)+Math.imul(d,V)|0))<<13)|0;f=((s=s+Math.imul(d,q)|0)+(n>>>13)|0)+(gt>>>26)|0,gt&=67108863,i=Math.imul(g,K),n=(n=Math.imul(g,z))+Math.imul(y,K)|0,s=Math.imul(y,z),i=i+Math.imul(l,V)|0,n=(n=n+Math.imul(l,q)|0)+Math.imul(m,V)|0,s=s+Math.imul(m,q)|0;var yt=(f+(i=i+Math.imul(c,G)|0)|0)+((8191&(n=(n=n+Math.imul(c,X)|0)+Math.imul(d,G)|0))<<13)|0;f=((s=s+Math.imul(d,X)|0)+(n>>>13)|0)+(yt>>>26)|0,yt&=67108863,i=Math.imul(_,K),n=(n=Math.imul(_,z))+Math.imul(S,K)|0,s=Math.imul(S,z),i=i+Math.imul(g,V)|0,n=(n=n+Math.imul(g,q)|0)+Math.imul(y,V)|0,s=s+Math.imul(y,q)|0,i=i+Math.imul(l,G)|0,n=(n=n+Math.imul(l,X)|0)+Math.imul(m,G)|0,s=s+Math.imul(m,X)|0;var vt=(f+(i=i+Math.imul(c,W)|0)|0)+((8191&(n=(n=n+Math.imul(c,J)|0)+Math.imul(d,W)|0))<<13)|0;f=((s=s+Math.imul(d,J)|0)+(n>>>13)|0)+(vt>>>26)|0,vt&=67108863,i=Math.imul(I,K),n=(n=Math.imul(I,z))+Math.imul(E,K)|0,s=Math.imul(E,z),i=i+Math.imul(_,V)|0,n=(n=n+Math.imul(_,q)|0)+Math.imul(S,V)|0,s=s+Math.imul(S,q)|0,i=i+Math.imul(g,G)|0,n=(n=n+Math.imul(g,X)|0)+Math.imul(y,G)|0,s=s+Math.imul(y,X)|0,i=i+Math.imul(l,W)|0,n=(n=n+Math.imul(l,J)|0)+Math.imul(m,W)|0,s=s+Math.imul(m,J)|0;var _t=(f+(i=i+Math.imul(c,$)|0)|0)+((8191&(n=(n=n+Math.imul(c,tt)|0)+Math.imul(d,$)|0))<<13)|0;f=((s=s+Math.imul(d,tt)|0)+(n>>>13)|0)+(_t>>>26)|0,_t&=67108863,i=Math.imul(P,K),n=(n=Math.imul(P,z))+Math.imul(O,K)|0,s=Math.imul(O,z),i=i+Math.imul(I,V)|0,n=(n=n+Math.imul(I,q)|0)+Math.imul(E,V)|0,s=s+Math.imul(E,q)|0,i=i+Math.imul(_,G)|0,n=(n=n+Math.imul(_,X)|0)+Math.imul(S,G)|0,s=s+Math.imul(S,X)|0,i=i+Math.imul(g,W)|0,n=(n=n+Math.imul(g,J)|0)+Math.imul(y,W)|0,s=s+Math.imul(y,J)|0,i=i+Math.imul(l,$)|0,n=(n=n+Math.imul(l,tt)|0)+Math.imul(m,$)|0,s=s+Math.imul(m,tt)|0;var St=(f+(i=i+Math.imul(c,rt)|0)|0)+((8191&(n=(n=n+Math.imul(c,it)|0)+Math.imul(d,rt)|0))<<13)|0;f=((s=s+Math.imul(d,it)|0)+(n>>>13)|0)+(St>>>26)|0,St&=67108863,i=Math.imul(k,K),n=(n=Math.imul(k,z))+Math.imul(T,K)|0,s=Math.imul(T,z),i=i+Math.imul(P,V)|0,n=(n=n+Math.imul(P,q)|0)+Math.imul(O,V)|0,s=s+Math.imul(O,q)|0,i=i+Math.imul(I,G)|0,n=(n=n+Math.imul(I,X)|0)+Math.imul(E,G)|0,s=s+Math.imul(E,X)|0,i=i+Math.imul(_,W)|0,n=(n=n+Math.imul(_,J)|0)+Math.imul(S,W)|0,s=s+Math.imul(S,J)|0,i=i+Math.imul(g,$)|0,n=(n=n+Math.imul(g,tt)|0)+Math.imul(y,$)|0,s=s+Math.imul(y,tt)|0,i=i+Math.imul(l,rt)|0,n=(n=n+Math.imul(l,it)|0)+Math.imul(m,rt)|0,s=s+Math.imul(m,it)|0;var wt=(f+(i=i+Math.imul(c,st)|0)|0)+((8191&(n=(n=n+Math.imul(c,ot)|0)+Math.imul(d,st)|0))<<13)|0;f=((s=s+Math.imul(d,ot)|0)+(n>>>13)|0)+(wt>>>26)|0,wt&=67108863,i=Math.imul(x,K),n=(n=Math.imul(x,z))+Math.imul(N,K)|0,s=Math.imul(N,z),i=i+Math.imul(k,V)|0,n=(n=n+Math.imul(k,q)|0)+Math.imul(T,V)|0,s=s+Math.imul(T,q)|0,i=i+Math.imul(P,G)|0,n=(n=n+Math.imul(P,X)|0)+Math.imul(O,G)|0,s=s+Math.imul(O,X)|0,i=i+Math.imul(I,W)|0,n=(n=n+Math.imul(I,J)|0)+Math.imul(E,W)|0,s=s+Math.imul(E,J)|0,i=i+Math.imul(_,$)|0,n=(n=n+Math.imul(_,tt)|0)+Math.imul(S,$)|0,s=s+Math.imul(S,tt)|0,i=i+Math.imul(g,rt)|0,n=(n=n+Math.imul(g,it)|0)+Math.imul(y,rt)|0,s=s+Math.imul(y,it)|0,i=i+Math.imul(l,st)|0,n=(n=n+Math.imul(l,ot)|0)+Math.imul(m,st)|0,s=s+Math.imul(m,ot)|0;var It=(f+(i=i+Math.imul(c,ut)|0)|0)+((8191&(n=(n=n+Math.imul(c,ft)|0)+Math.imul(d,ut)|0))<<13)|0;f=((s=s+Math.imul(d,ft)|0)+(n>>>13)|0)+(It>>>26)|0,It&=67108863,i=Math.imul(U,K),n=(n=Math.imul(U,z))+Math.imul(C,K)|0,s=Math.imul(C,z),i=i+Math.imul(x,V)|0,n=(n=n+Math.imul(x,q)|0)+Math.imul(N,V)|0,s=s+Math.imul(N,q)|0,i=i+Math.imul(k,G)|0,n=(n=n+Math.imul(k,X)|0)+Math.imul(T,G)|0,s=s+Math.imul(T,X)|0,i=i+Math.imul(P,W)|0,n=(n=n+Math.imul(P,J)|0)+Math.imul(O,W)|0,s=s+Math.imul(O,J)|0,i=i+Math.imul(I,$)|0,n=(n=n+Math.imul(I,tt)|0)+Math.imul(E,$)|0,s=s+Math.imul(E,tt)|0,i=i+Math.imul(_,rt)|0,n=(n=n+Math.imul(_,it)|0)+Math.imul(S,rt)|0,s=s+Math.imul(S,it)|0,i=i+Math.imul(g,st)|0,n=(n=n+Math.imul(g,ot)|0)+Math.imul(y,st)|0,s=s+Math.imul(y,ot)|0,i=i+Math.imul(l,ut)|0,n=(n=n+Math.imul(l,ft)|0)+Math.imul(m,ut)|0,s=s+Math.imul(m,ft)|0;var Et=(f+(i=i+Math.imul(c,ct)|0)|0)+((8191&(n=(n=n+Math.imul(c,dt)|0)+Math.imul(d,ct)|0))<<13)|0;f=((s=s+Math.imul(d,dt)|0)+(n>>>13)|0)+(Et>>>26)|0,Et&=67108863,i=Math.imul(H,K),n=(n=Math.imul(H,z))+Math.imul(D,K)|0,s=Math.imul(D,z),i=i+Math.imul(U,V)|0,n=(n=n+Math.imul(U,q)|0)+Math.imul(C,V)|0,s=s+Math.imul(C,q)|0,i=i+Math.imul(x,G)|0,n=(n=n+Math.imul(x,X)|0)+Math.imul(N,G)|0,s=s+Math.imul(N,X)|0,i=i+Math.imul(k,W)|0,n=(n=n+Math.imul(k,J)|0)+Math.imul(T,W)|0,s=s+Math.imul(T,J)|0,i=i+Math.imul(P,$)|0,n=(n=n+Math.imul(P,tt)|0)+Math.imul(O,$)|0,s=s+Math.imul(O,tt)|0,i=i+Math.imul(I,rt)|0,n=(n=n+Math.imul(I,it)|0)+Math.imul(E,rt)|0,s=s+Math.imul(E,it)|0,i=i+Math.imul(_,st)|0,n=(n=n+Math.imul(_,ot)|0)+Math.imul(S,st)|0,s=s+Math.imul(S,ot)|0,i=i+Math.imul(g,ut)|0,n=(n=n+Math.imul(g,ft)|0)+Math.imul(y,ut)|0,s=s+Math.imul(y,ft)|0,i=i+Math.imul(l,ct)|0,n=(n=n+Math.imul(l,dt)|0)+Math.imul(m,ct)|0,s=s+Math.imul(m,dt)|0;var At=(f+(i=i+Math.imul(c,lt)|0)|0)+((8191&(n=(n=n+Math.imul(c,mt)|0)+Math.imul(d,lt)|0))<<13)|0;f=((s=s+Math.imul(d,mt)|0)+(n>>>13)|0)+(At>>>26)|0,At&=67108863,i=Math.imul(H,V),n=(n=Math.imul(H,q))+Math.imul(D,V)|0,s=Math.imul(D,q),i=i+Math.imul(U,G)|0,n=(n=n+Math.imul(U,X)|0)+Math.imul(C,G)|0,s=s+Math.imul(C,X)|0,i=i+Math.imul(x,W)|0,n=(n=n+Math.imul(x,J)|0)+Math.imul(N,W)|0,s=s+Math.imul(N,J)|0,i=i+Math.imul(k,$)|0,n=(n=n+Math.imul(k,tt)|0)+Math.imul(T,$)|0,s=s+Math.imul(T,tt)|0,i=i+Math.imul(P,rt)|0,n=(n=n+Math.imul(P,it)|0)+Math.imul(O,rt)|0,s=s+Math.imul(O,it)|0,i=i+Math.imul(I,st)|0,n=(n=n+Math.imul(I,ot)|0)+Math.imul(E,st)|0,s=s+Math.imul(E,ot)|0,i=i+Math.imul(_,ut)|0,n=(n=n+Math.imul(_,ft)|0)+Math.imul(S,ut)|0,s=s+Math.imul(S,ft)|0,i=i+Math.imul(g,ct)|0,n=(n=n+Math.imul(g,dt)|0)+Math.imul(y,ct)|0,s=s+Math.imul(y,dt)|0;var Pt=(f+(i=i+Math.imul(l,lt)|0)|0)+((8191&(n=(n=n+Math.imul(l,mt)|0)+Math.imul(m,lt)|0))<<13)|0;f=((s=s+Math.imul(m,mt)|0)+(n>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,i=Math.imul(H,G),n=(n=Math.imul(H,X))+Math.imul(D,G)|0,s=Math.imul(D,X),i=i+Math.imul(U,W)|0,n=(n=n+Math.imul(U,J)|0)+Math.imul(C,W)|0,s=s+Math.imul(C,J)|0,i=i+Math.imul(x,$)|0,n=(n=n+Math.imul(x,tt)|0)+Math.imul(N,$)|0,s=s+Math.imul(N,tt)|0,i=i+Math.imul(k,rt)|0,n=(n=n+Math.imul(k,it)|0)+Math.imul(T,rt)|0,s=s+Math.imul(T,it)|0,i=i+Math.imul(P,st)|0,n=(n=n+Math.imul(P,ot)|0)+Math.imul(O,st)|0,s=s+Math.imul(O,ot)|0,i=i+Math.imul(I,ut)|0,n=(n=n+Math.imul(I,ft)|0)+Math.imul(E,ut)|0,s=s+Math.imul(E,ft)|0,i=i+Math.imul(_,ct)|0,n=(n=n+Math.imul(_,dt)|0)+Math.imul(S,ct)|0,s=s+Math.imul(S,dt)|0;var Ot=(f+(i=i+Math.imul(g,lt)|0)|0)+((8191&(n=(n=n+Math.imul(g,mt)|0)+Math.imul(y,lt)|0))<<13)|0;f=((s=s+Math.imul(y,mt)|0)+(n>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,i=Math.imul(H,W),n=(n=Math.imul(H,J))+Math.imul(D,W)|0,s=Math.imul(D,J),i=i+Math.imul(U,$)|0,n=(n=n+Math.imul(U,tt)|0)+Math.imul(C,$)|0,s=s+Math.imul(C,tt)|0,i=i+Math.imul(x,rt)|0,n=(n=n+Math.imul(x,it)|0)+Math.imul(N,rt)|0,s=s+Math.imul(N,it)|0,i=i+Math.imul(k,st)|0,n=(n=n+Math.imul(k,ot)|0)+Math.imul(T,st)|0,s=s+Math.imul(T,ot)|0,i=i+Math.imul(P,ut)|0,n=(n=n+Math.imul(P,ft)|0)+Math.imul(O,ut)|0,s=s+Math.imul(O,ft)|0,i=i+Math.imul(I,ct)|0,n=(n=n+Math.imul(I,dt)|0)+Math.imul(E,ct)|0,s=s+Math.imul(E,dt)|0;var Mt=(f+(i=i+Math.imul(_,lt)|0)|0)+((8191&(n=(n=n+Math.imul(_,mt)|0)+Math.imul(S,lt)|0))<<13)|0;f=((s=s+Math.imul(S,mt)|0)+(n>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,i=Math.imul(H,$),n=(n=Math.imul(H,tt))+Math.imul(D,$)|0,s=Math.imul(D,tt),i=i+Math.imul(U,rt)|0,n=(n=n+Math.imul(U,it)|0)+Math.imul(C,rt)|0,s=s+Math.imul(C,it)|0,i=i+Math.imul(x,st)|0,n=(n=n+Math.imul(x,ot)|0)+Math.imul(N,st)|0,s=s+Math.imul(N,ot)|0,i=i+Math.imul(k,ut)|0,n=(n=n+Math.imul(k,ft)|0)+Math.imul(T,ut)|0,s=s+Math.imul(T,ft)|0,i=i+Math.imul(P,ct)|0,n=(n=n+Math.imul(P,dt)|0)+Math.imul(O,ct)|0,s=s+Math.imul(O,dt)|0;var kt=(f+(i=i+Math.imul(I,lt)|0)|0)+((8191&(n=(n=n+Math.imul(I,mt)|0)+Math.imul(E,lt)|0))<<13)|0;f=((s=s+Math.imul(E,mt)|0)+(n>>>13)|0)+(kt>>>26)|0,kt&=67108863,i=Math.imul(H,rt),n=(n=Math.imul(H,it))+Math.imul(D,rt)|0,s=Math.imul(D,it),i=i+Math.imul(U,st)|0,n=(n=n+Math.imul(U,ot)|0)+Math.imul(C,st)|0,s=s+Math.imul(C,ot)|0,i=i+Math.imul(x,ut)|0,n=(n=n+Math.imul(x,ft)|0)+Math.imul(N,ut)|0,s=s+Math.imul(N,ft)|0,i=i+Math.imul(k,ct)|0,n=(n=n+Math.imul(k,dt)|0)+Math.imul(T,ct)|0,s=s+Math.imul(T,dt)|0;var Tt=(f+(i=i+Math.imul(P,lt)|0)|0)+((8191&(n=(n=n+Math.imul(P,mt)|0)+Math.imul(O,lt)|0))<<13)|0;f=((s=s+Math.imul(O,mt)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,i=Math.imul(H,st),n=(n=Math.imul(H,ot))+Math.imul(D,st)|0,s=Math.imul(D,ot),i=i+Math.imul(U,ut)|0,n=(n=n+Math.imul(U,ft)|0)+Math.imul(C,ut)|0,s=s+Math.imul(C,ft)|0,i=i+Math.imul(x,ct)|0,n=(n=n+Math.imul(x,dt)|0)+Math.imul(N,ct)|0,s=s+Math.imul(N,dt)|0;var Rt=(f+(i=i+Math.imul(k,lt)|0)|0)+((8191&(n=(n=n+Math.imul(k,mt)|0)+Math.imul(T,lt)|0))<<13)|0;f=((s=s+Math.imul(T,mt)|0)+(n>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,i=Math.imul(H,ut),n=(n=Math.imul(H,ft))+Math.imul(D,ut)|0,s=Math.imul(D,ft),i=i+Math.imul(U,ct)|0,n=(n=n+Math.imul(U,dt)|0)+Math.imul(C,ct)|0,s=s+Math.imul(C,dt)|0;var xt=(f+(i=i+Math.imul(x,lt)|0)|0)+((8191&(n=(n=n+Math.imul(x,mt)|0)+Math.imul(N,lt)|0))<<13)|0;f=((s=s+Math.imul(N,mt)|0)+(n>>>13)|0)+(xt>>>26)|0,xt&=67108863,i=Math.imul(H,ct),n=(n=Math.imul(H,dt))+Math.imul(D,ct)|0,s=Math.imul(D,dt);var Nt=(f+(i=i+Math.imul(U,lt)|0)|0)+((8191&(n=(n=n+Math.imul(U,mt)|0)+Math.imul(C,lt)|0))<<13)|0;f=((s=s+Math.imul(C,mt)|0)+(n>>>13)|0)+(Nt>>>26)|0,Nt&=67108863;var Bt=(f+(i=Math.imul(H,lt))|0)+((8191&(n=(n=Math.imul(H,mt))+Math.imul(D,lt)|0))<<13)|0;return f=((s=Math.imul(D,mt))+(n>>>13)|0)+(Bt>>>26)|0,Bt&=67108863,u[0]=bt,u[1]=gt,u[2]=yt,u[3]=vt,u[4]=_t,u[5]=St,u[6]=wt,u[7]=It,u[8]=Et,u[9]=At,u[10]=Pt,u[11]=Ot,u[12]=Mt,u[13]=kt,u[14]=Tt,u[15]=Rt,u[16]=xt,u[17]=Nt,u[18]=Bt,0!==f&&(u[19]=f,r.length++),r};function l(t,e,r){return(new m).mulp(t,e,r)}function m(t,e){this.x=t,this.y=e}Math.imul||(p=d),s.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?p(this,t,e):r<63?d(this,t,e):r<1024?function(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var i=0,n=0,s=0;s<r.length-1;s++){var o=n;n=0;for(var a=67108863&i,u=Math.min(s,e.length-1),f=Math.max(0,s-t.length+1);f<=u;f++){var h=s-f,c=(0|t.words[h])*(0|e.words[f]),d=67108863&c;a=67108863&(d=d+a|0),n+=(o=(o=o+(c/67108864|0)|0)+(d>>>26)|0)>>>26,o&=67108863}r.words[s]=a,i=o,o=n}return 0!==i?r.words[s]=i:r.length--,r.strip()}(this,t,e):l(this,t,e)},m.prototype.makeRBT=function(t){for(var e=new Array(t),r=s.prototype._countBits(t)-1,i=0;i<t;i++)e[i]=this.revBin(i,r,t);return e},m.prototype.revBin=function(t,e,r){if(0===t||t===r-1)return t;for(var i=0,n=0;n<e;n++)i|=(1&t)<<e-n-1,t>>=1;return i},m.prototype.permute=function(t,e,r,i,n,s){for(var o=0;o<s;o++)i[o]=e[t[o]],n[o]=r[t[o]]},m.prototype.transform=function(t,e,r,i,n,s){this.permute(s,t,e,r,i,n);for(var o=1;o<n;o<<=1)for(var a=o<<1,u=Math.cos(2*Math.PI/a),f=Math.sin(2*Math.PI/a),h=0;h<n;h+=a)for(var c=u,d=f,p=0;p<o;p++){var l=r[h+p],m=i[h+p],b=r[h+p+o],g=i[h+p+o],y=c*b-d*g;g=c*g+d*b,b=y,r[h+p]=l+b,i[h+p]=m+g,r[h+p+o]=l-b,i[h+p+o]=m-g,p!==a&&(y=u*c-f*d,d=u*d+f*c,c=y)}},m.prototype.guessLen13b=function(t,e){var r=1|Math.max(e,t),i=1&r,n=0;for(r=r/2|0;r;r>>>=1)n++;return 1<<n+1+i},m.prototype.conjugate=function(t,e,r){if(!(r<=1))for(var i=0;i<r/2;i++){var n=t[i];t[i]=t[r-i-1],t[r-i-1]=n,n=e[i],e[i]=-e[r-i-1],e[r-i-1]=-n}},m.prototype.normalize13b=function(t,e){for(var r=0,i=0;i<e/2;i++){var n=8192*Math.round(t[2*i+1]/e)+Math.round(t[2*i]/e)+r;t[i]=67108863&n,r=n<67108864?0:n/67108864|0}return t},m.prototype.convert13b=function(t,e,r,n){for(var s=0,o=0;o<e;o++)s+=0|t[o],r[2*o]=8191&s,s>>>=13,r[2*o+1]=8191&s,s>>>=13;for(o=2*e;o<n;++o)r[o]=0;i(0===s),i(0==(-8192&s))},m.prototype.stub=function(t){for(var e=new Array(t),r=0;r<t;r++)e[r]=0;return e},m.prototype.mulp=function(t,e,r){var i=2*this.guessLen13b(t.length,e.length),n=this.makeRBT(i),s=this.stub(i),o=new Array(i),a=new Array(i),u=new Array(i),f=new Array(i),h=new Array(i),c=new Array(i),d=r.words;d.length=i,this.convert13b(t.words,t.length,o,i),this.convert13b(e.words,e.length,f,i),this.transform(o,s,a,u,i,n),this.transform(f,s,h,c,i,n);for(var p=0;p<i;p++){var l=a[p]*h[p]-u[p]*c[p];u[p]=a[p]*c[p]+u[p]*h[p],a[p]=l}return this.conjugate(a,u,i),this.transform(a,u,d,s,i,n),this.conjugate(d,s,i),this.normalize13b(d,i),r.negative=t.negative^e.negative,r.length=t.length+e.length,r.strip()},s.prototype.mul=function(t){var e=new s(null);return e.words=new Array(this.length+t.length),this.mulTo(t,e)},s.prototype.mulf=function(t){var e=new s(null);return e.words=new Array(this.length+t.length),l(this,t,e)},s.prototype.imul=function(t){return this.clone().mulTo(t,this)},s.prototype.imuln=function(t){i("number"==typeof t),i(t<67108864);for(var e=0,r=0;r<this.length;r++){var n=(0|this.words[r])*t,s=(67108863&n)+(67108863&e);e>>=26,e+=n/67108864|0,e+=s>>>26,this.words[r]=67108863&s}return 0!==e&&(this.words[r]=e,this.length++),this},s.prototype.muln=function(t){return this.clone().imuln(t)},s.prototype.sqr=function(){return this.mul(this)},s.prototype.isqr=function(){return this.imul(this.clone())},s.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r<e.length;r++){var i=r/26|0,n=r%26;e[r]=(t.words[i]&1<<n)>>>n}return e}(t);if(0===e.length)return new s(1);for(var r=this,i=0;i<e.length&&0===e[i];i++,r=r.sqr());if(++i<e.length)for(var n=r.sqr();i<e.length;i++,n=n.sqr())0!==e[i]&&(r=r.mul(n));return r},s.prototype.iushln=function(t){i("number"==typeof t&&t>=0);var e,r=t%26,n=(t-r)/26,s=67108863>>>26-r<<26-r;if(0!==r){var o=0;for(e=0;e<this.length;e++){var a=this.words[e]&s,u=(0|this.words[e])-a<<r;this.words[e]=u|o,o=a>>>26-r}o&&(this.words[e]=o,this.length++)}if(0!==n){for(e=this.length-1;e>=0;e--)this.words[e+n]=this.words[e];for(e=0;e<n;e++)this.words[e]=0;this.length+=n}return this.strip()},s.prototype.ishln=function(t){return i(0===this.negative),this.iushln(t)},s.prototype.iushrn=function(t,e,r){var n;i("number"==typeof t&&t>=0),n=e?(e-e%26)/26:0;var s=t%26,o=Math.min((t-s)/26,this.length),a=67108863^67108863>>>s<<s,u=r;if(n-=o,n=Math.max(0,n),u){for(var f=0;f<o;f++)u.words[f]=this.words[f];u.length=o}if(0===o);else if(this.length>o)for(this.length-=o,f=0;f<this.length;f++)this.words[f]=this.words[f+o];else this.words[0]=0,this.length=1;var h=0;for(f=this.length-1;f>=0&&(0!==h||f>=n);f--){var c=0|this.words[f];this.words[f]=h<<26-s|c>>>s,h=c&a}return u&&0!==h&&(u.words[u.length++]=h),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},s.prototype.ishrn=function(t,e,r){return i(0===this.negative),this.iushrn(t,e,r)},s.prototype.shln=function(t){return this.clone().ishln(t)},s.prototype.ushln=function(t){return this.clone().iushln(t)},s.prototype.shrn=function(t){return this.clone().ishrn(t)},s.prototype.ushrn=function(t){return this.clone().iushrn(t)},s.prototype.testn=function(t){i("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26,n=1<<e;return!(this.length<=r)&&!!(this.words[r]&n)},s.prototype.imaskn=function(t){i("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26;if(i(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==e&&r++,this.length=Math.min(r,this.length),0!==e){var n=67108863^67108863>>>e<<e;this.words[this.length-1]&=n}return this.strip()},s.prototype.maskn=function(t){return this.clone().imaskn(t)},s.prototype.iaddn=function(t){return i("number"==typeof t),i(t<67108864),t<0?this.isubn(-t):0!==this.negative?1===this.length&&(0|this.words[0])<t?(this.words[0]=t-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(t),this.negative=1,this):this._iaddn(t)},s.prototype._iaddn=function(t){this.words[0]+=t;for(var e=0;e<this.length&&this.words[e]>=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},s.prototype.isubn=function(t){if(i("number"==typeof t),i(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e<this.length&&this.words[e]<0;e++)this.words[e]+=67108864,this.words[e+1]-=1;return this.strip()},s.prototype.addn=function(t){return this.clone().iaddn(t)},s.prototype.subn=function(t){return this.clone().isubn(t)},s.prototype.iabs=function(){return this.negative=0,this},s.prototype.abs=function(){return this.clone().iabs()},s.prototype._ishlnsubmul=function(t,e,r){var n,s,o=t.length+r;this._expand(o);var a=0;for(n=0;n<t.length;n++){s=(0|this.words[n+r])+a;var u=(0|t.words[n])*e;a=((s-=67108863&u)>>26)-(u/67108864|0),this.words[n+r]=67108863&s}for(;n<this.length-r;n++)a=(s=(0|this.words[n+r])+a)>>26,this.words[n+r]=67108863&s;if(0===a)return this.strip();for(i(-1===a),a=0,n=0;n<this.length;n++)a=(s=-(0|this.words[n])+a)>>26,this.words[n]=67108863&s;return this.negative=1,this.strip()},s.prototype._wordDiv=function(t,e){var r=(this.length,t.length),i=this.clone(),n=t,o=0|n.words[n.length-1];0!==(r=26-this._countBits(o))&&(n=n.ushln(r),i.iushln(r),o=0|n.words[n.length-1]);var a,u=i.length-n.length;if("mod"!==e){(a=new s(null)).length=u+1,a.words=new Array(a.length);for(var f=0;f<a.length;f++)a.words[f]=0}var h=i.clone()._ishlnsubmul(n,1,u);0===h.negative&&(i=h,a&&(a.words[u]=1));for(var c=u-1;c>=0;c--){var d=67108864*(0|i.words[n.length+c])+(0|i.words[n.length+c-1]);for(d=Math.min(d/o|0,67108863),i._ishlnsubmul(n,d,c);0!==i.negative;)d--,i.negative=0,i._ishlnsubmul(n,1,c),i.isZero()||(i.negative^=1);a&&(a.words[c]=d)}return a&&a.strip(),i.strip(),"div"!==e&&0!==r&&i.iushrn(r),{div:a||null,mod:i}},s.prototype.divmod=function(t,e,r){return i(!t.isZero()),this.isZero()?{div:new s(0),mod:new s(0)}:0!==this.negative&&0===t.negative?(a=this.neg().divmod(t,e),"mod"!==e&&(n=a.div.neg()),"div"!==e&&(o=a.mod.neg(),r&&0!==o.negative&&o.iadd(t)),{div:n,mod:o}):0===this.negative&&0!==t.negative?(a=this.divmod(t.neg(),e),"mod"!==e&&(n=a.div.neg()),{div:n,mod:a.mod}):0!=(this.negative&t.negative)?(a=this.neg().divmod(t.neg(),e),"div"!==e&&(o=a.mod.neg(),r&&0!==o.negative&&o.isub(t)),{div:a.div,mod:o}):t.length>this.length||this.cmp(t)<0?{div:new s(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new s(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new s(this.modn(t.words[0]))}:this._wordDiv(t,e);var n,o,a},s.prototype.div=function(t){return this.divmod(t,"div",!1).div},s.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},s.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},s.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,i=t.ushrn(1),n=t.andln(1),s=r.cmp(i);return s<0||1===n&&0===s?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},s.prototype.modn=function(t){i(t<=67108863);for(var e=(1<<26)%t,r=0,n=this.length-1;n>=0;n--)r=(e*r+(0|this.words[n]))%t;return r},s.prototype.idivn=function(t){i(t<=67108863);for(var e=0,r=this.length-1;r>=0;r--){var n=(0|this.words[r])+67108864*e;this.words[r]=n/t|0,e=n%t}return this.strip()},s.prototype.divn=function(t){return this.clone().idivn(t)},s.prototype.egcd=function(t){i(0===t.negative),i(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var n=new s(1),o=new s(0),a=new s(0),u=new s(1),f=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++f;for(var h=r.clone(),c=e.clone();!e.isZero();){for(var d=0,p=1;0==(e.words[0]&p)&&d<26;++d,p<<=1);if(d>0)for(e.iushrn(d);d-- >0;)(n.isOdd()||o.isOdd())&&(n.iadd(h),o.isub(c)),n.iushrn(1),o.iushrn(1);for(var l=0,m=1;0==(r.words[0]&m)&&l<26;++l,m<<=1);if(l>0)for(r.iushrn(l);l-- >0;)(a.isOdd()||u.isOdd())&&(a.iadd(h),u.isub(c)),a.iushrn(1),u.iushrn(1);e.cmp(r)>=0?(e.isub(r),n.isub(a),o.isub(u)):(r.isub(e),a.isub(n),u.isub(o))}return{a:a,b:u,gcd:r.iushln(f)}},s.prototype._invmp=function(t){i(0===t.negative),i(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var n,o=new s(1),a=new s(0),u=r.clone();e.cmpn(1)>0&&r.cmpn(1)>0;){for(var f=0,h=1;0==(e.words[0]&h)&&f<26;++f,h<<=1);if(f>0)for(e.iushrn(f);f-- >0;)o.isOdd()&&o.iadd(u),o.iushrn(1);for(var c=0,d=1;0==(r.words[0]&d)&&c<26;++c,d<<=1);if(c>0)for(r.iushrn(c);c-- >0;)a.isOdd()&&a.iadd(u),a.iushrn(1);e.cmp(r)>=0?(e.isub(r),o.isub(a)):(r.isub(e),a.isub(o))}return(n=0===e.cmpn(1)?o:a).cmpn(0)<0&&n.iadd(t),n},s.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var i=0;e.isEven()&&r.isEven();i++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=e.cmp(r);if(n<0){var s=e;e=r,r=s}else if(0===n||0===r.cmpn(1))break;e.isub(r)}return r.iushln(i)},s.prototype.invm=function(t){return this.egcd(t).a.umod(t)},s.prototype.isEven=function(){return 0==(1&this.words[0])},s.prototype.isOdd=function(){return 1==(1&this.words[0])},s.prototype.andln=function(t){return this.words[0]&t},s.prototype.bincn=function(t){i("number"==typeof t);var e=t%26,r=(t-e)/26,n=1<<e;if(this.length<=r)return this._expand(r+1),this.words[r]|=n,this;for(var s=n,o=r;0!==s&&o<this.length;o++){var a=0|this.words[o];s=(a+=s)>>>26,a&=67108863,this.words[o]=a}return 0!==s&&(this.words[o]=s,this.length++),this},s.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},s.prototype.cmpn=function(t){var e,r=t<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this.strip(),this.length>1)e=1;else{r&&(t=-t),i(t<=67108863,"Number is too big");var n=0|this.words[0];e=n===t?0:n<t?-1:1}return 0!==this.negative?0|-e:e},s.prototype.cmp=function(t){if(0!==this.negative&&0===t.negative)return-1;if(0===this.negative&&0!==t.negative)return 1;var e=this.ucmp(t);return 0!==this.negative?0|-e:e},s.prototype.ucmp=function(t){if(this.length>t.length)return 1;if(this.length<t.length)return-1;for(var e=0,r=this.length-1;r>=0;r--){var i=0|this.words[r],n=0|t.words[r];if(i!==n){i<n?e=-1:i>n&&(e=1);break}}return e},s.prototype.gtn=function(t){return 1===this.cmpn(t)},s.prototype.gt=function(t){return 1===this.cmp(t)},s.prototype.gten=function(t){return this.cmpn(t)>=0},s.prototype.gte=function(t){return this.cmp(t)>=0},s.prototype.ltn=function(t){return-1===this.cmpn(t)},s.prototype.lt=function(t){return-1===this.cmp(t)},s.prototype.lten=function(t){return this.cmpn(t)<=0},s.prototype.lte=function(t){return this.cmp(t)<=0},s.prototype.eqn=function(t){return 0===this.cmpn(t)},s.prototype.eq=function(t){return 0===this.cmp(t)},s.red=function(t){return new w(t)},s.prototype.toRed=function(t){return i(!this.red,"Already a number in reduction context"),i(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},s.prototype.fromRed=function(){return i(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},s.prototype._forceRed=function(t){return this.red=t,this},s.prototype.forceRed=function(t){return i(!this.red,"Already a number in reduction context"),this._forceRed(t)},s.prototype.redAdd=function(t){return i(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},s.prototype.redIAdd=function(t){return i(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},s.prototype.redSub=function(t){return i(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},s.prototype.redISub=function(t){return i(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},s.prototype.redShl=function(t){return i(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},s.prototype.redMul=function(t){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},s.prototype.redIMul=function(t){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},s.prototype.redSqr=function(){return i(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},s.prototype.redISqr=function(){return i(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},s.prototype.redSqrt=function(){return i(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},s.prototype.redInvm=function(){return i(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},s.prototype.redNeg=function(){return i(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},s.prototype.redPow=function(t){return i(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var b={k256:null,p224:null,p192:null,p25519:null};function g(t,e){this.name=t,this.p=new s(e,16),this.n=this.p.bitLength(),this.k=new s(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function y(){g.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function v(){g.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function _(){g.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function S(){g.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function w(t){if("string"==typeof t){var e=s._prime(t);this.m=e.p,this.prime=e}else i(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function I(t){w.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new s(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)}g.prototype._tmp=function(){var t=new s(null);return t.words=new Array(Math.ceil(this.n/13)),t},g.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(e>this.n);var i=e<this.n?-1:r.ucmp(this.p);return 0===i?(r.words[0]=0,r.length=1):i>0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},g.prototype.split=function(t,e){t.iushrn(this.n,0,e)},g.prototype.imulK=function(t){return t.imul(this.k)},n(y,g),y.prototype.split=function(t,e){for(var r=Math.min(t.length,9),i=0;i<r;i++)e.words[i]=t.words[i];if(e.length=r,t.length<=9)return t.words[0]=0,void(t.length=1);var n=t.words[9];for(e.words[e.length++]=4194303&n,i=10;i<t.length;i++){var s=0|t.words[i];t.words[i-10]=(4194303&s)<<4|n>>>22,n=s}n>>>=22,t.words[i-10]=n,0===n&&t.length>10?t.length-=10:t.length-=9},y.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r<t.length;r++){var i=0|t.words[r];e+=977*i,t.words[r]=67108863&e,e=64*i+(e/67108864|0)}return 0===t.words[t.length-1]&&(t.length--,0===t.words[t.length-1]&&t.length--),t},n(v,g),n(_,g),n(S,g),S.prototype.imulK=function(t){for(var e=0,r=0;r<t.length;r++){var i=19*(0|t.words[r])+e,n=67108863&i;i>>>=26,t.words[r]=n,e=i}return 0!==e&&(t.words[t.length++]=e),t},s._prime=function(t){if(b[t])return b[t];var e;if("k256"===t)e=new y;else if("p224"===t)e=new v;else if("p192"===t)e=new _;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new S}return b[t]=e,e},w.prototype._verify1=function(t){i(0===t.negative,"red works only with positives"),i(t.red,"red works only with red numbers")},w.prototype._verify2=function(t,e){i(0==(t.negative|e.negative),"red works only with positives"),i(t.red&&t.red===e.red,"red works only with red numbers")},w.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},w.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},w.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},w.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},w.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},w.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},w.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},w.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},w.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},w.prototype.isqr=function(t){return this.imul(t,t.clone())},w.prototype.sqr=function(t){return this.mul(t,t)},w.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(i(e%2==1),3===e){var r=this.m.add(new s(1)).iushrn(2);return this.pow(t,r)}for(var n=this.m.subn(1),o=0;!n.isZero()&&0===n.andln(1);)o++,n.iushrn(1);i(!n.isZero());var a=new s(1).toRed(this),u=a.redNeg(),f=this.m.subn(1).iushrn(1),h=this.m.bitLength();for(h=new s(2*h*h).toRed(this);0!==this.pow(h,f).cmp(u);)h.redIAdd(u);for(var c=this.pow(h,n),d=this.pow(t,n.addn(1).iushrn(1)),p=this.pow(t,n),l=o;0!==p.cmp(a);){for(var m=p,b=0;0!==m.cmp(a);b++)m=m.redSqr();i(b<l);var g=this.pow(c,new s(1).iushln(l-b-1));d=d.redMul(g),c=g.redSqr(),p=p.redMul(c),l=b}return d},w.prototype.invm=function(t){var e=t._invmp(this.m);return 0!==e.negative?(e.negative=0,this.imod(e).redNeg()):this.imod(e)},w.prototype.pow=function(t,e){if(e.isZero())return new s(1).toRed(this);if(0===e.cmpn(1))return t.clone();var r=new Array(16);r[0]=new s(1).toRed(this),r[1]=t;for(var i=2;i<r.length;i++)r[i]=this.mul(r[i-1],t);var n=r[0],o=0,a=0,u=e.bitLength()%26;for(0===u&&(u=26),i=e.length-1;i>=0;i--){for(var f=e.words[i],h=u-1;h>=0;h--){var c=f>>h&1;n!==r[0]&&(n=this.sqr(n)),0!==c||0!==o?(o<<=1,o|=c,(4===++a||0===i&&0===h)&&(n=this.mul(n,r[o]),a=0,o=0)):a=0}u=26}return n},w.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},w.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},s.mont=function(t){return new I(t)},n(I,w),I.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},I.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},I.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),s=n;return n.cmp(this.m)>=0?s=n.isub(this.m):n.cmpn(0)<0&&(s=n.iadd(this.m)),s._forceRed(this)},I.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new s(0)._forceRed(this);var r=t.mul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).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)},I.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t,this)}).call(this,r(43)(t))},function(t,e,r){"use strict";var i="https://docs.moneybutton.com/";t.exports=[{name:"InvalidB58Char",message:"Invalid Base58 character: {0} in {1}"},{name:"InvalidB58Checksum",message:"Invalid Base58 checksum for {0}"},{name:"InvalidNetwork",message:"Invalid version for network: got {0}"},{name:"InvalidState",message:"Invalid state: {0}"},{name:"NotImplemented",message:"Function {0} was not implemented yet"},{name:"InvalidNetworkArgument",message:'Invalid network: must be "livenet" or "testnet", got {0}'},{name:"InvalidArgument",message:function(){return"Invalid Argument"+(arguments[0]?": "+arguments[0]:"")+(arguments[1]?" Documentation: "+i+arguments[1]:"")}},{name:"AbstractMethodInvoked",message:"Abstract Method Invocation: {0}"},{name:"InvalidArgumentType",message:function(){return"Invalid Argument for "+arguments[2]+", expected "+arguments[1]+" but got "+typeof arguments[0]}},{name:"Unit",message:"Internal Error on Unit {0}",errors:[{name:"UnknownCode",message:"Unrecognized unit code: {0}"},{name:"InvalidRate",message:"Invalid exchange rate: {0}"}]},{name:"MerkleBlock",message:"Internal Error on MerkleBlock {0}",errors:[{name:"InvalidMerkleTree",message:"This MerkleBlock contain an invalid Merkle Tree"}]},{name:"Transaction",message:"Internal Error on Transaction {0}",errors:[{name:"Input",message:"Internal Error on Input {0}",errors:[{name:"MissingScript",message:"Need a script to create an input"},{name:"UnsupportedScript",message:"Unsupported input script type: {0}"},{name:"MissingPreviousOutput",message:"No previous output information."},{name:"MissingInput",message:"Invalid inputIndex."}]},{name:"NeedMoreInfo",message:"{0}"},{name:"InvalidSorting",message:"The sorting function provided did not return the change output as one of the array elements"},{name:"InvalidOutputAmountSum",message:"{0}"},{name:"MissingSignatures",message:"Some inputs have not been fully signed"},{name:"InvalidIndex",message:"Invalid index: {0} is not between 0, {1}"},{name:"UnableToVerifySignature",message:"Unable to verify signature: {0}"},{name:"DustOutputs",message:"Dust amount detected in one output"},{name:"MissingOutput",message:"Output not found"},{name:"InvalidSatoshis",message:"Output satoshis are invalid"},{name:"FeeError",message:"Internal Error on Fee {0}",errors:[{name:"TooSmall",message:"Fee is too small: {0}"},{name:"TooLarge",message:"Fee is too large: {0}"},{name:"Different",message:"Unspent value is different from specified fee: {0}"}]},{name:"ChangeAddressMissing",message:"Change address is missing"},{name:"BlockHeightTooHigh",message:"Block Height can be at most 2^32 -1"},{name:"NLockTimeOutOfRange",message:"Block Height can only be between 0 and 499 999 999"},{name:"LockTimeTooEarly",message:"Lock Time can't be earlier than UNIX date 500 000 000"},{name:"TransactionAlreadySealed",message:"Cannot update sealed transaction"}]},{name:"Script",message:"Internal Error on Script {0}",errors:[{name:"UnrecognizedAddress",message:"Expected argument {0} to be an address"},{name:"CantDeriveAddress",message:"Can't derive address associated with script {0}, needs to be p2pkh in, p2pkh out, p2sh in, or p2sh out."},{name:"InvalidBuffer",message:"Invalid script buffer: can't parse valid script from given buffer {0}"},{name:"InvalidOpcode",message:'Invalid Opcode: got "{0}"'}]},{name:"HDPrivateKey",message:"Internal Error on HDPrivateKey {0}",errors:[{name:"InvalidDerivationArgument",message:"Invalid derivation argument {0}, expected string, or number and boolean"},{name:"InvalidEntropyArgument",message:"Invalid entropy: must be an hexa string or binary buffer, got {0}",errors:[{name:"TooMuchEntropy",message:'Invalid entropy: more than 512 bits is non standard, got "{0}"'},{name:"NotEnoughEntropy",message:'Invalid entropy: at least 128 bits needed, got "{0}"'}]},{name:"InvalidLength",message:"Invalid length for xprivkey string in {0}"},{name:"InvalidPath",message:"Invalid derivation path: {0}"},{name:"UnrecognizedArgument",message:'Invalid argument: creating a HDPrivateKey requires a string, buffer, json or object, got "{0}"'}]},{name:"HDPublicKey",message:"Internal Error on HDPublicKey {0}",errors:[{name:"ArgumentIsPrivateExtended",message:"Argument is an extended private key: {0}"},{name:"InvalidDerivationArgument",message:"Invalid derivation argument: got {0}"},{name:"InvalidLength",message:'Invalid length for xpubkey: got "{0}"'},{name:"InvalidPath",message:'Invalid derivation path, it should look like: "m/1/100", got "{0}"'},{name:"InvalidIndexCantDeriveHardened",message:"Invalid argument: creating a hardened path requires an HDPrivateKey"},{name:"MustSupplyArgument",message:"Must supply an argument to create a HDPublicKey"},{name:"UnrecognizedArgument",message:"Invalid argument for creation, must be string, json, buffer, or object"}]}]},function(t){t.exports={name:"elliptic",version:"6.5.4",description:"EC cryptography",main:"lib/elliptic.js",files:["lib"],scripts:{lint:"eslint lib test","lint:fix":"npm run lint -- --fix",unit:"istanbul test _mocha --reporter=spec test/index.js",test:"npm run lint && npm run unit",version:"grunt dist && git add dist/"},repository:{type:"git",url:"git@github.com:indutny/elliptic"},keywords:["EC","Elliptic","curve","Cryptography"],author:"Fedor Indutny <fedor@indutny.com>",license:"MIT",bugs:{url:"https://github.com/indutny/elliptic/issues"},homepage:"https://github.com/indutny/elliptic",devDependencies:{brfs:"^2.0.2",coveralls:"^3.1.0",eslint:"^7.6.0",grunt:"^1.2.1","grunt-browserify":"^5.3.0","grunt-cli":"^1.3.2","grunt-contrib-connect":"^3.0.0","grunt-contrib-copy":"^1.0.0","grunt-contrib-uglify":"^5.0.0","grunt-mocha-istanbul":"^5.0.2","grunt-saucelabs":"^9.0.1",istanbul:"^0.4.5",mocha:"^8.0.1"},dependencies:{"bn.js":"^4.11.9",brorand:"^1.1.0","hash.js":"^1.0.0","hmac-drbg":"^1.0.1",inherits:"^2.0.4","minimalistic-assert":"^1.0.1","minimalistic-crypto-utils":"^1.0.1"}}},function(t,e){},function(t,e,r){"use strict";var i=r(6),n=r(10),s=r(37),o=r(27),a=i.assert;function u(t){o.call(this,"short",t),this.a=new n(t.a,16).toRed(this.red),this.b=new n(t.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=0===this.a.fromRed().cmpn(0),this.threeA=0===this.a.fromRed().sub(this.p).cmpn(-3),this.endo=this._getEndomorphism(t),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}function f(t,e,r,i){o.BasePoint.call(this,t,"affine"),null===e&&null===r?(this.x=null,this.y=null,this.inf=!0):(this.x=new n(e,16),this.y=new n(r,16),i&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.inf=!1)}function h(t,e,r,i){o.BasePoint.call(this,t,"jacobian"),null===e&&null===r&&null===i?(this.x=this.curve.one,this.y=this.curve.one,this.z=new n(0)):(this.x=new n(e,16),this.y=new n(r,16),this.z=new n(i,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}s(u,o),t.exports=u,u.prototype._getEndomorphism=function(t){if(this.zeroA&&this.g&&this.n&&1===this.p.modn(3)){var e,r;if(t.beta)e=new n(t.beta,16).toRed(this.red);else{var i=this._getEndoRoots(this.p);e=(e=i[0].cmp(i[1])<0?i[0]:i[1]).toRed(this.red)}if(t.lambda)r=new n(t.lambda,16);else{var s=this._getEndoRoots(this.n);0===this.g.mul(s[0]).x.cmp(this.g.x.redMul(e))?r=s[0]:(r=s[1],a(0===this.g.mul(r).x.cmp(this.g.x.redMul(e))))}return{beta:e,lambda:r,basis:t.basis?t.basis.map((function(t){return{a:new n(t.a,16),b:new n(t.b,16)}})):this._getEndoBasis(r)}}},u.prototype._getEndoRoots=function(t){var e=t===this.p?this.red:n.mont(t),r=new n(2).toRed(e).redInvm(),i=r.redNeg(),s=new n(3).toRed(e).redNeg().redSqrt().redMul(r);return[i.redAdd(s).fromRed(),i.redSub(s).fromRed()]},u.prototype._getEndoBasis=function(t){for(var e,r,i,s,o,a,u,f,h,c=this.n.ushrn(Math.floor(this.n.bitLength()/2)),d=t,p=this.n.clone(),l=new n(1),m=new n(0),b=new n(0),g=new n(1),y=0;0!==d.cmpn(0);){var v=p.div(d);f=p.sub(v.mul(d)),h=b.sub(v.mul(l));var _=g.sub(v.mul(m));if(!i&&f.cmp(c)<0)e=u.neg(),r=l,i=f.neg(),s=h;else if(i&&2==++y)break;u=f,p=d,d=f,b=l,l=h,g=m,m=_}o=f.neg(),a=h;var S=i.sqr().add(s.sqr());return o.sqr().add(a.sqr()).cmp(S)>=0&&(o=e,a=r),i.negative&&(i=i.neg(),s=s.neg()),o.negative&&(o=o.neg(),a=a.neg()),[{a:i,b:s},{a:o,b:a}]},u.prototype._endoSplit=function(t){var e=this.endo.basis,r=e[0],i=e[1],n=i.b.mul(t).divRound(this.n),s=r.b.neg().mul(t).divRound(this.n),o=n.mul(r.a),a=s.mul(i.a),u=n.mul(r.b),f=s.mul(i.b);return{k1:t.sub(o).sub(a),k2:u.add(f).neg()}},u.prototype.pointFromX=function(t,e){(t=new n(t,16)).red||(t=t.toRed(this.red));var r=t.redSqr().redMul(t).redIAdd(t.redMul(this.a)).redIAdd(this.b),i=r.redSqrt();if(0!==i.redSqr().redSub(r).cmp(this.zero))throw new Error("invalid point");var s=i.fromRed().isOdd();return(e&&!s||!e&&s)&&(i=i.redNeg()),this.point(t,i)},u.prototype.validate=function(t){if(t.inf)return!0;var e=t.x,r=t.y,i=this.a.redMul(e),n=e.redSqr().redMul(e).redIAdd(i).redIAdd(this.b);return 0===r.redSqr().redISub(n).cmpn(0)},u.prototype._endoWnafMulAdd=function(t,e,r){for(var i=this._endoWnafT1,n=this._endoWnafT2,s=0;s<t.length;s++){var o=this._endoSplit(e[s]),a=t[s],u=a._getBeta();o.k1.negative&&(o.k1.ineg(),a=a.neg(!0)),o.k2.negative&&(o.k2.ineg(),u=u.neg(!0)),i[2*s]=a,i[2*s+1]=u,n[2*s]=o.k1,n[2*s+1]=o.k2}for(var f=this._wnafMulAdd(1,i,n,2*s,r),h=0;h<2*s;h++)i[h]=null,n[h]=null;return f},s(f,o.BasePoint),u.prototype.point=function(t,e,r){return new f(this,t,e,r)},u.prototype.pointFromJSON=function(t,e){return f.fromJSON(this,t,e)},f.prototype._getBeta=function(){if(this.curve.endo){var t=this.precomputed;if(t&&t.beta)return t.beta;var e=this.curve.point(this.x.redMul(this.curve.endo.beta),this.y);if(t){var r=this.curve,i=function(t){return r.point(t.x.redMul(r.endo.beta),t.y)};t.beta=e,e.precomputed={beta:null,naf:t.naf&&{wnd:t.naf.wnd,points:t.naf.points.map(i)},doubles:t.doubles&&{step:t.doubles.step,points:t.doubles.points.map(i)}}}return e}},f.prototype.toJSON=function(){return this.precomputed?[this.x,this.y,this.precomputed&&{doubles:this.precomputed.doubles&&{step:this.precomputed.doubles.step,points:this.precomputed.doubles.points.slice(1)},naf:this.precomputed.naf&&{wnd:this.precomputed.naf.wnd,points:this.precomputed.naf.points.slice(1)}}]:[this.x,this.y]},f.fromJSON=function(t,e,r){"string"==typeof e&&(e=JSON.parse(e));var i=t.point(e[0],e[1],r);if(!e[2])return i;function n(e){return t.point(e[0],e[1],r)}var s=e[2];return i.precomputed={beta:null,doubles:s.doubles&&{step:s.doubles.step,points:[i].concat(s.doubles.points.map(n))},naf:s.naf&&{wnd:s.naf.wnd,points:[i].concat(s.naf.points.map(n))}},i},f.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+">"},f.prototype.isInfinity=function(){return this.inf},f.prototype.add=function(t){if(this.inf)return t;if(t.inf)return this;if(this.eq(t))return this.dbl();if(this.neg().eq(t))return this.curve.point(null,null);if(0===this.x.cmp(t.x))return this.curve.point(null,null);var e=this.y.redSub(t.y);0!==e.cmpn(0)&&(e=e.redMul(this.x.redSub(t.x).redInvm()));var r=e.redSqr().redISub(this.x).redISub(t.x),i=e.redMul(this.x.redSub(r)).redISub(this.y);return this.curve.point(r,i)},f.prototype.dbl=function(){if(this.inf)return this;var t=this.y.redAdd(this.y);if(0===t.cmpn(0))return this.curve.point(null,null);var e=this.curve.a,r=this.x.redSqr(),i=t.redInvm(),n=r.redAdd(r).redIAdd(r).redIAdd(e).redMul(i),s=n.redSqr().redISub(this.x.redAdd(this.x)),o=n.redMul(this.x.redSub(s)).redISub(this.y);return this.curve.point(s,o)},f.prototype.getX=function(){return this.x.fromRed()},f.prototype.getY=function(){return this.y.fromRed()},f.prototype.mul=function(t){return t=new n(t,16),this.isInfinity()?this:this._hasDoubles(t)?this.curve._fixedNafMul(this,t):this.curve.endo?this.curve._endoWnafMulAdd([this],[t]):this.curve._wnafMul(this,t)},f.prototype.mulAdd=function(t,e,r){var i=[this,e],n=[t,r];return this.curve.endo?this.curve._endoWnafMulAdd(i,n):this.curve._wnafMulAdd(1,i,n,2)},f.prototype.jmulAdd=function(t,e,r){var i=[this,e],n=[t,r];return this.curve.endo?this.curve._endoWnafMulAdd(i,n,!0):this.curve._wnafMulAdd(1,i,n,2,!0)},f.prototype.eq=function(t){return this===t||this.inf===t.inf&&(this.inf||0===this.x.cmp(t.x)&&0===this.y.cmp(t.y))},f.prototype.neg=function(t){if(this.inf)return this;var e=this.curve.point(this.x,this.y.redNeg());if(t&&this.precomputed){var r=this.precomputed,i=function(t){return t.neg()};e.precomputed={naf:r.naf&&{wnd:r.naf.wnd,points:r.naf.points.map(i)},doubles:r.doubles&&{step:r.doubles.step,points:r.doubles.points.map(i)}}}return e},f.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},s(h,o.BasePoint),u.prototype.jpoint=function(t,e,r){return new h(this,t,e,r)},h.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var t=this.z.redInvm(),e=t.redSqr(),r=this.x.redMul(e),i=this.y.redMul(e).redMul(t);return this.curve.point(r,i)},h.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},h.prototype.add=function(t){if(this.isInfinity())return t;if(t.isInfinity())return this;var e=t.z.redSqr(),r=this.z.redSqr(),i=this.x.redMul(e),n=t.x.redMul(r),s=this.y.redMul(e.redMul(t.z)),o=t.y.redMul(r.redMul(this.z)),a=i.redSub(n),u=s.redSub(o);if(0===a.cmpn(0))return 0!==u.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var f=a.redSqr(),h=f.redMul(a),c=i.redMul(f),d=u.redSqr().redIAdd(h).redISub(c).redISub(c),p=u.redMul(c.redISub(d)).redISub(s.redMul(h)),l=this.z.redMul(t.z).redMul(a);return this.curve.jpoint(d,p,l)},h.prototype.mixedAdd=function(t){if(this.isInfinity())return t.toJ();if(t.isInfinity())return this;var e=this.z.redSqr(),r=this.x,i=t.x.redMul(e),n=this.y,s=t.y.redMul(e).redMul(this.z),o=r.redSub(i),a=n.redSub(s);if(0===o.cmpn(0))return 0!==a.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var u=o.redSqr(),f=u.redMul(o),h=r.redMul(u),c=a.redSqr().redIAdd(f).redISub(h).redISub(h),d=a.redMul(h.redISub(c)).redISub(n.redMul(f)),p=this.z.redMul(o);return this.curve.jpoint(c,d,p)},h.prototype.dblp=function(t){if(0===t)return this;if(this.isInfinity())return this;if(!t)return this.dbl();var e;if(this.curve.zeroA||this.curve.threeA){var r=this;for(e=0;e<t;e++)r=r.dbl();return r}var i=this.curve.a,n=this.curve.tinv,s=this.x,o=this.y,a=this.z,u=a.redSqr().redSqr(),f=o.redAdd(o);for(e=0;e<t;e++){var h=s.redSqr(),c=f.redSqr(),d=c.redSqr(),p=h.redAdd(h).redIAdd(h).redIAdd(i.redMul(u)),l=s.redMul(c),m=p.redSqr().redISub(l.redAdd(l)),b=l.redISub(m),g=p.redMul(b);g=g.redIAdd(g).redISub(d);var y=f.redMul(a);e+1<t&&(u=u.redMul(d)),s=m,a=y,f=g}return this.curve.jpoint(s,f.redMul(n),a)},h.prototype.dbl=function(){return this.isInfinity()?this:this.curve.zeroA?this._zeroDbl():this.curve.threeA?this._threeDbl():this._dbl()},h.prototype._zeroDbl=function(){var t,e,r;if(this.zOne){var i=this.x.redSqr(),n=this.y.redSqr(),s=n.redSqr(),o=this.x.redAdd(n).redSqr().redISub(i).redISub(s);o=o.redIAdd(o);var a=i.redAdd(i).redIAdd(i),u=a.redSqr().redISub(o).redISub(o),f=s.redIAdd(s);f=(f=f.redIAdd(f)).redIAdd(f),t=u,e=a.redMul(o.redISub(u)).redISub(f),r=this.y.redAdd(this.y)}else{var h=this.x.redSqr(),c=this.y.redSqr(),d=c.redSqr(),p=this.x.redAdd(c).redSqr().redISub(h).redISub(d);p=p.redIAdd(p);var l=h.redAdd(h).redIAdd(h),m=l.redSqr(),b=d.redIAdd(d);b=(b=b.redIAdd(b)).redIAdd(b),t=m.redISub(p).redISub(p),e=l.redMul(p.redISub(t)).redISub(b),r=(r=this.y.redMul(this.z)).redIAdd(r)}return this.curve.jpoint(t,e,r)},h.prototype._threeDbl=function(){var t,e,r;if(this.zOne){var i=this.x.redSqr(),n=this.y.redSqr(),s=n.redSqr(),o=this.x.redAdd(n).redSqr().redISub(i).redISub(s);o=o.redIAdd(o);var a=i.redAdd(i).redIAdd(i).redIAdd(this.curve.a),u=a.redSqr().redISub(o).redISub(o);t=u;var f=s.redIAdd(s);f=(f=f.redIAdd(f)).redIAdd(f),e=a.redMul(o.redISub(u)).redISub(f),r=this.y.redAdd(this.y)}else{var h=this.z.redSqr(),c=this.y.redSqr(),d=this.x.redMul(c),p=this.x.redSub(h).redMul(this.x.redAdd(h));p=p.redAdd(p).redIAdd(p);var l=d.redIAdd(d),m=(l=l.redIAdd(l)).redAdd(l);t=p.redSqr().redISub(m),r=this.y.redAdd(this.z).redSqr().redISub(c).redISub(h);var b=c.redSqr();b=(b=(b=b.redIAdd(b)).redIAdd(b)).redIAdd(b),e=p.redMul(l.redISub(t)).redISub(b)}return this.curve.jpoint(t,e,r)},h.prototype._dbl=function(){var t=this.curve.a,e=this.x,r=this.y,i=this.z,n=i.redSqr().redSqr(),s=e.redSqr(),o=r.redSqr(),a=s.redAdd(s).redIAdd(s).redIAdd(t.redMul(n)),u=e.redAdd(e),f=(u=u.redIAdd(u)).redMul(o),h=a.redSqr().redISub(f.redAdd(f)),c=f.redISub(h),d=o.redSqr();d=(d=(d=d.redIAdd(d)).redIAdd(d)).redIAdd(d);var p=a.redMul(c).redISub(d),l=r.redAdd(r).redMul(i);return this.curve.jpoint(h,p,l)},h.prototype.trpl=function(){if(!this.curve.zeroA)return this.dbl().add(this);var t=this.x.redSqr(),e=this.y.redSqr(),r=this.z.redSqr(),i=e.redSqr(),n=t.redAdd(t).redIAdd(t),s=n.redSqr(),o=this.x.redAdd(e).redSqr().redISub(t).redISub(i),a=(o=(o=(o=o.redIAdd(o)).redAdd(o).redIAdd(o)).redISub(s)).redSqr(),u=i.redIAdd(i);u=(u=(u=u.redIAdd(u)).redIAdd(u)).redIAdd(u);var f=n.redIAdd(o).redSqr().redISub(s).redISub(a).redISub(u),h=e.redMul(f);h=(h=h.redIAdd(h)).redIAdd(h);var c=this.x.redMul(a).redISub(h);c=(c=c.redIAdd(c)).redIAdd(c);var d=this.y.redMul(f.redMul(u.redISub(f)).redISub(o.redMul(a)));d=(d=(d=d.redIAdd(d)).redIAdd(d)).redIAdd(d);var p=this.z.redAdd(o).redSqr().redISub(r).redISub(a);return this.curve.jpoint(c,d,p)},h.prototype.mul=function(t,e){return t=new n(t,e),this.curve._wnafMul(this,t)},h.prototype.eq=function(t){if("affine"===t.type)return this.eq(t.toJ());if(this===t)return!0;var e=this.z.redSqr(),r=t.z.redSqr();if(0!==this.x.redMul(r).redISub(t.x.redMul(e)).cmpn(0))return!1;var i=e.redMul(this.z),n=r.redMul(t.z);return 0===this.y.redMul(n).redISub(t.y.redMul(i)).cmpn(0)},h.prototype.eqXToP=function(t){var e=this.z.redSqr(),r=t.toRed(this.curve.red).redMul(e);if(0===this.x.cmp(r))return!0;for(var i=t.clone(),n=this.curve.redN.redMul(e);;){if(i.iadd(this.curve.n),i.cmp(this.curve.p)>=0)return!1;if(r.redIAdd(n),0===this.x.cmp(r))return!0}},h.prototype.inspect=function(){return this.isInfinity()?"<EC JPoint Infinity>":"<EC JPoint x: "+this.x.toString(16,2)+" y: "+this.y.toString(16,2)+" z: "+this.z.toString(16,2)+">"},h.prototype.isInfinity=function(){return 0===this.z.cmpn(0)}},function(t,e,r){"use strict";var i=r(10),n=r(37),s=r(27),o=r(6);function a(t){s.call(this,"mont",t),this.a=new i(t.a,16).toRed(this.red),this.b=new i(t.b,16).toRed(this.red),this.i4=new i(4).toRed(this.red).redInvm(),this.two=new i(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}function u(t,e,r){s.BasePoint.call(this,t,"projective"),null===e&&null===r?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new i(e,16),this.z=new i(r,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}n(a,s),t.exports=a,a.prototype.validate=function(t){var e=t.normalize().x,r=e.redSqr(),i=r.redMul(e).redAdd(r.redMul(this.a)).redAdd(e);return 0===i.redSqrt().redSqr().cmp(i)},n(u,s.BasePoint),a.prototype.decodePoint=function(t,e){return this.point(o.toArray(t,e),1)},a.prototype.point=function(t,e){return new u(this,t,e)},a.prototype.pointFromJSON=function(t){return u.fromJSON(this,t)},u.prototype.precompute=function(){},u.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())},u.fromJSON=function(t,e){return new u(t,e[0],e[1]||t.one)},u.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" z: "+this.z.fromRed().toString(16,2)+">"},u.prototype.isInfinity=function(){return 0===this.z.cmpn(0)},u.prototype.dbl=function(){var t=this.x.redAdd(this.z).redSqr(),e=this.x.redSub(this.z).redSqr(),r=t.redSub(e),i=t.redMul(e),n=r.redMul(e.redAdd(this.curve.a24.redMul(r)));return this.curve.point(i,n)},u.prototype.add=function(){throw new Error("Not supported on Montgomery curve")},u.prototype.diffAdd=function(t,e){var r=this.x.redAdd(this.z),i=this.x.redSub(this.z),n=t.x.redAdd(t.z),s=t.x.redSub(t.z).redMul(r),o=n.redMul(i),a=e.z.redMul(s.redAdd(o).redSqr()),u=e.x.redMul(s.redISub(o).redSqr());return this.curve.point(a,u)},u.prototype.mul=function(t){for(var e=t.clone(),r=this,i=this.curve.point(null,null),n=[];0!==e.cmpn(0);e.iushrn(1))n.push(e.andln(1));for(var s=n.length-1;s>=0;s--)0===n[s]?(r=r.diffAdd(i,this),i=i.dbl()):(i=r.diffAdd(i,this),r=r.dbl());return i},u.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")},u.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")},u.prototype.eq=function(t){return 0===this.getX().cmp(t.getX())},u.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},u.prototype.getX=function(){return this.normalize(),this.x.fromRed()}},function(t,e,r){"use strict";var i=r(6),n=r(10),s=r(37),o=r(27),a=i.assert;function u(t){this.twisted=1!=(0|t.a),this.mOneA=this.twisted&&-1==(0|t.a),this.extended=this.mOneA,o.call(this,"edwards",t),this.a=new n(t.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new n(t.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new n(t.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),a(!this.twisted||0===this.c.fromRed().cmpn(1)),this.oneC=1==(0|t.c)}function f(t,e,r,i,s){o.BasePoint.call(this,t,"projective"),null===e&&null===r&&null===i?(this.x=this.curve.zero,this.y=this.curve.one,this.z=this.curve.one,this.t=this.curve.zero,this.zOne=!0):(this.x=new n(e,16),this.y=new n(r,16),this.z=i?new n(i,16):this.curve.one,this.t=s&&new n(s,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.t&&!this.t.red&&(this.t=this.t.toRed(this.curve.red)),this.zOne=this.z===this.curve.one,this.curve.extended&&!this.t&&(this.t=this.x.redMul(this.y),this.zOne||(this.t=this.t.redMul(this.z.redInvm()))))}s(u,o),t.exports=u,u.prototype._mulA=function(t){return this.mOneA?t.redNeg():this.a.redMul(t)},u.prototype._mulC=function(t){return this.oneC?t:this.c.redMul(t)},u.prototype.jpoint=function(t,e,r,i){return this.point(t,e,r,i)},u.prototype.pointFromX=function(t,e){(t=new n(t,16)).red||(t=t.toRed(this.red));var r=t.redSqr(),i=this.c2.redSub(this.a.redMul(r)),s=this.one.redSub(this.c2.redMul(this.d).redMul(r)),o=i.redMul(s.redInvm()),a=o.redSqrt();if(0!==a.redSqr().redSub(o).cmp(this.zero))throw new Error("invalid point");var u=a.fromRed().isOdd();return(e&&!u||!e&&u)&&(a=a.redNeg()),this.point(t,a)},u.prototype.pointFromY=function(t,e){(t=new n(t,16)).red||(t=t.toRed(this.red));var r=t.redSqr(),i=r.redSub(this.c2),s=r.redMul(this.d).redMul(this.c2).redSub(this.a),o=i.redMul(s.redInvm());if(0===o.cmp(this.zero)){if(e)throw new Error("invalid point");return this.point(this.zero,t)}var a=o.redSqrt();if(0!==a.redSqr().redSub(o).cmp(this.zero))throw new Error("invalid point");return a.fromRed().isOdd()!==e&&(a=a.redNeg()),this.point(a,t)},u.prototype.validate=function(t){if(t.isInfinity())return!0;t.normalize();var e=t.x.redSqr(),r=t.y.redSqr(),i=e.redMul(this.a).redAdd(r),n=this.c2.redMul(this.one.redAdd(this.d.redMul(e).redMul(r)));return 0===i.cmp(n)},s(f,o.BasePoint),u.prototype.pointFromJSON=function(t){return f.fromJSON(this,t)},u.prototype.point=function(t,e,r,i){return new f(this,t,e,r,i)},f.fromJSON=function(t,e){return new f(t,e[0],e[1],e[2])},f.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+" z: "+this.z.fromRed().toString(16,2)+">"},f.prototype.isInfinity=function(){return 0===this.x.cmpn(0)&&(0===this.y.cmp(this.z)||this.zOne&&0===this.y.cmp(this.curve.c))},f.prototype._extDbl=function(){var t=this.x.redSqr(),e=this.y.redSqr(),r=this.z.redSqr();r=r.redIAdd(r);var i=this.curve._mulA(t),n=this.x.redAdd(this.y).redSqr().redISub(t).redISub(e),s=i.redAdd(e),o=s.redSub(r),a=i.redSub(e),u=n.redMul(o),f=s.redMul(a),h=n.redMul(a),c=o.redMul(s);return this.curve.point(u,f,c,h)},f.prototype._projDbl=function(){var t,e,r,i,n,s,o=this.x.redAdd(this.y).redSqr(),a=this.x.redSqr(),u=this.y.redSqr();if(this.curve.twisted){var f=(i=this.curve._mulA(a)).redAdd(u);this.zOne?(t=o.redSub(a).redSub(u).redMul(f.redSub(this.curve.two)),e=f.redMul(i.redSub(u)),r=f.redSqr().redSub(f).redSub(f)):(n=this.z.redSqr(),s=f.redSub(n).redISub(n),t=o.redSub(a).redISub(u).redMul(s),e=f.redMul(i.redSub(u)),r=f.redMul(s))}else i=a.redAdd(u),n=this.curve._mulC(this.z).redSqr(),s=i.redSub(n).redSub(n),t=this.curve._mulC(o.redISub(i)).redMul(s),e=this.curve._mulC(i).redMul(a.redISub(u)),r=i.redMul(s);return this.curve.point(t,e,r)},f.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},f.prototype._extAdd=function(t){var e=this.y.redSub(this.x).redMul(t.y.redSub(t.x)),r=this.y.redAdd(this.x).redMul(t.y.redAdd(t.x)),i=this.t.redMul(this.curve.dd).redMul(t.t),n=this.z.redMul(t.z.redAdd(t.z)),s=r.redSub(e),o=n.redSub(i),a=n.redAdd(i),u=r.redAdd(e),f=s.redMul(o),h=a.redMul(u),c=s.redMul(u),d=o.redMul(a);return this.curve.point(f,h,d,c)},f.prototype._projAdd=function(t){var e,r,i=this.z.redMul(t.z),n=i.redSqr(),s=this.x.redMul(t.x),o=this.y.redMul(t.y),a=this.curve.d.redMul(s).redMul(o),u=n.redSub(a),f=n.redAdd(a),h=this.x.redAdd(this.y).redMul(t.x.redAdd(t.y)).redISub(s).redISub(o),c=i.redMul(u).redMul(h);return this.curve.twisted?(e=i.redMul(f).redMul(o.redSub(this.curve._mulA(s))),r=u.redMul(f)):(e=i.redMul(f).redMul(o.redSub(s)),r=this.curve._mulC(u).redMul(f)),this.curve.point(c,e,r)},f.prototype.add=function(t){return this.isInfinity()?t:t.isInfinity()?this:this.curve.extended?this._extAdd(t):this._projAdd(t)},f.prototype.mul=function(t){return this._hasDoubles(t)?this.curve._fixedNafMul(this,t):this.curve._wnafMul(this,t)},f.prototype.mulAdd=function(t,e,r){return this.curve._wnafMulAdd(1,[this,e],[t,r],2,!1)},f.prototype.jmulAdd=function(t,e,r){return this.curve._wnafMulAdd(1,[this,e],[t,r],2,!0)},f.prototype.normalize=function(){if(this.zOne)return this;var t=this.z.redInvm();return this.x=this.x.redMul(t),this.y=this.y.redMul(t),this.t&&(this.t=this.t.redMul(t)),this.z=this.curve.one,this.zOne=!0,this},f.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},f.prototype.getX=function(){return this.normalize(),this.x.fromRed()},f.prototype.getY=function(){return this.normalize(),this.y.fromRed()},f.prototype.eq=function(t){return this===t||0===this.getX().cmp(t.getX())&&0===this.getY().cmp(t.getY())},f.prototype.eqXToP=function(t){var e=t.toRed(this.curve.red).redMul(this.z);if(0===this.x.cmp(e))return!0;for(var r=t.clone(),i=this.curve.redN.redMul(this.z);;){if(r.iadd(this.curve.n),r.cmp(this.curve.p)>=0)return!1;if(e.redIAdd(i),0===this.x.cmp(e))return!0}},f.prototype.toP=f.prototype.normalize,f.prototype.mixedAdd=f.prototype.add},function(t,e,r){"use strict";e.sha1=r(76),e.sha224=r(77),e.sha256=r(50),e.sha384=r(78),e.sha512=r(51)},function(t,e,r){"use strict";var i=r(11),n=r(22),s=r(49),o=i.rotl32,a=i.sum32,u=i.sum32_5,f=s.ft_1,h=n.BlockHash,c=[1518500249,1859775393,2400959708,3395469782];function d(){if(!(this instanceof d))return new d;h.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}i.inherits(d,h),t.exports=d,d.blockSize=512,d.outSize=160,d.hmacStrength=80,d.padLength=64,d.prototype._update=function(t,e){for(var r=this.W,i=0;i<16;i++)r[i]=t[e+i];for(;i<r.length;i++)r[i]=o(r[i-3]^r[i-8]^r[i-14]^r[i-16],1);var n=this.h[0],s=this.h[1],h=this.h[2],d=this.h[3],p=this.h[4];for(i=0;i<r.length;i++){var l=~~(i/20),m=u(o(n,5),f(l,s,h,d),p,r[i],c[l]);p=d,d=h,h=o(s,30),s=n,n=m}this.h[0]=a(this.h[0],n),this.h[1]=a(this.h[1],s),this.h[2]=a(this.h[2],h),this.h[3]=a(this.h[3],d),this.h[4]=a(this.h[4],p)},d.prototype._digest=function(t){return"hex"===t?i.toHex32(this.h,"big"):i.split32(this.h,"big")}},function(t,e,r){"use strict";var i=r(11),n=r(50);function s(){if(!(this instanceof s))return new s;n.call(this),this.h=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]}i.inherits(s,n),t.exports=s,s.blockSize=512,s.outSize=224,s.hmacStrength=192,s.padLength=64,s.prototype._digest=function(t){return"hex"===t?i.toHex32(this.h.slice(0,7),"big"):i.split32(this.h.slice(0,7),"big")}},function(t,e,r){"use strict";var i=r(11),n=r(51);function s(){if(!(this instanceof s))return new s;n.call(this),this.h=[3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]}i.inherits(s,n),t.exports=s,s.blockSize=1024,s.outSize=384,s.hmacStrength=192,s.padLength=128,s.prototype._digest=function(t){return"hex"===t?i.toHex32(this.h.slice(0,12),"big"):i.split32(this.h.slice(0,12),"big")}},function(t,e,r){"use strict";var i=r(11),n=r(22),s=i.rotl32,o=i.sum32,a=i.sum32_3,u=i.sum32_4,f=n.BlockHash;function h(){if(!(this instanceof h))return new h;f.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.endian="little"}function c(t,e,r,i){return t<=15?e^r^i:t<=31?e&r|~e&i:t<=47?(e|~r)^i:t<=63?e&i|r&~i:e^(r|~i)}function d(t){return t<=15?0:t<=31?1518500249:t<=47?1859775393:t<=63?2400959708:2840853838}function p(t){return t<=15?1352829926:t<=31?1548603684:t<=47?1836072691:t<=63?2053994217:0}i.inherits(h,f),e.ripemd160=h,h.blockSize=512,h.outSize=160,h.hmacStrength=192,h.padLength=64,h.prototype._update=function(t,e){for(var r=this.h[0],i=this.h[1],n=this.h[2],f=this.h[3],h=this.h[4],y=r,v=i,_=n,S=f,w=h,I=0;I<80;I++){var E=o(s(u(r,c(I,i,n,f),t[l[I]+e],d(I)),b[I]),h);r=h,h=f,f=s(n,10),n=i,i=E,E=o(s(u(y,c(79-I,v,_,S),t[m[I]+e],p(I)),g[I]),w),y=w,w=S,S=s(_,10),_=v,v=E}E=a(this.h[1],n,S),this.h[1]=a(this.h[2],f,w),this.h[2]=a(this.h[3],h,y),this.h[3]=a(this.h[4],r,v),this.h[4]=a(this.h[0],i,_),this.h[0]=E},h.prototype._digest=function(t){return"hex"===t?i.toHex32(this.h,"little"):i.split32(this.h,"little")};var l=[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],m=[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],b=[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],g=[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]},function(t,e,r){"use strict";var i=r(11),n=r(17);function s(t,e,r){if(!(this instanceof s))return new s(t,e,r);this.Hash=t,this.blockSize=t.blockSize/8,this.outSize=t.outSize/8,this.inner=null,this.outer=null,this._init(i.toArray(e,r))}t.exports=s,s.prototype._init=function(t){t.length>this.blockSize&&(t=(new this.Hash).update(t).digest()),n(t.length<=this.blockSize);for(var e=t.length;e<this.blockSize;e++)t.push(0);for(e=0;e<t.length;e++)t[e]^=54;for(this.inner=(new this.Hash).update(t),e=0;e<t.length;e++)t[e]^=106;this.outer=(new this.Hash).update(t)},s.prototype.update=function(t,e){return this.inner.update(t,e),this},s.prototype.digest=function(t){return this.outer.update(this.inner.digest()),this.outer.digest(t)}},function(t,e){t.exports={doubles:{step:4,points:[["e60fce93b59e9ec53011aabc21c23e97b2a31369b87a5ae9c44ee89e2a6dec0a","f7e3507399e595929db99f34f57937101296891e44d23f0be1f32cce69616821"],["8282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508","11f8a8098557dfe45e8256e830b60ace62d613ac2f7b17bed31b6eaff6e26caf"],["175e159f728b865a72f99cc6c6fc846de0b93833fd2222ed73fce5b551e5b739","d3506e0d9e3c79eba4ef97a51ff71f5eacb5955add24345c6efa6ffee9fed695"],["363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640","4e273adfc732221953b445397f3363145b9a89008199ecb62003c7f3bee9de9"],["8b4b5f165df3c2be8c6244b5b745638843e4a781a15bcd1b69f79a55dffdf80c","4aad0a6f68d308b4b3fbd7813ab0da04f9e336546162ee56b3eff0c65fd4fd36"],["723cbaa6e5db996d6bf771c00bd548c7b700dbffa6c0e77bcb6115925232fcda","96e867b5595cc498a921137488824d6e2660a0653779494801dc069d9eb39f5f"],["eebfa4d493bebf98ba5feec812c2d3b50947961237a919839a533eca0e7dd7fa","5d9a8ca3970ef0f269ee7edaf178089d9ae4cdc3a711f712ddfd4fdae1de8999"],["100f44da696e71672791d0a09b7bde459f1215a29b3c03bfefd7835b39a48db0","cdd9e13192a00b772ec8f3300c090666b7ff4a18ff5195ac0fbd5cd62bc65a09"],["e1031be262c7ed1b1dc9227a4a04c017a77f8d4464f3b3852c8acde6e534fd2d","9d7061928940405e6bb6a4176597535af292dd419e1ced79a44f18f29456a00d"],["feea6cae46d55b530ac2839f143bd7ec5cf8b266a41d6af52d5e688d9094696d","e57c6b6c97dce1bab06e4e12bf3ecd5c981c8957cc41442d3155debf18090088"],["da67a91d91049cdcb367be4be6ffca3cfeed657d808583de33fa978bc1ec6cb1","9bacaa35481642bc41f463f7ec9780e5dec7adc508f740a17e9ea8e27a68be1d"],["53904faa0b334cdda6e000935ef22151ec08d0f7bb11069f57545ccc1a37b7c0","5bc087d0bc80106d88c9eccac20d3c1c13999981e14434699dcb096b022771c8"],["8e7bcd0bd35983a7719cca7764ca906779b53a043a9b8bcaeff959f43ad86047","10b7770b2a3da4b3940310420ca9514579e88e2e47fd68b3ea10047e8460372a"],["385eed34c1cdff21e6d0818689b81bde71a7f4f18397e6690a841e1599c43862","283bebc3e8ea23f56701de19e9ebf4576b304eec2086dc8cc0458fe5542e5453"],["6f9d9b803ecf191637c73a4413dfa180fddf84a5947fbc9c606ed86c3fac3a7","7c80c68e603059ba69b8e2a30e45c4d47ea4dd2f5c281002d86890603a842160"],["3322d401243c4e2582a2147c104d6ecbf774d163db0f5e5313b7e0e742d0e6bd","56e70797e9664ef5bfb019bc4ddaf9b72805f63ea2873af624f3a2e96c28b2a0"],["85672c7d2de0b7da2bd1770d89665868741b3f9af7643397721d74d28134ab83","7c481b9b5b43b2eb6374049bfa62c2e5e77f17fcc5298f44c8e3094f790313a6"],["948bf809b1988a46b06c9f1919413b10f9226c60f668832ffd959af60c82a0a","53a562856dcb6646dc6b74c5d1c3418c6d4dff08c97cd2bed4cb7f88d8c8e589"],["6260ce7f461801c34f067ce0f02873a8f1b0e44dfc69752accecd819f38fd8e8","bc2da82b6fa5b571a7f09049776a1ef7ecd292238051c198c1a84e95b2b4ae17"],["e5037de0afc1d8d43d8348414bbf4103043ec8f575bfdc432953cc8d2037fa2d","4571534baa94d3b5f9f98d09fb990bddbd5f5b03ec481f10e0e5dc841d755bda"],["e06372b0f4a207adf5ea905e8f1771b4e7e8dbd1c6a6c5b725866a0ae4fce725","7a908974bce18cfe12a27bb2ad5a488cd7484a7787104870b27034f94eee31dd"],["213c7a715cd5d45358d0bbf9dc0ce02204b10bdde2a3f58540ad6908d0559754","4b6dad0b5ae462507013ad06245ba190bb4850f5f36a7eeddff2c27534b458f2"],["4e7c272a7af4b34e8dbb9352a5419a87e2838c70adc62cddf0cc3a3b08fbd53c","17749c766c9d0b18e16fd09f6def681b530b9614bff7dd33e0b3941817dcaae6"],["fea74e3dbe778b1b10f238ad61686aa5c76e3db2be43057632427e2840fb27b6","6e0568db9b0b13297cf674deccb6af93126b596b973f7b77701d3db7f23cb96f"],["76e64113f677cf0e10a2570d599968d31544e179b760432952c02a4417bdde39","c90ddf8dee4e95cf577066d70681f0d35e2a33d2b56d2032b4b1752d1901ac01"],["c738c56b03b2abe1e8281baa743f8f9a8f7cc643df26cbee3ab150242bcbb891","893fb578951ad2537f718f2eacbfbbbb82314eef7880cfe917e735d9699a84c3"],["d895626548b65b81e264c7637c972877d1d72e5f3a925014372e9f6588f6c14b","febfaa38f2bc7eae728ec60818c340eb03428d632bb067e179363ed75d7d991f"],["b8da94032a957518eb0f6433571e8761ceffc73693e84edd49150a564f676e03","2804dfa44805a1e4d7c99cc9762808b092cc584d95ff3b511488e4e74efdf6e7"],["e80fea14441fb33a7d8adab9475d7fab2019effb5156a792f1a11778e3c0df5d","eed1de7f638e00771e89768ca3ca94472d155e80af322ea9fcb4291b6ac9ec78"],["a301697bdfcd704313ba48e51d567543f2a182031efd6915ddc07bbcc4e16070","7370f91cfb67e4f5081809fa25d40f9b1735dbf7c0a11a130c0d1a041e177ea1"],["90ad85b389d6b936463f9d0512678de208cc330b11307fffab7ac63e3fb04ed4","e507a3620a38261affdcbd9427222b839aefabe1582894d991d4d48cb6ef150"],["8f68b9d2f63b5f339239c1ad981f162ee88c5678723ea3351b7b444c9ec4c0da","662a9f2dba063986de1d90c2b6be215dbbea2cfe95510bfdf23cbf79501fff82"],["e4f3fb0176af85d65ff99ff9198c36091f48e86503681e3e6686fd5053231e11","1e63633ad0ef4f1c1661a6d0ea02b7286cc7e74ec951d1c9822c38576feb73bc"],["8c00fa9b18ebf331eb961537a45a4266c7034f2f0d4e1d0716fb6eae20eae29e","efa47267fea521a1a9dc343a3736c974c2fadafa81e36c54e7d2a4c66702414b"],["e7a26ce69dd4829f3e10cec0a9e98ed3143d084f308b92c0997fddfc60cb3e41","2a758e300fa7984b471b006a1aafbb18d0a6b2c0420e83e20e8a9421cf2cfd51"],["b6459e0ee3662ec8d23540c223bcbdc571cbcb967d79424f3cf29eb3de6b80ef","67c876d06f3e06de1dadf16e5661db3c4b3ae6d48e35b2ff30bf0b61a71ba45"],["d68a80c8280bb840793234aa118f06231d6f1fc67e73c5a5deda0f5b496943e8","db8ba9fff4b586d00c4b1f9177b0e28b5b0e7b8f7845295a294c84266b133120"],["324aed7df65c804252dc0270907a30b09612aeb973449cea4095980fc28d3d5d","648a365774b61f2ff130c0c35aec1f4f19213b0c7e332843967224af96ab7c84"],["4df9c14919cde61f6d51dfdbe5fee5dceec4143ba8d1ca888e8bd373fd054c96","35ec51092d8728050974c23a1d85d4b5d506cdc288490192ebac06cad10d5d"],["9c3919a84a474870faed8a9c1cc66021523489054d7f0308cbfc99c8ac1f98cd","ddb84f0f4a4ddd57584f044bf260e641905326f76c64c8e6be7e5e03d4fc599d"],["6057170b1dd12fdf8de05f281d8e06bb91e1493a8b91d4cc5a21382120a959e5","9a1af0b26a6a4807add9a2daf71df262465152bc3ee24c65e899be932385a2a8"],["a576df8e23a08411421439a4518da31880cef0fba7d4df12b1a6973eecb94266","40a6bf20e76640b2c92b97afe58cd82c432e10a7f514d9f3ee8be11ae1b28ec8"],["7778a78c28dec3e30a05fe9629de8c38bb30d1f5cf9a3a208f763889be58ad71","34626d9ab5a5b22ff7098e12f2ff580087b38411ff24ac563b513fc1fd9f43ac"],["928955ee637a84463729fd30e7afd2ed5f96274e5ad7e5cb09eda9c06d903ac","c25621003d3f42a827b78a13093a95eeac3d26efa8a8d83fc5180e935bcd091f"],["85d0fef3ec6db109399064f3a0e3b2855645b4a907ad354527aae75163d82751","1f03648413a38c0be29d496e582cf5663e8751e96877331582c237a24eb1f962"],["ff2b0dce97eece97c1c9b6041798b85dfdfb6d8882da20308f5404824526087e","493d13fef524ba188af4c4dc54d07936c7b7ed6fb90e2ceb2c951e01f0c29907"],["827fbbe4b1e880ea9ed2b2e6301b212b57f1ee148cd6dd28780e5e2cf856e241","c60f9c923c727b0b71bef2c67d1d12687ff7a63186903166d605b68baec293ec"],["eaa649f21f51bdbae7be4ae34ce6e5217a58fdce7f47f9aa7f3b58fa2120e2b3","be3279ed5bbbb03ac69a80f89879aa5a01a6b965f13f7e59d47a5305ba5ad93d"],["e4a42d43c5cf169d9391df6decf42ee541b6d8f0c9a137401e23632dda34d24f","4d9f92e716d1c73526fc99ccfb8ad34ce886eedfa8d8e4f13a7f7131deba9414"],["1ec80fef360cbdd954160fadab352b6b92b53576a88fea4947173b9d4300bf19","aeefe93756b5340d2f3a4958a7abbf5e0146e77f6295a07b671cdc1cc107cefd"],["146a778c04670c2f91b00af4680dfa8bce3490717d58ba889ddb5928366642be","b318e0ec3354028add669827f9d4b2870aaa971d2f7e5ed1d0b297483d83efd0"],["fa50c0f61d22e5f07e3acebb1aa07b128d0012209a28b9776d76a8793180eef9","6b84c6922397eba9b72cd2872281a68a5e683293a57a213b38cd8d7d3f4f2811"],["da1d61d0ca721a11b1a5bf6b7d88e8421a288ab5d5bba5220e53d32b5f067ec2","8157f55a7c99306c79c0766161c91e2966a73899d279b48a655fba0f1ad836f1"],["a8e282ff0c9706907215ff98e8fd416615311de0446f1e062a73b0610d064e13","7f97355b8db81c09abfb7f3c5b2515888b679a3e50dd6bd6cef7c73111f4cc0c"],["174a53b9c9a285872d39e56e6913cab15d59b1fa512508c022f382de8319497c","ccc9dc37abfc9c1657b4155f2c47f9e6646b3a1d8cb9854383da13ac079afa73"],["959396981943785c3d3e57edf5018cdbe039e730e4918b3d884fdff09475b7ba","2e7e552888c331dd8ba0386a4b9cd6849c653f64c8709385e9b8abf87524f2fd"],["d2a63a50ae401e56d645a1153b109a8fcca0a43d561fba2dbb51340c9d82b151","e82d86fb6443fcb7565aee58b2948220a70f750af484ca52d4142174dcf89405"],["64587e2335471eb890ee7896d7cfdc866bacbdbd3839317b3436f9b45617e073","d99fcdd5bf6902e2ae96dd6447c299a185b90a39133aeab358299e5e9faf6589"],["8481bde0e4e4d885b3a546d3e549de042f0aa6cea250e7fd358d6c86dd45e458","38ee7b8cba5404dd84a25bf39cecb2ca900a79c42b262e556d64b1b59779057e"],["13464a57a78102aa62b6979ae817f4637ffcfed3c4b1ce30bcd6303f6caf666b","69be159004614580ef7e433453ccb0ca48f300a81d0942e13f495a907f6ecc27"],["bc4a9df5b713fe2e9aef430bcc1dc97a0cd9ccede2f28588cada3a0d2d83f366","d3a81ca6e785c06383937adf4b798caa6e8a9fbfa547b16d758d666581f33c1"],["8c28a97bf8298bc0d23d8c749452a32e694b65e30a9472a3954ab30fe5324caa","40a30463a3305193378fedf31f7cc0eb7ae784f0451cb9459e71dc73cbef9482"],["8ea9666139527a8c1dd94ce4f071fd23c8b350c5a4bb33748c4ba111faccae0","620efabbc8ee2782e24e7c0cfb95c5d735b783be9cf0f8e955af34a30e62b945"],["dd3625faef5ba06074669716bbd3788d89bdde815959968092f76cc4eb9a9787","7a188fa3520e30d461da2501045731ca941461982883395937f68d00c644a573"],["f710d79d9eb962297e4f6232b40e8f7feb2bc63814614d692c12de752408221e","ea98e67232d3b3295d3b535532115ccac8612c721851617526ae47a9c77bfc82"]]},naf:{wnd:7,points:[["f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9","388f7b0f632de8140fe337e62a37f3566500a99934c2231b6cb9fd7584b8e672"],["2f8bde4d1a07209355b4a7250a5c5128e88b84bddc619ab7cba8d569b240efe4","d8ac222636e5e3d6d4dba9dda6c9c426f788271bab0d6840dca87d3aa6ac62d6"],["5cbdf0646e5db4eaa398f365f2ea7a0e3d419b7e0330e39ce92bddedcac4f9bc","6aebca40ba255960a3178d6d861a54dba813d0b813fde7b5a5082628087264da"],["acd484e2f0c7f65309ad178a9f559abde09796974c57e714c35f110dfc27ccbe","cc338921b0a7d9fd64380971763b61e9add888a4375f8e0f05cc262ac64f9c37"],["774ae7f858a9411e5ef4246b70c65aac5649980be5c17891bbec17895da008cb","d984a032eb6b5e190243dd56d7b7b365372db1e2dff9d6a8301d74c9c953c61b"],["f28773c2d975288bc7d1d205c3748651b075fbc6610e58cddeeddf8f19405aa8","ab0902e8d880a89758212eb65cdaf473a1a06da521fa91f29b5cb52db03ed81"],["d7924d4f7d43ea965a465ae3095ff41131e5946f3c85f79e44adbcf8e27e080e","581e2872a86c72a683842ec228cc6defea40af2bd896d3a5c504dc9ff6a26b58"],["defdea4cdb677750a420fee807eacf21eb9898ae79b9768766e4faa04a2d4a34","4211ab0694635168e997b0ead2a93daeced1f4a04a95c0f6cfb199f69e56eb77"],["2b4ea0a797a443d293ef5cff444f4979f06acfebd7e86d277475656138385b6c","85e89bc037945d93b343083b5a1c86131a01f60c50269763b570c854e5c09b7a"],["352bbf4a4cdd12564f93fa332ce333301d9ad40271f8107181340aef25be59d5","321eb4075348f534d59c18259dda3e1f4a1b3b2e71b1039c67bd3d8bcf81998c"],["2fa2104d6b38d11b0230010559879124e42ab8dfeff5ff29dc9cdadd4ecacc3f","2de1068295dd865b64569335bd5dd80181d70ecfc882648423ba76b532b7d67"],["9248279b09b4d68dab21a9b066edda83263c3d84e09572e269ca0cd7f5453714","73016f7bf234aade5d1aa71bdea2b1ff3fc0de2a887912ffe54a32ce97cb3402"],["daed4f2be3a8bf278e70132fb0beb7522f570e144bf615c07e996d443dee8729","a69dce4a7d6c98e8d4a1aca87ef8d7003f83c230f3afa726ab40e52290be1c55"],["c44d12c7065d812e8acf28d7cbb19f9011ecd9e9fdf281b0e6a3b5e87d22e7db","2119a460ce326cdc76c45926c982fdac0e106e861edf61c5a039063f0e0e6482"],["6a245bf6dc698504c89a20cfded60853152b695336c28063b61c65cbd269e6b4","e022cf42c2bd4a708b3f5126f16a24ad8b33ba48d0423b6efd5e6348100d8a82"],["1697ffa6fd9de627c077e3d2fe541084ce13300b0bec1146f95ae57f0d0bd6a5","b9c398f186806f5d27561506e4557433a2cf15009e498ae7adee9d63d01b2396"],["605bdb019981718b986d0f07e834cb0d9deb8360ffb7f61df982345ef27a7479","2972d2de4f8d20681a78d93ec96fe23c26bfae84fb14db43b01e1e9056b8c49"],["62d14dab4150bf497402fdc45a215e10dcb01c354959b10cfe31c7e9d87ff33d","80fc06bd8cc5b01098088a1950eed0db01aa132967ab472235f5642483b25eaf"],["80c60ad0040f27dade5b4b06c408e56b2c50e9f56b9b8b425e555c2f86308b6f","1c38303f1cc5c30f26e66bad7fe72f70a65eed4cbe7024eb1aa01f56430bd57a"],["7a9375ad6167ad54aa74c6348cc54d344cc5dc9487d847049d5eabb0fa03c8fb","d0e3fa9eca8726909559e0d79269046bdc59ea10c70ce2b02d499ec224dc7f7"],["d528ecd9b696b54c907a9ed045447a79bb408ec39b68df504bb51f459bc3ffc9","eecf41253136e5f99966f21881fd656ebc4345405c520dbc063465b521409933"],["49370a4b5f43412ea25f514e8ecdad05266115e4a7ecb1387231808f8b45963","758f3f41afd6ed428b3081b0512fd62a54c3f3afbb5b6764b653052a12949c9a"],["77f230936ee88cbbd73df930d64702ef881d811e0e1498e2f1c13eb1fc345d74","958ef42a7886b6400a08266e9ba1b37896c95330d97077cbbe8eb3c7671c60d6"],["f2dac991cc4ce4b9ea44887e5c7c0bce58c80074ab9d4dbaeb28531b7739f530","e0dedc9b3b2f8dad4da1f32dec2531df9eb5fbeb0598e4fd1a117dba703a3c37"],["463b3d9f662621fb1b4be8fbbe2520125a216cdfc9dae3debcba4850c690d45b","5ed430d78c296c3543114306dd8622d7c622e27c970a1de31cb377b01af7307e"],["f16f804244e46e2a09232d4aff3b59976b98fac14328a2d1a32496b49998f247","cedabd9b82203f7e13d206fcdf4e33d92a6c53c26e5cce26d6579962c4e31df6"],["caf754272dc84563b0352b7a14311af55d245315ace27c65369e15f7151d41d1","cb474660ef35f5f2a41b643fa5e460575f4fa9b7962232a5c32f908318a04476"],["2600ca4b282cb986f85d0f1709979d8b44a09c07cb86d7c124497bc86f082120","4119b88753c15bd6a693b03fcddbb45d5ac6be74ab5f0ef44b0be9475a7e4b40"],["7635ca72d7e8432c338ec53cd12220bc01c48685e24f7dc8c602a7746998e435","91b649609489d613d1d5e590f78e6d74ecfc061d57048bad9e76f302c5b9c61"],["754e3239f325570cdbbf4a87deee8a66b7f2b33479d468fbc1a50743bf56cc18","673fb86e5bda30fb3cd0ed304ea49a023ee33d0197a695d0c5d98093c536683"],["e3e6bd1071a1e96aff57859c82d570f0330800661d1c952f9fe2694691d9b9e8","59c9e0bba394e76f40c0aa58379a3cb6a5a2283993e90c4167002af4920e37f5"],["186b483d056a033826ae73d88f732985c4ccb1f32ba35f4b4cc47fdcf04aa6eb","3b952d32c67cf77e2e17446e204180ab21fb8090895138b4a4a797f86e80888b"],["df9d70a6b9876ce544c98561f4be4f725442e6d2b737d9c91a8321724ce0963f","55eb2dafd84d6ccd5f862b785dc39d4ab157222720ef9da217b8c45cf2ba2417"],["5edd5cc23c51e87a497ca815d5dce0f8ab52554f849ed8995de64c5f34ce7143","efae9c8dbc14130661e8cec030c89ad0c13c66c0d17a2905cdc706ab7399a868"],["290798c2b6476830da12fe02287e9e777aa3fba1c355b17a722d362f84614fba","e38da76dcd440621988d00bcf79af25d5b29c094db2a23146d003afd41943e7a"],["af3c423a95d9f5b3054754efa150ac39cd29552fe360257362dfdecef4053b45","f98a3fd831eb2b749a93b0e6f35cfb40c8cd5aa667a15581bc2feded498fd9c6"],["766dbb24d134e745cccaa28c99bf274906bb66b26dcf98df8d2fed50d884249a","744b1152eacbe5e38dcc887980da38b897584a65fa06cedd2c924f97cbac5996"],["59dbf46f8c94759ba21277c33784f41645f7b44f6c596a58ce92e666191abe3e","c534ad44175fbc300f4ea6ce648309a042ce739a7919798cd85e216c4a307f6e"],["f13ada95103c4537305e691e74e9a4a8dd647e711a95e73cb62dc6018cfd87b8","e13817b44ee14de663bf4bc808341f326949e21a6a75c2570778419bdaf5733d"],["7754b4fa0e8aced06d4167a2c59cca4cda1869c06ebadfb6488550015a88522c","30e93e864e669d82224b967c3020b8fa8d1e4e350b6cbcc537a48b57841163a2"],["948dcadf5990e048aa3874d46abef9d701858f95de8041d2a6828c99e2262519","e491a42537f6e597d5d28a3224b1bc25df9154efbd2ef1d2cbba2cae5347d57e"],["7962414450c76c1689c7b48f8202ec37fb224cf5ac0bfa1570328a8a3d7c77ab","100b610ec4ffb4760d5c1fc133ef6f6b12507a051f04ac5760afa5b29db83437"],["3514087834964b54b15b160644d915485a16977225b8847bb0dd085137ec47ca","ef0afbb2056205448e1652c48e8127fc6039e77c15c2378b7e7d15a0de293311"],["d3cc30ad6b483e4bc79ce2c9dd8bc54993e947eb8df787b442943d3f7b527eaf","8b378a22d827278d89c5e9be8f9508ae3c2ad46290358630afb34db04eede0a4"],["1624d84780732860ce1c78fcbfefe08b2b29823db913f6493975ba0ff4847610","68651cf9b6da903e0914448c6cd9d4ca896878f5282be4c8cc06e2a404078575"],["733ce80da955a8a26902c95633e62a985192474b5af207da6df7b4fd5fc61cd4","f5435a2bd2badf7d485a4d8b8db9fcce3e1ef8e0201e4578c54673bc1dc5ea1d"],["15d9441254945064cf1a1c33bbd3b49f8966c5092171e699ef258dfab81c045c","d56eb30b69463e7234f5137b73b84177434800bacebfc685fc37bbe9efe4070d"],["a1d0fcf2ec9de675b612136e5ce70d271c21417c9d2b8aaaac138599d0717940","edd77f50bcb5a3cab2e90737309667f2641462a54070f3d519212d39c197a629"],["e22fbe15c0af8ccc5780c0735f84dbe9a790badee8245c06c7ca37331cb36980","a855babad5cd60c88b430a69f53a1a7a38289154964799be43d06d77d31da06"],["311091dd9860e8e20ee13473c1155f5f69635e394704eaa74009452246cfa9b3","66db656f87d1f04fffd1f04788c06830871ec5a64feee685bd80f0b1286d8374"],["34c1fd04d301be89b31c0442d3e6ac24883928b45a9340781867d4232ec2dbdf","9414685e97b1b5954bd46f730174136d57f1ceeb487443dc5321857ba73abee"],["f219ea5d6b54701c1c14de5b557eb42a8d13f3abbcd08affcc2a5e6b049b8d63","4cb95957e83d40b0f73af4544cccf6b1f4b08d3c07b27fb8d8c2962a400766d1"],["d7b8740f74a8fbaab1f683db8f45de26543a5490bca627087236912469a0b448","fa77968128d9c92ee1010f337ad4717eff15db5ed3c049b3411e0315eaa4593b"],["32d31c222f8f6f0ef86f7c98d3a3335ead5bcd32abdd94289fe4d3091aa824bf","5f3032f5892156e39ccd3d7915b9e1da2e6dac9e6f26e961118d14b8462e1661"],["7461f371914ab32671045a155d9831ea8793d77cd59592c4340f86cbc18347b5","8ec0ba238b96bec0cbdddcae0aa442542eee1ff50c986ea6b39847b3cc092ff6"],["ee079adb1df1860074356a25aa38206a6d716b2c3e67453d287698bad7b2b2d6","8dc2412aafe3be5c4c5f37e0ecc5f9f6a446989af04c4e25ebaac479ec1c8c1e"],["16ec93e447ec83f0467b18302ee620f7e65de331874c9dc72bfd8616ba9da6b5","5e4631150e62fb40d0e8c2a7ca5804a39d58186a50e497139626778e25b0674d"],["eaa5f980c245f6f038978290afa70b6bd8855897f98b6aa485b96065d537bd99","f65f5d3e292c2e0819a528391c994624d784869d7e6ea67fb18041024edc07dc"],["78c9407544ac132692ee1910a02439958ae04877151342ea96c4b6b35a49f51","f3e0319169eb9b85d5404795539a5e68fa1fbd583c064d2462b675f194a3ddb4"],["494f4be219a1a77016dcd838431aea0001cdc8ae7a6fc688726578d9702857a5","42242a969283a5f339ba7f075e36ba2af925ce30d767ed6e55f4b031880d562c"],["a598a8030da6d86c6bc7f2f5144ea549d28211ea58faa70ebf4c1e665c1fe9b5","204b5d6f84822c307e4b4a7140737aec23fc63b65b35f86a10026dbd2d864e6b"],["c41916365abb2b5d09192f5f2dbeafec208f020f12570a184dbadc3e58595997","4f14351d0087efa49d245b328984989d5caf9450f34bfc0ed16e96b58fa9913"],["841d6063a586fa475a724604da03bc5b92a2e0d2e0a36acfe4c73a5514742881","73867f59c0659e81904f9a1c7543698e62562d6744c169ce7a36de01a8d6154"],["5e95bb399a6971d376026947f89bde2f282b33810928be4ded112ac4d70e20d5","39f23f366809085beebfc71181313775a99c9aed7d8ba38b161384c746012865"],["36e4641a53948fd476c39f8a99fd974e5ec07564b5315d8bf99471bca0ef2f66","d2424b1b1abe4eb8164227b085c9aa9456ea13493fd563e06fd51cf5694c78fc"],["336581ea7bfbbb290c191a2f507a41cf5643842170e914faeab27c2c579f726","ead12168595fe1be99252129b6e56b3391f7ab1410cd1e0ef3dcdcabd2fda224"],["8ab89816dadfd6b6a1f2634fcf00ec8403781025ed6890c4849742706bd43ede","6fdcef09f2f6d0a044e654aef624136f503d459c3e89845858a47a9129cdd24e"],["1e33f1a746c9c5778133344d9299fcaa20b0938e8acff2544bb40284b8c5fb94","60660257dd11b3aa9c8ed618d24edff2306d320f1d03010e33a7d2057f3b3b6"],["85b7c1dcb3cec1b7ee7f30ded79dd20a0ed1f4cc18cbcfcfa410361fd8f08f31","3d98a9cdd026dd43f39048f25a8847f4fcafad1895d7a633c6fed3c35e999511"],["29df9fbd8d9e46509275f4b125d6d45d7fbe9a3b878a7af872a2800661ac5f51","b4c4fe99c775a606e2d8862179139ffda61dc861c019e55cd2876eb2a27d84b"],["a0b1cae06b0a847a3fea6e671aaf8adfdfe58ca2f768105c8082b2e449fce252","ae434102edde0958ec4b19d917a6a28e6b72da1834aff0e650f049503a296cf2"],["4e8ceafb9b3e9a136dc7ff67e840295b499dfb3b2133e4ba113f2e4c0e121e5","cf2174118c8b6d7a4b48f6d534ce5c79422c086a63460502b827ce62a326683c"],["d24a44e047e19b6f5afb81c7ca2f69080a5076689a010919f42725c2b789a33b","6fb8d5591b466f8fc63db50f1c0f1c69013f996887b8244d2cdec417afea8fa3"],["ea01606a7a6c9cdd249fdfcfacb99584001edd28abbab77b5104e98e8e3b35d4","322af4908c7312b0cfbfe369f7a7b3cdb7d4494bc2823700cfd652188a3ea98d"],["af8addbf2b661c8a6c6328655eb96651252007d8c5ea31be4ad196de8ce2131f","6749e67c029b85f52a034eafd096836b2520818680e26ac8f3dfbcdb71749700"],["e3ae1974566ca06cc516d47e0fb165a674a3dabcfca15e722f0e3450f45889","2aeabe7e4531510116217f07bf4d07300de97e4874f81f533420a72eeb0bd6a4"],["591ee355313d99721cf6993ffed1e3e301993ff3ed258802075ea8ced397e246","b0ea558a113c30bea60fc4775460c7901ff0b053d25ca2bdeee98f1a4be5d196"],["11396d55fda54c49f19aa97318d8da61fa8584e47b084945077cf03255b52984","998c74a8cd45ac01289d5833a7beb4744ff536b01b257be4c5767bea93ea57a4"],["3c5d2a1ba39c5a1790000738c9e0c40b8dcdfd5468754b6405540157e017aa7a","b2284279995a34e2f9d4de7396fc18b80f9b8b9fdd270f6661f79ca4c81bd257"],["cc8704b8a60a0defa3a99a7299f2e9c3fbc395afb04ac078425ef8a1793cc030","bdd46039feed17881d1e0862db347f8cf395b74fc4bcdc4e940b74e3ac1f1b13"],["c533e4f7ea8555aacd9777ac5cad29b97dd4defccc53ee7ea204119b2889b197","6f0a256bc5efdf429a2fb6242f1a43a2d9b925bb4a4b3a26bb8e0f45eb596096"],["c14f8f2ccb27d6f109f6d08d03cc96a69ba8c34eec07bbcf566d48e33da6593","c359d6923bb398f7fd4473e16fe1c28475b740dd098075e6c0e8649113dc3a38"],["a6cbc3046bc6a450bac24789fa17115a4c9739ed75f8f21ce441f72e0b90e6ef","21ae7f4680e889bb130619e2c0f95a360ceb573c70603139862afd617fa9b9f"],["347d6d9a02c48927ebfb86c1359b1caf130a3c0267d11ce6344b39f99d43cc38","60ea7f61a353524d1c987f6ecec92f086d565ab687870cb12689ff1e31c74448"],["da6545d2181db8d983f7dcb375ef5866d47c67b1bf31c8cf855ef7437b72656a","49b96715ab6878a79e78f07ce5680c5d6673051b4935bd897fea824b77dc208a"],["c40747cc9d012cb1a13b8148309c6de7ec25d6945d657146b9d5994b8feb1111","5ca560753be2a12fc6de6caf2cb489565db936156b9514e1bb5e83037e0fa2d4"],["4e42c8ec82c99798ccf3a610be870e78338c7f713348bd34c8203ef4037f3502","7571d74ee5e0fb92a7a8b33a07783341a5492144cc54bcc40a94473693606437"],["3775ab7089bc6af823aba2e1af70b236d251cadb0c86743287522a1b3b0dedea","be52d107bcfa09d8bcb9736a828cfa7fac8db17bf7a76a2c42ad961409018cf7"],["cee31cbf7e34ec379d94fb814d3d775ad954595d1314ba8846959e3e82f74e26","8fd64a14c06b589c26b947ae2bcf6bfa0149ef0be14ed4d80f448a01c43b1c6d"],["b4f9eaea09b6917619f6ea6a4eb5464efddb58fd45b1ebefcdc1a01d08b47986","39e5c9925b5a54b07433a4f18c61726f8bb131c012ca542eb24a8ac07200682a"],["d4263dfc3d2df923a0179a48966d30ce84e2515afc3dccc1b77907792ebcc60e","62dfaf07a0f78feb30e30d6295853ce189e127760ad6cf7fae164e122a208d54"],["48457524820fa65a4f8d35eb6930857c0032acc0a4a2de422233eeda897612c4","25a748ab367979d98733c38a1fa1c2e7dc6cc07db2d60a9ae7a76aaa49bd0f77"],["dfeeef1881101f2cb11644f3a2afdfc2045e19919152923f367a1767c11cceda","ecfb7056cf1de042f9420bab396793c0c390bde74b4bbdff16a83ae09a9a7517"],["6d7ef6b17543f8373c573f44e1f389835d89bcbc6062ced36c82df83b8fae859","cd450ec335438986dfefa10c57fea9bcc521a0959b2d80bbf74b190dca712d10"],["e75605d59102a5a2684500d3b991f2e3f3c88b93225547035af25af66e04541f","f5c54754a8f71ee540b9b48728473e314f729ac5308b06938360990e2bfad125"],["eb98660f4c4dfaa06a2be453d5020bc99a0c2e60abe388457dd43fefb1ed620c","6cb9a8876d9cb8520609af3add26cd20a0a7cd8a9411131ce85f44100099223e"],["13e87b027d8514d35939f2e6892b19922154596941888336dc3563e3b8dba942","fef5a3c68059a6dec5d624114bf1e91aac2b9da568d6abeb2570d55646b8adf1"],["ee163026e9fd6fe017c38f06a5be6fc125424b371ce2708e7bf4491691e5764a","1acb250f255dd61c43d94ccc670d0f58f49ae3fa15b96623e5430da0ad6c62b2"],["b268f5ef9ad51e4d78de3a750c2dc89b1e626d43505867999932e5db33af3d80","5f310d4b3c99b9ebb19f77d41c1dee018cf0d34fd4191614003e945a1216e423"],["ff07f3118a9df035e9fad85eb6c7bfe42b02f01ca99ceea3bf7ffdba93c4750d","438136d603e858a3a5c440c38eccbaddc1d2942114e2eddd4740d098ced1f0d8"],["8d8b9855c7c052a34146fd20ffb658bea4b9f69e0d825ebec16e8c3ce2b526a1","cdb559eedc2d79f926baf44fb84ea4d44bcf50fee51d7ceb30e2e7f463036758"],["52db0b5384dfbf05bfa9d472d7ae26dfe4b851ceca91b1eba54263180da32b63","c3b997d050ee5d423ebaf66a6db9f57b3180c902875679de924b69d84a7b375"],["e62f9490d3d51da6395efd24e80919cc7d0f29c3f3fa48c6fff543becbd43352","6d89ad7ba4876b0b22c2ca280c682862f342c8591f1daf5170e07bfd9ccafa7d"],["7f30ea2476b399b4957509c88f77d0191afa2ff5cb7b14fd6d8e7d65aaab1193","ca5ef7d4b231c94c3b15389a5f6311e9daff7bb67b103e9880ef4bff637acaec"],["5098ff1e1d9f14fb46a210fada6c903fef0fb7b4a1dd1d9ac60a0361800b7a00","9731141d81fc8f8084d37c6e7542006b3ee1b40d60dfe5362a5b132fd17ddc0"],["32b78c7de9ee512a72895be6b9cbefa6e2f3c4ccce445c96b9f2c81e2778ad58","ee1849f513df71e32efc3896ee28260c73bb80547ae2275ba497237794c8753c"],["e2cb74fddc8e9fbcd076eef2a7c72b0ce37d50f08269dfc074b581550547a4f7","d3aa2ed71c9dd2247a62df062736eb0baddea9e36122d2be8641abcb005cc4a4"],["8438447566d4d7bedadc299496ab357426009a35f235cb141be0d99cd10ae3a8","c4e1020916980a4da5d01ac5e6ad330734ef0d7906631c4f2390426b2edd791f"],["4162d488b89402039b584c6fc6c308870587d9c46f660b878ab65c82c711d67e","67163e903236289f776f22c25fb8a3afc1732f2b84b4e95dbda47ae5a0852649"],["3fad3fa84caf0f34f0f89bfd2dcf54fc175d767aec3e50684f3ba4a4bf5f683d","cd1bc7cb6cc407bb2f0ca647c718a730cf71872e7d0d2a53fa20efcdfe61826"],["674f2600a3007a00568c1a7ce05d0816c1fb84bf1370798f1c69532faeb1a86b","299d21f9413f33b3edf43b257004580b70db57da0b182259e09eecc69e0d38a5"],["d32f4da54ade74abb81b815ad1fb3b263d82d6c692714bcff87d29bd5ee9f08f","f9429e738b8e53b968e99016c059707782e14f4535359d582fc416910b3eea87"],["30e4e670435385556e593657135845d36fbb6931f72b08cb1ed954f1e3ce3ff6","462f9bce619898638499350113bbc9b10a878d35da70740dc695a559eb88db7b"],["be2062003c51cc3004682904330e4dee7f3dcd10b01e580bf1971b04d4cad297","62188bc49d61e5428573d48a74e1c655b1c61090905682a0d5558ed72dccb9bc"],["93144423ace3451ed29e0fb9ac2af211cb6e84a601df5993c419859fff5df04a","7c10dfb164c3425f5c71a3f9d7992038f1065224f72bb9d1d902a6d13037b47c"],["b015f8044f5fcbdcf21ca26d6c34fb8197829205c7b7d2a7cb66418c157b112c","ab8c1e086d04e813744a655b2df8d5f83b3cdc6faa3088c1d3aea1454e3a1d5f"],["d5e9e1da649d97d89e4868117a465a3a4f8a18de57a140d36b3f2af341a21b52","4cb04437f391ed73111a13cc1d4dd0db1693465c2240480d8955e8592f27447a"],["d3ae41047dd7ca065dbf8ed77b992439983005cd72e16d6f996a5316d36966bb","bd1aeb21ad22ebb22a10f0303417c6d964f8cdd7df0aca614b10dc14d125ac46"],["463e2763d885f958fc66cdd22800f0a487197d0a82e377b49f80af87c897b065","bfefacdb0e5d0fd7df3a311a94de062b26b80c61fbc97508b79992671ef7ca7f"],["7985fdfd127c0567c6f53ec1bb63ec3158e597c40bfe747c83cddfc910641917","603c12daf3d9862ef2b25fe1de289aed24ed291e0ec6708703a5bd567f32ed03"],["74a1ad6b5f76e39db2dd249410eac7f99e74c59cb83d2d0ed5ff1543da7703e9","cc6157ef18c9c63cd6193d83631bbea0093e0968942e8c33d5737fd790e0db08"],["30682a50703375f602d416664ba19b7fc9bab42c72747463a71d0896b22f6da3","553e04f6b018b4fa6c8f39e7f311d3176290d0e0f19ca73f17714d9977a22ff8"],["9e2158f0d7c0d5f26c3791efefa79597654e7a2b2464f52b1ee6c1347769ef57","712fcdd1b9053f09003a3481fa7762e9ffd7c8ef35a38509e2fbf2629008373"],["176e26989a43c9cfeba4029c202538c28172e566e3c4fce7322857f3be327d66","ed8cc9d04b29eb877d270b4878dc43c19aefd31f4eee09ee7b47834c1fa4b1c3"],["75d46efea3771e6e68abb89a13ad747ecf1892393dfc4f1b7004788c50374da8","9852390a99507679fd0b86fd2b39a868d7efc22151346e1a3ca4726586a6bed8"],["809a20c67d64900ffb698c4c825f6d5f2310fb0451c869345b7319f645605721","9e994980d9917e22b76b061927fa04143d096ccc54963e6a5ebfa5f3f8e286c1"],["1b38903a43f7f114ed4500b4eac7083fdefece1cf29c63528d563446f972c180","4036edc931a60ae889353f77fd53de4a2708b26b6f5da72ad3394119daf408f9"]]}}},function(t,e,r){"use strict";var i=r(10),n=r(83),s=r(6),o=r(38),a=r(47),u=s.assert,f=r(84),h=r(85);function c(t){if(!(this instanceof c))return new c(t);"string"==typeof t&&(u(Object.prototype.hasOwnProperty.call(o,t),"Unknown curve "+t),t=o[t]),t instanceof o.PresetCurve&&(t={curve:t}),this.curve=t.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=t.curve.g,this.g.precompute(t.curve.n.bitLength()+1),this.hash=t.hash||t.curve.hash}t.exports=c,c.prototype.keyPair=function(t){return new f(this,t)},c.prototype.keyFromPrivate=function(t,e){return f.fromPrivate(this,t,e)},c.prototype.keyFromPublic=function(t,e){return f.fromPublic(this,t,e)},c.prototype.genKeyPair=function(t){t||(t={});for(var e=new n({hash:this.hash,pers:t.pers,persEnc:t.persEnc||"utf8",entropy:t.entropy||a(this.hash.hmacStrength),entropyEnc:t.entropy&&t.entropyEnc||"utf8",nonce:this.n.toArray()}),r=this.n.byteLength(),s=this.n.sub(new i(2));;){var o=new i(e.generate(r));if(!(o.cmp(s)>0))return o.iaddn(1),this.keyFromPrivate(o)}},c.prototype._truncateToN=function(t,e){var r=8*t.byteLength()-this.n.bitLength();return r>0&&(t=t.ushrn(r)),!e&&t.cmp(this.n)>=0?t.sub(this.n):t},c.prototype.sign=function(t,e,r,s){"object"==typeof r&&(s=r,r=null),s||(s={}),e=this.keyFromPrivate(e,r),t=this._truncateToN(new i(t,16));for(var o=this.n.byteLength(),a=e.getPrivate().toArray("be",o),u=t.toArray("be",o),f=new n({hash:this.hash,entropy:a,nonce:u,pers:s.pers,persEnc:s.persEnc||"utf8"}),c=this.n.sub(new i(1)),d=0;;d++){var p=s.k?s.k(d):new i(f.generate(this.n.byteLength()));if(!((p=this._truncateToN(p,!0)).cmpn(1)<=0||p.cmp(c)>=0)){var l=this.g.mul(p);if(!l.isInfinity()){var m=l.getX(),b=m.umod(this.n);if(0!==b.cmpn(0)){var g=p.invm(this.n).mul(b.mul(e.getPrivate()).iadd(t));if(0!==(g=g.umod(this.n)).cmpn(0)){var y=(l.getY().isOdd()?1:0)|(0!==m.cmp(b)?2:0);return s.canonical&&g.cmp(this.nh)>0&&(g=this.n.sub(g),y^=1),new h({r:b,s:g,recoveryParam:y})}}}}}},c.prototype.verify=function(t,e,r,n){t=this._truncateToN(new i(t,16)),r=this.keyFromPublic(r,n);var s=(e=new h(e,"hex")).r,o=e.s;if(s.cmpn(1)<0||s.cmp(this.n)>=0)return!1;if(o.cmpn(1)<0||o.cmp(this.n)>=0)return!1;var a,u=o.invm(this.n),f=u.mul(t).umod(this.n),c=u.mul(s).umod(this.n);return this.curve._maxwellTrick?!(a=this.g.jmulAdd(f,r.getPublic(),c)).isInfinity()&&a.eqXToP(s):!(a=this.g.mulAdd(f,r.getPublic(),c)).isInfinity()&&0===a.getX().umod(this.n).cmp(s)},c.prototype.recoverPubKey=function(t,e,r,n){u((3&r)===r,"The recovery param is more than two bits"),e=new h(e,n);var s=this.n,o=new i(t),a=e.r,f=e.s,c=1&r,d=r>>1;if(a.cmp(this.curve.p.umod(this.curve.n))>=0&&d)throw new Error("Unable to find sencond key candinate");a=d?this.curve.pointFromX(a.add(this.curve.n),c):this.curve.pointFromX(a,c);var p=e.r.invm(s),l=s.sub(o).mul(p).umod(s),m=f.mul(p).umod(s);return this.g.mulAdd(l,a,m)},c.prototype.getKeyRecoveryParam=function(t,e,r,i){if(null!==(e=new h(e,i)).recoveryParam)return e.recoveryParam;for(var n=0;n<4;n++){var s;try{s=this.recoverPubKey(t,e,n)}catch(t){continue}if(s.eq(r))return n}throw new Error("Unable to find valid recovery factor")}},function(t,e,r){"use strict";var i=r(28),n=r(46),s=r(17);function o(t){if(!(this instanceof o))return new o(t);this.hash=t.hash,this.predResist=!!t.predResist,this.outLen=this.hash.outSize,this.minEntropy=t.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var e=n.toArray(t.entropy,t.entropyEnc||"hex"),r=n.toArray(t.nonce,t.nonceEnc||"hex"),i=n.toArray(t.pers,t.persEnc||"hex");s(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,r,i)}t.exports=o,o.prototype._init=function(t,e,r){var i=t.concat(e).concat(r);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var n=0;n<this.V.length;n++)this.K[n]=0,this.V[n]=1;this._update(i),this._reseed=1,this.reseedInterval=281474976710656},o.prototype._hmac=function(){return new i.hmac(this.hash,this.K)},o.prototype._update=function(t){var e=this._hmac().update(this.V).update([0]);t&&(e=e.update(t)),this.K=e.digest(),this.V=this._hmac().update(this.V).digest(),t&&(this.K=this._hmac().update(this.V).update([1]).update(t).digest(),this.V=this._hmac().update(this.V).digest())},o.prototype.reseed=function(t,e,r,i){"string"!=typeof e&&(i=r,r=e,e=null),t=n.toArray(t,e),r=n.toArray(r,i),s(t.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(t.concat(r||[])),this._reseed=1},o.prototype.generate=function(t,e,r,i){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");"string"!=typeof e&&(i=r,r=e,e=null),r&&(r=n.toArray(r,i||"hex"),this._update(r));for(var s=[];s.length<t;)this.V=this._hmac().update(this.V).digest(),s=s.concat(this.V);var o=s.slice(0,t);return this._update(r),this._reseed++,n.encode(o,e)}},function(t,e,r){"use strict";var i=r(10),n=r(6).assert;function s(t,e){this.ec=t,this.priv=null,this.pub=null,e.priv&&this._importPrivate(e.priv,e.privEnc),e.pub&&this._importPublic(e.pub,e.pubEnc)}t.exports=s,s.fromPublic=function(t,e,r){return e instanceof s?e:new s(t,{pub:e,pubEnc:r})},s.fromPrivate=function(t,e,r){return e instanceof s?e:new s(t,{priv:e,privEnc:r})},s.prototype.validate=function(){var t=this.getPublic();return t.isInfinity()?{result:!1,reason:"Invalid public key"}:t.validate()?t.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}},s.prototype.getPublic=function(t,e){return"string"==typeof t&&(e=t,t=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),e?this.pub.encode(e,t):this.pub},s.prototype.getPrivate=function(t){return"hex"===t?this.priv.toString(16,2):this.priv},s.prototype._importPrivate=function(t,e){this.priv=new i(t,e||16),this.priv=this.priv.umod(this.ec.curve.n)},s.prototype._importPublic=function(t,e){if(t.x||t.y)return"mont"===this.ec.curve.type?n(t.x,"Need x coordinate"):"short"!==this.ec.curve.type&&"edwards"!==this.ec.curve.type||n(t.x&&t.y,"Need both x and y coordinate"),void(this.pub=this.ec.curve.point(t.x,t.y));this.pub=this.ec.curve.decodePoint(t,e)},s.prototype.derive=function(t){return t.validate()||n(t.validate(),"public point not validated"),t.mul(this.priv).getX()},s.prototype.sign=function(t,e,r){return this.ec.sign(t,this,e,r)},s.prototype.verify=function(t,e){return this.ec.verify(t,e,this)},s.prototype.inspect=function(){return"<Key priv: "+(this.priv&&this.priv.toString(16,2))+" pub: "+(this.pub&&this.pub.inspect())+" >"}},function(t,e,r){"use strict";var i=r(10),n=r(6),s=n.assert;function o(t,e){if(t instanceof o)return t;this._importDER(t,e)||(s(t.r&&t.s,"Signature without r or s"),this.r=new i(t.r,16),this.s=new i(t.s,16),void 0===t.recoveryParam?this.recoveryParam=null:this.recoveryParam=t.recoveryParam)}function a(){this.place=0}function u(t,e){var r=t[e.place++];if(!(128&r))return r;var i=15&r;if(0===i||i>4)return!1;for(var n=0,s=0,o=e.place;s<i;s++,o++)n<<=8,n|=t[o],n>>>=0;return!(n<=127)&&(e.place=o,n)}function f(t){for(var e=0,r=t.length-1;!t[e]&&!(128&t[e+1])&&e<r;)e++;return 0===e?t:t.slice(e)}function h(t,e){if(e<128)t.push(e);else{var r=1+(Math.log(e)/Math.LN2>>>3);for(t.push(128|r);--r;)t.push(e>>>(r<<3)&255);t.push(e)}}t.exports=o,o.prototype._importDER=function(t,e){t=n.toArray(t,e);var r=new a;if(48!==t[r.place++])return!1;var s=u(t,r);if(!1===s)return!1;if(s+r.place!==t.length)return!1;if(2!==t[r.place++])return!1;var o=u(t,r);if(!1===o)return!1;var f=t.slice(r.place,o+r.place);if(r.place+=o,2!==t[r.place++])return!1;var h=u(t,r);if(!1===h)return!1;if(t.length!==h+r.place)return!1;var c=t.slice(r.place,h+r.place);if(0===f[0]){if(!(128&f[1]))return!1;f=f.slice(1)}if(0===c[0]){if(!(128&c[1]))return!1;c=c.slice(1)}return this.r=new i(f),this.s=new i(c),this.recoveryParam=null,!0},o.prototype.toDER=function(t){var e=this.r.toArray(),r=this.s.toArray();for(128&e[0]&&(e=[0].concat(e)),128&r[0]&&(r=[0].concat(r)),e=f(e),r=f(r);!(r[0]||128&r[1]);)r=r.slice(1);var i=[2];h(i,e.length),(i=i.concat(e)).push(2),h(i,r.length);var s=i.concat(r),o=[48];return h(o,s.length),o=o.concat(s),n.encode(o,t)}},function(t,e,r){"use strict";var i=r(28),n=r(38),s=r(6),o=s.assert,a=s.parseBytes,u=r(87),f=r(88);function h(t){if(o("ed25519"===t,"only tested with ed25519 so far"),!(this instanceof h))return new h(t);t=n[t].curve,this.curve=t,this.g=t.g,this.g.precompute(t.n.bitLength()+1),this.pointClass=t.point().constructor,this.encodingLength=Math.ceil(t.n.bitLength()/8),this.hash=i.sha512}t.exports=h,h.prototype.sign=function(t,e){t=a(t);var r=this.keyFromSecret(e),i=this.hashInt(r.messagePrefix(),t),n=this.g.mul(i),s=this.encodePoint(n),o=this.hashInt(s,r.pubBytes(),t).mul(r.priv()),u=i.add(o).umod(this.curve.n);return this.makeSignature({R:n,S:u,Rencoded:s})},h.prototype.verify=function(t,e,r){t=a(t),e=this.makeSignature(e);var i=this.keyFromPublic(r),n=this.hashInt(e.Rencoded(),i.pubBytes(),t),s=this.g.mul(e.S());return e.R().add(i.pub().mul(n)).eq(s)},h.prototype.hashInt=function(){for(var t=this.hash(),e=0;e<arguments.length;e++)t.update(arguments[e]);return s.intFromLE(t.digest()).umod(this.curve.n)},h.prototype.keyFromPublic=function(t){return u.fromPublic(this,t)},h.prototype.keyFromSecret=function(t){return u.fromSecret(this,t)},h.prototype.makeSignature=function(t){return t instanceof f?t:new f(this,t)},h.prototype.encodePoint=function(t){var e=t.getY().toArray("le",this.encodingLength);return e[this.encodingLength-1]|=t.getX().isOdd()?128:0,e},h.prototype.decodePoint=function(t){var e=(t=s.parseBytes(t)).length-1,r=t.slice(0,e).concat(-129&t[e]),i=0!=(128&t[e]),n=s.intFromLE(r);return this.curve.pointFromY(n,i)},h.prototype.encodeInt=function(t){return t.toArray("le",this.encodingLength)},h.prototype.decodeInt=function(t){return s.intFromLE(t)},h.prototype.isPoint=function(t){return t instanceof this.pointClass}},function(t,e,r){"use strict";var i=r(6),n=i.assert,s=i.parseBytes,o=i.cachedProperty;function a(t,e){this.eddsa=t,this._secret=s(e.secret),t.isPoint(e.pub)?this._pub=e.pub:this._pubBytes=s(e.pub)}a.fromPublic=function(t,e){return e instanceof a?e:new a(t,{pub:e})},a.fromSecret=function(t,e){return e instanceof a?e:new a(t,{secret:e})},a.prototype.secret=function(){return this._secret},o(a,"pubBytes",(function(){return this.eddsa.encodePoint(this.pub())})),o(a,"pub",(function(){return this._pubBytes?this.eddsa.decodePoint(this._pubBytes):this.eddsa.g.mul(this.priv())})),o(a,"privBytes",(function(){var t=this.eddsa,e=this.hash(),r=t.encodingLength-1,i=e.slice(0,t.encodingLength);return i[0]&=248,i[r]&=127,i[r]|=64,i})),o(a,"priv",(function(){return this.eddsa.decodeInt(this.privBytes())})),o(a,"hash",(function(){return this.eddsa.hash().update(this.secret()).digest()})),o(a,"messagePrefix",(function(){return this.hash().slice(this.eddsa.encodingLength)})),a.prototype.sign=function(t){return n(this._secret,"KeyPair can only verify"),this.eddsa.sign(t,this)},a.prototype.verify=function(t,e){return this.eddsa.verify(t,e,this)},a.prototype.getSecret=function(t){return n(this._secret,"KeyPair is public only"),i.encode(this.secret(),t)},a.prototype.getPublic=function(t){return i.encode(this.pubBytes(),t)},t.exports=a},function(t,e,r){"use strict";var i=r(10),n=r(6),s=n.assert,o=n.cachedProperty,a=n.parseBytes;function u(t,e){this.eddsa=t,"object"!=typeof e&&(e=a(e)),Array.isArray(e)&&(e={R:e.slice(0,t.encodingLength),S:e.slice(t.encodingLength)}),s(e.R&&e.S,"Signature without R or S"),t.isPoint(e.R)&&(this._R=e.R),e.S instanceof i&&(this._S=e.S),this._Rencoded=Array.isArray(e.R)?e.R:e.Rencoded,this._Sencoded=Array.isArray(e.S)?e.S:e.Sencoded}o(u,"S",(function(){return this.eddsa.decodeInt(this.Sencoded())})),o(u,"R",(function(){return this.eddsa.decodePoint(this.Rencoded())})),o(u,"Rencoded",(function(){return this.eddsa.encodePoint(this.R())})),o(u,"Sencoded",(function(){return this.eddsa.encodeInt(this.S())})),u.prototype.toBytes=function(){return this.Rencoded().concat(this.Sencoded())},u.prototype.toHex=function(){return n.encode(this.toBytes(),"hex").toUpperCase()},t.exports=u},function(t,e,r){"use strict";(function(e){var i=r(36),n=r(52),s=r(2),o=t.exports;o.sha1=function(t){return s.checkArgument(e.isBuffer(t)),i.createHash("sha1").update(t).digest()},o.sha1.blocksize=512,o.sha256=function(t){return s.checkArgument(e.isBuffer(t)),i.createHash("sha256").update(t).digest()},o.sha256.blocksize=512,o.sha256sha256=function(t){return s.checkArgument(e.isBuffer(t)),o.sha256(o.sha256(t))},o.sha512_256=function(t){s.checkArgument(e.isBuffer(t));const r=n.sha512_256(t);return e.from(r,"hex")},o.sha512_256sha512_256=function(t){return s.checkArgument(e.isBuffer(t)),o.sha512_256(o.sha512_256(t))},o.ripemd160=function(t){return s.checkArgument(e.isBuffer(t)),i.createHash("ripemd160").update(t).digest()},o.sha256ripemd160=function(t){return s.checkArgument(e.isBuffer(t)),o.ripemd160(o.sha256(t))},o.sha512=function(t){return s.checkArgument(e.isBuffer(t)),i.createHash("sha512").update(t).digest()},o.sha512.blocksize=1024,o.hmac=function(t,r,i){s.checkArgument(e.isBuffer(r)),s.checkArgument(e.isBuffer(i)),s.checkArgument(t.blocksize);var n=t.blocksize/8;if(i.length>n)i=t(i);else if(i<n){var o=e.alloc(n);o.fill(0),i.copy(o),i=o}var a=e.alloc(n);a.fill(92);var u=e.alloc(n);u.fill(54);for(var f=e.alloc(n),h=e.alloc(n),c=0;c<n;c++)f[c]=a[c]^i[c],h[c]=u[c]^i[c];return t(e.concat([f,t(e.concat([h,r]))]))},o.sha256hmac=function(t,e){return o.hmac(o.sha256,t,e)},o.sha512hmac=function(t,e){return o.hmac(o.sha512,t,e)}}).call(this,r(0).Buffer)},function(t,e){(function(e){t.exports=e}).call(this,{})},function(t,e,r){"use strict";var i=r(92).Buffer;t.exports=function(t){if(t.length>=255)throw new TypeError("Alphabet too long");var e=new Uint8Array(256);e.fill(255);for(var r=0;r<t.length;r++){var n=t.charAt(r),s=n.charCodeAt(0);if(255!==e[s])throw new TypeError(n+" is ambiguous");e[s]=r}var o=t.length,a=t.charAt(0),u=Math.log(o)/Math.log(256),f=Math.log(256)/Math.log(o);function h(t){if("string"!=typeof t)throw new TypeError("Expected String");if(0===t.length)return i.alloc(0);var r=0;if(" "!==t[r]){for(var n=0,s=0;t[r]===a;)n++,r++;for(var f=(t.length-r)*u+1>>>0,h=new Uint8Array(f);t[r];){var c=e[t.charCodeAt(r)];if(255===c)return;for(var d=0,p=f-1;(0!==c||d<s)&&-1!==p;p--,d++)c+=o*h[p]>>>0,h[p]=c%256>>>0,c=c/256>>>0;if(0!==c)throw new Error("Non-zero carry");s=d,r++}if(" "!==t[r]){for(var l=f-s;l!==f&&0===h[l];)l++;var m=i.allocUnsafe(n+(f-l));m.fill(0,0,n);for(var b=n;l!==f;)m[b++]=h[l++];return m}}}return{encode:function(e){if(!i.isBuffer(e))throw new TypeError("Expected Buffer");if(0===e.length)return"";for(var r=0,n=0,s=0,u=e.length;s!==u&&0===e[s];)s++,r++;for(var h=(u-s)*f+1>>>0,c=new Uint8Array(h);s!==u;){for(var d=e[s],p=0,l=h-1;(0!==d||p<n)&&-1!==l;l--,p++)d+=256*c[l]>>>0,c[l]=d%o>>>0,d=d/o>>>0;if(0!==d)throw new Error("Non-zero carry");n=p,s++}for(var m=h-n;m!==h&&0===c[m];)m++;for(var b=a.repeat(r);m<h;++m)b+=t.charAt(c[m]);return b},decodeUnsafe:h,decode:function(t){var e=h(t);if(e)return e;throw new Error("Non-base"+o+" character")}}}},function(t,e,r){var i=r(0),n=i.Buffer;function s(t,e){for(var r in t)e[r]=t[r]}function o(t,e,r){return n(t,e,r)}n.from&&n.alloc&&n.allocUnsafe&&n.allocUnsafeSlow?t.exports=i:(s(i,e),e.Buffer=o),o.prototype=Object.create(n.prototype),s(n,o),o.from=function(t,e,r){if("number"==typeof t)throw new TypeError("Argument must not be a number");return n(t,e,r)},o.alloc=function(t,e,r){if("number"!=typeof t)throw new TypeError("Argument must be a number");var i=n(t);return void 0!==e?"string"==typeof r?i.fill(e,r):i.fill(e):i.fill(0),i},o.allocUnsafe=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return n(t)},o.allocUnsafeSlow=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return i.SlowBuffer(t)}},function(t,e,r){"use strict";
/*
object-assign
(c) Sindre Sorhus
@license MIT
*/var i=Object.getOwnPropertySymbols,n=Object.prototype.hasOwnProperty,s=Object.prototype.propertyIsEnumerable;function o(t){if(null==t)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(t)}t.exports=function(){try{if(!Object.assign)return!1;var t=new String("abc");if(t[5]="de","5"===Object.getOwnPropertyNames(t)[0])return!1;for(var e={},r=0;r<10;r++)e["_"+String.fromCharCode(r)]=r;if("0123456789"!==Object.getOwnPropertyNames(e).map((function(t){return e[t]})).join(""))return!1;var i={};return"abcdefghijklmnopqrst".split("").forEach((function(t){i[t]=t})),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},i)).join("")}catch(t){return!1}}()?Object.assign:function(t,e){for(var r,a,u=o(t),f=1;f<arguments.length;f++){for(var h in r=Object(arguments[f]))n.call(r,h)&&(u[h]=r[h]);if(i){a=i(r);for(var c=0;c<a.length;c++)s.call(r,a[c])&&(u[a[c]]=r[a[c]])}}return u}},function(t,e,r){(function(t){var i=Object.getOwnPropertyDescriptors||function(t){for(var e=Object.keys(t),r={},i=0;i<e.length;i++)r[e[i]]=Object.getOwnPropertyDescriptor(t,e[i]);return r},n=/%[sdj%]/g;e.format=function(t){if(!g(t)){for(var e=[],r=0;r<arguments.length;r++)e.push(a(arguments[r]));return e.join(" ")}r=1;for(var i=arguments,s=i.length,o=String(t).replace(n,(function(t){if("%%"===t)return"%";if(r>=s)return t;switch(t){case"%s":return String(i[r++]);case"%d":return Number(i[r++]);case"%j":try{return JSON.stringify(i[r++])}catch(t){return"[Circular]"}default:return t}})),u=i[r];r<s;u=i[++r])m(u)||!_(u)?o+=" "+u:o+=" "+a(u);return o},e.deprecate=function(r,i){if(void 0!==t&&!0===t.noDeprecation)return r;if(void 0===t)return function(){return e.deprecate(r,i).apply(this,arguments)};var n=!1;return function(){if(!n){if(t.throwDeprecation)throw new Error(i);t.traceDeprecation?console.trace(i):console.error(i),n=!0}return r.apply(this,arguments)}};var s,o={};function a(t,r){var i={seen:[],stylize:f};return arguments.length>=3&&(i.depth=arguments[2]),arguments.length>=4&&(i.colors=arguments[3]),l(r)?i.showHidden=r:r&&e._extend(i,r),y(i.showHidden)&&(i.showHidden=!1),y(i.depth)&&(i.depth=2),y(i.colors)&&(i.colors=!1),y(i.customInspect)&&(i.customInspect=!0),i.colors&&(i.stylize=u),h(i,t,i.depth)}function u(t,e){var r=a.styles[e];return r?"["+a.colors[r][0]+"m"+t+"["+a.colors[r][1]+"m":t}function f(t,e){return t}function h(t,r,i){if(t.customInspect&&r&&I(r.inspect)&&r.inspect!==e.inspect&&(!r.constructor||r.constructor.prototype!==r)){var n=r.inspect(i,t);return g(n)||(n=h(t,n,i)),n}var s=function(t,e){if(y(e))return t.stylize("undefined","undefined");if(g(e)){var r="'"+JSON.stringify(e).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return t.stylize(r,"string")}if(b(e))return t.stylize(""+e,"number");if(l(e))return t.stylize(""+e,"boolean");if(m(e))return t.stylize("null","null")}(t,r);if(s)return s;var o=Object.keys(r),a=function(t){var e={};return t.forEach((function(t,r){e[t]=!0})),e}(o);if(t.showHidden&&(o=Object.getOwnPropertyNames(r)),w(r)&&(o.indexOf("message")>=0||o.indexOf("description")>=0))return c(r);if(0===o.length){if(I(r)){var u=r.name?": "+r.name:"";return t.stylize("[Function"+u+"]","special")}if(v(r))return t.stylize(RegExp.prototype.toString.call(r),"regexp");if(S(r))return t.stylize(Date.prototype.toString.call(r),"date");if(w(r))return c(r)}var f,_="",E=!1,A=["{","}"];(p(r)&&(E=!0,A=["[","]"]),I(r))&&(_=" [Function"+(r.name?": "+r.name:"")+"]");return v(r)&&(_=" "+RegExp.prototype.toString.call(r)),S(r)&&(_=" "+Date.prototype.toUTCString.call(r)),w(r)&&(_=" "+c(r)),0!==o.length||E&&0!=r.length?i<0?v(r)?t.stylize(RegExp.prototype.toString.call(r),"regexp"):t.stylize("[Object]","special"):(t.seen.push(r),f=E?function(t,e,r,i,n){for(var s=[],o=0,a=e.length;o<a;++o)M(e,String(o))?s.push(d(t,e,r,i,String(o),!0)):s.push("");return n.forEach((function(n){n.match(/^\d+$/)||s.push(d(t,e,r,i,n,!0))})),s}(t,r,i,a,o):o.map((function(e){return d(t,r,i,a,e,E)})),t.seen.pop(),function(t,e,r){if(t.reduce((function(t,e){return e.indexOf("\n")>=0&&0,t+e.replace(/\u001b\[\d\d?m/g,"").length+1}),0)>60)return r[0]+(""===e?"":e+"\n ")+" "+t.join(",\n ")+" "+r[1];return r[0]+e+" "+t.join(", ")+" "+r[1]}(f,_,A)):A[0]+_+A[1]}function c(t){return"["+Error.prototype.toString.call(t)+"]"}function d(t,e,r,i,n,s){var o,a,u;if((u=Object.getOwnPropertyDescriptor(e,n)||{value:e[n]}).get?a=u.set?t.stylize("[Getter/Setter]","special"):t.stylize("[Getter]","special"):u.set&&(a=t.stylize("[Setter]","special")),M(i,n)||(o="["+n+"]"),a||(t.seen.indexOf(u.value)<0?(a=m(r)?h(t,u.value,null):h(t,u.value,r-1)).indexOf("\n")>-1&&(a=s?a.split("\n").map((function(t){return" "+t})).join("\n").substr(2):"\n"+a.split("\n").map((function(t){return" "+t})).join("\n")):a=t.stylize("[Circular]","special")),y(o)){if(s&&n.match(/^\d+$/))return a;(o=JSON.stringify(""+n)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(o=o.substr(1,o.length-2),o=t.stylize(o,"name")):(o=o.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),o=t.stylize(o,"string"))}return o+": "+a}function p(t){return Array.isArray(t)}function l(t){return"boolean"==typeof t}function m(t){return null===t}function b(t){return"number"==typeof t}function g(t){return"string"==typeof t}function y(t){return void 0===t}function v(t){return _(t)&&"[object RegExp]"===E(t)}function _(t){return"object"==typeof t&&null!==t}function S(t){return _(t)&&"[object Date]"===E(t)}function w(t){return _(t)&&("[object Error]"===E(t)||t instanceof Error)}function I(t){return"function"==typeof t}function E(t){return Object.prototype.toString.call(t)}function A(t){return t<10?"0"+t.toString(10):t.toString(10)}e.debuglog=function(r){if(y(s)&&(s=t.env.NODE_DEBUG||""),r=r.toUpperCase(),!o[r])if(new RegExp("\\b"+r+"\\b","i").test(s)){var i=t.pid;o[r]=function(){var t=e.format.apply(e,arguments);console.error("%s %d: %s",r,i,t)}}else o[r]=function(){};return o[r]},e.inspect=a,a.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]},a.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},e.isArray=p,e.isBoolean=l,e.isNull=m,e.isNullOrUndefined=function(t){return null==t},e.isNumber=b,e.isString=g,e.isSymbol=function(t){return"symbol"==typeof t},e.isUndefined=y,e.isRegExp=v,e.isObject=_,e.isDate=S,e.isError=w,e.isFunction=I,e.isPrimitive=function(t){return null===t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||"symbol"==typeof t||void 0===t},e.isBuffer=r(95);var P=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function O(){var t=new Date,e=[A(t.getHours()),A(t.getMinutes()),A(t.getSeconds())].join(":");return[t.getDate(),P[t.getMonth()],e].join(" ")}function M(t,e){return Object.prototype.hasOwnProperty.call(t,e)}e.log=function(){console.log("%s - %s",O(),e.format.apply(e,arguments))},e.inherits=r(18),e._extend=function(t,e){if(!e||!_(e))return t;for(var r=Object.keys(e),i=r.length;i--;)t[r[i]]=e[r[i]];return t};var k="undefined"!=typeof Symbol?Symbol("util.promisify.custom"):void 0;function T(t,e){if(!t){var r=new Error("Promise was rejected with a falsy value");r.reason=t,t=r}return e(t)}e.promisify=function(t){if("function"!=typeof t)throw new TypeError('The "original" argument must be of type Function');if(k&&t[k]){var e;if("function"!=typeof(e=t[k]))throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(e,k,{value:e,enumerable:!1,writable:!1,configurable:!0}),e}function e(){for(var e,r,i=new Promise((function(t,i){e=t,r=i})),n=[],s=0;s<arguments.length;s++)n.push(arguments[s]);n.push((function(t,i){t?r(t):e(i)}));try{t.apply(this,n)}catch(t){r(t)}return i}return Object.setPrototypeOf(e,Object.getPrototypeOf(t)),k&&Object.defineProperty(e,k,{value:e,enumerable:!1,writable:!1,configurable:!0}),Object.defineProperties(e,i(t))},e.promisify.custom=k,e.callbackify=function(e){if("function"!=typeof e)throw new TypeError('The "original" argument must be of type Function');function r(){for(var r=[],i=0;i<arguments.length;i++)r.push(arguments[i]);var n=r.pop();if("function"!=typeof n)throw new TypeError("The last argument must be of type Function");var s=this,o=function(){return n.apply(s,arguments)};e.apply(this,r).then((function(e){t.nextTick(o,null,e)}),(function(e){t.nextTick(T,e,o)}))}return Object.setPrototypeOf(r,Object.getPrototypeOf(e)),Object.defineProperties(r,i(e)),r}}).call(this,r(29))},function(t,e){t.exports=function(t){return t&&"object"==typeof t&&"function"==typeof t.copy&&"function"==typeof t.fill&&"function"==typeof t.readUInt8}},function(t,e){t.exports=function(t,e){if(e>255)throw new Error("number too large");const r=new Uint8Array(1);return r[0]=e,t.write(r)}},function(t,e){t.exports=function(t,e){if(e>65535)throw new Error("number too large");const r=new Uint8Array(2);return r[0]=e%256,e>>=8,r[1]=e%256,t.write(r)}},function(t,e){t.exports=function(t,e){if(e>4294967295)throw new Error("number too large");const r=new Uint8Array(4);return r[0]=e%256,e=Math.floor(e/256),r[1]=e%256,e>>=8,r[2]=e%256,e>>=8,r[3]=e,t.write(r)}},function(t,e){t.exports=function(t,e){if(e<-2147483648||e>2147483647)throw new Error("Out of range. It must be >= -2147483648 and <= 2147483647.");const r=new Uint8Array(4);return r[0]=e%256,e=Math.floor(e/256),r[1]=e%256,e>>=8,r[2]=e%256,e>>=8,r[3]=e,t.write(r)}},function(t,e){t.exports=function(t,e){if(e>Number.MAX_SAFE_INTEGER)throw new Error("varint too large");if(e<=252)return t.write([e]);if(e<=65535)return t.write([253,e%256,Math.floor(e/256)]);if(e<=4294967295){const r=new Uint8Array(5);return r[0]=254,r[1]=e%256,e=Math.floor(e/256),r[2]=e%256,e=Math.floor(e/256),r[3]=e%256,e=Math.floor(e/256),r[4]=e,t.write(r)}const r=new Uint8Array(9);return r[0]=255,r[1]=e%256,e=Math.floor(e/256),r[2]=e%256,e=Math.floor(e/256),r[3]=e%256,e=Math.floor(e/256),r[4]=e%256,e=Math.floor(e/256),r[5]=e%256,e=Math.floor(e/256),r[6]=e%256,e=Math.floor(e/256),r[7]=e%256,e=Math.floor(e/256),r[8]=e,t.write(r)}},function(t,e,r){"use strict";const i=r(102),n=r(56),s=r(103);function o(t,e){switch(n(t)){case"object":return function(t,e){if("function"==typeof e)return e(t);if(e||s(t)){const r=new t.constructor;for(let i in t)r[i]=o(t[i],e);return r}return t}(t,e);case"array":return function(t,e){const r=new t.constructor(t.length);for(let i=0;i<t.length;i++)r[i]=o(t[i],e);return r}(t,e);default:return i(t)}}t.exports=o},function(t,e,r){"use strict";(function(e){
/*!
* shallow-clone <https://github.com/jonschlinkert/shallow-clone>
*
* Copyright (c) 2015-present, Jon Schlinkert.
* Released under the MIT License.
*/
const i=Symbol.prototype.valueOf,n=r(56);t.exports=function(t,r){switch(n(t)){case"array":return t.slice();case"object":return Object.assign({},t);case"date":return new t.constructor(Number(t));case"map":return new Map(t);case"set":return new Set(t);case"buffer":return function(t){const r=t.length,i=e.allocUnsafe?e.allocUnsafe(r):e.from(r);return t.copy(i),i}(t);case"symbol":return function(t){return i?Object(i.call(t)):{}}(t);case"arraybuffer":return function(t){const e=new t.constructor(t.byteLength);return new Uint8Array(e).set(new Uint8Array(t)),e}(t);case"float32array":case"float64array":case"int16array":case"int32array":case"int8array":case"uint16array":case"uint32array":case"uint8clampedarray":case"uint8array":return function(t,e){return new t.constructor(t.buffer,t.byteOffset,t.length)}(t);case"regexp":return function(t){const e=void 0!==t.flags?t.flags:/\w+$/.exec(t)||void 0,r=new t.constructor(t.source,e);return r.lastIndex=t.lastIndex,r}(t);case"error":return Object.create(t);default:return t}}}).call(this,r(0).Buffer)},function(t,e,r){"use strict";
/*!
* is-plain-object <https://github.com/jonschlinkert/is-plain-object>
*
* Copyright (c) 2014-2017, Jon Schlinkert.
* Released under the MIT License.
*/var i=r(104);function n(t){return!0===i(t)&&"[object Object]"===Object.prototype.toString.call(t)}t.exports=function(t){var e,r;return!1!==n(t)&&("function"==typeof(e=t.constructor)&&(!1!==n(r=e.prototype)&&!1!==r.hasOwnProperty("isPrototypeOf")))}},function(t,e,r){"use strict";
/*!
* isobject <https://github.com/jonschlinkert/isobject>
*
* Copyright (c) 2014-2017, Jon Schlinkert.
* Released under the MIT License.
*/t.exports=function(t){return null!=t&&"object"==typeof t&&!1===Array.isArray(t)}},function(t,e,r){"use strict";var i=r(18),n=r(2),s=r(25),o=r(16),a=r(15),u=r(9),f=r(8),h=r(26);function c(){s.apply(this,arguments)}i(c,s),c.prototype.getSignatures=function(t,e,r,i){n.checkState(this.output instanceof o),i=i||f.SIGHASH_ALL|f.SIGHASH_FORKID;var s=e.toPublicKey();return s.toString()===this.output.script.getPublicKey().toString("hex")?[new h({publicKey:s,prevTxId:this.prevTxId,outputIndex:this.outputIndex,inputIndex:r,signature:a.sign(t,e,i,r,this.output.script,this.output.satoshisBN),sigtype:i})]:[]},c.prototype.addSignature=function(t,e){return n.checkState(this.isValidSignature(t,e),"Signature is invalid"),this.setScript(u.buildPublicKeyIn(e.signature.toDER(),e.sigtype)),this},c.prototype.clearSignatures=function(){return this.setScript(u.empty()),this},c.prototype.isFullySigned=function(){return this.script.isPublicKeyIn()},c.SCRIPT_MAX_SIZE=74,c.prototype._estimateSize=function(){return s.BASE_SIZE+c.SCRIPT_MAX_SIZE},t.exports=c},function(t,e,r){"use strict";var i=r(18),n=r(2),s=r(5),o=r(25),a=r(16),u=r(15),f=r(9),h=r(8),c=r(26);function d(){o.apply(this,arguments)}i(d,o),d.prototype.getSignatures=function(t,e,r,i,o){return n.checkState(this.output instanceof a),o=o||s.sha256ripemd160(e.publicKey.toBuffer()),i=i||h.SIGHASH_ALL|h.SIGHASH_FORKID,o.equals(this.output.script.getPublicKeyHash())?[new c({publicKey:e.publicKey,prevTxId:this.prevTxId,outputIndex:this.outputIndex,inputIndex:r,signature:u.sign(t,e,i,r,this.output.script,this.output.satoshisBN),sigtype:i})]:[]},d.prototype.addSignature=function(t,e){return n.checkState(this.isValidSignature(t,e),"Signature is invalid"),this.setScript(f.buildPublicKeyHashIn(e.publicKey,e.signature.toDER(),e.sigtype)),this},d.prototype.clearSignatures=function(){return this.setScript(f.empty()),this},d.prototype.isFullySigned=function(){return this.script.isPublicKeyHashIn()},d.SCRIPT_MAX_SIZE=108,d.prototype._estimateSize=function(){return o.BASE_SIZE+d.SCRIPT_MAX_SIZE},t.exports=d},function(t,e,r){"use strict";(function(e){var i=r(1),n=r(18),s=r(25),o=r(16),a=r(2),u=r(9),f=r(8),h=r(15),c=r(26),d=r(12),p=r(24);function l(t,e,r,n){s.apply(this,arguments);var o=this;e=e||t.publicKeys,r=r||t.threshold,n=n||t.signatures,this.publicKeys=e.map(t=>t.toString("hex")).sort().map(t=>new d(t)),a.checkState(u.buildMultisigOut(this.publicKeys,r).equals(this.output.script),"Provided public keys don't match to the provided output script"),this.publicKeyIndex={},i.each(this.publicKeys,(function(t,e){o.publicKeyIndex[t.toString()]=e})),this.threshold=r,this.signatures=n?this._deserializeSignatures(n):new Array(this.publicKeys.length)}n(l,s),l.prototype.toObject=function(){var t=s.prototype.toObject.apply(this,arguments);return t.threshold=this.threshold,t.publicKeys=i.map(this.publicKeys,(function(t){return t.toString()})),t.signatures=this._serializeSignatures(),t},l.prototype._deserializeSignatures=function(t){return i.map(t,(function(t){if(t)return new c(t)}))},l.prototype._serializeSignatures=function(){return i.map(this.signatures,(function(t){if(t)return t.toObject()}))},l.prototype.getSignatures=function(t,e,r,n){a.checkState(this.output instanceof o),n=n||f.SIGHASH_ALL|f.SIGHASH_FORKID;var s=this,u=[];return i.each(this.publicKeys,(function(i){i.toString()===e.publicKey.toString()&&u.push(new c({publicKey:e.publicKey,prevTxId:s.prevTxId,outputIndex:s.outputIndex,inputIndex:r,signature:h.sign(t,e,n,r,s.output.script,s.output.satoshisBN),sigtype:n}))})),u},l.prototype.addSignature=function(t,e){return a.checkState(!this.isFullySigned(),"All needed signatures have already been added"),a.checkArgument(!i.isUndefined(this.publicKeyIndex[e.publicKey.toString()]),"Signature has no matching public key"),a.checkState(this.isValidSignature(t,e)),this.signatures[this.publicKeyIndex[e.publicKey.toString()]]=e,this._updateScript(),this},l.prototype._updateScript=function(){return this.setScript(u.buildMultisigIn(this.publicKeys,this.threshold,this._createSignatures())),this},l.prototype._createSignatures=function(){return i.map(i.filter(this.signatures,(function(t){return!i.isUndefined(t)})),(function(t){return e.concat([t.signature.toDER(),e.from([255&t.sigtype])])}))},l.prototype.clearSignatures=function(){this.signatures=new Array(this.publicKeys.length),this._updateScript()},l.prototype.isFullySigned=function(){return this.countSignatures()===this.threshold},l.prototype.countMissingSignatures=function(){return this.threshold-this.countSignatures()},l.prototype.countSignatures=function(){return i.reduce(this.signatures,(function(t,e){return t+!!e}),0)},l.prototype.publicKeysWithoutSignature=function(){var t=this;return i.filter(this.publicKeys,(function(e){return!t.signatures[t.publicKeyIndex[e.toString()]]}))},l.prototype.isValidSignature=function(t,e){return e.signature.nhashtype=e.sigtype,h.verify(t,e.signature,e.publicKey,e.inputIndex,this.output.script,this.output.satoshisBN)},l.normalizeSignatures=function(t,e,r,i,n){return n.map((function(n){var s=null;return i=i.filter((function(i){if(s)return!0;var o=new c({signature:f.fromTxFormat(i),publicKey:n,prevTxId:e.prevTxId,outputIndex:e.outputIndex,inputIndex:r,sigtype:f.SIGHASH_ALL});return o.signature.nhashtype=o.sigtype,!h.verify(t,o.signature,o.publicKey,o.inputIndex,e.output.script)||(s=o,!1)})),s||null}))},l.SIGNATURE_SIZE=73,l.prototype._estimateSize=function(){var t=1+this.threshold*l.SIGNATURE_SIZE;return s.BASE_SIZE+p(t).toBuffer().length+t},t.exports=l}).call(this,r(0).Buffer)},function(t,e,r){"use strict";(function(e){var i=r(1),n=r(18),s=r(25),o=r(16),a=r(2),u=r(9),f=r(8),h=r(15),c=r(26),d=r(12),p=r(24);function l(t,e,r,n){s.apply(this,arguments);var o=this;e=e||t.publicKeys,r=r||t.threshold,n=n||t.signatures,this.publicKeys=e.map(t=>t.toString("hex")).sort().map(t=>new d(t)),this.redeemScript=u.buildMultisigOut(this.publicKeys,r),a.checkState(u.buildScriptHashOut(this.redeemScript).equals(this.output.script),"Provided public keys don't hash to the provided output"),this.publicKeyIndex={},i.each(this.publicKeys,(function(t,e){o.publicKeyIndex[t.toString()]=e})),this.threshold=r,this.signatures=n?this._deserializeSignatures(n):new Array(this.publicKeys.length)}n(l,s),l.prototype.toObject=function(){var t=s.prototype.toObject.apply(this,arguments);return t.threshold=this.threshold,t.publicKeys=i.map(this.publicKeys,(function(t){return t.toString()})),t.signatures=this._serializeSignatures(),t},l.prototype._deserializeSignatures=function(t){return i.map(t,(function(t){if(t)return new c(t)}))},l.prototype._serializeSignatures=function(){return i.map(this.signatures,(function(t){if(t)return t.toObject()}))},l.prototype.getSignatures=function(t,e,r,n){a.checkState(this.output instanceof o),n=n||f.SIGHASH_ALL|f.SIGHASH_FORKID;var s=this,u=[];return i.each(this.publicKeys,(function(i){i.toString()===e.publicKey.toString()&&u.push(new c({publicKey:e.publicKey,prevTxId:s.prevTxId,outputIndex:s.outputIndex,inputIndex:r,signature:h.sign(t,e,n,r,s.redeemScript,s.output.satoshisBN),sigtype:n}))})),u},l.prototype.addSignature=function(t,e){return a.checkState(!this.isFullySigned(),"All needed signatures have already been added"),a.checkArgument(!i.isUndefined(this.publicKeyIndex[e.publicKey.toString()]),"Signature has no matching public key"),a.checkState(this.isValidSignature(t,e)),this.signatures[this.publicKeyIndex[e.publicKey.toString()]]=e,this._updateScript(),this},l.prototype._updateScript=function(){return this.setScript(u.buildP2SHMultisigIn(this.publicKeys,this.threshold,this._createSignatures(),{cachedMultisig:this.redeemScript})),this},l.prototype._createSignatures=function(){return i.map(i.filter(this.signatures,(function(t){return!i.isUndefined(t)})),(function(t){return e.concat([t.signature.toDER(),e.from([255&t.sigtype])])}))},l.prototype.clearSignatures=function(){this.signatures=new Array(this.publicKeys.length),this._updateScript()},l.prototype.isFullySigned=function(){return this.countSignatures()===this.threshold},l.prototype.countMissingSignatures=function(){return this.threshold-this.countSignatures()},l.prototype.countSignatures=function(){return i.reduce(this.signatures,(function(t,e){return t+!!e}),0)},l.prototype.publicKeysWithoutSignature=function(){var t=this;return i.filter(this.publicKeys,(function(e){return!t.signatures[t.publicKeyIndex[e.toString()]]}))},l.prototype.isValidSignature=function(t,e){return e.signature.nhashtype=e.sigtype,h.verify(t,e.signature,e.publicKey,e.inputIndex,this.redeemScript,this.output.satoshisBN)},l.SIGNATURE_SIZE=73,l.PUBKEY_SIZE=34,l.prototype._estimateSize=function(){var t=3+this.publicKeys.length*l.PUBKEY_SIZE,e=this.threshold*l.SIGNATURE_SIZE+1+(t<=75?1:t<=255?2:3)+t;return s.BASE_SIZE+p(e).toBuffer().length+e},t.exports=l}).call(this,r(0).Buffer)},function(t,e,r){t.exports=r(110),t.exports.BlockHeader=r(34),t.exports.MerkleBlock=r(60)},function(t,e,r){"use strict";(function(e){const i=r(1),n=r(34),s=r(3),o=r(14),a=r(13),u=r(5),f=r(32),h=r(2);function c(t){return this instanceof c?(i.extend(this,c._from(t)),this):new c(t)}c.MAX_BLOCK_SIZE=128e6,c._from=function(t){if(!t)throw new TypeError("Invalid argument for Block");let r={};if(e.isBuffer(t))r=c._fromBufferReader(new o(t));else{if(!i.isObject(t))throw new TypeError("Unrecognized argument for Block");r=c._fromObject(t)}return r},c._fromObject=function({header:t,transactions:e}){if(!t||!e)throw new TypeError("Invalid arguments for Block");return{header:n.fromObject(t),transactions:e.map(t=>t instanceof f?t:f().fromObject(t))}},c.fromObject=function(t){const e=c._fromObject(t);return new c(e)},c._fromBufferReader=function(t){return h.checkState(!t.finished(),"No block data received"),{header:n.fromBufferReader(t),transactions:[...Array(t.readVarintNum()).keys()].map(()=>f().fromBufferReader(t))}},c.fromBufferReader=function(t){return h.checkArgument(t,"buf is required"),new c(c._fromBufferReader(t))},c.fromBuffer=function(t){return c.fromBufferReader(new o(t))},c.fromString=function(t){return c.fromBuffer(e.from(t,"hex"))},c.fromRawBlock=function(t){e.isBuffer(t)||(t=e.from(t,"binary"));const r=new o(t);r.pos=c.Values.START_OF_BLOCK;const i=c._fromBufferReader(r);return new c(i)},c.prototype.toObject=c.prototype.toJSON=function(){const t=[];return this.transactions.forEach((function(e){t.push(e.toObject())})),{header:this.header.toObject(),transactions:t}},c.prototype.toBuffer=function(){return this.toBufferWriter().concat()},c.prototype.toString=function(){return this.toBuffer().toString("hex")},c.prototype.toBufferWriter=function(t){t||(t=new a),t.write(this.header.toBuffer()),t.writeVarintNum(this.transactions.length);for(let e=0;e<this.transactions.length;e++)this.transactions[e].toBufferWriter(t);return t},c.prototype.getTransactionHashes=function(){return 0===this.transactions.length?[c.Values.NULL_HASH]:this.transactions.map(t=>t._getHash())},c.prototype.getMerkleTree=function(){const t=this.getTransactionHashes();let r=0;for(let i=this.transactions.length;i>1;i=Math.floor((i+1)/2)){for(let n=0;n<i;n+=2){const s=Math.min(n+1,i-1),o=e.concat([t[r+n],t[r+s]]);t.push(u.sha256sha256(o))}r+=i}return t},c.prototype.getMerkleRoot=function(){const t=this.getMerkleTree();return t[t.length-1]},c.prototype.validMerkleRoot=function(){const t=new s(this.header.merkleRoot.toString("hex"),"hex"),e=new s(this.getMerkleRoot().toString("hex"),"hex");return 0===t.cmp(e)},c.prototype._getHash=function(){return this.header._getHash()};const d={configurable:!1,enumerable:!0,get:function(){return this._id||(this._id=this.header.id),this._id},set:i.noop};Object.defineProperty(c.prototype,"id",d),Object.defineProperty(c.prototype,"hash",d),c.prototype.inspect=function(){return"<Block "+this.id+">"},c.Values={START_OF_BLOCK:8,NULL_HASH:e.from("0000000000000000000000000000000000000000000000000000000000000000","hex")},t.exports=c}).call(this,r(0).Buffer)}]);