From 330159f34b078a7bfafe7f90695b4dd7c09b33c0 Mon Sep 17 00:00:00 2001 From: Daniel Date: Thu, 29 Feb 2024 19:20:10 +0100 Subject: [PATCH] PR#489 ("Fix typos") fixup - Revert changes to BitcoinJS.js and OpenGSN.js. The changes are not immediately obvious in the minified code, and merging it would require thoroughly checking all changes, and updating the file hashes in the build script. Not worth the effort and/or risk. - Apply one typo fix made in HTML also to the English translation source strings. - Remove some outdated comments altogether. - Fix an additional typo. --- client/src/PublicRequest.ts | 2 +- src/lib/bitcoin/BitcoinJS.js | 2 +- src/lib/polygon/OpenGSN.js | 6 +++--- src/request/export/Export.js | 4 ---- src/request/export/ExportFile.js | 3 --- src/request/export/ExportWords.js | 3 --- src/translations/en.json | 2 +- 7 files changed, 6 insertions(+), 16 deletions(-) diff --git a/client/src/PublicRequest.ts b/client/src/PublicRequest.ts index 0e1e7535d..15af5590f 100644 --- a/client/src/PublicRequest.ts +++ b/client/src/PublicRequest.ts @@ -303,7 +303,7 @@ export type SignSwapRequestCommon = SimpleRequest & { | 'sender' // Only known in second step (in swap-iframe) | 'senderType' // Must be HTLC | 'senderLabel' // Not used - | 'recipientType' // Must by BASIC (can only redeem to signer address) + | 'recipientType' // Must be BASIC (can only redeem to signer address) | 'flags' // Must be NONE, as it cannot be CONTRACT_CREATION > & { recipientLabel: string } diff --git a/src/lib/bitcoin/BitcoinJS.js b/src/lib/bitcoin/BitcoinJS.js index 66fd5d5b1..bb8991381 100644 --- a/src/lib/bitcoin/BitcoinJS.js +++ b/src/lib/bitcoin/BitcoinJS.js @@ -14,4 +14,4 @@ */ e.exports=function(t){return null!=t&&(n(t)||function(t){return"function"==typeof t.readFloatLE&&"function"==typeof t.slice&&n(t.slice(0,0))}(t)||!!t._isBuffer)}},{}],109:[function(t,e,r){var n={}.toString;e.exports=Array.isArray||function(t){return"[object Array]"==n.call(t)}},{}],110:[function(t,e,r){"use strict";var n=t("inherits"),i=t("hash-base"),s=t("safe-buffer").Buffer,o=new Array(16);function a(){i.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878}function u(t,e){return t<>>32-e}function f(t,e,r,n,i,s,o){return u(t+(e&r|~e&n)+i+s|0,o)+e|0}function c(t,e,r,n,i,s,o){return u(t+(e&n|r&~n)+i+s|0,o)+e|0}function h(t,e,r,n,i,s,o){return u(t+(e^r^n)+i+s|0,o)+e|0}function d(t,e,r,n,i,s,o){return u(t+(r^(e|~n))+i+s|0,o)+e|0}n(a,i),a.prototype._update=function(){for(var t=o,e=0;e<16;++e)t[e]=this._block.readInt32LE(4*e);var r=this._a,n=this._b,i=this._c,s=this._d;r=f(r,n,i,s,t[0],3614090360,7),s=f(s,r,n,i,t[1],3905402710,12),i=f(i,s,r,n,t[2],606105819,17),n=f(n,i,s,r,t[3],3250441966,22),r=f(r,n,i,s,t[4],4118548399,7),s=f(s,r,n,i,t[5],1200080426,12),i=f(i,s,r,n,t[6],2821735955,17),n=f(n,i,s,r,t[7],4249261313,22),r=f(r,n,i,s,t[8],1770035416,7),s=f(s,r,n,i,t[9],2336552879,12),i=f(i,s,r,n,t[10],4294925233,17),n=f(n,i,s,r,t[11],2304563134,22),r=f(r,n,i,s,t[12],1804603682,7),s=f(s,r,n,i,t[13],4254626195,12),i=f(i,s,r,n,t[14],2792965006,17),r=c(r,n=f(n,i,s,r,t[15],1236535329,22),i,s,t[1],4129170786,5),s=c(s,r,n,i,t[6],3225465664,9),i=c(i,s,r,n,t[11],643717713,14),n=c(n,i,s,r,t[0],3921069994,20),r=c(r,n,i,s,t[5],3593408605,5),s=c(s,r,n,i,t[10],38016083,9),i=c(i,s,r,n,t[15],3634488961,14),n=c(n,i,s,r,t[4],3889429448,20),r=c(r,n,i,s,t[9],568446438,5),s=c(s,r,n,i,t[14],3275163606,9),i=c(i,s,r,n,t[3],4107603335,14),n=c(n,i,s,r,t[8],1163531501,20),r=c(r,n,i,s,t[13],2850285829,5),s=c(s,r,n,i,t[2],4243563512,9),i=c(i,s,r,n,t[7],1735328473,14),r=h(r,n=c(n,i,s,r,t[12],2368359562,20),i,s,t[5],4294588738,4),s=h(s,r,n,i,t[8],2272392833,11),i=h(i,s,r,n,t[11],1839030562,16),n=h(n,i,s,r,t[14],4259657740,23),r=h(r,n,i,s,t[1],2763975236,4),s=h(s,r,n,i,t[4],1272893353,11),i=h(i,s,r,n,t[7],4139469664,16),n=h(n,i,s,r,t[10],3200236656,23),r=h(r,n,i,s,t[13],681279174,4),s=h(s,r,n,i,t[0],3936430074,11),i=h(i,s,r,n,t[3],3572445317,16),n=h(n,i,s,r,t[6],76029189,23),r=h(r,n,i,s,t[9],3654602809,4),s=h(s,r,n,i,t[12],3873151461,11),i=h(i,s,r,n,t[15],530742520,16),r=d(r,n=h(n,i,s,r,t[2],3299628645,23),i,s,t[0],4096336452,6),s=d(s,r,n,i,t[7],1126891415,10),i=d(i,s,r,n,t[14],2878612391,15),n=d(n,i,s,r,t[5],4237533241,21),r=d(r,n,i,s,t[12],1700485571,6),s=d(s,r,n,i,t[3],2399980690,10),i=d(i,s,r,n,t[10],4293915773,15),n=d(n,i,s,r,t[1],2240044497,21),r=d(r,n,i,s,t[8],1873313359,6),s=d(s,r,n,i,t[15],4264355552,10),i=d(i,s,r,n,t[6],2734768916,15),n=d(n,i,s,r,t[13],1309151649,21),r=d(r,n,i,s,t[4],4149444226,6),s=d(s,r,n,i,t[11],3174756917,10),i=d(i,s,r,n,t[2],718787259,15),n=d(n,i,s,r,t[9],3951481745,21),this._a=this._a+r|0,this._b=this._b+n|0,this._c=this._c+i|0,this._d=this._d+s|0},a.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var t=s.allocUnsafe(16);return t.writeInt32LE(this._a,0),t.writeInt32LE(this._b,4),t.writeInt32LE(this._c,8),t.writeInt32LE(this._d,12),t},e.exports=a},{"hash-base":92,inherits:107,"safe-buffer":133}],111:[function(t,e,r){(function(t){e.exports=function(e,r){if(!Array.isArray(e))throw TypeError("Expected values Array");if("function"!=typeof r)throw TypeError("Expected digest Function");for(var n=e.length,i=e.concat();n>1;){for(var s=0,o=0;o>8,o=255&i;s?r.push(s,o):r.push(o)}return r},n.zero2=i,n.toHex=s,n.encode=function(t,e){return"hex"===e?s(t):t}},{}],114:[function(t,e,r){(function(t){"use strict";!t.version||0===t.version.indexOf("v0.")||0===t.version.indexOf("v1.")&&0!==t.version.indexOf("v1.8.")?e.exports={nextTick:function(e,r,n,i){if("function"!=typeof e)throw new TypeError('"callback" argument must be a function');var s,o,a=arguments.length;switch(a){case 0:case 1:return t.nextTick(e);case 2:return t.nextTick((function(){e.call(null,r)}));case 3:return t.nextTick((function(){e.call(null,r,n)}));case 4:return t.nextTick((function(){e.call(null,r,n,i)}));default:for(s=new Array(a-1),o=0;o1)for(var r=1;rt.length)return null;r=t.readUInt8(e+1),i=2}else if(s===n.OP_PUSHDATA2){if(e+3>t.length)return null;r=t.readUInt16LE(e+1),i=3}else{if(e+5>t.length)return null;if(s!==n.OP_PUSHDATA4)throw new Error("Unexpected opcode");r=t.readUInt32LE(e+1),i=5}return{opcode:s,number:r,size:i}}}},{"bitcoin-ops":31}],117:[function(t,e,r){(function(r,n){"use strict";var i=65536,s=4294967295;var o=t("safe-buffer").Buffer,a=n.crypto||n.msCrypto;a&&a.getRandomValues?e.exports=function(t,e){if(t>s)throw new RangeError("requested too many random bytes");var n=o.allocUnsafe(t);if(t>0)if(t>i)for(var u=0;u0?("string"==typeof e||o.objectMode||Object.getPrototypeOf(e)===f.prototype||(e=function(t){return f.from(t)}(e)),n?o.endEmitted?t.emit("error",new Error("stream.unshift() after end event")):_(t,o,e,!0):o.ended?t.emit("error",new Error("stream.push() after EOF")):(o.reading=!1,o.decoder&&!r?(e=o.decoder.write(e),o.objectMode||0!==e.length?_(t,o,e,!1):T(t,o)):_(t,o,e,!1))):n||(o.reading=!1));return function(t){return!t.ended&&(t.needReadable||t.lengthe.highWaterMark&&(e.highWaterMark=function(t){return t>=S?t=S:(t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++),t}(t)),t<=e.length?t:e.ended?e.length:(e.needReadable=!0,0))}function k(t){var e=t._readableState;e.needReadable=!1,e.emittedReadable||(p("emitReadable",e.flowing),e.emittedReadable=!0,e.sync?i.nextTick(I,t):I(t))}function I(t){p("emit readable"),t.emit("readable"),P(t)}function T(t,e){e.readingMore||(e.readingMore=!0,i.nextTick(M,t,e))}function M(t,e){for(var r=e.length;!e.reading&&!e.flowing&&!e.ended&&e.length=e.length?(r=e.decoder?e.buffer.join(""):1===e.buffer.length?e.buffer.head.data:e.buffer.concat(e.length),e.buffer.clear()):r=function(t,e,r){var n;ts.length?s.length:t;if(o===s.length?i+=s:i+=s.slice(0,t),0===(t-=o)){o===s.length?(++n,r.next?e.head=r.next:e.head=e.tail=null):(e.head=r,r.data=s.slice(o));break}++n}return e.length-=n,i}(t,e):function(t,e){var r=f.allocUnsafe(t),n=e.head,i=1;n.data.copy(r),t-=n.data.length;for(;n=n.next;){var s=n.data,o=t>s.length?s.length:t;if(s.copy(r,r.length-t,0,o),0===(t-=o)){o===s.length?(++i,n.next?e.head=n.next:e.head=e.tail=null):(e.head=n,n.data=s.slice(o));break}++i}return e.length-=i,r}(t,e);return n}(t,e.buffer,e.decoder),r);var r}function N(t){var e=t._readableState;if(e.length>0)throw new Error('"endReadable()" called on non-empty stream');e.endEmitted||(e.ended=!0,i.nextTick(B,e,t))}function B(t,e){t.endEmitted||0!==t.length||(t.endEmitted=!0,e.readable=!1,e.emit("end"))}function U(t,e){for(var r=0,n=t.length;r=e.highWaterMark||e.ended))return p("read: emitReadable",e.length,e.ended),0===e.length&&e.ended?N(this):k(this),null;if(0===(t=E(t,e))&&e.ended)return 0===e.length&&N(this),null;var n,i=e.needReadable;return p("need readable",i),(0===e.length||e.length-t0?x(t,e):null)?(e.needReadable=!0,t=0):e.length-=t,0===e.length&&(e.ended||(e.needReadable=!0),r!==t&&e.ended&&N(this)),null!==n&&this.emit("data",n),n},w.prototype._read=function(t){this.emit("error",new Error("_read() is not implemented"))},w.prototype.pipe=function(t,e){var n=this,s=this._readableState;switch(s.pipesCount){case 0:s.pipes=t;break;case 1:s.pipes=[s.pipes,t];break;default:s.pipes.push(t)}s.pipesCount+=1,p("pipe count=%d opts=%j",s.pipesCount,e);var u=(!e||!1!==e.end)&&t!==r.stdout&&t!==r.stderr?c:w;function f(e,r){p("onunpipe"),e===n&&r&&!1===r.hasUnpiped&&(r.hasUnpiped=!0,p("cleanup"),t.removeListener("close",m),t.removeListener("finish",g),t.removeListener("drain",h),t.removeListener("error",y),t.removeListener("unpipe",f),n.removeListener("end",c),n.removeListener("end",w),n.removeListener("data",b),d=!0,!s.awaitDrain||t._writableState&&!t._writableState.needDrain||h())}function c(){p("onend"),t.end()}s.endEmitted?i.nextTick(u):n.once("end",u),t.on("unpipe",f);var h=function(t){return function(){var e=t._readableState;p("pipeOnDrain",e.awaitDrain),e.awaitDrain&&e.awaitDrain--,0===e.awaitDrain&&a(t,"data")&&(e.flowing=!0,P(t))}}(n);t.on("drain",h);var d=!1;var l=!1;function b(e){p("ondata"),l=!1,!1!==t.write(e)||l||((1===s.pipesCount&&s.pipes===t||s.pipesCount>1&&-1!==U(s.pipes,t))&&!d&&(p("false write response, pause",n._readableState.awaitDrain),n._readableState.awaitDrain++,l=!0),n.pause())}function y(e){p("onerror",e),w(),t.removeListener("error",y),0===a(t,"error")&&t.emit("error",e)}function m(){t.removeListener("finish",g),w()}function g(){p("onfinish"),t.removeListener("close",m),w()}function w(){p("unpipe"),n.unpipe(t)}return n.on("data",b),function(t,e,r){if("function"==typeof t.prependListener)return t.prependListener(e,r);t._events&&t._events[e]?o(t._events[e])?t._events[e].unshift(r):t._events[e]=[r,t._events[e]]:t.on(e,r)}(t,"error",y),t.once("close",m),t.once("finish",g),t.emit("pipe",n),s.flowing||(p("pipe resume"),n.resume()),t},w.prototype.unpipe=function(t){var e=this._readableState,r={hasUnpiped:!1};if(0===e.pipesCount)return this;if(1===e.pipesCount)return t&&t!==e.pipes||(t||(t=e.pipes),e.pipes=null,e.pipesCount=0,e.flowing=!1,t&&t.emit("unpipe",this,r)),this;if(!t){var n=e.pipes,i=e.pipesCount;e.pipes=null,e.pipesCount=0,e.flowing=!1;for(var s=0;s-1?i:s.nextTick;g.WritableState=m;var f=t("core-util-is");f.inherits=t("inherits");var c={deprecate:t("util-deprecate")},h=t("./internal/streams/stream"),d=t("safe-buffer").Buffer,p=n.Uint8Array||function(){};var l,b=t("./internal/streams/destroy");function y(){}function m(e,r){a=a||t("./_stream_duplex"),e=e||{};var n=r instanceof a;this.objectMode=!!e.objectMode,n&&(this.objectMode=this.objectMode||!!e.writableObjectMode);var i=e.highWaterMark,f=e.writableHighWaterMark,c=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:n&&(f||0===f)?f:c,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var h=!1===e.decodeStrings;this.decodeStrings=!h,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(t){!function(t,e){var r=t._writableState,n=r.sync,i=r.writecb;if(function(t){t.writing=!1,t.writecb=null,t.length-=t.writelen,t.writelen=0}(r),e)!function(t,e,r,n,i){--e.pendingcb,r?(s.nextTick(i,n),s.nextTick(k,t,e),t._writableState.errorEmitted=!0,t.emit("error",n)):(i(n),t._writableState.errorEmitted=!0,t.emit("error",n),k(t,e))}(t,r,n,e,i);else{var o=S(r);o||r.corked||r.bufferProcessing||!r.bufferedRequest||_(t,r),n?u(v,t,r,o,i):v(t,r,o,i)}}(r,t)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new o(this)}function g(e){if(a=a||t("./_stream_duplex"),!(l.call(g,this)||this instanceof a))return new g(e);this._writableState=new m(e,this),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),h.call(this)}function w(t,e,r,n,i,s,o){e.writelen=n,e.writecb=o,e.writing=!0,e.sync=!0,r?t._writev(i,e.onwrite):t._write(i,s,e.onwrite),e.sync=!1}function v(t,e,r,n){r||function(t,e){0===e.length&&e.needDrain&&(e.needDrain=!1,t.emit("drain"))}(t,e),e.pendingcb--,n(),k(t,e)}function _(t,e){e.bufferProcessing=!0;var r=e.bufferedRequest;if(t._writev&&r&&r.next){var n=e.bufferedRequestCount,i=new Array(n),s=e.corkedRequestsFree;s.entry=r;for(var a=0,u=!0;r;)i[a]=r,r.isBuf||(u=!1),r=r.next,a+=1;i.allBuffers=u,w(t,e,!0,e.length,i,"",s.finish),e.pendingcb++,e.lastBufferedRequest=null,s.next?(e.corkedRequestsFree=s.next,s.next=null):e.corkedRequestsFree=new o(e),e.bufferedRequestCount=0}else{for(;r;){var f=r.chunk,c=r.encoding,h=r.callback;if(w(t,e,!1,e.objectMode?1:f.length,f,c,h),r=r.next,e.bufferedRequestCount--,e.writing)break}null===r&&(e.lastBufferedRequest=null)}e.bufferedRequest=r,e.bufferProcessing=!1}function S(t){return t.ending&&0===t.length&&null===t.bufferedRequest&&!t.finished&&!t.writing}function E(t,e){t._final((function(r){e.pendingcb--,r&&t.emit("error",r),e.prefinished=!0,t.emit("prefinish"),k(t,e)}))}function k(t,e){var r=S(e);return r&&(!function(t,e){e.prefinished||e.finalCalled||("function"==typeof t._final?(e.pendingcb++,e.finalCalled=!0,s.nextTick(E,t,e)):(e.prefinished=!0,t.emit("prefinish")))}(t,e),0===e.pendingcb&&(e.finished=!0,t.emit("finish"))),r}f.inherits(g,h),m.prototype.getBuffer=function(){for(var t=this.bufferedRequest,e=[];t;)e.push(t),t=t.next;return e},function(){try{Object.defineProperty(m.prototype,"buffer",{get:c.deprecate((function(){return this.getBuffer()}),"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(t){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(l=Function.prototype[Symbol.hasInstance],Object.defineProperty(g,Symbol.hasInstance,{value:function(t){return!!l.call(this,t)||this===g&&(t&&t._writableState instanceof m)}})):l=function(t){return t instanceof this},g.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},g.prototype.write=function(t,e,r){var n,i=this._writableState,o=!1,a=!i.objectMode&&(n=t,d.isBuffer(n)||n instanceof p);return a&&!d.isBuffer(t)&&(t=function(t){return d.from(t)}(t)),"function"==typeof e&&(r=e,e=null),a?e="buffer":e||(e=i.defaultEncoding),"function"!=typeof r&&(r=y),i.ended?function(t,e){var r=new Error("write after end");t.emit("error",r),s.nextTick(e,r)}(this,r):(a||function(t,e,r,n){var i=!0,o=!1;return null===r?o=new TypeError("May not write null values to stream"):"string"==typeof r||void 0===r||e.objectMode||(o=new TypeError("Invalid non-string/buffer chunk")),o&&(t.emit("error",o),s.nextTick(n,o),i=!1),i}(this,i,t,r))&&(i.pendingcb++,o=function(t,e,r,n,i,s){if(!r){var o=function(t,e,r){t.objectMode||!1===t.decodeStrings||"string"!=typeof e||(e=d.from(e,r));return e}(e,n,i);n!==o&&(r=!0,i="buffer",n=o)}var a=e.objectMode?1:n.length;e.length+=a;var u=e.length-1))throw new TypeError("Unknown encoding: "+t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(g.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),g.prototype._write=function(t,e,r){r(new Error("_write() is not implemented"))},g.prototype._writev=null,g.prototype.end=function(t,e,r){var n=this._writableState;"function"==typeof t?(r=t,t=null,e=null):"function"==typeof e&&(r=e,e=null),null!=t&&this.write(t,e),n.corked&&(n.corked=1,this.uncork()),n.ending||n.finished||function(t,e,r){e.ending=!0,k(t,e),r&&(e.finished?s.nextTick(r):t.once("finish",r));e.ended=!0,t.writable=!1}(this,n,r)},Object.defineProperty(g.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(t){this._writableState&&(this._writableState.destroyed=t)}}),g.prototype.destroy=b.destroy,g.prototype._undestroy=b.undestroy,g.prototype._destroy=function(t,e){this.end(),e(t)}}).call(this,t("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},t("timers").setImmediate)},{"./_stream_duplex":119,"./internal/streams/destroy":125,"./internal/streams/stream":126,_process:115,"core-util-is":86,inherits:107,"process-nextick-args":114,"safe-buffer":133,timers:145,"util-deprecate":168}],124:[function(t,e,r){"use strict";var n=t("safe-buffer").Buffer,i=t("util");e.exports=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.head=null,this.tail=null,this.length=0}return t.prototype.push=function(t){var e={data:t,next:null};this.length>0?this.tail.next=e:this.head=e,this.tail=e,++this.length},t.prototype.unshift=function(t){var e={data:t,next:this.head};0===this.length&&(this.tail=e),this.head=e,++this.length},t.prototype.shift=function(){if(0!==this.length){var t=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,t}},t.prototype.clear=function(){this.head=this.tail=null,this.length=0},t.prototype.join=function(t){if(0===this.length)return"";for(var e=this.head,r=""+e.data;e=e.next;)r+=t+e.data;return r},t.prototype.concat=function(t){if(0===this.length)return n.alloc(0);if(1===this.length)return this.head.data;for(var e,r,i,s=n.allocUnsafe(t>>>0),o=this.head,a=0;o;)e=o.data,r=s,i=a,e.copy(r,i),a+=o.data.length,o=o.next;return s},t}(),i&&i.inspect&&i.inspect.custom&&(e.exports.prototype[i.inspect.custom]=function(){var t=i.inspect({length:this.length});return this.constructor.name+" "+t})},{"safe-buffer":133,util:80}],125:[function(t,e,r){"use strict";var n=t("process-nextick-args");function i(t,e){t.emit("error",e)}e.exports={destroy:function(t,e){var r=this,s=this._readableState&&this._readableState.destroyed,o=this._writableState&&this._writableState.destroyed;return s||o?(e?e(t):!t||this._writableState&&this._writableState.errorEmitted||n.nextTick(i,this,t),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(t||null,(function(t){!e&&t?(n.nextTick(i,r,t),r._writableState&&(r._writableState.errorEmitted=!0)):e&&e(t)})),this)},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}}},{"process-nextick-args":114}],126:[function(t,e,r){e.exports=t("events").EventEmitter},{events:91}],127:[function(t,e,r){"use strict";var n=t("safe-buffer").Buffer,i=n.isEncoding||function(t){switch((t=""+t)&&t.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function s(t){var e;switch(this.encoding=function(t){var e=function(t){if(!t)return"utf8";for(var e;;)switch(t){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return t;default:if(e)return;t=(""+t).toLowerCase(),e=!0}}(t);if("string"!=typeof e&&(n.isEncoding===i||!i(t)))throw new Error("Unknown encoding: "+t);return e||t}(t),this.encoding){case"utf16le":this.text=u,this.end=f,e=4;break;case"utf8":this.fillLast=a,e=4;break;case"base64":this.text=c,this.end=h,e=3;break;default:return this.write=d,void(this.end=p)}this.lastNeed=0,this.lastTotal=0,this.lastChar=n.allocUnsafe(e)}function o(t){return t<=127?0:t>>5==6?2:t>>4==14?3:t>>3==30?4:t>>6==2?-1:-2}function a(t){var e=this.lastTotal-this.lastNeed,r=function(t,e,r){if(128!=(192&e[0]))return t.lastNeed=0,"�";if(t.lastNeed>1&&e.length>1){if(128!=(192&e[1]))return t.lastNeed=1,"�";if(t.lastNeed>2&&e.length>2&&128!=(192&e[2]))return t.lastNeed=2,"�"}}(this,t);return void 0!==r?r:this.lastNeed<=t.length?(t.copy(this.lastChar,e,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(t.copy(this.lastChar,e,0,t.length),void(this.lastNeed-=t.length))}function u(t,e){if((t.length-e)%2==0){var r=t.toString("utf16le",e);if(r){var n=r.charCodeAt(r.length-1);if(n>=55296&&n<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=t[t.length-1],t.toString("utf16le",e,t.length-1)}function f(t){var e=t&&t.length?this.write(t):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return e+this.lastChar.toString("utf16le",0,r)}return e}function c(t,e){var r=(t.length-e)%3;return 0===r?t.toString("base64",e):(this.lastNeed=3-r,this.lastTotal=3,1===r?this.lastChar[0]=t[t.length-1]:(this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1]),t.toString("base64",e,t.length-r))}function h(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function d(t){return t.toString(this.encoding)}function p(t){return t&&t.length?this.write(t):""}r.StringDecoder=s,s.prototype.write=function(t){if(0===t.length)return"";var e,r;if(this.lastNeed){if(void 0===(e=this.fillLast(t)))return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r=0)return i>0&&(t.lastNeed=i-1),i;if(--n=0)return i>0&&(t.lastNeed=i-2),i;if(--n=0)return i>0&&(2===i?i=0:t.lastNeed=i-3),i;return 0}(this,t,e);if(!this.lastNeed)return t.toString("utf8",e);this.lastTotal=r;var n=t.length-(r-this.lastNeed);return t.copy(this.lastChar,0,n),t.toString("utf8",e,n)},s.prototype.fillLast=function(t){if(this.lastNeed<=t.length)return t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,t.length),this.lastNeed-=t.length}},{"safe-buffer":133}],128:[function(t,e,r){e.exports=t("./readable").PassThrough},{"./readable":129}],129:[function(t,e,r){(r=e.exports=t("./lib/_stream_readable.js")).Stream=r,r.Readable=r,r.Writable=t("./lib/_stream_writable.js"),r.Duplex=t("./lib/_stream_duplex.js"),r.Transform=t("./lib/_stream_transform.js"),r.PassThrough=t("./lib/_stream_passthrough.js")},{"./lib/_stream_duplex.js":119,"./lib/_stream_passthrough.js":120,"./lib/_stream_readable.js":121,"./lib/_stream_transform.js":122,"./lib/_stream_writable.js":123}],130:[function(t,e,r){e.exports=t("./readable").Transform},{"./readable":129}],131:[function(t,e,r){e.exports=t("./lib/_stream_writable.js")},{"./lib/_stream_writable.js":123}],132:[function(t,e,r){"use strict";var n=t("buffer").Buffer,i=t("inherits"),s=t("hash-base"),o=new Array(16),a=[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],u=[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],f=[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],c=[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],h=[0,1518500249,1859775393,2400959708,2840853838],d=[1352829926,1548603684,1836072691,2053994217,0];function p(){s.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520}function l(t,e){return t<>>32-e}function b(t,e,r,n,i,s,o,a){return l(t+(e^r^n)+s+o|0,a)+i|0}function y(t,e,r,n,i,s,o,a){return l(t+(e&r|~e&n)+s+o|0,a)+i|0}function m(t,e,r,n,i,s,o,a){return l(t+((e|~r)^n)+s+o|0,a)+i|0}function g(t,e,r,n,i,s,o,a){return l(t+(e&n|r&~n)+s+o|0,a)+i|0}function w(t,e,r,n,i,s,o,a){return l(t+(e^(r|~n))+s+o|0,a)+i|0}i(p,s),p.prototype._update=function(){for(var t=o,e=0;e<16;++e)t[e]=this._block.readInt32LE(4*e);for(var r=0|this._a,n=0|this._b,i=0|this._c,s=0|this._d,p=0|this._e,v=0|this._a,_=0|this._b,S=0|this._c,E=0|this._d,k=0|this._e,I=0;I<80;I+=1){var T,M;I<16?(T=b(r,n,i,s,p,t[a[I]],h[0],f[I]),M=w(v,_,S,E,k,t[u[I]],d[0],c[I])):I<32?(T=y(r,n,i,s,p,t[a[I]],h[1],f[I]),M=g(v,_,S,E,k,t[u[I]],d[1],c[I])):I<48?(T=m(r,n,i,s,p,t[a[I]],h[2],f[I]),M=m(v,_,S,E,k,t[u[I]],d[2],c[I])):I<64?(T=g(r,n,i,s,p,t[a[I]],h[3],f[I]),M=y(v,_,S,E,k,t[u[I]],d[3],c[I])):(T=w(r,n,i,s,p,t[a[I]],h[4],f[I]),M=b(v,_,S,E,k,t[u[I]],d[4],c[I])),r=p,p=s,s=l(i,10),i=n,n=T,v=k,k=E,E=l(S,10),S=_,_=M}var O=this._b+i+E|0;this._b=this._c+s+k|0,this._c=this._d+p+v|0,this._d=this._e+r+_|0,this._e=this._a+n+S|0,this._a=O},p.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var t=n.alloc?n.alloc(20):new n(20);return t.writeInt32LE(this._a,0),t.writeInt32LE(this._b,4),t.writeInt32LE(this._c,8),t.writeInt32LE(this._d,12),t.writeInt32LE(this._e,16),t},e.exports=p},{buffer:81,"hash-base":92,inherits:107}],133:[function(t,e,r){var n=t("buffer"),i=n.Buffer;function s(t,e){for(var r in t)e[r]=t[r]}function o(t,e,r){return i(t,e,r)}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?e.exports=n:(s(n,r),r.Buffer=o),s(i,o),o.from=function(t,e,r){if("number"==typeof t)throw new TypeError("Argument must not be a number");return i(t,e,r)},o.alloc=function(t,e,r){if("number"!=typeof t)throw new TypeError("Argument must be a number");var n=i(t);return void 0!==e?"string"==typeof r?n.fill(e,r):n.fill(e):n.fill(0),n},o.allocUnsafe=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return i(t)},o.allocUnsafeSlow=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return n.SlowBuffer(t)}},{buffer:81}],134:[function(t,e,r){var n=t("safe-buffer").Buffer;function i(t,e){this._block=n.alloc(t),this._finalSize=e,this._blockSize=t,this._len=0}i.prototype.update=function(t,e){"string"==typeof t&&(e=e||"utf8",t=n.from(t,e));for(var r=this._block,i=this._blockSize,s=t.length,o=this._len,a=0;a=this._finalSize&&(this._update(this._block),this._block.fill(0));var r=8*this._len;if(r<=4294967295)this._block.writeUInt32BE(r,this._blockSize-4);else{var n=(4294967295&r)>>>0,i=(r-n)/4294967296;this._block.writeUInt32BE(i,this._blockSize-8),this._block.writeUInt32BE(n,this._blockSize-4)}this._update(this._block);var s=this._hash();return t?s.toString(t):s},i.prototype._update=function(){throw new Error("_update must be implemented by subclass")},e.exports=i},{"safe-buffer":133}],135:[function(t,e,r){(r=e.exports=function(t){t=t.toLowerCase();var e=r[t];if(!e)throw new Error(t+" is not supported (we accept pull requests)");return new e}).sha=t("./sha"),r.sha1=t("./sha1"),r.sha224=t("./sha224"),r.sha256=t("./sha256"),r.sha384=t("./sha384"),r.sha512=t("./sha512")},{"./sha":136,"./sha1":137,"./sha224":138,"./sha256":139,"./sha384":140,"./sha512":141}],136:[function(t,e,r){var n=t("inherits"),i=t("./hash"),s=t("safe-buffer").Buffer,o=[1518500249,1859775393,-1894007588,-899497514],a=new Array(80);function u(){this.init(),this._w=a,i.call(this,64,56)}function f(t){return t<<30|t>>>2}function c(t,e,r,n){return 0===t?e&r|~e&n:2===t?e&r|e&n|r&n:e^r^n}n(u,i),u.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},u.prototype._update=function(t){for(var e,r=this._w,n=0|this._a,i=0|this._b,s=0|this._c,a=0|this._d,u=0|this._e,h=0;h<16;++h)r[h]=t.readInt32BE(4*h);for(;h<80;++h)r[h]=r[h-3]^r[h-8]^r[h-14]^r[h-16];for(var d=0;d<80;++d){var p=~~(d/20),l=0|((e=n)<<5|e>>>27)+c(p,i,s,a)+u+r[d]+o[p];u=a,a=s,s=f(i),i=n,n=l}this._a=n+this._a|0,this._b=i+this._b|0,this._c=s+this._c|0,this._d=a+this._d|0,this._e=u+this._e|0},u.prototype._hash=function(){var t=s.allocUnsafe(20);return t.writeInt32BE(0|this._a,0),t.writeInt32BE(0|this._b,4),t.writeInt32BE(0|this._c,8),t.writeInt32BE(0|this._d,12),t.writeInt32BE(0|this._e,16),t},e.exports=u},{"./hash":134,inherits:107,"safe-buffer":133}],137:[function(t,e,r){var n=t("inherits"),i=t("./hash"),s=t("safe-buffer").Buffer,o=[1518500249,1859775393,-1894007588,-899497514],a=new Array(80);function u(){this.init(),this._w=a,i.call(this,64,56)}function f(t){return t<<5|t>>>27}function c(t){return t<<30|t>>>2}function h(t,e,r,n){return 0===t?e&r|~e&n:2===t?e&r|e&n|r&n:e^r^n}n(u,i),u.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},u.prototype._update=function(t){for(var e,r=this._w,n=0|this._a,i=0|this._b,s=0|this._c,a=0|this._d,u=0|this._e,d=0;d<16;++d)r[d]=t.readInt32BE(4*d);for(;d<80;++d)r[d]=(e=r[d-3]^r[d-8]^r[d-14]^r[d-16])<<1|e>>>31;for(var p=0;p<80;++p){var l=~~(p/20),b=f(n)+h(l,i,s,a)+u+r[p]+o[l]|0;u=a,a=s,s=c(i),i=n,n=b}this._a=n+this._a|0,this._b=i+this._b|0,this._c=s+this._c|0,this._d=a+this._d|0,this._e=u+this._e|0},u.prototype._hash=function(){var t=s.allocUnsafe(20);return t.writeInt32BE(0|this._a,0),t.writeInt32BE(0|this._b,4),t.writeInt32BE(0|this._c,8),t.writeInt32BE(0|this._d,12),t.writeInt32BE(0|this._e,16),t},e.exports=u},{"./hash":134,inherits:107,"safe-buffer":133}],138:[function(t,e,r){var n=t("inherits"),i=t("./sha256"),s=t("./hash"),o=t("safe-buffer").Buffer,a=new Array(64);function u(){this.init(),this._w=a,s.call(this,64,56)}n(u,i),u.prototype.init=function(){return this._a=3238371032,this._b=914150663,this._c=812702999,this._d=4144912697,this._e=4290775857,this._f=1750603025,this._g=1694076839,this._h=3204075428,this},u.prototype._hash=function(){var t=o.allocUnsafe(28);return t.writeInt32BE(this._a,0),t.writeInt32BE(this._b,4),t.writeInt32BE(this._c,8),t.writeInt32BE(this._d,12),t.writeInt32BE(this._e,16),t.writeInt32BE(this._f,20),t.writeInt32BE(this._g,24),t},e.exports=u},{"./hash":134,"./sha256":139,inherits:107,"safe-buffer":133}],139:[function(t,e,r){var n=t("inherits"),i=t("./hash"),s=t("safe-buffer").Buffer,o=[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],a=new Array(64);function u(){this.init(),this._w=a,i.call(this,64,56)}function f(t,e,r){return r^t&(e^r)}function c(t,e,r){return t&e|r&(t|e)}function h(t){return(t>>>2|t<<30)^(t>>>13|t<<19)^(t>>>22|t<<10)}function d(t){return(t>>>6|t<<26)^(t>>>11|t<<21)^(t>>>25|t<<7)}function p(t){return(t>>>7|t<<25)^(t>>>18|t<<14)^t>>>3}n(u,i),u.prototype.init=function(){return this._a=1779033703,this._b=3144134277,this._c=1013904242,this._d=2773480762,this._e=1359893119,this._f=2600822924,this._g=528734635,this._h=1541459225,this},u.prototype._update=function(t){for(var e,r=this._w,n=0|this._a,i=0|this._b,s=0|this._c,a=0|this._d,u=0|this._e,l=0|this._f,b=0|this._g,y=0|this._h,m=0;m<16;++m)r[m]=t.readInt32BE(4*m);for(;m<64;++m)r[m]=0|(((e=r[m-2])>>>17|e<<15)^(e>>>19|e<<13)^e>>>10)+r[m-7]+p(r[m-15])+r[m-16];for(var g=0;g<64;++g){var w=y+d(u)+f(u,l,b)+o[g]+r[g]|0,v=h(n)+c(n,i,s)|0;y=b,b=l,l=u,u=a+w|0,a=s,s=i,i=n,n=w+v|0}this._a=n+this._a|0,this._b=i+this._b|0,this._c=s+this._c|0,this._d=a+this._d|0,this._e=u+this._e|0,this._f=l+this._f|0,this._g=b+this._g|0,this._h=y+this._h|0},u.prototype._hash=function(){var t=s.allocUnsafe(32);return t.writeInt32BE(this._a,0),t.writeInt32BE(this._b,4),t.writeInt32BE(this._c,8),t.writeInt32BE(this._d,12),t.writeInt32BE(this._e,16),t.writeInt32BE(this._f,20),t.writeInt32BE(this._g,24),t.writeInt32BE(this._h,28),t},e.exports=u},{"./hash":134,inherits:107,"safe-buffer":133}],140:[function(t,e,r){var n=t("inherits"),i=t("./sha512"),s=t("./hash"),o=t("safe-buffer").Buffer,a=new Array(160);function u(){this.init(),this._w=a,s.call(this,128,112)}n(u,i),u.prototype.init=function(){return this._ah=3418070365,this._bh=1654270250,this._ch=2438529370,this._dh=355462360,this._eh=1731405415,this._fh=2394180231,this._gh=3675008525,this._hh=1203062813,this._al=3238371032,this._bl=914150663,this._cl=812702999,this._dl=4144912697,this._el=4290775857,this._fl=1750603025,this._gl=1694076839,this._hl=3204075428,this},u.prototype._hash=function(){var t=o.allocUnsafe(48);function e(e,r,n){t.writeInt32BE(e,n),t.writeInt32BE(r,n+4)}return e(this._ah,this._al,0),e(this._bh,this._bl,8),e(this._ch,this._cl,16),e(this._dh,this._dl,24),e(this._eh,this._el,32),e(this._fh,this._fl,40),t},e.exports=u},{"./hash":134,"./sha512":141,inherits:107,"safe-buffer":133}],141:[function(t,e,r){var n=t("inherits"),i=t("./hash"),s=t("safe-buffer").Buffer,o=[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],a=new Array(160);function u(){this.init(),this._w=a,i.call(this,128,112)}function f(t,e,r){return r^t&(e^r)}function c(t,e,r){return t&e|r&(t|e)}function h(t,e){return(t>>>28|e<<4)^(e>>>2|t<<30)^(e>>>7|t<<25)}function d(t,e){return(t>>>14|e<<18)^(t>>>18|e<<14)^(e>>>9|t<<23)}function p(t,e){return(t>>>1|e<<31)^(t>>>8|e<<24)^t>>>7}function l(t,e){return(t>>>1|e<<31)^(t>>>8|e<<24)^(t>>>7|e<<25)}function b(t,e){return(t>>>19|e<<13)^(e>>>29|t<<3)^t>>>6}function y(t,e){return(t>>>19|e<<13)^(e>>>29|t<<3)^(t>>>6|e<<26)}function m(t,e){return t>>>0>>0?1:0}n(u,i),u.prototype.init=function(){return this._ah=1779033703,this._bh=3144134277,this._ch=1013904242,this._dh=2773480762,this._eh=1359893119,this._fh=2600822924,this._gh=528734635,this._hh=1541459225,this._al=4089235720,this._bl=2227873595,this._cl=4271175723,this._dl=1595750129,this._el=2917565137,this._fl=725511199,this._gl=4215389547,this._hl=327033209,this},u.prototype._update=function(t){for(var e=this._w,r=0|this._ah,n=0|this._bh,i=0|this._ch,s=0|this._dh,a=0|this._eh,u=0|this._fh,g=0|this._gh,w=0|this._hh,v=0|this._al,_=0|this._bl,S=0|this._cl,E=0|this._dl,k=0|this._el,I=0|this._fl,T=0|this._gl,M=0|this._hl,O=0;O<32;O+=2)e[O]=t.readInt32BE(4*O),e[O+1]=t.readInt32BE(4*O+4);for(;O<160;O+=2){var A=e[O-30],P=e[O-30+1],x=p(A,P),N=l(P,A),B=b(A=e[O-4],P=e[O-4+1]),U=y(P,A),R=e[O-14],C=e[O-14+1],L=e[O-32],H=e[O-32+1],j=N+C|0,q=x+R+m(j,N)|0;q=(q=q+B+m(j=j+U|0,U)|0)+L+m(j=j+H|0,H)|0,e[O]=q,e[O+1]=j}for(var D=0;D<160;D+=2){q=e[D],j=e[D+1];var F=c(r,n,i),W=c(v,_,S),K=h(r,v),z=h(v,r),V=d(a,k),X=d(k,a),G=o[D],J=o[D+1],Y=f(a,u,g),$=f(k,I,T),Z=M+X|0,Q=w+V+m(Z,M)|0;Q=(Q=(Q=Q+Y+m(Z=Z+$|0,$)|0)+G+m(Z=Z+J|0,J)|0)+q+m(Z=Z+j|0,j)|0;var tt=z+W|0,et=K+F+m(tt,z)|0;w=g,M=T,g=u,T=I,u=a,I=k,a=s+Q+m(k=E+Z|0,E)|0,s=i,E=S,i=n,S=_,n=r,_=v,r=Q+et+m(v=Z+tt|0,Z)|0}this._al=this._al+v|0,this._bl=this._bl+_|0,this._cl=this._cl+S|0,this._dl=this._dl+E|0,this._el=this._el+k|0,this._fl=this._fl+I|0,this._gl=this._gl+T|0,this._hl=this._hl+M|0,this._ah=this._ah+r+m(this._al,v)|0,this._bh=this._bh+n+m(this._bl,_)|0,this._ch=this._ch+i+m(this._cl,S)|0,this._dh=this._dh+s+m(this._dl,E)|0,this._eh=this._eh+a+m(this._el,k)|0,this._fh=this._fh+u+m(this._fl,I)|0,this._gh=this._gh+g+m(this._gl,T)|0,this._hh=this._hh+w+m(this._hl,M)|0},u.prototype._hash=function(){var t=s.allocUnsafe(64);function e(e,r,n){t.writeInt32BE(e,n),t.writeInt32BE(r,n+4)}return e(this._ah,this._al,0),e(this._bh,this._bl,8),e(this._ch,this._cl,16),e(this._dh,this._dl,24),e(this._eh,this._el,32),e(this._fh,this._fl,40),e(this._gh,this._gl,48),e(this._hh,this._hl,56),t},e.exports=u},{"./hash":134,inherits:107,"safe-buffer":133}],142:[function(t,e,r){e.exports=i;var n=t("events").EventEmitter;function i(){n.call(this)}t("inherits")(i,n),i.Readable=t("readable-stream/readable.js"),i.Writable=t("readable-stream/writable.js"),i.Duplex=t("readable-stream/duplex.js"),i.Transform=t("readable-stream/transform.js"),i.PassThrough=t("readable-stream/passthrough.js"),i.Stream=i,i.prototype.pipe=function(t,e){var r=this;function i(e){t.writable&&!1===t.write(e)&&r.pause&&r.pause()}function s(){r.readable&&r.resume&&r.resume()}r.on("data",i),t.on("drain",s),t._isStdio||e&&!1===e.end||(r.on("end",a),r.on("close",u));var o=!1;function a(){o||(o=!0,t.end())}function u(){o||(o=!0,"function"==typeof t.destroy&&t.destroy())}function f(t){if(c(),0===n.listenerCount(this,"error"))throw t}function c(){r.removeListener("data",i),t.removeListener("drain",s),r.removeListener("end",a),r.removeListener("close",u),r.removeListener("error",f),t.removeListener("error",f),r.removeListener("end",c),r.removeListener("close",c),t.removeListener("close",c)}return r.on("error",f),t.on("error",f),r.on("end",c),r.on("close",c),t.on("close",c),t.emit("pipe",r),t}},{events:91,inherits:107,"readable-stream/duplex.js":118,"readable-stream/passthrough.js":128,"readable-stream/readable.js":129,"readable-stream/transform.js":130,"readable-stream/writable.js":131}],143:[function(t,e,r){arguments[4][127][0].apply(r,arguments)},{dup:127,"safe-buffer":144}],144:[function(t,e,r){ /*! safe-buffer. MIT License. Feross Aboukhadijeh */ -var n=t("buffer"),i=n.Buffer;function s(t,e){for(var r in t)e[r]=t[r]}function o(t,e,r){return i(t,e,r)}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?e.exports=n:(s(n,r),r.Buffer=o),o.prototype=Object.create(i.prototype),s(i,o),o.from=function(t,e,r){if("number"==typeof t)throw new TypeError("Argument must not be a number");return i(t,e,r)},o.alloc=function(t,e,r){if("number"!=typeof t)throw new TypeError("Argument must be a number");var n=i(t);return void 0!==e?"string"==typeof r?n.fill(e,r):n.fill(e):n.fill(0),n},o.allocUnsafe=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return i(t)},o.allocUnsafeSlow=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return n.SlowBuffer(t)}},{buffer:81}],145:[function(t,e,r){(function(e,n){var i=t("process/browser.js").nextTick,s=Function.prototype.apply,o=Array.prototype.slice,a={},u=0;function f(t,e){this._id=t,this._clearFn=e}r.setTimeout=function(){return new f(s.call(setTimeout,window,arguments),clearTimeout)},r.setInterval=function(){return new f(s.call(setInterval,window,arguments),clearInterval)},r.clearTimeout=r.clearInterval=function(t){t.close()},f.prototype.unref=f.prototype.ref=function(){},f.prototype.close=function(){this._clearFn.call(window,this._id)},r.enroll=function(t,e){clearTimeout(t._idleTimeoutId),t._idleTimeout=e},r.unenroll=function(t){clearTimeout(t._idleTimeoutId),t._idleTimeout=-1},r._unrefActive=r.active=function(t){clearTimeout(t._idleTimeoutId);var e=t._idleTimeout;e>=0&&(t._idleTimeoutId=setTimeout((function(){t._onTimeout&&t._onTimeout()}),e))},r.setImmediate="function"==typeof e?e:function(t){var e=u++,n=!(arguments.length<2)&&o.call(arguments,1);return a[e]=!0,i((function(){a[e]&&(n?t.apply(null,n):t.call(null),r.clearImmediate(e))})),e},r.clearImmediate="function"==typeof n?n:function(t){delete a[t]}}).call(this,t("timers").setImmediate,t("timers").clearImmediate)},{"process/browser.js":115,timers:145}],146:[function(t,e,r){(function(r){const n=t("bn.js"),i=new(0,t("elliptic").ec)("secp256k1"),s=t("./rfc6979"),o=r.alloc(32,0),a=r.from("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141","hex"),u=r.from("fffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f","hex"),f=i.curve.n,c=f.shrn(1),h=i.curve.g,d="Expected Private",p="Expected Point",l="Expected Tweak",b="Expected Hash";function y(t){return r.isBuffer(t)&&32===t.length}function m(t){return!!y(t)&&t.compare(a)<0}function g(t){if(!r.isBuffer(t))return!1;if(t.length<33)return!1;const e=t[0],n=t.slice(1,33);if(0===n.compare(o))return!1;if(n.compare(u)>=0)return!1;if((2===e||3===e)&&33===t.length){try{k(t)}catch(t){return!1}return!0}const i=t.slice(33);return 0!==i.compare(o)&&(!(i.compare(u)>=0)&&(4===e&&65===t.length))}function w(t){return 4!==t[0]}function v(t){return!!y(t)&&(t.compare(o)>0&&t.compare(a)<0)}function _(t,e){return void 0===t&&void 0!==e?w(e):void 0===t||t}function S(t){return new n(t)}function E(t){return t.toArrayLike(r,"be",32)}function k(t){return i.curve.decodePoint(t)}function I(t,e){return r.from(t._encode(e))}function T(t,e,n){if(!y(t))throw new TypeError(b);if(!v(e))throw new TypeError(d);if(void 0!==n&&!y(n))throw new TypeError("Expected Extra Data (32 bytes)");const i=S(e),o=S(t);let a,u;s(t,e,(function(t){const e=S(t),r=h.mul(e);return!r.isInfinity()&&(a=r.x.umod(f),0!==a.isZero()&&(u=e.invm(f).mul(o.add(i.mul(a))).umod(f),0!==u.isZero()))}),v,n),u.cmp(c)>0&&(u=f.sub(u));const p=r.allocUnsafe(64);return E(a).copy(p,0),E(u).copy(p,32),p}e.exports={isPoint:g,isPointCompressed:function(t){return!!g(t)&&w(t)},isPrivate:v,pointAdd:function(t,e,r){if(!g(t))throw new TypeError(p);if(!g(e))throw new TypeError(p);const n=k(t),i=k(e),s=n.add(i);return s.isInfinity()?null:I(s,_(r,t))},pointAddScalar:function(t,e,r){if(!g(t))throw new TypeError(p);if(!m(e))throw new TypeError(l);const n=_(r,t),i=k(t);if(0===e.compare(o))return I(i,n);const s=S(e),a=h.mul(s),u=i.add(a);return u.isInfinity()?null:I(u,n)},pointCompress:function(t,e){if(!g(t))throw new TypeError(p);const r=k(t);if(r.isInfinity())throw new TypeError(p);return I(r,e)},pointFromScalar:function(t,e){if(!v(t))throw new TypeError(d);const r=S(t),n=h.mul(r);return n.isInfinity()?null:I(n,_(e))},pointMultiply:function(t,e,r){if(!g(t))throw new TypeError(p);if(!m(e))throw new TypeError(l);const n=_(r,t),i=k(t),s=S(e),o=i.mul(s);return o.isInfinity()?null:I(o,n)},privateAdd:function(t,e){if(!v(t))throw new TypeError(d);if(!m(e))throw new TypeError(l);const r=S(t),n=S(e),i=E(r.add(n).umod(f));return v(i)?i:null},privateSub:function(t,e){if(!v(t))throw new TypeError(d);if(!m(e))throw new TypeError(l);const r=S(t),n=S(e),i=E(r.sub(n).umod(f));return v(i)?i:null},sign:function(t,e){return T(t,e)},signWithEntropy:function(t,e,r){return T(t,e,r)},verify:function(t,e,n){if(!y(t))throw new TypeError(b);if(!g(e))throw new TypeError(p);if(!function(t){const e=t.slice(0,32),n=t.slice(32,64);return r.isBuffer(t)&&64===t.length&&e.compare(a)<0&&n.compare(a)<0}(n))throw new TypeError("Expected Signature");const i=k(e),s=S(n.slice(0,32)),o=S(n.slice(32,64));if(s.gtn(0)<=0)return!1;if(o.gtn(0)<=0)return!1;const u=S(t),c=o.invm(f),d=u.mul(c).umod(f),l=s.mul(c).umod(f),m=h.mulAdd(d,i,l);return!m.isInfinity()&&m.x.umod(f).eq(s)}}}).call(this,t("buffer").Buffer)},{"./rfc6979":163,"bn.js":78,buffer:81,elliptic:147}],147:[function(t,e,r){"use strict";var n=r;n.version=t("../package.json").version,n.utils=t("./elliptic/utils"),n.rand=t("brorand"),n.curve=t("./elliptic/curve"),n.curves=t("./elliptic/curves"),n.ec=t("./elliptic/ec"),n.eddsa=t("./elliptic/eddsa")},{"../package.json":162,"./elliptic/curve":150,"./elliptic/curves":153,"./elliptic/ec":154,"./elliptic/eddsa":157,"./elliptic/utils":161,brorand:79}],148:[function(t,e,r){"use strict";var n=t("bn.js"),i=t("../utils"),s=i.getNAF,o=i.getJSF,a=i.assert;function u(t,e){this.type=t,this.p=new n(e.p,16),this.red=e.prime?n.red(e.prime):n.mont(this.p),this.zero=new n(0).toRed(this.red),this.one=new n(1).toRed(this.red),this.two=new n(2).toRed(this.red),this.n=e.n&&new n(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}e.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(),n=s(e,1,this._bitLength),i=(1<=u;e--)f=(f<<1)+n[e];o.push(f)}for(var c=this.jpoint(null,null,null),h=this.jpoint(null,null,null),d=i;d>0;d--){for(u=0;u=0;f--){for(e=0;f>=0&&0===o[f];f--)e++;if(f>=0&&e++,u=u.dblp(e),f<0)break;var c=o[f];a(0!==c),u="affine"===t.type?c>0?u.mixedAdd(i[c-1>>1]):u.mixedAdd(i[-c-1>>1].neg()):c>0?u.add(i[c-1>>1]):u.add(i[-c-1>>1].neg())}return"affine"===t.type?u.toP():u},u.prototype._wnafMulAdd=function(t,e,r,n,i){for(var a=this._wnafT1,u=this._wnafT2,f=this._wnafT3,c=0,h=0;h=1;h-=2){var p=h-1,l=h;if(1===a[p]&&1===a[l]){var b=[e[p],null,null,e[l]];0===e[p].y.cmp(e[l].y)?(b[1]=e[p].add(e[l]),b[2]=e[p].toJ().mixedAdd(e[l].neg())):0===e[p].y.cmp(e[l].y.redNeg())?(b[1]=e[p].toJ().mixedAdd(e[l]),b[2]=e[p].add(e[l].neg())):(b[1]=e[p].toJ().mixedAdd(e[l]),b[2]=e[p].toJ().mixedAdd(e[l].neg()));var y=[-3,-1,-5,-7,0,7,5,1,3],m=o(r[p],r[l]);c=Math.max(m[0].length,c),f[p]=new Array(c),f[l]=new Array(c);for(var g=0;g=0;h--){for(var E=0;h>=0;){var k=!0;for(g=0;g=0&&E++,_=_.dblp(E),h<0)break;for(g=0;g0?I=u[g][T-1>>1]:T<0&&(I=u[g][-T-1>>1].neg()),_="affine"===I.type?_.mixedAdd(I):_.add(I))}}for(h=0;h=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],n=this,i=0;i":""},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 n=this.curve._mulA(t),i=this.x.redAdd(this.y).redSqr().redISub(t).redISub(e),s=n.redAdd(e),o=s.redSub(r),a=n.redSub(e),u=i.redMul(o),f=s.redMul(a),c=i.redMul(a),h=o.redMul(s);return this.curve.point(u,f,h,c)},f.prototype._projDbl=function(){var t,e,r,n=this.x.redAdd(this.y).redSqr(),i=this.x.redSqr(),s=this.y.redSqr();if(this.curve.twisted){var o=(f=this.curve._mulA(i)).redAdd(s);if(this.zOne)t=n.redSub(i).redSub(s).redMul(o.redSub(this.curve.two)),e=o.redMul(f.redSub(s)),r=o.redSqr().redSub(o).redSub(o);else{var a=this.z.redSqr(),u=o.redSub(a).redISub(a);t=n.redSub(i).redISub(s).redMul(u),e=o.redMul(f.redSub(s)),r=o.redMul(u)}}else{var f=i.redAdd(s);a=this.curve._mulC(this.z).redSqr(),u=f.redSub(a).redSub(a);t=this.curve._mulC(n.redISub(f)).redMul(u),e=this.curve._mulC(f).redMul(i.redISub(s)),r=f.redMul(u)}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)),n=this.t.redMul(this.curve.dd).redMul(t.t),i=this.z.redMul(t.z.redAdd(t.z)),s=r.redSub(e),o=i.redSub(n),a=i.redAdd(n),u=r.redAdd(e),f=s.redMul(o),c=a.redMul(u),h=s.redMul(u),d=o.redMul(a);return this.curve.point(f,c,d,h)},f.prototype._projAdd=function(t){var e,r,n=this.z.redMul(t.z),i=n.redSqr(),s=this.x.redMul(t.x),o=this.y.redMul(t.y),a=this.curve.d.redMul(s).redMul(o),u=i.redSub(a),f=i.redAdd(a),c=this.x.redAdd(this.y).redMul(t.x.redAdd(t.y)).redISub(s).redISub(o),h=n.redMul(u).redMul(c);return this.curve.twisted?(e=n.redMul(f).redMul(o.redSub(this.curve._mulA(s))),r=u.redMul(f)):(e=n.redMul(f).redMul(o.redSub(s)),r=this.curve._mulC(u).redMul(f)),this.curve.point(h,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(),n=this.curve.redN.redMul(this.z);;){if(r.iadd(this.curve.n),r.cmp(this.curve.p)>=0)return!1;if(e.redIAdd(n),0===this.x.cmp(e))return!0}},f.prototype.toP=f.prototype.normalize,f.prototype.mixedAdd=f.prototype.add},{"../utils":161,"./base":148,"bn.js":78,inherits:107}],150:[function(t,e,r){"use strict";var n=r;n.base=t("./base"),n.short=t("./short"),n.mont=t("./mont"),n.edwards=t("./edwards")},{"./base":148,"./edwards":149,"./mont":151,"./short":152}],151:[function(t,e,r){"use strict";var n=t("bn.js"),i=t("inherits"),s=t("./base"),o=t("../utils");function a(t){s.call(this,"mont",t),this.a=new n(t.a,16).toRed(this.red),this.b=new n(t.b,16).toRed(this.red),this.i4=new n(4).toRed(this.red).redInvm(),this.two=new n(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 n(e,16),this.z=new n(r,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}i(a,s),e.exports=a,a.prototype.validate=function(t){var e=t.normalize().x,r=e.redSqr(),n=r.redMul(e).redAdd(r.redMul(this.a)).redAdd(e);return 0===n.redSqrt().redSqr().cmp(n)},i(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()?"":""},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),n=t.redMul(e),i=r.redMul(e.redAdd(this.curve.a24.redMul(r)));return this.curve.point(n,i)},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),n=this.x.redSub(this.z),i=t.x.redAdd(t.z),s=t.x.redSub(t.z).redMul(r),o=i.redMul(n),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,n=this.curve.point(null,null),i=[];0!==e.cmpn(0);e.iushrn(1))i.push(e.andln(1));for(var s=i.length-1;s>=0;s--)0===i[s]?(r=r.diffAdd(n,this),n=n.dbl()):(n=r.diffAdd(n,this),r=r.dbl());return n},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()}},{"../utils":161,"./base":148,"bn.js":78,inherits:107}],152:[function(t,e,r){"use strict";var n=t("../utils"),i=t("bn.js"),s=t("inherits"),o=t("./base"),a=n.assert;function u(t){o.call(this,"short",t),this.a=new i(t.a,16).toRed(this.red),this.b=new i(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,n){o.BasePoint.call(this,t,"affine"),null===e&&null===r?(this.x=null,this.y=null,this.inf=!0):(this.x=new i(e,16),this.y=new i(r,16),n&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.inf=!1)}function c(t,e,r,n){o.BasePoint.call(this,t,"jacobian"),null===e&&null===r&&null===n?(this.x=this.curve.one,this.y=this.curve.one,this.z=new i(0)):(this.x=new i(e,16),this.y=new i(r,16),this.z=new i(n,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}s(u,o),e.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 i(t.beta,16).toRed(this.red);else{var n=this._getEndoRoots(this.p);e=(e=n[0].cmp(n[1])<0?n[0]:n[1]).toRed(this.red)}if(t.lambda)r=new i(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 i(t.a,16),b:new i(t.b,16)}})):this._getEndoBasis(r)}}},u.prototype._getEndoRoots=function(t){var e=t===this.p?this.red:i.mont(t),r=new i(2).toRed(e).redInvm(),n=r.redNeg(),s=new i(3).toRed(e).redNeg().redSqrt().redMul(r);return[n.redAdd(s).fromRed(),n.redSub(s).fromRed()]},u.prototype._getEndoBasis=function(t){for(var e,r,n,s,o,a,u,f,c,h=this.n.ushrn(Math.floor(this.n.bitLength()/2)),d=t,p=this.n.clone(),l=new i(1),b=new i(0),y=new i(0),m=new i(1),g=0;0!==d.cmpn(0);){var w=p.div(d);f=p.sub(w.mul(d)),c=y.sub(w.mul(l));var v=m.sub(w.mul(b));if(!n&&f.cmp(h)<0)e=u.neg(),r=l,n=f.neg(),s=c;else if(n&&2==++g)break;u=f,p=d,d=f,y=l,l=c,m=b,b=v}o=f.neg(),a=c;var _=n.sqr().add(s.sqr());return o.sqr().add(a.sqr()).cmp(_)>=0&&(o=e,a=r),n.negative&&(n=n.neg(),s=s.neg()),o.negative&&(o=o.neg(),a=a.neg()),[{a:n,b:s},{a:o,b:a}]},u.prototype._endoSplit=function(t){var e=this.endo.basis,r=e[0],n=e[1],i=n.b.mul(t).divRound(this.n),s=r.b.neg().mul(t).divRound(this.n),o=i.mul(r.a),a=s.mul(n.a),u=i.mul(r.b),f=s.mul(n.b);return{k1:t.sub(o).sub(a),k2:u.add(f).neg()}},u.prototype.pointFromX=function(t,e){(t=new i(t,16)).red||(t=t.toRed(this.red));var r=t.redSqr().redMul(t).redIAdd(t.redMul(this.a)).redIAdd(this.b),n=r.redSqrt();if(0!==n.redSqr().redSub(r).cmp(this.zero))throw new Error("invalid point");var s=n.fromRed().isOdd();return(e&&!s||!e&&s)&&(n=n.redNeg()),this.point(t,n)},u.prototype.validate=function(t){if(t.inf)return!0;var e=t.x,r=t.y,n=this.a.redMul(e),i=e.redSqr().redMul(e).redIAdd(n).redIAdd(this.b);return 0===r.redSqr().redISub(i).cmpn(0)},u.prototype._endoWnafMulAdd=function(t,e,r){for(var n=this._endoWnafT1,i=this._endoWnafT2,s=0;s":""},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),n=e.redMul(this.x.redSub(r)).redISub(this.y);return this.curve.point(r,n)},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(),n=t.redInvm(),i=r.redAdd(r).redIAdd(r).redIAdd(e).redMul(n),s=i.redSqr().redISub(this.x.redAdd(this.x)),o=i.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 i(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 n=[this,e],i=[t,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,i):this.curve._wnafMulAdd(1,n,i,2)},f.prototype.jmulAdd=function(t,e,r){var n=[this,e],i=[t,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,i,!0):this.curve._wnafMulAdd(1,n,i,2,!0)},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,n=function(t){return t.neg()};e.precomputed={naf:r.naf&&{wnd:r.naf.wnd,points:r.naf.points.map(n)},doubles:r.doubles&&{step:r.doubles.step,points:r.doubles.points.map(n)}}}return e},f.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},s(c,o.BasePoint),u.prototype.jpoint=function(t,e,r){return new c(this,t,e,r)},c.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var t=this.z.redInvm(),e=t.redSqr(),r=this.x.redMul(e),n=this.y.redMul(e).redMul(t);return this.curve.point(r,n)},c.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},c.prototype.add=function(t){if(this.isInfinity())return t;if(t.isInfinity())return this;var e=t.z.redSqr(),r=this.z.redSqr(),n=this.x.redMul(e),i=t.x.redMul(r),s=this.y.redMul(e.redMul(t.z)),o=t.y.redMul(r.redMul(this.z)),a=n.redSub(i),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(),c=f.redMul(a),h=n.redMul(f),d=u.redSqr().redIAdd(c).redISub(h).redISub(h),p=u.redMul(h.redISub(d)).redISub(s.redMul(c)),l=this.z.redMul(t.z).redMul(a);return this.curve.jpoint(d,p,l)},c.prototype.mixedAdd=function(t){if(this.isInfinity())return t.toJ();if(t.isInfinity())return this;var e=this.z.redSqr(),r=this.x,n=t.x.redMul(e),i=this.y,s=t.y.redMul(e).redMul(this.z),o=r.redSub(n),a=i.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),c=r.redMul(u),h=a.redSqr().redIAdd(f).redISub(c).redISub(c),d=a.redMul(c.redISub(h)).redISub(i.redMul(f)),p=this.z.redMul(o);return this.curve.jpoint(h,d,p)},c.prototype.dblp=function(t){if(0===t)return this;if(this.isInfinity())return this;if(!t)return this.dbl();if(this.curve.zeroA||this.curve.threeA){for(var e=this,r=0;r=0)return!1;if(r.redIAdd(i),0===this.x.cmp(r))return!0}},c.prototype.inspect=function(){return this.isInfinity()?"":""},c.prototype.isInfinity=function(){return 0===this.z.cmpn(0)}},{"../utils":161,"./base":148,"bn.js":78,inherits:107}],153:[function(t,e,r){"use strict";var n,i=r,s=t("hash.js"),o=t("./curve"),a=t("./utils").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(i,t,{configurable:!0,enumerable:!0,get:function(){var r=new u(e);return Object.defineProperty(i,t,{configurable:!0,enumerable:!0,value:r}),r}})}i.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{n=t("./precomputed/secp256k1")}catch(t){n=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",n]})},{"./curve":150,"./precomputed/secp256k1":160,"./utils":161,"hash.js":93}],154:[function(t,e,r){"use strict";var n=t("bn.js"),i=t("hmac-drbg"),s=t("../utils"),o=t("../curves"),a=t("brorand"),u=s.assert,f=t("./key"),c=t("./signature");function h(t){if(!(this instanceof h))return new h(t);"string"==typeof t&&(u(o.hasOwnProperty(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}e.exports=h,h.prototype.keyPair=function(t){return new f(this,t)},h.prototype.keyFromPrivate=function(t,e){return f.fromPrivate(this,t,e)},h.prototype.keyFromPublic=function(t,e){return f.fromPublic(this,t,e)},h.prototype.genKeyPair=function(t){t||(t={});for(var e=new i({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 n(2));;){var o=new n(e.generate(r));if(!(o.cmp(s)>0))return o.iaddn(1),this.keyFromPrivate(o)}},h.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},h.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 n(t,16));for(var o=this.n.byteLength(),a=e.getPrivate().toArray("be",o),u=t.toArray("be",o),f=new i({hash:this.hash,entropy:a,nonce:u,pers:s.pers,persEnc:s.persEnc||"utf8"}),h=this.n.sub(new n(1)),d=0;;d++){var p=s.k?s.k(d):new n(f.generate(this.n.byteLength()));if(!((p=this._truncateToN(p,!0)).cmpn(1)<=0||p.cmp(h)>=0)){var l=this.g.mul(p);if(!l.isInfinity()){var b=l.getX(),y=b.umod(this.n);if(0!==y.cmpn(0)){var m=p.invm(this.n).mul(y.mul(e.getPrivate()).iadd(t));if(0!==(m=m.umod(this.n)).cmpn(0)){var g=(l.getY().isOdd()?1:0)|(0!==b.cmp(y)?2:0);return s.canonical&&m.cmp(this.nh)>0&&(m=this.n.sub(m),g^=1),new c({r:y,s:m,recoveryParam:g})}}}}}},h.prototype.verify=function(t,e,r,i){t=this._truncateToN(new n(t,16)),r=this.keyFromPublic(r,i);var s=(e=new c(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),h=u.mul(s).umod(this.n);return this.curve._maxwellTrick?!(a=this.g.jmulAdd(f,r.getPublic(),h)).isInfinity()&&a.eqXToP(s):!(a=this.g.mulAdd(f,r.getPublic(),h)).isInfinity()&&0===a.getX().umod(this.n).cmp(s)},h.prototype.recoverPubKey=function(t,e,r,i){u((3&r)===r,"The recovery param is more than two bits"),e=new c(e,i);var s=this.n,o=new n(t),a=e.r,f=e.s,h=1&r,d=r>>1;if(a.cmp(this.curve.p.umod(this.curve.n))>=0&&d)throw new Error("Unable to find second key candidate");a=d?this.curve.pointFromX(a.add(this.curve.n),h):this.curve.pointFromX(a,h);var p=e.r.invm(s),l=s.sub(o).mul(p).umod(s),b=f.mul(p).umod(s);return this.g.mulAdd(l,a,b)},h.prototype.getKeyRecoveryParam=function(t,e,r,n){if(null!==(e=new c(e,n)).recoveryParam)return e.recoveryParam;for(var i=0;i<4;i++){var s;try{s=this.recoverPubKey(t,e,i)}catch(t){continue}if(s.eq(r))return i}throw new Error("Unable to find valid recovery factor")}},{"../curves":153,"../utils":161,"./key":155,"./signature":156,"bn.js":78,brorand:79,"hmac-drbg":105}],155:[function(t,e,r){"use strict";var n=t("bn.js"),i=t("../utils").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)}e.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 n(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?i(t.x,"Need x coordinate"):"short"!==this.ec.curve.type&&"edwards"!==this.ec.curve.type||i(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.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""}},{"../utils":161,"bn.js":78}],156:[function(t,e,r){"use strict";var n=t("bn.js"),i=t("../utils"),s=i.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 n(t.r,16),this.s=new n(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;for(var n=15&r,i=0,s=0,o=e.place;s>>3);for(t.push(128|r);--r;)t.push(e>>>(r<<3)&255);t.push(e)}}e.exports=o,o.prototype._importDER=function(t,e){t=i.toArray(t,e);var r=new a;if(48!==t[r.place++])return!1;if(u(t,r)+r.place!==t.length)return!1;if(2!==t[r.place++])return!1;var s=u(t,r),o=t.slice(r.place,s+r.place);if(r.place+=s,2!==t[r.place++])return!1;var f=u(t,r);if(t.length!==f+r.place)return!1;var c=t.slice(r.place,f+r.place);return 0===o[0]&&128&o[1]&&(o=o.slice(1)),0===c[0]&&128&c[1]&&(c=c.slice(1)),this.r=new n(o),this.s=new n(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 n=[2];c(n,e.length),(n=n.concat(e)).push(2),c(n,r.length);var s=n.concat(r),o=[48];return c(o,s.length),o=o.concat(s),i.encode(o,t)}},{"../utils":161,"bn.js":78}],157:[function(t,e,r){"use strict";var n=t("hash.js"),i=t("../curves"),s=t("../utils"),o=s.assert,a=s.parseBytes,u=t("./key"),f=t("./signature");function c(t){if(o("ed25519"===t,"only tested with ed25519 so far"),!(this instanceof c))return new c(t);t=i[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=n.sha512}e.exports=c,c.prototype.sign=function(t,e){t=a(t);var r=this.keyFromSecret(e),n=this.hashInt(r.messagePrefix(),t),i=this.g.mul(n),s=this.encodePoint(i),o=this.hashInt(s,r.pubBytes(),t).mul(r.priv()),u=n.add(o).umod(this.curve.n);return this.makeSignature({R:i,S:u,Rencoded:s})},c.prototype.verify=function(t,e,r){t=a(t),e=this.makeSignature(e);var n=this.keyFromPublic(r),i=this.hashInt(e.Rencoded(),n.pubBytes(),t),s=this.g.mul(e.S());return e.R().add(n.pub().mul(i)).eq(s)},c.prototype.hashInt=function(){for(var t=this.hash(),e=0;e(i>>1)-1?(i>>1)-u:u,s.isubn(a)):a=0,n[o]=a,s.iushrn(1)}return n},n.getJSF=function(t,e){var r=[[],[]];t=t.clone(),e=e.clone();for(var n=0,i=0;t.cmpn(-n)>0||e.cmpn(-i)>0;){var s,o,a,u=t.andln(3)+n&3,f=e.andln(3)+i&3;if(3===u&&(u=-1),3===f&&(f=-1),0==(1&u))s=0;else s=3!==(a=t.andln(7)+n&7)&&5!==a||2!==f?u:-u;if(r[0].push(s),0==(1&f))o=0;else o=3!==(a=e.andln(7)+i&7)&&5!==a||2!==u?f:-f;r[1].push(o),2*n===s+1&&(n=1-n),2*i===o+1&&(i=1-i),t.iushrn(1),e.iushrn(1)}return r},n.cachedProperty=function(t,e,r){var n="_"+e;t.prototype[e]=function(){return void 0!==this[n]?this[n]:this[n]=r.call(this)}},n.parseBytes=function(t){return"string"==typeof t?n.toArray(t,"hex"):t},n.intFromLE=function(t){return new i(t,"hex","le")}},{"bn.js":78,"minimalistic-assert":112,"minimalistic-crypto-utils":113}],162:[function(t,e,r){e.exports={name:"elliptic",version:"6.5.2",description:"EC cryptography",main:"lib/elliptic.js",files:["lib"],scripts:{jscs:"jscs benchmarks/*.js lib/*.js lib/**/*.js lib/**/**/*.js test/index.js",jshint:"jscs benchmarks/*.js lib/*.js lib/**/*.js lib/**/**/*.js test/index.js",lint:"npm run jscs && npm run jshint",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 ",license:"MIT",bugs:{url:"https://github.com/indutny/elliptic/issues"},homepage:"https://github.com/indutny/elliptic",devDependencies:{brfs:"^1.4.3",coveralls:"^3.0.8",grunt:"^1.0.4","grunt-browserify":"^5.0.0","grunt-cli":"^1.2.0","grunt-contrib-connect":"^1.0.0","grunt-contrib-copy":"^1.0.0","grunt-contrib-uglify":"^1.0.1","grunt-mocha-istanbul":"^3.0.1","grunt-saucelabs":"^9.0.1",istanbul:"^0.4.2",jscs:"^3.0.7",jshint:"^2.10.3",mocha:"^6.2.2"},dependencies:{"bn.js":"^4.4.0",brorand:"^1.0.1","hash.js":"^1.0.0","hmac-drbg":"^1.0.0",inherits:"^2.0.1","minimalistic-assert":"^1.0.0","minimalistic-crypto-utils":"^1.0.0"}}},{}],163:[function(t,e,r){(function(r){const n=t("create-hmac"),i=r.alloc(1,1),s=r.alloc(1,0);e.exports=function(t,e,o,a,u){let f=r.alloc(32,0),c=r.alloc(32,1);f=n("sha256",f).update(c).update(s).update(e).update(t).update(u||"").digest(),c=n("sha256",f).update(c).digest(),f=n("sha256",f).update(c).update(i).update(e).update(t).update(u||"").digest(),c=n("sha256",f).update(c).digest(),c=n("sha256",f).update(c).digest();let h=c;for(;!a(h)||!o(h);)f=n("sha256",f).update(c).update(s).digest(),c=n("sha256",f).update(c).digest(),c=n("sha256",f).update(c).digest(),h=c;return h}}).call(this,t("buffer").Buffer)},{buffer:81,"create-hmac":89}],164:[function(t,e,r){var n=t("./native");function i(t){return t.name||t.toString().match(/function (.*?)\s*\(/)[1]}function s(t){return n.Nil(t)?"":i(t.constructor)}function o(t,e){Error.captureStackTrace&&Error.captureStackTrace(t,e)}function a(t){return n.Function(t)?t.toJSON?t.toJSON():i(t):n.Array(t)?"Array":t&&n.Object(t)?"Object":void 0!==t?t:""}function u(t,e,r){var i=function(t){return n.Function(t)?"":n.String(t)?JSON.stringify(t):t&&n.Object(t)?"":t}(e);return"Expected "+a(t)+", got"+(""!==r?" "+r:"")+(""!==i?" "+i:"")}function f(t,e,r){r=r||s(e),this.message=u(t,e,r),o(this,f),this.__type=t,this.__value=e,this.__valueTypeName=r}function c(t,e,r,n,i){t?(i=i||s(n),this.message=function(t,e,r,n,i){var s='" of type ';return"key"===e&&(s='" with key type '),u('property "'+a(r)+s+a(t),n,i)}(t,r,e,n,i)):this.message='Unexpected property "'+e+'"',o(this,f),this.__label=r,this.__property=e,this.__type=t,this.__value=n,this.__valueTypeName=i}f.prototype=Object.create(Error.prototype),f.prototype.constructor=f,c.prototype=Object.create(Error.prototype),c.prototype.constructor=f,e.exports={TfTypeError:f,TfPropertyTypeError:c,tfCustomError:function(t,e){return new f(t,{},e)},tfSubError:function(t,e,r){return t instanceof c?(e=e+"."+t.__property,t=new c(t.__type,e,t.__label,t.__value,t.__valueTypeName)):t instanceof f&&(t=new c(t.__type,e,r,t.__value,t.__valueTypeName)),o(t),t},tfJSON:a,getValueTypeName:s}},{"./native":167}],165:[function(t,e,r){(function(r){var n=t("./native"),i=t("./errors");function s(t){return r.isBuffer(t)}function o(t){return"string"==typeof t&&/^([0-9a-f]{2})+$/i.test(t)}function a(t,e){var r=t.toJSON();function n(n){if(!t(n))return!1;if(n.length===e)return!0;throw i.tfCustomError(r+"(Length: "+e+")",r+"(Length: "+n.length+")")}return n.toJSON=function(){return r},n}var u=a.bind(null,n.Array),f=a.bind(null,s),c=a.bind(null,o),h=a.bind(null,n.String);var d=Math.pow(2,53)-1;var p={ArrayN:u,Buffer:s,BufferN:f,Finite:function(t){return"number"==typeof t&&isFinite(t)},Hex:o,HexN:c,Int8:function(t){return t<<24>>24===t},Int16:function(t){return t<<16>>16===t},Int32:function(t){return(0|t)===t},Int53:function(t){return"number"==typeof t&&t>=-d&&t<=d&&Math.floor(t)===t},Range:function(t,e,r){function i(n,i){return r(n,i)&&n>t&&n>>0===t},UInt53:function(t){return"number"==typeof t&&t>=0&&t<=d&&Math.floor(t)===t}};for(var l in p)p[l].toJSON=function(t){return t}.bind(null,l);e.exports=p}).call(this,{isBuffer:t("../is-buffer/index.js")})},{"../is-buffer/index.js":108,"./errors":164,"./native":167}],166:[function(t,e,r){var n=t("./errors"),i=t("./native"),s=n.tfJSON,o=n.TfTypeError,a=n.TfPropertyTypeError,u=n.tfSubError,f=n.getValueTypeName,c={arrayOf:function(t,e){function r(r,n){return!!i.Array(r)&&(!i.Nil(r)&&(!(void 0!==e.minLength&&r.lengthe.maxLength)&&((void 0===e.length||r.length===e.length)&&r.every((function(e,r){try{return d(t,e,n)}catch(t){throw u(t,r)}}))))))}return t=h(t),e=e||{},r.toJSON=function(){var r="["+s(t)+"]";return void 0!==e.length?r+="{"+e.length+"}":void 0===e.minLength&&void 0===e.maxLength||(r+="{"+(void 0===e.minLength?0:e.minLength)+","+(void 0===e.maxLength?1/0:e.maxLength)+"}"),r},r},maybe:function t(e){function r(r,n){return i.Nil(r)||e(r,n,t)}return e=h(e),r.toJSON=function(){return"?"+s(e)},r},map:function(t,e){function r(r,n){if(!i.Object(r))return!1;if(i.Nil(r))return!1;for(var s in r){try{e&&d(e,s,n)}catch(t){throw u(t,s,"key")}try{var o=r[s];d(t,o,n)}catch(t){throw u(t,s)}}return!0}return t=h(t),e&&(e=h(e)),r.toJSON=e?function(){return"{"+s(e)+": "+s(t)+"}"}:function(){return"{"+s(t)+"}"},r},object:function(t){var e={};for(var r in t)e[r]=h(t[r]);function n(t,r){if(!i.Object(t))return!1;if(i.Nil(t))return!1;var n;try{for(n in e){d(e[n],t[n],r)}}catch(t){throw u(t,n)}if(r)for(n in t)if(!e[n])throw new a(void 0,n);return!0}return n.toJSON=function(){return s(e)},n},anyOf:function(){var t=[].slice.call(arguments).map(h);function e(e,r){return t.some((function(t){try{return d(t,e,r)}catch(t){return!1}}))}return e.toJSON=function(){return t.map(s).join("|")},e},allOf:function(){var t=[].slice.call(arguments).map(h);function e(e,r){return t.every((function(t){try{return d(t,e,r)}catch(t){return!1}}))}return e.toJSON=function(){return t.map(s).join(" & ")},e},quacksLike:function(t){function e(e){return t===f(e)}return e.toJSON=function(){return t},e},tuple:function(){var t=[].slice.call(arguments).map(h);function e(e,r){return!i.Nil(e)&&(!i.Nil(e.length)&&((!r||e.length===t.length)&&t.every((function(t,n){try{return d(t,e[n],r)}catch(t){throw u(t,n)}}))))}return e.toJSON=function(){return"("+t.map(s).join(", ")+")"},e},value:function(t){function e(e){return e===t}return e.toJSON=function(){return t},e}};function h(t){if(i.String(t))return"?"===t[0]?c.maybe(t.slice(1)):i[t]||c.quacksLike(t);if(t&&i.Object(t)){if(i.Array(t)){if(1!==t.length)throw new TypeError("Expected compile() parameter of type Array of length 1");return c.arrayOf(t[0])}return c.object(t)}return i.Function(t)?t:c.value(t)}function d(t,e,r,n){if(i.Function(t)){if(t(e,r))return!0;throw new o(n||t,e)}return d(h(t),e,r)}for(var p in c.oneOf=c.anyOf,i)d[p]=i[p];for(p in c)d[p]=c[p];var l=t("./extra");for(p in l)d[p]=l[p];d.compile=h,d.TfTypeError=o,d.TfPropertyTypeError=a,e.exports=d},{"./errors":164,"./extra":165,"./native":167}],167:[function(t,e,r){var n={Array:function(t){return null!=t&&t.constructor===Array},Boolean:function(t){return"boolean"==typeof t},Function:function(t){return"function"==typeof t},Nil:function(t){return null==t},Number:function(t){return"number"==typeof t},Object:function(t){return"object"==typeof t},String:function(t){return"string"==typeof t},"":function(){return!0}};for(var i in n.Null=n.Nil,n)n[i].toJSON=function(t){return t}.bind(null,i);e.exports=n},{}],168:[function(t,e,r){(function(t){function r(e){try{if(!t.localStorage)return!1}catch(t){return!1}var r=t.localStorage[e];return null!=r&&"true"===String(r).toLowerCase()}e.exports=function(t,e){if(r("noDeprecation"))return t;var n=!1;return function(){if(!n){if(r("throwDeprecation"))throw new Error(e);r("traceDeprecation")?console.trace(e):console.warn(e),n=!0}return t.apply(this,arguments)}}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],169:[function(t,e,r){"use strict";var n=t("safe-buffer").Buffer;function i(t){if(t<0||t>9007199254740991||t%1!=0)throw new RangeError("value out of range")}function s(t){return i(t),t<253?1:t<=65535?3:t<=4294967295?5:9}e.exports={encode:function t(e,r,o){if(i(e),r||(r=n.allocUnsafe(s(e))),!n.isBuffer(r))throw new TypeError("buffer must be a Buffer instance");return o||(o=0),e<253?(r.writeUInt8(e,o),t.bytes=1):e<=65535?(r.writeUInt8(253,o),r.writeUInt16LE(e,o+1),t.bytes=3):e<=4294967295?(r.writeUInt8(254,o),r.writeUInt32LE(e,o+1),t.bytes=5):(r.writeUInt8(255,o),r.writeUInt32LE(e>>>0,o+1),r.writeUInt32LE(e/4294967296|0,o+5),t.bytes=9),r},decode:function t(e,r){if(!n.isBuffer(e))throw new TypeError("buffer must be a Buffer instance");r||(r=0);var s=e.readUInt8(r);if(s<253)return t.bytes=1,s;if(253===s)return t.bytes=3,e.readUInt16LE(r+1);if(254===s)return t.bytes=5,e.readUInt32LE(r+1);t.bytes=9;var o=e.readUInt32LE(r+1),a=4294967296*e.readUInt32LE(r+5)+o;return i(a),a},encodingLength:s}},{"safe-buffer":133}],170:[function(t,e,r){(function(r){var n=t("bs58check");function i(t,e){if(void 0!==e&&t[0]!==e)throw new Error("Invalid network version");if(33===t.length)return{version:t[0],privateKey:t.slice(1,33),compressed:!1};if(34!==t.length)throw new Error("Invalid WIF length");if(1!==t[33])throw new Error("Invalid compression flag");return{version:t[0],privateKey:t.slice(1,33),compressed:!0}}function s(t,e,n){var i=new r(n?34:33);return i.writeUInt8(t,0),e.copy(i,1),n&&(i[33]=1),i}e.exports={decode:function(t,e){return i(n.decode(t),e)},decodeRaw:i,encode:function(t,e,r){return"number"==typeof t?n.encode(s(t,e,r)):n.encode(s(t.version,t.privateKey,t.compressed))},encodeRaw:s}}).call(this,t("buffer").Buffer)},{bs58check:84,buffer:81}],171:[function(t,e,r){const{bip32:n,networks:i,payments:s,address:o,script:a,Psbt:u,ECPair:f}=t("bitcoinjs-lib"),{Buffer:c}=t("buffer");e.exports={bip32:n,networks:i,payments:s,address:o,script:a,Psbt:u,ECPair:f,Buffer:c}},{"bitcoinjs-lib":39,buffer:81}]},{},[171])(171)})); \ No newline at end of file +var n=t("buffer"),i=n.Buffer;function s(t,e){for(var r in t)e[r]=t[r]}function o(t,e,r){return i(t,e,r)}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?e.exports=n:(s(n,r),r.Buffer=o),o.prototype=Object.create(i.prototype),s(i,o),o.from=function(t,e,r){if("number"==typeof t)throw new TypeError("Argument must not be a number");return i(t,e,r)},o.alloc=function(t,e,r){if("number"!=typeof t)throw new TypeError("Argument must be a number");var n=i(t);return void 0!==e?"string"==typeof r?n.fill(e,r):n.fill(e):n.fill(0),n},o.allocUnsafe=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return i(t)},o.allocUnsafeSlow=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return n.SlowBuffer(t)}},{buffer:81}],145:[function(t,e,r){(function(e,n){var i=t("process/browser.js").nextTick,s=Function.prototype.apply,o=Array.prototype.slice,a={},u=0;function f(t,e){this._id=t,this._clearFn=e}r.setTimeout=function(){return new f(s.call(setTimeout,window,arguments),clearTimeout)},r.setInterval=function(){return new f(s.call(setInterval,window,arguments),clearInterval)},r.clearTimeout=r.clearInterval=function(t){t.close()},f.prototype.unref=f.prototype.ref=function(){},f.prototype.close=function(){this._clearFn.call(window,this._id)},r.enroll=function(t,e){clearTimeout(t._idleTimeoutId),t._idleTimeout=e},r.unenroll=function(t){clearTimeout(t._idleTimeoutId),t._idleTimeout=-1},r._unrefActive=r.active=function(t){clearTimeout(t._idleTimeoutId);var e=t._idleTimeout;e>=0&&(t._idleTimeoutId=setTimeout((function(){t._onTimeout&&t._onTimeout()}),e))},r.setImmediate="function"==typeof e?e:function(t){var e=u++,n=!(arguments.length<2)&&o.call(arguments,1);return a[e]=!0,i((function(){a[e]&&(n?t.apply(null,n):t.call(null),r.clearImmediate(e))})),e},r.clearImmediate="function"==typeof n?n:function(t){delete a[t]}}).call(this,t("timers").setImmediate,t("timers").clearImmediate)},{"process/browser.js":115,timers:145}],146:[function(t,e,r){(function(r){const n=t("bn.js"),i=new(0,t("elliptic").ec)("secp256k1"),s=t("./rfc6979"),o=r.alloc(32,0),a=r.from("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141","hex"),u=r.from("fffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f","hex"),f=i.curve.n,c=f.shrn(1),h=i.curve.g,d="Expected Private",p="Expected Point",l="Expected Tweak",b="Expected Hash";function y(t){return r.isBuffer(t)&&32===t.length}function m(t){return!!y(t)&&t.compare(a)<0}function g(t){if(!r.isBuffer(t))return!1;if(t.length<33)return!1;const e=t[0],n=t.slice(1,33);if(0===n.compare(o))return!1;if(n.compare(u)>=0)return!1;if((2===e||3===e)&&33===t.length){try{k(t)}catch(t){return!1}return!0}const i=t.slice(33);return 0!==i.compare(o)&&(!(i.compare(u)>=0)&&(4===e&&65===t.length))}function w(t){return 4!==t[0]}function v(t){return!!y(t)&&(t.compare(o)>0&&t.compare(a)<0)}function _(t,e){return void 0===t&&void 0!==e?w(e):void 0===t||t}function S(t){return new n(t)}function E(t){return t.toArrayLike(r,"be",32)}function k(t){return i.curve.decodePoint(t)}function I(t,e){return r.from(t._encode(e))}function T(t,e,n){if(!y(t))throw new TypeError(b);if(!v(e))throw new TypeError(d);if(void 0!==n&&!y(n))throw new TypeError("Expected Extra Data (32 bytes)");const i=S(e),o=S(t);let a,u;s(t,e,(function(t){const e=S(t),r=h.mul(e);return!r.isInfinity()&&(a=r.x.umod(f),0!==a.isZero()&&(u=e.invm(f).mul(o.add(i.mul(a))).umod(f),0!==u.isZero()))}),v,n),u.cmp(c)>0&&(u=f.sub(u));const p=r.allocUnsafe(64);return E(a).copy(p,0),E(u).copy(p,32),p}e.exports={isPoint:g,isPointCompressed:function(t){return!!g(t)&&w(t)},isPrivate:v,pointAdd:function(t,e,r){if(!g(t))throw new TypeError(p);if(!g(e))throw new TypeError(p);const n=k(t),i=k(e),s=n.add(i);return s.isInfinity()?null:I(s,_(r,t))},pointAddScalar:function(t,e,r){if(!g(t))throw new TypeError(p);if(!m(e))throw new TypeError(l);const n=_(r,t),i=k(t);if(0===e.compare(o))return I(i,n);const s=S(e),a=h.mul(s),u=i.add(a);return u.isInfinity()?null:I(u,n)},pointCompress:function(t,e){if(!g(t))throw new TypeError(p);const r=k(t);if(r.isInfinity())throw new TypeError(p);return I(r,e)},pointFromScalar:function(t,e){if(!v(t))throw new TypeError(d);const r=S(t),n=h.mul(r);return n.isInfinity()?null:I(n,_(e))},pointMultiply:function(t,e,r){if(!g(t))throw new TypeError(p);if(!m(e))throw new TypeError(l);const n=_(r,t),i=k(t),s=S(e),o=i.mul(s);return o.isInfinity()?null:I(o,n)},privateAdd:function(t,e){if(!v(t))throw new TypeError(d);if(!m(e))throw new TypeError(l);const r=S(t),n=S(e),i=E(r.add(n).umod(f));return v(i)?i:null},privateSub:function(t,e){if(!v(t))throw new TypeError(d);if(!m(e))throw new TypeError(l);const r=S(t),n=S(e),i=E(r.sub(n).umod(f));return v(i)?i:null},sign:function(t,e){return T(t,e)},signWithEntropy:function(t,e,r){return T(t,e,r)},verify:function(t,e,n){if(!y(t))throw new TypeError(b);if(!g(e))throw new TypeError(p);if(!function(t){const e=t.slice(0,32),n=t.slice(32,64);return r.isBuffer(t)&&64===t.length&&e.compare(a)<0&&n.compare(a)<0}(n))throw new TypeError("Expected Signature");const i=k(e),s=S(n.slice(0,32)),o=S(n.slice(32,64));if(s.gtn(0)<=0)return!1;if(o.gtn(0)<=0)return!1;const u=S(t),c=o.invm(f),d=u.mul(c).umod(f),l=s.mul(c).umod(f),m=h.mulAdd(d,i,l);return!m.isInfinity()&&m.x.umod(f).eq(s)}}}).call(this,t("buffer").Buffer)},{"./rfc6979":163,"bn.js":78,buffer:81,elliptic:147}],147:[function(t,e,r){"use strict";var n=r;n.version=t("../package.json").version,n.utils=t("./elliptic/utils"),n.rand=t("brorand"),n.curve=t("./elliptic/curve"),n.curves=t("./elliptic/curves"),n.ec=t("./elliptic/ec"),n.eddsa=t("./elliptic/eddsa")},{"../package.json":162,"./elliptic/curve":150,"./elliptic/curves":153,"./elliptic/ec":154,"./elliptic/eddsa":157,"./elliptic/utils":161,brorand:79}],148:[function(t,e,r){"use strict";var n=t("bn.js"),i=t("../utils"),s=i.getNAF,o=i.getJSF,a=i.assert;function u(t,e){this.type=t,this.p=new n(e.p,16),this.red=e.prime?n.red(e.prime):n.mont(this.p),this.zero=new n(0).toRed(this.red),this.one=new n(1).toRed(this.red),this.two=new n(2).toRed(this.red),this.n=e.n&&new n(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}e.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(),n=s(e,1,this._bitLength),i=(1<=u;e--)f=(f<<1)+n[e];o.push(f)}for(var c=this.jpoint(null,null,null),h=this.jpoint(null,null,null),d=i;d>0;d--){for(u=0;u=0;f--){for(e=0;f>=0&&0===o[f];f--)e++;if(f>=0&&e++,u=u.dblp(e),f<0)break;var c=o[f];a(0!==c),u="affine"===t.type?c>0?u.mixedAdd(i[c-1>>1]):u.mixedAdd(i[-c-1>>1].neg()):c>0?u.add(i[c-1>>1]):u.add(i[-c-1>>1].neg())}return"affine"===t.type?u.toP():u},u.prototype._wnafMulAdd=function(t,e,r,n,i){for(var a=this._wnafT1,u=this._wnafT2,f=this._wnafT3,c=0,h=0;h=1;h-=2){var p=h-1,l=h;if(1===a[p]&&1===a[l]){var b=[e[p],null,null,e[l]];0===e[p].y.cmp(e[l].y)?(b[1]=e[p].add(e[l]),b[2]=e[p].toJ().mixedAdd(e[l].neg())):0===e[p].y.cmp(e[l].y.redNeg())?(b[1]=e[p].toJ().mixedAdd(e[l]),b[2]=e[p].add(e[l].neg())):(b[1]=e[p].toJ().mixedAdd(e[l]),b[2]=e[p].toJ().mixedAdd(e[l].neg()));var y=[-3,-1,-5,-7,0,7,5,1,3],m=o(r[p],r[l]);c=Math.max(m[0].length,c),f[p]=new Array(c),f[l]=new Array(c);for(var g=0;g=0;h--){for(var E=0;h>=0;){var k=!0;for(g=0;g=0&&E++,_=_.dblp(E),h<0)break;for(g=0;g0?I=u[g][T-1>>1]:T<0&&(I=u[g][-T-1>>1].neg()),_="affine"===I.type?_.mixedAdd(I):_.add(I))}}for(h=0;h=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],n=this,i=0;i":""},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 n=this.curve._mulA(t),i=this.x.redAdd(this.y).redSqr().redISub(t).redISub(e),s=n.redAdd(e),o=s.redSub(r),a=n.redSub(e),u=i.redMul(o),f=s.redMul(a),c=i.redMul(a),h=o.redMul(s);return this.curve.point(u,f,h,c)},f.prototype._projDbl=function(){var t,e,r,n=this.x.redAdd(this.y).redSqr(),i=this.x.redSqr(),s=this.y.redSqr();if(this.curve.twisted){var o=(f=this.curve._mulA(i)).redAdd(s);if(this.zOne)t=n.redSub(i).redSub(s).redMul(o.redSub(this.curve.two)),e=o.redMul(f.redSub(s)),r=o.redSqr().redSub(o).redSub(o);else{var a=this.z.redSqr(),u=o.redSub(a).redISub(a);t=n.redSub(i).redISub(s).redMul(u),e=o.redMul(f.redSub(s)),r=o.redMul(u)}}else{var f=i.redAdd(s);a=this.curve._mulC(this.z).redSqr(),u=f.redSub(a).redSub(a);t=this.curve._mulC(n.redISub(f)).redMul(u),e=this.curve._mulC(f).redMul(i.redISub(s)),r=f.redMul(u)}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)),n=this.t.redMul(this.curve.dd).redMul(t.t),i=this.z.redMul(t.z.redAdd(t.z)),s=r.redSub(e),o=i.redSub(n),a=i.redAdd(n),u=r.redAdd(e),f=s.redMul(o),c=a.redMul(u),h=s.redMul(u),d=o.redMul(a);return this.curve.point(f,c,d,h)},f.prototype._projAdd=function(t){var e,r,n=this.z.redMul(t.z),i=n.redSqr(),s=this.x.redMul(t.x),o=this.y.redMul(t.y),a=this.curve.d.redMul(s).redMul(o),u=i.redSub(a),f=i.redAdd(a),c=this.x.redAdd(this.y).redMul(t.x.redAdd(t.y)).redISub(s).redISub(o),h=n.redMul(u).redMul(c);return this.curve.twisted?(e=n.redMul(f).redMul(o.redSub(this.curve._mulA(s))),r=u.redMul(f)):(e=n.redMul(f).redMul(o.redSub(s)),r=this.curve._mulC(u).redMul(f)),this.curve.point(h,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(),n=this.curve.redN.redMul(this.z);;){if(r.iadd(this.curve.n),r.cmp(this.curve.p)>=0)return!1;if(e.redIAdd(n),0===this.x.cmp(e))return!0}},f.prototype.toP=f.prototype.normalize,f.prototype.mixedAdd=f.prototype.add},{"../utils":161,"./base":148,"bn.js":78,inherits:107}],150:[function(t,e,r){"use strict";var n=r;n.base=t("./base"),n.short=t("./short"),n.mont=t("./mont"),n.edwards=t("./edwards")},{"./base":148,"./edwards":149,"./mont":151,"./short":152}],151:[function(t,e,r){"use strict";var n=t("bn.js"),i=t("inherits"),s=t("./base"),o=t("../utils");function a(t){s.call(this,"mont",t),this.a=new n(t.a,16).toRed(this.red),this.b=new n(t.b,16).toRed(this.red),this.i4=new n(4).toRed(this.red).redInvm(),this.two=new n(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 n(e,16),this.z=new n(r,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}i(a,s),e.exports=a,a.prototype.validate=function(t){var e=t.normalize().x,r=e.redSqr(),n=r.redMul(e).redAdd(r.redMul(this.a)).redAdd(e);return 0===n.redSqrt().redSqr().cmp(n)},i(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()?"":""},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),n=t.redMul(e),i=r.redMul(e.redAdd(this.curve.a24.redMul(r)));return this.curve.point(n,i)},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),n=this.x.redSub(this.z),i=t.x.redAdd(t.z),s=t.x.redSub(t.z).redMul(r),o=i.redMul(n),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,n=this.curve.point(null,null),i=[];0!==e.cmpn(0);e.iushrn(1))i.push(e.andln(1));for(var s=i.length-1;s>=0;s--)0===i[s]?(r=r.diffAdd(n,this),n=n.dbl()):(n=r.diffAdd(n,this),r=r.dbl());return n},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()}},{"../utils":161,"./base":148,"bn.js":78,inherits:107}],152:[function(t,e,r){"use strict";var n=t("../utils"),i=t("bn.js"),s=t("inherits"),o=t("./base"),a=n.assert;function u(t){o.call(this,"short",t),this.a=new i(t.a,16).toRed(this.red),this.b=new i(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,n){o.BasePoint.call(this,t,"affine"),null===e&&null===r?(this.x=null,this.y=null,this.inf=!0):(this.x=new i(e,16),this.y=new i(r,16),n&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.inf=!1)}function c(t,e,r,n){o.BasePoint.call(this,t,"jacobian"),null===e&&null===r&&null===n?(this.x=this.curve.one,this.y=this.curve.one,this.z=new i(0)):(this.x=new i(e,16),this.y=new i(r,16),this.z=new i(n,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}s(u,o),e.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 i(t.beta,16).toRed(this.red);else{var n=this._getEndoRoots(this.p);e=(e=n[0].cmp(n[1])<0?n[0]:n[1]).toRed(this.red)}if(t.lambda)r=new i(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 i(t.a,16),b:new i(t.b,16)}})):this._getEndoBasis(r)}}},u.prototype._getEndoRoots=function(t){var e=t===this.p?this.red:i.mont(t),r=new i(2).toRed(e).redInvm(),n=r.redNeg(),s=new i(3).toRed(e).redNeg().redSqrt().redMul(r);return[n.redAdd(s).fromRed(),n.redSub(s).fromRed()]},u.prototype._getEndoBasis=function(t){for(var e,r,n,s,o,a,u,f,c,h=this.n.ushrn(Math.floor(this.n.bitLength()/2)),d=t,p=this.n.clone(),l=new i(1),b=new i(0),y=new i(0),m=new i(1),g=0;0!==d.cmpn(0);){var w=p.div(d);f=p.sub(w.mul(d)),c=y.sub(w.mul(l));var v=m.sub(w.mul(b));if(!n&&f.cmp(h)<0)e=u.neg(),r=l,n=f.neg(),s=c;else if(n&&2==++g)break;u=f,p=d,d=f,y=l,l=c,m=b,b=v}o=f.neg(),a=c;var _=n.sqr().add(s.sqr());return o.sqr().add(a.sqr()).cmp(_)>=0&&(o=e,a=r),n.negative&&(n=n.neg(),s=s.neg()),o.negative&&(o=o.neg(),a=a.neg()),[{a:n,b:s},{a:o,b:a}]},u.prototype._endoSplit=function(t){var e=this.endo.basis,r=e[0],n=e[1],i=n.b.mul(t).divRound(this.n),s=r.b.neg().mul(t).divRound(this.n),o=i.mul(r.a),a=s.mul(n.a),u=i.mul(r.b),f=s.mul(n.b);return{k1:t.sub(o).sub(a),k2:u.add(f).neg()}},u.prototype.pointFromX=function(t,e){(t=new i(t,16)).red||(t=t.toRed(this.red));var r=t.redSqr().redMul(t).redIAdd(t.redMul(this.a)).redIAdd(this.b),n=r.redSqrt();if(0!==n.redSqr().redSub(r).cmp(this.zero))throw new Error("invalid point");var s=n.fromRed().isOdd();return(e&&!s||!e&&s)&&(n=n.redNeg()),this.point(t,n)},u.prototype.validate=function(t){if(t.inf)return!0;var e=t.x,r=t.y,n=this.a.redMul(e),i=e.redSqr().redMul(e).redIAdd(n).redIAdd(this.b);return 0===r.redSqr().redISub(i).cmpn(0)},u.prototype._endoWnafMulAdd=function(t,e,r){for(var n=this._endoWnafT1,i=this._endoWnafT2,s=0;s":""},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),n=e.redMul(this.x.redSub(r)).redISub(this.y);return this.curve.point(r,n)},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(),n=t.redInvm(),i=r.redAdd(r).redIAdd(r).redIAdd(e).redMul(n),s=i.redSqr().redISub(this.x.redAdd(this.x)),o=i.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 i(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 n=[this,e],i=[t,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,i):this.curve._wnafMulAdd(1,n,i,2)},f.prototype.jmulAdd=function(t,e,r){var n=[this,e],i=[t,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,i,!0):this.curve._wnafMulAdd(1,n,i,2,!0)},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,n=function(t){return t.neg()};e.precomputed={naf:r.naf&&{wnd:r.naf.wnd,points:r.naf.points.map(n)},doubles:r.doubles&&{step:r.doubles.step,points:r.doubles.points.map(n)}}}return e},f.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},s(c,o.BasePoint),u.prototype.jpoint=function(t,e,r){return new c(this,t,e,r)},c.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var t=this.z.redInvm(),e=t.redSqr(),r=this.x.redMul(e),n=this.y.redMul(e).redMul(t);return this.curve.point(r,n)},c.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},c.prototype.add=function(t){if(this.isInfinity())return t;if(t.isInfinity())return this;var e=t.z.redSqr(),r=this.z.redSqr(),n=this.x.redMul(e),i=t.x.redMul(r),s=this.y.redMul(e.redMul(t.z)),o=t.y.redMul(r.redMul(this.z)),a=n.redSub(i),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(),c=f.redMul(a),h=n.redMul(f),d=u.redSqr().redIAdd(c).redISub(h).redISub(h),p=u.redMul(h.redISub(d)).redISub(s.redMul(c)),l=this.z.redMul(t.z).redMul(a);return this.curve.jpoint(d,p,l)},c.prototype.mixedAdd=function(t){if(this.isInfinity())return t.toJ();if(t.isInfinity())return this;var e=this.z.redSqr(),r=this.x,n=t.x.redMul(e),i=this.y,s=t.y.redMul(e).redMul(this.z),o=r.redSub(n),a=i.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),c=r.redMul(u),h=a.redSqr().redIAdd(f).redISub(c).redISub(c),d=a.redMul(c.redISub(h)).redISub(i.redMul(f)),p=this.z.redMul(o);return this.curve.jpoint(h,d,p)},c.prototype.dblp=function(t){if(0===t)return this;if(this.isInfinity())return this;if(!t)return this.dbl();if(this.curve.zeroA||this.curve.threeA){for(var e=this,r=0;r=0)return!1;if(r.redIAdd(i),0===this.x.cmp(r))return!0}},c.prototype.inspect=function(){return this.isInfinity()?"":""},c.prototype.isInfinity=function(){return 0===this.z.cmpn(0)}},{"../utils":161,"./base":148,"bn.js":78,inherits:107}],153:[function(t,e,r){"use strict";var n,i=r,s=t("hash.js"),o=t("./curve"),a=t("./utils").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(i,t,{configurable:!0,enumerable:!0,get:function(){var r=new u(e);return Object.defineProperty(i,t,{configurable:!0,enumerable:!0,value:r}),r}})}i.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{n=t("./precomputed/secp256k1")}catch(t){n=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",n]})},{"./curve":150,"./precomputed/secp256k1":160,"./utils":161,"hash.js":93}],154:[function(t,e,r){"use strict";var n=t("bn.js"),i=t("hmac-drbg"),s=t("../utils"),o=t("../curves"),a=t("brorand"),u=s.assert,f=t("./key"),c=t("./signature");function h(t){if(!(this instanceof h))return new h(t);"string"==typeof t&&(u(o.hasOwnProperty(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}e.exports=h,h.prototype.keyPair=function(t){return new f(this,t)},h.prototype.keyFromPrivate=function(t,e){return f.fromPrivate(this,t,e)},h.prototype.keyFromPublic=function(t,e){return f.fromPublic(this,t,e)},h.prototype.genKeyPair=function(t){t||(t={});for(var e=new i({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 n(2));;){var o=new n(e.generate(r));if(!(o.cmp(s)>0))return o.iaddn(1),this.keyFromPrivate(o)}},h.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},h.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 n(t,16));for(var o=this.n.byteLength(),a=e.getPrivate().toArray("be",o),u=t.toArray("be",o),f=new i({hash:this.hash,entropy:a,nonce:u,pers:s.pers,persEnc:s.persEnc||"utf8"}),h=this.n.sub(new n(1)),d=0;;d++){var p=s.k?s.k(d):new n(f.generate(this.n.byteLength()));if(!((p=this._truncateToN(p,!0)).cmpn(1)<=0||p.cmp(h)>=0)){var l=this.g.mul(p);if(!l.isInfinity()){var b=l.getX(),y=b.umod(this.n);if(0!==y.cmpn(0)){var m=p.invm(this.n).mul(y.mul(e.getPrivate()).iadd(t));if(0!==(m=m.umod(this.n)).cmpn(0)){var g=(l.getY().isOdd()?1:0)|(0!==b.cmp(y)?2:0);return s.canonical&&m.cmp(this.nh)>0&&(m=this.n.sub(m),g^=1),new c({r:y,s:m,recoveryParam:g})}}}}}},h.prototype.verify=function(t,e,r,i){t=this._truncateToN(new n(t,16)),r=this.keyFromPublic(r,i);var s=(e=new c(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),h=u.mul(s).umod(this.n);return this.curve._maxwellTrick?!(a=this.g.jmulAdd(f,r.getPublic(),h)).isInfinity()&&a.eqXToP(s):!(a=this.g.mulAdd(f,r.getPublic(),h)).isInfinity()&&0===a.getX().umod(this.n).cmp(s)},h.prototype.recoverPubKey=function(t,e,r,i){u((3&r)===r,"The recovery param is more than two bits"),e=new c(e,i);var s=this.n,o=new n(t),a=e.r,f=e.s,h=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),h):this.curve.pointFromX(a,h);var p=e.r.invm(s),l=s.sub(o).mul(p).umod(s),b=f.mul(p).umod(s);return this.g.mulAdd(l,a,b)},h.prototype.getKeyRecoveryParam=function(t,e,r,n){if(null!==(e=new c(e,n)).recoveryParam)return e.recoveryParam;for(var i=0;i<4;i++){var s;try{s=this.recoverPubKey(t,e,i)}catch(t){continue}if(s.eq(r))return i}throw new Error("Unable to find valid recovery factor")}},{"../curves":153,"../utils":161,"./key":155,"./signature":156,"bn.js":78,brorand:79,"hmac-drbg":105}],155:[function(t,e,r){"use strict";var n=t("bn.js"),i=t("../utils").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)}e.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 n(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?i(t.x,"Need x coordinate"):"short"!==this.ec.curve.type&&"edwards"!==this.ec.curve.type||i(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.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""}},{"../utils":161,"bn.js":78}],156:[function(t,e,r){"use strict";var n=t("bn.js"),i=t("../utils"),s=i.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 n(t.r,16),this.s=new n(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;for(var n=15&r,i=0,s=0,o=e.place;s>>3);for(t.push(128|r);--r;)t.push(e>>>(r<<3)&255);t.push(e)}}e.exports=o,o.prototype._importDER=function(t,e){t=i.toArray(t,e);var r=new a;if(48!==t[r.place++])return!1;if(u(t,r)+r.place!==t.length)return!1;if(2!==t[r.place++])return!1;var s=u(t,r),o=t.slice(r.place,s+r.place);if(r.place+=s,2!==t[r.place++])return!1;var f=u(t,r);if(t.length!==f+r.place)return!1;var c=t.slice(r.place,f+r.place);return 0===o[0]&&128&o[1]&&(o=o.slice(1)),0===c[0]&&128&c[1]&&(c=c.slice(1)),this.r=new n(o),this.s=new n(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 n=[2];c(n,e.length),(n=n.concat(e)).push(2),c(n,r.length);var s=n.concat(r),o=[48];return c(o,s.length),o=o.concat(s),i.encode(o,t)}},{"../utils":161,"bn.js":78}],157:[function(t,e,r){"use strict";var n=t("hash.js"),i=t("../curves"),s=t("../utils"),o=s.assert,a=s.parseBytes,u=t("./key"),f=t("./signature");function c(t){if(o("ed25519"===t,"only tested with ed25519 so far"),!(this instanceof c))return new c(t);t=i[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=n.sha512}e.exports=c,c.prototype.sign=function(t,e){t=a(t);var r=this.keyFromSecret(e),n=this.hashInt(r.messagePrefix(),t),i=this.g.mul(n),s=this.encodePoint(i),o=this.hashInt(s,r.pubBytes(),t).mul(r.priv()),u=n.add(o).umod(this.curve.n);return this.makeSignature({R:i,S:u,Rencoded:s})},c.prototype.verify=function(t,e,r){t=a(t),e=this.makeSignature(e);var n=this.keyFromPublic(r),i=this.hashInt(e.Rencoded(),n.pubBytes(),t),s=this.g.mul(e.S());return e.R().add(n.pub().mul(i)).eq(s)},c.prototype.hashInt=function(){for(var t=this.hash(),e=0;e(i>>1)-1?(i>>1)-u:u,s.isubn(a)):a=0,n[o]=a,s.iushrn(1)}return n},n.getJSF=function(t,e){var r=[[],[]];t=t.clone(),e=e.clone();for(var n=0,i=0;t.cmpn(-n)>0||e.cmpn(-i)>0;){var s,o,a,u=t.andln(3)+n&3,f=e.andln(3)+i&3;if(3===u&&(u=-1),3===f&&(f=-1),0==(1&u))s=0;else s=3!==(a=t.andln(7)+n&7)&&5!==a||2!==f?u:-u;if(r[0].push(s),0==(1&f))o=0;else o=3!==(a=e.andln(7)+i&7)&&5!==a||2!==u?f:-f;r[1].push(o),2*n===s+1&&(n=1-n),2*i===o+1&&(i=1-i),t.iushrn(1),e.iushrn(1)}return r},n.cachedProperty=function(t,e,r){var n="_"+e;t.prototype[e]=function(){return void 0!==this[n]?this[n]:this[n]=r.call(this)}},n.parseBytes=function(t){return"string"==typeof t?n.toArray(t,"hex"):t},n.intFromLE=function(t){return new i(t,"hex","le")}},{"bn.js":78,"minimalistic-assert":112,"minimalistic-crypto-utils":113}],162:[function(t,e,r){e.exports={name:"elliptic",version:"6.5.2",description:"EC cryptography",main:"lib/elliptic.js",files:["lib"],scripts:{jscs:"jscs benchmarks/*.js lib/*.js lib/**/*.js lib/**/**/*.js test/index.js",jshint:"jscs benchmarks/*.js lib/*.js lib/**/*.js lib/**/**/*.js test/index.js",lint:"npm run jscs && npm run jshint",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 ",license:"MIT",bugs:{url:"https://github.com/indutny/elliptic/issues"},homepage:"https://github.com/indutny/elliptic",devDependencies:{brfs:"^1.4.3",coveralls:"^3.0.8",grunt:"^1.0.4","grunt-browserify":"^5.0.0","grunt-cli":"^1.2.0","grunt-contrib-connect":"^1.0.0","grunt-contrib-copy":"^1.0.0","grunt-contrib-uglify":"^1.0.1","grunt-mocha-istanbul":"^3.0.1","grunt-saucelabs":"^9.0.1",istanbul:"^0.4.2",jscs:"^3.0.7",jshint:"^2.10.3",mocha:"^6.2.2"},dependencies:{"bn.js":"^4.4.0",brorand:"^1.0.1","hash.js":"^1.0.0","hmac-drbg":"^1.0.0",inherits:"^2.0.1","minimalistic-assert":"^1.0.0","minimalistic-crypto-utils":"^1.0.0"}}},{}],163:[function(t,e,r){(function(r){const n=t("create-hmac"),i=r.alloc(1,1),s=r.alloc(1,0);e.exports=function(t,e,o,a,u){let f=r.alloc(32,0),c=r.alloc(32,1);f=n("sha256",f).update(c).update(s).update(e).update(t).update(u||"").digest(),c=n("sha256",f).update(c).digest(),f=n("sha256",f).update(c).update(i).update(e).update(t).update(u||"").digest(),c=n("sha256",f).update(c).digest(),c=n("sha256",f).update(c).digest();let h=c;for(;!a(h)||!o(h);)f=n("sha256",f).update(c).update(s).digest(),c=n("sha256",f).update(c).digest(),c=n("sha256",f).update(c).digest(),h=c;return h}}).call(this,t("buffer").Buffer)},{buffer:81,"create-hmac":89}],164:[function(t,e,r){var n=t("./native");function i(t){return t.name||t.toString().match(/function (.*?)\s*\(/)[1]}function s(t){return n.Nil(t)?"":i(t.constructor)}function o(t,e){Error.captureStackTrace&&Error.captureStackTrace(t,e)}function a(t){return n.Function(t)?t.toJSON?t.toJSON():i(t):n.Array(t)?"Array":t&&n.Object(t)?"Object":void 0!==t?t:""}function u(t,e,r){var i=function(t){return n.Function(t)?"":n.String(t)?JSON.stringify(t):t&&n.Object(t)?"":t}(e);return"Expected "+a(t)+", got"+(""!==r?" "+r:"")+(""!==i?" "+i:"")}function f(t,e,r){r=r||s(e),this.message=u(t,e,r),o(this,f),this.__type=t,this.__value=e,this.__valueTypeName=r}function c(t,e,r,n,i){t?(i=i||s(n),this.message=function(t,e,r,n,i){var s='" of type ';return"key"===e&&(s='" with key type '),u('property "'+a(r)+s+a(t),n,i)}(t,r,e,n,i)):this.message='Unexpected property "'+e+'"',o(this,f),this.__label=r,this.__property=e,this.__type=t,this.__value=n,this.__valueTypeName=i}f.prototype=Object.create(Error.prototype),f.prototype.constructor=f,c.prototype=Object.create(Error.prototype),c.prototype.constructor=f,e.exports={TfTypeError:f,TfPropertyTypeError:c,tfCustomError:function(t,e){return new f(t,{},e)},tfSubError:function(t,e,r){return t instanceof c?(e=e+"."+t.__property,t=new c(t.__type,e,t.__label,t.__value,t.__valueTypeName)):t instanceof f&&(t=new c(t.__type,e,r,t.__value,t.__valueTypeName)),o(t),t},tfJSON:a,getValueTypeName:s}},{"./native":167}],165:[function(t,e,r){(function(r){var n=t("./native"),i=t("./errors");function s(t){return r.isBuffer(t)}function o(t){return"string"==typeof t&&/^([0-9a-f]{2})+$/i.test(t)}function a(t,e){var r=t.toJSON();function n(n){if(!t(n))return!1;if(n.length===e)return!0;throw i.tfCustomError(r+"(Length: "+e+")",r+"(Length: "+n.length+")")}return n.toJSON=function(){return r},n}var u=a.bind(null,n.Array),f=a.bind(null,s),c=a.bind(null,o),h=a.bind(null,n.String);var d=Math.pow(2,53)-1;var p={ArrayN:u,Buffer:s,BufferN:f,Finite:function(t){return"number"==typeof t&&isFinite(t)},Hex:o,HexN:c,Int8:function(t){return t<<24>>24===t},Int16:function(t){return t<<16>>16===t},Int32:function(t){return(0|t)===t},Int53:function(t){return"number"==typeof t&&t>=-d&&t<=d&&Math.floor(t)===t},Range:function(t,e,r){function i(n,i){return r(n,i)&&n>t&&n>>0===t},UInt53:function(t){return"number"==typeof t&&t>=0&&t<=d&&Math.floor(t)===t}};for(var l in p)p[l].toJSON=function(t){return t}.bind(null,l);e.exports=p}).call(this,{isBuffer:t("../is-buffer/index.js")})},{"../is-buffer/index.js":108,"./errors":164,"./native":167}],166:[function(t,e,r){var n=t("./errors"),i=t("./native"),s=n.tfJSON,o=n.TfTypeError,a=n.TfPropertyTypeError,u=n.tfSubError,f=n.getValueTypeName,c={arrayOf:function(t,e){function r(r,n){return!!i.Array(r)&&(!i.Nil(r)&&(!(void 0!==e.minLength&&r.lengthe.maxLength)&&((void 0===e.length||r.length===e.length)&&r.every((function(e,r){try{return d(t,e,n)}catch(t){throw u(t,r)}}))))))}return t=h(t),e=e||{},r.toJSON=function(){var r="["+s(t)+"]";return void 0!==e.length?r+="{"+e.length+"}":void 0===e.minLength&&void 0===e.maxLength||(r+="{"+(void 0===e.minLength?0:e.minLength)+","+(void 0===e.maxLength?1/0:e.maxLength)+"}"),r},r},maybe:function t(e){function r(r,n){return i.Nil(r)||e(r,n,t)}return e=h(e),r.toJSON=function(){return"?"+s(e)},r},map:function(t,e){function r(r,n){if(!i.Object(r))return!1;if(i.Nil(r))return!1;for(var s in r){try{e&&d(e,s,n)}catch(t){throw u(t,s,"key")}try{var o=r[s];d(t,o,n)}catch(t){throw u(t,s)}}return!0}return t=h(t),e&&(e=h(e)),r.toJSON=e?function(){return"{"+s(e)+": "+s(t)+"}"}:function(){return"{"+s(t)+"}"},r},object:function(t){var e={};for(var r in t)e[r]=h(t[r]);function n(t,r){if(!i.Object(t))return!1;if(i.Nil(t))return!1;var n;try{for(n in e){d(e[n],t[n],r)}}catch(t){throw u(t,n)}if(r)for(n in t)if(!e[n])throw new a(void 0,n);return!0}return n.toJSON=function(){return s(e)},n},anyOf:function(){var t=[].slice.call(arguments).map(h);function e(e,r){return t.some((function(t){try{return d(t,e,r)}catch(t){return!1}}))}return e.toJSON=function(){return t.map(s).join("|")},e},allOf:function(){var t=[].slice.call(arguments).map(h);function e(e,r){return t.every((function(t){try{return d(t,e,r)}catch(t){return!1}}))}return e.toJSON=function(){return t.map(s).join(" & ")},e},quacksLike:function(t){function e(e){return t===f(e)}return e.toJSON=function(){return t},e},tuple:function(){var t=[].slice.call(arguments).map(h);function e(e,r){return!i.Nil(e)&&(!i.Nil(e.length)&&((!r||e.length===t.length)&&t.every((function(t,n){try{return d(t,e[n],r)}catch(t){throw u(t,n)}}))))}return e.toJSON=function(){return"("+t.map(s).join(", ")+")"},e},value:function(t){function e(e){return e===t}return e.toJSON=function(){return t},e}};function h(t){if(i.String(t))return"?"===t[0]?c.maybe(t.slice(1)):i[t]||c.quacksLike(t);if(t&&i.Object(t)){if(i.Array(t)){if(1!==t.length)throw new TypeError("Expected compile() parameter of type Array of length 1");return c.arrayOf(t[0])}return c.object(t)}return i.Function(t)?t:c.value(t)}function d(t,e,r,n){if(i.Function(t)){if(t(e,r))return!0;throw new o(n||t,e)}return d(h(t),e,r)}for(var p in c.oneOf=c.anyOf,i)d[p]=i[p];for(p in c)d[p]=c[p];var l=t("./extra");for(p in l)d[p]=l[p];d.compile=h,d.TfTypeError=o,d.TfPropertyTypeError=a,e.exports=d},{"./errors":164,"./extra":165,"./native":167}],167:[function(t,e,r){var n={Array:function(t){return null!=t&&t.constructor===Array},Boolean:function(t){return"boolean"==typeof t},Function:function(t){return"function"==typeof t},Nil:function(t){return null==t},Number:function(t){return"number"==typeof t},Object:function(t){return"object"==typeof t},String:function(t){return"string"==typeof t},"":function(){return!0}};for(var i in n.Null=n.Nil,n)n[i].toJSON=function(t){return t}.bind(null,i);e.exports=n},{}],168:[function(t,e,r){(function(t){function r(e){try{if(!t.localStorage)return!1}catch(t){return!1}var r=t.localStorage[e];return null!=r&&"true"===String(r).toLowerCase()}e.exports=function(t,e){if(r("noDeprecation"))return t;var n=!1;return function(){if(!n){if(r("throwDeprecation"))throw new Error(e);r("traceDeprecation")?console.trace(e):console.warn(e),n=!0}return t.apply(this,arguments)}}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],169:[function(t,e,r){"use strict";var n=t("safe-buffer").Buffer;function i(t){if(t<0||t>9007199254740991||t%1!=0)throw new RangeError("value out of range")}function s(t){return i(t),t<253?1:t<=65535?3:t<=4294967295?5:9}e.exports={encode:function t(e,r,o){if(i(e),r||(r=n.allocUnsafe(s(e))),!n.isBuffer(r))throw new TypeError("buffer must be a Buffer instance");return o||(o=0),e<253?(r.writeUInt8(e,o),t.bytes=1):e<=65535?(r.writeUInt8(253,o),r.writeUInt16LE(e,o+1),t.bytes=3):e<=4294967295?(r.writeUInt8(254,o),r.writeUInt32LE(e,o+1),t.bytes=5):(r.writeUInt8(255,o),r.writeUInt32LE(e>>>0,o+1),r.writeUInt32LE(e/4294967296|0,o+5),t.bytes=9),r},decode:function t(e,r){if(!n.isBuffer(e))throw new TypeError("buffer must be a Buffer instance");r||(r=0);var s=e.readUInt8(r);if(s<253)return t.bytes=1,s;if(253===s)return t.bytes=3,e.readUInt16LE(r+1);if(254===s)return t.bytes=5,e.readUInt32LE(r+1);t.bytes=9;var o=e.readUInt32LE(r+1),a=4294967296*e.readUInt32LE(r+5)+o;return i(a),a},encodingLength:s}},{"safe-buffer":133}],170:[function(t,e,r){(function(r){var n=t("bs58check");function i(t,e){if(void 0!==e&&t[0]!==e)throw new Error("Invalid network version");if(33===t.length)return{version:t[0],privateKey:t.slice(1,33),compressed:!1};if(34!==t.length)throw new Error("Invalid WIF length");if(1!==t[33])throw new Error("Invalid compression flag");return{version:t[0],privateKey:t.slice(1,33),compressed:!0}}function s(t,e,n){var i=new r(n?34:33);return i.writeUInt8(t,0),e.copy(i,1),n&&(i[33]=1),i}e.exports={decode:function(t,e){return i(n.decode(t),e)},decodeRaw:i,encode:function(t,e,r){return"number"==typeof t?n.encode(s(t,e,r)):n.encode(s(t.version,t.privateKey,t.compressed))},encodeRaw:s}}).call(this,t("buffer").Buffer)},{bs58check:84,buffer:81}],171:[function(t,e,r){const{bip32:n,networks:i,payments:s,address:o,script:a,Psbt:u,ECPair:f}=t("bitcoinjs-lib"),{Buffer:c}=t("buffer");e.exports={bip32:n,networks:i,payments:s,address:o,script:a,Psbt:u,ECPair:f,Buffer:c}},{"bitcoinjs-lib":39,buffer:81}]},{},[171])(171)})); \ No newline at end of file diff --git a/src/lib/polygon/OpenGSN.js b/src/lib/polygon/OpenGSN.js index 97a9e2acb..50747f872 100644 --- a/src/lib/polygon/OpenGSN.js +++ b/src/lib/polygon/OpenGSN.js @@ -11,13 +11,13 @@ * @author Feross Aboukhadijeh * @license MIT */ -"use strict";var n=t("base64-js"),i=t("ieee754");r.Buffer=e,r.SlowBuffer=function(t){+t!=t&&(t=0);return e.alloc(+t)},r.INSPECT_MAX_BYTES=50;var o=2147483647;function a(t){if(t>o)throw new RangeError('The value "'+t+'" is invalid for option "size"');var r=new Uint8Array(t);return r.__proto__=e.prototype,r}function e(t,e,r){if("number"==typeof t){if("string"==typeof e)throw new TypeError('The "string" argument must be of type string. Received type number');return u(t)}return s(t,e,r)}function s(t,r,n){if("string"==typeof t)return function(t,r){"string"==typeof r&&""!==r||(r="utf8");if(!e.isEncoding(r))throw new TypeError("Unknown encoding: "+r);var n=0|d(t,r),i=a(n),o=i.write(t,r);o!==n&&(i=i.slice(0,o));return i}(t,r);if(ArrayBuffer.isView(t))return h(t);if(null==t)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(q(t,ArrayBuffer)||t&&q(t.buffer,ArrayBuffer))return function(t,r,n){if(r<0||t.byteLength=o)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+o.toString(16)+" bytes");return 0|t}function d(t,r){if(e.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||q(t,ArrayBuffer))return t.byteLength;if("string"!=typeof t)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);var n=t.length,i=arguments.length>2&&!0===arguments[2];if(!i&&0===n)return 0;for(var o=!1;;)switch(r){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return N(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return z(t).length;default:if(o)return i?-1:N(t).length;r=(""+r).toLowerCase(),o=!0}}function l(t,e,r){var n=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return R(this,e,r);case"utf8":case"utf-8":return x(this,e,r);case"ascii":return E(this,e,r);case"latin1":case"binary":return k(this,e,r);case"base64":return S(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return T(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function p(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function b(t,r,n,i,o){if(0===t.length)return-1;if("string"==typeof n?(i=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),K(n=+n)&&(n=o?0:t.length-1),n<0&&(n=t.length+n),n>=t.length){if(o)return-1;n=t.length-1}else if(n<0){if(!o)return-1;n=0}if("string"==typeof r&&(r=e.from(r,i)),e.isBuffer(r))return 0===r.length?-1:m(t,r,n,i,o);if("number"==typeof r)return r&=255,"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(t,r,n):Uint8Array.prototype.lastIndexOf.call(t,r,n):m(t,[r],n,i,o);throw new TypeError("val must be string, number or Buffer")}function m(t,e,r,n,i){var o,a=1,s=t.length,f=e.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return-1;a=2,s/=2,f/=2,r/=2}function u(t,e){return 1===a?t[e]:t.readUInt16BE(e*a)}if(i){var h=-1;for(o=r;os&&(r=s-f),o=r;o>=0;o--){for(var c=!0,d=0;di&&(n=i):n=i;var o=e.length;n>o/2&&(n=o/2);for(var a=0;a>8,i=r%256,o.push(i),o.push(n);return o}(e,t.length-r),t,r,n)}function S(t,e,r){return 0===e&&r===t.length?n.fromByteArray(t):n.fromByteArray(t.slice(e,r))}function x(t,e,r){r=Math.min(t.length,r);for(var n=[],i=e;i239?4:u>223?3:u>191?2:1;if(i+c<=r)switch(c){case 1:u<128&&(h=u);break;case 2:128==(192&(o=t[i+1]))&&(f=(31&u)<<6|63&o)>127&&(h=f);break;case 3:o=t[i+1],a=t[i+2],128==(192&o)&&128==(192&a)&&(f=(15&u)<<12|(63&o)<<6|63&a)>2047&&(f<55296||f>57343)&&(h=f);break;case 4:o=t[i+1],a=t[i+2],s=t[i+3],128==(192&o)&&128==(192&a)&&128==(192&s)&&(f=(15&u)<<18|(63&o)<<12|(63&a)<<6|63&s)>65535&&f<1114112&&(h=f)}null===h?(h=65533,c=1):h>65535&&(h-=65536,n.push(h>>>10&1023|55296),h=56320|1023&h),n.push(h),i+=c}return function(t){var e=t.length;if(e<=A)return String.fromCharCode.apply(String,t);var r="",n=0;for(;ne&&(t+=" ... "),""},e.prototype.compare=function(t,r,n,i,o){if(q(t,Uint8Array)&&(t=e.from(t,t.offset,t.byteLength)),!e.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(void 0===r&&(r=0),void 0===n&&(n=t?t.length:0),void 0===i&&(i=0),void 0===o&&(o=this.length),r<0||n>t.length||i<0||o>this.length)throw new RangeError("out of range index");if(i>=o&&r>=n)return 0;if(i>=o)return-1;if(r>=n)return 1;if(this===t)return 0;for(var a=(o>>>=0)-(i>>>=0),s=(n>>>=0)-(r>>>=0),f=Math.min(a,s),u=this.slice(i,o),h=t.slice(r,n),c=0;c>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var i=this.length-e;if((void 0===r||r>i)&&(r=i),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var o=!1;;)switch(n){case"hex":return y(this,t,e,r);case"utf8":case"utf-8":return g(this,t,e,r);case"ascii":return v(this,t,e,r);case"latin1":case"binary":return w(this,t,e,r);case"base64":return _(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return M(this,t,e,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},e.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var A=4096;function E(t,e,r){var n="";r=Math.min(t.length,r);for(var i=e;in)&&(r=n);for(var i="",o=e;or)throw new RangeError("Trying to access beyond buffer length")}function I(t,r,n,i,o,a){if(!e.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(r>o||rt.length)throw new RangeError("Index out of range")}function L(t,e,r,n,i,o){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function P(t,e,r,n,o){return e=+e,r>>>=0,o||L(t,0,r,4),i.write(t,e,r,n,23,4),r+4}function j(t,e,r,n,o){return e=+e,r>>>=0,o||L(t,0,r,8),i.write(t,e,r,n,52,8),r+8}e.prototype.slice=function(t,r){var n=this.length;(t=~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),(r=void 0===r?n:~~r)<0?(r+=n)<0&&(r=0):r>n&&(r=n),r>>=0,e>>>=0,r||B(t,e,this.length);for(var n=this[t],i=1,o=0;++o>>=0,e>>>=0,r||B(t,e,this.length);for(var n=this[t+--e],i=1;e>0&&(i*=256);)n+=this[t+--e]*i;return n},e.prototype.readUInt8=function(t,e){return t>>>=0,e||B(t,1,this.length),this[t]},e.prototype.readUInt16LE=function(t,e){return t>>>=0,e||B(t,2,this.length),this[t]|this[t+1]<<8},e.prototype.readUInt16BE=function(t,e){return t>>>=0,e||B(t,2,this.length),this[t]<<8|this[t+1]},e.prototype.readUInt32LE=function(t,e){return t>>>=0,e||B(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},e.prototype.readUInt32BE=function(t,e){return t>>>=0,e||B(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},e.prototype.readIntLE=function(t,e,r){t>>>=0,e>>>=0,r||B(t,e,this.length);for(var n=this[t],i=1,o=0;++o=(i*=128)&&(n-=Math.pow(2,8*e)),n},e.prototype.readIntBE=function(t,e,r){t>>>=0,e>>>=0,r||B(t,e,this.length);for(var n=e,i=1,o=this[t+--n];n>0&&(i*=256);)o+=this[t+--n]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*e)),o},e.prototype.readInt8=function(t,e){return t>>>=0,e||B(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},e.prototype.readInt16LE=function(t,e){t>>>=0,e||B(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},e.prototype.readInt16BE=function(t,e){t>>>=0,e||B(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},e.prototype.readInt32LE=function(t,e){return t>>>=0,e||B(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},e.prototype.readInt32BE=function(t,e){return t>>>=0,e||B(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},e.prototype.readFloatLE=function(t,e){return t>>>=0,e||B(t,4,this.length),i.read(this,t,!0,23,4)},e.prototype.readFloatBE=function(t,e){return t>>>=0,e||B(t,4,this.length),i.read(this,t,!1,23,4)},e.prototype.readDoubleLE=function(t,e){return t>>>=0,e||B(t,8,this.length),i.read(this,t,!0,52,8)},e.prototype.readDoubleBE=function(t,e){return t>>>=0,e||B(t,8,this.length),i.read(this,t,!1,52,8)},e.prototype.writeUIntLE=function(t,e,r,n){(t=+t,e>>>=0,r>>>=0,n)||I(this,t,e,r,Math.pow(2,8*r)-1,0);var i=1,o=0;for(this[e]=255&t;++o>>=0,r>>>=0,n)||I(this,t,e,r,Math.pow(2,8*r)-1,0);var i=r-1,o=1;for(this[e+i]=255&t;--i>=0&&(o*=256);)this[e+i]=t/o&255;return e+r},e.prototype.writeUInt8=function(t,e,r){return t=+t,e>>>=0,r||I(this,t,e,1,255,0),this[e]=255&t,e+1},e.prototype.writeUInt16LE=function(t,e,r){return t=+t,e>>>=0,r||I(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},e.prototype.writeUInt16BE=function(t,e,r){return t=+t,e>>>=0,r||I(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},e.prototype.writeUInt32LE=function(t,e,r){return t=+t,e>>>=0,r||I(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t,e+4},e.prototype.writeUInt32BE=function(t,e,r){return t=+t,e>>>=0,r||I(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},e.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var i=Math.pow(2,8*r-1);I(this,t,e,r,i-1,-i)}var o=0,a=1,s=0;for(this[e]=255&t;++o>0)-s&255;return e+r},e.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var i=Math.pow(2,8*r-1);I(this,t,e,r,i-1,-i)}var o=r-1,a=1,s=0;for(this[e+o]=255&t;--o>=0&&(a*=256);)t<0&&0===s&&0!==this[e+o+1]&&(s=1),this[e+o]=(t/a>>0)-s&255;return e+r},e.prototype.writeInt8=function(t,e,r){return t=+t,e>>>=0,r||I(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},e.prototype.writeInt16LE=function(t,e,r){return t=+t,e>>>=0,r||I(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},e.prototype.writeInt16BE=function(t,e,r){return t=+t,e>>>=0,r||I(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},e.prototype.writeInt32LE=function(t,e,r){return t=+t,e>>>=0,r||I(this,t,e,4,2147483647,-2147483648),this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4},e.prototype.writeInt32BE=function(t,e,r){return t=+t,e>>>=0,r||I(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},e.prototype.writeFloatLE=function(t,e,r){return P(this,t,e,!0,r)},e.prototype.writeFloatBE=function(t,e,r){return P(this,t,e,!1,r)},e.prototype.writeDoubleLE=function(t,e,r){return j(this,t,e,!0,r)},e.prototype.writeDoubleBE=function(t,e,r){return j(this,t,e,!1,r)},e.prototype.copy=function(t,r,n,i){if(!e.isBuffer(t))throw new TypeError("argument should be a Buffer");if(n||(n=0),i||0===i||(i=this.length),r>=t.length&&(r=t.length),r||(r=0),i>0&&i=this.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),t.length-r=0;--a)t[a+r]=this[a+n];else Uint8Array.prototype.set.call(t,this.subarray(n,i),r);return o},e.prototype.fill=function(t,r,n,i){if("string"==typeof t){if("string"==typeof r?(i=r,r=0,n=this.length):"string"==typeof n&&(i=n,n=this.length),void 0!==i&&"string"!=typeof i)throw new TypeError("encoding must be a string");if("string"==typeof i&&!e.isEncoding(i))throw new TypeError("Unknown encoding: "+i);if(1===t.length){var o=t.charCodeAt(0);("utf8"===i&&o<128||"latin1"===i)&&(t=o)}}else"number"==typeof t&&(t&=255);if(r<0||this.length>>=0,n=void 0===n?this.length:n>>>0,t||(t=0),"number"==typeof t)for(a=r;a55295&&r<57344){if(!i){if(r>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(a+1===n){(e-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(e-=3)>-1&&o.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((e-=1)<0)break;o.push(r)}else if(r<2048){if((e-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function z(t){return n.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(O,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function U(t,e,r,n){for(var i=0;i=e.length||i>=t.length);++i)e[i+r]=t[i];return i}function q(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}function K(t){return t!=t}}).call(this,t("buffer").Buffer)},{"base64-js":5,buffer:9,ieee754:74}],10:[function(t,e,r){var n=t("safe-buffer").Buffer,i=t("stream").Transform,o=t("string_decoder").StringDecoder;function a(t){i.call(this),this.hashMode="string"==typeof t,this.hashMode?this[t]=this._finalOrDigest:this.final=this._finalOrDigest,this._final&&(this.__final=this._final,this._final=null),this._decoder=null,this._encoding=null}t("inherits")(a,i),a.prototype.update=function(t,e,r){"string"==typeof t&&(t=n.from(t,e));var i=this._update(t);return this.hashMode?this:(r&&(i=this._toString(i,r)),i)},a.prototype.setAutoPadding=function(){},a.prototype.getAuthTag=function(){throw new Error("trying to get auth tag in unsupported state")},a.prototype.setAuthTag=function(){throw new Error("trying to set auth tag in unsupported state")},a.prototype.setAAD=function(){throw new Error("trying to set aad in unsupported state")},a.prototype._transform=function(t,e,r){var n;try{this.hashMode?this._update(t):this.push(this._update(t))}catch(t){n=t}finally{r(n)}},a.prototype._flush=function(t){var e;try{this.push(this.__final())}catch(t){e=t}t(e)},a.prototype._finalOrDigest=function(t){var e=this.__final()||n.alloc(0);return t&&(e=this._toString(e,t,!0)),e},a.prototype._toString=function(t,e,r){if(this._decoder||(this._decoder=new o(e),this._encoding=e),this._encoding!==e)throw new Error("can't switch encodings");var n=this._decoder.write(t);return r&&(n+=this._decoder.end()),n},e.exports=a},{inherits:75,"safe-buffer":124,stream:136,string_decoder:137}],11:[function(t,e,r){(function(t){function e(t){return Object.prototype.toString.call(t)}r.isArray=function(t){return Array.isArray?Array.isArray(t):"[object Array]"===e(t)},r.isBoolean=function(t){return"boolean"==typeof t},r.isNull=function(t){return null===t},r.isNullOrUndefined=function(t){return null==t},r.isNumber=function(t){return"number"==typeof t},r.isString=function(t){return"string"==typeof t},r.isSymbol=function(t){return"symbol"==typeof t},r.isUndefined=function(t){return void 0===t},r.isRegExp=function(t){return"[object RegExp]"===e(t)},r.isObject=function(t){return"object"==typeof t&&null!==t},r.isDate=function(t){return"[object Date]"===e(t)},r.isError=function(t){return"[object Error]"===e(t)||t instanceof Error},r.isFunction=function(t){return"function"==typeof t},r.isPrimitive=function(t){return null===t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||"symbol"==typeof t||void 0===t},r.isBuffer=t.isBuffer}).call(this,{isBuffer:t("../../is-buffer/index.js")})},{"../../is-buffer/index.js":76}],12:[function(t,e,r){"use strict";var n=t("inherits"),i=t("md5.js"),o=t("ripemd160"),a=t("sha.js"),s=t("cipher-base");function f(t){s.call(this,"digest"),this._hash=t}n(f,s),f.prototype._update=function(t){this._hash.update(t)},f.prototype._final=function(){return this._hash.digest()},e.exports=function(t){return"md5"===(t=t.toLowerCase())?new i:"rmd160"===t||"ripemd160"===t?new o:new f(a(t))}},{"cipher-base":10,inherits:75,"md5.js":100,ripemd160:121,"sha.js":129}],13:[function(t,e,r){"use strict";var n=r;n.version=t("../package.json").version,n.utils=t("./elliptic/utils"),n.rand=t("brorand"),n.curve=t("./elliptic/curve"),n.curves=t("./elliptic/curves"),n.ec=t("./elliptic/ec"),n.eddsa=t("./elliptic/eddsa")},{"../package.json":28,"./elliptic/curve":16,"./elliptic/curves":19,"./elliptic/ec":20,"./elliptic/eddsa":23,"./elliptic/utils":27,brorand:7}],14:[function(t,e,r){"use strict";var n=t("bn.js"),i=t("../utils"),o=i.getNAF,a=i.getJSF,s=i.assert;function f(t,e){this.type=t,this.p=new n(e.p,16),this.red=e.prime?n.red(e.prime):n.mont(this.p),this.zero=new n(0).toRed(this.red),this.one=new n(1).toRed(this.red),this.two=new n(2).toRed(this.red),this.n=e.n&&new n(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 u(t,e){this.curve=t,this.type=e,this.precomputed=null}e.exports=f,f.prototype.point=function(){throw new Error("Not implemented")},f.prototype.validate=function(){throw new Error("Not implemented")},f.prototype._fixedNafMul=function(t,e){s(t.precomputed);var r=t._getDoubles(),n=o(e,1,this._bitLength),i=(1<=a;h--)f=(f<<1)+n[h];u.push(f)}for(var c=this.jpoint(null,null,null),d=this.jpoint(null,null,null),l=i;l>0;l--){for(a=0;a=0;u--){for(var h=0;u>=0&&0===a[u];u--)h++;if(u>=0&&h++,f=f.dblp(h),u<0)break;var c=a[u];s(0!==c),f="affine"===t.type?c>0?f.mixedAdd(i[c-1>>1]):f.mixedAdd(i[-c-1>>1].neg()):c>0?f.add(i[c-1>>1]):f.add(i[-c-1>>1].neg())}return"affine"===t.type?f.toP():f},f.prototype._wnafMulAdd=function(t,e,r,n,i){var s,f,u,h=this._wnafT1,c=this._wnafT2,d=this._wnafT3,l=0;for(s=0;s=1;s-=2){var b=s-1,m=s;if(1===h[b]&&1===h[m]){var y=[e[b],null,null,e[m]];0===e[b].y.cmp(e[m].y)?(y[1]=e[b].add(e[m]),y[2]=e[b].toJ().mixedAdd(e[m].neg())):0===e[b].y.cmp(e[m].y.redNeg())?(y[1]=e[b].toJ().mixedAdd(e[m]),y[2]=e[b].add(e[m].neg())):(y[1]=e[b].toJ().mixedAdd(e[m]),y[2]=e[b].toJ().mixedAdd(e[m].neg()));var g=[-3,-1,-5,-7,0,7,5,1,3],v=a(r[b],r[m]);for(l=Math.max(v[0].length,l),d[b]=new Array(l),d[m]=new Array(l),f=0;f=0;s--){for(var x=0;s>=0;){var A=!0;for(f=0;f=0&&x++,M=M.dblp(x),s<0)break;for(f=0;f0?u=c[f][E-1>>1]:E<0&&(u=c[f][-E-1>>1].neg()),M="affine"===u.type?M.mixedAdd(u):M.add(u))}}for(s=0;s=Math.ceil((t.bitLength()+1)/e.step)},u.prototype._getDoubles=function(t,e){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var r=[this],n=this,i=0;i":""},u.prototype.isInfinity=function(){return 0===this.x.cmpn(0)&&(0===this.y.cmp(this.z)||this.zOne&&0===this.y.cmp(this.curve.c))},u.prototype._extDbl=function(){var t=this.x.redSqr(),e=this.y.redSqr(),r=this.z.redSqr();r=r.redIAdd(r);var n=this.curve._mulA(t),i=this.x.redAdd(this.y).redSqr().redISub(t).redISub(e),o=n.redAdd(e),a=o.redSub(r),s=n.redSub(e),f=i.redMul(a),u=o.redMul(s),h=i.redMul(s),c=a.redMul(o);return this.curve.point(f,u,c,h)},u.prototype._projDbl=function(){var t,e,r,n,i,o,a=this.x.redAdd(this.y).redSqr(),s=this.x.redSqr(),f=this.y.redSqr();if(this.curve.twisted){var u=(n=this.curve._mulA(s)).redAdd(f);this.zOne?(t=a.redSub(s).redSub(f).redMul(u.redSub(this.curve.two)),e=u.redMul(n.redSub(f)),r=u.redSqr().redSub(u).redSub(u)):(i=this.z.redSqr(),o=u.redSub(i).redISub(i),t=a.redSub(s).redISub(f).redMul(o),e=u.redMul(n.redSub(f)),r=u.redMul(o))}else n=s.redAdd(f),i=this.curve._mulC(this.z).redSqr(),o=n.redSub(i).redSub(i),t=this.curve._mulC(a.redISub(n)).redMul(o),e=this.curve._mulC(n).redMul(s.redISub(f)),r=n.redMul(o);return this.curve.point(t,e,r)},u.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},u.prototype._extAdd=function(t){var e=this.y.redSub(this.x).redMul(t.y.redSub(t.x)),r=this.y.redAdd(this.x).redMul(t.y.redAdd(t.x)),n=this.t.redMul(this.curve.dd).redMul(t.t),i=this.z.redMul(t.z.redAdd(t.z)),o=r.redSub(e),a=i.redSub(n),s=i.redAdd(n),f=r.redAdd(e),u=o.redMul(a),h=s.redMul(f),c=o.redMul(f),d=a.redMul(s);return this.curve.point(u,h,d,c)},u.prototype._projAdd=function(t){var e,r,n=this.z.redMul(t.z),i=n.redSqr(),o=this.x.redMul(t.x),a=this.y.redMul(t.y),s=this.curve.d.redMul(o).redMul(a),f=i.redSub(s),u=i.redAdd(s),h=this.x.redAdd(this.y).redMul(t.x.redAdd(t.y)).redISub(o).redISub(a),c=n.redMul(f).redMul(h);return this.curve.twisted?(e=n.redMul(u).redMul(a.redSub(this.curve._mulA(o))),r=f.redMul(u)):(e=n.redMul(u).redMul(a.redSub(o)),r=this.curve._mulC(f).redMul(u)),this.curve.point(c,e,r)},u.prototype.add=function(t){return this.isInfinity()?t:t.isInfinity()?this:this.curve.extended?this._extAdd(t):this._projAdd(t)},u.prototype.mul=function(t){return this._hasDoubles(t)?this.curve._fixedNafMul(this,t):this.curve._wnafMul(this,t)},u.prototype.mulAdd=function(t,e,r){return this.curve._wnafMulAdd(1,[this,e],[t,r],2,!1)},u.prototype.jmulAdd=function(t,e,r){return this.curve._wnafMulAdd(1,[this,e],[t,r],2,!0)},u.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},u.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},u.prototype.getX=function(){return this.normalize(),this.x.fromRed()},u.prototype.getY=function(){return this.normalize(),this.y.fromRed()},u.prototype.eq=function(t){return this===t||0===this.getX().cmp(t.getX())&&0===this.getY().cmp(t.getY())},u.prototype.eqXToP=function(t){var e=t.toRed(this.curve.red).redMul(this.z);if(0===this.x.cmp(e))return!0;for(var r=t.clone(),n=this.curve.redN.redMul(this.z);;){if(r.iadd(this.curve.n),r.cmp(this.curve.p)>=0)return!1;if(e.redIAdd(n),0===this.x.cmp(e))return!0}},u.prototype.toP=u.prototype.normalize,u.prototype.mixedAdd=u.prototype.add},{"../utils":27,"./base":14,"bn.js":6,inherits:75}],16:[function(t,e,r){"use strict";var n=r;n.base=t("./base"),n.short=t("./short"),n.mont=t("./mont"),n.edwards=t("./edwards")},{"./base":14,"./edwards":15,"./mont":17,"./short":18}],17:[function(t,e,r){"use strict";var n=t("bn.js"),i=t("inherits"),o=t("./base"),a=t("../utils");function s(t){o.call(this,"mont",t),this.a=new n(t.a,16).toRed(this.red),this.b=new n(t.b,16).toRed(this.red),this.i4=new n(4).toRed(this.red).redInvm(),this.two=new n(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}function f(t,e,r){o.BasePoint.call(this,t,"projective"),null===e&&null===r?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new n(e,16),this.z=new n(r,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}i(s,o),e.exports=s,s.prototype.validate=function(t){var e=t.normalize().x,r=e.redSqr(),n=r.redMul(e).redAdd(r.redMul(this.a)).redAdd(e);return 0===n.redSqrt().redSqr().cmp(n)},i(f,o.BasePoint),s.prototype.decodePoint=function(t,e){return this.point(a.toArray(t,e),1)},s.prototype.point=function(t,e){return new f(this,t,e)},s.prototype.pointFromJSON=function(t){return f.fromJSON(this,t)},f.prototype.precompute=function(){},f.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())},f.fromJSON=function(t,e){return new f(t,e[0],e[1]||t.one)},f.prototype.inspect=function(){return this.isInfinity()?"":""},f.prototype.isInfinity=function(){return 0===this.z.cmpn(0)},f.prototype.dbl=function(){var t=this.x.redAdd(this.z).redSqr(),e=this.x.redSub(this.z).redSqr(),r=t.redSub(e),n=t.redMul(e),i=r.redMul(e.redAdd(this.curve.a24.redMul(r)));return this.curve.point(n,i)},f.prototype.add=function(){throw new Error("Not supported on Montgomery curve")},f.prototype.diffAdd=function(t,e){var r=this.x.redAdd(this.z),n=this.x.redSub(this.z),i=t.x.redAdd(t.z),o=t.x.redSub(t.z).redMul(r),a=i.redMul(n),s=e.z.redMul(o.redAdd(a).redSqr()),f=e.x.redMul(o.redISub(a).redSqr());return this.curve.point(s,f)},f.prototype.mul=function(t){for(var e=t.clone(),r=this,n=this.curve.point(null,null),i=[];0!==e.cmpn(0);e.iushrn(1))i.push(e.andln(1));for(var o=i.length-1;o>=0;o--)0===i[o]?(r=r.diffAdd(n,this),n=n.dbl()):(n=r.diffAdd(n,this),r=r.dbl());return n},f.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")},f.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")},f.prototype.eq=function(t){return 0===this.getX().cmp(t.getX())},f.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},f.prototype.getX=function(){return this.normalize(),this.x.fromRed()}},{"../utils":27,"./base":14,"bn.js":6,inherits:75}],18:[function(t,e,r){"use strict";var n=t("../utils"),i=t("bn.js"),o=t("inherits"),a=t("./base"),s=n.assert;function f(t){a.call(this,"short",t),this.a=new i(t.a,16).toRed(this.red),this.b=new i(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 u(t,e,r,n){a.BasePoint.call(this,t,"affine"),null===e&&null===r?(this.x=null,this.y=null,this.inf=!0):(this.x=new i(e,16),this.y=new i(r,16),n&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.inf=!1)}function h(t,e,r,n){a.BasePoint.call(this,t,"jacobian"),null===e&&null===r&&null===n?(this.x=this.curve.one,this.y=this.curve.one,this.z=new i(0)):(this.x=new i(e,16),this.y=new i(r,16),this.z=new i(n,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}o(f,a),e.exports=f,f.prototype._getEndomorphism=function(t){if(this.zeroA&&this.g&&this.n&&1===this.p.modn(3)){var e,r;if(t.beta)e=new i(t.beta,16).toRed(this.red);else{var n=this._getEndoRoots(this.p);e=(e=n[0].cmp(n[1])<0?n[0]:n[1]).toRed(this.red)}if(t.lambda)r=new i(t.lambda,16);else{var o=this._getEndoRoots(this.n);0===this.g.mul(o[0]).x.cmp(this.g.x.redMul(e))?r=o[0]:(r=o[1],s(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 i(t.a,16),b:new i(t.b,16)}})):this._getEndoBasis(r)}}},f.prototype._getEndoRoots=function(t){var e=t===this.p?this.red:i.mont(t),r=new i(2).toRed(e).redInvm(),n=r.redNeg(),o=new i(3).toRed(e).redNeg().redSqrt().redMul(r);return[n.redAdd(o).fromRed(),n.redSub(o).fromRed()]},f.prototype._getEndoBasis=function(t){for(var e,r,n,o,a,s,f,u,h,c=this.n.ushrn(Math.floor(this.n.bitLength()/2)),d=t,l=this.n.clone(),p=new i(1),b=new i(0),m=new i(0),y=new i(1),g=0;0!==d.cmpn(0);){var v=l.div(d);u=l.sub(v.mul(d)),h=m.sub(v.mul(p));var w=y.sub(v.mul(b));if(!n&&u.cmp(c)<0)e=f.neg(),r=p,n=u.neg(),o=h;else if(n&&2==++g)break;f=u,l=d,d=u,m=p,p=h,y=b,b=w}a=u.neg(),s=h;var _=n.sqr().add(o.sqr());return a.sqr().add(s.sqr()).cmp(_)>=0&&(a=e,s=r),n.negative&&(n=n.neg(),o=o.neg()),a.negative&&(a=a.neg(),s=s.neg()),[{a:n,b:o},{a:a,b:s}]},f.prototype._endoSplit=function(t){var e=this.endo.basis,r=e[0],n=e[1],i=n.b.mul(t).divRound(this.n),o=r.b.neg().mul(t).divRound(this.n),a=i.mul(r.a),s=o.mul(n.a),f=i.mul(r.b),u=o.mul(n.b);return{k1:t.sub(a).sub(s),k2:f.add(u).neg()}},f.prototype.pointFromX=function(t,e){(t=new i(t,16)).red||(t=t.toRed(this.red));var r=t.redSqr().redMul(t).redIAdd(t.redMul(this.a)).redIAdd(this.b),n=r.redSqrt();if(0!==n.redSqr().redSub(r).cmp(this.zero))throw new Error("invalid point");var o=n.fromRed().isOdd();return(e&&!o||!e&&o)&&(n=n.redNeg()),this.point(t,n)},f.prototype.validate=function(t){if(t.inf)return!0;var e=t.x,r=t.y,n=this.a.redMul(e),i=e.redSqr().redMul(e).redIAdd(n).redIAdd(this.b);return 0===r.redSqr().redISub(i).cmpn(0)},f.prototype._endoWnafMulAdd=function(t,e,r){for(var n=this._endoWnafT1,i=this._endoWnafT2,o=0;o":""},u.prototype.isInfinity=function(){return this.inf},u.prototype.add=function(t){if(this.inf)return t;if(t.inf)return this;if(this.eq(t))return this.dbl();if(this.neg().eq(t))return this.curve.point(null,null);if(0===this.x.cmp(t.x))return this.curve.point(null,null);var e=this.y.redSub(t.y);0!==e.cmpn(0)&&(e=e.redMul(this.x.redSub(t.x).redInvm()));var r=e.redSqr().redISub(this.x).redISub(t.x),n=e.redMul(this.x.redSub(r)).redISub(this.y);return this.curve.point(r,n)},u.prototype.dbl=function(){if(this.inf)return this;var t=this.y.redAdd(this.y);if(0===t.cmpn(0))return this.curve.point(null,null);var e=this.curve.a,r=this.x.redSqr(),n=t.redInvm(),i=r.redAdd(r).redIAdd(r).redIAdd(e).redMul(n),o=i.redSqr().redISub(this.x.redAdd(this.x)),a=i.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,a)},u.prototype.getX=function(){return this.x.fromRed()},u.prototype.getY=function(){return this.y.fromRed()},u.prototype.mul=function(t){return t=new i(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)},u.prototype.mulAdd=function(t,e,r){var n=[this,e],i=[t,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,i):this.curve._wnafMulAdd(1,n,i,2)},u.prototype.jmulAdd=function(t,e,r){var n=[this,e],i=[t,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,i,!0):this.curve._wnafMulAdd(1,n,i,2,!0)},u.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))},u.prototype.neg=function(t){if(this.inf)return this;var e=this.curve.point(this.x,this.y.redNeg());if(t&&this.precomputed){var r=this.precomputed,n=function(t){return t.neg()};e.precomputed={naf:r.naf&&{wnd:r.naf.wnd,points:r.naf.points.map(n)},doubles:r.doubles&&{step:r.doubles.step,points:r.doubles.points.map(n)}}}return e},u.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},o(h,a.BasePoint),f.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),n=this.y.redMul(e).redMul(t);return this.curve.point(r,n)},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(),n=this.x.redMul(e),i=t.x.redMul(r),o=this.y.redMul(e.redMul(t.z)),a=t.y.redMul(r.redMul(this.z)),s=n.redSub(i),f=o.redSub(a);if(0===s.cmpn(0))return 0!==f.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var u=s.redSqr(),h=u.redMul(s),c=n.redMul(u),d=f.redSqr().redIAdd(h).redISub(c).redISub(c),l=f.redMul(c.redISub(d)).redISub(o.redMul(h)),p=this.z.redMul(t.z).redMul(s);return this.curve.jpoint(d,l,p)},h.prototype.mixedAdd=function(t){if(this.isInfinity())return t.toJ();if(t.isInfinity())return this;var e=this.z.redSqr(),r=this.x,n=t.x.redMul(e),i=this.y,o=t.y.redMul(e).redMul(this.z),a=r.redSub(n),s=i.redSub(o);if(0===a.cmpn(0))return 0!==s.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var f=a.redSqr(),u=f.redMul(a),h=r.redMul(f),c=s.redSqr().redIAdd(u).redISub(h).redISub(h),d=s.redMul(h.redISub(c)).redISub(i.redMul(u)),l=this.z.redMul(a);return this.curve.jpoint(c,d,l)},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=0)return!1;if(r.redIAdd(i),0===this.x.cmp(r))return!0}},h.prototype.inspect=function(){return this.isInfinity()?"":""},h.prototype.isInfinity=function(){return 0===this.z.cmpn(0)}},{"../utils":27,"./base":14,"bn.js":6,inherits:75}],19:[function(t,e,r){"use strict";var n,i=r,o=t("hash.js"),a=t("./curve"),s=t("./utils").assert;function f(t){"short"===t.type?this.curve=new a.short(t):"edwards"===t.type?this.curve=new a.edwards(t):this.curve=new a.mont(t),this.g=this.curve.g,this.n=this.curve.n,this.hash=t.hash,s(this.g.validate(),"Invalid curve"),s(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function u(t,e){Object.defineProperty(i,t,{configurable:!0,enumerable:!0,get:function(){var r=new f(e);return Object.defineProperty(i,t,{configurable:!0,enumerable:!0,value:r}),r}})}i.PresetCurve=f,u("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:o.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),u("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:o.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),u("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:o.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),u("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:o.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),u("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:o.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),u("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:o.sha256,gRed:!1,g:["9"]}),u("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:o.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});try{n=t("./precomputed/secp256k1")}catch(t){n=void 0}u("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:o.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",n]})},{"./curve":16,"./precomputed/secp256k1":26,"./utils":27,"hash.js":61}],20:[function(t,e,r){"use strict";var n=t("bn.js"),i=t("hmac-drbg"),o=t("../utils"),a=t("../curves"),s=t("brorand"),f=o.assert,u=t("./key"),h=t("./signature");function c(t){if(!(this instanceof c))return new c(t);"string"==typeof t&&(f(Object.prototype.hasOwnProperty.call(a,t),"Unknown curve "+t),t=a[t]),t instanceof a.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}e.exports=c,c.prototype.keyPair=function(t){return new u(this,t)},c.prototype.keyFromPrivate=function(t,e){return u.fromPrivate(this,t,e)},c.prototype.keyFromPublic=function(t,e){return u.fromPublic(this,t,e)},c.prototype.genKeyPair=function(t){t||(t={});for(var e=new i({hash:this.hash,pers:t.pers,persEnc:t.persEnc||"utf8",entropy:t.entropy||s(this.hash.hmacStrength),entropyEnc:t.entropy&&t.entropyEnc||"utf8",nonce:this.n.toArray()}),r=this.n.byteLength(),o=this.n.sub(new n(2));;){var a=new n(e.generate(r));if(!(a.cmp(o)>0))return a.iaddn(1),this.keyFromPrivate(a)}},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,o){"object"==typeof r&&(o=r,r=null),o||(o={}),e=this.keyFromPrivate(e,r),t=this._truncateToN(new n(t,16));for(var a=this.n.byteLength(),s=e.getPrivate().toArray("be",a),f=t.toArray("be",a),u=new i({hash:this.hash,entropy:s,nonce:f,pers:o.pers,persEnc:o.persEnc||"utf8"}),c=this.n.sub(new n(1)),d=0;;d++){var l=o.k?o.k(d):new n(u.generate(this.n.byteLength()));if(!((l=this._truncateToN(l,!0)).cmpn(1)<=0||l.cmp(c)>=0)){var p=this.g.mul(l);if(!p.isInfinity()){var b=p.getX(),m=b.umod(this.n);if(0!==m.cmpn(0)){var y=l.invm(this.n).mul(m.mul(e.getPrivate()).iadd(t));if(0!==(y=y.umod(this.n)).cmpn(0)){var g=(p.getY().isOdd()?1:0)|(0!==b.cmp(m)?2:0);return o.canonical&&y.cmp(this.nh)>0&&(y=this.n.sub(y),g^=1),new h({r:m,s:y,recoveryParam:g})}}}}}},c.prototype.verify=function(t,e,r,i){t=this._truncateToN(new n(t,16)),r=this.keyFromPublic(r,i);var o=(e=new h(e,"hex")).r,a=e.s;if(o.cmpn(1)<0||o.cmp(this.n)>=0)return!1;if(a.cmpn(1)<0||a.cmp(this.n)>=0)return!1;var s,f=a.invm(this.n),u=f.mul(t).umod(this.n),c=f.mul(o).umod(this.n);return this.curve._maxwellTrick?!(s=this.g.jmulAdd(u,r.getPublic(),c)).isInfinity()&&s.eqXToP(o):!(s=this.g.mulAdd(u,r.getPublic(),c)).isInfinity()&&0===s.getX().umod(this.n).cmp(o)},c.prototype.recoverPubKey=function(t,e,r,i){f((3&r)===r,"The recovery param is more than two bits"),e=new h(e,i);var o=this.n,a=new n(t),s=e.r,u=e.s,c=1&r,d=r>>1;if(s.cmp(this.curve.p.umod(this.curve.n))>=0&&d)throw new Error("Unable to find second key candidate");s=d?this.curve.pointFromX(s.add(this.curve.n),c):this.curve.pointFromX(s,c);var l=e.r.invm(o),p=o.sub(a).mul(l).umod(o),b=u.mul(l).umod(o);return this.g.mulAdd(p,s,b)},c.prototype.getKeyRecoveryParam=function(t,e,r,n){if(null!==(e=new h(e,n)).recoveryParam)return e.recoveryParam;for(var i=0;i<4;i++){var o;try{o=this.recoverPubKey(t,e,i)}catch(t){continue}if(o.eq(r))return i}throw new Error("Unable to find valid recovery factor")}},{"../curves":19,"../utils":27,"./key":21,"./signature":22,"bn.js":6,brorand:7,"hmac-drbg":73}],21:[function(t,e,r){"use strict";var n=t("bn.js"),i=t("../utils").assert;function o(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)}e.exports=o,o.fromPublic=function(t,e,r){return e instanceof o?e:new o(t,{pub:e,pubEnc:r})},o.fromPrivate=function(t,e,r){return e instanceof o?e:new o(t,{priv:e,privEnc:r})},o.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"}},o.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},o.prototype.getPrivate=function(t){return"hex"===t?this.priv.toString(16,2):this.priv},o.prototype._importPrivate=function(t,e){this.priv=new n(t,e||16),this.priv=this.priv.umod(this.ec.curve.n)},o.prototype._importPublic=function(t,e){if(t.x||t.y)return"mont"===this.ec.curve.type?i(t.x,"Need x coordinate"):"short"!==this.ec.curve.type&&"edwards"!==this.ec.curve.type||i(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)},o.prototype.derive=function(t){return t.validate()||i(t.validate(),"public point not validated"),t.mul(this.priv).getX()},o.prototype.sign=function(t,e,r){return this.ec.sign(t,this,e,r)},o.prototype.verify=function(t,e){return this.ec.verify(t,e,this)},o.prototype.inspect=function(){return""}},{"../utils":27,"bn.js":6}],22:[function(t,e,r){"use strict";var n=t("bn.js"),i=t("../utils"),o=i.assert;function a(t,e){if(t instanceof a)return t;this._importDER(t,e)||(o(t.r&&t.s,"Signature without r or s"),this.r=new n(t.r,16),this.s=new n(t.s,16),void 0===t.recoveryParam?this.recoveryParam=null:this.recoveryParam=t.recoveryParam)}function s(){this.place=0}function f(t,e){var r=t[e.place++];if(!(128&r))return r;var n=15&r;if(0===n||n>4)return!1;for(var i=0,o=0,a=e.place;o>>=0;return!(i<=127)&&(e.place=a,i)}function u(t){for(var e=0,r=t.length-1;!t[e]&&!(128&t[e+1])&&e>>3);for(t.push(128|r);--r;)t.push(e>>>(r<<3)&255);t.push(e)}}e.exports=a,a.prototype._importDER=function(t,e){t=i.toArray(t,e);var r=new s;if(48!==t[r.place++])return!1;var o=f(t,r);if(!1===o)return!1;if(o+r.place!==t.length)return!1;if(2!==t[r.place++])return!1;var a=f(t,r);if(!1===a)return!1;var u=t.slice(r.place,a+r.place);if(r.place+=a,2!==t[r.place++])return!1;var h=f(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===u[0]){if(!(128&u[1]))return!1;u=u.slice(1)}if(0===c[0]){if(!(128&c[1]))return!1;c=c.slice(1)}return this.r=new n(u),this.s=new n(c),this.recoveryParam=null,!0},a.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=u(e),r=u(r);!(r[0]||128&r[1]);)r=r.slice(1);var n=[2];h(n,e.length),(n=n.concat(e)).push(2),h(n,r.length);var o=n.concat(r),a=[48];return h(a,o.length),a=a.concat(o),i.encode(a,t)}},{"../utils":27,"bn.js":6}],23:[function(t,e,r){"use strict";var n=t("hash.js"),i=t("../curves"),o=t("../utils"),a=o.assert,s=o.parseBytes,f=t("./key"),u=t("./signature");function h(t){if(a("ed25519"===t,"only tested with ed25519 so far"),!(this instanceof h))return new h(t);t=i[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=n.sha512}e.exports=h,h.prototype.sign=function(t,e){t=s(t);var r=this.keyFromSecret(e),n=this.hashInt(r.messagePrefix(),t),i=this.g.mul(n),o=this.encodePoint(i),a=this.hashInt(o,r.pubBytes(),t).mul(r.priv()),f=n.add(a).umod(this.curve.n);return this.makeSignature({R:i,S:f,Rencoded:o})},h.prototype.verify=function(t,e,r){t=s(t),e=this.makeSignature(e);var n=this.keyFromPublic(r),i=this.hashInt(e.Rencoded(),n.pubBytes(),t),o=this.g.mul(e.S());return e.R().add(n.pub().mul(i)).eq(o)},h.prototype.hashInt=function(){for(var t=this.hash(),e=0;e(i>>1)-1?(i>>1)-f:f,o.isubn(s)):s=0,n[a]=s,o.iushrn(1)}return n},n.getJSF=function(t,e){var r=[[],[]];t=t.clone(),e=e.clone();for(var n,i=0,o=0;t.cmpn(-i)>0||e.cmpn(-o)>0;){var a,s,f=t.andln(3)+i&3,u=e.andln(3)+o&3;3===f&&(f=-1),3===u&&(u=-1),a=0==(1&f)?0:3!==(n=t.andln(7)+i&7)&&5!==n||2!==u?f:-f,r[0].push(a),s=0==(1&u)?0:3!==(n=e.andln(7)+o&7)&&5!==n||2!==f?u:-u,r[1].push(s),2*i===a+1&&(i=1-i),2*o===s+1&&(o=1-o),t.iushrn(1),e.iushrn(1)}return r},n.cachedProperty=function(t,e,r){var n="_"+e;t.prototype[e]=function(){return void 0!==this[n]?this[n]:this[n]=r.call(this)}},n.parseBytes=function(t){return"string"==typeof t?n.toArray(t,"hex"):t},n.intFromLE=function(t){return new i(t,"hex","le")}},{"bn.js":6,"minimalistic-assert":101,"minimalistic-crypto-utils":102}],28:[function(t,e,r){e.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 ",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"}}},{}],29:[function(t,e,r){const{Buffer:n}=t("buffer"),i=t("ethereumjs-util"),o=t("ethereumjs-abi"),a=t("tweetnacl");a.util=t("tweetnacl-util");const s={type:"object",properties:{types:{type:"object",additionalProperties:{type:"array",items:{type:"object",properties:{name:{type:"string"},type:{type:"string"}},required:["name","type"]}}},primaryType:{type:"string"},domain:{type:"object"},message:{type:"object"}},required:["types","primaryType","domain","message"]},f={encodeData(t,e,r,a=!0){const s=["bytes32"],f=[this.hashType(t,r)];if(a){const u=(t,e,s)=>{if(void 0!==r[e])return["bytes32",null==s?"0x0000000000000000000000000000000000000000000000000000000000000000":i.sha3(this.encodeData(e,s,r,a))];if(void 0===s)throw new Error(`missing value for field ${t} of type ${e}`);if("bytes"===e)return["bytes32",i.sha3(s)];if("string"===e)return"string"==typeof s&&(s=n.from(s,"utf8")),["bytes32",i.sha3(s)];if(e.lastIndexOf("]")===e.length-1){const r=e.slice(0,e.lastIndexOf("[")),n=s.map((e=>u(t,r,e)));return["bytes32",i.sha3(o.rawEncode(n.map((([t])=>t)),n.map((([,t])=>t))))]}return[e,s]};for(const n of r[t]){const[t,r]=u(n.name,n.type,e[n.name]);s.push(t),f.push(r)}}else for(const o of r[t]){let t=e[o.name];if(void 0!==t)if("bytes"===o.type)s.push("bytes32"),t=i.sha3(t),f.push(t);else if("string"===o.type)s.push("bytes32"),"string"==typeof t&&(t=n.from(t,"utf8")),t=i.sha3(t),f.push(t);else if(void 0!==r[o.type])s.push("bytes32"),t=i.sha3(this.encodeData(o.type,t,r,a)),f.push(t);else{if(o.type.lastIndexOf("]")===o.type.length-1)throw new Error("Arrays currently unimplemented in encodeData");s.push(o.type),f.push(t)}}return o.rawEncode(s,f)},encodeType(t,e){let r="",n=this.findTypeDependencies(t,e).filter((e=>e!==t));n=[t].concat(n.sort());for(const t of n){if(!e[t])throw new Error("No type definition specified: "+t);r+=t+"("+e[t].map((({name:t,type:e})=>e+" "+t)).join(",")+")"}return r},findTypeDependencies(t,e,r=[]){if(t=t.match(/^\w*/)[0],r.includes(t)||void 0===e[t])return r;r.push(t);for(const n of e[t])for(const t of this.findTypeDependencies(n.type,e,r))!r.includes(t)&&r.push(t);return r},hashStruct(t,e,r,n=!0){return i.sha3(this.encodeData(t,e,r,n))},hashType(t,e){return i.sha3(this.encodeType(t,e))},sanitizeData(t){const e={};for(const r in s.properties)t[r]&&(e[r]=t[r]);return e.types&&(e.types=Object.assign({EIP712Domain:[]},e.types)),e},sign(t,e=!0){const r=this.sanitizeData(t),o=[n.from("1901","hex")];return o.push(this.hashStruct("EIP712Domain",r.domain,r.types,e)),"EIP712Domain"!==r.primaryType&&o.push(this.hashStruct(r.primaryType,r.message,r.types,e)),i.sha3(n.concat(o))}};function u(t){const e=new Error("Expect argument to be non-empty array");if("object"!=typeof t||!t.length)throw e;const r=t.map((function(t){return"bytes"===t.type?i.toBuffer(t.value):t.value})),n=t.map((function(t){return t.type})),a=t.map((function(t){if(!t.name)throw e;return t.type+" "+t.name}));return o.soliditySHA3(["bytes32","bytes32"],[o.soliditySHA3(new Array(t.length).fill("string"),a),o.soliditySHA3(n,r)])}function h(t,e){const r=i.toBuffer(e),n=i.fromRpcSig(r);return i.ecrecover(t,n.v,n.r,n.s)}function c(t){const e=i.toBuffer(t.data);return h(i.hashPersonalMessage(e),t.sig)}function d(t,e){for(var r=""+t;r.length0&&(s=2048-a-16),o.padding="0".repeat(s);const f={data:JSON.stringify(o)};return this.encrypt(t,f,r)},decrypt:function(t,e){switch(t.version){case"x25519-xsalsa20-poly1305":var r=l(e),n=a.box.keyPair.fromSecretKey(r).secretKey,i=a.util.decodeBase64(t.nonce),o=a.util.decodeBase64(t.ciphertext),s=a.util.decodeBase64(t.ephemPublicKey),f=a.box.open(o,i,s,n);try{var u=a.util.encodeUTF8(f)}catch(t){throw new Error("Decryption failed.")}if(u)return u;throw new Error("Decryption failed.");default:throw new Error("Encryption type/version not supported.")}},decryptSafely:function(t,e){return JSON.parse(this.decrypt(t,e)).data},getEncryptionPublicKey:function(t){var e=l(t),r=a.box.keyPair.fromSecretKey(e).publicKey;return a.util.encodeBase64(r)},signTypedMessage:function(t,e,r="V4"){switch(r){case"V1":return this.signTypedDataLegacy(t,e);case"V3":return this.signTypedData(t,e);case"V4":default:return this.signTypedData_v4(t,e)}},recoverTypedMessage:function(t,e="V4"){switch(e){case"V1":return this.recoverTypedSignatureLegacy(t);case"V3":return this.recoverTypedSignature(t);case"V4":default:return this.recoverTypedSignature_v4(t)}},signTypedData:function(t,e){const r=f.sign(e.data,!1),n=i.ecsign(r,t);return i.bufferToHex(this.concatSig(n.v,n.r,n.s))},signTypedData_v4:function(t,e){const r=f.sign(e.data),n=i.ecsign(r,t);return i.bufferToHex(this.concatSig(n.v,n.r,n.s))},recoverTypedSignature:function(t){const e=h(f.sign(t.data,!1),t.sig),r=i.publicToAddress(e);return i.bufferToHex(r)},recoverTypedSignature_v4:function(t){const e=h(f.sign(t.data),t.sig),r=i.publicToAddress(e);return i.bufferToHex(r)}}},{buffer:9,"ethereumjs-abi":39,"ethereumjs-util":30,tweetnacl:34,"tweetnacl-util":140}],30:[function(t,e,r){"use strict";var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},i=t("ethereum-cryptography/keccak"),o=i.keccak224,a=i.keccak384,s=i.keccak256,f=i.keccak512,u=t("./secp256k1-adapter"),h=t("assert"),c=t("rlp"),d=t("bn.js"),l=t("create-hash"),p=t("safe-buffer").Buffer;Object.assign(r,t("ethjs-util")),r.MAX_INTEGER=new d("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",16),r.TWO_POW256=new d("10000000000000000000000000000000000000000000000000000000000000000",16),r.KECCAK256_NULL_S="c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470",r.SHA3_NULL_S=r.KECCAK256_NULL_S,r.KECCAK256_NULL=p.from(r.KECCAK256_NULL_S,"hex"),r.SHA3_NULL=r.KECCAK256_NULL,r.KECCAK256_RLP_ARRAY_S="1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",r.SHA3_RLP_ARRAY_S=r.KECCAK256_RLP_ARRAY_S,r.KECCAK256_RLP_ARRAY=p.from(r.KECCAK256_RLP_ARRAY_S,"hex"),r.SHA3_RLP_ARRAY=r.KECCAK256_RLP_ARRAY,r.KECCAK256_RLP_S="56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",r.SHA3_RLP_S=r.KECCAK256_RLP_S,r.KECCAK256_RLP=p.from(r.KECCAK256_RLP_S,"hex"),r.SHA3_RLP=r.KECCAK256_RLP,r.BN=d,r.rlp=c,r.secp256k1=u,r.zeros=function(t){return p.allocUnsafe(t).fill(0)},r.zeroAddress=function(){var t=r.zeros(20);return r.bufferToHex(t)},r.setLengthLeft=r.setLength=function(t,e,n){var i=r.zeros(e);return t=r.toBuffer(t),n?t.length0&&"0"===e.toString();)e=(t=t.slice(1))[0];return t},r.toBuffer=function(t){if(!p.isBuffer(t))if(Array.isArray(t))t=p.from(t);else if("string"==typeof t)t=r.isHexString(t)?p.from(r.padToEven(r.stripHexPrefix(t)),"hex"):p.from(t);else if("number"==typeof t)t=r.intToBuffer(t);else if(null==t)t=p.allocUnsafe(0);else if(d.isBN(t))t=t.toArrayLike(p);else{if(!t.toArray)throw new Error("invalid type");t=p.from(t.toArray())}return t},r.bufferToInt=function(t){return new d(r.toBuffer(t)).toNumber()},r.bufferToHex=function(t){return"0x"+(t=r.toBuffer(t)).toString("hex")},r.fromSigned=function(t){return new d(t).fromTwos(256)},r.toUnsigned=function(t){return p.from(t.toTwos(256).toArray())},r.keccak=function(t,e){switch(t=r.toBuffer(t),e||(e=256),e){case 224:return o(t);case 256:return s(t);case 384:return a(t);case 512:return f(t);default:throw new Error("Invalid algorithm: keccak"+e)}},r.keccak256=function(t){return r.keccak(t)},r.sha3=r.keccak,r.sha256=function(t){return t=r.toBuffer(t),l("sha256").update(t).digest()},r.ripemd160=function(t,e){t=r.toBuffer(t);var n=l("rmd160").update(t).digest();return!0===e?r.setLength(n,32):n},r.rlphash=function(t){return r.keccak(c.encode(t))},r.isValidPrivate=function(t){return u.privateKeyVerify(t)},r.isValidPublic=function(t,e){return 64===t.length?u.publicKeyVerify(p.concat([p.from([4]),t])):!!e&&u.publicKeyVerify(t)},r.pubToAddress=r.publicToAddress=function(t,e){return t=r.toBuffer(t),e&&64!==t.length&&(t=u.publicKeyConvert(t,!1).slice(1)),h(64===t.length),r.keccak(t).slice(-20)};var b=r.privateToPublic=function(t){return t=r.toBuffer(t),u.publicKeyCreate(t,!1).slice(1)};r.importPublic=function(t){return 64!==(t=r.toBuffer(t)).length&&(t=u.publicKeyConvert(t,!1).slice(1)),t},r.ecsign=function(t,e){var r=u.sign(t,e),n={};return n.r=r.signature.slice(0,32),n.s=r.signature.slice(32,64),n.v=r.recovery+27,n},r.hashPersonalMessage=function(t){var e=r.toBuffer("Ethereum Signed Message:\n"+t.length.toString());return r.keccak(p.concat([e,t]))},r.ecrecover=function(t,e,n,i){var o=p.concat([r.setLength(n,32),r.setLength(i,32)],64),a=e-27;if(0!==a&&1!==a)throw new Error("Invalid signature v value");var s=u.recover(t,o,a);return u.publicKeyConvert(s,!1).slice(1)},r.toRpcSig=function(t,e,n){if(27!==t&&28!==t)throw new Error("Invalid recovery id");return r.bufferToHex(p.concat([r.setLengthLeft(e,32),r.setLengthLeft(n,32),r.toBuffer(t-27)]))},r.fromRpcSig=function(t){if(65!==(t=r.toBuffer(t)).length)throw new Error("Invalid signature length");var e=t[64];return e<27&&(e+=27),{v:e,r:t.slice(0,32),s:t.slice(32,64)}},r.privateToAddress=function(t){return r.publicToAddress(b(t))},r.isValidAddress=function(t){return/^0x[0-9a-fA-F]{40}$/.test(t)},r.isZeroAddress=function(t){return r.zeroAddress()===r.addHexPrefix(t)},r.toChecksumAddress=function(t){t=r.stripHexPrefix(t).toLowerCase();for(var e=r.keccak(t).toString("hex"),n="0x",i=0;i=8?n+=t[i].toUpperCase():n+=t[i];return n},r.isValidChecksumAddress=function(t){return r.isValidAddress(t)&&r.toChecksumAddress(t)===t},r.generateAddress=function(t,e){return t=r.toBuffer(t),e=(e=new d(e)).isZero()?null:p.from(e.toArray()),r.rlphash([t,e]).slice(-20)},r.isPrecompiled=function(t){var e=r.unpad(t);return 1===e.length&&e[0]>=1&&e[0]<=8},r.addHexPrefix=function(t){return"string"!=typeof t||r.isHexPrefixed(t)?t:"0x"+t},r.isValidSignature=function(t,e,r,n){var i=new d("7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0",16),o=new d("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141",16);return 32===e.length&&32===r.length&&((27===t||28===t)&&(e=new d(e),r=new d(r),!(e.isZero()||e.gt(o)||r.isZero()||r.gt(o))&&(!1!==n||1!==new d(r).cmp(i))))},r.baToJSON=function(t){if(p.isBuffer(t))return"0x"+t.toString("hex");if(t instanceof Array){for(var e=[],n=0;n=i.length,"The field "+e.name+" must not have more "+e.length+" bytes")):e.allowZero&&0===i.length||!e.length||h(e.length===i.length,"The field "+e.name+" must have byte length of "+e.length),t.raw[n]=i}t._fields.push(e.name),Object.defineProperty(t,e.name,{enumerable:!0,configurable:!0,get:i,set:o}),e.default&&(t[e.name]=e.default),e.alias&&Object.defineProperty(t,e.alias,{enumerable:!1,configurable:!0,set:o,get:i})})),i)if("string"==typeof i&&(i=p.from(r.stripHexPrefix(i),"hex")),p.isBuffer(i)&&(i=c.decode(i)),Array.isArray(i)){if(i.length>t._fields.length)throw new Error("wrong number of fields in data");i.forEach((function(e,n){t[t._fields[n]]=r.toBuffer(e)}))}else{if("object"!==(void 0===i?"undefined":n(i)))throw new Error("invalid data");var o=Object.keys(i);e.forEach((function(e){-1!==o.indexOf(e.name)&&(t[e.name]=i[e.name]),-1!==o.indexOf(e.alias)&&(t[e.alias]=i[e.alias])}))}}},{"./secp256k1-adapter":31,assert:1,"bn.js":6,"create-hash":12,"ethereum-cryptography/keccak":36,"ethjs-util":58,rlp:122,"safe-buffer":124}],31:[function(t,e,r){(function(r){"use strict";var n=t("ethereum-cryptography/secp256k1"),i=t("./secp256k1-lib/index"),o=t("./secp256k1-lib/der"),a=function(t){return 32===t.length&&n.privateKeyVerify(Uint8Array.from(t))};e.exports={privateKeyVerify:a,privateKeyExport:function(t,e){if(32!==t.length)throw new RangeError("private key length is invalid");var r=i.privateKeyExport(t,e);return o.privateKeyExport(t,r,e)},privateKeyImport:function(t){if(null!==(t=o.privateKeyImport(t))&&32===t.length&&a(t))return t;throw new Error("couldn't import from DER format")},privateKeyNegate:function(t){return r.from(n.privateKeyNegate(Uint8Array.from(t)))},privateKeyModInverse:function(t){if(32!==t.length)throw new Error("private key length is invalid");return r.from(i.privateKeyModInverse(Uint8Array.from(t)))},privateKeyTweakAdd:function(t,e){return r.from(n.privateKeyTweakAdd(Uint8Array.from(t),e))},privateKeyTweakMul:function(t,e){return r.from(n.privateKeyTweakMul(Uint8Array.from(t),Uint8Array.from(e)))},publicKeyCreate:function(t,e){return r.from(n.publicKeyCreate(Uint8Array.from(t),e))},publicKeyConvert:function(t,e){return r.from(n.publicKeyConvert(Uint8Array.from(t),e))},publicKeyVerify:function(t){return(33===t.length||65===t.length)&&n.publicKeyVerify(Uint8Array.from(t))},publicKeyTweakAdd:function(t,e,i){return r.from(n.publicKeyTweakAdd(Uint8Array.from(t),Uint8Array.from(e),i))},publicKeyTweakMul:function(t,e,i){return r.from(n.publicKeyTweakMul(Uint8Array.from(t),Uint8Array.from(e),i))},publicKeyCombine:function(t,e){var i=[];return t.forEach((function(t){i.push(Uint8Array.from(t))})),r.from(n.publicKeyCombine(i,e))},signatureNormalize:function(t){return r.from(n.signatureNormalize(Uint8Array.from(t)))},signatureExport:function(t){return r.from(n.signatureExport(Uint8Array.from(t)))},signatureImport:function(t){return r.from(n.signatureImport(Uint8Array.from(t)))},signatureImportLax:function(t){if(0===t.length)throw new RangeError("signature length is invalid");var e=o.signatureImportLax(t);if(null===e)throw new Error("couldn't parse DER signature");return i.signatureImport(e)},sign:function(t,e,i){if(null===i)throw new TypeError("options should be an Object");var o=void 0;if(i){if(o={},null===i.data)throw new TypeError("options.data should be a Buffer");if(i.data){if(32!==i.data.length)throw new RangeError("options.data length is invalid");o.data=new Uint8Array(i.data)}if(null===i.noncefn)throw new TypeError("options.noncefn should be a Function");i.noncefn&&(o.noncefn=function(t,e,n,o,a){var s=null!=n?r.from(n):null,f=null!=o?r.from(o):null,u=r.from("");return i.noncefn&&(u=i.noncefn(r.from(t),r.from(e),s,f,a)),Uint8Array.from(u)})}var a=n.ecdsaSign(Uint8Array.from(t),Uint8Array.from(e),o);return{signature:r.from(a.signature),recovery:a.recid}},verify:function(t,e,r){return n.ecdsaVerify(Uint8Array.from(e),Uint8Array.from(t),r)},recover:function(t,e,i,o){return r.from(n.ecdsaRecover(Uint8Array.from(e),i,Uint8Array.from(t),o))},ecdh:function(t,e){return r.from(n.ecdh(Uint8Array.from(t),Uint8Array.from(e),{}))},ecdhUnsafe:function(t,e,n){if(33!==t.length&&65!==t.length)throw new RangeError("public key length is invalid");if(32!==e.length)throw new RangeError("private key length is invalid");return r.from(i.ecdhUnsafe(Uint8Array.from(t),Uint8Array.from(e),n))}}}).call(this,t("buffer").Buffer)},{"./secp256k1-lib/der":32,"./secp256k1-lib/index":33,buffer:9,"ethereum-cryptography/secp256k1":38}],32:[function(t,e,r){(function(t){"use strict";var e=t.from([48,129,211,2,1,1,4,32,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,160,129,133,48,129,130,2,1,1,48,44,6,7,42,134,72,206,61,1,1,2,33,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,254,255,255,252,47,48,6,4,1,0,4,1,7,4,33,2,121,190,102,126,249,220,187,172,85,160,98,149,206,135,11,7,2,155,252,219,45,206,40,217,89,242,129,91,22,248,23,152,2,33,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,254,186,174,220,230,175,72,160,59,191,210,94,140,208,54,65,65,2,1,1,161,36,3,34,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]),n=t.from([48,130,1,19,2,1,1,4,32,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,160,129,165,48,129,162,2,1,1,48,44,6,7,42,134,72,206,61,1,1,2,33,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,254,255,255,252,47,48,6,4,1,0,4,1,7,4,65,4,121,190,102,126,249,220,187,172,85,160,98,149,206,135,11,7,2,155,252,219,45,206,40,217,89,242,129,91,22,248,23,152,72,58,218,119,38,163,196,101,93,164,251,252,14,17,8,168,253,23,180,72,166,133,84,25,156,71,208,143,251,16,212,184,2,33,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,254,186,174,220,230,175,72,160,59,191,210,94,140,208,54,65,65,2,1,1,161,68,3,66,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,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]);r.privateKeyExport=function(r,i,o){var a=t.from(o?e:n);return r.copy(a,o?8:9),i.copy(a,o?181:214),a},r.privateKeyImport=function(t){var e=t.length,r=0;if(e2)return null;if(e<(r+=1)+n)return null;var i=t[r+n-1]|(n>1?t[r+n-2]<<8:0);return e<(r+=n)+i||e32||ei)return null;if(2!==e[o++])return null;var s=e[o++];if(128&s){if(o+(a=s-128)>i)return null;for(;a>0&&0===e[o];o+=1,a-=1);for(s=0;a>0;o+=1,a-=1)s=(s<<8)+e[o]}if(s>i-o)return null;var f=o;if(o+=s,2!==e[o++])return null;var u=e[o++];if(128&u){if(o+(a=u-128)>i)return null;for(;a>0&&0===e[o];o+=1,a-=1);for(u=0;a>0;o+=1,a-=1)u=(u<<8)+e[o]}if(u>i-o)return null;var h=o;for(o+=u;s>0&&0===e[f];s-=1,f+=1);if(s>32)return null;var c=e.slice(f,f+s);for(c.copy(r,32-c.length);u>0&&0===e[h];u-=1,h+=1);if(u>32)return null;var d=e.slice(h,h+u);return d.copy(n,32-d.length),{r:r,s:n}}}).call(this,t("buffer").Buffer)},{buffer:9}],33:[function(t,e,r){(function(e){"use strict";var n=t("bn.js"),i=new(0,t("elliptic").ec)("secp256k1"),o=i.curve;r.privateKeyExport=function(t,e){var r=new n(t);if(r.ucmp(o.n)>=0)throw new Error("couldn't export to DER format");var s=i.g.mul(r);return a(s.getX(),s.getY(),e)},r.privateKeyModInverse=function(t){var r=new n(t);if(r.ucmp(o.n)>=0||r.isZero())throw new Error("private key range is invalid");return r.invm(o.n).toArrayLike(e,"be",32)},r.signatureImport=function(t){var r=new n(t.r);r.ucmp(o.n)>=0&&(r=new n(0));var i=new n(t.s);return i.ucmp(o.n)>=0&&(i=new n(0)),e.concat([r.toArrayLike(e,"be",32),i.toArrayLike(e,"be",32)])},r.ecdhUnsafe=function(t,e,r){var s=i.keyFromPublic(t),f=new n(e);if(f.ucmp(o.n)>=0||f.isZero())throw new Error("scalar was invalid (zero or overflow)");var u=s.pub.mul(f);return a(u.getX(),u.getY(),r)};var a=function(t,r,n){var i=void 0;return n?((i=e.alloc(33))[0]=r.isOdd()?3:2,t.toArrayLike(e,"be",32).copy(i,1)):((i=e.alloc(65))[0]=4,t.toArrayLike(e,"be",32).copy(i,1),r.toArrayLike(e,"be",32).copy(i,33)),i}}).call(this,t("buffer").Buffer)},{"bn.js":6,buffer:9,elliptic:13}],34:[function(t,e,r){!function(e){"use strict";var r=function(t){var e,r=new Float64Array(16);if(t)for(e=0;e>24&255,t[e+1]=r>>16&255,t[e+2]=r>>8&255,t[e+3]=255&r,t[e+4]=n>>24&255,t[e+5]=n>>16&255,t[e+6]=n>>8&255,t[e+7]=255&n}function b(t,e,r,n,i){var o,a=0;for(o=0;o>>8)-1}function m(t,e,r,n){return b(t,e,r,n,16)}function y(t,e,r,n){return b(t,e,r,n,32)}function g(t,e,r,n){!function(t,e,r,n){for(var i,o=255&n[0]|(255&n[1])<<8|(255&n[2])<<16|(255&n[3])<<24,a=255&r[0]|(255&r[1])<<8|(255&r[2])<<16|(255&r[3])<<24,s=255&r[4]|(255&r[5])<<8|(255&r[6])<<16|(255&r[7])<<24,f=255&r[8]|(255&r[9])<<8|(255&r[10])<<16|(255&r[11])<<24,u=255&r[12]|(255&r[13])<<8|(255&r[14])<<16|(255&r[15])<<24,h=255&n[4]|(255&n[5])<<8|(255&n[6])<<16|(255&n[7])<<24,c=255&e[0]|(255&e[1])<<8|(255&e[2])<<16|(255&e[3])<<24,d=255&e[4]|(255&e[5])<<8|(255&e[6])<<16|(255&e[7])<<24,l=255&e[8]|(255&e[9])<<8|(255&e[10])<<16|(255&e[11])<<24,p=255&e[12]|(255&e[13])<<8|(255&e[14])<<16|(255&e[15])<<24,b=255&n[8]|(255&n[9])<<8|(255&n[10])<<16|(255&n[11])<<24,m=255&r[16]|(255&r[17])<<8|(255&r[18])<<16|(255&r[19])<<24,y=255&r[20]|(255&r[21])<<8|(255&r[22])<<16|(255&r[23])<<24,g=255&r[24]|(255&r[25])<<8|(255&r[26])<<16|(255&r[27])<<24,v=255&r[28]|(255&r[29])<<8|(255&r[30])<<16|(255&r[31])<<24,w=255&n[12]|(255&n[13])<<8|(255&n[14])<<16|(255&n[15])<<24,_=o,M=a,S=s,x=f,A=u,E=h,k=c,R=d,T=l,B=p,I=b,L=m,P=y,j=g,O=v,C=w,N=0;N<20;N+=2)_^=(i=(P^=(i=(T^=(i=(A^=(i=_+P|0)<<7|i>>>25)+_|0)<<9|i>>>23)+A|0)<<13|i>>>19)+T|0)<<18|i>>>14,E^=(i=(M^=(i=(j^=(i=(B^=(i=E+M|0)<<7|i>>>25)+E|0)<<9|i>>>23)+B|0)<<13|i>>>19)+j|0)<<18|i>>>14,I^=(i=(k^=(i=(S^=(i=(O^=(i=I+k|0)<<7|i>>>25)+I|0)<<9|i>>>23)+O|0)<<13|i>>>19)+S|0)<<18|i>>>14,C^=(i=(L^=(i=(R^=(i=(x^=(i=C+L|0)<<7|i>>>25)+C|0)<<9|i>>>23)+x|0)<<13|i>>>19)+R|0)<<18|i>>>14,_^=(i=(x^=(i=(S^=(i=(M^=(i=_+x|0)<<7|i>>>25)+_|0)<<9|i>>>23)+M|0)<<13|i>>>19)+S|0)<<18|i>>>14,E^=(i=(A^=(i=(R^=(i=(k^=(i=E+A|0)<<7|i>>>25)+E|0)<<9|i>>>23)+k|0)<<13|i>>>19)+R|0)<<18|i>>>14,I^=(i=(B^=(i=(T^=(i=(L^=(i=I+B|0)<<7|i>>>25)+I|0)<<9|i>>>23)+L|0)<<13|i>>>19)+T|0)<<18|i>>>14,C^=(i=(O^=(i=(j^=(i=(P^=(i=C+O|0)<<7|i>>>25)+C|0)<<9|i>>>23)+P|0)<<13|i>>>19)+j|0)<<18|i>>>14;_=_+o|0,M=M+a|0,S=S+s|0,x=x+f|0,A=A+u|0,E=E+h|0,k=k+c|0,R=R+d|0,T=T+l|0,B=B+p|0,I=I+b|0,L=L+m|0,P=P+y|0,j=j+g|0,O=O+v|0,C=C+w|0,t[0]=_>>>0&255,t[1]=_>>>8&255,t[2]=_>>>16&255,t[3]=_>>>24&255,t[4]=M>>>0&255,t[5]=M>>>8&255,t[6]=M>>>16&255,t[7]=M>>>24&255,t[8]=S>>>0&255,t[9]=S>>>8&255,t[10]=S>>>16&255,t[11]=S>>>24&255,t[12]=x>>>0&255,t[13]=x>>>8&255,t[14]=x>>>16&255,t[15]=x>>>24&255,t[16]=A>>>0&255,t[17]=A>>>8&255,t[18]=A>>>16&255,t[19]=A>>>24&255,t[20]=E>>>0&255,t[21]=E>>>8&255,t[22]=E>>>16&255,t[23]=E>>>24&255,t[24]=k>>>0&255,t[25]=k>>>8&255,t[26]=k>>>16&255,t[27]=k>>>24&255,t[28]=R>>>0&255,t[29]=R>>>8&255,t[30]=R>>>16&255,t[31]=R>>>24&255,t[32]=T>>>0&255,t[33]=T>>>8&255,t[34]=T>>>16&255,t[35]=T>>>24&255,t[36]=B>>>0&255,t[37]=B>>>8&255,t[38]=B>>>16&255,t[39]=B>>>24&255,t[40]=I>>>0&255,t[41]=I>>>8&255,t[42]=I>>>16&255,t[43]=I>>>24&255,t[44]=L>>>0&255,t[45]=L>>>8&255,t[46]=L>>>16&255,t[47]=L>>>24&255,t[48]=P>>>0&255,t[49]=P>>>8&255,t[50]=P>>>16&255,t[51]=P>>>24&255,t[52]=j>>>0&255,t[53]=j>>>8&255,t[54]=j>>>16&255,t[55]=j>>>24&255,t[56]=O>>>0&255,t[57]=O>>>8&255,t[58]=O>>>16&255,t[59]=O>>>24&255,t[60]=C>>>0&255,t[61]=C>>>8&255,t[62]=C>>>16&255,t[63]=C>>>24&255}(t,e,r,n)}function v(t,e,r,n){!function(t,e,r,n){for(var i,o=255&n[0]|(255&n[1])<<8|(255&n[2])<<16|(255&n[3])<<24,a=255&r[0]|(255&r[1])<<8|(255&r[2])<<16|(255&r[3])<<24,s=255&r[4]|(255&r[5])<<8|(255&r[6])<<16|(255&r[7])<<24,f=255&r[8]|(255&r[9])<<8|(255&r[10])<<16|(255&r[11])<<24,u=255&r[12]|(255&r[13])<<8|(255&r[14])<<16|(255&r[15])<<24,h=255&n[4]|(255&n[5])<<8|(255&n[6])<<16|(255&n[7])<<24,c=255&e[0]|(255&e[1])<<8|(255&e[2])<<16|(255&e[3])<<24,d=255&e[4]|(255&e[5])<<8|(255&e[6])<<16|(255&e[7])<<24,l=255&e[8]|(255&e[9])<<8|(255&e[10])<<16|(255&e[11])<<24,p=255&e[12]|(255&e[13])<<8|(255&e[14])<<16|(255&e[15])<<24,b=255&n[8]|(255&n[9])<<8|(255&n[10])<<16|(255&n[11])<<24,m=255&r[16]|(255&r[17])<<8|(255&r[18])<<16|(255&r[19])<<24,y=255&r[20]|(255&r[21])<<8|(255&r[22])<<16|(255&r[23])<<24,g=255&r[24]|(255&r[25])<<8|(255&r[26])<<16|(255&r[27])<<24,v=255&r[28]|(255&r[29])<<8|(255&r[30])<<16|(255&r[31])<<24,w=255&n[12]|(255&n[13])<<8|(255&n[14])<<16|(255&n[15])<<24,_=0;_<20;_+=2)o^=(i=(y^=(i=(l^=(i=(u^=(i=o+y|0)<<7|i>>>25)+o|0)<<9|i>>>23)+u|0)<<13|i>>>19)+l|0)<<18|i>>>14,h^=(i=(a^=(i=(g^=(i=(p^=(i=h+a|0)<<7|i>>>25)+h|0)<<9|i>>>23)+p|0)<<13|i>>>19)+g|0)<<18|i>>>14,b^=(i=(c^=(i=(s^=(i=(v^=(i=b+c|0)<<7|i>>>25)+b|0)<<9|i>>>23)+v|0)<<13|i>>>19)+s|0)<<18|i>>>14,w^=(i=(m^=(i=(d^=(i=(f^=(i=w+m|0)<<7|i>>>25)+w|0)<<9|i>>>23)+f|0)<<13|i>>>19)+d|0)<<18|i>>>14,o^=(i=(f^=(i=(s^=(i=(a^=(i=o+f|0)<<7|i>>>25)+o|0)<<9|i>>>23)+a|0)<<13|i>>>19)+s|0)<<18|i>>>14,h^=(i=(u^=(i=(d^=(i=(c^=(i=h+u|0)<<7|i>>>25)+h|0)<<9|i>>>23)+c|0)<<13|i>>>19)+d|0)<<18|i>>>14,b^=(i=(p^=(i=(l^=(i=(m^=(i=b+p|0)<<7|i>>>25)+b|0)<<9|i>>>23)+m|0)<<13|i>>>19)+l|0)<<18|i>>>14,w^=(i=(v^=(i=(g^=(i=(y^=(i=w+v|0)<<7|i>>>25)+w|0)<<9|i>>>23)+y|0)<<13|i>>>19)+g|0)<<18|i>>>14;t[0]=o>>>0&255,t[1]=o>>>8&255,t[2]=o>>>16&255,t[3]=o>>>24&255,t[4]=h>>>0&255,t[5]=h>>>8&255,t[6]=h>>>16&255,t[7]=h>>>24&255,t[8]=b>>>0&255,t[9]=b>>>8&255,t[10]=b>>>16&255,t[11]=b>>>24&255,t[12]=w>>>0&255,t[13]=w>>>8&255,t[14]=w>>>16&255,t[15]=w>>>24&255,t[16]=c>>>0&255,t[17]=c>>>8&255,t[18]=c>>>16&255,t[19]=c>>>24&255,t[20]=d>>>0&255,t[21]=d>>>8&255,t[22]=d>>>16&255,t[23]=d>>>24&255,t[24]=l>>>0&255,t[25]=l>>>8&255,t[26]=l>>>16&255,t[27]=l>>>24&255,t[28]=p>>>0&255,t[29]=p>>>8&255,t[30]=p>>>16&255,t[31]=p>>>24&255}(t,e,r,n)}var w=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function _(t,e,r,n,i,o,a){var s,f,u=new Uint8Array(16),h=new Uint8Array(64);for(f=0;f<16;f++)u[f]=0;for(f=0;f<8;f++)u[f]=o[f];for(;i>=64;){for(g(h,u,a,w),f=0;f<64;f++)t[e+f]=r[n+f]^h[f];for(s=1,f=8;f<16;f++)s=s+(255&u[f])|0,u[f]=255&s,s>>>=8;i-=64,e+=64,n+=64}if(i>0)for(g(h,u,a,w),f=0;f=64;){for(g(f,s,i,w),a=0;a<64;a++)t[e+a]=f[a];for(o=1,a=8;a<16;a++)o=o+(255&s[a])|0,s[a]=255&o,o>>>=8;r-=64,e+=64}if(r>0)for(g(f,s,i,w),a=0;a>>13|r<<3),n=255&t[4]|(255&t[5])<<8,this.r[2]=7939&(r>>>10|n<<6),i=255&t[6]|(255&t[7])<<8,this.r[3]=8191&(n>>>7|i<<9),o=255&t[8]|(255&t[9])<<8,this.r[4]=255&(i>>>4|o<<12),this.r[5]=o>>>1&8190,a=255&t[10]|(255&t[11])<<8,this.r[6]=8191&(o>>>14|a<<2),s=255&t[12]|(255&t[13])<<8,this.r[7]=8065&(a>>>11|s<<5),f=255&t[14]|(255&t[15])<<8,this.r[8]=8191&(s>>>8|f<<8),this.r[9]=f>>>5&127,this.pad[0]=255&t[16]|(255&t[17])<<8,this.pad[1]=255&t[18]|(255&t[19])<<8,this.pad[2]=255&t[20]|(255&t[21])<<8,this.pad[3]=255&t[22]|(255&t[23])<<8,this.pad[4]=255&t[24]|(255&t[25])<<8,this.pad[5]=255&t[26]|(255&t[27])<<8,this.pad[6]=255&t[28]|(255&t[29])<<8,this.pad[7]=255&t[30]|(255&t[31])<<8};function E(t,e,r,n,i,o){var a=new A(o);return a.update(r,n,i),a.finish(t,e),0}function k(t,e,r,n,i,o){var a=new Uint8Array(16);return E(a,0,r,n,i,o),m(t,e,a,0)}function R(t,e,r,n,i){var o;if(r<32)return-1;for(x(t,0,e,0,r,n,i),E(t,16,t,32,r-32,t),o=0;o<16;o++)t[o]=0;return 0}function T(t,e,r,n,i){var o,a=new Uint8Array(32);if(r<32)return-1;if(S(a,0,32,n,i),0!==k(e,16,e,32,r-32,a))return-1;for(x(t,0,e,0,r,n,i),o=0;o<32;o++)t[o]=0;return 0}function B(t,e){var r;for(r=0;r<16;r++)t[r]=0|e[r]}function I(t){var e,r,n=1;for(e=0;e<16;e++)r=t[e]+n+65535,n=Math.floor(r/65536),t[e]=r-65536*n;t[0]+=n-1+37*(n-1)}function L(t,e,r){for(var n,i=~(r-1),o=0;o<16;o++)n=i&(t[o]^e[o]),t[o]^=n,e[o]^=n}function P(t,e){var n,i,o,a=r(),s=r();for(n=0;n<16;n++)s[n]=e[n];for(I(s),I(s),I(s),i=0;i<2;i++){for(a[0]=s[0]-65517,n=1;n<15;n++)a[n]=s[n]-65535-(a[n-1]>>16&1),a[n-1]&=65535;a[15]=s[15]-32767-(a[14]>>16&1),o=a[15]>>16&1,a[14]&=65535,L(s,a,1-o)}for(n=0;n<16;n++)t[2*n]=255&s[n],t[2*n+1]=s[n]>>8}function j(t,e){var r=new Uint8Array(32),n=new Uint8Array(32);return P(r,t),P(n,e),y(r,0,n,0)}function O(t){var e=new Uint8Array(32);return P(e,t),1&e[0]}function C(t,e){var r;for(r=0;r<16;r++)t[r]=e[2*r]+(e[2*r+1]<<8);t[15]&=32767}function N(t,e,r){for(var n=0;n<16;n++)t[n]=e[n]+r[n]}function z(t,e,r){for(var n=0;n<16;n++)t[n]=e[n]-r[n]}function U(t,e,r){var n,i,o=0,a=0,s=0,f=0,u=0,h=0,c=0,d=0,l=0,p=0,b=0,m=0,y=0,g=0,v=0,w=0,_=0,M=0,S=0,x=0,A=0,E=0,k=0,R=0,T=0,B=0,I=0,L=0,P=0,j=0,O=0,C=r[0],N=r[1],z=r[2],U=r[3],q=r[4],K=r[5],D=r[6],H=r[7],F=r[8],W=r[9],Z=r[10],V=r[11],Y=r[12],J=r[13],X=r[14],G=r[15];o+=(n=e[0])*C,a+=n*N,s+=n*z,f+=n*U,u+=n*q,h+=n*K,c+=n*D,d+=n*H,l+=n*F,p+=n*W,b+=n*Z,m+=n*V,y+=n*Y,g+=n*J,v+=n*X,w+=n*G,a+=(n=e[1])*C,s+=n*N,f+=n*z,u+=n*U,h+=n*q,c+=n*K,d+=n*D,l+=n*H,p+=n*F,b+=n*W,m+=n*Z,y+=n*V,g+=n*Y,v+=n*J,w+=n*X,_+=n*G,s+=(n=e[2])*C,f+=n*N,u+=n*z,h+=n*U,c+=n*q,d+=n*K,l+=n*D,p+=n*H,b+=n*F,m+=n*W,y+=n*Z,g+=n*V,v+=n*Y,w+=n*J,_+=n*X,M+=n*G,f+=(n=e[3])*C,u+=n*N,h+=n*z,c+=n*U,d+=n*q,l+=n*K,p+=n*D,b+=n*H,m+=n*F,y+=n*W,g+=n*Z,v+=n*V,w+=n*Y,_+=n*J,M+=n*X,S+=n*G,u+=(n=e[4])*C,h+=n*N,c+=n*z,d+=n*U,l+=n*q,p+=n*K,b+=n*D,m+=n*H,y+=n*F,g+=n*W,v+=n*Z,w+=n*V,_+=n*Y,M+=n*J,S+=n*X,x+=n*G,h+=(n=e[5])*C,c+=n*N,d+=n*z,l+=n*U,p+=n*q,b+=n*K,m+=n*D,y+=n*H,g+=n*F,v+=n*W,w+=n*Z,_+=n*V,M+=n*Y,S+=n*J,x+=n*X,A+=n*G,c+=(n=e[6])*C,d+=n*N,l+=n*z,p+=n*U,b+=n*q,m+=n*K,y+=n*D,g+=n*H,v+=n*F,w+=n*W,_+=n*Z,M+=n*V,S+=n*Y,x+=n*J,A+=n*X,E+=n*G,d+=(n=e[7])*C,l+=n*N,p+=n*z,b+=n*U,m+=n*q,y+=n*K,g+=n*D,v+=n*H,w+=n*F,_+=n*W,M+=n*Z,S+=n*V,x+=n*Y,A+=n*J,E+=n*X,k+=n*G,l+=(n=e[8])*C,p+=n*N,b+=n*z,m+=n*U,y+=n*q,g+=n*K,v+=n*D,w+=n*H,_+=n*F,M+=n*W,S+=n*Z,x+=n*V,A+=n*Y,E+=n*J,k+=n*X,R+=n*G,p+=(n=e[9])*C,b+=n*N,m+=n*z,y+=n*U,g+=n*q,v+=n*K,w+=n*D,_+=n*H,M+=n*F,S+=n*W,x+=n*Z,A+=n*V,E+=n*Y,k+=n*J,R+=n*X,T+=n*G,b+=(n=e[10])*C,m+=n*N,y+=n*z,g+=n*U,v+=n*q,w+=n*K,_+=n*D,M+=n*H,S+=n*F,x+=n*W,A+=n*Z,E+=n*V,k+=n*Y,R+=n*J,T+=n*X,B+=n*G,m+=(n=e[11])*C,y+=n*N,g+=n*z,v+=n*U,w+=n*q,_+=n*K,M+=n*D,S+=n*H,x+=n*F,A+=n*W,E+=n*Z,k+=n*V,R+=n*Y,T+=n*J,B+=n*X,I+=n*G,y+=(n=e[12])*C,g+=n*N,v+=n*z,w+=n*U,_+=n*q,M+=n*K,S+=n*D,x+=n*H,A+=n*F,E+=n*W,k+=n*Z,R+=n*V,T+=n*Y,B+=n*J,I+=n*X,L+=n*G,g+=(n=e[13])*C,v+=n*N,w+=n*z,_+=n*U,M+=n*q,S+=n*K,x+=n*D,A+=n*H,E+=n*F,k+=n*W,R+=n*Z,T+=n*V,B+=n*Y,I+=n*J,L+=n*X,P+=n*G,v+=(n=e[14])*C,w+=n*N,_+=n*z,M+=n*U,S+=n*q,x+=n*K,A+=n*D,E+=n*H,k+=n*F,R+=n*W,T+=n*Z,B+=n*V,I+=n*Y,L+=n*J,P+=n*X,j+=n*G,w+=(n=e[15])*C,a+=38*(M+=n*z),s+=38*(S+=n*U),f+=38*(x+=n*q),u+=38*(A+=n*K),h+=38*(E+=n*D),c+=38*(k+=n*H),d+=38*(R+=n*F),l+=38*(T+=n*W),p+=38*(B+=n*Z),b+=38*(I+=n*V),m+=38*(L+=n*Y),y+=38*(P+=n*J),g+=38*(j+=n*X),v+=38*(O+=n*G),o=(n=(o+=38*(_+=n*N))+(i=1)+65535)-65536*(i=Math.floor(n/65536)),a=(n=a+i+65535)-65536*(i=Math.floor(n/65536)),s=(n=s+i+65535)-65536*(i=Math.floor(n/65536)),f=(n=f+i+65535)-65536*(i=Math.floor(n/65536)),u=(n=u+i+65535)-65536*(i=Math.floor(n/65536)),h=(n=h+i+65535)-65536*(i=Math.floor(n/65536)),c=(n=c+i+65535)-65536*(i=Math.floor(n/65536)),d=(n=d+i+65535)-65536*(i=Math.floor(n/65536)),l=(n=l+i+65535)-65536*(i=Math.floor(n/65536)),p=(n=p+i+65535)-65536*(i=Math.floor(n/65536)),b=(n=b+i+65535)-65536*(i=Math.floor(n/65536)),m=(n=m+i+65535)-65536*(i=Math.floor(n/65536)),y=(n=y+i+65535)-65536*(i=Math.floor(n/65536)),g=(n=g+i+65535)-65536*(i=Math.floor(n/65536)),v=(n=v+i+65535)-65536*(i=Math.floor(n/65536)),w=(n=w+i+65535)-65536*(i=Math.floor(n/65536)),o=(n=(o+=i-1+37*(i-1))+(i=1)+65535)-65536*(i=Math.floor(n/65536)),a=(n=a+i+65535)-65536*(i=Math.floor(n/65536)),s=(n=s+i+65535)-65536*(i=Math.floor(n/65536)),f=(n=f+i+65535)-65536*(i=Math.floor(n/65536)),u=(n=u+i+65535)-65536*(i=Math.floor(n/65536)),h=(n=h+i+65535)-65536*(i=Math.floor(n/65536)),c=(n=c+i+65535)-65536*(i=Math.floor(n/65536)),d=(n=d+i+65535)-65536*(i=Math.floor(n/65536)),l=(n=l+i+65535)-65536*(i=Math.floor(n/65536)),p=(n=p+i+65535)-65536*(i=Math.floor(n/65536)),b=(n=b+i+65535)-65536*(i=Math.floor(n/65536)),m=(n=m+i+65535)-65536*(i=Math.floor(n/65536)),y=(n=y+i+65535)-65536*(i=Math.floor(n/65536)),g=(n=g+i+65535)-65536*(i=Math.floor(n/65536)),v=(n=v+i+65535)-65536*(i=Math.floor(n/65536)),w=(n=w+i+65535)-65536*(i=Math.floor(n/65536)),o+=i-1+37*(i-1),t[0]=o,t[1]=a,t[2]=s,t[3]=f,t[4]=u,t[5]=h,t[6]=c,t[7]=d,t[8]=l,t[9]=p,t[10]=b,t[11]=m,t[12]=y,t[13]=g,t[14]=v,t[15]=w}function q(t,e){U(t,e,e)}function K(t,e){var n,i=r();for(n=0;n<16;n++)i[n]=e[n];for(n=253;n>=0;n--)q(i,i),2!==n&&4!==n&&U(i,i,e);for(n=0;n<16;n++)t[n]=i[n]}function D(t,e){var n,i=r();for(n=0;n<16;n++)i[n]=e[n];for(n=250;n>=0;n--)q(i,i),1!==n&&U(i,i,e);for(n=0;n<16;n++)t[n]=i[n]}function H(t,e,n){var i,o,a=new Uint8Array(32),s=new Float64Array(80),u=r(),h=r(),c=r(),d=r(),l=r(),p=r();for(o=0;o<31;o++)a[o]=e[o];for(a[31]=127&e[31]|64,a[0]&=248,C(s,n),o=0;o<16;o++)h[o]=s[o],d[o]=u[o]=c[o]=0;for(u[0]=d[0]=1,o=254;o>=0;--o)L(u,h,i=a[o>>>3]>>>(7&o)&1),L(c,d,i),N(l,u,c),z(u,u,c),N(c,h,d),z(h,h,d),q(d,l),q(p,u),U(u,c,u),U(c,h,l),N(l,u,c),z(u,u,c),q(h,u),z(c,d,p),U(u,c,f),N(u,u,d),U(c,c,u),U(u,d,p),U(d,h,s),q(h,l),L(u,h,i),L(c,d,i);for(o=0;o<16;o++)s[o+16]=u[o],s[o+32]=c[o],s[o+48]=h[o],s[o+64]=d[o];var b=s.subarray(32),m=s.subarray(16);return K(b,b),U(m,m,b),P(t,m),0}function F(t,e){return H(t,e,o)}function W(t,e){return n(e,32),F(t,e)}function Z(t,e,r){var n=new Uint8Array(32);return H(n,r,e),v(t,i,n,w)}A.prototype.blocks=function(t,e,r){for(var n,i,o,a,s,f,u,h,c,d,l,p,b,m,y,g,v,w,_,M=this.fin?0:2048,S=this.h[0],x=this.h[1],A=this.h[2],E=this.h[3],k=this.h[4],R=this.h[5],T=this.h[6],B=this.h[7],I=this.h[8],L=this.h[9],P=this.r[0],j=this.r[1],O=this.r[2],C=this.r[3],N=this.r[4],z=this.r[5],U=this.r[6],q=this.r[7],K=this.r[8],D=this.r[9];r>=16;)d=c=0,d+=(S+=8191&(n=255&t[e+0]|(255&t[e+1])<<8))*P,d+=(x+=8191&(n>>>13|(i=255&t[e+2]|(255&t[e+3])<<8)<<3))*(5*D),d+=(A+=8191&(i>>>10|(o=255&t[e+4]|(255&t[e+5])<<8)<<6))*(5*K),d+=(E+=8191&(o>>>7|(a=255&t[e+6]|(255&t[e+7])<<8)<<9))*(5*q),c=(d+=(k+=8191&(a>>>4|(s=255&t[e+8]|(255&t[e+9])<<8)<<12))*(5*U))>>>13,d&=8191,d+=(R+=s>>>1&8191)*(5*z),d+=(T+=8191&(s>>>14|(f=255&t[e+10]|(255&t[e+11])<<8)<<2))*(5*N),d+=(B+=8191&(f>>>11|(u=255&t[e+12]|(255&t[e+13])<<8)<<5))*(5*C),d+=(I+=8191&(u>>>8|(h=255&t[e+14]|(255&t[e+15])<<8)<<8))*(5*O),l=c+=(d+=(L+=h>>>5|M)*(5*j))>>>13,l+=S*j,l+=x*P,l+=A*(5*D),l+=E*(5*K),c=(l+=k*(5*q))>>>13,l&=8191,l+=R*(5*U),l+=T*(5*z),l+=B*(5*N),l+=I*(5*C),c+=(l+=L*(5*O))>>>13,l&=8191,p=c,p+=S*O,p+=x*j,p+=A*P,p+=E*(5*D),c=(p+=k*(5*K))>>>13,p&=8191,p+=R*(5*q),p+=T*(5*U),p+=B*(5*z),p+=I*(5*N),b=c+=(p+=L*(5*C))>>>13,b+=S*C,b+=x*O,b+=A*j,b+=E*P,c=(b+=k*(5*D))>>>13,b&=8191,b+=R*(5*K),b+=T*(5*q),b+=B*(5*U),b+=I*(5*z),m=c+=(b+=L*(5*N))>>>13,m+=S*N,m+=x*C,m+=A*O,m+=E*j,c=(m+=k*P)>>>13,m&=8191,m+=R*(5*D),m+=T*(5*K),m+=B*(5*q),m+=I*(5*U),y=c+=(m+=L*(5*z))>>>13,y+=S*z,y+=x*N,y+=A*C,y+=E*O,c=(y+=k*j)>>>13,y&=8191,y+=R*P,y+=T*(5*D),y+=B*(5*K),y+=I*(5*q),g=c+=(y+=L*(5*U))>>>13,g+=S*U,g+=x*z,g+=A*N,g+=E*C,c=(g+=k*O)>>>13,g&=8191,g+=R*j,g+=T*P,g+=B*(5*D),g+=I*(5*K),v=c+=(g+=L*(5*q))>>>13,v+=S*q,v+=x*U,v+=A*z,v+=E*N,c=(v+=k*C)>>>13,v&=8191,v+=R*O,v+=T*j,v+=B*P,v+=I*(5*D),w=c+=(v+=L*(5*K))>>>13,w+=S*K,w+=x*q,w+=A*U,w+=E*z,c=(w+=k*N)>>>13,w&=8191,w+=R*C,w+=T*O,w+=B*j,w+=I*P,_=c+=(w+=L*(5*D))>>>13,_+=S*D,_+=x*K,_+=A*q,_+=E*U,c=(_+=k*z)>>>13,_&=8191,_+=R*N,_+=T*C,_+=B*O,_+=I*j,S=d=8191&(c=(c=((c+=(_+=L*P)>>>13)<<2)+c|0)+(d&=8191)|0),x=l+=c>>>=13,A=p&=8191,E=b&=8191,k=m&=8191,R=y&=8191,T=g&=8191,B=v&=8191,I=w&=8191,L=_&=8191,e+=16,r-=16;this.h[0]=S,this.h[1]=x,this.h[2]=A,this.h[3]=E,this.h[4]=k,this.h[5]=R,this.h[6]=T,this.h[7]=B,this.h[8]=I,this.h[9]=L},A.prototype.finish=function(t,e){var r,n,i,o,a=new Uint16Array(10);if(this.leftover){for(o=this.leftover,this.buffer[o++]=1;o<16;o++)this.buffer[o]=0;this.fin=1,this.blocks(this.buffer,0,16)}for(r=this.h[1]>>>13,this.h[1]&=8191,o=2;o<10;o++)this.h[o]+=r,r=this.h[o]>>>13,this.h[o]&=8191;for(this.h[0]+=5*r,r=this.h[0]>>>13,this.h[0]&=8191,this.h[1]+=r,r=this.h[1]>>>13,this.h[1]&=8191,this.h[2]+=r,a[0]=this.h[0]+5,r=a[0]>>>13,a[0]&=8191,o=1;o<10;o++)a[o]=this.h[o]+r,r=a[o]>>>13,a[o]&=8191;for(a[9]-=8192,n=(1^r)-1,o=0;o<10;o++)a[o]&=n;for(n=~n,o=0;o<10;o++)this.h[o]=this.h[o]&n|a[o];for(this.h[0]=65535&(this.h[0]|this.h[1]<<13),this.h[1]=65535&(this.h[1]>>>3|this.h[2]<<10),this.h[2]=65535&(this.h[2]>>>6|this.h[3]<<7),this.h[3]=65535&(this.h[3]>>>9|this.h[4]<<4),this.h[4]=65535&(this.h[4]>>>12|this.h[5]<<1|this.h[6]<<14),this.h[5]=65535&(this.h[6]>>>2|this.h[7]<<11),this.h[6]=65535&(this.h[7]>>>5|this.h[8]<<8),this.h[7]=65535&(this.h[8]>>>8|this.h[9]<<5),i=this.h[0]+this.pad[0],this.h[0]=65535&i,o=1;o<8;o++)i=(this.h[o]+this.pad[o]|0)+(i>>>16)|0,this.h[o]=65535&i;t[e+0]=this.h[0]>>>0&255,t[e+1]=this.h[0]>>>8&255,t[e+2]=this.h[1]>>>0&255,t[e+3]=this.h[1]>>>8&255,t[e+4]=this.h[2]>>>0&255,t[e+5]=this.h[2]>>>8&255,t[e+6]=this.h[3]>>>0&255,t[e+7]=this.h[3]>>>8&255,t[e+8]=this.h[4]>>>0&255,t[e+9]=this.h[4]>>>8&255,t[e+10]=this.h[5]>>>0&255,t[e+11]=this.h[5]>>>8&255,t[e+12]=this.h[6]>>>0&255,t[e+13]=this.h[6]>>>8&255,t[e+14]=this.h[7]>>>0&255,t[e+15]=this.h[7]>>>8&255},A.prototype.update=function(t,e,r){var n,i;if(this.leftover){for((i=16-this.leftover)>r&&(i=r),n=0;n=16&&(i=r-r%16,this.blocks(t,e,i),e+=i,r-=i),r){for(n=0;n=128;){for(M=0;M<16;M++)S=8*M+Y,B[M]=r[S+0]<<24|r[S+1]<<16|r[S+2]<<8|r[S+3],I[M]=r[S+4]<<24|r[S+5]<<16|r[S+6]<<8|r[S+7];for(M=0;M<80;M++)if(i=L,o=P,a=j,s=O,f=C,u=N,h=z,U,d=q,l=K,p=D,b=H,m=F,y=W,g=Z,V,E=65535&(A=V),k=A>>>16,R=65535&(x=U),T=x>>>16,E+=65535&(A=(F>>>14|C<<18)^(F>>>18|C<<14)^(C>>>9|F<<23)),k+=A>>>16,R+=65535&(x=(C>>>14|F<<18)^(C>>>18|F<<14)^(F>>>9|C<<23)),T+=x>>>16,E+=65535&(A=F&W^~F&Z),k+=A>>>16,R+=65535&(x=C&N^~C&z),T+=x>>>16,E+=65535&(A=J[2*M+1]),k+=A>>>16,R+=65535&(x=J[2*M]),T+=x>>>16,x=B[M%16],k+=(A=I[M%16])>>>16,R+=65535&x,T+=x>>>16,R+=(k+=(E+=65535&A)>>>16)>>>16,E=65535&(A=_=65535&E|k<<16),k=A>>>16,R=65535&(x=w=65535&R|(T+=R>>>16)<<16),T=x>>>16,E+=65535&(A=(q>>>28|L<<4)^(L>>>2|q<<30)^(L>>>7|q<<25)),k+=A>>>16,R+=65535&(x=(L>>>28|q<<4)^(q>>>2|L<<30)^(q>>>7|L<<25)),T+=x>>>16,k+=(A=q&K^q&D^K&D)>>>16,R+=65535&(x=L&P^L&j^P&j),T+=x>>>16,c=65535&(R+=(k+=(E+=65535&A)>>>16)>>>16)|(T+=R>>>16)<<16,v=65535&E|k<<16,E=65535&(A=b),k=A>>>16,R=65535&(x=s),T=x>>>16,k+=(A=_)>>>16,R+=65535&(x=w),T+=x>>>16,P=i,j=o,O=a,C=s=65535&(R+=(k+=(E+=65535&A)>>>16)>>>16)|(T+=R>>>16)<<16,N=f,z=u,U=h,L=c,K=d,D=l,H=p,F=b=65535&E|k<<16,W=m,Z=y,V=g,q=v,M%16==15)for(S=0;S<16;S++)x=B[S],E=65535&(A=I[S]),k=A>>>16,R=65535&x,T=x>>>16,x=B[(S+9)%16],E+=65535&(A=I[(S+9)%16]),k+=A>>>16,R+=65535&x,T+=x>>>16,w=B[(S+1)%16],E+=65535&(A=((_=I[(S+1)%16])>>>1|w<<31)^(_>>>8|w<<24)^(_>>>7|w<<25)),k+=A>>>16,R+=65535&(x=(w>>>1|_<<31)^(w>>>8|_<<24)^w>>>7),T+=x>>>16,w=B[(S+14)%16],k+=(A=((_=I[(S+14)%16])>>>19|w<<13)^(w>>>29|_<<3)^(_>>>6|w<<26))>>>16,R+=65535&(x=(w>>>19|_<<13)^(_>>>29|w<<3)^w>>>6),T+=x>>>16,T+=(R+=(k+=(E+=65535&A)>>>16)>>>16)>>>16,B[S]=65535&R|T<<16,I[S]=65535&E|k<<16;E=65535&(A=q),k=A>>>16,R=65535&(x=L),T=x>>>16,x=t[0],k+=(A=e[0])>>>16,R+=65535&x,T+=x>>>16,T+=(R+=(k+=(E+=65535&A)>>>16)>>>16)>>>16,t[0]=L=65535&R|T<<16,e[0]=q=65535&E|k<<16,E=65535&(A=K),k=A>>>16,R=65535&(x=P),T=x>>>16,x=t[1],k+=(A=e[1])>>>16,R+=65535&x,T+=x>>>16,T+=(R+=(k+=(E+=65535&A)>>>16)>>>16)>>>16,t[1]=P=65535&R|T<<16,e[1]=K=65535&E|k<<16,E=65535&(A=D),k=A>>>16,R=65535&(x=j),T=x>>>16,x=t[2],k+=(A=e[2])>>>16,R+=65535&x,T+=x>>>16,T+=(R+=(k+=(E+=65535&A)>>>16)>>>16)>>>16,t[2]=j=65535&R|T<<16,e[2]=D=65535&E|k<<16,E=65535&(A=H),k=A>>>16,R=65535&(x=O),T=x>>>16,x=t[3],k+=(A=e[3])>>>16,R+=65535&x,T+=x>>>16,T+=(R+=(k+=(E+=65535&A)>>>16)>>>16)>>>16,t[3]=O=65535&R|T<<16,e[3]=H=65535&E|k<<16,E=65535&(A=F),k=A>>>16,R=65535&(x=C),T=x>>>16,x=t[4],k+=(A=e[4])>>>16,R+=65535&x,T+=x>>>16,T+=(R+=(k+=(E+=65535&A)>>>16)>>>16)>>>16,t[4]=C=65535&R|T<<16,e[4]=F=65535&E|k<<16,E=65535&(A=W),k=A>>>16,R=65535&(x=N),T=x>>>16,x=t[5],k+=(A=e[5])>>>16,R+=65535&x,T+=x>>>16,T+=(R+=(k+=(E+=65535&A)>>>16)>>>16)>>>16,t[5]=N=65535&R|T<<16,e[5]=W=65535&E|k<<16,E=65535&(A=Z),k=A>>>16,R=65535&(x=z),T=x>>>16,x=t[6],k+=(A=e[6])>>>16,R+=65535&x,T+=x>>>16,T+=(R+=(k+=(E+=65535&A)>>>16)>>>16)>>>16,t[6]=z=65535&R|T<<16,e[6]=Z=65535&E|k<<16,E=65535&(A=V),k=A>>>16,R=65535&(x=U),T=x>>>16,x=t[7],k+=(A=e[7])>>>16,R+=65535&x,T+=x>>>16,T+=(R+=(k+=(E+=65535&A)>>>16)>>>16)>>>16,t[7]=U=65535&R|T<<16,e[7]=V=65535&E|k<<16,Y+=128,n-=128}return n}function G(t,e,r){var n,i=new Int32Array(8),o=new Int32Array(8),a=new Uint8Array(256),s=r;for(i[0]=1779033703,i[1]=3144134277,i[2]=1013904242,i[3]=2773480762,i[4]=1359893119,i[5]=2600822924,i[6]=528734635,i[7]=1541459225,o[0]=4089235720,o[1]=2227873595,o[2]=4271175723,o[3]=1595750129,o[4]=2917565137,o[5]=725511199,o[6]=4215389547,o[7]=327033209,X(i,o,e,r),r%=128,n=0;n=0;--i)Q(t,e,n=r[i/8|0]>>(7&i)&1),$(e,t),$(t,t),Q(t,e,n)}function rt(t,e){var n=[r(),r(),r(),r()];B(n[0],c),B(n[1],d),B(n[2],s),U(n[3],c,d),et(t,n,e)}function nt(t,e,i){var o,a=new Uint8Array(64),s=[r(),r(),r(),r()];for(i||n(e,32),G(a,e,32),a[0]&=248,a[31]&=127,a[31]|=64,rt(s,a),tt(t,s),o=0;o<32;o++)e[o+32]=t[o];return 0}var it=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function ot(t,e){var r,n,i,o;for(n=63;n>=32;--n){for(r=0,i=n-32,o=n-12;i>4)*it[i],r=e[i]>>8,e[i]&=255;for(i=0;i<32;i++)e[i]-=r*it[i];for(n=0;n<32;n++)e[n+1]+=e[n]>>8,t[n]=255&e[n]}function at(t){var e,r=new Float64Array(64);for(e=0;e<64;e++)r[e]=t[e];for(e=0;e<64;e++)t[e]=0;ot(t,r)}function st(t,e,n,i){var o,a,s=new Uint8Array(64),f=new Uint8Array(64),u=new Uint8Array(64),h=new Float64Array(64),c=[r(),r(),r(),r()];G(s,i,32),s[0]&=248,s[31]&=127,s[31]|=64;var d=n+64;for(o=0;o>7&&z(t[0],a,t[0]),U(t[3],t[0],t[1]),0)}(d,i))return-1;for(o=0;o=0},e.sign.keyPair=function(){var t=new Uint8Array(ct),e=new Uint8Array(dt);return nt(t,e),{publicKey:t,secretKey:e}},e.sign.keyPair.fromSecretKey=function(t){if(pt(t),t.length!==dt)throw new Error("bad secret key size");for(var e=new Uint8Array(ct),r=0;r0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]o)throw new Error("Elements exceed array size: "+o);for(l in c=[],t=t.slice(0,t.lastIndexOf("[")),"string"==typeof e&&(e=JSON.parse(e)),e)c.push(d(t,e[l]));if("dynamic"===o){var p=d("uint256",e.length);c.unshift(p)}return r.concat(c)}if("bytes"===t)return e=new r(e),c=r.concat([d("uint256",e.length),e]),e.length%32!=0&&(c=r.concat([c,n.zeros(32-e.length%32)])),c;if(t.startsWith("bytes")){if((o=s(t))<1||o>32)throw new Error("Invalid bytes width: "+o);return n.setLengthRight(e,32)}if(t.startsWith("uint")){if((o=s(t))%8||o<8||o>256)throw new Error("Invalid uint width: "+o);if((a=h(e)).bitLength()>o)throw new Error("Supplied uint exceeds width: "+o+" vs "+a.bitLength());if(a<0)throw new Error("Supplied uint is negative");return a.toArrayLike(r,"be",32)}if(t.startsWith("int")){if((o=s(t))%8||o<8||o>256)throw new Error("Invalid int width: "+o);if((a=h(e)).bitLength()>o)throw new Error("Supplied int exceeds width: "+o+" vs "+a.bitLength());return a.toTwos(256).toArrayLike(r,"be",32)}if(t.startsWith("ufixed")){if(o=f(t),(a=h(e))<0)throw new Error("Supplied ufixed is negative");return d("uint256",a.mul(new i(2).pow(new i(o[1]))))}if(t.startsWith("fixed"))return o=f(t),d("int256",h(e).mul(new i(2).pow(new i(o[1]))));throw new Error("Unsupported or invalid type: "+t)}function l(t,e,n){var o,a,s,f;if("string"==typeof t&&(t=p(t)),"address"===t.name)return l(t.rawType,e,n).toArrayLike(r,"be",20).toString("hex");if("bool"===t.name)return l(t.rawType,e,n).toString()===new i(1).toString();if("string"===t.name){var u=l(t.rawType,e,n);return new r(u,"utf8").toString()}if(t.isArray){for(s=[],o=t.size,"dynamic"===t.size&&(n=l("uint256",e,n).toNumber(),o=l("uint256",e,n).toNumber(),n+=32),f=0;ft.size)throw new Error("Decoded int exceeds width: "+t.size+" vs "+a.bitLength());return a}if(t.name.startsWith("int")){if((a=new i(e.slice(n,n+32),16,"be").fromTwos(256)).bitLength()>t.size)throw new Error("Decoded uint exceeds width: "+t.size+" vs "+a.bitLength());return a}if(t.name.startsWith("ufixed")){if(o=new i(2).pow(new i(t.size[1])),!(a=l("uint256",e,n)).mod(o).isZero())throw new Error("Decimals not supported yet");return a.div(o)}if(t.name.startsWith("fixed")){if(o=new i(2).pow(new i(t.size[1])),!(a=l("int256",e,n)).mod(o).isZero())throw new Error("Decimals not supported yet");return a.div(o)}throw new Error("Unsupported or invalid type: "+t.name)}function p(t){var e,r,n;if(m(t)){e=u(t);var i=t.slice(0,t.lastIndexOf("["));return i=p(i),r={isArray:!0,name:t,size:e,memoryUsage:"dynamic"===e?32:i.memoryUsage*e,subArray:i}}switch(t){case"address":n="uint160";break;case"bool":n="uint8";break;case"string":n="bytes"}if(r={rawType:n,name:t,memoryUsage:32},t.startsWith("bytes")&&"bytes"!==t||t.startsWith("uint")||t.startsWith("int")?r.size=s(t):(t.startsWith("ufixed")||t.startsWith("fixed"))&&(r.size=f(t)),t.startsWith("bytes")&&"bytes"!==t&&(r.size<1||r.size>32))throw new Error("Invalid bytes width: "+r.size);if((t.startsWith("uint")||t.startsWith("int"))&&(r.size%8||r.size<8||r.size>256))throw new Error("Invalid int/uint width: "+r.size);return r}function b(t){return"string"===t||"bytes"===t||"dynamic"===u(t)}function m(t){return t.lastIndexOf("]")===t.length-1}function y(t,e){return t.startsWith("address")||t.startsWith("bytes")?"0x"+e.toString("hex"):e.toString()}o.eventID=function(t,e){var i=t+"("+e.map(a).join(",")+")";return n.sha3(new r(i))},o.methodID=function(t,e){return o.eventID(t,e).slice(0,4)},o.rawEncode=function(t,e){var n=[],i=[],o=32*t.length;for(var s in t){var f=a(t[s]),u=d(f,e[s]);b(f)?(n.push(d("uint256",o)),i.push(u),o+=u.length):n.push(u)}return r.concat(n.concat(i))},o.rawDecode=function(t,e){var n=[];e=new r(e);var i=0;for(var o in t){var s=p(a(t[o])),f=l(s,e,i);i+=s.memoryUsage,n.push(f)}return n},o.simpleEncode=function(t){var e=Array.prototype.slice.call(arguments).slice(1),n=c(t);if(e.length!==n.args.length)throw new Error("Argument count mismatch");return r.concat([o.methodID(n.method,n.args),o.rawEncode(n.args,e)])},o.simpleDecode=function(t,e){var r=c(t);if(!r.retargs)throw new Error("No return values in method");return o.rawDecode(r.retargs,e)},o.stringify=function(t,e){var r=[];for(var n in t){var i=t[n],o=e[n];o=/^[^\[]+\[.*\]$/.test(i)?o.map((function(t){return y(i,t)})).join(", "):y(i,o),r.push(o)}return r},o.solidityPack=function(t,e){if(t.length!==e.length)throw new Error("Number of types are not matching the values");for(var i,o,f=[],u=0;u32)throw new Error("Invalid bytes width: "+i);f.push(n.setLengthRight(d,i))}else if(c.startsWith("uint")){if((i=s(c))%8||i<8||i>256)throw new Error("Invalid uint width: "+i);if((o=h(d)).bitLength()>i)throw new Error("Supplied uint exceeds width: "+i+" vs "+o.bitLength());f.push(o.toArrayLike(r,"be",i/8))}else{if(!c.startsWith("int"))throw new Error("Unsupported or invalid type: "+c);if((i=s(c))%8||i<8||i>256)throw new Error("Invalid int width: "+i);if((o=h(d)).bitLength()>i)throw new Error("Supplied int exceeds width: "+i+" vs "+o.bitLength());f.push(o.toTwos(i).toArrayLike(r,"be",i/8))}}return r.concat(f)},o.soliditySHA3=function(t,e){return n.sha3(o.solidityPack(t,e))},o.soliditySHA256=function(t,e){return n.sha256(o.solidityPack(t,e))},o.solidityRIPEMD160=function(t,e){return n.ripemd160(o.solidityPack(t,e),!0)},o.fromSerpent=function(t){for(var e,r=[],n=0;n="0"&&e<="9");)o+=t[a]-"0",a++;n=a-1,r.push(o)}else if("i"===i)r.push("int256");else{if("a"!==i)throw new Error("Unsupported or invalid type: "+i);r.push("int256[]")}}return r},o.toSerpent=function(t){for(var e=[],r=0;r0&&"0"===e.toString();)e=(t=t.slice(1))[0];return t},r.toBuffer=function(t){if(!e.isBuffer(t))if(Array.isArray(t))t=new e(t);else if("string"==typeof t)t=r.isHexPrefixed(t)?new e(r.padToEven(r.stripHexPrefix(t)),"hex"):new e(t);else if("number"==typeof t)t=r.intToBuffer(t);else if(null==t)t=new e([]);else{if(!t.toArray)throw new Error("invalid type");t=new e(t.toArray())}return t},r.intToHex=function(t){h(t%1==0,"number is not a integer"),h(t>=0,"number must be positive");var e=t.toString(16);return e.length%2&&(e="0"+e),"0x"+e},r.intToBuffer=function(t){var n=r.intToHex(t);return new e(n.slice(2),"hex")},r.bufferToInt=function(t){return parseInt(r.bufferToHex(t),16)},r.bufferToHex=function(t){return 0===(t=r.toBuffer(t)).length?0:"0x"+t.toString("hex")},r.fromSigned=function(t){return new d(t).fromTwos(256)},r.toUnsigned=function(t){return new e(t.toTwos(256).toArray())},r.sha3=function(t,e){switch(t=r.toBuffer(t),e||(e=256),e){case 224:return o(t);case 256:return s(t);case 384:return a(t);case 512:return f(t);default:throw new Error("Invalid algorithm: keccak"+e)}},r.sha256=function(t){return t=r.toBuffer(t),l("sha256").update(t).digest()},r.ripemd160=function(t,e){t=r.toBuffer(t);var n=l("rmd160").update(t).digest();return!0===e?r.setLength(n,32):n},r.rlphash=function(t){return r.sha3(c.encode(t))},r.isValidPrivate=function(t){return u.privateKeyVerify(t)},r.isValidPublic=function(t,r){return 64===t.length?u.publicKeyVerify(e.concat([new e([4]),t])):!!r&&u.publicKeyVerify(t)},r.pubToAddress=r.publicToAddress=function(t,e){return t=r.toBuffer(t),e&&64!==t.length&&(t=u.publicKeyConvert(t,!1).slice(1)),h(64===t.length),r.sha3(t).slice(-20)};var p=r.privateToPublic=function(t){return t=r.toBuffer(t),u.publicKeyCreate(t,!1).slice(1)};r.importPublic=function(t){return 64!==(t=r.toBuffer(t)).length&&(t=u.publicKeyConvert(t,!1).slice(1)),t},r.ecsign=function(t,e){var r=u.sign(t,e),n={};return n.r=r.signature.slice(0,32),n.s=r.signature.slice(32,64),n.v=r.recovery+27,n},r.ecrecover=function(t,n,i,o){var a=e.concat([r.setLength(i,32),r.setLength(o,32)],64),s=r.bufferToInt(n)-27;if(0!==s&&1!==s)throw new Error("Invalid signature v value");var f=u.recover(t,a,s);return u.publicKeyConvert(f,!1).slice(1)},r.toRpcSig=function(t,n,i){return r.bufferToHex(e.concat([n,i,r.toBuffer(t-27)]))},r.fromRpcSig=function(t){var e=(t=r.toBuffer(t))[64];return e<27&&(e+=27),{v:e,r:t.slice(0,32),s:t.slice(32,64)}},r.privateToAddress=function(t){return r.publicToAddress(p(t))},r.isValidAddress=function(t){return/^0x[0-9a-fA-F]{40}$/i.test(t)},r.toChecksumAddress=function(t){t=r.stripHexPrefix(t).toLowerCase();for(var e=r.sha3(t).toString("hex"),n="0x",i=0;i=8?n+=t[i].toUpperCase():n+=t[i];return n},r.isValidChecksumAddress=function(t){return r.isValidAddress(t)&&r.toChecksumAddress(t)===t},r.generateAddress=function(t,n){return t=r.toBuffer(t),n=(n=new d(n)).isZero()?null:new e(n.toArray()),r.rlphash([t,n]).slice(-20)},r.isPrecompiled=function(t){var e=r.unpad(t);return 1===e.length&&e[0]>0&&e[0]<5},r.isHexPrefixed=function(t){return"0x"===t.slice(0,2)},r.stripHexPrefix=function(t){return"string"!=typeof t?t:r.isHexPrefixed(t)?t.slice(2):t},r.addHexPrefix=function(t){return"string"!=typeof t||r.isHexPrefixed(t)?t:"0x"+t},r.padToEven=function(t){return t.length%2&&(t="0"+t),t},r.baToJSON=function(t){if(e.isBuffer(t))return"0x"+t.toString("hex");if(t instanceof Array){for(var n=[],i=0;i=o.length,"The field "+n.name+" must not have more "+n.length+" bytes")):n.allowZero&&0===o.length||!n.length||h(n.length===o.length,"The field "+n.name+" must have byte length of "+n.length),t.raw[i]=o}t._fields.push(n.name),Object.defineProperty(t,n.name,{enumerable:!0,configurable:!0,get:o,set:a}),n.default&&(t[n.name]=n.default),n.alias&&Object.defineProperty(t,n.alias,{enumerable:!1,configurable:!0,set:a,get:o})})),o)if("string"==typeof o&&(o=new e(r.stripHexPrefix(o),"hex")),e.isBuffer(o)&&(o=c.decode(o)),Array.isArray(o)){if(o.length>t._fields.length)throw new Error("wrong number of fields in data");o.forEach((function(e,n){t[t._fields[n]]=r.toBuffer(e)}))}else{if("object"!==(void 0===o?"undefined":n(o)))throw new Error("invalid data");for(var a in o)-1!==t._fields.indexOf(a)&&(t[a]=o[a])}}}).call(this,t("buffer").Buffer)},{"./secp256k1-adapter":42,assert:1,"bn.js":6,buffer:9,"create-hash":12,"ethereum-cryptography/keccak":36,rlp:122}],42:[function(t,e,r){arguments[4][31][0].apply(r,arguments)},{"./secp256k1-lib/der":43,"./secp256k1-lib/index":44,buffer:9,dup:31,"ethereum-cryptography/secp256k1":38}],43:[function(t,e,r){arguments[4][32][0].apply(r,arguments)},{buffer:9,dup:32}],44:[function(t,e,r){arguments[4][33][0].apply(r,arguments)},{"bn.js":6,buffer:9,dup:33,elliptic:13}],45:[function(t,e,r){(function(e){"use strict";var n=this&&this.__read||function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,i,o=r.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(n=o.next()).done;)a.push(n.value)}catch(t){i={error:t}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return a},i=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(r,"__esModule",{value:!0}),r.isZeroAddress=r.zeroAddress=r.importPublic=r.privateToAddress=r.privateToPublic=r.publicToAddress=r.pubToAddress=r.isValidPublic=r.isValidPrivate=r.generateAddress2=r.generateAddress=r.isValidChecksumAddress=r.toChecksumAddress=r.isValidAddress=r.Account=void 0;var o=i(t("assert")),a=t("./externals"),s=t("ethereum-cryptography/secp256k1"),f=t("./internal"),u=t("./constants"),h=t("./bytes"),c=t("./hash"),d=t("./helpers"),l=t("./types"),p=function(){function t(t,e,r,n){void 0===t&&(t=new a.BN(0)),void 0===e&&(e=new a.BN(0)),void 0===r&&(r=u.KECCAK256_RLP),void 0===n&&(n=u.KECCAK256_NULL),this.nonce=t,this.balance=e,this.stateRoot=r,this.codeHash=n,this._validate()}return t.fromAccountData=function(e){var r=e.nonce,n=e.balance,i=e.stateRoot,o=e.codeHash;return new t(r?new a.BN((0,h.toBuffer)(r)):void 0,n?new a.BN((0,h.toBuffer)(n)):void 0,i?(0,h.toBuffer)(i):void 0,o?(0,h.toBuffer)(o):void 0)},t.fromRlpSerializedAccount=function(t){var e=a.rlp.decode(t);if(!Array.isArray(e))throw new Error("Invalid serialized account input. Must be array");return this.fromValuesArray(e)},t.fromValuesArray=function(e){var r=n(e,4),i=r[0],o=r[1],s=r[2],f=r[3];return new t(new a.BN(i),new a.BN(o),s,f)},t.prototype._validate=function(){if(this.nonce.lt(new a.BN(0)))throw new Error("nonce must be greater than zero");if(this.balance.lt(new a.BN(0)))throw new Error("balance must be greater than zero");if(32!==this.stateRoot.length)throw new Error("stateRoot must have a length of 32");if(32!==this.codeHash.length)throw new Error("codeHash must have a length of 32")},t.prototype.raw=function(){return[(0,l.bnToUnpaddedBuffer)(this.nonce),(0,l.bnToUnpaddedBuffer)(this.balance),this.stateRoot,this.codeHash]},t.prototype.serialize=function(){return a.rlp.encode(this.raw())},t.prototype.isContract=function(){return!this.codeHash.equals(u.KECCAK256_NULL)},t.prototype.isEmpty=function(){return this.balance.isZero()&&this.nonce.isZero()&&this.codeHash.equals(u.KECCAK256_NULL)},t}();r.Account=p;r.isValidAddress=function(t){try{(0,d.assertIsString)(t)}catch(t){return!1}return/^0x[0-9a-fA-F]{40}$/.test(t)};r.toChecksumAddress=function(t,e){(0,d.assertIsHexString)(t);var r=(0,f.stripHexPrefix)(t).toLowerCase(),n="";e&&(n=(0,l.toType)(e,l.TypeOutput.BN).toString()+"0x");for(var i=(0,c.keccakFromString)(n+r).toString("hex"),o="0x",a=0;a=8?o+=r[a].toUpperCase():o+=r[a];return o};r.isValidChecksumAddress=function(t,e){return(0,r.isValidAddress)(t)&&(0,r.toChecksumAddress)(t,e)===t};r.generateAddress=function(t,r){(0,d.assertIsBuffer)(t),(0,d.assertIsBuffer)(r);var n=new a.BN(r);return n.isZero()?(0,c.rlphash)([t,null]).slice(-20):(0,c.rlphash)([t,e.from(n.toArray())]).slice(-20)};r.generateAddress2=function(t,r,n){return(0,d.assertIsBuffer)(t),(0,d.assertIsBuffer)(r),(0,d.assertIsBuffer)(n),(0,o.default)(20===t.length),(0,o.default)(32===r.length),(0,c.keccak256)(e.concat([e.from("ff","hex"),t,r,(0,c.keccak256)(n)])).slice(-20)};r.isValidPrivate=function(t){return(0,s.privateKeyVerify)(t)};r.isValidPublic=function(t,r){return void 0===r&&(r=!1),(0,d.assertIsBuffer)(t),64===t.length?(0,s.publicKeyVerify)(e.concat([e.from([4]),t])):!!r&&(0,s.publicKeyVerify)(t)};r.pubToAddress=function(t,r){return void 0===r&&(r=!1),(0,d.assertIsBuffer)(t),r&&64!==t.length&&(t=e.from((0,s.publicKeyConvert)(t,!1).slice(1))),(0,o.default)(64===t.length),(0,c.keccak)(t).slice(-20)},r.publicToAddress=r.pubToAddress;r.privateToPublic=function(t){return(0,d.assertIsBuffer)(t),e.from((0,s.publicKeyCreate)(t,!1)).slice(1)};r.privateToAddress=function(t){return(0,r.publicToAddress)((0,r.privateToPublic)(t))};r.importPublic=function(t){return(0,d.assertIsBuffer)(t),64!==t.length&&(t=e.from((0,s.publicKeyConvert)(t,!1).slice(1))),t};r.zeroAddress=function(){var t=(0,h.zeros)(20);return(0,h.bufferToHex)(t)};r.isZeroAddress=function(t){try{(0,d.assertIsString)(t)}catch(t){return!1}return(0,r.zeroAddress)()===t}}).call(this,t("buffer").Buffer)},{"./bytes":47,"./constants":48,"./externals":49,"./hash":50,"./helpers":51,"./internal":53,"./types":56,assert:1,buffer:9,"ethereum-cryptography/secp256k1":38}],46:[function(t,e,r){(function(e){"use strict";var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(r,"__esModule",{value:!0}),r.Address=void 0;var i=n(t("assert")),o=t("./externals"),a=t("./bytes"),s=t("./account"),f=function(){function t(t){(0,i.default)(20===t.length,"Invalid address length"),this.buf=t}return t.zero=function(){return new t((0,a.zeros)(20))},t.fromString=function(e){return(0,i.default)((0,s.isValidAddress)(e),"Invalid address"),new t((0,a.toBuffer)(e))},t.fromPublicKey=function(r){return(0,i.default)(e.isBuffer(r),"Public key should be Buffer"),new t((0,s.pubToAddress)(r))},t.fromPrivateKey=function(r){return(0,i.default)(e.isBuffer(r),"Private key should be Buffer"),new t((0,s.privateToAddress)(r))},t.generate=function(r,n){return(0,i.default)(o.BN.isBN(n)),new t((0,s.generateAddress)(r.buf,n.toArrayLike(e)))},t.generate2=function(r,n,o){return(0,i.default)(e.isBuffer(n)),(0,i.default)(e.isBuffer(o)),new t((0,s.generateAddress2)(r.buf,n,o))},t.prototype.equals=function(t){return this.buf.equals(t.buf)},t.prototype.isZero=function(){return this.equals(t.zero())},t.prototype.isPrecompileOrSystemAddress=function(){var t=new o.BN(this.buf),e=new o.BN(0),r=new o.BN("ffff","hex");return t.gte(e)&&t.lte(r)},t.prototype.toString=function(){return"0x"+this.buf.toString("hex")},t.prototype.toBuffer=function(){return e.from(this.buf)},t}();r.Address=f}).call(this,t("buffer").Buffer)},{"./account":45,"./bytes":47,"./externals":49,assert:1,buffer:9}],47:[function(t,e,r){(function(e){"use strict";var n=this&&this.__values||function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},i=this&&this.__read||function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,i,o=r.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(n=o.next()).done;)a.push(n.value)}catch(t){i={error:t}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return a};Object.defineProperty(r,"__esModule",{value:!0}),r.bufArrToArr=r.arrToBufArr=r.validateNoLeadingZeroes=r.baToJSON=r.toUtf8=r.addHexPrefix=r.toUnsigned=r.fromSigned=r.bufferToHex=r.bufferToInt=r.toBuffer=r.unpadHexString=r.unpadArray=r.unpadBuffer=r.setLengthRight=r.setLengthLeft=r.zeros=r.intToBuffer=r.intToHex=void 0;var o=t("./externals"),a=t("./internal"),s=t("./helpers");r.intToHex=function(t){if(!Number.isSafeInteger(t)||t<0)throw new Error("Received an invalid integer type: ".concat(t));return"0x".concat(t.toString(16))};r.intToBuffer=function(t){var n=(0,r.intToHex)(t);return e.from((0,a.padToEven)(n.slice(2)),"hex")};r.zeros=function(t){return e.allocUnsafe(t).fill(0)};var f=function(t,e,n){var i=(0,r.zeros)(e);return n?t.length0&&"0"===e.toString();)e=(t=t.slice(1))[0];return t};r.unpadBuffer=function(t){return(0,s.assertIsBuffer)(t),u(t)};r.unpadArray=function(t){return(0,s.assertIsArray)(t),u(t)};r.unpadHexString=function(t){return(0,s.assertIsHexString)(t),t=(0,a.stripHexPrefix)(t),u(t)};r.toBuffer=function(t){if(null==t)return e.allocUnsafe(0);if(e.isBuffer(t))return e.from(t);if(Array.isArray(t)||t instanceof Uint8Array)return e.from(t);if("string"==typeof t){if(!(0,a.isHexString)(t))throw new Error("Cannot convert string to buffer. toBuffer only supports 0x-prefixed hex strings and this string was given: ".concat(t));return e.from((0,a.padToEven)((0,a.stripHexPrefix)(t)),"hex")}if("number"==typeof t)return(0,r.intToBuffer)(t);if(o.BN.isBN(t)){if(t.isNeg())throw new Error("Cannot convert negative BN to buffer. Given: ".concat(t));return t.toArrayLike(e)}if(t.toArray)return e.from(t.toArray());if(t.toBuffer)return e.from(t.toBuffer());throw new Error("invalid type")};r.bufferToInt=function(t){return new o.BN((0,r.toBuffer)(t)).toNumber()};r.bufferToHex=function(t){return"0x"+(t=(0,r.toBuffer)(t)).toString("hex")};r.fromSigned=function(t){return new o.BN(t).fromTwos(256)};r.toUnsigned=function(t){return e.from(t.toTwos(256).toArray())};r.addHexPrefix=function(t){return"string"!=typeof t||(0,a.isHexPrefixed)(t)?t:"0x"+t};r.toUtf8=function(t){if((t=(0,a.stripHexPrefix)(t)).length%2!=0)throw new Error("Invalid non-even hex string input for toUtf8() provided");return e.from(t.replace(/^(00)+|(00)+$/g,""),"hex").toString("utf8")};r.baToJSON=function(t){if(e.isBuffer(t))return"0x".concat(t.toString("hex"));if(t instanceof Array){for(var n=[],i=0;i0&&0===u[0])throw new Error("".concat(f," cannot have leading zeroes, received: ").concat(u.toString("hex")))}}catch(t){e={error:t}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(e)throw e.error}}},r.arrToBufArr=function t(r){return Array.isArray(r)?r.map((function(e){return t(e)})):e.from(r)},r.bufArrToArr=function t(e){return Array.isArray(e)?e.map((function(e){return t(e)})):Uint8Array.from(null!=e?e:[])}}).call(this,t("buffer").Buffer)},{"./externals":49,"./helpers":51,"./internal":53,buffer:9}],48:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.KECCAK256_RLP=r.KECCAK256_RLP_S=r.KECCAK256_RLP_ARRAY=r.KECCAK256_RLP_ARRAY_S=r.KECCAK256_NULL=r.KECCAK256_NULL_S=r.TWO_POW256=r.MAX_INTEGER=r.MAX_UINT64=void 0;var n=t("buffer"),i=t("./externals");r.MAX_UINT64=new i.BN("ffffffffffffffff",16),r.MAX_INTEGER=new i.BN("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",16),r.TWO_POW256=new i.BN("10000000000000000000000000000000000000000000000000000000000000000",16),r.KECCAK256_NULL_S="c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470",r.KECCAK256_NULL=n.Buffer.from(r.KECCAK256_NULL_S,"hex"),r.KECCAK256_RLP_ARRAY_S="1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",r.KECCAK256_RLP_ARRAY=n.Buffer.from(r.KECCAK256_RLP_ARRAY_S,"hex"),r.KECCAK256_RLP_S="56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",r.KECCAK256_RLP=n.Buffer.from(r.KECCAK256_RLP_S,"hex")},{"./externals":49,buffer:9}],49:[function(t,e,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(t,e,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);i&&!("get"in i?!e.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}:function(t,e,r,n){void 0===n&&(n=r),t[n]=e[r]}),i=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),o=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)"default"!==r&&Object.prototype.hasOwnProperty.call(t,r)&&n(e,t,r);return i(e,t),e},a=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(r,"__esModule",{value:!0}),r.rlp=r.BN=void 0;var s=a(t("bn.js"));r.BN=s.default;var f=o(t("rlp"));r.rlp=f},{"bn.js":57,rlp:122}],50:[function(t,e,r){(function(e){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.rlphash=r.ripemd160FromArray=r.ripemd160FromString=r.ripemd160=r.sha256FromArray=r.sha256FromString=r.sha256=r.keccakFromArray=r.keccakFromHexString=r.keccakFromString=r.keccak256=r.keccak=void 0;var n=t("ethereum-cryptography/keccak"),i=t("create-hash"),o=t("./externals"),a=t("./bytes"),s=t("./helpers");r.keccak=function(t,e){switch(void 0===e&&(e=256),(0,s.assertIsBuffer)(t),e){case 224:return(0,n.keccak224)(t);case 256:return(0,n.keccak256)(t);case 384:return(0,n.keccak384)(t);case 512:return(0,n.keccak512)(t);default:throw new Error("Invalid algorithm: keccak".concat(e))}};r.keccak256=function(t){return(0,r.keccak)(t)};r.keccakFromString=function(t,n){void 0===n&&(n=256),(0,s.assertIsString)(t);var i=e.from(t,"utf8");return(0,r.keccak)(i,n)};r.keccakFromHexString=function(t,e){return void 0===e&&(e=256),(0,s.assertIsHexString)(t),(0,r.keccak)((0,a.toBuffer)(t),e)};r.keccakFromArray=function(t,e){return void 0===e&&(e=256),(0,s.assertIsArray)(t),(0,r.keccak)((0,a.toBuffer)(t),e)};var f=function(t){return t=(0,a.toBuffer)(t),i("sha256").update(t).digest()};r.sha256=function(t){return(0,s.assertIsBuffer)(t),f(t)};r.sha256FromString=function(t){return(0,s.assertIsString)(t),f(t)};r.sha256FromArray=function(t){return(0,s.assertIsArray)(t),f(t)};var u=function(t,e){t=(0,a.toBuffer)(t);var r=i("rmd160").update(t).digest();return!0===e?(0,a.setLengthLeft)(r,32):r};r.ripemd160=function(t,e){return(0,s.assertIsBuffer)(t),u(t,e)};r.ripemd160FromString=function(t,e){return(0,s.assertIsString)(t),u(t,e)};r.ripemd160FromArray=function(t,e){return(0,s.assertIsArray)(t),u(t,e)};r.rlphash=function(t){return(0,r.keccak)(o.rlp.encode(t))}}).call(this,t("buffer").Buffer)},{"./bytes":47,"./externals":49,"./helpers":51,buffer:9,"create-hash":12,"ethereum-cryptography/keccak":36}],51:[function(t,e,r){(function(e){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.assertIsString=r.assertIsArray=r.assertIsBuffer=r.assertIsHexString=void 0;var n=t("./internal");r.assertIsHexString=function(t){if(!(0,n.isHexString)(t)){var e="This method only supports 0x-prefixed hex strings but input was: ".concat(t);throw new Error(e)}};r.assertIsBuffer=function(t){if(!e.isBuffer(t)){var r="This method only supports Buffer but input was: ".concat(t);throw new Error(r)}};r.assertIsArray=function(t){if(!Array.isArray(t)){var e="This method only supports number arrays but input was: ".concat(t);throw new Error(e)}};r.assertIsString=function(t){if("string"!=typeof t){var e="This method only supports strings but input was: ".concat(t);throw new Error(e)}}}).call(this,{isBuffer:t("../../is-buffer/index.js")})},{"../../is-buffer/index.js":76,"./internal":53}],52:[function(t,e,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(t,e,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);i&&!("get"in i?!e.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}:function(t,e,r,n){void 0===n&&(n=r),t[n]=e[r]}),i=this&&this.__exportStar||function(t,e){for(var r in t)"default"===r||Object.prototype.hasOwnProperty.call(e,r)||n(e,t,r)};Object.defineProperty(r,"__esModule",{value:!0}),r.isHexString=r.getKeys=r.fromAscii=r.fromUtf8=r.toAscii=r.arrayContainsArray=r.getBinarySize=r.padToEven=r.stripHexPrefix=r.isHexPrefixed=void 0,i(t("./constants"),r),i(t("./account"),r),i(t("./address"),r),i(t("./hash"),r),i(t("./signature"),r),i(t("./bytes"),r),i(t("./object"),r),i(t("./externals"),r),i(t("./types"),r);var o=t("./internal");Object.defineProperty(r,"isHexPrefixed",{enumerable:!0,get:function(){return o.isHexPrefixed}}),Object.defineProperty(r,"stripHexPrefix",{enumerable:!0,get:function(){return o.stripHexPrefix}}),Object.defineProperty(r,"padToEven",{enumerable:!0,get:function(){return o.padToEven}}),Object.defineProperty(r,"getBinarySize",{enumerable:!0,get:function(){return o.getBinarySize}}),Object.defineProperty(r,"arrayContainsArray",{enumerable:!0,get:function(){return o.arrayContainsArray}}),Object.defineProperty(r,"toAscii",{enumerable:!0,get:function(){return o.toAscii}}),Object.defineProperty(r,"fromUtf8",{enumerable:!0,get:function(){return o.fromUtf8}}),Object.defineProperty(r,"fromAscii",{enumerable:!0,get:function(){return o.fromAscii}}),Object.defineProperty(r,"getKeys",{enumerable:!0,get:function(){return o.getKeys}}),Object.defineProperty(r,"isHexString",{enumerable:!0,get:function(){return o.isHexString}})},{"./account":45,"./address":46,"./bytes":47,"./constants":48,"./externals":49,"./hash":50,"./internal":53,"./object":54,"./signature":55,"./types":56}],53:[function(t,e,r){(function(t){"use strict";function e(t){if("string"!=typeof t)throw new Error("[isHexPrefixed] input must be type 'string', received type ".concat(typeof t));return"0"===t[0]&&"x"===t[1]}Object.defineProperty(r,"__esModule",{value:!0}),r.isHexString=r.getKeys=r.fromAscii=r.fromUtf8=r.toAscii=r.arrayContainsArray=r.getBinarySize=r.padToEven=r.stripHexPrefix=r.isHexPrefixed=void 0,r.isHexPrefixed=e;function n(t){var e=t;if("string"!=typeof e)throw new Error("[padToEven] value must be type 'string', received ".concat(typeof e));return e.length%2&&(e="0".concat(e)),e}r.stripHexPrefix=function(t){if("string"!=typeof t)throw new Error("[stripHexPrefix] input must be type 'string', received ".concat(typeof t));return e(t)?t.slice(2):t},r.padToEven=n,r.getBinarySize=function(e){if("string"!=typeof e)throw new Error("[getBinarySize] method requires input type 'string', received ".concat(typeof e));return t.byteLength(e,"utf8")},r.arrayContainsArray=function(t,e,r){if(!0!==Array.isArray(t))throw new Error("[arrayContainsArray] method requires input 'superset' to be an array, got type '".concat(typeof t,"'"));if(!0!==Array.isArray(e))throw new Error("[arrayContainsArray] method requires input 'subset' to be an array, got type '".concat(typeof e,"'"));return e[r?"some":"every"]((function(e){return t.indexOf(e)>=0}))},r.toAscii=function(t){var e="",r=0,n=t.length;for("0x"===t.substring(0,2)&&(r=2);r=o.length,"The field ".concat(r.name," must not have more ").concat(r.length," bytes"))):r.allowZero&&0===o.length||!r.length||(0,i.default)(r.length===o.length,"The field ".concat(r.name," must have byte length of ").concat(r.length)),t.raw[n]=o}t._fields.push(r.name),Object.defineProperty(t,r.name,{enumerable:!0,configurable:!0,get:o,set:a}),r.default&&(t[r.name]=r.default),r.alias&&Object.defineProperty(t,r.alias,{enumerable:!1,configurable:!0,set:a,get:o})})),n)if("string"==typeof n&&(n=e.from((0,o.stripHexPrefix)(n),"hex")),e.isBuffer(n)&&(n=a.rlp.decode(n)),Array.isArray(n)){if(n.length>t._fields.length)throw new Error("wrong number of fields in data");n.forEach((function(e,r){t[t._fields[r]]=(0,s.toBuffer)(e)}))}else{if("object"!=typeof n)throw new Error("invalid data");var f=Object.keys(n);r.forEach((function(e){-1!==f.indexOf(e.name)&&(t[e.name]=n[e.name]),-1!==f.indexOf(e.alias)&&(t[e.alias]=n[e.alias])}))}}}).call(this,t("buffer").Buffer)},{"./bytes":47,"./externals":49,"./internal":53,assert:1,buffer:9}],55:[function(t,e,r){(function(e){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.hashPersonalMessage=r.isValidSignature=r.fromRpcSig=r.toCompactSig=r.toRpcSig=r.ecrecover=r.ecsign=void 0;var n=t("ethereum-cryptography/secp256k1"),i=t("./externals"),o=t("./bytes"),a=t("./hash"),s=t("./helpers"),f=t("./types");function u(t,e){var r=(0,f.toType)(t,f.TypeOutput.BN);if(r.eqn(0)||r.eqn(1))return(0,f.toType)(t,f.TypeOutput.BN);if(!e)return r.subn(27);var n=(0,f.toType)(e,f.TypeOutput.BN);return r.sub(n.muln(2).addn(35))}function h(t){var e=new i.BN(t);return e.eqn(0)||e.eqn(1)}r.ecsign=function(t,r,i){var o=(0,n.ecdsaSign)(t,r),a=o.signature,s=o.recid,u=e.from(a.slice(0,32)),h=e.from(a.slice(32,64));if(!i||"number"==typeof i){if(i&&!Number.isSafeInteger(i))throw new Error("The provided number is greater than MAX_SAFE_INTEGER (please use an alternative input type)");return{r:u,s:h,v:i?s+(2*i+35):s+27}}return{r:u,s:h,v:(0,f.toType)(i,f.TypeOutput.BN).muln(2).addn(35).addn(s).toArrayLike(e)}};r.ecrecover=function(t,r,i,a,s){var f=e.concat([(0,o.setLengthLeft)(i,32),(0,o.setLengthLeft)(a,32)],64),c=u(r,s);if(!h(c))throw new Error("Invalid signature v value");var d=(0,n.ecdsaRecover)(f,c.toNumber(),t);return e.from((0,n.publicKeyConvert)(d,!1).slice(1))};r.toRpcSig=function(t,r,n,i){if(!h(u(t,i)))throw new Error("Invalid signature v value");return(0,o.bufferToHex)(e.concat([(0,o.setLengthLeft)(r,32),(0,o.setLengthLeft)(n,32),(0,o.toBuffer)(t)]))};r.toCompactSig=function(t,r,n,i){if(!h(u(t,i)))throw new Error("Invalid signature v value");var a=(0,f.toType)(t,f.TypeOutput.Number),s=n;return(a>28&&a%2==1||1===a||28===a)&&((s=e.from(n))[0]|=128),(0,o.bufferToHex)(e.concat([(0,o.setLengthLeft)(r,32),(0,o.setLengthLeft)(s,32)]))};r.fromRpcSig=function(t){var e,r,n,i=(0,o.toBuffer)(t);if(i.length>=65)e=i.slice(0,32),r=i.slice(32,64),n=(0,o.bufferToInt)(i.slice(64));else{if(64!==i.length)throw new Error("Invalid signature length");e=i.slice(0,32),r=i.slice(32,64),n=(0,o.bufferToInt)(i.slice(32,33))>>7,r[0]&=127}return n<27&&(n+=27),{v:n,r:e,s:r}};r.isValidSignature=function(t,e,r,n,o){void 0===n&&(n=!0);var a=new i.BN("7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0",16),s=new i.BN("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141",16);if(32!==e.length||32!==r.length)return!1;if(!h(u(t,o)))return!1;var f=new i.BN(e),c=new i.BN(r);return!(f.isZero()||f.gt(s)||c.isZero()||c.gt(s))&&(!n||1!==c.cmp(a))};r.hashPersonalMessage=function(t){(0,s.assertIsBuffer)(t);var r=e.from("Ethereum Signed Message:\n".concat(t.length),"utf-8");return(0,a.keccak)(e.concat([r,t]))}}).call(this,t("buffer").Buffer)},{"./bytes":47,"./externals":49,"./hash":50,"./helpers":51,"./types":56,buffer:9,"ethereum-cryptography/secp256k1":38}],56:[function(t,e,r){(function(e){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.toType=r.TypeOutput=r.bnToRlp=r.bnToUnpaddedBuffer=r.bnToHex=void 0;var n,i=t("./externals"),o=t("./internal"),a=t("./bytes");function s(t){return(0,a.unpadBuffer)(t.toArrayLike(e))}r.bnToHex=function(t){return"0x".concat(t.toString(16))},r.bnToUnpaddedBuffer=s,r.bnToRlp=function(t){return s(t)},function(t){t[t.Number=0]="Number",t[t.BN=1]="BN",t[t.Buffer=2]="Buffer",t[t.PrefixedHexString=3]="PrefixedHexString"}(n=r.TypeOutput||(r.TypeOutput={})),r.toType=function(t,e){if(null===t)return null;if(void 0!==t){if("string"==typeof t&&!(0,o.isHexString)(t))throw new Error("A string must be provided with a 0x-prefix, given: ".concat(t));if("number"==typeof t&&!Number.isSafeInteger(t))throw new Error("The provided number is greater than MAX_SAFE_INTEGER (please use an alternative input type)");var r=(0,a.toBuffer)(t);if(e===n.Buffer)return r;if(e===n.BN)return new i.BN(r);if(e===n.Number){var s=new i.BN(r),f=new i.BN(Number.MAX_SAFE_INTEGER.toString());if(s.gt(f))throw new Error("The provided number is greater than MAX_SAFE_INTEGER (please use an alternative output type)");return s.toNumber()}return"0x".concat(r.toString("hex"))}}}).call(this,t("buffer").Buffer)},{"./bytes":47,"./externals":49,"./internal":53,buffer:9}],57:[function(t,e,r){!function(e,r){"use strict";function n(t,e){if(!t)throw new Error(e||"Assertion failed")}function i(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function o(t,e,r){if(o.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 a;"object"==typeof e?e.exports=o:r.BN=o,o.BN=o,o.wordSize=26;try{a="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:t("buffer").Buffer}catch(t){}function s(t,e){var r=t.charCodeAt(e);return r>=48&&r<=57?r-48:r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:void n(!1,"Invalid character in "+t)}function f(t,e,r){var n=s(t,r);return r-1>=e&&(n|=s(t,r-1)<<4),n}function u(t,e,r,i){for(var o=0,a=0,s=Math.min(t.length,r),f=e;f=49?u-49+10:u>=17?u-17+10:u,n(u>=0&&a0?t:e},o.min=function(t,e){return t.cmp(e)<0?t:e},o.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),n(e===(0|e)&&e>=2&&e<=36);var i=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i=0;i-=3)a=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[o]|=a<>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);else if("le"===r)for(i=0,o=0;i>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);return this._strip()},o.prototype._parseHex=function(t,e,r){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var n=0;n=e;n-=2)i=f(t,e,n)<=18?(o-=18,a+=1,this.words[a]|=i>>>26):o+=8;else for(n=(t.length-e)%2==0?e+1:e;n=18?(o-=18,a+=1,this.words[a]|=i>>>26):o+=8;this._strip()},o.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var n=0,i=1;i<=67108863;i*=e)n++;n--,i=i/e|0;for(var o=t.length-r,a=o%n,s=Math.min(o,o-a)+r,f=0,h=r;h1&&0===this.words[this.length-1];)this.length--;return this._normSign()},o.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for)try{o.prototype[Symbol.for("nodejs.util.inspect.custom")]=c}catch(t){o.prototype.inspect=c}else o.prototype.inspect=c;function c(){return(this.red?""}var d=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],l=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],p=[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];o.prototype.toString=function(t,e){var r;if(e=0|e||1,16===(t=t||10)||"hex"===t){r="";for(var i=0,o=0,a=0;a>>24-i&16777215,(i+=2)>=26&&(i-=26,a--),r=0!==o||a!==this.length-1?d[6-f.length]+f+r:f+r}for(0!==o&&(r=o.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 u=l[t],h=p[t];r="";var c=this.clone();for(c.negative=0;!c.isZero();){var b=c.modrn(h).toString(t);r=(c=c.idivn(h)).isZero()?b+r:d[u-b.length]+b+r}for(this.isZero()&&(r="0"+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}n(!1,"Base should be between 2 and 36")},o.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&&n(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},o.prototype.toJSON=function(){return this.toString(16,2)},a&&(o.prototype.toBuffer=function(t,e){return this.toArrayLike(a,t,e)}),o.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)};function b(t,e,r){r.negative=e.negative^t.negative;var n=t.length+e.length|0;r.length=n,n=n-1|0;var i=0|t.words[0],o=0|e.words[0],a=i*o,s=67108863&a,f=a/67108864|0;r.words[0]=s;for(var u=1;u>>26,c=67108863&f,d=Math.min(u,e.length-1),l=Math.max(0,u-t.length+1);l<=d;l++){var p=u-l|0;h+=(a=(i=0|t.words[p])*(o=0|e.words[l])+c)/67108864|0,c=67108863&a}r.words[u]=0|c,f=0|h}return 0!==f?r.words[u]=0|f:r.length--,r._strip()}o.prototype.toArrayLike=function(t,e,r){this._strip();var i=this.byteLength(),o=r||Math.max(1,i);n(i<=o,"byte array longer than desired length"),n(o>0,"Requested array length <= 0");var a=function(t,e){return t.allocUnsafe?t.allocUnsafe(e):new t(e)}(t,o);return this["_toArrayLike"+("le"===e?"LE":"BE")](a,i),a},o.prototype._toArrayLikeLE=function(t,e){for(var r=0,n=0,i=0,o=0;i>8&255),r>16&255),6===o?(r>24&255),n=0,o=0):(n=a>>>24,o+=2)}if(r=0&&(t[r--]=a>>8&255),r>=0&&(t[r--]=a>>16&255),6===o?(r>=0&&(t[r--]=a>>24&255),n=0,o=0):(n=a>>>24,o+=2)}if(r>=0)for(t[r--]=n;r>=0;)t[r--]=0},Math.clz32?o.prototype._countBits=function(t){return 32-Math.clz32(t)}:o.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},o.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},o.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;et.length?this.clone().ior(t):t.clone().ior(this)},o.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},o.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;rt.length?this.clone().iand(t):t.clone().iand(this)},o.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},o.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var n=0;nt.length?this.clone().ixor(t):t.clone().ixor(this)},o.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},o.prototype.inotn=function(t){n("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),r=t%26;this._expand(e),r>0&&e--;for(var i=0;i0&&(this.words[i]=~this.words[i]&67108863>>26-r),this._strip()},o.prototype.notn=function(t){return this.clone().inotn(t)},o.prototype.setn=function(t,e){n("number"==typeof t&&t>=0);var r=t/26|0,i=t%26;return this._expand(r+1),this.words[r]=e?this.words[r]|1<t.length?(r=this,n=t):(r=t,n=this);for(var i=0,o=0;o>>26;for(;0!==i&&o>>26;if(this.length=r.length,0!==i)this.words[this.length]=i,this.length++;else if(r!==this)for(;ot.length?this.clone().iadd(t):t.clone().iadd(this)},o.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,n,i=this.cmp(t);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(r=this,n=t):(r=t,n=this);for(var o=0,a=0;a>26,this.words[a]=67108863&e;for(;0!==o&&a>26,this.words[a]=67108863&e;if(0===o&&a>>13,l=0|a[1],p=8191&l,b=l>>>13,m=0|a[2],y=8191&m,g=m>>>13,v=0|a[3],w=8191&v,_=v>>>13,M=0|a[4],S=8191&M,x=M>>>13,A=0|a[5],E=8191&A,k=A>>>13,R=0|a[6],T=8191&R,B=R>>>13,I=0|a[7],L=8191&I,P=I>>>13,j=0|a[8],O=8191&j,C=j>>>13,N=0|a[9],z=8191&N,U=N>>>13,q=0|s[0],K=8191&q,D=q>>>13,H=0|s[1],F=8191&H,W=H>>>13,Z=0|s[2],V=8191&Z,Y=Z>>>13,J=0|s[3],X=8191&J,G=J>>>13,$=0|s[4],Q=8191&$,tt=$>>>13,et=0|s[5],rt=8191&et,nt=et>>>13,it=0|s[6],ot=8191&it,at=it>>>13,st=0|s[7],ft=8191&st,ut=st>>>13,ht=0|s[8],ct=8191&ht,dt=ht>>>13,lt=0|s[9],pt=8191<,bt=lt>>>13;r.negative=t.negative^e.negative,r.length=19;var mt=(u+(n=Math.imul(c,K))|0)+((8191&(i=(i=Math.imul(c,D))+Math.imul(d,K)|0))<<13)|0;u=((o=Math.imul(d,D))+(i>>>13)|0)+(mt>>>26)|0,mt&=67108863,n=Math.imul(p,K),i=(i=Math.imul(p,D))+Math.imul(b,K)|0,o=Math.imul(b,D);var yt=(u+(n=n+Math.imul(c,F)|0)|0)+((8191&(i=(i=i+Math.imul(c,W)|0)+Math.imul(d,F)|0))<<13)|0;u=((o=o+Math.imul(d,W)|0)+(i>>>13)|0)+(yt>>>26)|0,yt&=67108863,n=Math.imul(y,K),i=(i=Math.imul(y,D))+Math.imul(g,K)|0,o=Math.imul(g,D),n=n+Math.imul(p,F)|0,i=(i=i+Math.imul(p,W)|0)+Math.imul(b,F)|0,o=o+Math.imul(b,W)|0;var gt=(u+(n=n+Math.imul(c,V)|0)|0)+((8191&(i=(i=i+Math.imul(c,Y)|0)+Math.imul(d,V)|0))<<13)|0;u=((o=o+Math.imul(d,Y)|0)+(i>>>13)|0)+(gt>>>26)|0,gt&=67108863,n=Math.imul(w,K),i=(i=Math.imul(w,D))+Math.imul(_,K)|0,o=Math.imul(_,D),n=n+Math.imul(y,F)|0,i=(i=i+Math.imul(y,W)|0)+Math.imul(g,F)|0,o=o+Math.imul(g,W)|0,n=n+Math.imul(p,V)|0,i=(i=i+Math.imul(p,Y)|0)+Math.imul(b,V)|0,o=o+Math.imul(b,Y)|0;var vt=(u+(n=n+Math.imul(c,X)|0)|0)+((8191&(i=(i=i+Math.imul(c,G)|0)+Math.imul(d,X)|0))<<13)|0;u=((o=o+Math.imul(d,G)|0)+(i>>>13)|0)+(vt>>>26)|0,vt&=67108863,n=Math.imul(S,K),i=(i=Math.imul(S,D))+Math.imul(x,K)|0,o=Math.imul(x,D),n=n+Math.imul(w,F)|0,i=(i=i+Math.imul(w,W)|0)+Math.imul(_,F)|0,o=o+Math.imul(_,W)|0,n=n+Math.imul(y,V)|0,i=(i=i+Math.imul(y,Y)|0)+Math.imul(g,V)|0,o=o+Math.imul(g,Y)|0,n=n+Math.imul(p,X)|0,i=(i=i+Math.imul(p,G)|0)+Math.imul(b,X)|0,o=o+Math.imul(b,G)|0;var wt=(u+(n=n+Math.imul(c,Q)|0)|0)+((8191&(i=(i=i+Math.imul(c,tt)|0)+Math.imul(d,Q)|0))<<13)|0;u=((o=o+Math.imul(d,tt)|0)+(i>>>13)|0)+(wt>>>26)|0,wt&=67108863,n=Math.imul(E,K),i=(i=Math.imul(E,D))+Math.imul(k,K)|0,o=Math.imul(k,D),n=n+Math.imul(S,F)|0,i=(i=i+Math.imul(S,W)|0)+Math.imul(x,F)|0,o=o+Math.imul(x,W)|0,n=n+Math.imul(w,V)|0,i=(i=i+Math.imul(w,Y)|0)+Math.imul(_,V)|0,o=o+Math.imul(_,Y)|0,n=n+Math.imul(y,X)|0,i=(i=i+Math.imul(y,G)|0)+Math.imul(g,X)|0,o=o+Math.imul(g,G)|0,n=n+Math.imul(p,Q)|0,i=(i=i+Math.imul(p,tt)|0)+Math.imul(b,Q)|0,o=o+Math.imul(b,tt)|0;var _t=(u+(n=n+Math.imul(c,rt)|0)|0)+((8191&(i=(i=i+Math.imul(c,nt)|0)+Math.imul(d,rt)|0))<<13)|0;u=((o=o+Math.imul(d,nt)|0)+(i>>>13)|0)+(_t>>>26)|0,_t&=67108863,n=Math.imul(T,K),i=(i=Math.imul(T,D))+Math.imul(B,K)|0,o=Math.imul(B,D),n=n+Math.imul(E,F)|0,i=(i=i+Math.imul(E,W)|0)+Math.imul(k,F)|0,o=o+Math.imul(k,W)|0,n=n+Math.imul(S,V)|0,i=(i=i+Math.imul(S,Y)|0)+Math.imul(x,V)|0,o=o+Math.imul(x,Y)|0,n=n+Math.imul(w,X)|0,i=(i=i+Math.imul(w,G)|0)+Math.imul(_,X)|0,o=o+Math.imul(_,G)|0,n=n+Math.imul(y,Q)|0,i=(i=i+Math.imul(y,tt)|0)+Math.imul(g,Q)|0,o=o+Math.imul(g,tt)|0,n=n+Math.imul(p,rt)|0,i=(i=i+Math.imul(p,nt)|0)+Math.imul(b,rt)|0,o=o+Math.imul(b,nt)|0;var Mt=(u+(n=n+Math.imul(c,ot)|0)|0)+((8191&(i=(i=i+Math.imul(c,at)|0)+Math.imul(d,ot)|0))<<13)|0;u=((o=o+Math.imul(d,at)|0)+(i>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,n=Math.imul(L,K),i=(i=Math.imul(L,D))+Math.imul(P,K)|0,o=Math.imul(P,D),n=n+Math.imul(T,F)|0,i=(i=i+Math.imul(T,W)|0)+Math.imul(B,F)|0,o=o+Math.imul(B,W)|0,n=n+Math.imul(E,V)|0,i=(i=i+Math.imul(E,Y)|0)+Math.imul(k,V)|0,o=o+Math.imul(k,Y)|0,n=n+Math.imul(S,X)|0,i=(i=i+Math.imul(S,G)|0)+Math.imul(x,X)|0,o=o+Math.imul(x,G)|0,n=n+Math.imul(w,Q)|0,i=(i=i+Math.imul(w,tt)|0)+Math.imul(_,Q)|0,o=o+Math.imul(_,tt)|0,n=n+Math.imul(y,rt)|0,i=(i=i+Math.imul(y,nt)|0)+Math.imul(g,rt)|0,o=o+Math.imul(g,nt)|0,n=n+Math.imul(p,ot)|0,i=(i=i+Math.imul(p,at)|0)+Math.imul(b,ot)|0,o=o+Math.imul(b,at)|0;var St=(u+(n=n+Math.imul(c,ft)|0)|0)+((8191&(i=(i=i+Math.imul(c,ut)|0)+Math.imul(d,ft)|0))<<13)|0;u=((o=o+Math.imul(d,ut)|0)+(i>>>13)|0)+(St>>>26)|0,St&=67108863,n=Math.imul(O,K),i=(i=Math.imul(O,D))+Math.imul(C,K)|0,o=Math.imul(C,D),n=n+Math.imul(L,F)|0,i=(i=i+Math.imul(L,W)|0)+Math.imul(P,F)|0,o=o+Math.imul(P,W)|0,n=n+Math.imul(T,V)|0,i=(i=i+Math.imul(T,Y)|0)+Math.imul(B,V)|0,o=o+Math.imul(B,Y)|0,n=n+Math.imul(E,X)|0,i=(i=i+Math.imul(E,G)|0)+Math.imul(k,X)|0,o=o+Math.imul(k,G)|0,n=n+Math.imul(S,Q)|0,i=(i=i+Math.imul(S,tt)|0)+Math.imul(x,Q)|0,o=o+Math.imul(x,tt)|0,n=n+Math.imul(w,rt)|0,i=(i=i+Math.imul(w,nt)|0)+Math.imul(_,rt)|0,o=o+Math.imul(_,nt)|0,n=n+Math.imul(y,ot)|0,i=(i=i+Math.imul(y,at)|0)+Math.imul(g,ot)|0,o=o+Math.imul(g,at)|0,n=n+Math.imul(p,ft)|0,i=(i=i+Math.imul(p,ut)|0)+Math.imul(b,ft)|0,o=o+Math.imul(b,ut)|0;var xt=(u+(n=n+Math.imul(c,ct)|0)|0)+((8191&(i=(i=i+Math.imul(c,dt)|0)+Math.imul(d,ct)|0))<<13)|0;u=((o=o+Math.imul(d,dt)|0)+(i>>>13)|0)+(xt>>>26)|0,xt&=67108863,n=Math.imul(z,K),i=(i=Math.imul(z,D))+Math.imul(U,K)|0,o=Math.imul(U,D),n=n+Math.imul(O,F)|0,i=(i=i+Math.imul(O,W)|0)+Math.imul(C,F)|0,o=o+Math.imul(C,W)|0,n=n+Math.imul(L,V)|0,i=(i=i+Math.imul(L,Y)|0)+Math.imul(P,V)|0,o=o+Math.imul(P,Y)|0,n=n+Math.imul(T,X)|0,i=(i=i+Math.imul(T,G)|0)+Math.imul(B,X)|0,o=o+Math.imul(B,G)|0,n=n+Math.imul(E,Q)|0,i=(i=i+Math.imul(E,tt)|0)+Math.imul(k,Q)|0,o=o+Math.imul(k,tt)|0,n=n+Math.imul(S,rt)|0,i=(i=i+Math.imul(S,nt)|0)+Math.imul(x,rt)|0,o=o+Math.imul(x,nt)|0,n=n+Math.imul(w,ot)|0,i=(i=i+Math.imul(w,at)|0)+Math.imul(_,ot)|0,o=o+Math.imul(_,at)|0,n=n+Math.imul(y,ft)|0,i=(i=i+Math.imul(y,ut)|0)+Math.imul(g,ft)|0,o=o+Math.imul(g,ut)|0,n=n+Math.imul(p,ct)|0,i=(i=i+Math.imul(p,dt)|0)+Math.imul(b,ct)|0,o=o+Math.imul(b,dt)|0;var At=(u+(n=n+Math.imul(c,pt)|0)|0)+((8191&(i=(i=i+Math.imul(c,bt)|0)+Math.imul(d,pt)|0))<<13)|0;u=((o=o+Math.imul(d,bt)|0)+(i>>>13)|0)+(At>>>26)|0,At&=67108863,n=Math.imul(z,F),i=(i=Math.imul(z,W))+Math.imul(U,F)|0,o=Math.imul(U,W),n=n+Math.imul(O,V)|0,i=(i=i+Math.imul(O,Y)|0)+Math.imul(C,V)|0,o=o+Math.imul(C,Y)|0,n=n+Math.imul(L,X)|0,i=(i=i+Math.imul(L,G)|0)+Math.imul(P,X)|0,o=o+Math.imul(P,G)|0,n=n+Math.imul(T,Q)|0,i=(i=i+Math.imul(T,tt)|0)+Math.imul(B,Q)|0,o=o+Math.imul(B,tt)|0,n=n+Math.imul(E,rt)|0,i=(i=i+Math.imul(E,nt)|0)+Math.imul(k,rt)|0,o=o+Math.imul(k,nt)|0,n=n+Math.imul(S,ot)|0,i=(i=i+Math.imul(S,at)|0)+Math.imul(x,ot)|0,o=o+Math.imul(x,at)|0,n=n+Math.imul(w,ft)|0,i=(i=i+Math.imul(w,ut)|0)+Math.imul(_,ft)|0,o=o+Math.imul(_,ut)|0,n=n+Math.imul(y,ct)|0,i=(i=i+Math.imul(y,dt)|0)+Math.imul(g,ct)|0,o=o+Math.imul(g,dt)|0;var Et=(u+(n=n+Math.imul(p,pt)|0)|0)+((8191&(i=(i=i+Math.imul(p,bt)|0)+Math.imul(b,pt)|0))<<13)|0;u=((o=o+Math.imul(b,bt)|0)+(i>>>13)|0)+(Et>>>26)|0,Et&=67108863,n=Math.imul(z,V),i=(i=Math.imul(z,Y))+Math.imul(U,V)|0,o=Math.imul(U,Y),n=n+Math.imul(O,X)|0,i=(i=i+Math.imul(O,G)|0)+Math.imul(C,X)|0,o=o+Math.imul(C,G)|0,n=n+Math.imul(L,Q)|0,i=(i=i+Math.imul(L,tt)|0)+Math.imul(P,Q)|0,o=o+Math.imul(P,tt)|0,n=n+Math.imul(T,rt)|0,i=(i=i+Math.imul(T,nt)|0)+Math.imul(B,rt)|0,o=o+Math.imul(B,nt)|0,n=n+Math.imul(E,ot)|0,i=(i=i+Math.imul(E,at)|0)+Math.imul(k,ot)|0,o=o+Math.imul(k,at)|0,n=n+Math.imul(S,ft)|0,i=(i=i+Math.imul(S,ut)|0)+Math.imul(x,ft)|0,o=o+Math.imul(x,ut)|0,n=n+Math.imul(w,ct)|0,i=(i=i+Math.imul(w,dt)|0)+Math.imul(_,ct)|0,o=o+Math.imul(_,dt)|0;var kt=(u+(n=n+Math.imul(y,pt)|0)|0)+((8191&(i=(i=i+Math.imul(y,bt)|0)+Math.imul(g,pt)|0))<<13)|0;u=((o=o+Math.imul(g,bt)|0)+(i>>>13)|0)+(kt>>>26)|0,kt&=67108863,n=Math.imul(z,X),i=(i=Math.imul(z,G))+Math.imul(U,X)|0,o=Math.imul(U,G),n=n+Math.imul(O,Q)|0,i=(i=i+Math.imul(O,tt)|0)+Math.imul(C,Q)|0,o=o+Math.imul(C,tt)|0,n=n+Math.imul(L,rt)|0,i=(i=i+Math.imul(L,nt)|0)+Math.imul(P,rt)|0,o=o+Math.imul(P,nt)|0,n=n+Math.imul(T,ot)|0,i=(i=i+Math.imul(T,at)|0)+Math.imul(B,ot)|0,o=o+Math.imul(B,at)|0,n=n+Math.imul(E,ft)|0,i=(i=i+Math.imul(E,ut)|0)+Math.imul(k,ft)|0,o=o+Math.imul(k,ut)|0,n=n+Math.imul(S,ct)|0,i=(i=i+Math.imul(S,dt)|0)+Math.imul(x,ct)|0,o=o+Math.imul(x,dt)|0;var Rt=(u+(n=n+Math.imul(w,pt)|0)|0)+((8191&(i=(i=i+Math.imul(w,bt)|0)+Math.imul(_,pt)|0))<<13)|0;u=((o=o+Math.imul(_,bt)|0)+(i>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,n=Math.imul(z,Q),i=(i=Math.imul(z,tt))+Math.imul(U,Q)|0,o=Math.imul(U,tt),n=n+Math.imul(O,rt)|0,i=(i=i+Math.imul(O,nt)|0)+Math.imul(C,rt)|0,o=o+Math.imul(C,nt)|0,n=n+Math.imul(L,ot)|0,i=(i=i+Math.imul(L,at)|0)+Math.imul(P,ot)|0,o=o+Math.imul(P,at)|0,n=n+Math.imul(T,ft)|0,i=(i=i+Math.imul(T,ut)|0)+Math.imul(B,ft)|0,o=o+Math.imul(B,ut)|0,n=n+Math.imul(E,ct)|0,i=(i=i+Math.imul(E,dt)|0)+Math.imul(k,ct)|0,o=o+Math.imul(k,dt)|0;var Tt=(u+(n=n+Math.imul(S,pt)|0)|0)+((8191&(i=(i=i+Math.imul(S,bt)|0)+Math.imul(x,pt)|0))<<13)|0;u=((o=o+Math.imul(x,bt)|0)+(i>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,n=Math.imul(z,rt),i=(i=Math.imul(z,nt))+Math.imul(U,rt)|0,o=Math.imul(U,nt),n=n+Math.imul(O,ot)|0,i=(i=i+Math.imul(O,at)|0)+Math.imul(C,ot)|0,o=o+Math.imul(C,at)|0,n=n+Math.imul(L,ft)|0,i=(i=i+Math.imul(L,ut)|0)+Math.imul(P,ft)|0,o=o+Math.imul(P,ut)|0,n=n+Math.imul(T,ct)|0,i=(i=i+Math.imul(T,dt)|0)+Math.imul(B,ct)|0,o=o+Math.imul(B,dt)|0;var Bt=(u+(n=n+Math.imul(E,pt)|0)|0)+((8191&(i=(i=i+Math.imul(E,bt)|0)+Math.imul(k,pt)|0))<<13)|0;u=((o=o+Math.imul(k,bt)|0)+(i>>>13)|0)+(Bt>>>26)|0,Bt&=67108863,n=Math.imul(z,ot),i=(i=Math.imul(z,at))+Math.imul(U,ot)|0,o=Math.imul(U,at),n=n+Math.imul(O,ft)|0,i=(i=i+Math.imul(O,ut)|0)+Math.imul(C,ft)|0,o=o+Math.imul(C,ut)|0,n=n+Math.imul(L,ct)|0,i=(i=i+Math.imul(L,dt)|0)+Math.imul(P,ct)|0,o=o+Math.imul(P,dt)|0;var It=(u+(n=n+Math.imul(T,pt)|0)|0)+((8191&(i=(i=i+Math.imul(T,bt)|0)+Math.imul(B,pt)|0))<<13)|0;u=((o=o+Math.imul(B,bt)|0)+(i>>>13)|0)+(It>>>26)|0,It&=67108863,n=Math.imul(z,ft),i=(i=Math.imul(z,ut))+Math.imul(U,ft)|0,o=Math.imul(U,ut),n=n+Math.imul(O,ct)|0,i=(i=i+Math.imul(O,dt)|0)+Math.imul(C,ct)|0,o=o+Math.imul(C,dt)|0;var Lt=(u+(n=n+Math.imul(L,pt)|0)|0)+((8191&(i=(i=i+Math.imul(L,bt)|0)+Math.imul(P,pt)|0))<<13)|0;u=((o=o+Math.imul(P,bt)|0)+(i>>>13)|0)+(Lt>>>26)|0,Lt&=67108863,n=Math.imul(z,ct),i=(i=Math.imul(z,dt))+Math.imul(U,ct)|0,o=Math.imul(U,dt);var Pt=(u+(n=n+Math.imul(O,pt)|0)|0)+((8191&(i=(i=i+Math.imul(O,bt)|0)+Math.imul(C,pt)|0))<<13)|0;u=((o=o+Math.imul(C,bt)|0)+(i>>>13)|0)+(Pt>>>26)|0,Pt&=67108863;var jt=(u+(n=Math.imul(z,pt))|0)+((8191&(i=(i=Math.imul(z,bt))+Math.imul(U,pt)|0))<<13)|0;return u=((o=Math.imul(U,bt))+(i>>>13)|0)+(jt>>>26)|0,jt&=67108863,f[0]=mt,f[1]=yt,f[2]=gt,f[3]=vt,f[4]=wt,f[5]=_t,f[6]=Mt,f[7]=St,f[8]=xt,f[9]=At,f[10]=Et,f[11]=kt,f[12]=Rt,f[13]=Tt,f[14]=Bt,f[15]=It,f[16]=Lt,f[17]=Pt,f[18]=jt,0!==u&&(f[19]=u,r.length++),r};function y(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var n=0,i=0,o=0;o>>26)|0)>>>26,a&=67108863}r.words[o]=s,n=a,a=i}return 0!==n?r.words[o]=n:r.length--,r._strip()}function g(t,e,r){return y(t,e,r)}function v(t,e){this.x=t,this.y=e}Math.imul||(m=b),o.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?m(this,t,e):r<63?b(this,t,e):r<1024?y(this,t,e):g(this,t,e)},v.prototype.makeRBT=function(t){for(var e=new Array(t),r=o.prototype._countBits(t)-1,n=0;n>=1;return n},v.prototype.permute=function(t,e,r,n,i,o){for(var a=0;a>>=1)i++;return 1<>>=13,r[2*a+1]=8191&o,o>>>=13;for(a=2*e;a>=26,r+=o/67108864|0,r+=a>>>26,this.words[i]=67108863&a}return 0!==r&&(this.words[i]=r,this.length++),e?this.ineg():this},o.prototype.muln=function(t){return this.clone().imuln(t)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r>>i&1}return e}(t);if(0===e.length)return new o(1);for(var r=this,n=0;n=0);var e,r=t%26,i=(t-r)/26,o=67108863>>>26-r<<26-r;if(0!==r){var a=0;for(e=0;e>>26-r}a&&(this.words[e]=a,this.length++)}if(0!==i){for(e=this.length-1;e>=0;e--)this.words[e+i]=this.words[e];for(e=0;e=0),i=e?(e-e%26)/26:0;var o=t%26,a=Math.min((t-o)/26,this.length),s=67108863^67108863>>>o<a)for(this.length-=a,u=0;u=0&&(0!==h||u>=i);u--){var c=0|this.words[u];this.words[u]=h<<26-o|c>>>o,h=c&s}return f&&0!==h&&(f.words[f.length++]=h),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},o.prototype.ishrn=function(t,e,r){return n(0===this.negative),this.iushrn(t,e,r)},o.prototype.shln=function(t){return this.clone().ishln(t)},o.prototype.ushln=function(t){return this.clone().iushln(t)},o.prototype.shrn=function(t){return this.clone().ishrn(t)},o.prototype.ushrn=function(t){return this.clone().iushrn(t)},o.prototype.testn=function(t){n("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26,i=1<=0);var e=t%26,r=(t-e)/26;if(n(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 i=67108863^67108863>>>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},o.prototype.isubn=function(t){if(n("number"==typeof t),n(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>26)-(f/67108864|0),this.words[i+r]=67108863&o}for(;i>26,this.words[i+r]=67108863&o;if(0===s)return this._strip();for(n(-1===s),s=0,i=0;i>26,this.words[i]=67108863&o;return this.negative=1,this._strip()},o.prototype._wordDiv=function(t,e){var r=(this.length,t.length),n=this.clone(),i=t,a=0|i.words[i.length-1];0!==(r=26-this._countBits(a))&&(i=i.ushln(r),n.iushln(r),a=0|i.words[i.length-1]);var s,f=n.length-i.length;if("mod"!==e){(s=new o(null)).length=f+1,s.words=new Array(s.length);for(var u=0;u=0;c--){var d=67108864*(0|n.words[i.length+c])+(0|n.words[i.length+c-1]);for(d=Math.min(d/a|0,67108863),n._ishlnsubmul(i,d,c);0!==n.negative;)d--,n.negative=0,n._ishlnsubmul(i,1,c),n.isZero()||(n.negative^=1);s&&(s.words[c]=d)}return s&&s._strip(),n._strip(),"div"!==e&&0!==r&&n.iushrn(r),{div:s||null,mod:n}},o.prototype.divmod=function(t,e,r){return n(!t.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===t.negative?(s=this.neg().divmod(t,e),"mod"!==e&&(i=s.div.neg()),"div"!==e&&(a=s.mod.neg(),r&&0!==a.negative&&a.iadd(t)),{div:i,mod:a}):0===this.negative&&0!==t.negative?(s=this.divmod(t.neg(),e),"mod"!==e&&(i=s.div.neg()),{div:i,mod:s.mod}):0!=(this.negative&t.negative)?(s=this.neg().divmod(t.neg(),e),"div"!==e&&(a=s.mod.neg(),r&&0!==a.negative&&a.isub(t)),{div:s.div,mod:a}):t.length>this.length||this.cmp(t)<0?{div:new o(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new o(this.modrn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new o(this.modrn(t.words[0]))}:this._wordDiv(t,e);var i,a,s},o.prototype.div=function(t){return this.divmod(t,"div",!1).div},o.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},o.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},o.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,n=t.ushrn(1),i=t.andln(1),o=r.cmp(n);return o<0||1===i&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},o.prototype.modrn=function(t){var e=t<0;e&&(t=-t),n(t<=67108863);for(var r=(1<<26)%t,i=0,o=this.length-1;o>=0;o--)i=(r*i+(0|this.words[o]))%t;return e?-i:i},o.prototype.modn=function(t){return this.modrn(t)},o.prototype.idivn=function(t){var e=t<0;e&&(t=-t),n(t<=67108863);for(var r=0,i=this.length-1;i>=0;i--){var o=(0|this.words[i])+67108864*r;this.words[i]=o/t|0,r=o%t}return this._strip(),e?this.ineg():this},o.prototype.divn=function(t){return this.clone().idivn(t)},o.prototype.egcd=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i=new o(1),a=new o(0),s=new o(0),f=new o(1),u=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++u;for(var h=r.clone(),c=e.clone();!e.isZero();){for(var d=0,l=1;0==(e.words[0]&l)&&d<26;++d,l<<=1);if(d>0)for(e.iushrn(d);d-- >0;)(i.isOdd()||a.isOdd())&&(i.iadd(h),a.isub(c)),i.iushrn(1),a.iushrn(1);for(var p=0,b=1;0==(r.words[0]&b)&&p<26;++p,b<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(s.isOdd()||f.isOdd())&&(s.iadd(h),f.isub(c)),s.iushrn(1),f.iushrn(1);e.cmp(r)>=0?(e.isub(r),i.isub(s),a.isub(f)):(r.isub(e),s.isub(i),f.isub(a))}return{a:s,b:f,gcd:r.iushln(u)}},o.prototype._invmp=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i,a=new o(1),s=new o(0),f=r.clone();e.cmpn(1)>0&&r.cmpn(1)>0;){for(var u=0,h=1;0==(e.words[0]&h)&&u<26;++u,h<<=1);if(u>0)for(e.iushrn(u);u-- >0;)a.isOdd()&&a.iadd(f),a.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;)s.isOdd()&&s.iadd(f),s.iushrn(1);e.cmp(r)>=0?(e.isub(r),a.isub(s)):(r.isub(e),s.isub(a))}return(i=0===e.cmpn(1)?a:s).cmpn(0)<0&&i.iadd(t),i},o.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var n=0;e.isEven()&&r.isEven();n++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var i=e.cmp(r);if(i<0){var o=e;e=r,r=o}else if(0===i||0===r.cmpn(1))break;e.isub(r)}return r.iushln(n)},o.prototype.invm=function(t){return this.egcd(t).a.umod(t)},o.prototype.isEven=function(){return 0==(1&this.words[0])},o.prototype.isOdd=function(){return 1==(1&this.words[0])},o.prototype.andln=function(t){return this.words[0]&t},o.prototype.bincn=function(t){n("number"==typeof t);var e=t%26,r=(t-e)/26,i=1<>>26,s&=67108863,this.words[a]=s}return 0!==o&&(this.words[a]=o,this.length++),this},o.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},o.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),n(t<=67108863,"Number is too big");var i=0|this.words[0];e=i===t?0:it.length)return 1;if(this.length=0;r--){var n=0|this.words[r],i=0|t.words[r];if(n!==i){ni&&(e=1);break}}return e},o.prototype.gtn=function(t){return 1===this.cmpn(t)},o.prototype.gt=function(t){return 1===this.cmp(t)},o.prototype.gten=function(t){return this.cmpn(t)>=0},o.prototype.gte=function(t){return this.cmp(t)>=0},o.prototype.ltn=function(t){return-1===this.cmpn(t)},o.prototype.lt=function(t){return-1===this.cmp(t)},o.prototype.lten=function(t){return this.cmpn(t)<=0},o.prototype.lte=function(t){return this.cmp(t)<=0},o.prototype.eqn=function(t){return 0===this.cmpn(t)},o.prototype.eq=function(t){return 0===this.cmp(t)},o.red=function(t){return new E(t)},o.prototype.toRed=function(t){return n(!this.red,"Already a number in reduction context"),n(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},o.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(t){return this.red=t,this},o.prototype.forceRed=function(t){return n(!this.red,"Already a number in reduction context"),this._forceRed(t)},o.prototype.redAdd=function(t){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},o.prototype.redIAdd=function(t){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},o.prototype.redSub=function(t){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},o.prototype.redISub=function(t){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},o.prototype.redShl=function(t){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},o.prototype.redMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},o.prototype.redIMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},o.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(t){return n(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var w={k256:null,p224:null,p192:null,p25519:null};function _(t,e){this.name=t,this.p=new o(e,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function M(){_.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function S(){_.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function x(){_.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function A(){_.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function E(t){if("string"==typeof t){var e=o._prime(t);this.m=e.p,this.prime=e}else n(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function k(t){E.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new o(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)}_.prototype._tmp=function(){var t=new o(null);return t.words=new Array(Math.ceil(this.n/13)),t},_.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(e>this.n);var n=e0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},_.prototype.split=function(t,e){t.iushrn(this.n,0,e)},_.prototype.imulK=function(t){return t.imul(this.k)},i(M,_),M.prototype.split=function(t,e){for(var r=4194303,n=Math.min(t.length,9),i=0;i>>22,o=a}o>>>=22,t.words[i-10]=o,0===o&&t.length>10?t.length-=10:t.length-=9},M.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>>=26,t.words[r]=i,e=n}return 0!==e&&(t.words[t.length++]=e),t},o._prime=function(t){if(w[t])return w[t];var e;if("k256"===t)e=new M;else if("p224"===t)e=new S;else if("p192"===t)e=new x;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new A}return w[t]=e,e},E.prototype._verify1=function(t){n(0===t.negative,"red works only with positives"),n(t.red,"red works only with red numbers")},E.prototype._verify2=function(t,e){n(0==(t.negative|e.negative),"red works only with positives"),n(t.red&&t.red===e.red,"red works only with red numbers")},E.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):(h(t,t.umod(this.m)._forceRed(this)),t)},E.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},E.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},E.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},E.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},E.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},E.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},E.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},E.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},E.prototype.isqr=function(t){return this.imul(t,t.clone())},E.prototype.sqr=function(t){return this.mul(t,t)},E.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(n(e%2==1),3===e){var r=this.m.add(new o(1)).iushrn(2);return this.pow(t,r)}for(var i=this.m.subn(1),a=0;!i.isZero()&&0===i.andln(1);)a++,i.iushrn(1);n(!i.isZero());var s=new o(1).toRed(this),f=s.redNeg(),u=this.m.subn(1).iushrn(1),h=this.m.bitLength();for(h=new o(2*h*h).toRed(this);0!==this.pow(h,u).cmp(f);)h.redIAdd(f);for(var c=this.pow(h,i),d=this.pow(t,i.addn(1).iushrn(1)),l=this.pow(t,i),p=a;0!==l.cmp(s);){for(var b=l,m=0;0!==b.cmp(s);m++)b=b.redSqr();n(m=0;n--){for(var u=e.words[n],h=f-1;h>=0;h--){var c=u>>h&1;i!==r[0]&&(i=this.sqr(i)),0!==c||0!==a?(a<<=1,a|=c,(4===++s||0===n&&0===h)&&(i=this.mul(i,r[a]),s=0,a=0)):s=0}f=26}return i},E.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},E.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},o.mont=function(t){return new k(t)},i(k,E),k.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},k.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},k.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},k.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new o(0)._forceRed(this);var r=t.mul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),a=i;return i.cmp(this.m)>=0?a=i.isub(this.m):i.cmpn(0)<0&&(a=i.iadd(this.m)),a._forceRed(this)},k.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(void 0===e||e,this)},{buffer:8}],58:[function(t,e,r){(function(r){"use strict";var n=t("is-hex-prefixed"),i=t("strip-hex-prefix");function o(t){var e=t;if("string"!=typeof e)throw new Error("[ethjs-util] while padding to even, value must be string, is currently "+typeof e+", while padToEven.");return e.length%2&&(e="0"+e),e}function a(t){return"0x"+t.toString(16)}e.exports={arrayContainsArray:function(t,e,r){if(!0!==Array.isArray(t))throw new Error("[ethjs-util] method arrayContainsArray requires input 'superset' to be an array got type '"+typeof t+"'");if(!0!==Array.isArray(e))throw new Error("[ethjs-util] method arrayContainsArray requires input 'subset' to be an array got type '"+typeof e+"'");return e[Boolean(r)?"some":"every"]((function(e){return t.indexOf(e)>=0}))},intToBuffer:function(t){var e=a(t);return new r(o(e.slice(2)),"hex")},getBinarySize:function(t){if("string"!=typeof t)throw new Error("[ethjs-util] while getting binary size, method getBinarySize requires input 'str' to be type String, got '"+typeof t+"'.");return r.byteLength(t,"utf8")},isHexPrefixed:n,stripHexPrefix:i,padToEven:o,intToHex:a,fromAscii:function(t){for(var e="",r=0;r0&&s.length>o){s.warned=!0;var f=new Error("Possible EventEmitter memory leak detected. "+s.length+' "'+String(e)+'" listeners added. Use emitter.setMaxListeners() to increase limit.');f.name="MaxListenersExceededWarning",f.emitter=t,f.type=e,f.count=s.length,"object"==typeof console&&console.warn&&console.warn("%s: %s",f.name,f.message)}}else s=a[e]=r,++t._eventsCount;return t}function y(){if(!this.fired)switch(this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length){case 0:return this.listener.call(this.target);case 1:return this.listener.call(this.target,arguments[0]);case 2:return this.listener.call(this.target,arguments[0],arguments[1]);case 3:return this.listener.call(this.target,arguments[0],arguments[1],arguments[2]);default:for(var t=new Array(arguments.length),e=0;e1&&(e=arguments[1]),e instanceof Error)throw e;var f=new Error('Unhandled "error" event. ('+e+")");throw f.context=e,f}if(!(r=a[t]))return!1;var u="function"==typeof r;switch(n=arguments.length){case 1:c(r,u,this);break;case 2:d(r,u,this,arguments[1]);break;case 3:l(r,u,this,arguments[1],arguments[2]);break;case 4:p(r,u,this,arguments[1],arguments[2],arguments[3]);break;default:for(i=new Array(n-1),o=1;o=0;a--)if(r[a]===e||r[a].listener===e){s=r[a].listener,o=a;break}if(o<0)return this;0===o?r.shift():function(t,e){for(var r=e,n=r+1,i=t.length;n=0;o--)this.removeListener(t,e[o]);return this},a.prototype.listeners=function(t){return v(this,t,!0)},a.prototype.rawListeners=function(t){return v(this,t,!1)},a.listenerCount=function(t,e){return"function"==typeof t.listenerCount?t.listenerCount(e):w.call(t,e)},a.prototype.listenerCount=w,a.prototype.eventNames=function(){return this._eventsCount>0?Reflect.ownKeys(this._events):[]}},{}],60:[function(t,e,r){"use strict";var n=t("safe-buffer").Buffer,i=t("stream").Transform;function o(t){i.call(this),this._block=n.allocUnsafe(t),this._blockSize=t,this._blockOffset=0,this._length=[0,0,0,0],this._finalized=!1}t("inherits")(o,i),o.prototype._transform=function(t,e,r){var n=null;try{this.update(t,e)}catch(t){n=t}r(n)},o.prototype._flush=function(t){var e=null;try{this.push(this.digest())}catch(t){e=t}t(e)},o.prototype.update=function(t,e){if(function(t,e){if(!n.isBuffer(t)&&"string"!=typeof t)throw new TypeError(e+" must be a string or a buffer")}(t,"Data"),this._finalized)throw new Error("Digest already called");n.isBuffer(t)||(t=n.from(t,e));for(var r=this._block,i=0;this._blockOffset+t.length-i>=this._blockSize;){for(var o=this._blockOffset;o0;++a)this._length[a]+=s,(s=this._length[a]/4294967296|0)>0&&(this._length[a]-=4294967296*s);return this},o.prototype._update=function(){throw new Error("_update is not implemented")},o.prototype.digest=function(t){if(this._finalized)throw new Error("Digest already called");this._finalized=!0;var e=this._digest();void 0!==t&&(e=e.toString(t)),this._block.fill(0),this._blockOffset=0;for(var r=0;r<4;++r)this._length[r]=0;return e},o.prototype._digest=function(){throw new Error("_digest is not implemented")},e.exports=o},{inherits:75,"safe-buffer":124,stream:136}],61:[function(t,e,r){var n=r;n.utils=t("./hash/utils"),n.common=t("./hash/common"),n.sha=t("./hash/sha"),n.ripemd=t("./hash/ripemd"),n.hmac=t("./hash/hmac"),n.sha1=n.sha.sha1,n.sha256=n.sha.sha256,n.sha224=n.sha.sha224,n.sha384=n.sha.sha384,n.sha512=n.sha.sha512,n.ripemd160=n.ripemd.ripemd160},{"./hash/common":62,"./hash/hmac":63,"./hash/ripemd":64,"./hash/sha":65,"./hash/utils":72}],62:[function(t,e,r){"use strict";var n=t("./utils"),i=t("minimalistic-assert");function o(){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}r.BlockHash=o,o.prototype.update=function(t,e){if(t=n.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=n.join32(t,0,t.length-r,this.endian);for(var i=0;i>>24&255,n[i++]=t>>>16&255,n[i++]=t>>>8&255,n[i++]=255&t}else for(n[i++]=255&t,n[i++]=t>>>8&255,n[i++]=t>>>16&255,n[i++]=t>>>24&255,n[i++]=0,n[i++]=0,n[i++]=0,n[i++]=0,o=8;othis.blockSize&&(t=(new this.Hash).update(t).digest()),i(t.length<=this.blockSize);for(var e=t.length;e>>3},r.g1_256=function(t){return n(t,17)^n(t,19)^t>>>10}},{"../utils":72}],72:[function(t,e,r){"use strict";var n=t("minimalistic-assert"),i=t("inherits");function o(t,e){return 55296==(64512&t.charCodeAt(e))&&(!(e<0||e+1>=t.length)&&56320==(64512&t.charCodeAt(e+1)))}function a(t){return(t>>>24|t>>>8&65280|t<<8&16711680|(255&t)<<24)>>>0}function s(t){return 1===t.length?"0"+t:t}function f(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}r.inherits=i,r.toArray=function(t,e){if(Array.isArray(t))return t.slice();if(!t)return[];var r=[];if("string"==typeof t)if(e){if("hex"===e)for((t=t.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(t="0"+t),i=0;i>6|192,r[n++]=63&a|128):o(t,i)?(a=65536+((1023&a)<<10)+(1023&t.charCodeAt(++i)),r[n++]=a>>18|240,r[n++]=a>>12&63|128,r[n++]=a>>6&63|128,r[n++]=63&a|128):(r[n++]=a>>12|224,r[n++]=a>>6&63|128,r[n++]=63&a|128)}else for(i=0;i>>0}return a},r.split32=function(t,e){for(var r=new Array(4*t.length),n=0,i=0;n>>24,r[i+1]=o>>>16&255,r[i+2]=o>>>8&255,r[i+3]=255&o):(r[i+3]=o>>>24,r[i+2]=o>>>16&255,r[i+1]=o>>>8&255,r[i]=255&o)}return r},r.rotr32=function(t,e){return t>>>e|t<<32-e},r.rotl32=function(t,e){return t<>>32-e},r.sum32=function(t,e){return t+e>>>0},r.sum32_3=function(t,e,r){return t+e+r>>>0},r.sum32_4=function(t,e,r,n){return t+e+r+n>>>0},r.sum32_5=function(t,e,r,n,i){return t+e+r+n+i>>>0},r.sum64=function(t,e,r,n){var i=t[e],o=n+t[e+1]>>>0,a=(o>>0,t[e+1]=o},r.sum64_hi=function(t,e,r,n){return(e+n>>>0>>0},r.sum64_lo=function(t,e,r,n){return e+n>>>0},r.sum64_4_hi=function(t,e,r,n,i,o,a,s){var f=0,u=e;return f+=(u=u+n>>>0)>>0)>>0)>>0},r.sum64_4_lo=function(t,e,r,n,i,o,a,s){return e+n+o+s>>>0},r.sum64_5_hi=function(t,e,r,n,i,o,a,s,f,u){var h=0,c=e;return h+=(c=c+n>>>0)>>0)>>0)>>0)>>0},r.sum64_5_lo=function(t,e,r,n,i,o,a,s,f,u){return e+n+o+s+u>>>0},r.rotr64_hi=function(t,e,r){return(e<<32-r|t>>>r)>>>0},r.rotr64_lo=function(t,e,r){return(t<<32-r|e>>>r)>>>0},r.shr64_hi=function(t,e,r){return t>>>r},r.shr64_lo=function(t,e,r){return(t<<32-r|e>>>r)>>>0}},{inherits:75,"minimalistic-assert":101}],73:[function(t,e,r){"use strict";var n=t("hash.js"),i=t("minimalistic-crypto-utils"),o=t("minimalistic-assert");function a(t){if(!(this instanceof a))return new a(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=i.toArray(t.entropy,t.entropyEnc||"hex"),r=i.toArray(t.nonce,t.nonceEnc||"hex"),n=i.toArray(t.pers,t.persEnc||"hex");o(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,r,n)}e.exports=a,a.prototype._init=function(t,e,r){var n=t.concat(e).concat(r);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var i=0;i=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(t.concat(r||[])),this._reseed=1},a.prototype.generate=function(t,e,r,n){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");"string"!=typeof e&&(n=r,r=e,e=null),r&&(r=i.toArray(r,n||"hex"),this._update(r));for(var o=[];o.length>1,h=-7,c=r?i-1:0,d=r?-1:1,l=t[e+c];for(c+=d,o=l&(1<<-h)-1,l>>=-h,h+=s;h>0;o=256*o+t[e+c],c+=d,h-=8);for(a=o&(1<<-h)-1,o>>=-h,h+=n;h>0;a=256*a+t[e+c],c+=d,h-=8);if(0===o)o=1-u;else{if(o===f)return a?NaN:1/0*(l?-1:1);a+=Math.pow(2,n),o-=u}return(l?-1:1)*a*Math.pow(2,o-n)},r.write=function(t,e,r,n,i,o){var a,s,f,u=8*o-i-1,h=(1<>1,d=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,l=n?0:o-1,p=n?1:-1,b=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=isNaN(e)?1:0,a=h):(a=Math.floor(Math.log(e)/Math.LN2),e*(f=Math.pow(2,-a))<1&&(a--,f*=2),(e+=a+c>=1?d/f:d*Math.pow(2,1-c))*f>=2&&(a++,f/=2),a+c>=h?(s=0,a=h):a+c>=1?(s=(e*f-1)*Math.pow(2,i),a+=c):(s=e*Math.pow(2,c-1)*Math.pow(2,i),a=0));i>=8;t[r+l]=255&s,l+=p,s/=256,i-=8);for(a=a<0;t[r+l]=255&a,l+=p,a/=256,u-=8);t[r+l-p]|=128*b}},{}],75:[function(t,e,r){"function"==typeof Object.create?e.exports=function(t,e){e&&(t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:e.exports=function(t,e){if(e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}}},{}],76:[function(t,e,r){function n(t){return!!t.constructor&&"function"==typeof t.constructor.isBuffer&&t.constructor.isBuffer(t)} +"use strict";var n=t("base64-js"),i=t("ieee754");r.Buffer=e,r.SlowBuffer=function(t){+t!=t&&(t=0);return e.alloc(+t)},r.INSPECT_MAX_BYTES=50;var o=2147483647;function a(t){if(t>o)throw new RangeError('The value "'+t+'" is invalid for option "size"');var r=new Uint8Array(t);return r.__proto__=e.prototype,r}function e(t,e,r){if("number"==typeof t){if("string"==typeof e)throw new TypeError('The "string" argument must be of type string. Received type number');return u(t)}return s(t,e,r)}function s(t,r,n){if("string"==typeof t)return function(t,r){"string"==typeof r&&""!==r||(r="utf8");if(!e.isEncoding(r))throw new TypeError("Unknown encoding: "+r);var n=0|d(t,r),i=a(n),o=i.write(t,r);o!==n&&(i=i.slice(0,o));return i}(t,r);if(ArrayBuffer.isView(t))return h(t);if(null==t)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(q(t,ArrayBuffer)||t&&q(t.buffer,ArrayBuffer))return function(t,r,n){if(r<0||t.byteLength=o)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+o.toString(16)+" bytes");return 0|t}function d(t,r){if(e.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||q(t,ArrayBuffer))return t.byteLength;if("string"!=typeof t)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);var n=t.length,i=arguments.length>2&&!0===arguments[2];if(!i&&0===n)return 0;for(var o=!1;;)switch(r){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return N(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return z(t).length;default:if(o)return i?-1:N(t).length;r=(""+r).toLowerCase(),o=!0}}function l(t,e,r){var n=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return R(this,e,r);case"utf8":case"utf-8":return x(this,e,r);case"ascii":return E(this,e,r);case"latin1":case"binary":return k(this,e,r);case"base64":return S(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return T(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function p(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function b(t,r,n,i,o){if(0===t.length)return-1;if("string"==typeof n?(i=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),K(n=+n)&&(n=o?0:t.length-1),n<0&&(n=t.length+n),n>=t.length){if(o)return-1;n=t.length-1}else if(n<0){if(!o)return-1;n=0}if("string"==typeof r&&(r=e.from(r,i)),e.isBuffer(r))return 0===r.length?-1:m(t,r,n,i,o);if("number"==typeof r)return r&=255,"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(t,r,n):Uint8Array.prototype.lastIndexOf.call(t,r,n):m(t,[r],n,i,o);throw new TypeError("val must be string, number or Buffer")}function m(t,e,r,n,i){var o,a=1,s=t.length,f=e.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return-1;a=2,s/=2,f/=2,r/=2}function u(t,e){return 1===a?t[e]:t.readUInt16BE(e*a)}if(i){var h=-1;for(o=r;os&&(r=s-f),o=r;o>=0;o--){for(var c=!0,d=0;di&&(n=i):n=i;var o=e.length;n>o/2&&(n=o/2);for(var a=0;a>8,i=r%256,o.push(i),o.push(n);return o}(e,t.length-r),t,r,n)}function S(t,e,r){return 0===e&&r===t.length?n.fromByteArray(t):n.fromByteArray(t.slice(e,r))}function x(t,e,r){r=Math.min(t.length,r);for(var n=[],i=e;i239?4:u>223?3:u>191?2:1;if(i+c<=r)switch(c){case 1:u<128&&(h=u);break;case 2:128==(192&(o=t[i+1]))&&(f=(31&u)<<6|63&o)>127&&(h=f);break;case 3:o=t[i+1],a=t[i+2],128==(192&o)&&128==(192&a)&&(f=(15&u)<<12|(63&o)<<6|63&a)>2047&&(f<55296||f>57343)&&(h=f);break;case 4:o=t[i+1],a=t[i+2],s=t[i+3],128==(192&o)&&128==(192&a)&&128==(192&s)&&(f=(15&u)<<18|(63&o)<<12|(63&a)<<6|63&s)>65535&&f<1114112&&(h=f)}null===h?(h=65533,c=1):h>65535&&(h-=65536,n.push(h>>>10&1023|55296),h=56320|1023&h),n.push(h),i+=c}return function(t){var e=t.length;if(e<=A)return String.fromCharCode.apply(String,t);var r="",n=0;for(;ne&&(t+=" ... "),""},e.prototype.compare=function(t,r,n,i,o){if(q(t,Uint8Array)&&(t=e.from(t,t.offset,t.byteLength)),!e.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(void 0===r&&(r=0),void 0===n&&(n=t?t.length:0),void 0===i&&(i=0),void 0===o&&(o=this.length),r<0||n>t.length||i<0||o>this.length)throw new RangeError("out of range index");if(i>=o&&r>=n)return 0;if(i>=o)return-1;if(r>=n)return 1;if(this===t)return 0;for(var a=(o>>>=0)-(i>>>=0),s=(n>>>=0)-(r>>>=0),f=Math.min(a,s),u=this.slice(i,o),h=t.slice(r,n),c=0;c>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var i=this.length-e;if((void 0===r||r>i)&&(r=i),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var o=!1;;)switch(n){case"hex":return y(this,t,e,r);case"utf8":case"utf-8":return g(this,t,e,r);case"ascii":return v(this,t,e,r);case"latin1":case"binary":return w(this,t,e,r);case"base64":return _(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return M(this,t,e,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},e.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var A=4096;function E(t,e,r){var n="";r=Math.min(t.length,r);for(var i=e;in)&&(r=n);for(var i="",o=e;or)throw new RangeError("Trying to access beyond buffer length")}function I(t,r,n,i,o,a){if(!e.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(r>o||rt.length)throw new RangeError("Index out of range")}function L(t,e,r,n,i,o){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function P(t,e,r,n,o){return e=+e,r>>>=0,o||L(t,0,r,4),i.write(t,e,r,n,23,4),r+4}function j(t,e,r,n,o){return e=+e,r>>>=0,o||L(t,0,r,8),i.write(t,e,r,n,52,8),r+8}e.prototype.slice=function(t,r){var n=this.length;(t=~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),(r=void 0===r?n:~~r)<0?(r+=n)<0&&(r=0):r>n&&(r=n),r>>=0,e>>>=0,r||B(t,e,this.length);for(var n=this[t],i=1,o=0;++o>>=0,e>>>=0,r||B(t,e,this.length);for(var n=this[t+--e],i=1;e>0&&(i*=256);)n+=this[t+--e]*i;return n},e.prototype.readUInt8=function(t,e){return t>>>=0,e||B(t,1,this.length),this[t]},e.prototype.readUInt16LE=function(t,e){return t>>>=0,e||B(t,2,this.length),this[t]|this[t+1]<<8},e.prototype.readUInt16BE=function(t,e){return t>>>=0,e||B(t,2,this.length),this[t]<<8|this[t+1]},e.prototype.readUInt32LE=function(t,e){return t>>>=0,e||B(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},e.prototype.readUInt32BE=function(t,e){return t>>>=0,e||B(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},e.prototype.readIntLE=function(t,e,r){t>>>=0,e>>>=0,r||B(t,e,this.length);for(var n=this[t],i=1,o=0;++o=(i*=128)&&(n-=Math.pow(2,8*e)),n},e.prototype.readIntBE=function(t,e,r){t>>>=0,e>>>=0,r||B(t,e,this.length);for(var n=e,i=1,o=this[t+--n];n>0&&(i*=256);)o+=this[t+--n]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*e)),o},e.prototype.readInt8=function(t,e){return t>>>=0,e||B(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},e.prototype.readInt16LE=function(t,e){t>>>=0,e||B(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},e.prototype.readInt16BE=function(t,e){t>>>=0,e||B(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},e.prototype.readInt32LE=function(t,e){return t>>>=0,e||B(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},e.prototype.readInt32BE=function(t,e){return t>>>=0,e||B(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},e.prototype.readFloatLE=function(t,e){return t>>>=0,e||B(t,4,this.length),i.read(this,t,!0,23,4)},e.prototype.readFloatBE=function(t,e){return t>>>=0,e||B(t,4,this.length),i.read(this,t,!1,23,4)},e.prototype.readDoubleLE=function(t,e){return t>>>=0,e||B(t,8,this.length),i.read(this,t,!0,52,8)},e.prototype.readDoubleBE=function(t,e){return t>>>=0,e||B(t,8,this.length),i.read(this,t,!1,52,8)},e.prototype.writeUIntLE=function(t,e,r,n){(t=+t,e>>>=0,r>>>=0,n)||I(this,t,e,r,Math.pow(2,8*r)-1,0);var i=1,o=0;for(this[e]=255&t;++o>>=0,r>>>=0,n)||I(this,t,e,r,Math.pow(2,8*r)-1,0);var i=r-1,o=1;for(this[e+i]=255&t;--i>=0&&(o*=256);)this[e+i]=t/o&255;return e+r},e.prototype.writeUInt8=function(t,e,r){return t=+t,e>>>=0,r||I(this,t,e,1,255,0),this[e]=255&t,e+1},e.prototype.writeUInt16LE=function(t,e,r){return t=+t,e>>>=0,r||I(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},e.prototype.writeUInt16BE=function(t,e,r){return t=+t,e>>>=0,r||I(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},e.prototype.writeUInt32LE=function(t,e,r){return t=+t,e>>>=0,r||I(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t,e+4},e.prototype.writeUInt32BE=function(t,e,r){return t=+t,e>>>=0,r||I(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},e.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var i=Math.pow(2,8*r-1);I(this,t,e,r,i-1,-i)}var o=0,a=1,s=0;for(this[e]=255&t;++o>0)-s&255;return e+r},e.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var i=Math.pow(2,8*r-1);I(this,t,e,r,i-1,-i)}var o=r-1,a=1,s=0;for(this[e+o]=255&t;--o>=0&&(a*=256);)t<0&&0===s&&0!==this[e+o+1]&&(s=1),this[e+o]=(t/a>>0)-s&255;return e+r},e.prototype.writeInt8=function(t,e,r){return t=+t,e>>>=0,r||I(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},e.prototype.writeInt16LE=function(t,e,r){return t=+t,e>>>=0,r||I(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},e.prototype.writeInt16BE=function(t,e,r){return t=+t,e>>>=0,r||I(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},e.prototype.writeInt32LE=function(t,e,r){return t=+t,e>>>=0,r||I(this,t,e,4,2147483647,-2147483648),this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4},e.prototype.writeInt32BE=function(t,e,r){return t=+t,e>>>=0,r||I(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},e.prototype.writeFloatLE=function(t,e,r){return P(this,t,e,!0,r)},e.prototype.writeFloatBE=function(t,e,r){return P(this,t,e,!1,r)},e.prototype.writeDoubleLE=function(t,e,r){return j(this,t,e,!0,r)},e.prototype.writeDoubleBE=function(t,e,r){return j(this,t,e,!1,r)},e.prototype.copy=function(t,r,n,i){if(!e.isBuffer(t))throw new TypeError("argument should be a Buffer");if(n||(n=0),i||0===i||(i=this.length),r>=t.length&&(r=t.length),r||(r=0),i>0&&i=this.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),t.length-r=0;--a)t[a+r]=this[a+n];else Uint8Array.prototype.set.call(t,this.subarray(n,i),r);return o},e.prototype.fill=function(t,r,n,i){if("string"==typeof t){if("string"==typeof r?(i=r,r=0,n=this.length):"string"==typeof n&&(i=n,n=this.length),void 0!==i&&"string"!=typeof i)throw new TypeError("encoding must be a string");if("string"==typeof i&&!e.isEncoding(i))throw new TypeError("Unknown encoding: "+i);if(1===t.length){var o=t.charCodeAt(0);("utf8"===i&&o<128||"latin1"===i)&&(t=o)}}else"number"==typeof t&&(t&=255);if(r<0||this.length>>=0,n=void 0===n?this.length:n>>>0,t||(t=0),"number"==typeof t)for(a=r;a55295&&r<57344){if(!i){if(r>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(a+1===n){(e-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(e-=3)>-1&&o.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((e-=1)<0)break;o.push(r)}else if(r<2048){if((e-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function z(t){return n.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(O,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function U(t,e,r,n){for(var i=0;i=e.length||i>=t.length);++i)e[i+r]=t[i];return i}function q(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}function K(t){return t!=t}}).call(this,t("buffer").Buffer)},{"base64-js":5,buffer:9,ieee754:74}],10:[function(t,e,r){var n=t("safe-buffer").Buffer,i=t("stream").Transform,o=t("string_decoder").StringDecoder;function a(t){i.call(this),this.hashMode="string"==typeof t,this.hashMode?this[t]=this._finalOrDigest:this.final=this._finalOrDigest,this._final&&(this.__final=this._final,this._final=null),this._decoder=null,this._encoding=null}t("inherits")(a,i),a.prototype.update=function(t,e,r){"string"==typeof t&&(t=n.from(t,e));var i=this._update(t);return this.hashMode?this:(r&&(i=this._toString(i,r)),i)},a.prototype.setAutoPadding=function(){},a.prototype.getAuthTag=function(){throw new Error("trying to get auth tag in unsupported state")},a.prototype.setAuthTag=function(){throw new Error("trying to set auth tag in unsupported state")},a.prototype.setAAD=function(){throw new Error("trying to set aad in unsupported state")},a.prototype._transform=function(t,e,r){var n;try{this.hashMode?this._update(t):this.push(this._update(t))}catch(t){n=t}finally{r(n)}},a.prototype._flush=function(t){var e;try{this.push(this.__final())}catch(t){e=t}t(e)},a.prototype._finalOrDigest=function(t){var e=this.__final()||n.alloc(0);return t&&(e=this._toString(e,t,!0)),e},a.prototype._toString=function(t,e,r){if(this._decoder||(this._decoder=new o(e),this._encoding=e),this._encoding!==e)throw new Error("can't switch encodings");var n=this._decoder.write(t);return r&&(n+=this._decoder.end()),n},e.exports=a},{inherits:75,"safe-buffer":124,stream:136,string_decoder:137}],11:[function(t,e,r){(function(t){function e(t){return Object.prototype.toString.call(t)}r.isArray=function(t){return Array.isArray?Array.isArray(t):"[object Array]"===e(t)},r.isBoolean=function(t){return"boolean"==typeof t},r.isNull=function(t){return null===t},r.isNullOrUndefined=function(t){return null==t},r.isNumber=function(t){return"number"==typeof t},r.isString=function(t){return"string"==typeof t},r.isSymbol=function(t){return"symbol"==typeof t},r.isUndefined=function(t){return void 0===t},r.isRegExp=function(t){return"[object RegExp]"===e(t)},r.isObject=function(t){return"object"==typeof t&&null!==t},r.isDate=function(t){return"[object Date]"===e(t)},r.isError=function(t){return"[object Error]"===e(t)||t instanceof Error},r.isFunction=function(t){return"function"==typeof t},r.isPrimitive=function(t){return null===t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||"symbol"==typeof t||void 0===t},r.isBuffer=t.isBuffer}).call(this,{isBuffer:t("../../is-buffer/index.js")})},{"../../is-buffer/index.js":76}],12:[function(t,e,r){"use strict";var n=t("inherits"),i=t("md5.js"),o=t("ripemd160"),a=t("sha.js"),s=t("cipher-base");function f(t){s.call(this,"digest"),this._hash=t}n(f,s),f.prototype._update=function(t){this._hash.update(t)},f.prototype._final=function(){return this._hash.digest()},e.exports=function(t){return"md5"===(t=t.toLowerCase())?new i:"rmd160"===t||"ripemd160"===t?new o:new f(a(t))}},{"cipher-base":10,inherits:75,"md5.js":100,ripemd160:121,"sha.js":129}],13:[function(t,e,r){"use strict";var n=r;n.version=t("../package.json").version,n.utils=t("./elliptic/utils"),n.rand=t("brorand"),n.curve=t("./elliptic/curve"),n.curves=t("./elliptic/curves"),n.ec=t("./elliptic/ec"),n.eddsa=t("./elliptic/eddsa")},{"../package.json":28,"./elliptic/curve":16,"./elliptic/curves":19,"./elliptic/ec":20,"./elliptic/eddsa":23,"./elliptic/utils":27,brorand:7}],14:[function(t,e,r){"use strict";var n=t("bn.js"),i=t("../utils"),o=i.getNAF,a=i.getJSF,s=i.assert;function f(t,e){this.type=t,this.p=new n(e.p,16),this.red=e.prime?n.red(e.prime):n.mont(this.p),this.zero=new n(0).toRed(this.red),this.one=new n(1).toRed(this.red),this.two=new n(2).toRed(this.red),this.n=e.n&&new n(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 u(t,e){this.curve=t,this.type=e,this.precomputed=null}e.exports=f,f.prototype.point=function(){throw new Error("Not implemented")},f.prototype.validate=function(){throw new Error("Not implemented")},f.prototype._fixedNafMul=function(t,e){s(t.precomputed);var r=t._getDoubles(),n=o(e,1,this._bitLength),i=(1<=a;h--)f=(f<<1)+n[h];u.push(f)}for(var c=this.jpoint(null,null,null),d=this.jpoint(null,null,null),l=i;l>0;l--){for(a=0;a=0;u--){for(var h=0;u>=0&&0===a[u];u--)h++;if(u>=0&&h++,f=f.dblp(h),u<0)break;var c=a[u];s(0!==c),f="affine"===t.type?c>0?f.mixedAdd(i[c-1>>1]):f.mixedAdd(i[-c-1>>1].neg()):c>0?f.add(i[c-1>>1]):f.add(i[-c-1>>1].neg())}return"affine"===t.type?f.toP():f},f.prototype._wnafMulAdd=function(t,e,r,n,i){var s,f,u,h=this._wnafT1,c=this._wnafT2,d=this._wnafT3,l=0;for(s=0;s=1;s-=2){var b=s-1,m=s;if(1===h[b]&&1===h[m]){var y=[e[b],null,null,e[m]];0===e[b].y.cmp(e[m].y)?(y[1]=e[b].add(e[m]),y[2]=e[b].toJ().mixedAdd(e[m].neg())):0===e[b].y.cmp(e[m].y.redNeg())?(y[1]=e[b].toJ().mixedAdd(e[m]),y[2]=e[b].add(e[m].neg())):(y[1]=e[b].toJ().mixedAdd(e[m]),y[2]=e[b].toJ().mixedAdd(e[m].neg()));var g=[-3,-1,-5,-7,0,7,5,1,3],v=a(r[b],r[m]);for(l=Math.max(v[0].length,l),d[b]=new Array(l),d[m]=new Array(l),f=0;f=0;s--){for(var x=0;s>=0;){var A=!0;for(f=0;f=0&&x++,M=M.dblp(x),s<0)break;for(f=0;f0?u=c[f][E-1>>1]:E<0&&(u=c[f][-E-1>>1].neg()),M="affine"===u.type?M.mixedAdd(u):M.add(u))}}for(s=0;s=Math.ceil((t.bitLength()+1)/e.step)},u.prototype._getDoubles=function(t,e){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var r=[this],n=this,i=0;i":""},u.prototype.isInfinity=function(){return 0===this.x.cmpn(0)&&(0===this.y.cmp(this.z)||this.zOne&&0===this.y.cmp(this.curve.c))},u.prototype._extDbl=function(){var t=this.x.redSqr(),e=this.y.redSqr(),r=this.z.redSqr();r=r.redIAdd(r);var n=this.curve._mulA(t),i=this.x.redAdd(this.y).redSqr().redISub(t).redISub(e),o=n.redAdd(e),a=o.redSub(r),s=n.redSub(e),f=i.redMul(a),u=o.redMul(s),h=i.redMul(s),c=a.redMul(o);return this.curve.point(f,u,c,h)},u.prototype._projDbl=function(){var t,e,r,n,i,o,a=this.x.redAdd(this.y).redSqr(),s=this.x.redSqr(),f=this.y.redSqr();if(this.curve.twisted){var u=(n=this.curve._mulA(s)).redAdd(f);this.zOne?(t=a.redSub(s).redSub(f).redMul(u.redSub(this.curve.two)),e=u.redMul(n.redSub(f)),r=u.redSqr().redSub(u).redSub(u)):(i=this.z.redSqr(),o=u.redSub(i).redISub(i),t=a.redSub(s).redISub(f).redMul(o),e=u.redMul(n.redSub(f)),r=u.redMul(o))}else n=s.redAdd(f),i=this.curve._mulC(this.z).redSqr(),o=n.redSub(i).redSub(i),t=this.curve._mulC(a.redISub(n)).redMul(o),e=this.curve._mulC(n).redMul(s.redISub(f)),r=n.redMul(o);return this.curve.point(t,e,r)},u.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},u.prototype._extAdd=function(t){var e=this.y.redSub(this.x).redMul(t.y.redSub(t.x)),r=this.y.redAdd(this.x).redMul(t.y.redAdd(t.x)),n=this.t.redMul(this.curve.dd).redMul(t.t),i=this.z.redMul(t.z.redAdd(t.z)),o=r.redSub(e),a=i.redSub(n),s=i.redAdd(n),f=r.redAdd(e),u=o.redMul(a),h=s.redMul(f),c=o.redMul(f),d=a.redMul(s);return this.curve.point(u,h,d,c)},u.prototype._projAdd=function(t){var e,r,n=this.z.redMul(t.z),i=n.redSqr(),o=this.x.redMul(t.x),a=this.y.redMul(t.y),s=this.curve.d.redMul(o).redMul(a),f=i.redSub(s),u=i.redAdd(s),h=this.x.redAdd(this.y).redMul(t.x.redAdd(t.y)).redISub(o).redISub(a),c=n.redMul(f).redMul(h);return this.curve.twisted?(e=n.redMul(u).redMul(a.redSub(this.curve._mulA(o))),r=f.redMul(u)):(e=n.redMul(u).redMul(a.redSub(o)),r=this.curve._mulC(f).redMul(u)),this.curve.point(c,e,r)},u.prototype.add=function(t){return this.isInfinity()?t:t.isInfinity()?this:this.curve.extended?this._extAdd(t):this._projAdd(t)},u.prototype.mul=function(t){return this._hasDoubles(t)?this.curve._fixedNafMul(this,t):this.curve._wnafMul(this,t)},u.prototype.mulAdd=function(t,e,r){return this.curve._wnafMulAdd(1,[this,e],[t,r],2,!1)},u.prototype.jmulAdd=function(t,e,r){return this.curve._wnafMulAdd(1,[this,e],[t,r],2,!0)},u.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},u.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},u.prototype.getX=function(){return this.normalize(),this.x.fromRed()},u.prototype.getY=function(){return this.normalize(),this.y.fromRed()},u.prototype.eq=function(t){return this===t||0===this.getX().cmp(t.getX())&&0===this.getY().cmp(t.getY())},u.prototype.eqXToP=function(t){var e=t.toRed(this.curve.red).redMul(this.z);if(0===this.x.cmp(e))return!0;for(var r=t.clone(),n=this.curve.redN.redMul(this.z);;){if(r.iadd(this.curve.n),r.cmp(this.curve.p)>=0)return!1;if(e.redIAdd(n),0===this.x.cmp(e))return!0}},u.prototype.toP=u.prototype.normalize,u.prototype.mixedAdd=u.prototype.add},{"../utils":27,"./base":14,"bn.js":6,inherits:75}],16:[function(t,e,r){"use strict";var n=r;n.base=t("./base"),n.short=t("./short"),n.mont=t("./mont"),n.edwards=t("./edwards")},{"./base":14,"./edwards":15,"./mont":17,"./short":18}],17:[function(t,e,r){"use strict";var n=t("bn.js"),i=t("inherits"),o=t("./base"),a=t("../utils");function s(t){o.call(this,"mont",t),this.a=new n(t.a,16).toRed(this.red),this.b=new n(t.b,16).toRed(this.red),this.i4=new n(4).toRed(this.red).redInvm(),this.two=new n(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}function f(t,e,r){o.BasePoint.call(this,t,"projective"),null===e&&null===r?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new n(e,16),this.z=new n(r,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}i(s,o),e.exports=s,s.prototype.validate=function(t){var e=t.normalize().x,r=e.redSqr(),n=r.redMul(e).redAdd(r.redMul(this.a)).redAdd(e);return 0===n.redSqrt().redSqr().cmp(n)},i(f,o.BasePoint),s.prototype.decodePoint=function(t,e){return this.point(a.toArray(t,e),1)},s.prototype.point=function(t,e){return new f(this,t,e)},s.prototype.pointFromJSON=function(t){return f.fromJSON(this,t)},f.prototype.precompute=function(){},f.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())},f.fromJSON=function(t,e){return new f(t,e[0],e[1]||t.one)},f.prototype.inspect=function(){return this.isInfinity()?"":""},f.prototype.isInfinity=function(){return 0===this.z.cmpn(0)},f.prototype.dbl=function(){var t=this.x.redAdd(this.z).redSqr(),e=this.x.redSub(this.z).redSqr(),r=t.redSub(e),n=t.redMul(e),i=r.redMul(e.redAdd(this.curve.a24.redMul(r)));return this.curve.point(n,i)},f.prototype.add=function(){throw new Error("Not supported on Montgomery curve")},f.prototype.diffAdd=function(t,e){var r=this.x.redAdd(this.z),n=this.x.redSub(this.z),i=t.x.redAdd(t.z),o=t.x.redSub(t.z).redMul(r),a=i.redMul(n),s=e.z.redMul(o.redAdd(a).redSqr()),f=e.x.redMul(o.redISub(a).redSqr());return this.curve.point(s,f)},f.prototype.mul=function(t){for(var e=t.clone(),r=this,n=this.curve.point(null,null),i=[];0!==e.cmpn(0);e.iushrn(1))i.push(e.andln(1));for(var o=i.length-1;o>=0;o--)0===i[o]?(r=r.diffAdd(n,this),n=n.dbl()):(n=r.diffAdd(n,this),r=r.dbl());return n},f.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")},f.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")},f.prototype.eq=function(t){return 0===this.getX().cmp(t.getX())},f.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},f.prototype.getX=function(){return this.normalize(),this.x.fromRed()}},{"../utils":27,"./base":14,"bn.js":6,inherits:75}],18:[function(t,e,r){"use strict";var n=t("../utils"),i=t("bn.js"),o=t("inherits"),a=t("./base"),s=n.assert;function f(t){a.call(this,"short",t),this.a=new i(t.a,16).toRed(this.red),this.b=new i(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 u(t,e,r,n){a.BasePoint.call(this,t,"affine"),null===e&&null===r?(this.x=null,this.y=null,this.inf=!0):(this.x=new i(e,16),this.y=new i(r,16),n&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.inf=!1)}function h(t,e,r,n){a.BasePoint.call(this,t,"jacobian"),null===e&&null===r&&null===n?(this.x=this.curve.one,this.y=this.curve.one,this.z=new i(0)):(this.x=new i(e,16),this.y=new i(r,16),this.z=new i(n,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}o(f,a),e.exports=f,f.prototype._getEndomorphism=function(t){if(this.zeroA&&this.g&&this.n&&1===this.p.modn(3)){var e,r;if(t.beta)e=new i(t.beta,16).toRed(this.red);else{var n=this._getEndoRoots(this.p);e=(e=n[0].cmp(n[1])<0?n[0]:n[1]).toRed(this.red)}if(t.lambda)r=new i(t.lambda,16);else{var o=this._getEndoRoots(this.n);0===this.g.mul(o[0]).x.cmp(this.g.x.redMul(e))?r=o[0]:(r=o[1],s(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 i(t.a,16),b:new i(t.b,16)}})):this._getEndoBasis(r)}}},f.prototype._getEndoRoots=function(t){var e=t===this.p?this.red:i.mont(t),r=new i(2).toRed(e).redInvm(),n=r.redNeg(),o=new i(3).toRed(e).redNeg().redSqrt().redMul(r);return[n.redAdd(o).fromRed(),n.redSub(o).fromRed()]},f.prototype._getEndoBasis=function(t){for(var e,r,n,o,a,s,f,u,h,c=this.n.ushrn(Math.floor(this.n.bitLength()/2)),d=t,l=this.n.clone(),p=new i(1),b=new i(0),m=new i(0),y=new i(1),g=0;0!==d.cmpn(0);){var v=l.div(d);u=l.sub(v.mul(d)),h=m.sub(v.mul(p));var w=y.sub(v.mul(b));if(!n&&u.cmp(c)<0)e=f.neg(),r=p,n=u.neg(),o=h;else if(n&&2==++g)break;f=u,l=d,d=u,m=p,p=h,y=b,b=w}a=u.neg(),s=h;var _=n.sqr().add(o.sqr());return a.sqr().add(s.sqr()).cmp(_)>=0&&(a=e,s=r),n.negative&&(n=n.neg(),o=o.neg()),a.negative&&(a=a.neg(),s=s.neg()),[{a:n,b:o},{a:a,b:s}]},f.prototype._endoSplit=function(t){var e=this.endo.basis,r=e[0],n=e[1],i=n.b.mul(t).divRound(this.n),o=r.b.neg().mul(t).divRound(this.n),a=i.mul(r.a),s=o.mul(n.a),f=i.mul(r.b),u=o.mul(n.b);return{k1:t.sub(a).sub(s),k2:f.add(u).neg()}},f.prototype.pointFromX=function(t,e){(t=new i(t,16)).red||(t=t.toRed(this.red));var r=t.redSqr().redMul(t).redIAdd(t.redMul(this.a)).redIAdd(this.b),n=r.redSqrt();if(0!==n.redSqr().redSub(r).cmp(this.zero))throw new Error("invalid point");var o=n.fromRed().isOdd();return(e&&!o||!e&&o)&&(n=n.redNeg()),this.point(t,n)},f.prototype.validate=function(t){if(t.inf)return!0;var e=t.x,r=t.y,n=this.a.redMul(e),i=e.redSqr().redMul(e).redIAdd(n).redIAdd(this.b);return 0===r.redSqr().redISub(i).cmpn(0)},f.prototype._endoWnafMulAdd=function(t,e,r){for(var n=this._endoWnafT1,i=this._endoWnafT2,o=0;o":""},u.prototype.isInfinity=function(){return this.inf},u.prototype.add=function(t){if(this.inf)return t;if(t.inf)return this;if(this.eq(t))return this.dbl();if(this.neg().eq(t))return this.curve.point(null,null);if(0===this.x.cmp(t.x))return this.curve.point(null,null);var e=this.y.redSub(t.y);0!==e.cmpn(0)&&(e=e.redMul(this.x.redSub(t.x).redInvm()));var r=e.redSqr().redISub(this.x).redISub(t.x),n=e.redMul(this.x.redSub(r)).redISub(this.y);return this.curve.point(r,n)},u.prototype.dbl=function(){if(this.inf)return this;var t=this.y.redAdd(this.y);if(0===t.cmpn(0))return this.curve.point(null,null);var e=this.curve.a,r=this.x.redSqr(),n=t.redInvm(),i=r.redAdd(r).redIAdd(r).redIAdd(e).redMul(n),o=i.redSqr().redISub(this.x.redAdd(this.x)),a=i.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,a)},u.prototype.getX=function(){return this.x.fromRed()},u.prototype.getY=function(){return this.y.fromRed()},u.prototype.mul=function(t){return t=new i(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)},u.prototype.mulAdd=function(t,e,r){var n=[this,e],i=[t,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,i):this.curve._wnafMulAdd(1,n,i,2)},u.prototype.jmulAdd=function(t,e,r){var n=[this,e],i=[t,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,i,!0):this.curve._wnafMulAdd(1,n,i,2,!0)},u.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))},u.prototype.neg=function(t){if(this.inf)return this;var e=this.curve.point(this.x,this.y.redNeg());if(t&&this.precomputed){var r=this.precomputed,n=function(t){return t.neg()};e.precomputed={naf:r.naf&&{wnd:r.naf.wnd,points:r.naf.points.map(n)},doubles:r.doubles&&{step:r.doubles.step,points:r.doubles.points.map(n)}}}return e},u.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},o(h,a.BasePoint),f.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),n=this.y.redMul(e).redMul(t);return this.curve.point(r,n)},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(),n=this.x.redMul(e),i=t.x.redMul(r),o=this.y.redMul(e.redMul(t.z)),a=t.y.redMul(r.redMul(this.z)),s=n.redSub(i),f=o.redSub(a);if(0===s.cmpn(0))return 0!==f.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var u=s.redSqr(),h=u.redMul(s),c=n.redMul(u),d=f.redSqr().redIAdd(h).redISub(c).redISub(c),l=f.redMul(c.redISub(d)).redISub(o.redMul(h)),p=this.z.redMul(t.z).redMul(s);return this.curve.jpoint(d,l,p)},h.prototype.mixedAdd=function(t){if(this.isInfinity())return t.toJ();if(t.isInfinity())return this;var e=this.z.redSqr(),r=this.x,n=t.x.redMul(e),i=this.y,o=t.y.redMul(e).redMul(this.z),a=r.redSub(n),s=i.redSub(o);if(0===a.cmpn(0))return 0!==s.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var f=a.redSqr(),u=f.redMul(a),h=r.redMul(f),c=s.redSqr().redIAdd(u).redISub(h).redISub(h),d=s.redMul(h.redISub(c)).redISub(i.redMul(u)),l=this.z.redMul(a);return this.curve.jpoint(c,d,l)},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=0)return!1;if(r.redIAdd(i),0===this.x.cmp(r))return!0}},h.prototype.inspect=function(){return this.isInfinity()?"":""},h.prototype.isInfinity=function(){return 0===this.z.cmpn(0)}},{"../utils":27,"./base":14,"bn.js":6,inherits:75}],19:[function(t,e,r){"use strict";var n,i=r,o=t("hash.js"),a=t("./curve"),s=t("./utils").assert;function f(t){"short"===t.type?this.curve=new a.short(t):"edwards"===t.type?this.curve=new a.edwards(t):this.curve=new a.mont(t),this.g=this.curve.g,this.n=this.curve.n,this.hash=t.hash,s(this.g.validate(),"Invalid curve"),s(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function u(t,e){Object.defineProperty(i,t,{configurable:!0,enumerable:!0,get:function(){var r=new f(e);return Object.defineProperty(i,t,{configurable:!0,enumerable:!0,value:r}),r}})}i.PresetCurve=f,u("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:o.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),u("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:o.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),u("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:o.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),u("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:o.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),u("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:o.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),u("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:o.sha256,gRed:!1,g:["9"]}),u("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:o.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});try{n=t("./precomputed/secp256k1")}catch(t){n=void 0}u("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:o.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",n]})},{"./curve":16,"./precomputed/secp256k1":26,"./utils":27,"hash.js":61}],20:[function(t,e,r){"use strict";var n=t("bn.js"),i=t("hmac-drbg"),o=t("../utils"),a=t("../curves"),s=t("brorand"),f=o.assert,u=t("./key"),h=t("./signature");function c(t){if(!(this instanceof c))return new c(t);"string"==typeof t&&(f(Object.prototype.hasOwnProperty.call(a,t),"Unknown curve "+t),t=a[t]),t instanceof a.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}e.exports=c,c.prototype.keyPair=function(t){return new u(this,t)},c.prototype.keyFromPrivate=function(t,e){return u.fromPrivate(this,t,e)},c.prototype.keyFromPublic=function(t,e){return u.fromPublic(this,t,e)},c.prototype.genKeyPair=function(t){t||(t={});for(var e=new i({hash:this.hash,pers:t.pers,persEnc:t.persEnc||"utf8",entropy:t.entropy||s(this.hash.hmacStrength),entropyEnc:t.entropy&&t.entropyEnc||"utf8",nonce:this.n.toArray()}),r=this.n.byteLength(),o=this.n.sub(new n(2));;){var a=new n(e.generate(r));if(!(a.cmp(o)>0))return a.iaddn(1),this.keyFromPrivate(a)}},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,o){"object"==typeof r&&(o=r,r=null),o||(o={}),e=this.keyFromPrivate(e,r),t=this._truncateToN(new n(t,16));for(var a=this.n.byteLength(),s=e.getPrivate().toArray("be",a),f=t.toArray("be",a),u=new i({hash:this.hash,entropy:s,nonce:f,pers:o.pers,persEnc:o.persEnc||"utf8"}),c=this.n.sub(new n(1)),d=0;;d++){var l=o.k?o.k(d):new n(u.generate(this.n.byteLength()));if(!((l=this._truncateToN(l,!0)).cmpn(1)<=0||l.cmp(c)>=0)){var p=this.g.mul(l);if(!p.isInfinity()){var b=p.getX(),m=b.umod(this.n);if(0!==m.cmpn(0)){var y=l.invm(this.n).mul(m.mul(e.getPrivate()).iadd(t));if(0!==(y=y.umod(this.n)).cmpn(0)){var g=(p.getY().isOdd()?1:0)|(0!==b.cmp(m)?2:0);return o.canonical&&y.cmp(this.nh)>0&&(y=this.n.sub(y),g^=1),new h({r:m,s:y,recoveryParam:g})}}}}}},c.prototype.verify=function(t,e,r,i){t=this._truncateToN(new n(t,16)),r=this.keyFromPublic(r,i);var o=(e=new h(e,"hex")).r,a=e.s;if(o.cmpn(1)<0||o.cmp(this.n)>=0)return!1;if(a.cmpn(1)<0||a.cmp(this.n)>=0)return!1;var s,f=a.invm(this.n),u=f.mul(t).umod(this.n),c=f.mul(o).umod(this.n);return this.curve._maxwellTrick?!(s=this.g.jmulAdd(u,r.getPublic(),c)).isInfinity()&&s.eqXToP(o):!(s=this.g.mulAdd(u,r.getPublic(),c)).isInfinity()&&0===s.getX().umod(this.n).cmp(o)},c.prototype.recoverPubKey=function(t,e,r,i){f((3&r)===r,"The recovery param is more than two bits"),e=new h(e,i);var o=this.n,a=new n(t),s=e.r,u=e.s,c=1&r,d=r>>1;if(s.cmp(this.curve.p.umod(this.curve.n))>=0&&d)throw new Error("Unable to find sencond key candinate");s=d?this.curve.pointFromX(s.add(this.curve.n),c):this.curve.pointFromX(s,c);var l=e.r.invm(o),p=o.sub(a).mul(l).umod(o),b=u.mul(l).umod(o);return this.g.mulAdd(p,s,b)},c.prototype.getKeyRecoveryParam=function(t,e,r,n){if(null!==(e=new h(e,n)).recoveryParam)return e.recoveryParam;for(var i=0;i<4;i++){var o;try{o=this.recoverPubKey(t,e,i)}catch(t){continue}if(o.eq(r))return i}throw new Error("Unable to find valid recovery factor")}},{"../curves":19,"../utils":27,"./key":21,"./signature":22,"bn.js":6,brorand:7,"hmac-drbg":73}],21:[function(t,e,r){"use strict";var n=t("bn.js"),i=t("../utils").assert;function o(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)}e.exports=o,o.fromPublic=function(t,e,r){return e instanceof o?e:new o(t,{pub:e,pubEnc:r})},o.fromPrivate=function(t,e,r){return e instanceof o?e:new o(t,{priv:e,privEnc:r})},o.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"}},o.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},o.prototype.getPrivate=function(t){return"hex"===t?this.priv.toString(16,2):this.priv},o.prototype._importPrivate=function(t,e){this.priv=new n(t,e||16),this.priv=this.priv.umod(this.ec.curve.n)},o.prototype._importPublic=function(t,e){if(t.x||t.y)return"mont"===this.ec.curve.type?i(t.x,"Need x coordinate"):"short"!==this.ec.curve.type&&"edwards"!==this.ec.curve.type||i(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)},o.prototype.derive=function(t){return t.validate()||i(t.validate(),"public point not validated"),t.mul(this.priv).getX()},o.prototype.sign=function(t,e,r){return this.ec.sign(t,this,e,r)},o.prototype.verify=function(t,e){return this.ec.verify(t,e,this)},o.prototype.inspect=function(){return""}},{"../utils":27,"bn.js":6}],22:[function(t,e,r){"use strict";var n=t("bn.js"),i=t("../utils"),o=i.assert;function a(t,e){if(t instanceof a)return t;this._importDER(t,e)||(o(t.r&&t.s,"Signature without r or s"),this.r=new n(t.r,16),this.s=new n(t.s,16),void 0===t.recoveryParam?this.recoveryParam=null:this.recoveryParam=t.recoveryParam)}function s(){this.place=0}function f(t,e){var r=t[e.place++];if(!(128&r))return r;var n=15&r;if(0===n||n>4)return!1;for(var i=0,o=0,a=e.place;o>>=0;return!(i<=127)&&(e.place=a,i)}function u(t){for(var e=0,r=t.length-1;!t[e]&&!(128&t[e+1])&&e>>3);for(t.push(128|r);--r;)t.push(e>>>(r<<3)&255);t.push(e)}}e.exports=a,a.prototype._importDER=function(t,e){t=i.toArray(t,e);var r=new s;if(48!==t[r.place++])return!1;var o=f(t,r);if(!1===o)return!1;if(o+r.place!==t.length)return!1;if(2!==t[r.place++])return!1;var a=f(t,r);if(!1===a)return!1;var u=t.slice(r.place,a+r.place);if(r.place+=a,2!==t[r.place++])return!1;var h=f(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===u[0]){if(!(128&u[1]))return!1;u=u.slice(1)}if(0===c[0]){if(!(128&c[1]))return!1;c=c.slice(1)}return this.r=new n(u),this.s=new n(c),this.recoveryParam=null,!0},a.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=u(e),r=u(r);!(r[0]||128&r[1]);)r=r.slice(1);var n=[2];h(n,e.length),(n=n.concat(e)).push(2),h(n,r.length);var o=n.concat(r),a=[48];return h(a,o.length),a=a.concat(o),i.encode(a,t)}},{"../utils":27,"bn.js":6}],23:[function(t,e,r){"use strict";var n=t("hash.js"),i=t("../curves"),o=t("../utils"),a=o.assert,s=o.parseBytes,f=t("./key"),u=t("./signature");function h(t){if(a("ed25519"===t,"only tested with ed25519 so far"),!(this instanceof h))return new h(t);t=i[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=n.sha512}e.exports=h,h.prototype.sign=function(t,e){t=s(t);var r=this.keyFromSecret(e),n=this.hashInt(r.messagePrefix(),t),i=this.g.mul(n),o=this.encodePoint(i),a=this.hashInt(o,r.pubBytes(),t).mul(r.priv()),f=n.add(a).umod(this.curve.n);return this.makeSignature({R:i,S:f,Rencoded:o})},h.prototype.verify=function(t,e,r){t=s(t),e=this.makeSignature(e);var n=this.keyFromPublic(r),i=this.hashInt(e.Rencoded(),n.pubBytes(),t),o=this.g.mul(e.S());return e.R().add(n.pub().mul(i)).eq(o)},h.prototype.hashInt=function(){for(var t=this.hash(),e=0;e(i>>1)-1?(i>>1)-f:f,o.isubn(s)):s=0,n[a]=s,o.iushrn(1)}return n},n.getJSF=function(t,e){var r=[[],[]];t=t.clone(),e=e.clone();for(var n,i=0,o=0;t.cmpn(-i)>0||e.cmpn(-o)>0;){var a,s,f=t.andln(3)+i&3,u=e.andln(3)+o&3;3===f&&(f=-1),3===u&&(u=-1),a=0==(1&f)?0:3!==(n=t.andln(7)+i&7)&&5!==n||2!==u?f:-f,r[0].push(a),s=0==(1&u)?0:3!==(n=e.andln(7)+o&7)&&5!==n||2!==f?u:-u,r[1].push(s),2*i===a+1&&(i=1-i),2*o===s+1&&(o=1-o),t.iushrn(1),e.iushrn(1)}return r},n.cachedProperty=function(t,e,r){var n="_"+e;t.prototype[e]=function(){return void 0!==this[n]?this[n]:this[n]=r.call(this)}},n.parseBytes=function(t){return"string"==typeof t?n.toArray(t,"hex"):t},n.intFromLE=function(t){return new i(t,"hex","le")}},{"bn.js":6,"minimalistic-assert":101,"minimalistic-crypto-utils":102}],28:[function(t,e,r){e.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 ",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"}}},{}],29:[function(t,e,r){const{Buffer:n}=t("buffer"),i=t("ethereumjs-util"),o=t("ethereumjs-abi"),a=t("tweetnacl");a.util=t("tweetnacl-util");const s={type:"object",properties:{types:{type:"object",additionalProperties:{type:"array",items:{type:"object",properties:{name:{type:"string"},type:{type:"string"}},required:["name","type"]}}},primaryType:{type:"string"},domain:{type:"object"},message:{type:"object"}},required:["types","primaryType","domain","message"]},f={encodeData(t,e,r,a=!0){const s=["bytes32"],f=[this.hashType(t,r)];if(a){const u=(t,e,s)=>{if(void 0!==r[e])return["bytes32",null==s?"0x0000000000000000000000000000000000000000000000000000000000000000":i.sha3(this.encodeData(e,s,r,a))];if(void 0===s)throw new Error(`missing value for field ${t} of type ${e}`);if("bytes"===e)return["bytes32",i.sha3(s)];if("string"===e)return"string"==typeof s&&(s=n.from(s,"utf8")),["bytes32",i.sha3(s)];if(e.lastIndexOf("]")===e.length-1){const r=e.slice(0,e.lastIndexOf("[")),n=s.map((e=>u(t,r,e)));return["bytes32",i.sha3(o.rawEncode(n.map((([t])=>t)),n.map((([,t])=>t))))]}return[e,s]};for(const n of r[t]){const[t,r]=u(n.name,n.type,e[n.name]);s.push(t),f.push(r)}}else for(const o of r[t]){let t=e[o.name];if(void 0!==t)if("bytes"===o.type)s.push("bytes32"),t=i.sha3(t),f.push(t);else if("string"===o.type)s.push("bytes32"),"string"==typeof t&&(t=n.from(t,"utf8")),t=i.sha3(t),f.push(t);else if(void 0!==r[o.type])s.push("bytes32"),t=i.sha3(this.encodeData(o.type,t,r,a)),f.push(t);else{if(o.type.lastIndexOf("]")===o.type.length-1)throw new Error("Arrays currently unimplemented in encodeData");s.push(o.type),f.push(t)}}return o.rawEncode(s,f)},encodeType(t,e){let r="",n=this.findTypeDependencies(t,e).filter((e=>e!==t));n=[t].concat(n.sort());for(const t of n){if(!e[t])throw new Error("No type definition specified: "+t);r+=t+"("+e[t].map((({name:t,type:e})=>e+" "+t)).join(",")+")"}return r},findTypeDependencies(t,e,r=[]){if(t=t.match(/^\w*/)[0],r.includes(t)||void 0===e[t])return r;r.push(t);for(const n of e[t])for(const t of this.findTypeDependencies(n.type,e,r))!r.includes(t)&&r.push(t);return r},hashStruct(t,e,r,n=!0){return i.sha3(this.encodeData(t,e,r,n))},hashType(t,e){return i.sha3(this.encodeType(t,e))},sanitizeData(t){const e={};for(const r in s.properties)t[r]&&(e[r]=t[r]);return e.types&&(e.types=Object.assign({EIP712Domain:[]},e.types)),e},sign(t,e=!0){const r=this.sanitizeData(t),o=[n.from("1901","hex")];return o.push(this.hashStruct("EIP712Domain",r.domain,r.types,e)),"EIP712Domain"!==r.primaryType&&o.push(this.hashStruct(r.primaryType,r.message,r.types,e)),i.sha3(n.concat(o))}};function u(t){const e=new Error("Expect argument to be non-empty array");if("object"!=typeof t||!t.length)throw e;const r=t.map((function(t){return"bytes"===t.type?i.toBuffer(t.value):t.value})),n=t.map((function(t){return t.type})),a=t.map((function(t){if(!t.name)throw e;return t.type+" "+t.name}));return o.soliditySHA3(["bytes32","bytes32"],[o.soliditySHA3(new Array(t.length).fill("string"),a),o.soliditySHA3(n,r)])}function h(t,e){const r=i.toBuffer(e),n=i.fromRpcSig(r);return i.ecrecover(t,n.v,n.r,n.s)}function c(t){const e=i.toBuffer(t.data);return h(i.hashPersonalMessage(e),t.sig)}function d(t,e){for(var r=""+t;r.length0&&(s=2048-a-16),o.padding="0".repeat(s);const f={data:JSON.stringify(o)};return this.encrypt(t,f,r)},decrypt:function(t,e){switch(t.version){case"x25519-xsalsa20-poly1305":var r=l(e),n=a.box.keyPair.fromSecretKey(r).secretKey,i=a.util.decodeBase64(t.nonce),o=a.util.decodeBase64(t.ciphertext),s=a.util.decodeBase64(t.ephemPublicKey),f=a.box.open(o,i,s,n);try{var u=a.util.encodeUTF8(f)}catch(t){throw new Error("Decryption failed.")}if(u)return u;throw new Error("Decryption failed.");default:throw new Error("Encryption type/version not supported.")}},decryptSafely:function(t,e){return JSON.parse(this.decrypt(t,e)).data},getEncryptionPublicKey:function(t){var e=l(t),r=a.box.keyPair.fromSecretKey(e).publicKey;return a.util.encodeBase64(r)},signTypedMessage:function(t,e,r="V4"){switch(r){case"V1":return this.signTypedDataLegacy(t,e);case"V3":return this.signTypedData(t,e);case"V4":default:return this.signTypedData_v4(t,e)}},recoverTypedMessage:function(t,e="V4"){switch(e){case"V1":return this.recoverTypedSignatureLegacy(t);case"V3":return this.recoverTypedSignature(t);case"V4":default:return this.recoverTypedSignature_v4(t)}},signTypedData:function(t,e){const r=f.sign(e.data,!1),n=i.ecsign(r,t);return i.bufferToHex(this.concatSig(n.v,n.r,n.s))},signTypedData_v4:function(t,e){const r=f.sign(e.data),n=i.ecsign(r,t);return i.bufferToHex(this.concatSig(n.v,n.r,n.s))},recoverTypedSignature:function(t){const e=h(f.sign(t.data,!1),t.sig),r=i.publicToAddress(e);return i.bufferToHex(r)},recoverTypedSignature_v4:function(t){const e=h(f.sign(t.data),t.sig),r=i.publicToAddress(e);return i.bufferToHex(r)}}},{buffer:9,"ethereumjs-abi":39,"ethereumjs-util":30,tweetnacl:34,"tweetnacl-util":140}],30:[function(t,e,r){"use strict";var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},i=t("ethereum-cryptography/keccak"),o=i.keccak224,a=i.keccak384,s=i.keccak256,f=i.keccak512,u=t("./secp256k1-adapter"),h=t("assert"),c=t("rlp"),d=t("bn.js"),l=t("create-hash"),p=t("safe-buffer").Buffer;Object.assign(r,t("ethjs-util")),r.MAX_INTEGER=new d("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",16),r.TWO_POW256=new d("10000000000000000000000000000000000000000000000000000000000000000",16),r.KECCAK256_NULL_S="c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470",r.SHA3_NULL_S=r.KECCAK256_NULL_S,r.KECCAK256_NULL=p.from(r.KECCAK256_NULL_S,"hex"),r.SHA3_NULL=r.KECCAK256_NULL,r.KECCAK256_RLP_ARRAY_S="1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",r.SHA3_RLP_ARRAY_S=r.KECCAK256_RLP_ARRAY_S,r.KECCAK256_RLP_ARRAY=p.from(r.KECCAK256_RLP_ARRAY_S,"hex"),r.SHA3_RLP_ARRAY=r.KECCAK256_RLP_ARRAY,r.KECCAK256_RLP_S="56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",r.SHA3_RLP_S=r.KECCAK256_RLP_S,r.KECCAK256_RLP=p.from(r.KECCAK256_RLP_S,"hex"),r.SHA3_RLP=r.KECCAK256_RLP,r.BN=d,r.rlp=c,r.secp256k1=u,r.zeros=function(t){return p.allocUnsafe(t).fill(0)},r.zeroAddress=function(){var t=r.zeros(20);return r.bufferToHex(t)},r.setLengthLeft=r.setLength=function(t,e,n){var i=r.zeros(e);return t=r.toBuffer(t),n?t.length0&&"0"===e.toString();)e=(t=t.slice(1))[0];return t},r.toBuffer=function(t){if(!p.isBuffer(t))if(Array.isArray(t))t=p.from(t);else if("string"==typeof t)t=r.isHexString(t)?p.from(r.padToEven(r.stripHexPrefix(t)),"hex"):p.from(t);else if("number"==typeof t)t=r.intToBuffer(t);else if(null==t)t=p.allocUnsafe(0);else if(d.isBN(t))t=t.toArrayLike(p);else{if(!t.toArray)throw new Error("invalid type");t=p.from(t.toArray())}return t},r.bufferToInt=function(t){return new d(r.toBuffer(t)).toNumber()},r.bufferToHex=function(t){return"0x"+(t=r.toBuffer(t)).toString("hex")},r.fromSigned=function(t){return new d(t).fromTwos(256)},r.toUnsigned=function(t){return p.from(t.toTwos(256).toArray())},r.keccak=function(t,e){switch(t=r.toBuffer(t),e||(e=256),e){case 224:return o(t);case 256:return s(t);case 384:return a(t);case 512:return f(t);default:throw new Error("Invald algorithm: keccak"+e)}},r.keccak256=function(t){return r.keccak(t)},r.sha3=r.keccak,r.sha256=function(t){return t=r.toBuffer(t),l("sha256").update(t).digest()},r.ripemd160=function(t,e){t=r.toBuffer(t);var n=l("rmd160").update(t).digest();return!0===e?r.setLength(n,32):n},r.rlphash=function(t){return r.keccak(c.encode(t))},r.isValidPrivate=function(t){return u.privateKeyVerify(t)},r.isValidPublic=function(t,e){return 64===t.length?u.publicKeyVerify(p.concat([p.from([4]),t])):!!e&&u.publicKeyVerify(t)},r.pubToAddress=r.publicToAddress=function(t,e){return t=r.toBuffer(t),e&&64!==t.length&&(t=u.publicKeyConvert(t,!1).slice(1)),h(64===t.length),r.keccak(t).slice(-20)};var b=r.privateToPublic=function(t){return t=r.toBuffer(t),u.publicKeyCreate(t,!1).slice(1)};r.importPublic=function(t){return 64!==(t=r.toBuffer(t)).length&&(t=u.publicKeyConvert(t,!1).slice(1)),t},r.ecsign=function(t,e){var r=u.sign(t,e),n={};return n.r=r.signature.slice(0,32),n.s=r.signature.slice(32,64),n.v=r.recovery+27,n},r.hashPersonalMessage=function(t){var e=r.toBuffer("Ethereum Signed Message:\n"+t.length.toString());return r.keccak(p.concat([e,t]))},r.ecrecover=function(t,e,n,i){var o=p.concat([r.setLength(n,32),r.setLength(i,32)],64),a=e-27;if(0!==a&&1!==a)throw new Error("Invalid signature v value");var s=u.recover(t,o,a);return u.publicKeyConvert(s,!1).slice(1)},r.toRpcSig=function(t,e,n){if(27!==t&&28!==t)throw new Error("Invalid recovery id");return r.bufferToHex(p.concat([r.setLengthLeft(e,32),r.setLengthLeft(n,32),r.toBuffer(t-27)]))},r.fromRpcSig=function(t){if(65!==(t=r.toBuffer(t)).length)throw new Error("Invalid signature length");var e=t[64];return e<27&&(e+=27),{v:e,r:t.slice(0,32),s:t.slice(32,64)}},r.privateToAddress=function(t){return r.publicToAddress(b(t))},r.isValidAddress=function(t){return/^0x[0-9a-fA-F]{40}$/.test(t)},r.isZeroAddress=function(t){return r.zeroAddress()===r.addHexPrefix(t)},r.toChecksumAddress=function(t){t=r.stripHexPrefix(t).toLowerCase();for(var e=r.keccak(t).toString("hex"),n="0x",i=0;i=8?n+=t[i].toUpperCase():n+=t[i];return n},r.isValidChecksumAddress=function(t){return r.isValidAddress(t)&&r.toChecksumAddress(t)===t},r.generateAddress=function(t,e){return t=r.toBuffer(t),e=(e=new d(e)).isZero()?null:p.from(e.toArray()),r.rlphash([t,e]).slice(-20)},r.isPrecompiled=function(t){var e=r.unpad(t);return 1===e.length&&e[0]>=1&&e[0]<=8},r.addHexPrefix=function(t){return"string"!=typeof t||r.isHexPrefixed(t)?t:"0x"+t},r.isValidSignature=function(t,e,r,n){var i=new d("7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0",16),o=new d("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141",16);return 32===e.length&&32===r.length&&((27===t||28===t)&&(e=new d(e),r=new d(r),!(e.isZero()||e.gt(o)||r.isZero()||r.gt(o))&&(!1!==n||1!==new d(r).cmp(i))))},r.baToJSON=function(t){if(p.isBuffer(t))return"0x"+t.toString("hex");if(t instanceof Array){for(var e=[],n=0;n=i.length,"The field "+e.name+" must not have more "+e.length+" bytes")):e.allowZero&&0===i.length||!e.length||h(e.length===i.length,"The field "+e.name+" must have byte length of "+e.length),t.raw[n]=i}t._fields.push(e.name),Object.defineProperty(t,e.name,{enumerable:!0,configurable:!0,get:i,set:o}),e.default&&(t[e.name]=e.default),e.alias&&Object.defineProperty(t,e.alias,{enumerable:!1,configurable:!0,set:o,get:i})})),i)if("string"==typeof i&&(i=p.from(r.stripHexPrefix(i),"hex")),p.isBuffer(i)&&(i=c.decode(i)),Array.isArray(i)){if(i.length>t._fields.length)throw new Error("wrong number of fields in data");i.forEach((function(e,n){t[t._fields[n]]=r.toBuffer(e)}))}else{if("object"!==(void 0===i?"undefined":n(i)))throw new Error("invalid data");var o=Object.keys(i);e.forEach((function(e){-1!==o.indexOf(e.name)&&(t[e.name]=i[e.name]),-1!==o.indexOf(e.alias)&&(t[e.alias]=i[e.alias])}))}}},{"./secp256k1-adapter":31,assert:1,"bn.js":6,"create-hash":12,"ethereum-cryptography/keccak":36,"ethjs-util":58,rlp:122,"safe-buffer":124}],31:[function(t,e,r){(function(r){"use strict";var n=t("ethereum-cryptography/secp256k1"),i=t("./secp256k1-lib/index"),o=t("./secp256k1-lib/der"),a=function(t){return 32===t.length&&n.privateKeyVerify(Uint8Array.from(t))};e.exports={privateKeyVerify:a,privateKeyExport:function(t,e){if(32!==t.length)throw new RangeError("private key length is invalid");var r=i.privateKeyExport(t,e);return o.privateKeyExport(t,r,e)},privateKeyImport:function(t){if(null!==(t=o.privateKeyImport(t))&&32===t.length&&a(t))return t;throw new Error("couldn't import from DER format")},privateKeyNegate:function(t){return r.from(n.privateKeyNegate(Uint8Array.from(t)))},privateKeyModInverse:function(t){if(32!==t.length)throw new Error("private key length is invalid");return r.from(i.privateKeyModInverse(Uint8Array.from(t)))},privateKeyTweakAdd:function(t,e){return r.from(n.privateKeyTweakAdd(Uint8Array.from(t),e))},privateKeyTweakMul:function(t,e){return r.from(n.privateKeyTweakMul(Uint8Array.from(t),Uint8Array.from(e)))},publicKeyCreate:function(t,e){return r.from(n.publicKeyCreate(Uint8Array.from(t),e))},publicKeyConvert:function(t,e){return r.from(n.publicKeyConvert(Uint8Array.from(t),e))},publicKeyVerify:function(t){return(33===t.length||65===t.length)&&n.publicKeyVerify(Uint8Array.from(t))},publicKeyTweakAdd:function(t,e,i){return r.from(n.publicKeyTweakAdd(Uint8Array.from(t),Uint8Array.from(e),i))},publicKeyTweakMul:function(t,e,i){return r.from(n.publicKeyTweakMul(Uint8Array.from(t),Uint8Array.from(e),i))},publicKeyCombine:function(t,e){var i=[];return t.forEach((function(t){i.push(Uint8Array.from(t))})),r.from(n.publicKeyCombine(i,e))},signatureNormalize:function(t){return r.from(n.signatureNormalize(Uint8Array.from(t)))},signatureExport:function(t){return r.from(n.signatureExport(Uint8Array.from(t)))},signatureImport:function(t){return r.from(n.signatureImport(Uint8Array.from(t)))},signatureImportLax:function(t){if(0===t.length)throw new RangeError("signature length is invalid");var e=o.signatureImportLax(t);if(null===e)throw new Error("couldn't parse DER signature");return i.signatureImport(e)},sign:function(t,e,i){if(null===i)throw new TypeError("options should be an Object");var o=void 0;if(i){if(o={},null===i.data)throw new TypeError("options.data should be a Buffer");if(i.data){if(32!==i.data.length)throw new RangeError("options.data length is invalid");o.data=new Uint8Array(i.data)}if(null===i.noncefn)throw new TypeError("options.noncefn should be a Function");i.noncefn&&(o.noncefn=function(t,e,n,o,a){var s=null!=n?r.from(n):null,f=null!=o?r.from(o):null,u=r.from("");return i.noncefn&&(u=i.noncefn(r.from(t),r.from(e),s,f,a)),Uint8Array.from(u)})}var a=n.ecdsaSign(Uint8Array.from(t),Uint8Array.from(e),o);return{signature:r.from(a.signature),recovery:a.recid}},verify:function(t,e,r){return n.ecdsaVerify(Uint8Array.from(e),Uint8Array.from(t),r)},recover:function(t,e,i,o){return r.from(n.ecdsaRecover(Uint8Array.from(e),i,Uint8Array.from(t),o))},ecdh:function(t,e){return r.from(n.ecdh(Uint8Array.from(t),Uint8Array.from(e),{}))},ecdhUnsafe:function(t,e,n){if(33!==t.length&&65!==t.length)throw new RangeError("public key length is invalid");if(32!==e.length)throw new RangeError("private key length is invalid");return r.from(i.ecdhUnsafe(Uint8Array.from(t),Uint8Array.from(e),n))}}}).call(this,t("buffer").Buffer)},{"./secp256k1-lib/der":32,"./secp256k1-lib/index":33,buffer:9,"ethereum-cryptography/secp256k1":38}],32:[function(t,e,r){(function(t){"use strict";var e=t.from([48,129,211,2,1,1,4,32,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,160,129,133,48,129,130,2,1,1,48,44,6,7,42,134,72,206,61,1,1,2,33,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,254,255,255,252,47,48,6,4,1,0,4,1,7,4,33,2,121,190,102,126,249,220,187,172,85,160,98,149,206,135,11,7,2,155,252,219,45,206,40,217,89,242,129,91,22,248,23,152,2,33,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,254,186,174,220,230,175,72,160,59,191,210,94,140,208,54,65,65,2,1,1,161,36,3,34,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]),n=t.from([48,130,1,19,2,1,1,4,32,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,160,129,165,48,129,162,2,1,1,48,44,6,7,42,134,72,206,61,1,1,2,33,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,254,255,255,252,47,48,6,4,1,0,4,1,7,4,65,4,121,190,102,126,249,220,187,172,85,160,98,149,206,135,11,7,2,155,252,219,45,206,40,217,89,242,129,91,22,248,23,152,72,58,218,119,38,163,196,101,93,164,251,252,14,17,8,168,253,23,180,72,166,133,84,25,156,71,208,143,251,16,212,184,2,33,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,254,186,174,220,230,175,72,160,59,191,210,94,140,208,54,65,65,2,1,1,161,68,3,66,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,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]);r.privateKeyExport=function(r,i,o){var a=t.from(o?e:n);return r.copy(a,o?8:9),i.copy(a,o?181:214),a},r.privateKeyImport=function(t){var e=t.length,r=0;if(e2)return null;if(e<(r+=1)+n)return null;var i=t[r+n-1]|(n>1?t[r+n-2]<<8:0);return e<(r+=n)+i||e32||ei)return null;if(2!==e[o++])return null;var s=e[o++];if(128&s){if(o+(a=s-128)>i)return null;for(;a>0&&0===e[o];o+=1,a-=1);for(s=0;a>0;o+=1,a-=1)s=(s<<8)+e[o]}if(s>i-o)return null;var f=o;if(o+=s,2!==e[o++])return null;var u=e[o++];if(128&u){if(o+(a=u-128)>i)return null;for(;a>0&&0===e[o];o+=1,a-=1);for(u=0;a>0;o+=1,a-=1)u=(u<<8)+e[o]}if(u>i-o)return null;var h=o;for(o+=u;s>0&&0===e[f];s-=1,f+=1);if(s>32)return null;var c=e.slice(f,f+s);for(c.copy(r,32-c.length);u>0&&0===e[h];u-=1,h+=1);if(u>32)return null;var d=e.slice(h,h+u);return d.copy(n,32-d.length),{r:r,s:n}}}).call(this,t("buffer").Buffer)},{buffer:9}],33:[function(t,e,r){(function(e){"use strict";var n=t("bn.js"),i=new(0,t("elliptic").ec)("secp256k1"),o=i.curve;r.privateKeyExport=function(t,e){var r=new n(t);if(r.ucmp(o.n)>=0)throw new Error("couldn't export to DER format");var s=i.g.mul(r);return a(s.getX(),s.getY(),e)},r.privateKeyModInverse=function(t){var r=new n(t);if(r.ucmp(o.n)>=0||r.isZero())throw new Error("private key range is invalid");return r.invm(o.n).toArrayLike(e,"be",32)},r.signatureImport=function(t){var r=new n(t.r);r.ucmp(o.n)>=0&&(r=new n(0));var i=new n(t.s);return i.ucmp(o.n)>=0&&(i=new n(0)),e.concat([r.toArrayLike(e,"be",32),i.toArrayLike(e,"be",32)])},r.ecdhUnsafe=function(t,e,r){var s=i.keyFromPublic(t),f=new n(e);if(f.ucmp(o.n)>=0||f.isZero())throw new Error("scalar was invalid (zero or overflow)");var u=s.pub.mul(f);return a(u.getX(),u.getY(),r)};var a=function(t,r,n){var i=void 0;return n?((i=e.alloc(33))[0]=r.isOdd()?3:2,t.toArrayLike(e,"be",32).copy(i,1)):((i=e.alloc(65))[0]=4,t.toArrayLike(e,"be",32).copy(i,1),r.toArrayLike(e,"be",32).copy(i,33)),i}}).call(this,t("buffer").Buffer)},{"bn.js":6,buffer:9,elliptic:13}],34:[function(t,e,r){!function(e){"use strict";var r=function(t){var e,r=new Float64Array(16);if(t)for(e=0;e>24&255,t[e+1]=r>>16&255,t[e+2]=r>>8&255,t[e+3]=255&r,t[e+4]=n>>24&255,t[e+5]=n>>16&255,t[e+6]=n>>8&255,t[e+7]=255&n}function b(t,e,r,n,i){var o,a=0;for(o=0;o>>8)-1}function m(t,e,r,n){return b(t,e,r,n,16)}function y(t,e,r,n){return b(t,e,r,n,32)}function g(t,e,r,n){!function(t,e,r,n){for(var i,o=255&n[0]|(255&n[1])<<8|(255&n[2])<<16|(255&n[3])<<24,a=255&r[0]|(255&r[1])<<8|(255&r[2])<<16|(255&r[3])<<24,s=255&r[4]|(255&r[5])<<8|(255&r[6])<<16|(255&r[7])<<24,f=255&r[8]|(255&r[9])<<8|(255&r[10])<<16|(255&r[11])<<24,u=255&r[12]|(255&r[13])<<8|(255&r[14])<<16|(255&r[15])<<24,h=255&n[4]|(255&n[5])<<8|(255&n[6])<<16|(255&n[7])<<24,c=255&e[0]|(255&e[1])<<8|(255&e[2])<<16|(255&e[3])<<24,d=255&e[4]|(255&e[5])<<8|(255&e[6])<<16|(255&e[7])<<24,l=255&e[8]|(255&e[9])<<8|(255&e[10])<<16|(255&e[11])<<24,p=255&e[12]|(255&e[13])<<8|(255&e[14])<<16|(255&e[15])<<24,b=255&n[8]|(255&n[9])<<8|(255&n[10])<<16|(255&n[11])<<24,m=255&r[16]|(255&r[17])<<8|(255&r[18])<<16|(255&r[19])<<24,y=255&r[20]|(255&r[21])<<8|(255&r[22])<<16|(255&r[23])<<24,g=255&r[24]|(255&r[25])<<8|(255&r[26])<<16|(255&r[27])<<24,v=255&r[28]|(255&r[29])<<8|(255&r[30])<<16|(255&r[31])<<24,w=255&n[12]|(255&n[13])<<8|(255&n[14])<<16|(255&n[15])<<24,_=o,M=a,S=s,x=f,A=u,E=h,k=c,R=d,T=l,B=p,I=b,L=m,P=y,j=g,O=v,C=w,N=0;N<20;N+=2)_^=(i=(P^=(i=(T^=(i=(A^=(i=_+P|0)<<7|i>>>25)+_|0)<<9|i>>>23)+A|0)<<13|i>>>19)+T|0)<<18|i>>>14,E^=(i=(M^=(i=(j^=(i=(B^=(i=E+M|0)<<7|i>>>25)+E|0)<<9|i>>>23)+B|0)<<13|i>>>19)+j|0)<<18|i>>>14,I^=(i=(k^=(i=(S^=(i=(O^=(i=I+k|0)<<7|i>>>25)+I|0)<<9|i>>>23)+O|0)<<13|i>>>19)+S|0)<<18|i>>>14,C^=(i=(L^=(i=(R^=(i=(x^=(i=C+L|0)<<7|i>>>25)+C|0)<<9|i>>>23)+x|0)<<13|i>>>19)+R|0)<<18|i>>>14,_^=(i=(x^=(i=(S^=(i=(M^=(i=_+x|0)<<7|i>>>25)+_|0)<<9|i>>>23)+M|0)<<13|i>>>19)+S|0)<<18|i>>>14,E^=(i=(A^=(i=(R^=(i=(k^=(i=E+A|0)<<7|i>>>25)+E|0)<<9|i>>>23)+k|0)<<13|i>>>19)+R|0)<<18|i>>>14,I^=(i=(B^=(i=(T^=(i=(L^=(i=I+B|0)<<7|i>>>25)+I|0)<<9|i>>>23)+L|0)<<13|i>>>19)+T|0)<<18|i>>>14,C^=(i=(O^=(i=(j^=(i=(P^=(i=C+O|0)<<7|i>>>25)+C|0)<<9|i>>>23)+P|0)<<13|i>>>19)+j|0)<<18|i>>>14;_=_+o|0,M=M+a|0,S=S+s|0,x=x+f|0,A=A+u|0,E=E+h|0,k=k+c|0,R=R+d|0,T=T+l|0,B=B+p|0,I=I+b|0,L=L+m|0,P=P+y|0,j=j+g|0,O=O+v|0,C=C+w|0,t[0]=_>>>0&255,t[1]=_>>>8&255,t[2]=_>>>16&255,t[3]=_>>>24&255,t[4]=M>>>0&255,t[5]=M>>>8&255,t[6]=M>>>16&255,t[7]=M>>>24&255,t[8]=S>>>0&255,t[9]=S>>>8&255,t[10]=S>>>16&255,t[11]=S>>>24&255,t[12]=x>>>0&255,t[13]=x>>>8&255,t[14]=x>>>16&255,t[15]=x>>>24&255,t[16]=A>>>0&255,t[17]=A>>>8&255,t[18]=A>>>16&255,t[19]=A>>>24&255,t[20]=E>>>0&255,t[21]=E>>>8&255,t[22]=E>>>16&255,t[23]=E>>>24&255,t[24]=k>>>0&255,t[25]=k>>>8&255,t[26]=k>>>16&255,t[27]=k>>>24&255,t[28]=R>>>0&255,t[29]=R>>>8&255,t[30]=R>>>16&255,t[31]=R>>>24&255,t[32]=T>>>0&255,t[33]=T>>>8&255,t[34]=T>>>16&255,t[35]=T>>>24&255,t[36]=B>>>0&255,t[37]=B>>>8&255,t[38]=B>>>16&255,t[39]=B>>>24&255,t[40]=I>>>0&255,t[41]=I>>>8&255,t[42]=I>>>16&255,t[43]=I>>>24&255,t[44]=L>>>0&255,t[45]=L>>>8&255,t[46]=L>>>16&255,t[47]=L>>>24&255,t[48]=P>>>0&255,t[49]=P>>>8&255,t[50]=P>>>16&255,t[51]=P>>>24&255,t[52]=j>>>0&255,t[53]=j>>>8&255,t[54]=j>>>16&255,t[55]=j>>>24&255,t[56]=O>>>0&255,t[57]=O>>>8&255,t[58]=O>>>16&255,t[59]=O>>>24&255,t[60]=C>>>0&255,t[61]=C>>>8&255,t[62]=C>>>16&255,t[63]=C>>>24&255}(t,e,r,n)}function v(t,e,r,n){!function(t,e,r,n){for(var i,o=255&n[0]|(255&n[1])<<8|(255&n[2])<<16|(255&n[3])<<24,a=255&r[0]|(255&r[1])<<8|(255&r[2])<<16|(255&r[3])<<24,s=255&r[4]|(255&r[5])<<8|(255&r[6])<<16|(255&r[7])<<24,f=255&r[8]|(255&r[9])<<8|(255&r[10])<<16|(255&r[11])<<24,u=255&r[12]|(255&r[13])<<8|(255&r[14])<<16|(255&r[15])<<24,h=255&n[4]|(255&n[5])<<8|(255&n[6])<<16|(255&n[7])<<24,c=255&e[0]|(255&e[1])<<8|(255&e[2])<<16|(255&e[3])<<24,d=255&e[4]|(255&e[5])<<8|(255&e[6])<<16|(255&e[7])<<24,l=255&e[8]|(255&e[9])<<8|(255&e[10])<<16|(255&e[11])<<24,p=255&e[12]|(255&e[13])<<8|(255&e[14])<<16|(255&e[15])<<24,b=255&n[8]|(255&n[9])<<8|(255&n[10])<<16|(255&n[11])<<24,m=255&r[16]|(255&r[17])<<8|(255&r[18])<<16|(255&r[19])<<24,y=255&r[20]|(255&r[21])<<8|(255&r[22])<<16|(255&r[23])<<24,g=255&r[24]|(255&r[25])<<8|(255&r[26])<<16|(255&r[27])<<24,v=255&r[28]|(255&r[29])<<8|(255&r[30])<<16|(255&r[31])<<24,w=255&n[12]|(255&n[13])<<8|(255&n[14])<<16|(255&n[15])<<24,_=0;_<20;_+=2)o^=(i=(y^=(i=(l^=(i=(u^=(i=o+y|0)<<7|i>>>25)+o|0)<<9|i>>>23)+u|0)<<13|i>>>19)+l|0)<<18|i>>>14,h^=(i=(a^=(i=(g^=(i=(p^=(i=h+a|0)<<7|i>>>25)+h|0)<<9|i>>>23)+p|0)<<13|i>>>19)+g|0)<<18|i>>>14,b^=(i=(c^=(i=(s^=(i=(v^=(i=b+c|0)<<7|i>>>25)+b|0)<<9|i>>>23)+v|0)<<13|i>>>19)+s|0)<<18|i>>>14,w^=(i=(m^=(i=(d^=(i=(f^=(i=w+m|0)<<7|i>>>25)+w|0)<<9|i>>>23)+f|0)<<13|i>>>19)+d|0)<<18|i>>>14,o^=(i=(f^=(i=(s^=(i=(a^=(i=o+f|0)<<7|i>>>25)+o|0)<<9|i>>>23)+a|0)<<13|i>>>19)+s|0)<<18|i>>>14,h^=(i=(u^=(i=(d^=(i=(c^=(i=h+u|0)<<7|i>>>25)+h|0)<<9|i>>>23)+c|0)<<13|i>>>19)+d|0)<<18|i>>>14,b^=(i=(p^=(i=(l^=(i=(m^=(i=b+p|0)<<7|i>>>25)+b|0)<<9|i>>>23)+m|0)<<13|i>>>19)+l|0)<<18|i>>>14,w^=(i=(v^=(i=(g^=(i=(y^=(i=w+v|0)<<7|i>>>25)+w|0)<<9|i>>>23)+y|0)<<13|i>>>19)+g|0)<<18|i>>>14;t[0]=o>>>0&255,t[1]=o>>>8&255,t[2]=o>>>16&255,t[3]=o>>>24&255,t[4]=h>>>0&255,t[5]=h>>>8&255,t[6]=h>>>16&255,t[7]=h>>>24&255,t[8]=b>>>0&255,t[9]=b>>>8&255,t[10]=b>>>16&255,t[11]=b>>>24&255,t[12]=w>>>0&255,t[13]=w>>>8&255,t[14]=w>>>16&255,t[15]=w>>>24&255,t[16]=c>>>0&255,t[17]=c>>>8&255,t[18]=c>>>16&255,t[19]=c>>>24&255,t[20]=d>>>0&255,t[21]=d>>>8&255,t[22]=d>>>16&255,t[23]=d>>>24&255,t[24]=l>>>0&255,t[25]=l>>>8&255,t[26]=l>>>16&255,t[27]=l>>>24&255,t[28]=p>>>0&255,t[29]=p>>>8&255,t[30]=p>>>16&255,t[31]=p>>>24&255}(t,e,r,n)}var w=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function _(t,e,r,n,i,o,a){var s,f,u=new Uint8Array(16),h=new Uint8Array(64);for(f=0;f<16;f++)u[f]=0;for(f=0;f<8;f++)u[f]=o[f];for(;i>=64;){for(g(h,u,a,w),f=0;f<64;f++)t[e+f]=r[n+f]^h[f];for(s=1,f=8;f<16;f++)s=s+(255&u[f])|0,u[f]=255&s,s>>>=8;i-=64,e+=64,n+=64}if(i>0)for(g(h,u,a,w),f=0;f=64;){for(g(f,s,i,w),a=0;a<64;a++)t[e+a]=f[a];for(o=1,a=8;a<16;a++)o=o+(255&s[a])|0,s[a]=255&o,o>>>=8;r-=64,e+=64}if(r>0)for(g(f,s,i,w),a=0;a>>13|r<<3),n=255&t[4]|(255&t[5])<<8,this.r[2]=7939&(r>>>10|n<<6),i=255&t[6]|(255&t[7])<<8,this.r[3]=8191&(n>>>7|i<<9),o=255&t[8]|(255&t[9])<<8,this.r[4]=255&(i>>>4|o<<12),this.r[5]=o>>>1&8190,a=255&t[10]|(255&t[11])<<8,this.r[6]=8191&(o>>>14|a<<2),s=255&t[12]|(255&t[13])<<8,this.r[7]=8065&(a>>>11|s<<5),f=255&t[14]|(255&t[15])<<8,this.r[8]=8191&(s>>>8|f<<8),this.r[9]=f>>>5&127,this.pad[0]=255&t[16]|(255&t[17])<<8,this.pad[1]=255&t[18]|(255&t[19])<<8,this.pad[2]=255&t[20]|(255&t[21])<<8,this.pad[3]=255&t[22]|(255&t[23])<<8,this.pad[4]=255&t[24]|(255&t[25])<<8,this.pad[5]=255&t[26]|(255&t[27])<<8,this.pad[6]=255&t[28]|(255&t[29])<<8,this.pad[7]=255&t[30]|(255&t[31])<<8};function E(t,e,r,n,i,o){var a=new A(o);return a.update(r,n,i),a.finish(t,e),0}function k(t,e,r,n,i,o){var a=new Uint8Array(16);return E(a,0,r,n,i,o),m(t,e,a,0)}function R(t,e,r,n,i){var o;if(r<32)return-1;for(x(t,0,e,0,r,n,i),E(t,16,t,32,r-32,t),o=0;o<16;o++)t[o]=0;return 0}function T(t,e,r,n,i){var o,a=new Uint8Array(32);if(r<32)return-1;if(S(a,0,32,n,i),0!==k(e,16,e,32,r-32,a))return-1;for(x(t,0,e,0,r,n,i),o=0;o<32;o++)t[o]=0;return 0}function B(t,e){var r;for(r=0;r<16;r++)t[r]=0|e[r]}function I(t){var e,r,n=1;for(e=0;e<16;e++)r=t[e]+n+65535,n=Math.floor(r/65536),t[e]=r-65536*n;t[0]+=n-1+37*(n-1)}function L(t,e,r){for(var n,i=~(r-1),o=0;o<16;o++)n=i&(t[o]^e[o]),t[o]^=n,e[o]^=n}function P(t,e){var n,i,o,a=r(),s=r();for(n=0;n<16;n++)s[n]=e[n];for(I(s),I(s),I(s),i=0;i<2;i++){for(a[0]=s[0]-65517,n=1;n<15;n++)a[n]=s[n]-65535-(a[n-1]>>16&1),a[n-1]&=65535;a[15]=s[15]-32767-(a[14]>>16&1),o=a[15]>>16&1,a[14]&=65535,L(s,a,1-o)}for(n=0;n<16;n++)t[2*n]=255&s[n],t[2*n+1]=s[n]>>8}function j(t,e){var r=new Uint8Array(32),n=new Uint8Array(32);return P(r,t),P(n,e),y(r,0,n,0)}function O(t){var e=new Uint8Array(32);return P(e,t),1&e[0]}function C(t,e){var r;for(r=0;r<16;r++)t[r]=e[2*r]+(e[2*r+1]<<8);t[15]&=32767}function N(t,e,r){for(var n=0;n<16;n++)t[n]=e[n]+r[n]}function z(t,e,r){for(var n=0;n<16;n++)t[n]=e[n]-r[n]}function U(t,e,r){var n,i,o=0,a=0,s=0,f=0,u=0,h=0,c=0,d=0,l=0,p=0,b=0,m=0,y=0,g=0,v=0,w=0,_=0,M=0,S=0,x=0,A=0,E=0,k=0,R=0,T=0,B=0,I=0,L=0,P=0,j=0,O=0,C=r[0],N=r[1],z=r[2],U=r[3],q=r[4],K=r[5],D=r[6],H=r[7],F=r[8],W=r[9],Z=r[10],V=r[11],Y=r[12],J=r[13],X=r[14],G=r[15];o+=(n=e[0])*C,a+=n*N,s+=n*z,f+=n*U,u+=n*q,h+=n*K,c+=n*D,d+=n*H,l+=n*F,p+=n*W,b+=n*Z,m+=n*V,y+=n*Y,g+=n*J,v+=n*X,w+=n*G,a+=(n=e[1])*C,s+=n*N,f+=n*z,u+=n*U,h+=n*q,c+=n*K,d+=n*D,l+=n*H,p+=n*F,b+=n*W,m+=n*Z,y+=n*V,g+=n*Y,v+=n*J,w+=n*X,_+=n*G,s+=(n=e[2])*C,f+=n*N,u+=n*z,h+=n*U,c+=n*q,d+=n*K,l+=n*D,p+=n*H,b+=n*F,m+=n*W,y+=n*Z,g+=n*V,v+=n*Y,w+=n*J,_+=n*X,M+=n*G,f+=(n=e[3])*C,u+=n*N,h+=n*z,c+=n*U,d+=n*q,l+=n*K,p+=n*D,b+=n*H,m+=n*F,y+=n*W,g+=n*Z,v+=n*V,w+=n*Y,_+=n*J,M+=n*X,S+=n*G,u+=(n=e[4])*C,h+=n*N,c+=n*z,d+=n*U,l+=n*q,p+=n*K,b+=n*D,m+=n*H,y+=n*F,g+=n*W,v+=n*Z,w+=n*V,_+=n*Y,M+=n*J,S+=n*X,x+=n*G,h+=(n=e[5])*C,c+=n*N,d+=n*z,l+=n*U,p+=n*q,b+=n*K,m+=n*D,y+=n*H,g+=n*F,v+=n*W,w+=n*Z,_+=n*V,M+=n*Y,S+=n*J,x+=n*X,A+=n*G,c+=(n=e[6])*C,d+=n*N,l+=n*z,p+=n*U,b+=n*q,m+=n*K,y+=n*D,g+=n*H,v+=n*F,w+=n*W,_+=n*Z,M+=n*V,S+=n*Y,x+=n*J,A+=n*X,E+=n*G,d+=(n=e[7])*C,l+=n*N,p+=n*z,b+=n*U,m+=n*q,y+=n*K,g+=n*D,v+=n*H,w+=n*F,_+=n*W,M+=n*Z,S+=n*V,x+=n*Y,A+=n*J,E+=n*X,k+=n*G,l+=(n=e[8])*C,p+=n*N,b+=n*z,m+=n*U,y+=n*q,g+=n*K,v+=n*D,w+=n*H,_+=n*F,M+=n*W,S+=n*Z,x+=n*V,A+=n*Y,E+=n*J,k+=n*X,R+=n*G,p+=(n=e[9])*C,b+=n*N,m+=n*z,y+=n*U,g+=n*q,v+=n*K,w+=n*D,_+=n*H,M+=n*F,S+=n*W,x+=n*Z,A+=n*V,E+=n*Y,k+=n*J,R+=n*X,T+=n*G,b+=(n=e[10])*C,m+=n*N,y+=n*z,g+=n*U,v+=n*q,w+=n*K,_+=n*D,M+=n*H,S+=n*F,x+=n*W,A+=n*Z,E+=n*V,k+=n*Y,R+=n*J,T+=n*X,B+=n*G,m+=(n=e[11])*C,y+=n*N,g+=n*z,v+=n*U,w+=n*q,_+=n*K,M+=n*D,S+=n*H,x+=n*F,A+=n*W,E+=n*Z,k+=n*V,R+=n*Y,T+=n*J,B+=n*X,I+=n*G,y+=(n=e[12])*C,g+=n*N,v+=n*z,w+=n*U,_+=n*q,M+=n*K,S+=n*D,x+=n*H,A+=n*F,E+=n*W,k+=n*Z,R+=n*V,T+=n*Y,B+=n*J,I+=n*X,L+=n*G,g+=(n=e[13])*C,v+=n*N,w+=n*z,_+=n*U,M+=n*q,S+=n*K,x+=n*D,A+=n*H,E+=n*F,k+=n*W,R+=n*Z,T+=n*V,B+=n*Y,I+=n*J,L+=n*X,P+=n*G,v+=(n=e[14])*C,w+=n*N,_+=n*z,M+=n*U,S+=n*q,x+=n*K,A+=n*D,E+=n*H,k+=n*F,R+=n*W,T+=n*Z,B+=n*V,I+=n*Y,L+=n*J,P+=n*X,j+=n*G,w+=(n=e[15])*C,a+=38*(M+=n*z),s+=38*(S+=n*U),f+=38*(x+=n*q),u+=38*(A+=n*K),h+=38*(E+=n*D),c+=38*(k+=n*H),d+=38*(R+=n*F),l+=38*(T+=n*W),p+=38*(B+=n*Z),b+=38*(I+=n*V),m+=38*(L+=n*Y),y+=38*(P+=n*J),g+=38*(j+=n*X),v+=38*(O+=n*G),o=(n=(o+=38*(_+=n*N))+(i=1)+65535)-65536*(i=Math.floor(n/65536)),a=(n=a+i+65535)-65536*(i=Math.floor(n/65536)),s=(n=s+i+65535)-65536*(i=Math.floor(n/65536)),f=(n=f+i+65535)-65536*(i=Math.floor(n/65536)),u=(n=u+i+65535)-65536*(i=Math.floor(n/65536)),h=(n=h+i+65535)-65536*(i=Math.floor(n/65536)),c=(n=c+i+65535)-65536*(i=Math.floor(n/65536)),d=(n=d+i+65535)-65536*(i=Math.floor(n/65536)),l=(n=l+i+65535)-65536*(i=Math.floor(n/65536)),p=(n=p+i+65535)-65536*(i=Math.floor(n/65536)),b=(n=b+i+65535)-65536*(i=Math.floor(n/65536)),m=(n=m+i+65535)-65536*(i=Math.floor(n/65536)),y=(n=y+i+65535)-65536*(i=Math.floor(n/65536)),g=(n=g+i+65535)-65536*(i=Math.floor(n/65536)),v=(n=v+i+65535)-65536*(i=Math.floor(n/65536)),w=(n=w+i+65535)-65536*(i=Math.floor(n/65536)),o=(n=(o+=i-1+37*(i-1))+(i=1)+65535)-65536*(i=Math.floor(n/65536)),a=(n=a+i+65535)-65536*(i=Math.floor(n/65536)),s=(n=s+i+65535)-65536*(i=Math.floor(n/65536)),f=(n=f+i+65535)-65536*(i=Math.floor(n/65536)),u=(n=u+i+65535)-65536*(i=Math.floor(n/65536)),h=(n=h+i+65535)-65536*(i=Math.floor(n/65536)),c=(n=c+i+65535)-65536*(i=Math.floor(n/65536)),d=(n=d+i+65535)-65536*(i=Math.floor(n/65536)),l=(n=l+i+65535)-65536*(i=Math.floor(n/65536)),p=(n=p+i+65535)-65536*(i=Math.floor(n/65536)),b=(n=b+i+65535)-65536*(i=Math.floor(n/65536)),m=(n=m+i+65535)-65536*(i=Math.floor(n/65536)),y=(n=y+i+65535)-65536*(i=Math.floor(n/65536)),g=(n=g+i+65535)-65536*(i=Math.floor(n/65536)),v=(n=v+i+65535)-65536*(i=Math.floor(n/65536)),w=(n=w+i+65535)-65536*(i=Math.floor(n/65536)),o+=i-1+37*(i-1),t[0]=o,t[1]=a,t[2]=s,t[3]=f,t[4]=u,t[5]=h,t[6]=c,t[7]=d,t[8]=l,t[9]=p,t[10]=b,t[11]=m,t[12]=y,t[13]=g,t[14]=v,t[15]=w}function q(t,e){U(t,e,e)}function K(t,e){var n,i=r();for(n=0;n<16;n++)i[n]=e[n];for(n=253;n>=0;n--)q(i,i),2!==n&&4!==n&&U(i,i,e);for(n=0;n<16;n++)t[n]=i[n]}function D(t,e){var n,i=r();for(n=0;n<16;n++)i[n]=e[n];for(n=250;n>=0;n--)q(i,i),1!==n&&U(i,i,e);for(n=0;n<16;n++)t[n]=i[n]}function H(t,e,n){var i,o,a=new Uint8Array(32),s=new Float64Array(80),u=r(),h=r(),c=r(),d=r(),l=r(),p=r();for(o=0;o<31;o++)a[o]=e[o];for(a[31]=127&e[31]|64,a[0]&=248,C(s,n),o=0;o<16;o++)h[o]=s[o],d[o]=u[o]=c[o]=0;for(u[0]=d[0]=1,o=254;o>=0;--o)L(u,h,i=a[o>>>3]>>>(7&o)&1),L(c,d,i),N(l,u,c),z(u,u,c),N(c,h,d),z(h,h,d),q(d,l),q(p,u),U(u,c,u),U(c,h,l),N(l,u,c),z(u,u,c),q(h,u),z(c,d,p),U(u,c,f),N(u,u,d),U(c,c,u),U(u,d,p),U(d,h,s),q(h,l),L(u,h,i),L(c,d,i);for(o=0;o<16;o++)s[o+16]=u[o],s[o+32]=c[o],s[o+48]=h[o],s[o+64]=d[o];var b=s.subarray(32),m=s.subarray(16);return K(b,b),U(m,m,b),P(t,m),0}function F(t,e){return H(t,e,o)}function W(t,e){return n(e,32),F(t,e)}function Z(t,e,r){var n=new Uint8Array(32);return H(n,r,e),v(t,i,n,w)}A.prototype.blocks=function(t,e,r){for(var n,i,o,a,s,f,u,h,c,d,l,p,b,m,y,g,v,w,_,M=this.fin?0:2048,S=this.h[0],x=this.h[1],A=this.h[2],E=this.h[3],k=this.h[4],R=this.h[5],T=this.h[6],B=this.h[7],I=this.h[8],L=this.h[9],P=this.r[0],j=this.r[1],O=this.r[2],C=this.r[3],N=this.r[4],z=this.r[5],U=this.r[6],q=this.r[7],K=this.r[8],D=this.r[9];r>=16;)d=c=0,d+=(S+=8191&(n=255&t[e+0]|(255&t[e+1])<<8))*P,d+=(x+=8191&(n>>>13|(i=255&t[e+2]|(255&t[e+3])<<8)<<3))*(5*D),d+=(A+=8191&(i>>>10|(o=255&t[e+4]|(255&t[e+5])<<8)<<6))*(5*K),d+=(E+=8191&(o>>>7|(a=255&t[e+6]|(255&t[e+7])<<8)<<9))*(5*q),c=(d+=(k+=8191&(a>>>4|(s=255&t[e+8]|(255&t[e+9])<<8)<<12))*(5*U))>>>13,d&=8191,d+=(R+=s>>>1&8191)*(5*z),d+=(T+=8191&(s>>>14|(f=255&t[e+10]|(255&t[e+11])<<8)<<2))*(5*N),d+=(B+=8191&(f>>>11|(u=255&t[e+12]|(255&t[e+13])<<8)<<5))*(5*C),d+=(I+=8191&(u>>>8|(h=255&t[e+14]|(255&t[e+15])<<8)<<8))*(5*O),l=c+=(d+=(L+=h>>>5|M)*(5*j))>>>13,l+=S*j,l+=x*P,l+=A*(5*D),l+=E*(5*K),c=(l+=k*(5*q))>>>13,l&=8191,l+=R*(5*U),l+=T*(5*z),l+=B*(5*N),l+=I*(5*C),c+=(l+=L*(5*O))>>>13,l&=8191,p=c,p+=S*O,p+=x*j,p+=A*P,p+=E*(5*D),c=(p+=k*(5*K))>>>13,p&=8191,p+=R*(5*q),p+=T*(5*U),p+=B*(5*z),p+=I*(5*N),b=c+=(p+=L*(5*C))>>>13,b+=S*C,b+=x*O,b+=A*j,b+=E*P,c=(b+=k*(5*D))>>>13,b&=8191,b+=R*(5*K),b+=T*(5*q),b+=B*(5*U),b+=I*(5*z),m=c+=(b+=L*(5*N))>>>13,m+=S*N,m+=x*C,m+=A*O,m+=E*j,c=(m+=k*P)>>>13,m&=8191,m+=R*(5*D),m+=T*(5*K),m+=B*(5*q),m+=I*(5*U),y=c+=(m+=L*(5*z))>>>13,y+=S*z,y+=x*N,y+=A*C,y+=E*O,c=(y+=k*j)>>>13,y&=8191,y+=R*P,y+=T*(5*D),y+=B*(5*K),y+=I*(5*q),g=c+=(y+=L*(5*U))>>>13,g+=S*U,g+=x*z,g+=A*N,g+=E*C,c=(g+=k*O)>>>13,g&=8191,g+=R*j,g+=T*P,g+=B*(5*D),g+=I*(5*K),v=c+=(g+=L*(5*q))>>>13,v+=S*q,v+=x*U,v+=A*z,v+=E*N,c=(v+=k*C)>>>13,v&=8191,v+=R*O,v+=T*j,v+=B*P,v+=I*(5*D),w=c+=(v+=L*(5*K))>>>13,w+=S*K,w+=x*q,w+=A*U,w+=E*z,c=(w+=k*N)>>>13,w&=8191,w+=R*C,w+=T*O,w+=B*j,w+=I*P,_=c+=(w+=L*(5*D))>>>13,_+=S*D,_+=x*K,_+=A*q,_+=E*U,c=(_+=k*z)>>>13,_&=8191,_+=R*N,_+=T*C,_+=B*O,_+=I*j,S=d=8191&(c=(c=((c+=(_+=L*P)>>>13)<<2)+c|0)+(d&=8191)|0),x=l+=c>>>=13,A=p&=8191,E=b&=8191,k=m&=8191,R=y&=8191,T=g&=8191,B=v&=8191,I=w&=8191,L=_&=8191,e+=16,r-=16;this.h[0]=S,this.h[1]=x,this.h[2]=A,this.h[3]=E,this.h[4]=k,this.h[5]=R,this.h[6]=T,this.h[7]=B,this.h[8]=I,this.h[9]=L},A.prototype.finish=function(t,e){var r,n,i,o,a=new Uint16Array(10);if(this.leftover){for(o=this.leftover,this.buffer[o++]=1;o<16;o++)this.buffer[o]=0;this.fin=1,this.blocks(this.buffer,0,16)}for(r=this.h[1]>>>13,this.h[1]&=8191,o=2;o<10;o++)this.h[o]+=r,r=this.h[o]>>>13,this.h[o]&=8191;for(this.h[0]+=5*r,r=this.h[0]>>>13,this.h[0]&=8191,this.h[1]+=r,r=this.h[1]>>>13,this.h[1]&=8191,this.h[2]+=r,a[0]=this.h[0]+5,r=a[0]>>>13,a[0]&=8191,o=1;o<10;o++)a[o]=this.h[o]+r,r=a[o]>>>13,a[o]&=8191;for(a[9]-=8192,n=(1^r)-1,o=0;o<10;o++)a[o]&=n;for(n=~n,o=0;o<10;o++)this.h[o]=this.h[o]&n|a[o];for(this.h[0]=65535&(this.h[0]|this.h[1]<<13),this.h[1]=65535&(this.h[1]>>>3|this.h[2]<<10),this.h[2]=65535&(this.h[2]>>>6|this.h[3]<<7),this.h[3]=65535&(this.h[3]>>>9|this.h[4]<<4),this.h[4]=65535&(this.h[4]>>>12|this.h[5]<<1|this.h[6]<<14),this.h[5]=65535&(this.h[6]>>>2|this.h[7]<<11),this.h[6]=65535&(this.h[7]>>>5|this.h[8]<<8),this.h[7]=65535&(this.h[8]>>>8|this.h[9]<<5),i=this.h[0]+this.pad[0],this.h[0]=65535&i,o=1;o<8;o++)i=(this.h[o]+this.pad[o]|0)+(i>>>16)|0,this.h[o]=65535&i;t[e+0]=this.h[0]>>>0&255,t[e+1]=this.h[0]>>>8&255,t[e+2]=this.h[1]>>>0&255,t[e+3]=this.h[1]>>>8&255,t[e+4]=this.h[2]>>>0&255,t[e+5]=this.h[2]>>>8&255,t[e+6]=this.h[3]>>>0&255,t[e+7]=this.h[3]>>>8&255,t[e+8]=this.h[4]>>>0&255,t[e+9]=this.h[4]>>>8&255,t[e+10]=this.h[5]>>>0&255,t[e+11]=this.h[5]>>>8&255,t[e+12]=this.h[6]>>>0&255,t[e+13]=this.h[6]>>>8&255,t[e+14]=this.h[7]>>>0&255,t[e+15]=this.h[7]>>>8&255},A.prototype.update=function(t,e,r){var n,i;if(this.leftover){for((i=16-this.leftover)>r&&(i=r),n=0;n=16&&(i=r-r%16,this.blocks(t,e,i),e+=i,r-=i),r){for(n=0;n=128;){for(M=0;M<16;M++)S=8*M+Y,B[M]=r[S+0]<<24|r[S+1]<<16|r[S+2]<<8|r[S+3],I[M]=r[S+4]<<24|r[S+5]<<16|r[S+6]<<8|r[S+7];for(M=0;M<80;M++)if(i=L,o=P,a=j,s=O,f=C,u=N,h=z,U,d=q,l=K,p=D,b=H,m=F,y=W,g=Z,V,E=65535&(A=V),k=A>>>16,R=65535&(x=U),T=x>>>16,E+=65535&(A=(F>>>14|C<<18)^(F>>>18|C<<14)^(C>>>9|F<<23)),k+=A>>>16,R+=65535&(x=(C>>>14|F<<18)^(C>>>18|F<<14)^(F>>>9|C<<23)),T+=x>>>16,E+=65535&(A=F&W^~F&Z),k+=A>>>16,R+=65535&(x=C&N^~C&z),T+=x>>>16,E+=65535&(A=J[2*M+1]),k+=A>>>16,R+=65535&(x=J[2*M]),T+=x>>>16,x=B[M%16],k+=(A=I[M%16])>>>16,R+=65535&x,T+=x>>>16,R+=(k+=(E+=65535&A)>>>16)>>>16,E=65535&(A=_=65535&E|k<<16),k=A>>>16,R=65535&(x=w=65535&R|(T+=R>>>16)<<16),T=x>>>16,E+=65535&(A=(q>>>28|L<<4)^(L>>>2|q<<30)^(L>>>7|q<<25)),k+=A>>>16,R+=65535&(x=(L>>>28|q<<4)^(q>>>2|L<<30)^(q>>>7|L<<25)),T+=x>>>16,k+=(A=q&K^q&D^K&D)>>>16,R+=65535&(x=L&P^L&j^P&j),T+=x>>>16,c=65535&(R+=(k+=(E+=65535&A)>>>16)>>>16)|(T+=R>>>16)<<16,v=65535&E|k<<16,E=65535&(A=b),k=A>>>16,R=65535&(x=s),T=x>>>16,k+=(A=_)>>>16,R+=65535&(x=w),T+=x>>>16,P=i,j=o,O=a,C=s=65535&(R+=(k+=(E+=65535&A)>>>16)>>>16)|(T+=R>>>16)<<16,N=f,z=u,U=h,L=c,K=d,D=l,H=p,F=b=65535&E|k<<16,W=m,Z=y,V=g,q=v,M%16==15)for(S=0;S<16;S++)x=B[S],E=65535&(A=I[S]),k=A>>>16,R=65535&x,T=x>>>16,x=B[(S+9)%16],E+=65535&(A=I[(S+9)%16]),k+=A>>>16,R+=65535&x,T+=x>>>16,w=B[(S+1)%16],E+=65535&(A=((_=I[(S+1)%16])>>>1|w<<31)^(_>>>8|w<<24)^(_>>>7|w<<25)),k+=A>>>16,R+=65535&(x=(w>>>1|_<<31)^(w>>>8|_<<24)^w>>>7),T+=x>>>16,w=B[(S+14)%16],k+=(A=((_=I[(S+14)%16])>>>19|w<<13)^(w>>>29|_<<3)^(_>>>6|w<<26))>>>16,R+=65535&(x=(w>>>19|_<<13)^(_>>>29|w<<3)^w>>>6),T+=x>>>16,T+=(R+=(k+=(E+=65535&A)>>>16)>>>16)>>>16,B[S]=65535&R|T<<16,I[S]=65535&E|k<<16;E=65535&(A=q),k=A>>>16,R=65535&(x=L),T=x>>>16,x=t[0],k+=(A=e[0])>>>16,R+=65535&x,T+=x>>>16,T+=(R+=(k+=(E+=65535&A)>>>16)>>>16)>>>16,t[0]=L=65535&R|T<<16,e[0]=q=65535&E|k<<16,E=65535&(A=K),k=A>>>16,R=65535&(x=P),T=x>>>16,x=t[1],k+=(A=e[1])>>>16,R+=65535&x,T+=x>>>16,T+=(R+=(k+=(E+=65535&A)>>>16)>>>16)>>>16,t[1]=P=65535&R|T<<16,e[1]=K=65535&E|k<<16,E=65535&(A=D),k=A>>>16,R=65535&(x=j),T=x>>>16,x=t[2],k+=(A=e[2])>>>16,R+=65535&x,T+=x>>>16,T+=(R+=(k+=(E+=65535&A)>>>16)>>>16)>>>16,t[2]=j=65535&R|T<<16,e[2]=D=65535&E|k<<16,E=65535&(A=H),k=A>>>16,R=65535&(x=O),T=x>>>16,x=t[3],k+=(A=e[3])>>>16,R+=65535&x,T+=x>>>16,T+=(R+=(k+=(E+=65535&A)>>>16)>>>16)>>>16,t[3]=O=65535&R|T<<16,e[3]=H=65535&E|k<<16,E=65535&(A=F),k=A>>>16,R=65535&(x=C),T=x>>>16,x=t[4],k+=(A=e[4])>>>16,R+=65535&x,T+=x>>>16,T+=(R+=(k+=(E+=65535&A)>>>16)>>>16)>>>16,t[4]=C=65535&R|T<<16,e[4]=F=65535&E|k<<16,E=65535&(A=W),k=A>>>16,R=65535&(x=N),T=x>>>16,x=t[5],k+=(A=e[5])>>>16,R+=65535&x,T+=x>>>16,T+=(R+=(k+=(E+=65535&A)>>>16)>>>16)>>>16,t[5]=N=65535&R|T<<16,e[5]=W=65535&E|k<<16,E=65535&(A=Z),k=A>>>16,R=65535&(x=z),T=x>>>16,x=t[6],k+=(A=e[6])>>>16,R+=65535&x,T+=x>>>16,T+=(R+=(k+=(E+=65535&A)>>>16)>>>16)>>>16,t[6]=z=65535&R|T<<16,e[6]=Z=65535&E|k<<16,E=65535&(A=V),k=A>>>16,R=65535&(x=U),T=x>>>16,x=t[7],k+=(A=e[7])>>>16,R+=65535&x,T+=x>>>16,T+=(R+=(k+=(E+=65535&A)>>>16)>>>16)>>>16,t[7]=U=65535&R|T<<16,e[7]=V=65535&E|k<<16,Y+=128,n-=128}return n}function G(t,e,r){var n,i=new Int32Array(8),o=new Int32Array(8),a=new Uint8Array(256),s=r;for(i[0]=1779033703,i[1]=3144134277,i[2]=1013904242,i[3]=2773480762,i[4]=1359893119,i[5]=2600822924,i[6]=528734635,i[7]=1541459225,o[0]=4089235720,o[1]=2227873595,o[2]=4271175723,o[3]=1595750129,o[4]=2917565137,o[5]=725511199,o[6]=4215389547,o[7]=327033209,X(i,o,e,r),r%=128,n=0;n=0;--i)Q(t,e,n=r[i/8|0]>>(7&i)&1),$(e,t),$(t,t),Q(t,e,n)}function rt(t,e){var n=[r(),r(),r(),r()];B(n[0],c),B(n[1],d),B(n[2],s),U(n[3],c,d),et(t,n,e)}function nt(t,e,i){var o,a=new Uint8Array(64),s=[r(),r(),r(),r()];for(i||n(e,32),G(a,e,32),a[0]&=248,a[31]&=127,a[31]|=64,rt(s,a),tt(t,s),o=0;o<32;o++)e[o+32]=t[o];return 0}var it=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function ot(t,e){var r,n,i,o;for(n=63;n>=32;--n){for(r=0,i=n-32,o=n-12;i>4)*it[i],r=e[i]>>8,e[i]&=255;for(i=0;i<32;i++)e[i]-=r*it[i];for(n=0;n<32;n++)e[n+1]+=e[n]>>8,t[n]=255&e[n]}function at(t){var e,r=new Float64Array(64);for(e=0;e<64;e++)r[e]=t[e];for(e=0;e<64;e++)t[e]=0;ot(t,r)}function st(t,e,n,i){var o,a,s=new Uint8Array(64),f=new Uint8Array(64),u=new Uint8Array(64),h=new Float64Array(64),c=[r(),r(),r(),r()];G(s,i,32),s[0]&=248,s[31]&=127,s[31]|=64;var d=n+64;for(o=0;o>7&&z(t[0],a,t[0]),U(t[3],t[0],t[1]),0)}(d,i))return-1;for(o=0;o=0},e.sign.keyPair=function(){var t=new Uint8Array(ct),e=new Uint8Array(dt);return nt(t,e),{publicKey:t,secretKey:e}},e.sign.keyPair.fromSecretKey=function(t){if(pt(t),t.length!==dt)throw new Error("bad secret key size");for(var e=new Uint8Array(ct),r=0;r0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]o)throw new Error("Elements exceed array size: "+o);for(l in c=[],t=t.slice(0,t.lastIndexOf("[")),"string"==typeof e&&(e=JSON.parse(e)),e)c.push(d(t,e[l]));if("dynamic"===o){var p=d("uint256",e.length);c.unshift(p)}return r.concat(c)}if("bytes"===t)return e=new r(e),c=r.concat([d("uint256",e.length),e]),e.length%32!=0&&(c=r.concat([c,n.zeros(32-e.length%32)])),c;if(t.startsWith("bytes")){if((o=s(t))<1||o>32)throw new Error("Invalid bytes width: "+o);return n.setLengthRight(e,32)}if(t.startsWith("uint")){if((o=s(t))%8||o<8||o>256)throw new Error("Invalid uint width: "+o);if((a=h(e)).bitLength()>o)throw new Error("Supplied uint exceeds width: "+o+" vs "+a.bitLength());if(a<0)throw new Error("Supplied uint is negative");return a.toArrayLike(r,"be",32)}if(t.startsWith("int")){if((o=s(t))%8||o<8||o>256)throw new Error("Invalid int width: "+o);if((a=h(e)).bitLength()>o)throw new Error("Supplied int exceeds width: "+o+" vs "+a.bitLength());return a.toTwos(256).toArrayLike(r,"be",32)}if(t.startsWith("ufixed")){if(o=f(t),(a=h(e))<0)throw new Error("Supplied ufixed is negative");return d("uint256",a.mul(new i(2).pow(new i(o[1]))))}if(t.startsWith("fixed"))return o=f(t),d("int256",h(e).mul(new i(2).pow(new i(o[1]))));throw new Error("Unsupported or invalid type: "+t)}function l(t,e,n){var o,a,s,f;if("string"==typeof t&&(t=p(t)),"address"===t.name)return l(t.rawType,e,n).toArrayLike(r,"be",20).toString("hex");if("bool"===t.name)return l(t.rawType,e,n).toString()===new i(1).toString();if("string"===t.name){var u=l(t.rawType,e,n);return new r(u,"utf8").toString()}if(t.isArray){for(s=[],o=t.size,"dynamic"===t.size&&(n=l("uint256",e,n).toNumber(),o=l("uint256",e,n).toNumber(),n+=32),f=0;ft.size)throw new Error("Decoded int exceeds width: "+t.size+" vs "+a.bitLength());return a}if(t.name.startsWith("int")){if((a=new i(e.slice(n,n+32),16,"be").fromTwos(256)).bitLength()>t.size)throw new Error("Decoded uint exceeds width: "+t.size+" vs "+a.bitLength());return a}if(t.name.startsWith("ufixed")){if(o=new i(2).pow(new i(t.size[1])),!(a=l("uint256",e,n)).mod(o).isZero())throw new Error("Decimals not supported yet");return a.div(o)}if(t.name.startsWith("fixed")){if(o=new i(2).pow(new i(t.size[1])),!(a=l("int256",e,n)).mod(o).isZero())throw new Error("Decimals not supported yet");return a.div(o)}throw new Error("Unsupported or invalid type: "+t.name)}function p(t){var e,r,n;if(m(t)){e=u(t);var i=t.slice(0,t.lastIndexOf("["));return i=p(i),r={isArray:!0,name:t,size:e,memoryUsage:"dynamic"===e?32:i.memoryUsage*e,subArray:i}}switch(t){case"address":n="uint160";break;case"bool":n="uint8";break;case"string":n="bytes"}if(r={rawType:n,name:t,memoryUsage:32},t.startsWith("bytes")&&"bytes"!==t||t.startsWith("uint")||t.startsWith("int")?r.size=s(t):(t.startsWith("ufixed")||t.startsWith("fixed"))&&(r.size=f(t)),t.startsWith("bytes")&&"bytes"!==t&&(r.size<1||r.size>32))throw new Error("Invalid bytes width: "+r.size);if((t.startsWith("uint")||t.startsWith("int"))&&(r.size%8||r.size<8||r.size>256))throw new Error("Invalid int/uint width: "+r.size);return r}function b(t){return"string"===t||"bytes"===t||"dynamic"===u(t)}function m(t){return t.lastIndexOf("]")===t.length-1}function y(t,e){return t.startsWith("address")||t.startsWith("bytes")?"0x"+e.toString("hex"):e.toString()}o.eventID=function(t,e){var i=t+"("+e.map(a).join(",")+")";return n.sha3(new r(i))},o.methodID=function(t,e){return o.eventID(t,e).slice(0,4)},o.rawEncode=function(t,e){var n=[],i=[],o=32*t.length;for(var s in t){var f=a(t[s]),u=d(f,e[s]);b(f)?(n.push(d("uint256",o)),i.push(u),o+=u.length):n.push(u)}return r.concat(n.concat(i))},o.rawDecode=function(t,e){var n=[];e=new r(e);var i=0;for(var o in t){var s=p(a(t[o])),f=l(s,e,i);i+=s.memoryUsage,n.push(f)}return n},o.simpleEncode=function(t){var e=Array.prototype.slice.call(arguments).slice(1),n=c(t);if(e.length!==n.args.length)throw new Error("Argument count mismatch");return r.concat([o.methodID(n.method,n.args),o.rawEncode(n.args,e)])},o.simpleDecode=function(t,e){var r=c(t);if(!r.retargs)throw new Error("No return values in method");return o.rawDecode(r.retargs,e)},o.stringify=function(t,e){var r=[];for(var n in t){var i=t[n],o=e[n];o=/^[^\[]+\[.*\]$/.test(i)?o.map((function(t){return y(i,t)})).join(", "):y(i,o),r.push(o)}return r},o.solidityPack=function(t,e){if(t.length!==e.length)throw new Error("Number of types are not matching the values");for(var i,o,f=[],u=0;u32)throw new Error("Invalid bytes width: "+i);f.push(n.setLengthRight(d,i))}else if(c.startsWith("uint")){if((i=s(c))%8||i<8||i>256)throw new Error("Invalid uint width: "+i);if((o=h(d)).bitLength()>i)throw new Error("Supplied uint exceeds width: "+i+" vs "+o.bitLength());f.push(o.toArrayLike(r,"be",i/8))}else{if(!c.startsWith("int"))throw new Error("Unsupported or invalid type: "+c);if((i=s(c))%8||i<8||i>256)throw new Error("Invalid int width: "+i);if((o=h(d)).bitLength()>i)throw new Error("Supplied int exceeds width: "+i+" vs "+o.bitLength());f.push(o.toTwos(i).toArrayLike(r,"be",i/8))}}return r.concat(f)},o.soliditySHA3=function(t,e){return n.sha3(o.solidityPack(t,e))},o.soliditySHA256=function(t,e){return n.sha256(o.solidityPack(t,e))},o.solidityRIPEMD160=function(t,e){return n.ripemd160(o.solidityPack(t,e),!0)},o.fromSerpent=function(t){for(var e,r=[],n=0;n="0"&&e<="9");)o+=t[a]-"0",a++;n=a-1,r.push(o)}else if("i"===i)r.push("int256");else{if("a"!==i)throw new Error("Unsupported or invalid type: "+i);r.push("int256[]")}}return r},o.toSerpent=function(t){for(var e=[],r=0;r0&&"0"===e.toString();)e=(t=t.slice(1))[0];return t},r.toBuffer=function(t){if(!e.isBuffer(t))if(Array.isArray(t))t=new e(t);else if("string"==typeof t)t=r.isHexPrefixed(t)?new e(r.padToEven(r.stripHexPrefix(t)),"hex"):new e(t);else if("number"==typeof t)t=r.intToBuffer(t);else if(null==t)t=new e([]);else{if(!t.toArray)throw new Error("invalid type");t=new e(t.toArray())}return t},r.intToHex=function(t){h(t%1==0,"number is not a integer"),h(t>=0,"number must be positive");var e=t.toString(16);return e.length%2&&(e="0"+e),"0x"+e},r.intToBuffer=function(t){var n=r.intToHex(t);return new e(n.slice(2),"hex")},r.bufferToInt=function(t){return parseInt(r.bufferToHex(t),16)},r.bufferToHex=function(t){return 0===(t=r.toBuffer(t)).length?0:"0x"+t.toString("hex")},r.fromSigned=function(t){return new d(t).fromTwos(256)},r.toUnsigned=function(t){return new e(t.toTwos(256).toArray())},r.sha3=function(t,e){switch(t=r.toBuffer(t),e||(e=256),e){case 224:return o(t);case 256:return s(t);case 384:return a(t);case 512:return f(t);default:throw new Error("Invalid algorithm: keccak"+e)}},r.sha256=function(t){return t=r.toBuffer(t),l("sha256").update(t).digest()},r.ripemd160=function(t,e){t=r.toBuffer(t);var n=l("rmd160").update(t).digest();return!0===e?r.setLength(n,32):n},r.rlphash=function(t){return r.sha3(c.encode(t))},r.isValidPrivate=function(t){return u.privateKeyVerify(t)},r.isValidPublic=function(t,r){return 64===t.length?u.publicKeyVerify(e.concat([new e([4]),t])):!!r&&u.publicKeyVerify(t)},r.pubToAddress=r.publicToAddress=function(t,e){return t=r.toBuffer(t),e&&64!==t.length&&(t=u.publicKeyConvert(t,!1).slice(1)),h(64===t.length),r.sha3(t).slice(-20)};var p=r.privateToPublic=function(t){return t=r.toBuffer(t),u.publicKeyCreate(t,!1).slice(1)};r.importPublic=function(t){return 64!==(t=r.toBuffer(t)).length&&(t=u.publicKeyConvert(t,!1).slice(1)),t},r.ecsign=function(t,e){var r=u.sign(t,e),n={};return n.r=r.signature.slice(0,32),n.s=r.signature.slice(32,64),n.v=r.recovery+27,n},r.ecrecover=function(t,n,i,o){var a=e.concat([r.setLength(i,32),r.setLength(o,32)],64),s=r.bufferToInt(n)-27;if(0!==s&&1!==s)throw new Error("Invalid signature v value");var f=u.recover(t,a,s);return u.publicKeyConvert(f,!1).slice(1)},r.toRpcSig=function(t,n,i){return r.bufferToHex(e.concat([n,i,r.toBuffer(t-27)]))},r.fromRpcSig=function(t){var e=(t=r.toBuffer(t))[64];return e<27&&(e+=27),{v:e,r:t.slice(0,32),s:t.slice(32,64)}},r.privateToAddress=function(t){return r.publicToAddress(p(t))},r.isValidAddress=function(t){return/^0x[0-9a-fA-F]{40}$/i.test(t)},r.toChecksumAddress=function(t){t=r.stripHexPrefix(t).toLowerCase();for(var e=r.sha3(t).toString("hex"),n="0x",i=0;i=8?n+=t[i].toUpperCase():n+=t[i];return n},r.isValidChecksumAddress=function(t){return r.isValidAddress(t)&&r.toChecksumAddress(t)===t},r.generateAddress=function(t,n){return t=r.toBuffer(t),n=(n=new d(n)).isZero()?null:new e(n.toArray()),r.rlphash([t,n]).slice(-20)},r.isPrecompiled=function(t){var e=r.unpad(t);return 1===e.length&&e[0]>0&&e[0]<5},r.isHexPrefixed=function(t){return"0x"===t.slice(0,2)},r.stripHexPrefix=function(t){return"string"!=typeof t?t:r.isHexPrefixed(t)?t.slice(2):t},r.addHexPrefix=function(t){return"string"!=typeof t||r.isHexPrefixed(t)?t:"0x"+t},r.padToEven=function(t){return t.length%2&&(t="0"+t),t},r.baToJSON=function(t){if(e.isBuffer(t))return"0x"+t.toString("hex");if(t instanceof Array){for(var n=[],i=0;i=o.length,"The field "+n.name+" must not have more "+n.length+" bytes")):n.allowZero&&0===o.length||!n.length||h(n.length===o.length,"The field "+n.name+" must have byte length of "+n.length),t.raw[i]=o}t._fields.push(n.name),Object.defineProperty(t,n.name,{enumerable:!0,configurable:!0,get:o,set:a}),n.default&&(t[n.name]=n.default),n.alias&&Object.defineProperty(t,n.alias,{enumerable:!1,configurable:!0,set:a,get:o})})),o)if("string"==typeof o&&(o=new e(r.stripHexPrefix(o),"hex")),e.isBuffer(o)&&(o=c.decode(o)),Array.isArray(o)){if(o.length>t._fields.length)throw new Error("wrong number of fields in data");o.forEach((function(e,n){t[t._fields[n]]=r.toBuffer(e)}))}else{if("object"!==(void 0===o?"undefined":n(o)))throw new Error("invalid data");for(var a in o)-1!==t._fields.indexOf(a)&&(t[a]=o[a])}}}).call(this,t("buffer").Buffer)},{"./secp256k1-adapter":42,assert:1,"bn.js":6,buffer:9,"create-hash":12,"ethereum-cryptography/keccak":36,rlp:122}],42:[function(t,e,r){arguments[4][31][0].apply(r,arguments)},{"./secp256k1-lib/der":43,"./secp256k1-lib/index":44,buffer:9,dup:31,"ethereum-cryptography/secp256k1":38}],43:[function(t,e,r){arguments[4][32][0].apply(r,arguments)},{buffer:9,dup:32}],44:[function(t,e,r){arguments[4][33][0].apply(r,arguments)},{"bn.js":6,buffer:9,dup:33,elliptic:13}],45:[function(t,e,r){(function(e){"use strict";var n=this&&this.__read||function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,i,o=r.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(n=o.next()).done;)a.push(n.value)}catch(t){i={error:t}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return a},i=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(r,"__esModule",{value:!0}),r.isZeroAddress=r.zeroAddress=r.importPublic=r.privateToAddress=r.privateToPublic=r.publicToAddress=r.pubToAddress=r.isValidPublic=r.isValidPrivate=r.generateAddress2=r.generateAddress=r.isValidChecksumAddress=r.toChecksumAddress=r.isValidAddress=r.Account=void 0;var o=i(t("assert")),a=t("./externals"),s=t("ethereum-cryptography/secp256k1"),f=t("./internal"),u=t("./constants"),h=t("./bytes"),c=t("./hash"),d=t("./helpers"),l=t("./types"),p=function(){function t(t,e,r,n){void 0===t&&(t=new a.BN(0)),void 0===e&&(e=new a.BN(0)),void 0===r&&(r=u.KECCAK256_RLP),void 0===n&&(n=u.KECCAK256_NULL),this.nonce=t,this.balance=e,this.stateRoot=r,this.codeHash=n,this._validate()}return t.fromAccountData=function(e){var r=e.nonce,n=e.balance,i=e.stateRoot,o=e.codeHash;return new t(r?new a.BN((0,h.toBuffer)(r)):void 0,n?new a.BN((0,h.toBuffer)(n)):void 0,i?(0,h.toBuffer)(i):void 0,o?(0,h.toBuffer)(o):void 0)},t.fromRlpSerializedAccount=function(t){var e=a.rlp.decode(t);if(!Array.isArray(e))throw new Error("Invalid serialized account input. Must be array");return this.fromValuesArray(e)},t.fromValuesArray=function(e){var r=n(e,4),i=r[0],o=r[1],s=r[2],f=r[3];return new t(new a.BN(i),new a.BN(o),s,f)},t.prototype._validate=function(){if(this.nonce.lt(new a.BN(0)))throw new Error("nonce must be greater than zero");if(this.balance.lt(new a.BN(0)))throw new Error("balance must be greater than zero");if(32!==this.stateRoot.length)throw new Error("stateRoot must have a length of 32");if(32!==this.codeHash.length)throw new Error("codeHash must have a length of 32")},t.prototype.raw=function(){return[(0,l.bnToUnpaddedBuffer)(this.nonce),(0,l.bnToUnpaddedBuffer)(this.balance),this.stateRoot,this.codeHash]},t.prototype.serialize=function(){return a.rlp.encode(this.raw())},t.prototype.isContract=function(){return!this.codeHash.equals(u.KECCAK256_NULL)},t.prototype.isEmpty=function(){return this.balance.isZero()&&this.nonce.isZero()&&this.codeHash.equals(u.KECCAK256_NULL)},t}();r.Account=p;r.isValidAddress=function(t){try{(0,d.assertIsString)(t)}catch(t){return!1}return/^0x[0-9a-fA-F]{40}$/.test(t)};r.toChecksumAddress=function(t,e){(0,d.assertIsHexString)(t);var r=(0,f.stripHexPrefix)(t).toLowerCase(),n="";e&&(n=(0,l.toType)(e,l.TypeOutput.BN).toString()+"0x");for(var i=(0,c.keccakFromString)(n+r).toString("hex"),o="0x",a=0;a=8?o+=r[a].toUpperCase():o+=r[a];return o};r.isValidChecksumAddress=function(t,e){return(0,r.isValidAddress)(t)&&(0,r.toChecksumAddress)(t,e)===t};r.generateAddress=function(t,r){(0,d.assertIsBuffer)(t),(0,d.assertIsBuffer)(r);var n=new a.BN(r);return n.isZero()?(0,c.rlphash)([t,null]).slice(-20):(0,c.rlphash)([t,e.from(n.toArray())]).slice(-20)};r.generateAddress2=function(t,r,n){return(0,d.assertIsBuffer)(t),(0,d.assertIsBuffer)(r),(0,d.assertIsBuffer)(n),(0,o.default)(20===t.length),(0,o.default)(32===r.length),(0,c.keccak256)(e.concat([e.from("ff","hex"),t,r,(0,c.keccak256)(n)])).slice(-20)};r.isValidPrivate=function(t){return(0,s.privateKeyVerify)(t)};r.isValidPublic=function(t,r){return void 0===r&&(r=!1),(0,d.assertIsBuffer)(t),64===t.length?(0,s.publicKeyVerify)(e.concat([e.from([4]),t])):!!r&&(0,s.publicKeyVerify)(t)};r.pubToAddress=function(t,r){return void 0===r&&(r=!1),(0,d.assertIsBuffer)(t),r&&64!==t.length&&(t=e.from((0,s.publicKeyConvert)(t,!1).slice(1))),(0,o.default)(64===t.length),(0,c.keccak)(t).slice(-20)},r.publicToAddress=r.pubToAddress;r.privateToPublic=function(t){return(0,d.assertIsBuffer)(t),e.from((0,s.publicKeyCreate)(t,!1)).slice(1)};r.privateToAddress=function(t){return(0,r.publicToAddress)((0,r.privateToPublic)(t))};r.importPublic=function(t){return(0,d.assertIsBuffer)(t),64!==t.length&&(t=e.from((0,s.publicKeyConvert)(t,!1).slice(1))),t};r.zeroAddress=function(){var t=(0,h.zeros)(20);return(0,h.bufferToHex)(t)};r.isZeroAddress=function(t){try{(0,d.assertIsString)(t)}catch(t){return!1}return(0,r.zeroAddress)()===t}}).call(this,t("buffer").Buffer)},{"./bytes":47,"./constants":48,"./externals":49,"./hash":50,"./helpers":51,"./internal":53,"./types":56,assert:1,buffer:9,"ethereum-cryptography/secp256k1":38}],46:[function(t,e,r){(function(e){"use strict";var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(r,"__esModule",{value:!0}),r.Address=void 0;var i=n(t("assert")),o=t("./externals"),a=t("./bytes"),s=t("./account"),f=function(){function t(t){(0,i.default)(20===t.length,"Invalid address length"),this.buf=t}return t.zero=function(){return new t((0,a.zeros)(20))},t.fromString=function(e){return(0,i.default)((0,s.isValidAddress)(e),"Invalid address"),new t((0,a.toBuffer)(e))},t.fromPublicKey=function(r){return(0,i.default)(e.isBuffer(r),"Public key should be Buffer"),new t((0,s.pubToAddress)(r))},t.fromPrivateKey=function(r){return(0,i.default)(e.isBuffer(r),"Private key should be Buffer"),new t((0,s.privateToAddress)(r))},t.generate=function(r,n){return(0,i.default)(o.BN.isBN(n)),new t((0,s.generateAddress)(r.buf,n.toArrayLike(e)))},t.generate2=function(r,n,o){return(0,i.default)(e.isBuffer(n)),(0,i.default)(e.isBuffer(o)),new t((0,s.generateAddress2)(r.buf,n,o))},t.prototype.equals=function(t){return this.buf.equals(t.buf)},t.prototype.isZero=function(){return this.equals(t.zero())},t.prototype.isPrecompileOrSystemAddress=function(){var t=new o.BN(this.buf),e=new o.BN(0),r=new o.BN("ffff","hex");return t.gte(e)&&t.lte(r)},t.prototype.toString=function(){return"0x"+this.buf.toString("hex")},t.prototype.toBuffer=function(){return e.from(this.buf)},t}();r.Address=f}).call(this,t("buffer").Buffer)},{"./account":45,"./bytes":47,"./externals":49,assert:1,buffer:9}],47:[function(t,e,r){(function(e){"use strict";var n=this&&this.__values||function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},i=this&&this.__read||function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,i,o=r.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(n=o.next()).done;)a.push(n.value)}catch(t){i={error:t}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return a};Object.defineProperty(r,"__esModule",{value:!0}),r.bufArrToArr=r.arrToBufArr=r.validateNoLeadingZeroes=r.baToJSON=r.toUtf8=r.addHexPrefix=r.toUnsigned=r.fromSigned=r.bufferToHex=r.bufferToInt=r.toBuffer=r.unpadHexString=r.unpadArray=r.unpadBuffer=r.setLengthRight=r.setLengthLeft=r.zeros=r.intToBuffer=r.intToHex=void 0;var o=t("./externals"),a=t("./internal"),s=t("./helpers");r.intToHex=function(t){if(!Number.isSafeInteger(t)||t<0)throw new Error("Received an invalid integer type: ".concat(t));return"0x".concat(t.toString(16))};r.intToBuffer=function(t){var n=(0,r.intToHex)(t);return e.from((0,a.padToEven)(n.slice(2)),"hex")};r.zeros=function(t){return e.allocUnsafe(t).fill(0)};var f=function(t,e,n){var i=(0,r.zeros)(e);return n?t.length0&&"0"===e.toString();)e=(t=t.slice(1))[0];return t};r.unpadBuffer=function(t){return(0,s.assertIsBuffer)(t),u(t)};r.unpadArray=function(t){return(0,s.assertIsArray)(t),u(t)};r.unpadHexString=function(t){return(0,s.assertIsHexString)(t),t=(0,a.stripHexPrefix)(t),u(t)};r.toBuffer=function(t){if(null==t)return e.allocUnsafe(0);if(e.isBuffer(t))return e.from(t);if(Array.isArray(t)||t instanceof Uint8Array)return e.from(t);if("string"==typeof t){if(!(0,a.isHexString)(t))throw new Error("Cannot convert string to buffer. toBuffer only supports 0x-prefixed hex strings and this string was given: ".concat(t));return e.from((0,a.padToEven)((0,a.stripHexPrefix)(t)),"hex")}if("number"==typeof t)return(0,r.intToBuffer)(t);if(o.BN.isBN(t)){if(t.isNeg())throw new Error("Cannot convert negative BN to buffer. Given: ".concat(t));return t.toArrayLike(e)}if(t.toArray)return e.from(t.toArray());if(t.toBuffer)return e.from(t.toBuffer());throw new Error("invalid type")};r.bufferToInt=function(t){return new o.BN((0,r.toBuffer)(t)).toNumber()};r.bufferToHex=function(t){return"0x"+(t=(0,r.toBuffer)(t)).toString("hex")};r.fromSigned=function(t){return new o.BN(t).fromTwos(256)};r.toUnsigned=function(t){return e.from(t.toTwos(256).toArray())};r.addHexPrefix=function(t){return"string"!=typeof t||(0,a.isHexPrefixed)(t)?t:"0x"+t};r.toUtf8=function(t){if((t=(0,a.stripHexPrefix)(t)).length%2!=0)throw new Error("Invalid non-even hex string input for toUtf8() provided");return e.from(t.replace(/^(00)+|(00)+$/g,""),"hex").toString("utf8")};r.baToJSON=function(t){if(e.isBuffer(t))return"0x".concat(t.toString("hex"));if(t instanceof Array){for(var n=[],i=0;i0&&0===u[0])throw new Error("".concat(f," cannot have leading zeroes, received: ").concat(u.toString("hex")))}}catch(t){e={error:t}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(e)throw e.error}}},r.arrToBufArr=function t(r){return Array.isArray(r)?r.map((function(e){return t(e)})):e.from(r)},r.bufArrToArr=function t(e){return Array.isArray(e)?e.map((function(e){return t(e)})):Uint8Array.from(null!=e?e:[])}}).call(this,t("buffer").Buffer)},{"./externals":49,"./helpers":51,"./internal":53,buffer:9}],48:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.KECCAK256_RLP=r.KECCAK256_RLP_S=r.KECCAK256_RLP_ARRAY=r.KECCAK256_RLP_ARRAY_S=r.KECCAK256_NULL=r.KECCAK256_NULL_S=r.TWO_POW256=r.MAX_INTEGER=r.MAX_UINT64=void 0;var n=t("buffer"),i=t("./externals");r.MAX_UINT64=new i.BN("ffffffffffffffff",16),r.MAX_INTEGER=new i.BN("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",16),r.TWO_POW256=new i.BN("10000000000000000000000000000000000000000000000000000000000000000",16),r.KECCAK256_NULL_S="c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470",r.KECCAK256_NULL=n.Buffer.from(r.KECCAK256_NULL_S,"hex"),r.KECCAK256_RLP_ARRAY_S="1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",r.KECCAK256_RLP_ARRAY=n.Buffer.from(r.KECCAK256_RLP_ARRAY_S,"hex"),r.KECCAK256_RLP_S="56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",r.KECCAK256_RLP=n.Buffer.from(r.KECCAK256_RLP_S,"hex")},{"./externals":49,buffer:9}],49:[function(t,e,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(t,e,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);i&&!("get"in i?!e.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}:function(t,e,r,n){void 0===n&&(n=r),t[n]=e[r]}),i=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),o=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)"default"!==r&&Object.prototype.hasOwnProperty.call(t,r)&&n(e,t,r);return i(e,t),e},a=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(r,"__esModule",{value:!0}),r.rlp=r.BN=void 0;var s=a(t("bn.js"));r.BN=s.default;var f=o(t("rlp"));r.rlp=f},{"bn.js":57,rlp:122}],50:[function(t,e,r){(function(e){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.rlphash=r.ripemd160FromArray=r.ripemd160FromString=r.ripemd160=r.sha256FromArray=r.sha256FromString=r.sha256=r.keccakFromArray=r.keccakFromHexString=r.keccakFromString=r.keccak256=r.keccak=void 0;var n=t("ethereum-cryptography/keccak"),i=t("create-hash"),o=t("./externals"),a=t("./bytes"),s=t("./helpers");r.keccak=function(t,e){switch(void 0===e&&(e=256),(0,s.assertIsBuffer)(t),e){case 224:return(0,n.keccak224)(t);case 256:return(0,n.keccak256)(t);case 384:return(0,n.keccak384)(t);case 512:return(0,n.keccak512)(t);default:throw new Error("Invald algorithm: keccak".concat(e))}};r.keccak256=function(t){return(0,r.keccak)(t)};r.keccakFromString=function(t,n){void 0===n&&(n=256),(0,s.assertIsString)(t);var i=e.from(t,"utf8");return(0,r.keccak)(i,n)};r.keccakFromHexString=function(t,e){return void 0===e&&(e=256),(0,s.assertIsHexString)(t),(0,r.keccak)((0,a.toBuffer)(t),e)};r.keccakFromArray=function(t,e){return void 0===e&&(e=256),(0,s.assertIsArray)(t),(0,r.keccak)((0,a.toBuffer)(t),e)};var f=function(t){return t=(0,a.toBuffer)(t),i("sha256").update(t).digest()};r.sha256=function(t){return(0,s.assertIsBuffer)(t),f(t)};r.sha256FromString=function(t){return(0,s.assertIsString)(t),f(t)};r.sha256FromArray=function(t){return(0,s.assertIsArray)(t),f(t)};var u=function(t,e){t=(0,a.toBuffer)(t);var r=i("rmd160").update(t).digest();return!0===e?(0,a.setLengthLeft)(r,32):r};r.ripemd160=function(t,e){return(0,s.assertIsBuffer)(t),u(t,e)};r.ripemd160FromString=function(t,e){return(0,s.assertIsString)(t),u(t,e)};r.ripemd160FromArray=function(t,e){return(0,s.assertIsArray)(t),u(t,e)};r.rlphash=function(t){return(0,r.keccak)(o.rlp.encode(t))}}).call(this,t("buffer").Buffer)},{"./bytes":47,"./externals":49,"./helpers":51,buffer:9,"create-hash":12,"ethereum-cryptography/keccak":36}],51:[function(t,e,r){(function(e){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.assertIsString=r.assertIsArray=r.assertIsBuffer=r.assertIsHexString=void 0;var n=t("./internal");r.assertIsHexString=function(t){if(!(0,n.isHexString)(t)){var e="This method only supports 0x-prefixed hex strings but input was: ".concat(t);throw new Error(e)}};r.assertIsBuffer=function(t){if(!e.isBuffer(t)){var r="This method only supports Buffer but input was: ".concat(t);throw new Error(r)}};r.assertIsArray=function(t){if(!Array.isArray(t)){var e="This method only supports number arrays but input was: ".concat(t);throw new Error(e)}};r.assertIsString=function(t){if("string"!=typeof t){var e="This method only supports strings but input was: ".concat(t);throw new Error(e)}}}).call(this,{isBuffer:t("../../is-buffer/index.js")})},{"../../is-buffer/index.js":76,"./internal":53}],52:[function(t,e,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(t,e,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);i&&!("get"in i?!e.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}:function(t,e,r,n){void 0===n&&(n=r),t[n]=e[r]}),i=this&&this.__exportStar||function(t,e){for(var r in t)"default"===r||Object.prototype.hasOwnProperty.call(e,r)||n(e,t,r)};Object.defineProperty(r,"__esModule",{value:!0}),r.isHexString=r.getKeys=r.fromAscii=r.fromUtf8=r.toAscii=r.arrayContainsArray=r.getBinarySize=r.padToEven=r.stripHexPrefix=r.isHexPrefixed=void 0,i(t("./constants"),r),i(t("./account"),r),i(t("./address"),r),i(t("./hash"),r),i(t("./signature"),r),i(t("./bytes"),r),i(t("./object"),r),i(t("./externals"),r),i(t("./types"),r);var o=t("./internal");Object.defineProperty(r,"isHexPrefixed",{enumerable:!0,get:function(){return o.isHexPrefixed}}),Object.defineProperty(r,"stripHexPrefix",{enumerable:!0,get:function(){return o.stripHexPrefix}}),Object.defineProperty(r,"padToEven",{enumerable:!0,get:function(){return o.padToEven}}),Object.defineProperty(r,"getBinarySize",{enumerable:!0,get:function(){return o.getBinarySize}}),Object.defineProperty(r,"arrayContainsArray",{enumerable:!0,get:function(){return o.arrayContainsArray}}),Object.defineProperty(r,"toAscii",{enumerable:!0,get:function(){return o.toAscii}}),Object.defineProperty(r,"fromUtf8",{enumerable:!0,get:function(){return o.fromUtf8}}),Object.defineProperty(r,"fromAscii",{enumerable:!0,get:function(){return o.fromAscii}}),Object.defineProperty(r,"getKeys",{enumerable:!0,get:function(){return o.getKeys}}),Object.defineProperty(r,"isHexString",{enumerable:!0,get:function(){return o.isHexString}})},{"./account":45,"./address":46,"./bytes":47,"./constants":48,"./externals":49,"./hash":50,"./internal":53,"./object":54,"./signature":55,"./types":56}],53:[function(t,e,r){(function(t){"use strict";function e(t){if("string"!=typeof t)throw new Error("[isHexPrefixed] input must be type 'string', received type ".concat(typeof t));return"0"===t[0]&&"x"===t[1]}Object.defineProperty(r,"__esModule",{value:!0}),r.isHexString=r.getKeys=r.fromAscii=r.fromUtf8=r.toAscii=r.arrayContainsArray=r.getBinarySize=r.padToEven=r.stripHexPrefix=r.isHexPrefixed=void 0,r.isHexPrefixed=e;function n(t){var e=t;if("string"!=typeof e)throw new Error("[padToEven] value must be type 'string', received ".concat(typeof e));return e.length%2&&(e="0".concat(e)),e}r.stripHexPrefix=function(t){if("string"!=typeof t)throw new Error("[stripHexPrefix] input must be type 'string', received ".concat(typeof t));return e(t)?t.slice(2):t},r.padToEven=n,r.getBinarySize=function(e){if("string"!=typeof e)throw new Error("[getBinarySize] method requires input type 'string', recieved ".concat(typeof e));return t.byteLength(e,"utf8")},r.arrayContainsArray=function(t,e,r){if(!0!==Array.isArray(t))throw new Error("[arrayContainsArray] method requires input 'superset' to be an array, got type '".concat(typeof t,"'"));if(!0!==Array.isArray(e))throw new Error("[arrayContainsArray] method requires input 'subset' to be an array, got type '".concat(typeof e,"'"));return e[r?"some":"every"]((function(e){return t.indexOf(e)>=0}))},r.toAscii=function(t){var e="",r=0,n=t.length;for("0x"===t.substring(0,2)&&(r=2);r=o.length,"The field ".concat(r.name," must not have more ").concat(r.length," bytes"))):r.allowZero&&0===o.length||!r.length||(0,i.default)(r.length===o.length,"The field ".concat(r.name," must have byte length of ").concat(r.length)),t.raw[n]=o}t._fields.push(r.name),Object.defineProperty(t,r.name,{enumerable:!0,configurable:!0,get:o,set:a}),r.default&&(t[r.name]=r.default),r.alias&&Object.defineProperty(t,r.alias,{enumerable:!1,configurable:!0,set:a,get:o})})),n)if("string"==typeof n&&(n=e.from((0,o.stripHexPrefix)(n),"hex")),e.isBuffer(n)&&(n=a.rlp.decode(n)),Array.isArray(n)){if(n.length>t._fields.length)throw new Error("wrong number of fields in data");n.forEach((function(e,r){t[t._fields[r]]=(0,s.toBuffer)(e)}))}else{if("object"!=typeof n)throw new Error("invalid data");var f=Object.keys(n);r.forEach((function(e){-1!==f.indexOf(e.name)&&(t[e.name]=n[e.name]),-1!==f.indexOf(e.alias)&&(t[e.alias]=n[e.alias])}))}}}).call(this,t("buffer").Buffer)},{"./bytes":47,"./externals":49,"./internal":53,assert:1,buffer:9}],55:[function(t,e,r){(function(e){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.hashPersonalMessage=r.isValidSignature=r.fromRpcSig=r.toCompactSig=r.toRpcSig=r.ecrecover=r.ecsign=void 0;var n=t("ethereum-cryptography/secp256k1"),i=t("./externals"),o=t("./bytes"),a=t("./hash"),s=t("./helpers"),f=t("./types");function u(t,e){var r=(0,f.toType)(t,f.TypeOutput.BN);if(r.eqn(0)||r.eqn(1))return(0,f.toType)(t,f.TypeOutput.BN);if(!e)return r.subn(27);var n=(0,f.toType)(e,f.TypeOutput.BN);return r.sub(n.muln(2).addn(35))}function h(t){var e=new i.BN(t);return e.eqn(0)||e.eqn(1)}r.ecsign=function(t,r,i){var o=(0,n.ecdsaSign)(t,r),a=o.signature,s=o.recid,u=e.from(a.slice(0,32)),h=e.from(a.slice(32,64));if(!i||"number"==typeof i){if(i&&!Number.isSafeInteger(i))throw new Error("The provided number is greater than MAX_SAFE_INTEGER (please use an alternative input type)");return{r:u,s:h,v:i?s+(2*i+35):s+27}}return{r:u,s:h,v:(0,f.toType)(i,f.TypeOutput.BN).muln(2).addn(35).addn(s).toArrayLike(e)}};r.ecrecover=function(t,r,i,a,s){var f=e.concat([(0,o.setLengthLeft)(i,32),(0,o.setLengthLeft)(a,32)],64),c=u(r,s);if(!h(c))throw new Error("Invalid signature v value");var d=(0,n.ecdsaRecover)(f,c.toNumber(),t);return e.from((0,n.publicKeyConvert)(d,!1).slice(1))};r.toRpcSig=function(t,r,n,i){if(!h(u(t,i)))throw new Error("Invalid signature v value");return(0,o.bufferToHex)(e.concat([(0,o.setLengthLeft)(r,32),(0,o.setLengthLeft)(n,32),(0,o.toBuffer)(t)]))};r.toCompactSig=function(t,r,n,i){if(!h(u(t,i)))throw new Error("Invalid signature v value");var a=(0,f.toType)(t,f.TypeOutput.Number),s=n;return(a>28&&a%2==1||1===a||28===a)&&((s=e.from(n))[0]|=128),(0,o.bufferToHex)(e.concat([(0,o.setLengthLeft)(r,32),(0,o.setLengthLeft)(s,32)]))};r.fromRpcSig=function(t){var e,r,n,i=(0,o.toBuffer)(t);if(i.length>=65)e=i.slice(0,32),r=i.slice(32,64),n=(0,o.bufferToInt)(i.slice(64));else{if(64!==i.length)throw new Error("Invalid signature length");e=i.slice(0,32),r=i.slice(32,64),n=(0,o.bufferToInt)(i.slice(32,33))>>7,r[0]&=127}return n<27&&(n+=27),{v:n,r:e,s:r}};r.isValidSignature=function(t,e,r,n,o){void 0===n&&(n=!0);var a=new i.BN("7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0",16),s=new i.BN("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141",16);if(32!==e.length||32!==r.length)return!1;if(!h(u(t,o)))return!1;var f=new i.BN(e),c=new i.BN(r);return!(f.isZero()||f.gt(s)||c.isZero()||c.gt(s))&&(!n||1!==c.cmp(a))};r.hashPersonalMessage=function(t){(0,s.assertIsBuffer)(t);var r=e.from("Ethereum Signed Message:\n".concat(t.length),"utf-8");return(0,a.keccak)(e.concat([r,t]))}}).call(this,t("buffer").Buffer)},{"./bytes":47,"./externals":49,"./hash":50,"./helpers":51,"./types":56,buffer:9,"ethereum-cryptography/secp256k1":38}],56:[function(t,e,r){(function(e){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.toType=r.TypeOutput=r.bnToRlp=r.bnToUnpaddedBuffer=r.bnToHex=void 0;var n,i=t("./externals"),o=t("./internal"),a=t("./bytes");function s(t){return(0,a.unpadBuffer)(t.toArrayLike(e))}r.bnToHex=function(t){return"0x".concat(t.toString(16))},r.bnToUnpaddedBuffer=s,r.bnToRlp=function(t){return s(t)},function(t){t[t.Number=0]="Number",t[t.BN=1]="BN",t[t.Buffer=2]="Buffer",t[t.PrefixedHexString=3]="PrefixedHexString"}(n=r.TypeOutput||(r.TypeOutput={})),r.toType=function(t,e){if(null===t)return null;if(void 0!==t){if("string"==typeof t&&!(0,o.isHexString)(t))throw new Error("A string must be provided with a 0x-prefix, given: ".concat(t));if("number"==typeof t&&!Number.isSafeInteger(t))throw new Error("The provided number is greater than MAX_SAFE_INTEGER (please use an alternative input type)");var r=(0,a.toBuffer)(t);if(e===n.Buffer)return r;if(e===n.BN)return new i.BN(r);if(e===n.Number){var s=new i.BN(r),f=new i.BN(Number.MAX_SAFE_INTEGER.toString());if(s.gt(f))throw new Error("The provided number is greater than MAX_SAFE_INTEGER (please use an alternative output type)");return s.toNumber()}return"0x".concat(r.toString("hex"))}}}).call(this,t("buffer").Buffer)},{"./bytes":47,"./externals":49,"./internal":53,buffer:9}],57:[function(t,e,r){!function(e,r){"use strict";function n(t,e){if(!t)throw new Error(e||"Assertion failed")}function i(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function o(t,e,r){if(o.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 a;"object"==typeof e?e.exports=o:r.BN=o,o.BN=o,o.wordSize=26;try{a="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:t("buffer").Buffer}catch(t){}function s(t,e){var r=t.charCodeAt(e);return r>=48&&r<=57?r-48:r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:void n(!1,"Invalid character in "+t)}function f(t,e,r){var n=s(t,r);return r-1>=e&&(n|=s(t,r-1)<<4),n}function u(t,e,r,i){for(var o=0,a=0,s=Math.min(t.length,r),f=e;f=49?u-49+10:u>=17?u-17+10:u,n(u>=0&&a0?t:e},o.min=function(t,e){return t.cmp(e)<0?t:e},o.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),n(e===(0|e)&&e>=2&&e<=36);var i=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i=0;i-=3)a=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[o]|=a<>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);else if("le"===r)for(i=0,o=0;i>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);return this._strip()},o.prototype._parseHex=function(t,e,r){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var n=0;n=e;n-=2)i=f(t,e,n)<=18?(o-=18,a+=1,this.words[a]|=i>>>26):o+=8;else for(n=(t.length-e)%2==0?e+1:e;n=18?(o-=18,a+=1,this.words[a]|=i>>>26):o+=8;this._strip()},o.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var n=0,i=1;i<=67108863;i*=e)n++;n--,i=i/e|0;for(var o=t.length-r,a=o%n,s=Math.min(o,o-a)+r,f=0,h=r;h1&&0===this.words[this.length-1];)this.length--;return this._normSign()},o.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for)try{o.prototype[Symbol.for("nodejs.util.inspect.custom")]=c}catch(t){o.prototype.inspect=c}else o.prototype.inspect=c;function c(){return(this.red?""}var d=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],l=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],p=[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];o.prototype.toString=function(t,e){var r;if(e=0|e||1,16===(t=t||10)||"hex"===t){r="";for(var i=0,o=0,a=0;a>>24-i&16777215,(i+=2)>=26&&(i-=26,a--),r=0!==o||a!==this.length-1?d[6-f.length]+f+r:f+r}for(0!==o&&(r=o.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 u=l[t],h=p[t];r="";var c=this.clone();for(c.negative=0;!c.isZero();){var b=c.modrn(h).toString(t);r=(c=c.idivn(h)).isZero()?b+r:d[u-b.length]+b+r}for(this.isZero()&&(r="0"+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}n(!1,"Base should be between 2 and 36")},o.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&&n(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},o.prototype.toJSON=function(){return this.toString(16,2)},a&&(o.prototype.toBuffer=function(t,e){return this.toArrayLike(a,t,e)}),o.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)};function b(t,e,r){r.negative=e.negative^t.negative;var n=t.length+e.length|0;r.length=n,n=n-1|0;var i=0|t.words[0],o=0|e.words[0],a=i*o,s=67108863&a,f=a/67108864|0;r.words[0]=s;for(var u=1;u>>26,c=67108863&f,d=Math.min(u,e.length-1),l=Math.max(0,u-t.length+1);l<=d;l++){var p=u-l|0;h+=(a=(i=0|t.words[p])*(o=0|e.words[l])+c)/67108864|0,c=67108863&a}r.words[u]=0|c,f=0|h}return 0!==f?r.words[u]=0|f:r.length--,r._strip()}o.prototype.toArrayLike=function(t,e,r){this._strip();var i=this.byteLength(),o=r||Math.max(1,i);n(i<=o,"byte array longer than desired length"),n(o>0,"Requested array length <= 0");var a=function(t,e){return t.allocUnsafe?t.allocUnsafe(e):new t(e)}(t,o);return this["_toArrayLike"+("le"===e?"LE":"BE")](a,i),a},o.prototype._toArrayLikeLE=function(t,e){for(var r=0,n=0,i=0,o=0;i>8&255),r>16&255),6===o?(r>24&255),n=0,o=0):(n=a>>>24,o+=2)}if(r=0&&(t[r--]=a>>8&255),r>=0&&(t[r--]=a>>16&255),6===o?(r>=0&&(t[r--]=a>>24&255),n=0,o=0):(n=a>>>24,o+=2)}if(r>=0)for(t[r--]=n;r>=0;)t[r--]=0},Math.clz32?o.prototype._countBits=function(t){return 32-Math.clz32(t)}:o.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},o.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},o.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;et.length?this.clone().ior(t):t.clone().ior(this)},o.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},o.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;rt.length?this.clone().iand(t):t.clone().iand(this)},o.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},o.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var n=0;nt.length?this.clone().ixor(t):t.clone().ixor(this)},o.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},o.prototype.inotn=function(t){n("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),r=t%26;this._expand(e),r>0&&e--;for(var i=0;i0&&(this.words[i]=~this.words[i]&67108863>>26-r),this._strip()},o.prototype.notn=function(t){return this.clone().inotn(t)},o.prototype.setn=function(t,e){n("number"==typeof t&&t>=0);var r=t/26|0,i=t%26;return this._expand(r+1),this.words[r]=e?this.words[r]|1<t.length?(r=this,n=t):(r=t,n=this);for(var i=0,o=0;o>>26;for(;0!==i&&o>>26;if(this.length=r.length,0!==i)this.words[this.length]=i,this.length++;else if(r!==this)for(;ot.length?this.clone().iadd(t):t.clone().iadd(this)},o.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,n,i=this.cmp(t);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(r=this,n=t):(r=t,n=this);for(var o=0,a=0;a>26,this.words[a]=67108863&e;for(;0!==o&&a>26,this.words[a]=67108863&e;if(0===o&&a>>13,l=0|a[1],p=8191&l,b=l>>>13,m=0|a[2],y=8191&m,g=m>>>13,v=0|a[3],w=8191&v,_=v>>>13,M=0|a[4],S=8191&M,x=M>>>13,A=0|a[5],E=8191&A,k=A>>>13,R=0|a[6],T=8191&R,B=R>>>13,I=0|a[7],L=8191&I,P=I>>>13,j=0|a[8],O=8191&j,C=j>>>13,N=0|a[9],z=8191&N,U=N>>>13,q=0|s[0],K=8191&q,D=q>>>13,H=0|s[1],F=8191&H,W=H>>>13,Z=0|s[2],V=8191&Z,Y=Z>>>13,J=0|s[3],X=8191&J,G=J>>>13,$=0|s[4],Q=8191&$,tt=$>>>13,et=0|s[5],rt=8191&et,nt=et>>>13,it=0|s[6],ot=8191&it,at=it>>>13,st=0|s[7],ft=8191&st,ut=st>>>13,ht=0|s[8],ct=8191&ht,dt=ht>>>13,lt=0|s[9],pt=8191<,bt=lt>>>13;r.negative=t.negative^e.negative,r.length=19;var mt=(u+(n=Math.imul(c,K))|0)+((8191&(i=(i=Math.imul(c,D))+Math.imul(d,K)|0))<<13)|0;u=((o=Math.imul(d,D))+(i>>>13)|0)+(mt>>>26)|0,mt&=67108863,n=Math.imul(p,K),i=(i=Math.imul(p,D))+Math.imul(b,K)|0,o=Math.imul(b,D);var yt=(u+(n=n+Math.imul(c,F)|0)|0)+((8191&(i=(i=i+Math.imul(c,W)|0)+Math.imul(d,F)|0))<<13)|0;u=((o=o+Math.imul(d,W)|0)+(i>>>13)|0)+(yt>>>26)|0,yt&=67108863,n=Math.imul(y,K),i=(i=Math.imul(y,D))+Math.imul(g,K)|0,o=Math.imul(g,D),n=n+Math.imul(p,F)|0,i=(i=i+Math.imul(p,W)|0)+Math.imul(b,F)|0,o=o+Math.imul(b,W)|0;var gt=(u+(n=n+Math.imul(c,V)|0)|0)+((8191&(i=(i=i+Math.imul(c,Y)|0)+Math.imul(d,V)|0))<<13)|0;u=((o=o+Math.imul(d,Y)|0)+(i>>>13)|0)+(gt>>>26)|0,gt&=67108863,n=Math.imul(w,K),i=(i=Math.imul(w,D))+Math.imul(_,K)|0,o=Math.imul(_,D),n=n+Math.imul(y,F)|0,i=(i=i+Math.imul(y,W)|0)+Math.imul(g,F)|0,o=o+Math.imul(g,W)|0,n=n+Math.imul(p,V)|0,i=(i=i+Math.imul(p,Y)|0)+Math.imul(b,V)|0,o=o+Math.imul(b,Y)|0;var vt=(u+(n=n+Math.imul(c,X)|0)|0)+((8191&(i=(i=i+Math.imul(c,G)|0)+Math.imul(d,X)|0))<<13)|0;u=((o=o+Math.imul(d,G)|0)+(i>>>13)|0)+(vt>>>26)|0,vt&=67108863,n=Math.imul(S,K),i=(i=Math.imul(S,D))+Math.imul(x,K)|0,o=Math.imul(x,D),n=n+Math.imul(w,F)|0,i=(i=i+Math.imul(w,W)|0)+Math.imul(_,F)|0,o=o+Math.imul(_,W)|0,n=n+Math.imul(y,V)|0,i=(i=i+Math.imul(y,Y)|0)+Math.imul(g,V)|0,o=o+Math.imul(g,Y)|0,n=n+Math.imul(p,X)|0,i=(i=i+Math.imul(p,G)|0)+Math.imul(b,X)|0,o=o+Math.imul(b,G)|0;var wt=(u+(n=n+Math.imul(c,Q)|0)|0)+((8191&(i=(i=i+Math.imul(c,tt)|0)+Math.imul(d,Q)|0))<<13)|0;u=((o=o+Math.imul(d,tt)|0)+(i>>>13)|0)+(wt>>>26)|0,wt&=67108863,n=Math.imul(E,K),i=(i=Math.imul(E,D))+Math.imul(k,K)|0,o=Math.imul(k,D),n=n+Math.imul(S,F)|0,i=(i=i+Math.imul(S,W)|0)+Math.imul(x,F)|0,o=o+Math.imul(x,W)|0,n=n+Math.imul(w,V)|0,i=(i=i+Math.imul(w,Y)|0)+Math.imul(_,V)|0,o=o+Math.imul(_,Y)|0,n=n+Math.imul(y,X)|0,i=(i=i+Math.imul(y,G)|0)+Math.imul(g,X)|0,o=o+Math.imul(g,G)|0,n=n+Math.imul(p,Q)|0,i=(i=i+Math.imul(p,tt)|0)+Math.imul(b,Q)|0,o=o+Math.imul(b,tt)|0;var _t=(u+(n=n+Math.imul(c,rt)|0)|0)+((8191&(i=(i=i+Math.imul(c,nt)|0)+Math.imul(d,rt)|0))<<13)|0;u=((o=o+Math.imul(d,nt)|0)+(i>>>13)|0)+(_t>>>26)|0,_t&=67108863,n=Math.imul(T,K),i=(i=Math.imul(T,D))+Math.imul(B,K)|0,o=Math.imul(B,D),n=n+Math.imul(E,F)|0,i=(i=i+Math.imul(E,W)|0)+Math.imul(k,F)|0,o=o+Math.imul(k,W)|0,n=n+Math.imul(S,V)|0,i=(i=i+Math.imul(S,Y)|0)+Math.imul(x,V)|0,o=o+Math.imul(x,Y)|0,n=n+Math.imul(w,X)|0,i=(i=i+Math.imul(w,G)|0)+Math.imul(_,X)|0,o=o+Math.imul(_,G)|0,n=n+Math.imul(y,Q)|0,i=(i=i+Math.imul(y,tt)|0)+Math.imul(g,Q)|0,o=o+Math.imul(g,tt)|0,n=n+Math.imul(p,rt)|0,i=(i=i+Math.imul(p,nt)|0)+Math.imul(b,rt)|0,o=o+Math.imul(b,nt)|0;var Mt=(u+(n=n+Math.imul(c,ot)|0)|0)+((8191&(i=(i=i+Math.imul(c,at)|0)+Math.imul(d,ot)|0))<<13)|0;u=((o=o+Math.imul(d,at)|0)+(i>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,n=Math.imul(L,K),i=(i=Math.imul(L,D))+Math.imul(P,K)|0,o=Math.imul(P,D),n=n+Math.imul(T,F)|0,i=(i=i+Math.imul(T,W)|0)+Math.imul(B,F)|0,o=o+Math.imul(B,W)|0,n=n+Math.imul(E,V)|0,i=(i=i+Math.imul(E,Y)|0)+Math.imul(k,V)|0,o=o+Math.imul(k,Y)|0,n=n+Math.imul(S,X)|0,i=(i=i+Math.imul(S,G)|0)+Math.imul(x,X)|0,o=o+Math.imul(x,G)|0,n=n+Math.imul(w,Q)|0,i=(i=i+Math.imul(w,tt)|0)+Math.imul(_,Q)|0,o=o+Math.imul(_,tt)|0,n=n+Math.imul(y,rt)|0,i=(i=i+Math.imul(y,nt)|0)+Math.imul(g,rt)|0,o=o+Math.imul(g,nt)|0,n=n+Math.imul(p,ot)|0,i=(i=i+Math.imul(p,at)|0)+Math.imul(b,ot)|0,o=o+Math.imul(b,at)|0;var St=(u+(n=n+Math.imul(c,ft)|0)|0)+((8191&(i=(i=i+Math.imul(c,ut)|0)+Math.imul(d,ft)|0))<<13)|0;u=((o=o+Math.imul(d,ut)|0)+(i>>>13)|0)+(St>>>26)|0,St&=67108863,n=Math.imul(O,K),i=(i=Math.imul(O,D))+Math.imul(C,K)|0,o=Math.imul(C,D),n=n+Math.imul(L,F)|0,i=(i=i+Math.imul(L,W)|0)+Math.imul(P,F)|0,o=o+Math.imul(P,W)|0,n=n+Math.imul(T,V)|0,i=(i=i+Math.imul(T,Y)|0)+Math.imul(B,V)|0,o=o+Math.imul(B,Y)|0,n=n+Math.imul(E,X)|0,i=(i=i+Math.imul(E,G)|0)+Math.imul(k,X)|0,o=o+Math.imul(k,G)|0,n=n+Math.imul(S,Q)|0,i=(i=i+Math.imul(S,tt)|0)+Math.imul(x,Q)|0,o=o+Math.imul(x,tt)|0,n=n+Math.imul(w,rt)|0,i=(i=i+Math.imul(w,nt)|0)+Math.imul(_,rt)|0,o=o+Math.imul(_,nt)|0,n=n+Math.imul(y,ot)|0,i=(i=i+Math.imul(y,at)|0)+Math.imul(g,ot)|0,o=o+Math.imul(g,at)|0,n=n+Math.imul(p,ft)|0,i=(i=i+Math.imul(p,ut)|0)+Math.imul(b,ft)|0,o=o+Math.imul(b,ut)|0;var xt=(u+(n=n+Math.imul(c,ct)|0)|0)+((8191&(i=(i=i+Math.imul(c,dt)|0)+Math.imul(d,ct)|0))<<13)|0;u=((o=o+Math.imul(d,dt)|0)+(i>>>13)|0)+(xt>>>26)|0,xt&=67108863,n=Math.imul(z,K),i=(i=Math.imul(z,D))+Math.imul(U,K)|0,o=Math.imul(U,D),n=n+Math.imul(O,F)|0,i=(i=i+Math.imul(O,W)|0)+Math.imul(C,F)|0,o=o+Math.imul(C,W)|0,n=n+Math.imul(L,V)|0,i=(i=i+Math.imul(L,Y)|0)+Math.imul(P,V)|0,o=o+Math.imul(P,Y)|0,n=n+Math.imul(T,X)|0,i=(i=i+Math.imul(T,G)|0)+Math.imul(B,X)|0,o=o+Math.imul(B,G)|0,n=n+Math.imul(E,Q)|0,i=(i=i+Math.imul(E,tt)|0)+Math.imul(k,Q)|0,o=o+Math.imul(k,tt)|0,n=n+Math.imul(S,rt)|0,i=(i=i+Math.imul(S,nt)|0)+Math.imul(x,rt)|0,o=o+Math.imul(x,nt)|0,n=n+Math.imul(w,ot)|0,i=(i=i+Math.imul(w,at)|0)+Math.imul(_,ot)|0,o=o+Math.imul(_,at)|0,n=n+Math.imul(y,ft)|0,i=(i=i+Math.imul(y,ut)|0)+Math.imul(g,ft)|0,o=o+Math.imul(g,ut)|0,n=n+Math.imul(p,ct)|0,i=(i=i+Math.imul(p,dt)|0)+Math.imul(b,ct)|0,o=o+Math.imul(b,dt)|0;var At=(u+(n=n+Math.imul(c,pt)|0)|0)+((8191&(i=(i=i+Math.imul(c,bt)|0)+Math.imul(d,pt)|0))<<13)|0;u=((o=o+Math.imul(d,bt)|0)+(i>>>13)|0)+(At>>>26)|0,At&=67108863,n=Math.imul(z,F),i=(i=Math.imul(z,W))+Math.imul(U,F)|0,o=Math.imul(U,W),n=n+Math.imul(O,V)|0,i=(i=i+Math.imul(O,Y)|0)+Math.imul(C,V)|0,o=o+Math.imul(C,Y)|0,n=n+Math.imul(L,X)|0,i=(i=i+Math.imul(L,G)|0)+Math.imul(P,X)|0,o=o+Math.imul(P,G)|0,n=n+Math.imul(T,Q)|0,i=(i=i+Math.imul(T,tt)|0)+Math.imul(B,Q)|0,o=o+Math.imul(B,tt)|0,n=n+Math.imul(E,rt)|0,i=(i=i+Math.imul(E,nt)|0)+Math.imul(k,rt)|0,o=o+Math.imul(k,nt)|0,n=n+Math.imul(S,ot)|0,i=(i=i+Math.imul(S,at)|0)+Math.imul(x,ot)|0,o=o+Math.imul(x,at)|0,n=n+Math.imul(w,ft)|0,i=(i=i+Math.imul(w,ut)|0)+Math.imul(_,ft)|0,o=o+Math.imul(_,ut)|0,n=n+Math.imul(y,ct)|0,i=(i=i+Math.imul(y,dt)|0)+Math.imul(g,ct)|0,o=o+Math.imul(g,dt)|0;var Et=(u+(n=n+Math.imul(p,pt)|0)|0)+((8191&(i=(i=i+Math.imul(p,bt)|0)+Math.imul(b,pt)|0))<<13)|0;u=((o=o+Math.imul(b,bt)|0)+(i>>>13)|0)+(Et>>>26)|0,Et&=67108863,n=Math.imul(z,V),i=(i=Math.imul(z,Y))+Math.imul(U,V)|0,o=Math.imul(U,Y),n=n+Math.imul(O,X)|0,i=(i=i+Math.imul(O,G)|0)+Math.imul(C,X)|0,o=o+Math.imul(C,G)|0,n=n+Math.imul(L,Q)|0,i=(i=i+Math.imul(L,tt)|0)+Math.imul(P,Q)|0,o=o+Math.imul(P,tt)|0,n=n+Math.imul(T,rt)|0,i=(i=i+Math.imul(T,nt)|0)+Math.imul(B,rt)|0,o=o+Math.imul(B,nt)|0,n=n+Math.imul(E,ot)|0,i=(i=i+Math.imul(E,at)|0)+Math.imul(k,ot)|0,o=o+Math.imul(k,at)|0,n=n+Math.imul(S,ft)|0,i=(i=i+Math.imul(S,ut)|0)+Math.imul(x,ft)|0,o=o+Math.imul(x,ut)|0,n=n+Math.imul(w,ct)|0,i=(i=i+Math.imul(w,dt)|0)+Math.imul(_,ct)|0,o=o+Math.imul(_,dt)|0;var kt=(u+(n=n+Math.imul(y,pt)|0)|0)+((8191&(i=(i=i+Math.imul(y,bt)|0)+Math.imul(g,pt)|0))<<13)|0;u=((o=o+Math.imul(g,bt)|0)+(i>>>13)|0)+(kt>>>26)|0,kt&=67108863,n=Math.imul(z,X),i=(i=Math.imul(z,G))+Math.imul(U,X)|0,o=Math.imul(U,G),n=n+Math.imul(O,Q)|0,i=(i=i+Math.imul(O,tt)|0)+Math.imul(C,Q)|0,o=o+Math.imul(C,tt)|0,n=n+Math.imul(L,rt)|0,i=(i=i+Math.imul(L,nt)|0)+Math.imul(P,rt)|0,o=o+Math.imul(P,nt)|0,n=n+Math.imul(T,ot)|0,i=(i=i+Math.imul(T,at)|0)+Math.imul(B,ot)|0,o=o+Math.imul(B,at)|0,n=n+Math.imul(E,ft)|0,i=(i=i+Math.imul(E,ut)|0)+Math.imul(k,ft)|0,o=o+Math.imul(k,ut)|0,n=n+Math.imul(S,ct)|0,i=(i=i+Math.imul(S,dt)|0)+Math.imul(x,ct)|0,o=o+Math.imul(x,dt)|0;var Rt=(u+(n=n+Math.imul(w,pt)|0)|0)+((8191&(i=(i=i+Math.imul(w,bt)|0)+Math.imul(_,pt)|0))<<13)|0;u=((o=o+Math.imul(_,bt)|0)+(i>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,n=Math.imul(z,Q),i=(i=Math.imul(z,tt))+Math.imul(U,Q)|0,o=Math.imul(U,tt),n=n+Math.imul(O,rt)|0,i=(i=i+Math.imul(O,nt)|0)+Math.imul(C,rt)|0,o=o+Math.imul(C,nt)|0,n=n+Math.imul(L,ot)|0,i=(i=i+Math.imul(L,at)|0)+Math.imul(P,ot)|0,o=o+Math.imul(P,at)|0,n=n+Math.imul(T,ft)|0,i=(i=i+Math.imul(T,ut)|0)+Math.imul(B,ft)|0,o=o+Math.imul(B,ut)|0,n=n+Math.imul(E,ct)|0,i=(i=i+Math.imul(E,dt)|0)+Math.imul(k,ct)|0,o=o+Math.imul(k,dt)|0;var Tt=(u+(n=n+Math.imul(S,pt)|0)|0)+((8191&(i=(i=i+Math.imul(S,bt)|0)+Math.imul(x,pt)|0))<<13)|0;u=((o=o+Math.imul(x,bt)|0)+(i>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,n=Math.imul(z,rt),i=(i=Math.imul(z,nt))+Math.imul(U,rt)|0,o=Math.imul(U,nt),n=n+Math.imul(O,ot)|0,i=(i=i+Math.imul(O,at)|0)+Math.imul(C,ot)|0,o=o+Math.imul(C,at)|0,n=n+Math.imul(L,ft)|0,i=(i=i+Math.imul(L,ut)|0)+Math.imul(P,ft)|0,o=o+Math.imul(P,ut)|0,n=n+Math.imul(T,ct)|0,i=(i=i+Math.imul(T,dt)|0)+Math.imul(B,ct)|0,o=o+Math.imul(B,dt)|0;var Bt=(u+(n=n+Math.imul(E,pt)|0)|0)+((8191&(i=(i=i+Math.imul(E,bt)|0)+Math.imul(k,pt)|0))<<13)|0;u=((o=o+Math.imul(k,bt)|0)+(i>>>13)|0)+(Bt>>>26)|0,Bt&=67108863,n=Math.imul(z,ot),i=(i=Math.imul(z,at))+Math.imul(U,ot)|0,o=Math.imul(U,at),n=n+Math.imul(O,ft)|0,i=(i=i+Math.imul(O,ut)|0)+Math.imul(C,ft)|0,o=o+Math.imul(C,ut)|0,n=n+Math.imul(L,ct)|0,i=(i=i+Math.imul(L,dt)|0)+Math.imul(P,ct)|0,o=o+Math.imul(P,dt)|0;var It=(u+(n=n+Math.imul(T,pt)|0)|0)+((8191&(i=(i=i+Math.imul(T,bt)|0)+Math.imul(B,pt)|0))<<13)|0;u=((o=o+Math.imul(B,bt)|0)+(i>>>13)|0)+(It>>>26)|0,It&=67108863,n=Math.imul(z,ft),i=(i=Math.imul(z,ut))+Math.imul(U,ft)|0,o=Math.imul(U,ut),n=n+Math.imul(O,ct)|0,i=(i=i+Math.imul(O,dt)|0)+Math.imul(C,ct)|0,o=o+Math.imul(C,dt)|0;var Lt=(u+(n=n+Math.imul(L,pt)|0)|0)+((8191&(i=(i=i+Math.imul(L,bt)|0)+Math.imul(P,pt)|0))<<13)|0;u=((o=o+Math.imul(P,bt)|0)+(i>>>13)|0)+(Lt>>>26)|0,Lt&=67108863,n=Math.imul(z,ct),i=(i=Math.imul(z,dt))+Math.imul(U,ct)|0,o=Math.imul(U,dt);var Pt=(u+(n=n+Math.imul(O,pt)|0)|0)+((8191&(i=(i=i+Math.imul(O,bt)|0)+Math.imul(C,pt)|0))<<13)|0;u=((o=o+Math.imul(C,bt)|0)+(i>>>13)|0)+(Pt>>>26)|0,Pt&=67108863;var jt=(u+(n=Math.imul(z,pt))|0)+((8191&(i=(i=Math.imul(z,bt))+Math.imul(U,pt)|0))<<13)|0;return u=((o=Math.imul(U,bt))+(i>>>13)|0)+(jt>>>26)|0,jt&=67108863,f[0]=mt,f[1]=yt,f[2]=gt,f[3]=vt,f[4]=wt,f[5]=_t,f[6]=Mt,f[7]=St,f[8]=xt,f[9]=At,f[10]=Et,f[11]=kt,f[12]=Rt,f[13]=Tt,f[14]=Bt,f[15]=It,f[16]=Lt,f[17]=Pt,f[18]=jt,0!==u&&(f[19]=u,r.length++),r};function y(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var n=0,i=0,o=0;o>>26)|0)>>>26,a&=67108863}r.words[o]=s,n=a,a=i}return 0!==n?r.words[o]=n:r.length--,r._strip()}function g(t,e,r){return y(t,e,r)}function v(t,e){this.x=t,this.y=e}Math.imul||(m=b),o.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?m(this,t,e):r<63?b(this,t,e):r<1024?y(this,t,e):g(this,t,e)},v.prototype.makeRBT=function(t){for(var e=new Array(t),r=o.prototype._countBits(t)-1,n=0;n>=1;return n},v.prototype.permute=function(t,e,r,n,i,o){for(var a=0;a>>=1)i++;return 1<>>=13,r[2*a+1]=8191&o,o>>>=13;for(a=2*e;a>=26,r+=o/67108864|0,r+=a>>>26,this.words[i]=67108863&a}return 0!==r&&(this.words[i]=r,this.length++),e?this.ineg():this},o.prototype.muln=function(t){return this.clone().imuln(t)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r>>i&1}return e}(t);if(0===e.length)return new o(1);for(var r=this,n=0;n=0);var e,r=t%26,i=(t-r)/26,o=67108863>>>26-r<<26-r;if(0!==r){var a=0;for(e=0;e>>26-r}a&&(this.words[e]=a,this.length++)}if(0!==i){for(e=this.length-1;e>=0;e--)this.words[e+i]=this.words[e];for(e=0;e=0),i=e?(e-e%26)/26:0;var o=t%26,a=Math.min((t-o)/26,this.length),s=67108863^67108863>>>o<a)for(this.length-=a,u=0;u=0&&(0!==h||u>=i);u--){var c=0|this.words[u];this.words[u]=h<<26-o|c>>>o,h=c&s}return f&&0!==h&&(f.words[f.length++]=h),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},o.prototype.ishrn=function(t,e,r){return n(0===this.negative),this.iushrn(t,e,r)},o.prototype.shln=function(t){return this.clone().ishln(t)},o.prototype.ushln=function(t){return this.clone().iushln(t)},o.prototype.shrn=function(t){return this.clone().ishrn(t)},o.prototype.ushrn=function(t){return this.clone().iushrn(t)},o.prototype.testn=function(t){n("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26,i=1<=0);var e=t%26,r=(t-e)/26;if(n(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 i=67108863^67108863>>>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},o.prototype.isubn=function(t){if(n("number"==typeof t),n(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>26)-(f/67108864|0),this.words[i+r]=67108863&o}for(;i>26,this.words[i+r]=67108863&o;if(0===s)return this._strip();for(n(-1===s),s=0,i=0;i>26,this.words[i]=67108863&o;return this.negative=1,this._strip()},o.prototype._wordDiv=function(t,e){var r=(this.length,t.length),n=this.clone(),i=t,a=0|i.words[i.length-1];0!==(r=26-this._countBits(a))&&(i=i.ushln(r),n.iushln(r),a=0|i.words[i.length-1]);var s,f=n.length-i.length;if("mod"!==e){(s=new o(null)).length=f+1,s.words=new Array(s.length);for(var u=0;u=0;c--){var d=67108864*(0|n.words[i.length+c])+(0|n.words[i.length+c-1]);for(d=Math.min(d/a|0,67108863),n._ishlnsubmul(i,d,c);0!==n.negative;)d--,n.negative=0,n._ishlnsubmul(i,1,c),n.isZero()||(n.negative^=1);s&&(s.words[c]=d)}return s&&s._strip(),n._strip(),"div"!==e&&0!==r&&n.iushrn(r),{div:s||null,mod:n}},o.prototype.divmod=function(t,e,r){return n(!t.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===t.negative?(s=this.neg().divmod(t,e),"mod"!==e&&(i=s.div.neg()),"div"!==e&&(a=s.mod.neg(),r&&0!==a.negative&&a.iadd(t)),{div:i,mod:a}):0===this.negative&&0!==t.negative?(s=this.divmod(t.neg(),e),"mod"!==e&&(i=s.div.neg()),{div:i,mod:s.mod}):0!=(this.negative&t.negative)?(s=this.neg().divmod(t.neg(),e),"div"!==e&&(a=s.mod.neg(),r&&0!==a.negative&&a.isub(t)),{div:s.div,mod:a}):t.length>this.length||this.cmp(t)<0?{div:new o(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new o(this.modrn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new o(this.modrn(t.words[0]))}:this._wordDiv(t,e);var i,a,s},o.prototype.div=function(t){return this.divmod(t,"div",!1).div},o.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},o.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},o.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,n=t.ushrn(1),i=t.andln(1),o=r.cmp(n);return o<0||1===i&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},o.prototype.modrn=function(t){var e=t<0;e&&(t=-t),n(t<=67108863);for(var r=(1<<26)%t,i=0,o=this.length-1;o>=0;o--)i=(r*i+(0|this.words[o]))%t;return e?-i:i},o.prototype.modn=function(t){return this.modrn(t)},o.prototype.idivn=function(t){var e=t<0;e&&(t=-t),n(t<=67108863);for(var r=0,i=this.length-1;i>=0;i--){var o=(0|this.words[i])+67108864*r;this.words[i]=o/t|0,r=o%t}return this._strip(),e?this.ineg():this},o.prototype.divn=function(t){return this.clone().idivn(t)},o.prototype.egcd=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i=new o(1),a=new o(0),s=new o(0),f=new o(1),u=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++u;for(var h=r.clone(),c=e.clone();!e.isZero();){for(var d=0,l=1;0==(e.words[0]&l)&&d<26;++d,l<<=1);if(d>0)for(e.iushrn(d);d-- >0;)(i.isOdd()||a.isOdd())&&(i.iadd(h),a.isub(c)),i.iushrn(1),a.iushrn(1);for(var p=0,b=1;0==(r.words[0]&b)&&p<26;++p,b<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(s.isOdd()||f.isOdd())&&(s.iadd(h),f.isub(c)),s.iushrn(1),f.iushrn(1);e.cmp(r)>=0?(e.isub(r),i.isub(s),a.isub(f)):(r.isub(e),s.isub(i),f.isub(a))}return{a:s,b:f,gcd:r.iushln(u)}},o.prototype._invmp=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i,a=new o(1),s=new o(0),f=r.clone();e.cmpn(1)>0&&r.cmpn(1)>0;){for(var u=0,h=1;0==(e.words[0]&h)&&u<26;++u,h<<=1);if(u>0)for(e.iushrn(u);u-- >0;)a.isOdd()&&a.iadd(f),a.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;)s.isOdd()&&s.iadd(f),s.iushrn(1);e.cmp(r)>=0?(e.isub(r),a.isub(s)):(r.isub(e),s.isub(a))}return(i=0===e.cmpn(1)?a:s).cmpn(0)<0&&i.iadd(t),i},o.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var n=0;e.isEven()&&r.isEven();n++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var i=e.cmp(r);if(i<0){var o=e;e=r,r=o}else if(0===i||0===r.cmpn(1))break;e.isub(r)}return r.iushln(n)},o.prototype.invm=function(t){return this.egcd(t).a.umod(t)},o.prototype.isEven=function(){return 0==(1&this.words[0])},o.prototype.isOdd=function(){return 1==(1&this.words[0])},o.prototype.andln=function(t){return this.words[0]&t},o.prototype.bincn=function(t){n("number"==typeof t);var e=t%26,r=(t-e)/26,i=1<>>26,s&=67108863,this.words[a]=s}return 0!==o&&(this.words[a]=o,this.length++),this},o.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},o.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),n(t<=67108863,"Number is too big");var i=0|this.words[0];e=i===t?0:it.length)return 1;if(this.length=0;r--){var n=0|this.words[r],i=0|t.words[r];if(n!==i){ni&&(e=1);break}}return e},o.prototype.gtn=function(t){return 1===this.cmpn(t)},o.prototype.gt=function(t){return 1===this.cmp(t)},o.prototype.gten=function(t){return this.cmpn(t)>=0},o.prototype.gte=function(t){return this.cmp(t)>=0},o.prototype.ltn=function(t){return-1===this.cmpn(t)},o.prototype.lt=function(t){return-1===this.cmp(t)},o.prototype.lten=function(t){return this.cmpn(t)<=0},o.prototype.lte=function(t){return this.cmp(t)<=0},o.prototype.eqn=function(t){return 0===this.cmpn(t)},o.prototype.eq=function(t){return 0===this.cmp(t)},o.red=function(t){return new E(t)},o.prototype.toRed=function(t){return n(!this.red,"Already a number in reduction context"),n(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},o.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(t){return this.red=t,this},o.prototype.forceRed=function(t){return n(!this.red,"Already a number in reduction context"),this._forceRed(t)},o.prototype.redAdd=function(t){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},o.prototype.redIAdd=function(t){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},o.prototype.redSub=function(t){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},o.prototype.redISub=function(t){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},o.prototype.redShl=function(t){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},o.prototype.redMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},o.prototype.redIMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},o.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(t){return n(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var w={k256:null,p224:null,p192:null,p25519:null};function _(t,e){this.name=t,this.p=new o(e,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function M(){_.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function S(){_.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function x(){_.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function A(){_.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function E(t){if("string"==typeof t){var e=o._prime(t);this.m=e.p,this.prime=e}else n(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function k(t){E.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new o(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)}_.prototype._tmp=function(){var t=new o(null);return t.words=new Array(Math.ceil(this.n/13)),t},_.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(e>this.n);var n=e0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},_.prototype.split=function(t,e){t.iushrn(this.n,0,e)},_.prototype.imulK=function(t){return t.imul(this.k)},i(M,_),M.prototype.split=function(t,e){for(var r=4194303,n=Math.min(t.length,9),i=0;i>>22,o=a}o>>>=22,t.words[i-10]=o,0===o&&t.length>10?t.length-=10:t.length-=9},M.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>>=26,t.words[r]=i,e=n}return 0!==e&&(t.words[t.length++]=e),t},o._prime=function(t){if(w[t])return w[t];var e;if("k256"===t)e=new M;else if("p224"===t)e=new S;else if("p192"===t)e=new x;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new A}return w[t]=e,e},E.prototype._verify1=function(t){n(0===t.negative,"red works only with positives"),n(t.red,"red works only with red numbers")},E.prototype._verify2=function(t,e){n(0==(t.negative|e.negative),"red works only with positives"),n(t.red&&t.red===e.red,"red works only with red numbers")},E.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):(h(t,t.umod(this.m)._forceRed(this)),t)},E.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},E.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},E.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},E.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},E.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},E.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},E.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},E.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},E.prototype.isqr=function(t){return this.imul(t,t.clone())},E.prototype.sqr=function(t){return this.mul(t,t)},E.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(n(e%2==1),3===e){var r=this.m.add(new o(1)).iushrn(2);return this.pow(t,r)}for(var i=this.m.subn(1),a=0;!i.isZero()&&0===i.andln(1);)a++,i.iushrn(1);n(!i.isZero());var s=new o(1).toRed(this),f=s.redNeg(),u=this.m.subn(1).iushrn(1),h=this.m.bitLength();for(h=new o(2*h*h).toRed(this);0!==this.pow(h,u).cmp(f);)h.redIAdd(f);for(var c=this.pow(h,i),d=this.pow(t,i.addn(1).iushrn(1)),l=this.pow(t,i),p=a;0!==l.cmp(s);){for(var b=l,m=0;0!==b.cmp(s);m++)b=b.redSqr();n(m=0;n--){for(var u=e.words[n],h=f-1;h>=0;h--){var c=u>>h&1;i!==r[0]&&(i=this.sqr(i)),0!==c||0!==a?(a<<=1,a|=c,(4===++s||0===n&&0===h)&&(i=this.mul(i,r[a]),s=0,a=0)):s=0}f=26}return i},E.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},E.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},o.mont=function(t){return new k(t)},i(k,E),k.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},k.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},k.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},k.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new o(0)._forceRed(this);var r=t.mul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),a=i;return i.cmp(this.m)>=0?a=i.isub(this.m):i.cmpn(0)<0&&(a=i.iadd(this.m)),a._forceRed(this)},k.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(void 0===e||e,this)},{buffer:8}],58:[function(t,e,r){(function(r){"use strict";var n=t("is-hex-prefixed"),i=t("strip-hex-prefix");function o(t){var e=t;if("string"!=typeof e)throw new Error("[ethjs-util] while padding to even, value must be string, is currently "+typeof e+", while padToEven.");return e.length%2&&(e="0"+e),e}function a(t){return"0x"+t.toString(16)}e.exports={arrayContainsArray:function(t,e,r){if(!0!==Array.isArray(t))throw new Error("[ethjs-util] method arrayContainsArray requires input 'superset' to be an array got type '"+typeof t+"'");if(!0!==Array.isArray(e))throw new Error("[ethjs-util] method arrayContainsArray requires input 'subset' to be an array got type '"+typeof e+"'");return e[Boolean(r)?"some":"every"]((function(e){return t.indexOf(e)>=0}))},intToBuffer:function(t){var e=a(t);return new r(o(e.slice(2)),"hex")},getBinarySize:function(t){if("string"!=typeof t)throw new Error("[ethjs-util] while getting binary size, method getBinarySize requires input 'str' to be type String, got '"+typeof t+"'.");return r.byteLength(t,"utf8")},isHexPrefixed:n,stripHexPrefix:i,padToEven:o,intToHex:a,fromAscii:function(t){for(var e="",r=0;r0&&s.length>o){s.warned=!0;var f=new Error("Possible EventEmitter memory leak detected. "+s.length+' "'+String(e)+'" listeners added. Use emitter.setMaxListeners() to increase limit.');f.name="MaxListenersExceededWarning",f.emitter=t,f.type=e,f.count=s.length,"object"==typeof console&&console.warn&&console.warn("%s: %s",f.name,f.message)}}else s=a[e]=r,++t._eventsCount;return t}function y(){if(!this.fired)switch(this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length){case 0:return this.listener.call(this.target);case 1:return this.listener.call(this.target,arguments[0]);case 2:return this.listener.call(this.target,arguments[0],arguments[1]);case 3:return this.listener.call(this.target,arguments[0],arguments[1],arguments[2]);default:for(var t=new Array(arguments.length),e=0;e1&&(e=arguments[1]),e instanceof Error)throw e;var f=new Error('Unhandled "error" event. ('+e+")");throw f.context=e,f}if(!(r=a[t]))return!1;var u="function"==typeof r;switch(n=arguments.length){case 1:c(r,u,this);break;case 2:d(r,u,this,arguments[1]);break;case 3:l(r,u,this,arguments[1],arguments[2]);break;case 4:p(r,u,this,arguments[1],arguments[2],arguments[3]);break;default:for(i=new Array(n-1),o=1;o=0;a--)if(r[a]===e||r[a].listener===e){s=r[a].listener,o=a;break}if(o<0)return this;0===o?r.shift():function(t,e){for(var r=e,n=r+1,i=t.length;n=0;o--)this.removeListener(t,e[o]);return this},a.prototype.listeners=function(t){return v(this,t,!0)},a.prototype.rawListeners=function(t){return v(this,t,!1)},a.listenerCount=function(t,e){return"function"==typeof t.listenerCount?t.listenerCount(e):w.call(t,e)},a.prototype.listenerCount=w,a.prototype.eventNames=function(){return this._eventsCount>0?Reflect.ownKeys(this._events):[]}},{}],60:[function(t,e,r){"use strict";var n=t("safe-buffer").Buffer,i=t("stream").Transform;function o(t){i.call(this),this._block=n.allocUnsafe(t),this._blockSize=t,this._blockOffset=0,this._length=[0,0,0,0],this._finalized=!1}t("inherits")(o,i),o.prototype._transform=function(t,e,r){var n=null;try{this.update(t,e)}catch(t){n=t}r(n)},o.prototype._flush=function(t){var e=null;try{this.push(this.digest())}catch(t){e=t}t(e)},o.prototype.update=function(t,e){if(function(t,e){if(!n.isBuffer(t)&&"string"!=typeof t)throw new TypeError(e+" must be a string or a buffer")}(t,"Data"),this._finalized)throw new Error("Digest already called");n.isBuffer(t)||(t=n.from(t,e));for(var r=this._block,i=0;this._blockOffset+t.length-i>=this._blockSize;){for(var o=this._blockOffset;o0;++a)this._length[a]+=s,(s=this._length[a]/4294967296|0)>0&&(this._length[a]-=4294967296*s);return this},o.prototype._update=function(){throw new Error("_update is not implemented")},o.prototype.digest=function(t){if(this._finalized)throw new Error("Digest already called");this._finalized=!0;var e=this._digest();void 0!==t&&(e=e.toString(t)),this._block.fill(0),this._blockOffset=0;for(var r=0;r<4;++r)this._length[r]=0;return e},o.prototype._digest=function(){throw new Error("_digest is not implemented")},e.exports=o},{inherits:75,"safe-buffer":124,stream:136}],61:[function(t,e,r){var n=r;n.utils=t("./hash/utils"),n.common=t("./hash/common"),n.sha=t("./hash/sha"),n.ripemd=t("./hash/ripemd"),n.hmac=t("./hash/hmac"),n.sha1=n.sha.sha1,n.sha256=n.sha.sha256,n.sha224=n.sha.sha224,n.sha384=n.sha.sha384,n.sha512=n.sha.sha512,n.ripemd160=n.ripemd.ripemd160},{"./hash/common":62,"./hash/hmac":63,"./hash/ripemd":64,"./hash/sha":65,"./hash/utils":72}],62:[function(t,e,r){"use strict";var n=t("./utils"),i=t("minimalistic-assert");function o(){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}r.BlockHash=o,o.prototype.update=function(t,e){if(t=n.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=n.join32(t,0,t.length-r,this.endian);for(var i=0;i>>24&255,n[i++]=t>>>16&255,n[i++]=t>>>8&255,n[i++]=255&t}else for(n[i++]=255&t,n[i++]=t>>>8&255,n[i++]=t>>>16&255,n[i++]=t>>>24&255,n[i++]=0,n[i++]=0,n[i++]=0,n[i++]=0,o=8;othis.blockSize&&(t=(new this.Hash).update(t).digest()),i(t.length<=this.blockSize);for(var e=t.length;e>>3},r.g1_256=function(t){return n(t,17)^n(t,19)^t>>>10}},{"../utils":72}],72:[function(t,e,r){"use strict";var n=t("minimalistic-assert"),i=t("inherits");function o(t,e){return 55296==(64512&t.charCodeAt(e))&&(!(e<0||e+1>=t.length)&&56320==(64512&t.charCodeAt(e+1)))}function a(t){return(t>>>24|t>>>8&65280|t<<8&16711680|(255&t)<<24)>>>0}function s(t){return 1===t.length?"0"+t:t}function f(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}r.inherits=i,r.toArray=function(t,e){if(Array.isArray(t))return t.slice();if(!t)return[];var r=[];if("string"==typeof t)if(e){if("hex"===e)for((t=t.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(t="0"+t),i=0;i>6|192,r[n++]=63&a|128):o(t,i)?(a=65536+((1023&a)<<10)+(1023&t.charCodeAt(++i)),r[n++]=a>>18|240,r[n++]=a>>12&63|128,r[n++]=a>>6&63|128,r[n++]=63&a|128):(r[n++]=a>>12|224,r[n++]=a>>6&63|128,r[n++]=63&a|128)}else for(i=0;i>>0}return a},r.split32=function(t,e){for(var r=new Array(4*t.length),n=0,i=0;n>>24,r[i+1]=o>>>16&255,r[i+2]=o>>>8&255,r[i+3]=255&o):(r[i+3]=o>>>24,r[i+2]=o>>>16&255,r[i+1]=o>>>8&255,r[i]=255&o)}return r},r.rotr32=function(t,e){return t>>>e|t<<32-e},r.rotl32=function(t,e){return t<>>32-e},r.sum32=function(t,e){return t+e>>>0},r.sum32_3=function(t,e,r){return t+e+r>>>0},r.sum32_4=function(t,e,r,n){return t+e+r+n>>>0},r.sum32_5=function(t,e,r,n,i){return t+e+r+n+i>>>0},r.sum64=function(t,e,r,n){var i=t[e],o=n+t[e+1]>>>0,a=(o>>0,t[e+1]=o},r.sum64_hi=function(t,e,r,n){return(e+n>>>0>>0},r.sum64_lo=function(t,e,r,n){return e+n>>>0},r.sum64_4_hi=function(t,e,r,n,i,o,a,s){var f=0,u=e;return f+=(u=u+n>>>0)>>0)>>0)>>0},r.sum64_4_lo=function(t,e,r,n,i,o,a,s){return e+n+o+s>>>0},r.sum64_5_hi=function(t,e,r,n,i,o,a,s,f,u){var h=0,c=e;return h+=(c=c+n>>>0)>>0)>>0)>>0)>>0},r.sum64_5_lo=function(t,e,r,n,i,o,a,s,f,u){return e+n+o+s+u>>>0},r.rotr64_hi=function(t,e,r){return(e<<32-r|t>>>r)>>>0},r.rotr64_lo=function(t,e,r){return(t<<32-r|e>>>r)>>>0},r.shr64_hi=function(t,e,r){return t>>>r},r.shr64_lo=function(t,e,r){return(t<<32-r|e>>>r)>>>0}},{inherits:75,"minimalistic-assert":101}],73:[function(t,e,r){"use strict";var n=t("hash.js"),i=t("minimalistic-crypto-utils"),o=t("minimalistic-assert");function a(t){if(!(this instanceof a))return new a(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=i.toArray(t.entropy,t.entropyEnc||"hex"),r=i.toArray(t.nonce,t.nonceEnc||"hex"),n=i.toArray(t.pers,t.persEnc||"hex");o(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,r,n)}e.exports=a,a.prototype._init=function(t,e,r){var n=t.concat(e).concat(r);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var i=0;i=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(t.concat(r||[])),this._reseed=1},a.prototype.generate=function(t,e,r,n){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");"string"!=typeof e&&(n=r,r=e,e=null),r&&(r=i.toArray(r,n||"hex"),this._update(r));for(var o=[];o.length>1,h=-7,c=r?i-1:0,d=r?-1:1,l=t[e+c];for(c+=d,o=l&(1<<-h)-1,l>>=-h,h+=s;h>0;o=256*o+t[e+c],c+=d,h-=8);for(a=o&(1<<-h)-1,o>>=-h,h+=n;h>0;a=256*a+t[e+c],c+=d,h-=8);if(0===o)o=1-u;else{if(o===f)return a?NaN:1/0*(l?-1:1);a+=Math.pow(2,n),o-=u}return(l?-1:1)*a*Math.pow(2,o-n)},r.write=function(t,e,r,n,i,o){var a,s,f,u=8*o-i-1,h=(1<>1,d=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,l=n?0:o-1,p=n?1:-1,b=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=isNaN(e)?1:0,a=h):(a=Math.floor(Math.log(e)/Math.LN2),e*(f=Math.pow(2,-a))<1&&(a--,f*=2),(e+=a+c>=1?d/f:d*Math.pow(2,1-c))*f>=2&&(a++,f/=2),a+c>=h?(s=0,a=h):a+c>=1?(s=(e*f-1)*Math.pow(2,i),a+=c):(s=e*Math.pow(2,c-1)*Math.pow(2,i),a=0));i>=8;t[r+l]=255&s,l+=p,s/=256,i-=8);for(a=a<0;t[r+l]=255&a,l+=p,a/=256,u-=8);t[r+l-p]|=128*b}},{}],75:[function(t,e,r){"function"==typeof Object.create?e.exports=function(t,e){e&&(t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:e.exports=function(t,e){if(e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}}},{}],76:[function(t,e,r){function n(t){return!!t.constructor&&"function"==typeof t.constructor.isBuffer&&t.constructor.isBuffer(t)} /*! * Determine if an object is a Buffer * * @author Feross Aboukhadijeh * @license MIT */ -e.exports=function(t){return null!=t&&(n(t)||function(t){return"function"==typeof t.readFloatLE&&"function"==typeof t.slice&&n(t.slice(0,0))}(t)||!!t._isBuffer)}},{}],77:[function(t,e,r){e.exports=function(t){if("string"!=typeof t)throw new Error("[is-hex-prefixed] value must be type 'string', is currently type "+typeof t+", while checking isHexPrefixed.");return"0x"===t.slice(0,2)}},{}],78:[function(t,e,r){var n={}.toString;e.exports=Array.isArray||function(t){return"[object Array]"==n.call(t)}},{}],79:[function(t,e,r){e.exports=t("./lib/api")(t("./lib/keccak"))},{"./lib/api":80,"./lib/keccak":84}],80:[function(t,e,r){const n=t("./keccak"),i=t("./shake");e.exports=function(t){const e=n(t),r=i(t);return function(t,n){switch("string"==typeof t?t.toLowerCase():t){case"keccak224":return new e(1152,448,null,224,n);case"keccak256":return new e(1088,512,null,256,n);case"keccak384":return new e(832,768,null,384,n);case"keccak512":return new e(576,1024,null,512,n);case"sha3-224":return new e(1152,448,6,224,n);case"sha3-256":return new e(1088,512,6,256,n);case"sha3-384":return new e(832,768,6,384,n);case"sha3-512":return new e(576,1024,6,512,n);case"shake128":return new r(1344,256,31,n);case"shake256":return new r(1088,512,31,n);default:throw new Error("Invalid algorithm: "+t)}}}},{"./keccak":81,"./shake":82}],81:[function(t,e,r){(function(r){const{Transform:n}=t("readable-stream");e.exports=t=>class e extends n{constructor(e,r,n,i,o){super(o),this._rate=e,this._capacity=r,this._delimitedSuffix=n,this._hashBitLength=i,this._options=o,this._state=new t,this._state.initialize(e,r),this._finalized=!1}_transform(t,e,r){let n=null;try{this.update(t,e)}catch(t){n=t}r(n)}_flush(t){let e=null;try{this.push(this.digest())}catch(t){e=t}t(e)}update(t,e){if(!r.isBuffer(t)&&"string"!=typeof t)throw new TypeError("Data must be a string or a buffer");if(this._finalized)throw new Error("Digest already called");return r.isBuffer(t)||(t=r.from(t,e)),this._state.absorb(t),this}digest(t){if(this._finalized)throw new Error("Digest already called");this._finalized=!0,this._delimitedSuffix&&this._state.absorbLastFewBits(this._delimitedSuffix);let e=this._state.squeeze(this._hashBitLength/8);return void 0!==t&&(e=e.toString(t)),this._resetState(),e}_resetState(){return this._state.initialize(this._rate,this._capacity),this}_clone(){const t=new e(this._rate,this._capacity,this._delimitedSuffix,this._hashBitLength,this._options);return this._state.copy(t._state),t._finalized=this._finalized,t}}}).call(this,t("buffer").Buffer)},{buffer:9,"readable-stream":99}],82:[function(t,e,r){(function(r){const{Transform:n}=t("readable-stream");e.exports=t=>class e extends n{constructor(e,r,n,i){super(i),this._rate=e,this._capacity=r,this._delimitedSuffix=n,this._options=i,this._state=new t,this._state.initialize(e,r),this._finalized=!1}_transform(t,e,r){let n=null;try{this.update(t,e)}catch(t){n=t}r(n)}_flush(){}_read(t){this.push(this.squeeze(t))}update(t,e){if(!r.isBuffer(t)&&"string"!=typeof t)throw new TypeError("Data must be a string or a buffer");if(this._finalized)throw new Error("Squeeze already called");return r.isBuffer(t)||(t=r.from(t,e)),this._state.absorb(t),this}squeeze(t,e){this._finalized||(this._finalized=!0,this._state.absorbLastFewBits(this._delimitedSuffix));let r=this._state.squeeze(t);return void 0!==e&&(r=r.toString(e)),r}_resetState(){return this._state.initialize(this._rate,this._capacity),this}_clone(){const t=new e(this._rate,this._capacity,this._delimitedSuffix,this._options);return this._state.copy(t._state),t._finalized=this._finalized,t}}}).call(this,t("buffer").Buffer)},{buffer:9,"readable-stream":99}],83:[function(t,e,r){const n=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648];r.p1600=function(t){for(let e=0;e<24;++e){const r=t[0]^t[10]^t[20]^t[30]^t[40],i=t[1]^t[11]^t[21]^t[31]^t[41],o=t[2]^t[12]^t[22]^t[32]^t[42],a=t[3]^t[13]^t[23]^t[33]^t[43],s=t[4]^t[14]^t[24]^t[34]^t[44],f=t[5]^t[15]^t[25]^t[35]^t[45],u=t[6]^t[16]^t[26]^t[36]^t[46],h=t[7]^t[17]^t[27]^t[37]^t[47],c=t[8]^t[18]^t[28]^t[38]^t[48],d=t[9]^t[19]^t[29]^t[39]^t[49];let l=c^(o<<1|a>>>31),p=d^(a<<1|o>>>31);const b=t[0]^l,m=t[1]^p,y=t[10]^l,g=t[11]^p,v=t[20]^l,w=t[21]^p,_=t[30]^l,M=t[31]^p,S=t[40]^l,x=t[41]^p;l=r^(s<<1|f>>>31),p=i^(f<<1|s>>>31);const A=t[2]^l,E=t[3]^p,k=t[12]^l,R=t[13]^p,T=t[22]^l,B=t[23]^p,I=t[32]^l,L=t[33]^p,P=t[42]^l,j=t[43]^p;l=o^(u<<1|h>>>31),p=a^(h<<1|u>>>31);const O=t[4]^l,C=t[5]^p,N=t[14]^l,z=t[15]^p,U=t[24]^l,q=t[25]^p,K=t[34]^l,D=t[35]^p,H=t[44]^l,F=t[45]^p;l=s^(c<<1|d>>>31),p=f^(d<<1|c>>>31);const W=t[6]^l,Z=t[7]^p,V=t[16]^l,Y=t[17]^p,J=t[26]^l,X=t[27]^p,G=t[36]^l,$=t[37]^p,Q=t[46]^l,tt=t[47]^p;l=u^(r<<1|i>>>31),p=h^(i<<1|r>>>31);const et=t[8]^l,rt=t[9]^p,nt=t[18]^l,it=t[19]^p,ot=t[28]^l,at=t[29]^p,st=t[38]^l,ft=t[39]^p,ut=t[48]^l,ht=t[49]^p,ct=b,dt=m,lt=g<<4|y>>>28,pt=y<<4|g>>>28,bt=v<<3|w>>>29,mt=w<<3|v>>>29,yt=M<<9|_>>>23,gt=_<<9|M>>>23,vt=S<<18|x>>>14,wt=x<<18|S>>>14,_t=A<<1|E>>>31,Mt=E<<1|A>>>31,St=R<<12|k>>>20,xt=k<<12|R>>>20,At=T<<10|B>>>22,Et=B<<10|T>>>22,kt=L<<13|I>>>19,Rt=I<<13|L>>>19,Tt=P<<2|j>>>30,Bt=j<<2|P>>>30,It=C<<30|O>>>2,Lt=O<<30|C>>>2,Pt=N<<6|z>>>26,jt=z<<6|N>>>26,Ot=q<<11|U>>>21,Ct=U<<11|q>>>21,Nt=K<<15|D>>>17,zt=D<<15|K>>>17,Ut=F<<29|H>>>3,qt=H<<29|F>>>3,Kt=W<<28|Z>>>4,Dt=Z<<28|W>>>4,Ht=Y<<23|V>>>9,Ft=V<<23|Y>>>9,Wt=J<<25|X>>>7,Zt=X<<25|J>>>7,Vt=G<<21|$>>>11,Yt=$<<21|G>>>11,Jt=tt<<24|Q>>>8,Xt=Q<<24|tt>>>8,Gt=et<<27|rt>>>5,$t=rt<<27|et>>>5,Qt=nt<<20|it>>>12,te=it<<20|nt>>>12,ee=at<<7|ot>>>25,re=ot<<7|at>>>25,ne=st<<8|ft>>>24,ie=ft<<8|st>>>24,oe=ut<<14|ht>>>18,ae=ht<<14|ut>>>18;t[0]=ct^~St&Ot,t[1]=dt^~xt&Ct,t[10]=Kt^~Qt&bt,t[11]=Dt^~te&mt,t[20]=_t^~Pt&Wt,t[21]=Mt^~jt&Zt,t[30]=Gt^~lt&At,t[31]=$t^~pt&Et,t[40]=It^~Ht&ee,t[41]=Lt^~Ft&re,t[2]=St^~Ot&Vt,t[3]=xt^~Ct&Yt,t[12]=Qt^~bt&kt,t[13]=te^~mt&Rt,t[22]=Pt^~Wt&ne,t[23]=jt^~Zt&ie,t[32]=lt^~At&Nt,t[33]=pt^~Et&zt,t[42]=Ht^~ee&yt,t[43]=Ft^~re>,t[4]=Ot^~Vt&oe,t[5]=Ct^~Yt&ae,t[14]=bt^~kt&Ut,t[15]=mt^~Rt&qt,t[24]=Wt^~ne&vt,t[25]=Zt^~ie&wt,t[34]=At^~Nt&Jt,t[35]=Et^~zt&Xt,t[44]=ee^~yt&Tt,t[45]=re^~gt&Bt,t[6]=Vt^~oe&ct,t[7]=Yt^~ae&dt,t[16]=kt^~Ut&Kt,t[17]=Rt^~qt&Dt,t[26]=ne^~vt&_t,t[27]=ie^~wt&Mt,t[36]=Nt^~Jt&Gt,t[37]=zt^~Xt&$t,t[46]=yt^~Tt&It,t[47]=gt^~Bt&Lt,t[8]=oe^~ct&St,t[9]=ae^~dt&xt,t[18]=Ut^~Kt&Qt,t[19]=qt^~Dt&te,t[28]=vt^~_t&Pt,t[29]=wt^~Mt&jt,t[38]=Jt^~Gt<,t[39]=Xt^~$t&pt,t[48]=Tt^~It&Ht,t[49]=Bt^~Lt&Ft,t[0]^=n[2*e],t[1]^=n[2*e+1]}}},{}],84:[function(t,e,r){(function(r){const n=t("./keccak-state-unroll");function i(){this.state=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],this.blockSize=null,this.count=0,this.squeezing=!1}i.prototype.initialize=function(t,e){for(let t=0;t<50;++t)this.state[t]=0;this.blockSize=t/8,this.count=0,this.squeezing=!1},i.prototype.absorb=function(t){for(let e=0;e>>this.count%4*8&255,this.count+=1,this.count===this.blockSize&&(n.p1600(this.state),this.count=0);return e},i.prototype.copy=function(t){for(let e=0;e<50;++e)t.state[e]=this.state[e];t.blockSize=this.blockSize,t.count=this.count,t.squeezing=this.squeezing},e.exports=i}).call(this,t("buffer").Buffer)},{"./keccak-state-unroll":83,buffer:9}],85:[function(t,e,r){"use strict";var n={};function i(t,e,r){r||(r=Error);var i=function(t){var r,n;function i(r,n,i){return t.call(this,function(t,r,n){return"string"==typeof e?e:e(t,r,n)}(r,n,i))||this}return n=t,(r=i).prototype=Object.create(n.prototype),r.prototype.constructor=r,r.__proto__=n,i}(r);i.prototype.name=r.name,i.prototype.code=t,n[t]=i}function o(t,e){if(Array.isArray(t)){var r=t.length;return t=t.map((function(t){return String(t)})),r>2?"one of ".concat(e," ").concat(t.slice(0,r-1).join(", "),", or ")+t[r-1]:2===r?"one of ".concat(e," ").concat(t[0]," or ").concat(t[1]):"of ".concat(e," ").concat(t[0])}return"of ".concat(e," ").concat(String(t))}i("ERR_INVALID_OPT_VALUE",(function(t,e){return'The value "'+e+'" is invalid for option "'+t+'"'}),TypeError),i("ERR_INVALID_ARG_TYPE",(function(t,e,r){var n,i,a,s;if("string"==typeof e&&(i="not ",e.substr(!a||a<0?0:+a,i.length)===i)?(n="must not be",e=e.replace(/^not /,"")):n="must be",function(t,e,r){return(void 0===r||r>t.length)&&(r=t.length),t.substring(r-e.length,r)===e}(t," argument"))s="The ".concat(t," ").concat(n," ").concat(o(e,"type"));else{var f=function(t,e,r){return"number"!=typeof r&&(r=0),!(r+e.length>t.length)&&-1!==t.indexOf(e,r)}(t,".")?"property":"argument";s='The "'.concat(t,'" ').concat(f," ").concat(n," ").concat(o(e,"type"))}return s+=". Received type ".concat(typeof r)}),TypeError),i("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),i("ERR_METHOD_NOT_IMPLEMENTED",(function(t){return"The "+t+" method is not implemented"})),i("ERR_STREAM_PREMATURE_CLOSE","Premature close"),i("ERR_STREAM_DESTROYED",(function(t){return"Cannot call "+t+" after a stream was destroyed"})),i("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),i("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),i("ERR_STREAM_WRITE_AFTER_END","write after end"),i("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),i("ERR_UNKNOWN_ENCODING",(function(t){return"Unknown encoding: "+t}),TypeError),i("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),e.exports.codes=n},{}],86:[function(t,e,r){(function(r){"use strict";var n=Object.keys||function(t){var e=[];for(var r in t)e.push(r);return e};e.exports=u;var i=t("./_stream_readable"),o=t("./_stream_writable");t("inherits")(u,i);for(var a=n(o.prototype),s=0;s0)if("string"==typeof e||a.objectMode||Object.getPrototypeOf(e)===s.prototype||(e=function(t){return s.from(t)}(e)),n)a.endEmitted?M(t,new _):k(t,a,e,!0);else if(a.ended)M(t,new v);else{if(a.destroyed)return!1;a.reading=!1,a.decoder&&!r?(e=a.decoder.write(e),a.objectMode||0!==e.length?k(t,a,e,!1):L(t,a)):k(t,a,e,!1)}else n||(a.reading=!1,L(t,a));return!a.ended&&(a.lengthe.highWaterMark&&(e.highWaterMark=function(t){return t>=R?t=R:(t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++),t}(t)),t<=e.length?t:e.ended?e.length:(e.needReadable=!0,0))}function B(t){var e=t._readableState;u("emitReadable",e.needReadable,e.emittedReadable),e.needReadable=!1,e.emittedReadable||(u("emitReadable",e.flowing),e.emittedReadable=!0,r.nextTick(I,t))}function I(t){var e=t._readableState;u("emitReadable_",e.destroyed,e.length,e.ended),e.destroyed||!e.length&&!e.ended||(t.emit("readable"),e.emittedReadable=!1),e.needReadable=!e.flowing&&!e.ended&&e.length<=e.highWaterMark,N(t)}function L(t,e){e.readingMore||(e.readingMore=!0,r.nextTick(P,t,e))}function P(t,e){for(;!e.reading&&!e.ended&&(e.length0,e.resumeScheduled&&!e.paused?e.flowing=!0:t.listenerCount("data")>0&&t.resume()}function O(t){u("readable nexttick read 0"),t.read(0)}function C(t,e){u("resume",e.reading),e.reading||t.read(0),e.resumeScheduled=!1,t.emit("resume"),N(t),e.flowing&&!e.reading&&t.read(0)}function N(t){var e=t._readableState;for(u("flow",e.flowing);e.flowing&&null!==t.read(););}function z(t,e){return 0===e.length?null:(e.objectMode?r=e.buffer.shift():!t||t>=e.length?(r=e.decoder?e.buffer.join(""):1===e.buffer.length?e.buffer.first():e.buffer.concat(e.length),e.buffer.clear()):r=e.buffer.consume(t,e.decoder),r);var r}function U(t){var e=t._readableState;u("endReadable",e.endEmitted),e.endEmitted||(e.ended=!0,r.nextTick(q,e,t))}function q(t,e){if(u("endReadableNT",t.endEmitted,t.length),!t.endEmitted&&0===t.length&&(t.endEmitted=!0,e.readable=!1,e.emit("end"),t.autoDestroy)){var r=e._writableState;(!r||r.autoDestroy&&r.finished)&&e.destroy()}}function K(t,e){for(var r=0,n=t.length;r=e.highWaterMark:e.length>0)||e.ended))return u("read: emitReadable",e.length,e.ended),0===e.length&&e.ended?U(this):B(this),null;if(0===(t=T(t,e))&&e.ended)return 0===e.length&&U(this),null;var n,i=e.needReadable;return u("need readable",i),(0===e.length||e.length-t0?z(t,e):null)?(e.needReadable=e.length<=e.highWaterMark,t=0):(e.length-=t,e.awaitDrain=0),0===e.length&&(e.ended||(e.needReadable=!0),r!==t&&e.ended&&U(this)),null!==n&&this.emit("data",n),n},A.prototype._read=function(t){M(this,new w("_read()"))},A.prototype.pipe=function(t,e){var n=this,i=this._readableState;switch(i.pipesCount){case 0:i.pipes=t;break;case 1:i.pipes=[i.pipes,t];break;default:i.pipes.push(t)}i.pipesCount+=1,u("pipe count=%d opts=%j",i.pipesCount,e);var a=(!e||!1!==e.end)&&t!==r.stdout&&t!==r.stderr?f:m;function s(e,r){u("onunpipe"),e===n&&r&&!1===r.hasUnpiped&&(r.hasUnpiped=!0,u("cleanup"),t.removeListener("close",p),t.removeListener("finish",b),t.removeListener("drain",h),t.removeListener("error",l),t.removeListener("unpipe",s),n.removeListener("end",f),n.removeListener("end",m),n.removeListener("data",d),c=!0,!i.awaitDrain||t._writableState&&!t._writableState.needDrain||h())}function f(){u("onend"),t.end()}i.endEmitted?r.nextTick(a):n.once("end",a),t.on("unpipe",s);var h=function(t){return function(){var e=t._readableState;u("pipeOnDrain",e.awaitDrain),e.awaitDrain&&e.awaitDrain--,0===e.awaitDrain&&o(t,"data")&&(e.flowing=!0,N(t))}}(n);t.on("drain",h);var c=!1;function d(e){u("ondata");var r=t.write(e);u("dest.write",r),!1===r&&((1===i.pipesCount&&i.pipes===t||i.pipesCount>1&&-1!==K(i.pipes,t))&&!c&&(u("false write response, pause",i.awaitDrain),i.awaitDrain++),n.pause())}function l(e){u("onerror",e),m(),t.removeListener("error",l),0===o(t,"error")&&M(t,e)}function p(){t.removeListener("finish",b),m()}function b(){u("onfinish"),t.removeListener("close",p),m()}function m(){u("unpipe"),n.unpipe(t)}return n.on("data",d),function(t,e,r){if("function"==typeof t.prependListener)return t.prependListener(e,r);t._events&&t._events[e]?Array.isArray(t._events[e])?t._events[e].unshift(r):t._events[e]=[r,t._events[e]]:t.on(e,r)}(t,"error",l),t.once("close",p),t.once("finish",b),t.emit("pipe",n),i.flowing||(u("pipe resume"),n.resume()),t},A.prototype.unpipe=function(t){var e=this._readableState,r={hasUnpiped:!1};if(0===e.pipesCount)return this;if(1===e.pipesCount)return t&&t!==e.pipes||(t||(t=e.pipes),e.pipes=null,e.pipesCount=0,e.flowing=!1,t&&t.emit("unpipe",this,r)),this;if(!t){var n=e.pipes,i=e.pipesCount;e.pipes=null,e.pipesCount=0,e.flowing=!1;for(var o=0;o0,!1!==i.flowing&&this.resume()):"readable"===t&&(i.endEmitted||i.readableListening||(i.readableListening=i.needReadable=!0,i.flowing=!1,i.emittedReadable=!1,u("on readable",i.length,i.reading),i.length?B(this):i.reading||r.nextTick(O,this))),n},A.prototype.addListener=A.prototype.on,A.prototype.removeListener=function(t,e){var n=a.prototype.removeListener.call(this,t,e);return"readable"===t&&r.nextTick(j,this),n},A.prototype.removeAllListeners=function(t){var e=a.prototype.removeAllListeners.apply(this,arguments);return"readable"!==t&&void 0!==t||r.nextTick(j,this),e},A.prototype.resume=function(){var t=this._readableState;return t.flowing||(u("resume"),t.flowing=!t.readableListening,function(t,e){e.resumeScheduled||(e.resumeScheduled=!0,r.nextTick(C,t,e))}(this,t)),t.paused=!1,this},A.prototype.pause=function(){return u("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(u("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},A.prototype.wrap=function(t){var e=this,r=this._readableState,n=!1;for(var i in t.on("end",(function(){if(u("wrapped end"),r.decoder&&!r.ended){var t=r.decoder.end();t&&t.length&&e.push(t)}e.push(null)})),t.on("data",(function(i){(u("wrapped data"),r.decoder&&(i=r.decoder.write(i)),r.objectMode&&null==i)||(r.objectMode||i&&i.length)&&(e.push(i)||(n=!0,t.pause()))})),t)void 0===this[i]&&"function"==typeof t[i]&&(this[i]=function(e){return function(){return t[e].apply(t,arguments)}}(i));for(var o=0;o-1))throw new _(t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(A.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(A.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),A.prototype._write=function(t,e,r){r(new b("_write()"))},A.prototype._writev=null,A.prototype.end=function(t,e,n){var i=this._writableState;return"function"==typeof t?(n=t,t=null,e=null):"function"==typeof e&&(n=e,e=null),null!=t&&this.write(t,e),i.corked&&(i.corked=1,this.uncork()),i.ending||function(t,e,n){e.ending=!0,I(t,e),n&&(e.finished?r.nextTick(n):t.once("finish",n));e.ended=!0,t.writable=!1}(this,i,n),this},Object.defineProperty(A.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(A.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(t){this._writableState&&(this._writableState.destroyed=t)}}),A.prototype.destroy=c.destroy,A.prototype._undestroy=c.undestroy,A.prototype._destroy=function(t,e){e(t)}}).call(this,t("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../errors":85,"./_stream_duplex":86,"./internal/streams/destroy":93,"./internal/streams/state":97,"./internal/streams/stream":98,_process:104,buffer:9,inherits:75,"util-deprecate":141}],91:[function(t,e,r){(function(r){"use strict";var n;function i(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var o=t("./end-of-stream"),a=Symbol("lastResolve"),s=Symbol("lastReject"),f=Symbol("error"),u=Symbol("ended"),h=Symbol("lastPromise"),c=Symbol("handlePromise"),d=Symbol("stream");function l(t,e){return{value:t,done:e}}function p(t){var e=t[a];if(null!==e){var r=t[d].read();null!==r&&(t[h]=null,t[a]=null,t[s]=null,e(l(r,!1)))}}function b(t){r.nextTick(p,t)}var m=Object.getPrototypeOf((function(){})),y=Object.setPrototypeOf((i(n={get stream(){return this[d]},next:function(){var t=this,e=this[f];if(null!==e)return Promise.reject(e);if(this[u])return Promise.resolve(l(void 0,!0));if(this[d].destroyed)return new Promise((function(e,n){r.nextTick((function(){t[f]?n(t[f]):e(l(void 0,!0))}))}));var n,i=this[h];if(i)n=new Promise(function(t,e){return function(r,n){t.then((function(){e[u]?r(l(void 0,!0)):e[c](r,n)}),n)}}(i,this));else{var o=this[d].read();if(null!==o)return Promise.resolve(l(o,!1));n=new Promise(this[c])}return this[h]=n,n}},Symbol.asyncIterator,(function(){return this})),i(n,"return",(function(){var t=this;return new Promise((function(e,r){t[d].destroy(null,(function(t){t?r(t):e(l(void 0,!0))}))}))})),n),m);e.exports=function(t){var e,r=Object.create(y,(i(e={},d,{value:t,writable:!0}),i(e,a,{value:null,writable:!0}),i(e,s,{value:null,writable:!0}),i(e,f,{value:null,writable:!0}),i(e,u,{value:t._readableState.endEmitted,writable:!0}),i(e,c,{value:function(t,e){var n=r[d].read();n?(r[h]=null,r[a]=null,r[s]=null,t(l(n,!1))):(r[a]=t,r[s]=e)},writable:!0}),e));return r[h]=null,o(t,(function(t){if(t&&"ERR_STREAM_PREMATURE_CLOSE"!==t.code){var e=r[s];return null!==e&&(r[h]=null,r[a]=null,r[s]=null,e(t)),void(r[f]=t)}var n=r[a];null!==n&&(r[h]=null,r[a]=null,r[s]=null,n(l(void 0,!0))),r[u]=!0})),t.on("readable",b.bind(null,r)),r}}).call(this,t("_process"))},{"./end-of-stream":94,_process:104}],92:[function(t,e,r){"use strict";function n(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function i(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function o(t,e){for(var r=0;r0?this.tail.next=e:this.head=e,this.tail=e,++this.length}},{key:"unshift",value:function(t){var e={data:t,next:this.head};0===this.length&&(this.tail=e),this.head=e,++this.length}},{key:"shift",value:function(){if(0!==this.length){var t=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,t}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(t){if(0===this.length)return"";for(var e=this.head,r=""+e.data;e=e.next;)r+=t+e.data;return r}},{key:"concat",value:function(t){if(0===this.length)return a.alloc(0);for(var e,r,n,i=a.allocUnsafe(t>>>0),o=this.head,s=0;o;)e=o.data,r=i,n=s,a.prototype.copy.call(e,r,n),s+=o.data.length,o=o.next;return i}},{key:"consume",value:function(t,e){var r;return ti.length?i.length:t;if(o===i.length?n+=i:n+=i.slice(0,t),0==(t-=o)){o===i.length?(++r,e.next?this.head=e.next:this.head=this.tail=null):(this.head=e,e.data=i.slice(o));break}++r}return this.length-=r,n}},{key:"_getBuffer",value:function(t){var e=a.allocUnsafe(t),r=this.head,n=1;for(r.data.copy(e),t-=r.data.length;r=r.next;){var i=r.data,o=t>i.length?i.length:t;if(i.copy(e,e.length-t,0,o),0==(t-=o)){o===i.length?(++n,r.next?this.head=r.next:this.head=this.tail=null):(this.head=r,r.data=i.slice(o));break}++n}return this.length-=n,e}},{key:f,value:function(t,e){return s(this,function(t){for(var e=1;e0,(function(t){n||(n=t),t&&a.forEach(u),o||(a.forEach(u),i(n))}))}));return e.reduce(h)}},{"../../../errors":85,"./end-of-stream":94}],97:[function(t,e,r){"use strict";var n=t("../../../errors").codes.ERR_INVALID_OPT_VALUE;e.exports={getHighWaterMark:function(t,e,r,i){var o=function(t,e,r){return null!=t.highWaterMark?t.highWaterMark:e?t[r]:null}(e,i,r);if(null!=o){if(!isFinite(o)||Math.floor(o)!==o||o<0)throw new n(i?r:"highWaterMark",o);return Math.floor(o)}return t.objectMode?16:16384}}},{"../../../errors":85}],98:[function(t,e,r){e.exports=t("events").EventEmitter},{events:59}],99:[function(t,e,r){(r=e.exports=t("./lib/_stream_readable.js")).Stream=r,r.Readable=r,r.Writable=t("./lib/_stream_writable.js"),r.Duplex=t("./lib/_stream_duplex.js"),r.Transform=t("./lib/_stream_transform.js"),r.PassThrough=t("./lib/_stream_passthrough.js"),r.finished=t("./lib/internal/streams/end-of-stream.js"),r.pipeline=t("./lib/internal/streams/pipeline.js")},{"./lib/_stream_duplex.js":86,"./lib/_stream_passthrough.js":87,"./lib/_stream_readable.js":88,"./lib/_stream_transform.js":89,"./lib/_stream_writable.js":90,"./lib/internal/streams/end-of-stream.js":94,"./lib/internal/streams/pipeline.js":96}],100:[function(t,e,r){"use strict";var n=t("inherits"),i=t("hash-base"),o=t("safe-buffer").Buffer,a=new Array(16);function s(){i.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878}function f(t,e){return t<>>32-e}function u(t,e,r,n,i,o,a){return f(t+(e&r|~e&n)+i+o|0,a)+e|0}function h(t,e,r,n,i,o,a){return f(t+(e&n|r&~n)+i+o|0,a)+e|0}function c(t,e,r,n,i,o,a){return f(t+(e^r^n)+i+o|0,a)+e|0}function d(t,e,r,n,i,o,a){return f(t+(r^(e|~n))+i+o|0,a)+e|0}n(s,i),s.prototype._update=function(){for(var t=a,e=0;e<16;++e)t[e]=this._block.readInt32LE(4*e);var r=this._a,n=this._b,i=this._c,o=this._d;r=u(r,n,i,o,t[0],3614090360,7),o=u(o,r,n,i,t[1],3905402710,12),i=u(i,o,r,n,t[2],606105819,17),n=u(n,i,o,r,t[3],3250441966,22),r=u(r,n,i,o,t[4],4118548399,7),o=u(o,r,n,i,t[5],1200080426,12),i=u(i,o,r,n,t[6],2821735955,17),n=u(n,i,o,r,t[7],4249261313,22),r=u(r,n,i,o,t[8],1770035416,7),o=u(o,r,n,i,t[9],2336552879,12),i=u(i,o,r,n,t[10],4294925233,17),n=u(n,i,o,r,t[11],2304563134,22),r=u(r,n,i,o,t[12],1804603682,7),o=u(o,r,n,i,t[13],4254626195,12),i=u(i,o,r,n,t[14],2792965006,17),r=h(r,n=u(n,i,o,r,t[15],1236535329,22),i,o,t[1],4129170786,5),o=h(o,r,n,i,t[6],3225465664,9),i=h(i,o,r,n,t[11],643717713,14),n=h(n,i,o,r,t[0],3921069994,20),r=h(r,n,i,o,t[5],3593408605,5),o=h(o,r,n,i,t[10],38016083,9),i=h(i,o,r,n,t[15],3634488961,14),n=h(n,i,o,r,t[4],3889429448,20),r=h(r,n,i,o,t[9],568446438,5),o=h(o,r,n,i,t[14],3275163606,9),i=h(i,o,r,n,t[3],4107603335,14),n=h(n,i,o,r,t[8],1163531501,20),r=h(r,n,i,o,t[13],2850285829,5),o=h(o,r,n,i,t[2],4243563512,9),i=h(i,o,r,n,t[7],1735328473,14),r=c(r,n=h(n,i,o,r,t[12],2368359562,20),i,o,t[5],4294588738,4),o=c(o,r,n,i,t[8],2272392833,11),i=c(i,o,r,n,t[11],1839030562,16),n=c(n,i,o,r,t[14],4259657740,23),r=c(r,n,i,o,t[1],2763975236,4),o=c(o,r,n,i,t[4],1272893353,11),i=c(i,o,r,n,t[7],4139469664,16),n=c(n,i,o,r,t[10],3200236656,23),r=c(r,n,i,o,t[13],681279174,4),o=c(o,r,n,i,t[0],3936430074,11),i=c(i,o,r,n,t[3],3572445317,16),n=c(n,i,o,r,t[6],76029189,23),r=c(r,n,i,o,t[9],3654602809,4),o=c(o,r,n,i,t[12],3873151461,11),i=c(i,o,r,n,t[15],530742520,16),r=d(r,n=c(n,i,o,r,t[2],3299628645,23),i,o,t[0],4096336452,6),o=d(o,r,n,i,t[7],1126891415,10),i=d(i,o,r,n,t[14],2878612391,15),n=d(n,i,o,r,t[5],4237533241,21),r=d(r,n,i,o,t[12],1700485571,6),o=d(o,r,n,i,t[3],2399980690,10),i=d(i,o,r,n,t[10],4293915773,15),n=d(n,i,o,r,t[1],2240044497,21),r=d(r,n,i,o,t[8],1873313359,6),o=d(o,r,n,i,t[15],4264355552,10),i=d(i,o,r,n,t[6],2734768916,15),n=d(n,i,o,r,t[13],1309151649,21),r=d(r,n,i,o,t[4],4149444226,6),o=d(o,r,n,i,t[11],3174756917,10),i=d(i,o,r,n,t[2],718787259,15),n=d(n,i,o,r,t[9],3951481745,21),this._a=this._a+r|0,this._b=this._b+n|0,this._c=this._c+i|0,this._d=this._d+o|0},s.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var t=o.allocUnsafe(16);return t.writeInt32LE(this._a,0),t.writeInt32LE(this._b,4),t.writeInt32LE(this._c,8),t.writeInt32LE(this._d,12),t},e.exports=s},{"hash-base":60,inherits:75,"safe-buffer":124}],101:[function(t,e,r){function n(t,e){if(!t)throw new Error(e||"Assertion failed")}e.exports=n,n.equal=function(t,e,r){if(t!=e)throw new Error(r||"Assertion failed: "+t+" != "+e)}},{}],102:[function(t,e,r){"use strict";var n=r;function i(t){return 1===t.length?"0"+t:t}function o(t){for(var e="",r=0;r>8,a=255&i;o?r.push(o,a):r.push(a)}return r},n.zero2=i,n.toHex=o,n.encode=function(t,e){return"hex"===e?o(t):t}},{}],103:[function(t,e,r){(function(t){"use strict";!t.version||0===t.version.indexOf("v0.")||0===t.version.indexOf("v1.")&&0!==t.version.indexOf("v1.8.")?e.exports={nextTick:function(e,r,n,i){if("function"!=typeof e)throw new TypeError('"callback" argument must be a function');var o,a,s=arguments.length;switch(s){case 0:case 1:return t.nextTick(e);case 2:return t.nextTick((function(){e.call(null,r)}));case 3:return t.nextTick((function(){e.call(null,r,n)}));case 4:return t.nextTick((function(){e.call(null,r,n,i)}));default:for(o=new Array(s-1),a=0;a1)for(var r=1;ro)throw new RangeError("requested too many random bytes");var n=a.allocUnsafe(t);if(t>0)if(t>i)for(var f=0;f0?("string"==typeof e||a.objectMode||Object.getPrototypeOf(e)===u.prototype||(e=function(t){return u.from(t)}(e)),n?a.endEmitted?t.emit("error",new Error("stream.unshift() after end event")):_(t,a,e,!0):a.ended?t.emit("error",new Error("stream.push() after EOF")):(a.reading=!1,a.decoder&&!r?(e=a.decoder.write(e),a.objectMode||0!==e.length?_(t,a,e,!1):E(t,a)):_(t,a,e,!1))):n||(a.reading=!1));return function(t){return!t.ended&&(t.needReadable||t.lengthe.highWaterMark&&(e.highWaterMark=function(t){return t>=M?t=M:(t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++),t}(t)),t<=e.length?t:e.ended?e.length:(e.needReadable=!0,0))}function x(t){var e=t._readableState;e.needReadable=!1,e.emittedReadable||(l("emitReadable",e.flowing),e.emittedReadable=!0,e.sync?i.nextTick(A,t):A(t))}function A(t){l("emit readable"),t.emit("readable"),B(t)}function E(t,e){e.readingMore||(e.readingMore=!0,i.nextTick(k,t,e))}function k(t,e){for(var r=e.length;!e.reading&&!e.flowing&&!e.ended&&e.length=e.length?(r=e.decoder?e.buffer.join(""):1===e.buffer.length?e.buffer.head.data:e.buffer.concat(e.length),e.buffer.clear()):r=function(t,e,r){var n;to.length?o.length:t;if(a===o.length?i+=o:i+=o.slice(0,t),0===(t-=a)){a===o.length?(++n,r.next?e.head=r.next:e.head=e.tail=null):(e.head=r,r.data=o.slice(a));break}++n}return e.length-=n,i}(t,e):function(t,e){var r=u.allocUnsafe(t),n=e.head,i=1;n.data.copy(r),t-=n.data.length;for(;n=n.next;){var o=n.data,a=t>o.length?o.length:t;if(o.copy(r,r.length-t,0,a),0===(t-=a)){a===o.length?(++i,n.next?e.head=n.next:e.head=e.tail=null):(e.head=n,n.data=o.slice(a));break}++i}return e.length-=i,r}(t,e);return n}(t,e.buffer,e.decoder),r);var r}function L(t){var e=t._readableState;if(e.length>0)throw new Error('"endReadable()" called on non-empty stream');e.endEmitted||(e.ended=!0,i.nextTick(P,e,t))}function P(t,e){t.endEmitted||0!==t.length||(t.endEmitted=!0,e.readable=!1,e.emit("end"))}function j(t,e){for(var r=0,n=t.length;r=e.highWaterMark||e.ended))return l("read: emitReadable",e.length,e.ended),0===e.length&&e.ended?L(this):x(this),null;if(0===(t=S(t,e))&&e.ended)return 0===e.length&&L(this),null;var n,i=e.needReadable;return l("need readable",i),(0===e.length||e.length-t0?I(t,e):null)?(e.needReadable=!0,t=0):e.length-=t,0===e.length&&(e.ended||(e.needReadable=!0),r!==t&&e.ended&&L(this)),null!==n&&this.emit("data",n),n},v.prototype._read=function(t){this.emit("error",new Error("_read() is not implemented"))},v.prototype.pipe=function(t,e){var n=this,o=this._readableState;switch(o.pipesCount){case 0:o.pipes=t;break;case 1:o.pipes=[o.pipes,t];break;default:o.pipes.push(t)}o.pipesCount+=1,l("pipe count=%d opts=%j",o.pipesCount,e);var f=(!e||!1!==e.end)&&t!==r.stdout&&t!==r.stderr?h:v;function u(e,r){l("onunpipe"),e===n&&r&&!1===r.hasUnpiped&&(r.hasUnpiped=!0,l("cleanup"),t.removeListener("close",y),t.removeListener("finish",g),t.removeListener("drain",c),t.removeListener("error",m),t.removeListener("unpipe",u),n.removeListener("end",h),n.removeListener("end",v),n.removeListener("data",b),d=!0,!o.awaitDrain||t._writableState&&!t._writableState.needDrain||c())}function h(){l("onend"),t.end()}o.endEmitted?i.nextTick(f):n.once("end",f),t.on("unpipe",u);var c=function(t){return function(){var e=t._readableState;l("pipeOnDrain",e.awaitDrain),e.awaitDrain&&e.awaitDrain--,0===e.awaitDrain&&s(t,"data")&&(e.flowing=!0,B(t))}}(n);t.on("drain",c);var d=!1;var p=!1;function b(e){l("ondata"),p=!1,!1!==t.write(e)||p||((1===o.pipesCount&&o.pipes===t||o.pipesCount>1&&-1!==j(o.pipes,t))&&!d&&(l("false write response, pause",n._readableState.awaitDrain),n._readableState.awaitDrain++,p=!0),n.pause())}function m(e){l("onerror",e),v(),t.removeListener("error",m),0===s(t,"error")&&t.emit("error",e)}function y(){t.removeListener("finish",g),v()}function g(){l("onfinish"),t.removeListener("close",y),v()}function v(){l("unpipe"),n.unpipe(t)}return n.on("data",b),function(t,e,r){if("function"==typeof t.prependListener)return t.prependListener(e,r);t._events&&t._events[e]?a(t._events[e])?t._events[e].unshift(r):t._events[e]=[r,t._events[e]]:t.on(e,r)}(t,"error",m),t.once("close",y),t.once("finish",g),t.emit("pipe",n),o.flowing||(l("pipe resume"),n.resume()),t},v.prototype.unpipe=function(t){var e=this._readableState,r={hasUnpiped:!1};if(0===e.pipesCount)return this;if(1===e.pipesCount)return t&&t!==e.pipes||(t||(t=e.pipes),e.pipes=null,e.pipesCount=0,e.flowing=!1,t&&t.emit("unpipe",this,r)),this;if(!t){var n=e.pipes,i=e.pipesCount;e.pipes=null,e.pipesCount=0,e.flowing=!1;for(var o=0;o-1?i:o.nextTick;g.WritableState=y;var u=t("core-util-is");u.inherits=t("inherits");var h={deprecate:t("util-deprecate")},c=t("./internal/streams/stream"),d=t("safe-buffer").Buffer,l=n.Uint8Array||function(){};var p,b=t("./internal/streams/destroy");function m(){}function y(e,r){s=s||t("./_stream_duplex"),e=e||{};var n=r instanceof s;this.objectMode=!!e.objectMode,n&&(this.objectMode=this.objectMode||!!e.writableObjectMode);var i=e.highWaterMark,u=e.writableHighWaterMark,h=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:n&&(u||0===u)?u:h,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var c=!1===e.decodeStrings;this.decodeStrings=!c,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(t){!function(t,e){var r=t._writableState,n=r.sync,i=r.writecb;if(function(t){t.writing=!1,t.writecb=null,t.length-=t.writelen,t.writelen=0}(r),e)!function(t,e,r,n,i){--e.pendingcb,r?(o.nextTick(i,n),o.nextTick(x,t,e),t._writableState.errorEmitted=!0,t.emit("error",n)):(i(n),t._writableState.errorEmitted=!0,t.emit("error",n),x(t,e))}(t,r,n,e,i);else{var a=M(r);a||r.corked||r.bufferProcessing||!r.bufferedRequest||_(t,r),n?f(w,t,r,a,i):w(t,r,a,i)}}(r,t)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new a(this)}function g(e){if(s=s||t("./_stream_duplex"),!(p.call(g,this)||this instanceof s))return new g(e);this._writableState=new y(e,this),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),c.call(this)}function v(t,e,r,n,i,o,a){e.writelen=n,e.writecb=a,e.writing=!0,e.sync=!0,r?t._writev(i,e.onwrite):t._write(i,o,e.onwrite),e.sync=!1}function w(t,e,r,n){r||function(t,e){0===e.length&&e.needDrain&&(e.needDrain=!1,t.emit("drain"))}(t,e),e.pendingcb--,n(),x(t,e)}function _(t,e){e.bufferProcessing=!0;var r=e.bufferedRequest;if(t._writev&&r&&r.next){var n=e.bufferedRequestCount,i=new Array(n),o=e.corkedRequestsFree;o.entry=r;for(var s=0,f=!0;r;)i[s]=r,r.isBuf||(f=!1),r=r.next,s+=1;i.allBuffers=f,v(t,e,!0,e.length,i,"",o.finish),e.pendingcb++,e.lastBufferedRequest=null,o.next?(e.corkedRequestsFree=o.next,o.next=null):e.corkedRequestsFree=new a(e),e.bufferedRequestCount=0}else{for(;r;){var u=r.chunk,h=r.encoding,c=r.callback;if(v(t,e,!1,e.objectMode?1:u.length,u,h,c),r=r.next,e.bufferedRequestCount--,e.writing)break}null===r&&(e.lastBufferedRequest=null)}e.bufferedRequest=r,e.bufferProcessing=!1}function M(t){return t.ending&&0===t.length&&null===t.bufferedRequest&&!t.finished&&!t.writing}function S(t,e){t._final((function(r){e.pendingcb--,r&&t.emit("error",r),e.prefinished=!0,t.emit("prefinish"),x(t,e)}))}function x(t,e){var r=M(e);return r&&(!function(t,e){e.prefinished||e.finalCalled||("function"==typeof t._final?(e.pendingcb++,e.finalCalled=!0,o.nextTick(S,t,e)):(e.prefinished=!0,t.emit("prefinish")))}(t,e),0===e.pendingcb&&(e.finished=!0,t.emit("finish"))),r}u.inherits(g,c),y.prototype.getBuffer=function(){for(var t=this.bufferedRequest,e=[];t;)e.push(t),t=t.next;return e},function(){try{Object.defineProperty(y.prototype,"buffer",{get:h.deprecate((function(){return this.getBuffer()}),"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(t){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(p=Function.prototype[Symbol.hasInstance],Object.defineProperty(g,Symbol.hasInstance,{value:function(t){return!!p.call(this,t)||this===g&&(t&&t._writableState instanceof y)}})):p=function(t){return t instanceof this},g.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},g.prototype.write=function(t,e,r){var n,i=this._writableState,a=!1,s=!i.objectMode&&(n=t,d.isBuffer(n)||n instanceof l);return s&&!d.isBuffer(t)&&(t=function(t){return d.from(t)}(t)),"function"==typeof e&&(r=e,e=null),s?e="buffer":e||(e=i.defaultEncoding),"function"!=typeof r&&(r=m),i.ended?function(t,e){var r=new Error("write after end");t.emit("error",r),o.nextTick(e,r)}(this,r):(s||function(t,e,r,n){var i=!0,a=!1;return null===r?a=new TypeError("May not write null values to stream"):"string"==typeof r||void 0===r||e.objectMode||(a=new TypeError("Invalid non-string/buffer chunk")),a&&(t.emit("error",a),o.nextTick(n,a),i=!1),i}(this,i,t,r))&&(i.pendingcb++,a=function(t,e,r,n,i,o){if(!r){var a=function(t,e,r){t.objectMode||!1===t.decodeStrings||"string"!=typeof e||(e=d.from(e,r));return e}(e,n,i);n!==a&&(r=!0,i="buffer",n=a)}var s=e.objectMode?1:n.length;e.length+=s;var f=e.length-1))throw new TypeError("Unknown encoding: "+t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(g.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),g.prototype._write=function(t,e,r){r(new Error("_write() is not implemented"))},g.prototype._writev=null,g.prototype.end=function(t,e,r){var n=this._writableState;"function"==typeof t?(r=t,t=null,e=null):"function"==typeof e&&(r=e,e=null),null!=t&&this.write(t,e),n.corked&&(n.corked=1,this.uncork()),n.ending||n.finished||function(t,e,r){e.ending=!0,x(t,e),r&&(e.finished?o.nextTick(r):t.once("finish",r));e.ended=!0,t.writable=!1}(this,n,r)},Object.defineProperty(g.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(t){this._writableState&&(this._writableState.destroyed=t)}}),g.prototype.destroy=b.destroy,g.prototype._undestroy=b.undestroy,g.prototype._destroy=function(t,e){this.end(),e(t)}}).call(this,t("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},t("timers").setImmediate)},{"./_stream_duplex":107,"./internal/streams/destroy":113,"./internal/streams/stream":114,_process:104,"core-util-is":11,inherits:75,"process-nextick-args":103,"safe-buffer":115,timers:139,"util-deprecate":141}],112:[function(t,e,r){"use strict";var n=t("safe-buffer").Buffer,i=t("util");e.exports=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.head=null,this.tail=null,this.length=0}return t.prototype.push=function(t){var e={data:t,next:null};this.length>0?this.tail.next=e:this.head=e,this.tail=e,++this.length},t.prototype.unshift=function(t){var e={data:t,next:this.head};0===this.length&&(this.tail=e),this.head=e,++this.length},t.prototype.shift=function(){if(0!==this.length){var t=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,t}},t.prototype.clear=function(){this.head=this.tail=null,this.length=0},t.prototype.join=function(t){if(0===this.length)return"";for(var e=this.head,r=""+e.data;e=e.next;)r+=t+e.data;return r},t.prototype.concat=function(t){if(0===this.length)return n.alloc(0);if(1===this.length)return this.head.data;for(var e,r,i,o=n.allocUnsafe(t>>>0),a=this.head,s=0;a;)e=a.data,r=o,i=s,e.copy(r,i),s+=a.data.length,a=a.next;return o},t}(),i&&i.inspect&&i.inspect.custom&&(e.exports.prototype[i.inspect.custom]=function(){var t=i.inspect({length:this.length});return this.constructor.name+" "+t})},{"safe-buffer":115,util:8}],113:[function(t,e,r){"use strict";var n=t("process-nextick-args");function i(t,e){t.emit("error",e)}e.exports={destroy:function(t,e){var r=this,o=this._readableState&&this._readableState.destroyed,a=this._writableState&&this._writableState.destroyed;return o||a?(e?e(t):!t||this._writableState&&this._writableState.errorEmitted||n.nextTick(i,this,t),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(t||null,(function(t){!e&&t?(n.nextTick(i,r,t),r._writableState&&(r._writableState.errorEmitted=!0)):e&&e(t)})),this)},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}}},{"process-nextick-args":103}],114:[function(t,e,r){arguments[4][98][0].apply(r,arguments)},{dup:98,events:59}],115:[function(t,e,r){var n=t("buffer"),i=n.Buffer;function o(t,e){for(var r in t)e[r]=t[r]}function a(t,e,r){return i(t,e,r)}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?e.exports=n:(o(n,r),r.Buffer=a),o(i,a),a.from=function(t,e,r){if("number"==typeof t)throw new TypeError("Argument must not be a number");return i(t,e,r)},a.alloc=function(t,e,r){if("number"!=typeof t)throw new TypeError("Argument must be a number");var n=i(t);return void 0!==e?"string"==typeof r?n.fill(e,r):n.fill(e):n.fill(0),n},a.allocUnsafe=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return i(t)},a.allocUnsafeSlow=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return n.SlowBuffer(t)}},{buffer:9}],116:[function(t,e,r){"use strict";var n=t("safe-buffer").Buffer,i=n.isEncoding||function(t){switch((t=""+t)&&t.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function o(t){var e;switch(this.encoding=function(t){var e=function(t){if(!t)return"utf8";for(var e;;)switch(t){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return t;default:if(e)return;t=(""+t).toLowerCase(),e=!0}}(t);if("string"!=typeof e&&(n.isEncoding===i||!i(t)))throw new Error("Unknown encoding: "+t);return e||t}(t),this.encoding){case"utf16le":this.text=f,this.end=u,e=4;break;case"utf8":this.fillLast=s,e=4;break;case"base64":this.text=h,this.end=c,e=3;break;default:return this.write=d,void(this.end=l)}this.lastNeed=0,this.lastTotal=0,this.lastChar=n.allocUnsafe(e)}function a(t){return t<=127?0:t>>5==6?2:t>>4==14?3:t>>3==30?4:t>>6==2?-1:-2}function s(t){var e=this.lastTotal-this.lastNeed,r=function(t,e,r){if(128!=(192&e[0]))return t.lastNeed=0,"�";if(t.lastNeed>1&&e.length>1){if(128!=(192&e[1]))return t.lastNeed=1,"�";if(t.lastNeed>2&&e.length>2&&128!=(192&e[2]))return t.lastNeed=2,"�"}}(this,t);return void 0!==r?r:this.lastNeed<=t.length?(t.copy(this.lastChar,e,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(t.copy(this.lastChar,e,0,t.length),void(this.lastNeed-=t.length))}function f(t,e){if((t.length-e)%2==0){var r=t.toString("utf16le",e);if(r){var n=r.charCodeAt(r.length-1);if(n>=55296&&n<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=t[t.length-1],t.toString("utf16le",e,t.length-1)}function u(t){var e=t&&t.length?this.write(t):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return e+this.lastChar.toString("utf16le",0,r)}return e}function h(t,e){var r=(t.length-e)%3;return 0===r?t.toString("base64",e):(this.lastNeed=3-r,this.lastTotal=3,1===r?this.lastChar[0]=t[t.length-1]:(this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1]),t.toString("base64",e,t.length-r))}function c(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function d(t){return t.toString(this.encoding)}function l(t){return t&&t.length?this.write(t):""}r.StringDecoder=o,o.prototype.write=function(t){if(0===t.length)return"";var e,r;if(this.lastNeed){if(void 0===(e=this.fillLast(t)))return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r=0)return i>0&&(t.lastNeed=i-1),i;if(--n=0)return i>0&&(t.lastNeed=i-2),i;if(--n=0)return i>0&&(2===i?i=0:t.lastNeed=i-3),i;return 0}(this,t,e);if(!this.lastNeed)return t.toString("utf8",e);this.lastTotal=r;var n=t.length-(r-this.lastNeed);return t.copy(this.lastChar,0,n),t.toString("utf8",e,n)},o.prototype.fillLast=function(t){if(this.lastNeed<=t.length)return t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,t.length),this.lastNeed-=t.length}},{"safe-buffer":115}],117:[function(t,e,r){e.exports=t("./readable").PassThrough},{"./readable":118}],118:[function(t,e,r){(r=e.exports=t("./lib/_stream_readable.js")).Stream=r,r.Readable=r,r.Writable=t("./lib/_stream_writable.js"),r.Duplex=t("./lib/_stream_duplex.js"),r.Transform=t("./lib/_stream_transform.js"),r.PassThrough=t("./lib/_stream_passthrough.js")},{"./lib/_stream_duplex.js":107,"./lib/_stream_passthrough.js":108,"./lib/_stream_readable.js":109,"./lib/_stream_transform.js":110,"./lib/_stream_writable.js":111}],119:[function(t,e,r){e.exports=t("./readable").Transform},{"./readable":118}],120:[function(t,e,r){e.exports=t("./lib/_stream_writable.js")},{"./lib/_stream_writable.js":111}],121:[function(t,e,r){"use strict";var n=t("buffer").Buffer,i=t("inherits"),o=t("hash-base"),a=new Array(16),s=[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],f=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],u=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],h=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11],c=[0,1518500249,1859775393,2400959708,2840853838],d=[1352829926,1548603684,1836072691,2053994217,0];function l(){o.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520}function p(t,e){return t<>>32-e}function b(t,e,r,n,i,o,a,s){return p(t+(e^r^n)+o+a|0,s)+i|0}function m(t,e,r,n,i,o,a,s){return p(t+(e&r|~e&n)+o+a|0,s)+i|0}function y(t,e,r,n,i,o,a,s){return p(t+((e|~r)^n)+o+a|0,s)+i|0}function g(t,e,r,n,i,o,a,s){return p(t+(e&n|r&~n)+o+a|0,s)+i|0}function v(t,e,r,n,i,o,a,s){return p(t+(e^(r|~n))+o+a|0,s)+i|0}i(l,o),l.prototype._update=function(){for(var t=a,e=0;e<16;++e)t[e]=this._block.readInt32LE(4*e);for(var r=0|this._a,n=0|this._b,i=0|this._c,o=0|this._d,l=0|this._e,w=0|this._a,_=0|this._b,M=0|this._c,S=0|this._d,x=0|this._e,A=0;A<80;A+=1){var E,k;A<16?(E=b(r,n,i,o,l,t[s[A]],c[0],u[A]),k=v(w,_,M,S,x,t[f[A]],d[0],h[A])):A<32?(E=m(r,n,i,o,l,t[s[A]],c[1],u[A]),k=g(w,_,M,S,x,t[f[A]],d[1],h[A])):A<48?(E=y(r,n,i,o,l,t[s[A]],c[2],u[A]),k=y(w,_,M,S,x,t[f[A]],d[2],h[A])):A<64?(E=g(r,n,i,o,l,t[s[A]],c[3],u[A]),k=m(w,_,M,S,x,t[f[A]],d[3],h[A])):(E=v(r,n,i,o,l,t[s[A]],c[4],u[A]),k=b(w,_,M,S,x,t[f[A]],d[4],h[A])),r=l,l=o,o=p(i,10),i=n,n=E,w=x,x=S,S=p(M,10),M=_,_=k}var R=this._b+i+S|0;this._b=this._c+o+x|0,this._c=this._d+l+w|0,this._d=this._e+r+_|0,this._e=this._a+n+M|0,this._a=R},l.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var t=n.alloc?n.alloc(20):new n(20);return t.writeInt32LE(this._a,0),t.writeInt32LE(this._b,4),t.writeInt32LE(this._c,8),t.writeInt32LE(this._d,12),t.writeInt32LE(this._e,16),t},e.exports=l},{buffer:9,"hash-base":60,inherits:75}],122:[function(t,e,r){(function(e){"use strict";var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(r,"__esModule",{value:!0}),r.getLength=r.decode=r.encode=void 0;var i=n(t("bn.js"));function o(t,e){if("0"===t[0]&&"0"===t[1])throw new Error("invalid RLP: extra zeros");return parseInt(t,e)}function a(t,r){if(t<56)return e.from([t+r]);var n=u(t),i=u(r+55+n.length/2);return e.from(i+n,"hex")}function s(t){var r,n,i,a,f,u=[],h=t[0];if(h<=127)return{data:t.slice(0,1),remainder:t.slice(1)};if(h<=183){if(r=h-127,i=128===h?e.from([]):t.slice(1,r),2===r&&i[0]<128)throw new Error("invalid rlp encoding: byte must be less 0x80");return{data:i,remainder:t.slice(r)}}if(h<=191){if(n=h-182,t.length-1t.length)throw new Error("invalid rlp: total length is larger than the data");if(0===(a=t.slice(n,c)).length)throw new Error("invalid rlp, List has a invalid length");for(;a.length;)f=s(a),u.push(f.data),a=f.remainder;return{data:u,remainder:t.slice(c)}}function f(t){return"0x"===t.slice(0,2)}function u(t){if(t<0)throw new Error("Invalid integer as argument, must be unsigned!");var e=t.toString(16);return e.length%2?"0"+e:e}function h(t){if(!e.isBuffer(t)){if("string"==typeof t)return f(t)?e.from((n="string"!=typeof(o=t)?o:f(o)?o.slice(2):o).length%2?"0"+n:n,"hex"):e.from(t);if("number"==typeof t||"bigint"==typeof t)return t?(r=u(t),e.from(r,"hex")):e.from([]);if(null==t)return e.from([]);if(t instanceof Uint8Array)return e.from(t);if(i.default.isBN(t))return e.from(t.toArray());throw new Error("invalid type")}var r,n,o;return t}r.encode=function t(r){if(Array.isArray(r)){for(var n=[],i=0;iclass e extends n{constructor(e,r,n,i,o){super(o),this._rate=e,this._capacity=r,this._delimitedSuffix=n,this._hashBitLength=i,this._options=o,this._state=new t,this._state.initialize(e,r),this._finalized=!1}_transform(t,e,r){let n=null;try{this.update(t,e)}catch(t){n=t}r(n)}_flush(t){let e=null;try{this.push(this.digest())}catch(t){e=t}t(e)}update(t,e){if(!r.isBuffer(t)&&"string"!=typeof t)throw new TypeError("Data must be a string or a buffer");if(this._finalized)throw new Error("Digest already called");return r.isBuffer(t)||(t=r.from(t,e)),this._state.absorb(t),this}digest(t){if(this._finalized)throw new Error("Digest already called");this._finalized=!0,this._delimitedSuffix&&this._state.absorbLastFewBits(this._delimitedSuffix);let e=this._state.squeeze(this._hashBitLength/8);return void 0!==t&&(e=e.toString(t)),this._resetState(),e}_resetState(){return this._state.initialize(this._rate,this._capacity),this}_clone(){const t=new e(this._rate,this._capacity,this._delimitedSuffix,this._hashBitLength,this._options);return this._state.copy(t._state),t._finalized=this._finalized,t}}}).call(this,t("buffer").Buffer)},{buffer:9,"readable-stream":99}],82:[function(t,e,r){(function(r){const{Transform:n}=t("readable-stream");e.exports=t=>class e extends n{constructor(e,r,n,i){super(i),this._rate=e,this._capacity=r,this._delimitedSuffix=n,this._options=i,this._state=new t,this._state.initialize(e,r),this._finalized=!1}_transform(t,e,r){let n=null;try{this.update(t,e)}catch(t){n=t}r(n)}_flush(){}_read(t){this.push(this.squeeze(t))}update(t,e){if(!r.isBuffer(t)&&"string"!=typeof t)throw new TypeError("Data must be a string or a buffer");if(this._finalized)throw new Error("Squeeze already called");return r.isBuffer(t)||(t=r.from(t,e)),this._state.absorb(t),this}squeeze(t,e){this._finalized||(this._finalized=!0,this._state.absorbLastFewBits(this._delimitedSuffix));let r=this._state.squeeze(t);return void 0!==e&&(r=r.toString(e)),r}_resetState(){return this._state.initialize(this._rate,this._capacity),this}_clone(){const t=new e(this._rate,this._capacity,this._delimitedSuffix,this._options);return this._state.copy(t._state),t._finalized=this._finalized,t}}}).call(this,t("buffer").Buffer)},{buffer:9,"readable-stream":99}],83:[function(t,e,r){const n=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648];r.p1600=function(t){for(let e=0;e<24;++e){const r=t[0]^t[10]^t[20]^t[30]^t[40],i=t[1]^t[11]^t[21]^t[31]^t[41],o=t[2]^t[12]^t[22]^t[32]^t[42],a=t[3]^t[13]^t[23]^t[33]^t[43],s=t[4]^t[14]^t[24]^t[34]^t[44],f=t[5]^t[15]^t[25]^t[35]^t[45],u=t[6]^t[16]^t[26]^t[36]^t[46],h=t[7]^t[17]^t[27]^t[37]^t[47],c=t[8]^t[18]^t[28]^t[38]^t[48],d=t[9]^t[19]^t[29]^t[39]^t[49];let l=c^(o<<1|a>>>31),p=d^(a<<1|o>>>31);const b=t[0]^l,m=t[1]^p,y=t[10]^l,g=t[11]^p,v=t[20]^l,w=t[21]^p,_=t[30]^l,M=t[31]^p,S=t[40]^l,x=t[41]^p;l=r^(s<<1|f>>>31),p=i^(f<<1|s>>>31);const A=t[2]^l,E=t[3]^p,k=t[12]^l,R=t[13]^p,T=t[22]^l,B=t[23]^p,I=t[32]^l,L=t[33]^p,P=t[42]^l,j=t[43]^p;l=o^(u<<1|h>>>31),p=a^(h<<1|u>>>31);const O=t[4]^l,C=t[5]^p,N=t[14]^l,z=t[15]^p,U=t[24]^l,q=t[25]^p,K=t[34]^l,D=t[35]^p,H=t[44]^l,F=t[45]^p;l=s^(c<<1|d>>>31),p=f^(d<<1|c>>>31);const W=t[6]^l,Z=t[7]^p,V=t[16]^l,Y=t[17]^p,J=t[26]^l,X=t[27]^p,G=t[36]^l,$=t[37]^p,Q=t[46]^l,tt=t[47]^p;l=u^(r<<1|i>>>31),p=h^(i<<1|r>>>31);const et=t[8]^l,rt=t[9]^p,nt=t[18]^l,it=t[19]^p,ot=t[28]^l,at=t[29]^p,st=t[38]^l,ft=t[39]^p,ut=t[48]^l,ht=t[49]^p,ct=b,dt=m,lt=g<<4|y>>>28,pt=y<<4|g>>>28,bt=v<<3|w>>>29,mt=w<<3|v>>>29,yt=M<<9|_>>>23,gt=_<<9|M>>>23,vt=S<<18|x>>>14,wt=x<<18|S>>>14,_t=A<<1|E>>>31,Mt=E<<1|A>>>31,St=R<<12|k>>>20,xt=k<<12|R>>>20,At=T<<10|B>>>22,Et=B<<10|T>>>22,kt=L<<13|I>>>19,Rt=I<<13|L>>>19,Tt=P<<2|j>>>30,Bt=j<<2|P>>>30,It=C<<30|O>>>2,Lt=O<<30|C>>>2,Pt=N<<6|z>>>26,jt=z<<6|N>>>26,Ot=q<<11|U>>>21,Ct=U<<11|q>>>21,Nt=K<<15|D>>>17,zt=D<<15|K>>>17,Ut=F<<29|H>>>3,qt=H<<29|F>>>3,Kt=W<<28|Z>>>4,Dt=Z<<28|W>>>4,Ht=Y<<23|V>>>9,Ft=V<<23|Y>>>9,Wt=J<<25|X>>>7,Zt=X<<25|J>>>7,Vt=G<<21|$>>>11,Yt=$<<21|G>>>11,Jt=tt<<24|Q>>>8,Xt=Q<<24|tt>>>8,Gt=et<<27|rt>>>5,$t=rt<<27|et>>>5,Qt=nt<<20|it>>>12,te=it<<20|nt>>>12,ee=at<<7|ot>>>25,re=ot<<7|at>>>25,ne=st<<8|ft>>>24,ie=ft<<8|st>>>24,oe=ut<<14|ht>>>18,ae=ht<<14|ut>>>18;t[0]=ct^~St&Ot,t[1]=dt^~xt&Ct,t[10]=Kt^~Qt&bt,t[11]=Dt^~te&mt,t[20]=_t^~Pt&Wt,t[21]=Mt^~jt&Zt,t[30]=Gt^~lt&At,t[31]=$t^~pt&Et,t[40]=It^~Ht&ee,t[41]=Lt^~Ft&re,t[2]=St^~Ot&Vt,t[3]=xt^~Ct&Yt,t[12]=Qt^~bt&kt,t[13]=te^~mt&Rt,t[22]=Pt^~Wt&ne,t[23]=jt^~Zt&ie,t[32]=lt^~At&Nt,t[33]=pt^~Et&zt,t[42]=Ht^~ee&yt,t[43]=Ft^~re>,t[4]=Ot^~Vt&oe,t[5]=Ct^~Yt&ae,t[14]=bt^~kt&Ut,t[15]=mt^~Rt&qt,t[24]=Wt^~ne&vt,t[25]=Zt^~ie&wt,t[34]=At^~Nt&Jt,t[35]=Et^~zt&Xt,t[44]=ee^~yt&Tt,t[45]=re^~gt&Bt,t[6]=Vt^~oe&ct,t[7]=Yt^~ae&dt,t[16]=kt^~Ut&Kt,t[17]=Rt^~qt&Dt,t[26]=ne^~vt&_t,t[27]=ie^~wt&Mt,t[36]=Nt^~Jt&Gt,t[37]=zt^~Xt&$t,t[46]=yt^~Tt&It,t[47]=gt^~Bt&Lt,t[8]=oe^~ct&St,t[9]=ae^~dt&xt,t[18]=Ut^~Kt&Qt,t[19]=qt^~Dt&te,t[28]=vt^~_t&Pt,t[29]=wt^~Mt&jt,t[38]=Jt^~Gt<,t[39]=Xt^~$t&pt,t[48]=Tt^~It&Ht,t[49]=Bt^~Lt&Ft,t[0]^=n[2*e],t[1]^=n[2*e+1]}}},{}],84:[function(t,e,r){(function(r){const n=t("./keccak-state-unroll");function i(){this.state=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],this.blockSize=null,this.count=0,this.squeezing=!1}i.prototype.initialize=function(t,e){for(let t=0;t<50;++t)this.state[t]=0;this.blockSize=t/8,this.count=0,this.squeezing=!1},i.prototype.absorb=function(t){for(let e=0;e>>this.count%4*8&255,this.count+=1,this.count===this.blockSize&&(n.p1600(this.state),this.count=0);return e},i.prototype.copy=function(t){for(let e=0;e<50;++e)t.state[e]=this.state[e];t.blockSize=this.blockSize,t.count=this.count,t.squeezing=this.squeezing},e.exports=i}).call(this,t("buffer").Buffer)},{"./keccak-state-unroll":83,buffer:9}],85:[function(t,e,r){"use strict";var n={};function i(t,e,r){r||(r=Error);var i=function(t){var r,n;function i(r,n,i){return t.call(this,function(t,r,n){return"string"==typeof e?e:e(t,r,n)}(r,n,i))||this}return n=t,(r=i).prototype=Object.create(n.prototype),r.prototype.constructor=r,r.__proto__=n,i}(r);i.prototype.name=r.name,i.prototype.code=t,n[t]=i}function o(t,e){if(Array.isArray(t)){var r=t.length;return t=t.map((function(t){return String(t)})),r>2?"one of ".concat(e," ").concat(t.slice(0,r-1).join(", "),", or ")+t[r-1]:2===r?"one of ".concat(e," ").concat(t[0]," or ").concat(t[1]):"of ".concat(e," ").concat(t[0])}return"of ".concat(e," ").concat(String(t))}i("ERR_INVALID_OPT_VALUE",(function(t,e){return'The value "'+e+'" is invalid for option "'+t+'"'}),TypeError),i("ERR_INVALID_ARG_TYPE",(function(t,e,r){var n,i,a,s;if("string"==typeof e&&(i="not ",e.substr(!a||a<0?0:+a,i.length)===i)?(n="must not be",e=e.replace(/^not /,"")):n="must be",function(t,e,r){return(void 0===r||r>t.length)&&(r=t.length),t.substring(r-e.length,r)===e}(t," argument"))s="The ".concat(t," ").concat(n," ").concat(o(e,"type"));else{var f=function(t,e,r){return"number"!=typeof r&&(r=0),!(r+e.length>t.length)&&-1!==t.indexOf(e,r)}(t,".")?"property":"argument";s='The "'.concat(t,'" ').concat(f," ").concat(n," ").concat(o(e,"type"))}return s+=". Received type ".concat(typeof r)}),TypeError),i("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),i("ERR_METHOD_NOT_IMPLEMENTED",(function(t){return"The "+t+" method is not implemented"})),i("ERR_STREAM_PREMATURE_CLOSE","Premature close"),i("ERR_STREAM_DESTROYED",(function(t){return"Cannot call "+t+" after a stream was destroyed"})),i("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),i("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),i("ERR_STREAM_WRITE_AFTER_END","write after end"),i("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),i("ERR_UNKNOWN_ENCODING",(function(t){return"Unknown encoding: "+t}),TypeError),i("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),e.exports.codes=n},{}],86:[function(t,e,r){(function(r){"use strict";var n=Object.keys||function(t){var e=[];for(var r in t)e.push(r);return e};e.exports=u;var i=t("./_stream_readable"),o=t("./_stream_writable");t("inherits")(u,i);for(var a=n(o.prototype),s=0;s0)if("string"==typeof e||a.objectMode||Object.getPrototypeOf(e)===s.prototype||(e=function(t){return s.from(t)}(e)),n)a.endEmitted?M(t,new _):k(t,a,e,!0);else if(a.ended)M(t,new v);else{if(a.destroyed)return!1;a.reading=!1,a.decoder&&!r?(e=a.decoder.write(e),a.objectMode||0!==e.length?k(t,a,e,!1):L(t,a)):k(t,a,e,!1)}else n||(a.reading=!1,L(t,a));return!a.ended&&(a.lengthe.highWaterMark&&(e.highWaterMark=function(t){return t>=R?t=R:(t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++),t}(t)),t<=e.length?t:e.ended?e.length:(e.needReadable=!0,0))}function B(t){var e=t._readableState;u("emitReadable",e.needReadable,e.emittedReadable),e.needReadable=!1,e.emittedReadable||(u("emitReadable",e.flowing),e.emittedReadable=!0,r.nextTick(I,t))}function I(t){var e=t._readableState;u("emitReadable_",e.destroyed,e.length,e.ended),e.destroyed||!e.length&&!e.ended||(t.emit("readable"),e.emittedReadable=!1),e.needReadable=!e.flowing&&!e.ended&&e.length<=e.highWaterMark,N(t)}function L(t,e){e.readingMore||(e.readingMore=!0,r.nextTick(P,t,e))}function P(t,e){for(;!e.reading&&!e.ended&&(e.length0,e.resumeScheduled&&!e.paused?e.flowing=!0:t.listenerCount("data")>0&&t.resume()}function O(t){u("readable nexttick read 0"),t.read(0)}function C(t,e){u("resume",e.reading),e.reading||t.read(0),e.resumeScheduled=!1,t.emit("resume"),N(t),e.flowing&&!e.reading&&t.read(0)}function N(t){var e=t._readableState;for(u("flow",e.flowing);e.flowing&&null!==t.read(););}function z(t,e){return 0===e.length?null:(e.objectMode?r=e.buffer.shift():!t||t>=e.length?(r=e.decoder?e.buffer.join(""):1===e.buffer.length?e.buffer.first():e.buffer.concat(e.length),e.buffer.clear()):r=e.buffer.consume(t,e.decoder),r);var r}function U(t){var e=t._readableState;u("endReadable",e.endEmitted),e.endEmitted||(e.ended=!0,r.nextTick(q,e,t))}function q(t,e){if(u("endReadableNT",t.endEmitted,t.length),!t.endEmitted&&0===t.length&&(t.endEmitted=!0,e.readable=!1,e.emit("end"),t.autoDestroy)){var r=e._writableState;(!r||r.autoDestroy&&r.finished)&&e.destroy()}}function K(t,e){for(var r=0,n=t.length;r=e.highWaterMark:e.length>0)||e.ended))return u("read: emitReadable",e.length,e.ended),0===e.length&&e.ended?U(this):B(this),null;if(0===(t=T(t,e))&&e.ended)return 0===e.length&&U(this),null;var n,i=e.needReadable;return u("need readable",i),(0===e.length||e.length-t0?z(t,e):null)?(e.needReadable=e.length<=e.highWaterMark,t=0):(e.length-=t,e.awaitDrain=0),0===e.length&&(e.ended||(e.needReadable=!0),r!==t&&e.ended&&U(this)),null!==n&&this.emit("data",n),n},A.prototype._read=function(t){M(this,new w("_read()"))},A.prototype.pipe=function(t,e){var n=this,i=this._readableState;switch(i.pipesCount){case 0:i.pipes=t;break;case 1:i.pipes=[i.pipes,t];break;default:i.pipes.push(t)}i.pipesCount+=1,u("pipe count=%d opts=%j",i.pipesCount,e);var a=(!e||!1!==e.end)&&t!==r.stdout&&t!==r.stderr?f:m;function s(e,r){u("onunpipe"),e===n&&r&&!1===r.hasUnpiped&&(r.hasUnpiped=!0,u("cleanup"),t.removeListener("close",p),t.removeListener("finish",b),t.removeListener("drain",h),t.removeListener("error",l),t.removeListener("unpipe",s),n.removeListener("end",f),n.removeListener("end",m),n.removeListener("data",d),c=!0,!i.awaitDrain||t._writableState&&!t._writableState.needDrain||h())}function f(){u("onend"),t.end()}i.endEmitted?r.nextTick(a):n.once("end",a),t.on("unpipe",s);var h=function(t){return function(){var e=t._readableState;u("pipeOnDrain",e.awaitDrain),e.awaitDrain&&e.awaitDrain--,0===e.awaitDrain&&o(t,"data")&&(e.flowing=!0,N(t))}}(n);t.on("drain",h);var c=!1;function d(e){u("ondata");var r=t.write(e);u("dest.write",r),!1===r&&((1===i.pipesCount&&i.pipes===t||i.pipesCount>1&&-1!==K(i.pipes,t))&&!c&&(u("false write response, pause",i.awaitDrain),i.awaitDrain++),n.pause())}function l(e){u("onerror",e),m(),t.removeListener("error",l),0===o(t,"error")&&M(t,e)}function p(){t.removeListener("finish",b),m()}function b(){u("onfinish"),t.removeListener("close",p),m()}function m(){u("unpipe"),n.unpipe(t)}return n.on("data",d),function(t,e,r){if("function"==typeof t.prependListener)return t.prependListener(e,r);t._events&&t._events[e]?Array.isArray(t._events[e])?t._events[e].unshift(r):t._events[e]=[r,t._events[e]]:t.on(e,r)}(t,"error",l),t.once("close",p),t.once("finish",b),t.emit("pipe",n),i.flowing||(u("pipe resume"),n.resume()),t},A.prototype.unpipe=function(t){var e=this._readableState,r={hasUnpiped:!1};if(0===e.pipesCount)return this;if(1===e.pipesCount)return t&&t!==e.pipes||(t||(t=e.pipes),e.pipes=null,e.pipesCount=0,e.flowing=!1,t&&t.emit("unpipe",this,r)),this;if(!t){var n=e.pipes,i=e.pipesCount;e.pipes=null,e.pipesCount=0,e.flowing=!1;for(var o=0;o0,!1!==i.flowing&&this.resume()):"readable"===t&&(i.endEmitted||i.readableListening||(i.readableListening=i.needReadable=!0,i.flowing=!1,i.emittedReadable=!1,u("on readable",i.length,i.reading),i.length?B(this):i.reading||r.nextTick(O,this))),n},A.prototype.addListener=A.prototype.on,A.prototype.removeListener=function(t,e){var n=a.prototype.removeListener.call(this,t,e);return"readable"===t&&r.nextTick(j,this),n},A.prototype.removeAllListeners=function(t){var e=a.prototype.removeAllListeners.apply(this,arguments);return"readable"!==t&&void 0!==t||r.nextTick(j,this),e},A.prototype.resume=function(){var t=this._readableState;return t.flowing||(u("resume"),t.flowing=!t.readableListening,function(t,e){e.resumeScheduled||(e.resumeScheduled=!0,r.nextTick(C,t,e))}(this,t)),t.paused=!1,this},A.prototype.pause=function(){return u("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(u("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},A.prototype.wrap=function(t){var e=this,r=this._readableState,n=!1;for(var i in t.on("end",(function(){if(u("wrapped end"),r.decoder&&!r.ended){var t=r.decoder.end();t&&t.length&&e.push(t)}e.push(null)})),t.on("data",(function(i){(u("wrapped data"),r.decoder&&(i=r.decoder.write(i)),r.objectMode&&null==i)||(r.objectMode||i&&i.length)&&(e.push(i)||(n=!0,t.pause()))})),t)void 0===this[i]&&"function"==typeof t[i]&&(this[i]=function(e){return function(){return t[e].apply(t,arguments)}}(i));for(var o=0;o-1))throw new _(t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(A.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(A.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),A.prototype._write=function(t,e,r){r(new b("_write()"))},A.prototype._writev=null,A.prototype.end=function(t,e,n){var i=this._writableState;return"function"==typeof t?(n=t,t=null,e=null):"function"==typeof e&&(n=e,e=null),null!=t&&this.write(t,e),i.corked&&(i.corked=1,this.uncork()),i.ending||function(t,e,n){e.ending=!0,I(t,e),n&&(e.finished?r.nextTick(n):t.once("finish",n));e.ended=!0,t.writable=!1}(this,i,n),this},Object.defineProperty(A.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(A.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(t){this._writableState&&(this._writableState.destroyed=t)}}),A.prototype.destroy=c.destroy,A.prototype._undestroy=c.undestroy,A.prototype._destroy=function(t,e){e(t)}}).call(this,t("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../errors":85,"./_stream_duplex":86,"./internal/streams/destroy":93,"./internal/streams/state":97,"./internal/streams/stream":98,_process:104,buffer:9,inherits:75,"util-deprecate":141}],91:[function(t,e,r){(function(r){"use strict";var n;function i(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var o=t("./end-of-stream"),a=Symbol("lastResolve"),s=Symbol("lastReject"),f=Symbol("error"),u=Symbol("ended"),h=Symbol("lastPromise"),c=Symbol("handlePromise"),d=Symbol("stream");function l(t,e){return{value:t,done:e}}function p(t){var e=t[a];if(null!==e){var r=t[d].read();null!==r&&(t[h]=null,t[a]=null,t[s]=null,e(l(r,!1)))}}function b(t){r.nextTick(p,t)}var m=Object.getPrototypeOf((function(){})),y=Object.setPrototypeOf((i(n={get stream(){return this[d]},next:function(){var t=this,e=this[f];if(null!==e)return Promise.reject(e);if(this[u])return Promise.resolve(l(void 0,!0));if(this[d].destroyed)return new Promise((function(e,n){r.nextTick((function(){t[f]?n(t[f]):e(l(void 0,!0))}))}));var n,i=this[h];if(i)n=new Promise(function(t,e){return function(r,n){t.then((function(){e[u]?r(l(void 0,!0)):e[c](r,n)}),n)}}(i,this));else{var o=this[d].read();if(null!==o)return Promise.resolve(l(o,!1));n=new Promise(this[c])}return this[h]=n,n}},Symbol.asyncIterator,(function(){return this})),i(n,"return",(function(){var t=this;return new Promise((function(e,r){t[d].destroy(null,(function(t){t?r(t):e(l(void 0,!0))}))}))})),n),m);e.exports=function(t){var e,r=Object.create(y,(i(e={},d,{value:t,writable:!0}),i(e,a,{value:null,writable:!0}),i(e,s,{value:null,writable:!0}),i(e,f,{value:null,writable:!0}),i(e,u,{value:t._readableState.endEmitted,writable:!0}),i(e,c,{value:function(t,e){var n=r[d].read();n?(r[h]=null,r[a]=null,r[s]=null,t(l(n,!1))):(r[a]=t,r[s]=e)},writable:!0}),e));return r[h]=null,o(t,(function(t){if(t&&"ERR_STREAM_PREMATURE_CLOSE"!==t.code){var e=r[s];return null!==e&&(r[h]=null,r[a]=null,r[s]=null,e(t)),void(r[f]=t)}var n=r[a];null!==n&&(r[h]=null,r[a]=null,r[s]=null,n(l(void 0,!0))),r[u]=!0})),t.on("readable",b.bind(null,r)),r}}).call(this,t("_process"))},{"./end-of-stream":94,_process:104}],92:[function(t,e,r){"use strict";function n(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function i(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function o(t,e){for(var r=0;r0?this.tail.next=e:this.head=e,this.tail=e,++this.length}},{key:"unshift",value:function(t){var e={data:t,next:this.head};0===this.length&&(this.tail=e),this.head=e,++this.length}},{key:"shift",value:function(){if(0!==this.length){var t=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,t}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(t){if(0===this.length)return"";for(var e=this.head,r=""+e.data;e=e.next;)r+=t+e.data;return r}},{key:"concat",value:function(t){if(0===this.length)return a.alloc(0);for(var e,r,n,i=a.allocUnsafe(t>>>0),o=this.head,s=0;o;)e=o.data,r=i,n=s,a.prototype.copy.call(e,r,n),s+=o.data.length,o=o.next;return i}},{key:"consume",value:function(t,e){var r;return ti.length?i.length:t;if(o===i.length?n+=i:n+=i.slice(0,t),0==(t-=o)){o===i.length?(++r,e.next?this.head=e.next:this.head=this.tail=null):(this.head=e,e.data=i.slice(o));break}++r}return this.length-=r,n}},{key:"_getBuffer",value:function(t){var e=a.allocUnsafe(t),r=this.head,n=1;for(r.data.copy(e),t-=r.data.length;r=r.next;){var i=r.data,o=t>i.length?i.length:t;if(i.copy(e,e.length-t,0,o),0==(t-=o)){o===i.length?(++n,r.next?this.head=r.next:this.head=this.tail=null):(this.head=r,r.data=i.slice(o));break}++n}return this.length-=n,e}},{key:f,value:function(t,e){return s(this,function(t){for(var e=1;e0,(function(t){n||(n=t),t&&a.forEach(u),o||(a.forEach(u),i(n))}))}));return e.reduce(h)}},{"../../../errors":85,"./end-of-stream":94}],97:[function(t,e,r){"use strict";var n=t("../../../errors").codes.ERR_INVALID_OPT_VALUE;e.exports={getHighWaterMark:function(t,e,r,i){var o=function(t,e,r){return null!=t.highWaterMark?t.highWaterMark:e?t[r]:null}(e,i,r);if(null!=o){if(!isFinite(o)||Math.floor(o)!==o||o<0)throw new n(i?r:"highWaterMark",o);return Math.floor(o)}return t.objectMode?16:16384}}},{"../../../errors":85}],98:[function(t,e,r){e.exports=t("events").EventEmitter},{events:59}],99:[function(t,e,r){(r=e.exports=t("./lib/_stream_readable.js")).Stream=r,r.Readable=r,r.Writable=t("./lib/_stream_writable.js"),r.Duplex=t("./lib/_stream_duplex.js"),r.Transform=t("./lib/_stream_transform.js"),r.PassThrough=t("./lib/_stream_passthrough.js"),r.finished=t("./lib/internal/streams/end-of-stream.js"),r.pipeline=t("./lib/internal/streams/pipeline.js")},{"./lib/_stream_duplex.js":86,"./lib/_stream_passthrough.js":87,"./lib/_stream_readable.js":88,"./lib/_stream_transform.js":89,"./lib/_stream_writable.js":90,"./lib/internal/streams/end-of-stream.js":94,"./lib/internal/streams/pipeline.js":96}],100:[function(t,e,r){"use strict";var n=t("inherits"),i=t("hash-base"),o=t("safe-buffer").Buffer,a=new Array(16);function s(){i.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878}function f(t,e){return t<>>32-e}function u(t,e,r,n,i,o,a){return f(t+(e&r|~e&n)+i+o|0,a)+e|0}function h(t,e,r,n,i,o,a){return f(t+(e&n|r&~n)+i+o|0,a)+e|0}function c(t,e,r,n,i,o,a){return f(t+(e^r^n)+i+o|0,a)+e|0}function d(t,e,r,n,i,o,a){return f(t+(r^(e|~n))+i+o|0,a)+e|0}n(s,i),s.prototype._update=function(){for(var t=a,e=0;e<16;++e)t[e]=this._block.readInt32LE(4*e);var r=this._a,n=this._b,i=this._c,o=this._d;r=u(r,n,i,o,t[0],3614090360,7),o=u(o,r,n,i,t[1],3905402710,12),i=u(i,o,r,n,t[2],606105819,17),n=u(n,i,o,r,t[3],3250441966,22),r=u(r,n,i,o,t[4],4118548399,7),o=u(o,r,n,i,t[5],1200080426,12),i=u(i,o,r,n,t[6],2821735955,17),n=u(n,i,o,r,t[7],4249261313,22),r=u(r,n,i,o,t[8],1770035416,7),o=u(o,r,n,i,t[9],2336552879,12),i=u(i,o,r,n,t[10],4294925233,17),n=u(n,i,o,r,t[11],2304563134,22),r=u(r,n,i,o,t[12],1804603682,7),o=u(o,r,n,i,t[13],4254626195,12),i=u(i,o,r,n,t[14],2792965006,17),r=h(r,n=u(n,i,o,r,t[15],1236535329,22),i,o,t[1],4129170786,5),o=h(o,r,n,i,t[6],3225465664,9),i=h(i,o,r,n,t[11],643717713,14),n=h(n,i,o,r,t[0],3921069994,20),r=h(r,n,i,o,t[5],3593408605,5),o=h(o,r,n,i,t[10],38016083,9),i=h(i,o,r,n,t[15],3634488961,14),n=h(n,i,o,r,t[4],3889429448,20),r=h(r,n,i,o,t[9],568446438,5),o=h(o,r,n,i,t[14],3275163606,9),i=h(i,o,r,n,t[3],4107603335,14),n=h(n,i,o,r,t[8],1163531501,20),r=h(r,n,i,o,t[13],2850285829,5),o=h(o,r,n,i,t[2],4243563512,9),i=h(i,o,r,n,t[7],1735328473,14),r=c(r,n=h(n,i,o,r,t[12],2368359562,20),i,o,t[5],4294588738,4),o=c(o,r,n,i,t[8],2272392833,11),i=c(i,o,r,n,t[11],1839030562,16),n=c(n,i,o,r,t[14],4259657740,23),r=c(r,n,i,o,t[1],2763975236,4),o=c(o,r,n,i,t[4],1272893353,11),i=c(i,o,r,n,t[7],4139469664,16),n=c(n,i,o,r,t[10],3200236656,23),r=c(r,n,i,o,t[13],681279174,4),o=c(o,r,n,i,t[0],3936430074,11),i=c(i,o,r,n,t[3],3572445317,16),n=c(n,i,o,r,t[6],76029189,23),r=c(r,n,i,o,t[9],3654602809,4),o=c(o,r,n,i,t[12],3873151461,11),i=c(i,o,r,n,t[15],530742520,16),r=d(r,n=c(n,i,o,r,t[2],3299628645,23),i,o,t[0],4096336452,6),o=d(o,r,n,i,t[7],1126891415,10),i=d(i,o,r,n,t[14],2878612391,15),n=d(n,i,o,r,t[5],4237533241,21),r=d(r,n,i,o,t[12],1700485571,6),o=d(o,r,n,i,t[3],2399980690,10),i=d(i,o,r,n,t[10],4293915773,15),n=d(n,i,o,r,t[1],2240044497,21),r=d(r,n,i,o,t[8],1873313359,6),o=d(o,r,n,i,t[15],4264355552,10),i=d(i,o,r,n,t[6],2734768916,15),n=d(n,i,o,r,t[13],1309151649,21),r=d(r,n,i,o,t[4],4149444226,6),o=d(o,r,n,i,t[11],3174756917,10),i=d(i,o,r,n,t[2],718787259,15),n=d(n,i,o,r,t[9],3951481745,21),this._a=this._a+r|0,this._b=this._b+n|0,this._c=this._c+i|0,this._d=this._d+o|0},s.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var t=o.allocUnsafe(16);return t.writeInt32LE(this._a,0),t.writeInt32LE(this._b,4),t.writeInt32LE(this._c,8),t.writeInt32LE(this._d,12),t},e.exports=s},{"hash-base":60,inherits:75,"safe-buffer":124}],101:[function(t,e,r){function n(t,e){if(!t)throw new Error(e||"Assertion failed")}e.exports=n,n.equal=function(t,e,r){if(t!=e)throw new Error(r||"Assertion failed: "+t+" != "+e)}},{}],102:[function(t,e,r){"use strict";var n=r;function i(t){return 1===t.length?"0"+t:t}function o(t){for(var e="",r=0;r>8,a=255&i;o?r.push(o,a):r.push(a)}return r},n.zero2=i,n.toHex=o,n.encode=function(t,e){return"hex"===e?o(t):t}},{}],103:[function(t,e,r){(function(t){"use strict";!t.version||0===t.version.indexOf("v0.")||0===t.version.indexOf("v1.")&&0!==t.version.indexOf("v1.8.")?e.exports={nextTick:function(e,r,n,i){if("function"!=typeof e)throw new TypeError('"callback" argument must be a function');var o,a,s=arguments.length;switch(s){case 0:case 1:return t.nextTick(e);case 2:return t.nextTick((function(){e.call(null,r)}));case 3:return t.nextTick((function(){e.call(null,r,n)}));case 4:return t.nextTick((function(){e.call(null,r,n,i)}));default:for(o=new Array(s-1),a=0;a1)for(var r=1;ro)throw new RangeError("requested too many random bytes");var n=a.allocUnsafe(t);if(t>0)if(t>i)for(var f=0;f0?("string"==typeof e||a.objectMode||Object.getPrototypeOf(e)===u.prototype||(e=function(t){return u.from(t)}(e)),n?a.endEmitted?t.emit("error",new Error("stream.unshift() after end event")):_(t,a,e,!0):a.ended?t.emit("error",new Error("stream.push() after EOF")):(a.reading=!1,a.decoder&&!r?(e=a.decoder.write(e),a.objectMode||0!==e.length?_(t,a,e,!1):E(t,a)):_(t,a,e,!1))):n||(a.reading=!1));return function(t){return!t.ended&&(t.needReadable||t.lengthe.highWaterMark&&(e.highWaterMark=function(t){return t>=M?t=M:(t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++),t}(t)),t<=e.length?t:e.ended?e.length:(e.needReadable=!0,0))}function x(t){var e=t._readableState;e.needReadable=!1,e.emittedReadable||(l("emitReadable",e.flowing),e.emittedReadable=!0,e.sync?i.nextTick(A,t):A(t))}function A(t){l("emit readable"),t.emit("readable"),B(t)}function E(t,e){e.readingMore||(e.readingMore=!0,i.nextTick(k,t,e))}function k(t,e){for(var r=e.length;!e.reading&&!e.flowing&&!e.ended&&e.length=e.length?(r=e.decoder?e.buffer.join(""):1===e.buffer.length?e.buffer.head.data:e.buffer.concat(e.length),e.buffer.clear()):r=function(t,e,r){var n;to.length?o.length:t;if(a===o.length?i+=o:i+=o.slice(0,t),0===(t-=a)){a===o.length?(++n,r.next?e.head=r.next:e.head=e.tail=null):(e.head=r,r.data=o.slice(a));break}++n}return e.length-=n,i}(t,e):function(t,e){var r=u.allocUnsafe(t),n=e.head,i=1;n.data.copy(r),t-=n.data.length;for(;n=n.next;){var o=n.data,a=t>o.length?o.length:t;if(o.copy(r,r.length-t,0,a),0===(t-=a)){a===o.length?(++i,n.next?e.head=n.next:e.head=e.tail=null):(e.head=n,n.data=o.slice(a));break}++i}return e.length-=i,r}(t,e);return n}(t,e.buffer,e.decoder),r);var r}function L(t){var e=t._readableState;if(e.length>0)throw new Error('"endReadable()" called on non-empty stream');e.endEmitted||(e.ended=!0,i.nextTick(P,e,t))}function P(t,e){t.endEmitted||0!==t.length||(t.endEmitted=!0,e.readable=!1,e.emit("end"))}function j(t,e){for(var r=0,n=t.length;r=e.highWaterMark||e.ended))return l("read: emitReadable",e.length,e.ended),0===e.length&&e.ended?L(this):x(this),null;if(0===(t=S(t,e))&&e.ended)return 0===e.length&&L(this),null;var n,i=e.needReadable;return l("need readable",i),(0===e.length||e.length-t0?I(t,e):null)?(e.needReadable=!0,t=0):e.length-=t,0===e.length&&(e.ended||(e.needReadable=!0),r!==t&&e.ended&&L(this)),null!==n&&this.emit("data",n),n},v.prototype._read=function(t){this.emit("error",new Error("_read() is not implemented"))},v.prototype.pipe=function(t,e){var n=this,o=this._readableState;switch(o.pipesCount){case 0:o.pipes=t;break;case 1:o.pipes=[o.pipes,t];break;default:o.pipes.push(t)}o.pipesCount+=1,l("pipe count=%d opts=%j",o.pipesCount,e);var f=(!e||!1!==e.end)&&t!==r.stdout&&t!==r.stderr?h:v;function u(e,r){l("onunpipe"),e===n&&r&&!1===r.hasUnpiped&&(r.hasUnpiped=!0,l("cleanup"),t.removeListener("close",y),t.removeListener("finish",g),t.removeListener("drain",c),t.removeListener("error",m),t.removeListener("unpipe",u),n.removeListener("end",h),n.removeListener("end",v),n.removeListener("data",b),d=!0,!o.awaitDrain||t._writableState&&!t._writableState.needDrain||c())}function h(){l("onend"),t.end()}o.endEmitted?i.nextTick(f):n.once("end",f),t.on("unpipe",u);var c=function(t){return function(){var e=t._readableState;l("pipeOnDrain",e.awaitDrain),e.awaitDrain&&e.awaitDrain--,0===e.awaitDrain&&s(t,"data")&&(e.flowing=!0,B(t))}}(n);t.on("drain",c);var d=!1;var p=!1;function b(e){l("ondata"),p=!1,!1!==t.write(e)||p||((1===o.pipesCount&&o.pipes===t||o.pipesCount>1&&-1!==j(o.pipes,t))&&!d&&(l("false write response, pause",n._readableState.awaitDrain),n._readableState.awaitDrain++,p=!0),n.pause())}function m(e){l("onerror",e),v(),t.removeListener("error",m),0===s(t,"error")&&t.emit("error",e)}function y(){t.removeListener("finish",g),v()}function g(){l("onfinish"),t.removeListener("close",y),v()}function v(){l("unpipe"),n.unpipe(t)}return n.on("data",b),function(t,e,r){if("function"==typeof t.prependListener)return t.prependListener(e,r);t._events&&t._events[e]?a(t._events[e])?t._events[e].unshift(r):t._events[e]=[r,t._events[e]]:t.on(e,r)}(t,"error",m),t.once("close",y),t.once("finish",g),t.emit("pipe",n),o.flowing||(l("pipe resume"),n.resume()),t},v.prototype.unpipe=function(t){var e=this._readableState,r={hasUnpiped:!1};if(0===e.pipesCount)return this;if(1===e.pipesCount)return t&&t!==e.pipes||(t||(t=e.pipes),e.pipes=null,e.pipesCount=0,e.flowing=!1,t&&t.emit("unpipe",this,r)),this;if(!t){var n=e.pipes,i=e.pipesCount;e.pipes=null,e.pipesCount=0,e.flowing=!1;for(var o=0;o-1?i:o.nextTick;g.WritableState=y;var u=t("core-util-is");u.inherits=t("inherits");var h={deprecate:t("util-deprecate")},c=t("./internal/streams/stream"),d=t("safe-buffer").Buffer,l=n.Uint8Array||function(){};var p,b=t("./internal/streams/destroy");function m(){}function y(e,r){s=s||t("./_stream_duplex"),e=e||{};var n=r instanceof s;this.objectMode=!!e.objectMode,n&&(this.objectMode=this.objectMode||!!e.writableObjectMode);var i=e.highWaterMark,u=e.writableHighWaterMark,h=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:n&&(u||0===u)?u:h,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var c=!1===e.decodeStrings;this.decodeStrings=!c,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(t){!function(t,e){var r=t._writableState,n=r.sync,i=r.writecb;if(function(t){t.writing=!1,t.writecb=null,t.length-=t.writelen,t.writelen=0}(r),e)!function(t,e,r,n,i){--e.pendingcb,r?(o.nextTick(i,n),o.nextTick(x,t,e),t._writableState.errorEmitted=!0,t.emit("error",n)):(i(n),t._writableState.errorEmitted=!0,t.emit("error",n),x(t,e))}(t,r,n,e,i);else{var a=M(r);a||r.corked||r.bufferProcessing||!r.bufferedRequest||_(t,r),n?f(w,t,r,a,i):w(t,r,a,i)}}(r,t)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new a(this)}function g(e){if(s=s||t("./_stream_duplex"),!(p.call(g,this)||this instanceof s))return new g(e);this._writableState=new y(e,this),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),c.call(this)}function v(t,e,r,n,i,o,a){e.writelen=n,e.writecb=a,e.writing=!0,e.sync=!0,r?t._writev(i,e.onwrite):t._write(i,o,e.onwrite),e.sync=!1}function w(t,e,r,n){r||function(t,e){0===e.length&&e.needDrain&&(e.needDrain=!1,t.emit("drain"))}(t,e),e.pendingcb--,n(),x(t,e)}function _(t,e){e.bufferProcessing=!0;var r=e.bufferedRequest;if(t._writev&&r&&r.next){var n=e.bufferedRequestCount,i=new Array(n),o=e.corkedRequestsFree;o.entry=r;for(var s=0,f=!0;r;)i[s]=r,r.isBuf||(f=!1),r=r.next,s+=1;i.allBuffers=f,v(t,e,!0,e.length,i,"",o.finish),e.pendingcb++,e.lastBufferedRequest=null,o.next?(e.corkedRequestsFree=o.next,o.next=null):e.corkedRequestsFree=new a(e),e.bufferedRequestCount=0}else{for(;r;){var u=r.chunk,h=r.encoding,c=r.callback;if(v(t,e,!1,e.objectMode?1:u.length,u,h,c),r=r.next,e.bufferedRequestCount--,e.writing)break}null===r&&(e.lastBufferedRequest=null)}e.bufferedRequest=r,e.bufferProcessing=!1}function M(t){return t.ending&&0===t.length&&null===t.bufferedRequest&&!t.finished&&!t.writing}function S(t,e){t._final((function(r){e.pendingcb--,r&&t.emit("error",r),e.prefinished=!0,t.emit("prefinish"),x(t,e)}))}function x(t,e){var r=M(e);return r&&(!function(t,e){e.prefinished||e.finalCalled||("function"==typeof t._final?(e.pendingcb++,e.finalCalled=!0,o.nextTick(S,t,e)):(e.prefinished=!0,t.emit("prefinish")))}(t,e),0===e.pendingcb&&(e.finished=!0,t.emit("finish"))),r}u.inherits(g,c),y.prototype.getBuffer=function(){for(var t=this.bufferedRequest,e=[];t;)e.push(t),t=t.next;return e},function(){try{Object.defineProperty(y.prototype,"buffer",{get:h.deprecate((function(){return this.getBuffer()}),"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(t){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(p=Function.prototype[Symbol.hasInstance],Object.defineProperty(g,Symbol.hasInstance,{value:function(t){return!!p.call(this,t)||this===g&&(t&&t._writableState instanceof y)}})):p=function(t){return t instanceof this},g.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},g.prototype.write=function(t,e,r){var n,i=this._writableState,a=!1,s=!i.objectMode&&(n=t,d.isBuffer(n)||n instanceof l);return s&&!d.isBuffer(t)&&(t=function(t){return d.from(t)}(t)),"function"==typeof e&&(r=e,e=null),s?e="buffer":e||(e=i.defaultEncoding),"function"!=typeof r&&(r=m),i.ended?function(t,e){var r=new Error("write after end");t.emit("error",r),o.nextTick(e,r)}(this,r):(s||function(t,e,r,n){var i=!0,a=!1;return null===r?a=new TypeError("May not write null values to stream"):"string"==typeof r||void 0===r||e.objectMode||(a=new TypeError("Invalid non-string/buffer chunk")),a&&(t.emit("error",a),o.nextTick(n,a),i=!1),i}(this,i,t,r))&&(i.pendingcb++,a=function(t,e,r,n,i,o){if(!r){var a=function(t,e,r){t.objectMode||!1===t.decodeStrings||"string"!=typeof e||(e=d.from(e,r));return e}(e,n,i);n!==a&&(r=!0,i="buffer",n=a)}var s=e.objectMode?1:n.length;e.length+=s;var f=e.length-1))throw new TypeError("Unknown encoding: "+t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(g.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),g.prototype._write=function(t,e,r){r(new Error("_write() is not implemented"))},g.prototype._writev=null,g.prototype.end=function(t,e,r){var n=this._writableState;"function"==typeof t?(r=t,t=null,e=null):"function"==typeof e&&(r=e,e=null),null!=t&&this.write(t,e),n.corked&&(n.corked=1,this.uncork()),n.ending||n.finished||function(t,e,r){e.ending=!0,x(t,e),r&&(e.finished?o.nextTick(r):t.once("finish",r));e.ended=!0,t.writable=!1}(this,n,r)},Object.defineProperty(g.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(t){this._writableState&&(this._writableState.destroyed=t)}}),g.prototype.destroy=b.destroy,g.prototype._undestroy=b.undestroy,g.prototype._destroy=function(t,e){this.end(),e(t)}}).call(this,t("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},t("timers").setImmediate)},{"./_stream_duplex":107,"./internal/streams/destroy":113,"./internal/streams/stream":114,_process:104,"core-util-is":11,inherits:75,"process-nextick-args":103,"safe-buffer":115,timers:139,"util-deprecate":141}],112:[function(t,e,r){"use strict";var n=t("safe-buffer").Buffer,i=t("util");e.exports=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.head=null,this.tail=null,this.length=0}return t.prototype.push=function(t){var e={data:t,next:null};this.length>0?this.tail.next=e:this.head=e,this.tail=e,++this.length},t.prototype.unshift=function(t){var e={data:t,next:this.head};0===this.length&&(this.tail=e),this.head=e,++this.length},t.prototype.shift=function(){if(0!==this.length){var t=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,t}},t.prototype.clear=function(){this.head=this.tail=null,this.length=0},t.prototype.join=function(t){if(0===this.length)return"";for(var e=this.head,r=""+e.data;e=e.next;)r+=t+e.data;return r},t.prototype.concat=function(t){if(0===this.length)return n.alloc(0);if(1===this.length)return this.head.data;for(var e,r,i,o=n.allocUnsafe(t>>>0),a=this.head,s=0;a;)e=a.data,r=o,i=s,e.copy(r,i),s+=a.data.length,a=a.next;return o},t}(),i&&i.inspect&&i.inspect.custom&&(e.exports.prototype[i.inspect.custom]=function(){var t=i.inspect({length:this.length});return this.constructor.name+" "+t})},{"safe-buffer":115,util:8}],113:[function(t,e,r){"use strict";var n=t("process-nextick-args");function i(t,e){t.emit("error",e)}e.exports={destroy:function(t,e){var r=this,o=this._readableState&&this._readableState.destroyed,a=this._writableState&&this._writableState.destroyed;return o||a?(e?e(t):!t||this._writableState&&this._writableState.errorEmitted||n.nextTick(i,this,t),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(t||null,(function(t){!e&&t?(n.nextTick(i,r,t),r._writableState&&(r._writableState.errorEmitted=!0)):e&&e(t)})),this)},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}}},{"process-nextick-args":103}],114:[function(t,e,r){arguments[4][98][0].apply(r,arguments)},{dup:98,events:59}],115:[function(t,e,r){var n=t("buffer"),i=n.Buffer;function o(t,e){for(var r in t)e[r]=t[r]}function a(t,e,r){return i(t,e,r)}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?e.exports=n:(o(n,r),r.Buffer=a),o(i,a),a.from=function(t,e,r){if("number"==typeof t)throw new TypeError("Argument must not be a number");return i(t,e,r)},a.alloc=function(t,e,r){if("number"!=typeof t)throw new TypeError("Argument must be a number");var n=i(t);return void 0!==e?"string"==typeof r?n.fill(e,r):n.fill(e):n.fill(0),n},a.allocUnsafe=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return i(t)},a.allocUnsafeSlow=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return n.SlowBuffer(t)}},{buffer:9}],116:[function(t,e,r){"use strict";var n=t("safe-buffer").Buffer,i=n.isEncoding||function(t){switch((t=""+t)&&t.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function o(t){var e;switch(this.encoding=function(t){var e=function(t){if(!t)return"utf8";for(var e;;)switch(t){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return t;default:if(e)return;t=(""+t).toLowerCase(),e=!0}}(t);if("string"!=typeof e&&(n.isEncoding===i||!i(t)))throw new Error("Unknown encoding: "+t);return e||t}(t),this.encoding){case"utf16le":this.text=f,this.end=u,e=4;break;case"utf8":this.fillLast=s,e=4;break;case"base64":this.text=h,this.end=c,e=3;break;default:return this.write=d,void(this.end=l)}this.lastNeed=0,this.lastTotal=0,this.lastChar=n.allocUnsafe(e)}function a(t){return t<=127?0:t>>5==6?2:t>>4==14?3:t>>3==30?4:t>>6==2?-1:-2}function s(t){var e=this.lastTotal-this.lastNeed,r=function(t,e,r){if(128!=(192&e[0]))return t.lastNeed=0,"�";if(t.lastNeed>1&&e.length>1){if(128!=(192&e[1]))return t.lastNeed=1,"�";if(t.lastNeed>2&&e.length>2&&128!=(192&e[2]))return t.lastNeed=2,"�"}}(this,t);return void 0!==r?r:this.lastNeed<=t.length?(t.copy(this.lastChar,e,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(t.copy(this.lastChar,e,0,t.length),void(this.lastNeed-=t.length))}function f(t,e){if((t.length-e)%2==0){var r=t.toString("utf16le",e);if(r){var n=r.charCodeAt(r.length-1);if(n>=55296&&n<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=t[t.length-1],t.toString("utf16le",e,t.length-1)}function u(t){var e=t&&t.length?this.write(t):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return e+this.lastChar.toString("utf16le",0,r)}return e}function h(t,e){var r=(t.length-e)%3;return 0===r?t.toString("base64",e):(this.lastNeed=3-r,this.lastTotal=3,1===r?this.lastChar[0]=t[t.length-1]:(this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1]),t.toString("base64",e,t.length-r))}function c(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function d(t){return t.toString(this.encoding)}function l(t){return t&&t.length?this.write(t):""}r.StringDecoder=o,o.prototype.write=function(t){if(0===t.length)return"";var e,r;if(this.lastNeed){if(void 0===(e=this.fillLast(t)))return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r=0)return i>0&&(t.lastNeed=i-1),i;if(--n=0)return i>0&&(t.lastNeed=i-2),i;if(--n=0)return i>0&&(2===i?i=0:t.lastNeed=i-3),i;return 0}(this,t,e);if(!this.lastNeed)return t.toString("utf8",e);this.lastTotal=r;var n=t.length-(r-this.lastNeed);return t.copy(this.lastChar,0,n),t.toString("utf8",e,n)},o.prototype.fillLast=function(t){if(this.lastNeed<=t.length)return t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,t.length),this.lastNeed-=t.length}},{"safe-buffer":115}],117:[function(t,e,r){e.exports=t("./readable").PassThrough},{"./readable":118}],118:[function(t,e,r){(r=e.exports=t("./lib/_stream_readable.js")).Stream=r,r.Readable=r,r.Writable=t("./lib/_stream_writable.js"),r.Duplex=t("./lib/_stream_duplex.js"),r.Transform=t("./lib/_stream_transform.js"),r.PassThrough=t("./lib/_stream_passthrough.js")},{"./lib/_stream_duplex.js":107,"./lib/_stream_passthrough.js":108,"./lib/_stream_readable.js":109,"./lib/_stream_transform.js":110,"./lib/_stream_writable.js":111}],119:[function(t,e,r){e.exports=t("./readable").Transform},{"./readable":118}],120:[function(t,e,r){e.exports=t("./lib/_stream_writable.js")},{"./lib/_stream_writable.js":111}],121:[function(t,e,r){"use strict";var n=t("buffer").Buffer,i=t("inherits"),o=t("hash-base"),a=new Array(16),s=[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],f=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],u=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],h=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11],c=[0,1518500249,1859775393,2400959708,2840853838],d=[1352829926,1548603684,1836072691,2053994217,0];function l(){o.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520}function p(t,e){return t<>>32-e}function b(t,e,r,n,i,o,a,s){return p(t+(e^r^n)+o+a|0,s)+i|0}function m(t,e,r,n,i,o,a,s){return p(t+(e&r|~e&n)+o+a|0,s)+i|0}function y(t,e,r,n,i,o,a,s){return p(t+((e|~r)^n)+o+a|0,s)+i|0}function g(t,e,r,n,i,o,a,s){return p(t+(e&n|r&~n)+o+a|0,s)+i|0}function v(t,e,r,n,i,o,a,s){return p(t+(e^(r|~n))+o+a|0,s)+i|0}i(l,o),l.prototype._update=function(){for(var t=a,e=0;e<16;++e)t[e]=this._block.readInt32LE(4*e);for(var r=0|this._a,n=0|this._b,i=0|this._c,o=0|this._d,l=0|this._e,w=0|this._a,_=0|this._b,M=0|this._c,S=0|this._d,x=0|this._e,A=0;A<80;A+=1){var E,k;A<16?(E=b(r,n,i,o,l,t[s[A]],c[0],u[A]),k=v(w,_,M,S,x,t[f[A]],d[0],h[A])):A<32?(E=m(r,n,i,o,l,t[s[A]],c[1],u[A]),k=g(w,_,M,S,x,t[f[A]],d[1],h[A])):A<48?(E=y(r,n,i,o,l,t[s[A]],c[2],u[A]),k=y(w,_,M,S,x,t[f[A]],d[2],h[A])):A<64?(E=g(r,n,i,o,l,t[s[A]],c[3],u[A]),k=m(w,_,M,S,x,t[f[A]],d[3],h[A])):(E=v(r,n,i,o,l,t[s[A]],c[4],u[A]),k=b(w,_,M,S,x,t[f[A]],d[4],h[A])),r=l,l=o,o=p(i,10),i=n,n=E,w=x,x=S,S=p(M,10),M=_,_=k}var R=this._b+i+S|0;this._b=this._c+o+x|0,this._c=this._d+l+w|0,this._d=this._e+r+_|0,this._e=this._a+n+M|0,this._a=R},l.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var t=n.alloc?n.alloc(20):new n(20);return t.writeInt32LE(this._a,0),t.writeInt32LE(this._b,4),t.writeInt32LE(this._c,8),t.writeInt32LE(this._d,12),t.writeInt32LE(this._e,16),t},e.exports=l},{buffer:9,"hash-base":60,inherits:75}],122:[function(t,e,r){(function(e){"use strict";var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(r,"__esModule",{value:!0}),r.getLength=r.decode=r.encode=void 0;var i=n(t("bn.js"));function o(t,e){if("0"===t[0]&&"0"===t[1])throw new Error("invalid RLP: extra zeros");return parseInt(t,e)}function a(t,r){if(t<56)return e.from([t+r]);var n=u(t),i=u(r+55+n.length/2);return e.from(i+n,"hex")}function s(t){var r,n,i,a,f,u=[],h=t[0];if(h<=127)return{data:t.slice(0,1),remainder:t.slice(1)};if(h<=183){if(r=h-127,i=128===h?e.from([]):t.slice(1,r),2===r&&i[0]<128)throw new Error("invalid rlp encoding: byte must be less 0x80");return{data:i,remainder:t.slice(r)}}if(h<=191){if(n=h-182,t.length-1t.length)throw new Error("invalid rlp: total length is larger than the data");if(0===(a=t.slice(n,c)).length)throw new Error("invalid rlp, List has a invalid length");for(;a.length;)f=s(a),u.push(f.data),a=f.remainder;return{data:u,remainder:t.slice(c)}}function f(t){return"0x"===t.slice(0,2)}function u(t){if(t<0)throw new Error("Invalid integer as argument, must be unsigned!");var e=t.toString(16);return e.length%2?"0"+e:e}function h(t){if(!e.isBuffer(t)){if("string"==typeof t)return f(t)?e.from((n="string"!=typeof(o=t)?o:f(o)?o.slice(2):o).length%2?"0"+n:n,"hex"):e.from(t);if("number"==typeof t||"bigint"==typeof t)return t?(r=u(t),e.from(r,"hex")):e.from([]);if(null==t)return e.from([]);if(t instanceof Uint8Array)return e.from(t);if(i.default.isBN(t))return e.from(t.toArray());throw new Error("invalid type")}var r,n,o;return t}r.encode=function t(r){if(Array.isArray(r)){for(var n=[],i=0;i */ -var n=t("buffer"),i=n.Buffer;function o(t,e){for(var r in t)e[r]=t[r]}function a(t,e,r){return i(t,e,r)}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?e.exports=n:(o(n,r),r.Buffer=a),a.prototype=Object.create(i.prototype),o(i,a),a.from=function(t,e,r){if("number"==typeof t)throw new TypeError("Argument must not be a number");return i(t,e,r)},a.alloc=function(t,e,r){if("number"!=typeof t)throw new TypeError("Argument must be a number");var n=i(t);return void 0!==e?"string"==typeof r?n.fill(e,r):n.fill(e):n.fill(0),n},a.allocUnsafe=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return i(t)},a.allocUnsafeSlow=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return n.SlowBuffer(t)}},{buffer:9}],125:[function(t,e,r){e.exports=t("./lib")(t("./lib/elliptic"))},{"./lib":127,"./lib/elliptic":126}],126:[function(t,e,r){const n=new(0,t("elliptic").ec)("secp256k1"),i=n.curve,o=i.n.constructor;function a(t){const e=t[0];switch(e){case 2:case 3:return 33!==t.length?null:function(t,e){let r=new o(e);if(r.cmp(i.p)>=0)return null;r=r.toRed(i.red);let a=r.redSqr().redIMul(r).redIAdd(i.b).redSqrt();return 3===t!==a.isOdd()&&(a=a.redNeg()),n.keyPair({pub:{x:r,y:a}})}(e,t.subarray(1,33));case 4:case 6:case 7:return 65!==t.length?null:function(t,e,r){let a=new o(e),s=new o(r);if(a.cmp(i.p)>=0||s.cmp(i.p)>=0)return null;if(a=a.toRed(i.red),s=s.toRed(i.red),(6===t||7===t)&&s.isOdd()!==(7===t))return null;const f=a.redSqr().redIMul(a);return s.redSqr().redISub(f.redIAdd(i.b)).isZero()?n.keyPair({pub:{x:a,y:s}}):null}(e,t.subarray(1,33),t.subarray(33,65));default:return null}}function s(t,e){const r=e.encode(null,33===t.length);for(let e=0;e0,privateKeyVerify(t){const e=new o(t);return e.cmp(i.n)<0&&!e.isZero()?0:1},privateKeyNegate(t){const e=new o(t),r=i.n.sub(e).umod(i.n).toArrayLike(Uint8Array,"be",32);return t.set(r),0},privateKeyTweakAdd(t,e){const r=new o(e);if(r.cmp(i.n)>=0)return 1;if(r.iadd(new o(t)),r.cmp(i.n)>=0&&r.isub(i.n),r.isZero())return 1;const n=r.toArrayLike(Uint8Array,"be",32);return t.set(n),0},privateKeyTweakMul(t,e){let r=new o(e);if(r.cmp(i.n)>=0||r.isZero())return 1;r.imul(new o(t)),r.cmp(i.n)>=0&&(r=r.umod(i.n));const n=r.toArrayLike(Uint8Array,"be",32);return t.set(n),0},publicKeyVerify:t=>null===a(t)?1:0,publicKeyCreate(t,e){const r=new o(e);if(r.cmp(i.n)>=0||r.isZero())return 1;return s(t,n.keyFromPrivate(e).getPublic()),0},publicKeyConvert(t,e){const r=a(e);if(null===r)return 1;return s(t,r.getPublic()),0},publicKeyNegate(t,e){const r=a(e);if(null===r)return 1;const n=r.getPublic();return n.y=n.y.redNeg(),s(t,n),0},publicKeyCombine(t,e){const r=new Array(e.length);for(let t=0;t=0)return 2;const f=n.getPublic().add(i.g.mul(r));return f.isInfinity()?2:(s(t,f),0)},publicKeyTweakMul(t,e,r){const n=a(e);if(null===n)return 1;if((r=new o(r)).cmp(i.n)>=0||r.isZero())return 2;return s(t,n.getPublic().mul(r)),0},signatureNormalize(t){const e=new o(t.subarray(0,32)),r=new o(t.subarray(32,64));return e.cmp(i.n)>=0||r.cmp(i.n)>=0?1:(1===r.cmp(n.nh)&&t.set(i.n.sub(r).toArrayLike(Uint8Array,"be",32),32),0)},signatureExport(t,e){const r=e.subarray(0,32),n=e.subarray(32,64);if(new o(r).cmp(i.n)>=0)return 1;if(new o(n).cmp(i.n)>=0)return 1;const{output:a}=t;let s=a.subarray(4,37);s[0]=0,s.set(r,1);let f=33,u=0;for(;f>1&&0===s[u]&&!(128&s[u+1]);--f,++u);if(s=s.subarray(u),128&s[0])return 1;if(f>1&&0===s[0]&&!(128&s[1]))return 1;let h=a.subarray(39,72);h[0]=0,h.set(n,1);let c=33,d=0;for(;c>1&&0===h[d]&&!(128&h[d+1]);--c,++d);return h=h.subarray(d),128&h[0]||c>1&&0===h[0]&&!(128&h[1])?1:(t.outputlen=6+f+c,a[0]=48,a[1]=t.outputlen-2,a[2]=2,a[3]=s.length,a.set(s,4),a[4+f]=2,a[5+f]=h.length,a.set(h,6+f),0)},signatureImport(t,e){if(e.length<8)return 1;if(e.length>72)return 1;if(48!==e[0])return 1;if(e[1]!==e.length-2)return 1;if(2!==e[2])return 1;const r=e[3];if(0===r)return 1;if(5+r>=e.length)return 1;if(2!==e[4+r])return 1;const n=e[5+r];if(0===n)return 1;if(6+r+n!==e.length)return 1;if(128&e[4])return 1;if(r>1&&0===e[4]&&!(128&e[5]))return 1;if(128&e[r+6])return 1;if(n>1&&0===e[r+6]&&!(128&e[r+7]))return 1;let a=e.subarray(4,4+r);if(33===a.length&&0===a[0]&&(a=a.subarray(1)),a.length>32)return 1;let s=e.subarray(6+r);if(33===s.length&&0===s[0]&&(s=s.slice(1)),s.length>32)throw new Error("S length is too long");let f=new o(a);f.cmp(i.n)>=0&&(f=new o(0));let u=new o(e.subarray(6+r));return u.cmp(i.n)>=0&&(u=new o(0)),t.set(f.toArrayLike(Uint8Array,"be",32),0),t.set(u.toArrayLike(Uint8Array,"be",32),32),0},ecdsaSign(t,e,r,a,s){if(s){const t=s;s=n=>{const i=t(e,r,null,a,n);if(!(i instanceof Uint8Array&&32===i.length))throw new Error("This is the way");return new o(i)}}const f=new o(r);if(f.cmp(i.n)>=0||f.isZero())return 1;let u;try{u=n.sign(e,r,{canonical:!0,k:s,pers:a})}catch(t){return 1}return t.signature.set(u.r.toArrayLike(Uint8Array,"be",32),0),t.signature.set(u.s.toArrayLike(Uint8Array,"be",32),32),t.recid=u.recoveryParam,0},ecdsaVerify(t,e,r){const s={r:t.subarray(0,32),s:t.subarray(32,64)},f=new o(s.r),u=new o(s.s);if(f.cmp(i.n)>=0||u.cmp(i.n)>=0)return 1;if(1===u.cmp(n.nh)||f.isZero()||u.isZero())return 3;const h=a(r);if(null===h)return 2;const c=h.getPublic();return n.verify(e,s,c)?0:3},ecdsaRecover(t,e,r,a){const f={r:e.slice(0,32),s:e.slice(32,64)},u=new o(f.r),h=new o(f.s);if(u.cmp(i.n)>=0||h.cmp(i.n)>=0)return 1;if(u.isZero()||h.isZero())return 2;let c;try{c=n.recoverPubKey(a,f,r)}catch(t){return 2}return s(t,c),0},ecdh(t,e,r,s,f,u,h){const c=a(e);if(null===c)return 1;const d=new o(r);if(d.cmp(i.n)>=0||d.isZero())return 2;const l=c.getPublic().mul(d);if(void 0===f){const e=l.encode(null,!0),r=n.hash().update(e).digest();for(let e=0;e<32;++e)t[e]=r[e]}else{u||(u=new Uint8Array(32));const e=l.getX().toArray("be",32);for(let t=0;t<32;++t)u[t]=e[t];h||(h=new Uint8Array(32));const r=l.getY().toArray("be",32);for(let t=0;t<32;++t)h[t]=r[t];const n=f(u,h,s);if(!(n instanceof Uint8Array&&n.length===t.length))return 2;t.set(n)}return 0}}},{elliptic:13}],127:[function(t,e,r){const n="Impossible case. Please create issue.",i="The tweak was out of range or the resulted private key is invalid",o="The tweak was out of range or equal to zero",a="Unknown error on context randomization",s="Private Key is invalid",f="Public Key could not be parsed",u="Public Key serialization error",h="The sum of the public keys is not valid",c="Signature could not be parsed",d="The nonce generation function failed, or the private key was invalid",l="Public key could not be recover",p="Scalar was invalid (zero or overflow)";function b(t,e){if(!t)throw new Error(e)}function m(t,e,r){if(b(e instanceof Uint8Array,`Expected ${t} to be an Uint8Array`),void 0!==r)if(Array.isArray(r)){const n=`Expected ${t} to be an Uint8Array with length [${r.join(", ")}]`;b(r.includes(e.length),n)}else{const n=`Expected ${t} to be an Uint8Array with length ${r}`;b(e.length===r,n)}}function y(t){b("Boolean"===v(t),"Expected compressed to be a Boolean")}function g(t=(t=>new Uint8Array(t)),e){return"function"==typeof t&&(t=t(e)),m("output",t,e),t}function v(t){return Object.prototype.toString.call(t).slice(8,-1)}e.exports=t=>({contextRandomize(e){switch(b(null===e||e instanceof Uint8Array,"Expected seed to be an Uint8Array or null"),null!==e&&m("seed",e,32),t.contextRandomize(e)){case 1:throw new Error(a)}},privateKeyVerify:e=>(m("private key",e,32),0===t.privateKeyVerify(e)),privateKeyNegate(e){switch(m("private key",e,32),t.privateKeyNegate(e)){case 0:return e;case 1:throw new Error(n)}},privateKeyTweakAdd(e,r){switch(m("private key",e,32),m("tweak",r,32),t.privateKeyTweakAdd(e,r)){case 0:return e;case 1:throw new Error(i)}},privateKeyTweakMul(e,r){switch(m("private key",e,32),m("tweak",r,32),t.privateKeyTweakMul(e,r)){case 0:return e;case 1:throw new Error(o)}},publicKeyVerify:e=>(m("public key",e,[33,65]),0===t.publicKeyVerify(e)),publicKeyCreate(e,r=!0,n){switch(m("private key",e,32),y(r),n=g(n,r?33:65),t.publicKeyCreate(n,e)){case 0:return n;case 1:throw new Error(s);case 2:throw new Error(u)}},publicKeyConvert(e,r=!0,n){switch(m("public key",e,[33,65]),y(r),n=g(n,r?33:65),t.publicKeyConvert(n,e)){case 0:return n;case 1:throw new Error(f);case 2:throw new Error(u)}},publicKeyNegate(e,r=!0,i){switch(m("public key",e,[33,65]),y(r),i=g(i,r?33:65),t.publicKeyNegate(i,e)){case 0:return i;case 1:throw new Error(f);case 2:throw new Error(n);case 3:throw new Error(u)}},publicKeyCombine(e,r=!0,n){b(Array.isArray(e),"Expected public keys to be an Array"),b(e.length>0,"Expected public keys array will have more than zero items");for(const t of e)m("public key",t,[33,65]);switch(y(r),n=g(n,r?33:65),t.publicKeyCombine(n,e)){case 0:return n;case 1:throw new Error(f);case 2:throw new Error(h);case 3:throw new Error(u)}},publicKeyTweakAdd(e,r,n=!0,o){switch(m("public key",e,[33,65]),m("tweak",r,32),y(n),o=g(o,n?33:65),t.publicKeyTweakAdd(o,e,r)){case 0:return o;case 1:throw new Error(f);case 2:throw new Error(i)}},publicKeyTweakMul(e,r,n=!0,i){switch(m("public key",e,[33,65]),m("tweak",r,32),y(n),i=g(i,n?33:65),t.publicKeyTweakMul(i,e,r)){case 0:return i;case 1:throw new Error(f);case 2:throw new Error(o)}},signatureNormalize(e){switch(m("signature",e,64),t.signatureNormalize(e)){case 0:return e;case 1:throw new Error(c)}},signatureExport(e,r){m("signature",e,64);const i={output:r=g(r,72),outputlen:72};switch(t.signatureExport(i,e)){case 0:return r.slice(0,i.outputlen);case 1:throw new Error(c);case 2:throw new Error(n)}},signatureImport(e,r){switch(m("signature",e),r=g(r,64),t.signatureImport(r,e)){case 0:return r;case 1:throw new Error(c);case 2:throw new Error(n)}},ecdsaSign(e,r,i={},o){m("message",e,32),m("private key",r,32),b("Object"===v(i),"Expected options to be an Object"),void 0!==i.data&&m("options.data",i.data),void 0!==i.noncefn&&b("Function"===v(i.noncefn),"Expected options.noncefn to be a Function");const a={signature:o=g(o,64),recid:null};switch(t.ecdsaSign(a,e,r,i.data,i.noncefn)){case 0:return a;case 1:throw new Error(d);case 2:throw new Error(n)}},ecdsaVerify(e,r,n){switch(m("signature",e,64),m("message",r,32),m("public key",n,[33,65]),t.ecdsaVerify(e,r,n)){case 0:return!0;case 3:return!1;case 1:throw new Error(c);case 2:throw new Error(f)}},ecdsaRecover(e,r,i,o=!0,a){switch(m("signature",e,64),b("Number"===v(r)&&r>=0&&r<=3,"Expected recovery id to be a Number within interval [0, 3]"),m("message",i,32),y(o),a=g(a,o?33:65),t.ecdsaRecover(a,e,r,i)){case 0:return a;case 1:throw new Error(c);case 2:throw new Error(l);case 3:throw new Error(n)}},ecdh(e,r,n={},i){switch(m("public key",e,[33,65]),m("private key",r,32),b("Object"===v(n),"Expected options to be an Object"),void 0!==n.data&&m("options.data",n.data),void 0!==n.hashfn?(b("Function"===v(n.hashfn),"Expected options.hashfn to be a Function"),void 0!==n.xbuf&&m("options.xbuf",n.xbuf,32),void 0!==n.ybuf&&m("options.ybuf",n.ybuf,32),m("output",i)):i=g(i,32),t.ecdh(i,e,r,n.data,n.hashfn,n.xbuf,n.ybuf)){case 0:return i;case 1:throw new Error(f);case 2:throw new Error(p)}}})},{}],128:[function(t,e,r){var n=t("safe-buffer").Buffer;function i(t,e){this._block=n.alloc(t),this._finalSize=e,this._blockSize=t,this._len=0}i.prototype.update=function(t,e){"string"==typeof t&&(e=e||"utf8",t=n.from(t,e));for(var r=this._block,i=this._blockSize,o=t.length,a=this._len,s=0;s=this._finalSize&&(this._update(this._block),this._block.fill(0));var r=8*this._len;if(r<=4294967295)this._block.writeUInt32BE(r,this._blockSize-4);else{var n=(4294967295&r)>>>0,i=(r-n)/4294967296;this._block.writeUInt32BE(i,this._blockSize-8),this._block.writeUInt32BE(n,this._blockSize-4)}this._update(this._block);var o=this._hash();return t?o.toString(t):o},i.prototype._update=function(){throw new Error("_update must be implemented by subclass")},e.exports=i},{"safe-buffer":124}],129:[function(t,e,r){(r=e.exports=function(t){t=t.toLowerCase();var e=r[t];if(!e)throw new Error(t+" is not supported (we accept pull requests)");return new e}).sha=t("./sha"),r.sha1=t("./sha1"),r.sha224=t("./sha224"),r.sha256=t("./sha256"),r.sha384=t("./sha384"),r.sha512=t("./sha512")},{"./sha":130,"./sha1":131,"./sha224":132,"./sha256":133,"./sha384":134,"./sha512":135}],130:[function(t,e,r){var n=t("inherits"),i=t("./hash"),o=t("safe-buffer").Buffer,a=[1518500249,1859775393,-1894007588,-899497514],s=new Array(80);function f(){this.init(),this._w=s,i.call(this,64,56)}function u(t){return t<<30|t>>>2}function h(t,e,r,n){return 0===t?e&r|~e&n:2===t?e&r|e&n|r&n:e^r^n}n(f,i),f.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},f.prototype._update=function(t){for(var e,r=this._w,n=0|this._a,i=0|this._b,o=0|this._c,s=0|this._d,f=0|this._e,c=0;c<16;++c)r[c]=t.readInt32BE(4*c);for(;c<80;++c)r[c]=r[c-3]^r[c-8]^r[c-14]^r[c-16];for(var d=0;d<80;++d){var l=~~(d/20),p=0|((e=n)<<5|e>>>27)+h(l,i,o,s)+f+r[d]+a[l];f=s,s=o,o=u(i),i=n,n=p}this._a=n+this._a|0,this._b=i+this._b|0,this._c=o+this._c|0,this._d=s+this._d|0,this._e=f+this._e|0},f.prototype._hash=function(){var t=o.allocUnsafe(20);return t.writeInt32BE(0|this._a,0),t.writeInt32BE(0|this._b,4),t.writeInt32BE(0|this._c,8),t.writeInt32BE(0|this._d,12),t.writeInt32BE(0|this._e,16),t},e.exports=f},{"./hash":128,inherits:75,"safe-buffer":124}],131:[function(t,e,r){var n=t("inherits"),i=t("./hash"),o=t("safe-buffer").Buffer,a=[1518500249,1859775393,-1894007588,-899497514],s=new Array(80);function f(){this.init(),this._w=s,i.call(this,64,56)}function u(t){return t<<5|t>>>27}function h(t){return t<<30|t>>>2}function c(t,e,r,n){return 0===t?e&r|~e&n:2===t?e&r|e&n|r&n:e^r^n}n(f,i),f.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},f.prototype._update=function(t){for(var e,r=this._w,n=0|this._a,i=0|this._b,o=0|this._c,s=0|this._d,f=0|this._e,d=0;d<16;++d)r[d]=t.readInt32BE(4*d);for(;d<80;++d)r[d]=(e=r[d-3]^r[d-8]^r[d-14]^r[d-16])<<1|e>>>31;for(var l=0;l<80;++l){var p=~~(l/20),b=u(n)+c(p,i,o,s)+f+r[l]+a[p]|0;f=s,s=o,o=h(i),i=n,n=b}this._a=n+this._a|0,this._b=i+this._b|0,this._c=o+this._c|0,this._d=s+this._d|0,this._e=f+this._e|0},f.prototype._hash=function(){var t=o.allocUnsafe(20);return t.writeInt32BE(0|this._a,0),t.writeInt32BE(0|this._b,4),t.writeInt32BE(0|this._c,8),t.writeInt32BE(0|this._d,12),t.writeInt32BE(0|this._e,16),t},e.exports=f},{"./hash":128,inherits:75,"safe-buffer":124}],132:[function(t,e,r){var n=t("inherits"),i=t("./sha256"),o=t("./hash"),a=t("safe-buffer").Buffer,s=new Array(64);function f(){this.init(),this._w=s,o.call(this,64,56)}n(f,i),f.prototype.init=function(){return this._a=3238371032,this._b=914150663,this._c=812702999,this._d=4144912697,this._e=4290775857,this._f=1750603025,this._g=1694076839,this._h=3204075428,this},f.prototype._hash=function(){var t=a.allocUnsafe(28);return t.writeInt32BE(this._a,0),t.writeInt32BE(this._b,4),t.writeInt32BE(this._c,8),t.writeInt32BE(this._d,12),t.writeInt32BE(this._e,16),t.writeInt32BE(this._f,20),t.writeInt32BE(this._g,24),t},e.exports=f},{"./hash":128,"./sha256":133,inherits:75,"safe-buffer":124}],133:[function(t,e,r){var n=t("inherits"),i=t("./hash"),o=t("safe-buffer").Buffer,a=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],s=new Array(64);function f(){this.init(),this._w=s,i.call(this,64,56)}function u(t,e,r){return r^t&(e^r)}function h(t,e,r){return t&e|r&(t|e)}function c(t){return(t>>>2|t<<30)^(t>>>13|t<<19)^(t>>>22|t<<10)}function d(t){return(t>>>6|t<<26)^(t>>>11|t<<21)^(t>>>25|t<<7)}function l(t){return(t>>>7|t<<25)^(t>>>18|t<<14)^t>>>3}n(f,i),f.prototype.init=function(){return this._a=1779033703,this._b=3144134277,this._c=1013904242,this._d=2773480762,this._e=1359893119,this._f=2600822924,this._g=528734635,this._h=1541459225,this},f.prototype._update=function(t){for(var e,r=this._w,n=0|this._a,i=0|this._b,o=0|this._c,s=0|this._d,f=0|this._e,p=0|this._f,b=0|this._g,m=0|this._h,y=0;y<16;++y)r[y]=t.readInt32BE(4*y);for(;y<64;++y)r[y]=0|(((e=r[y-2])>>>17|e<<15)^(e>>>19|e<<13)^e>>>10)+r[y-7]+l(r[y-15])+r[y-16];for(var g=0;g<64;++g){var v=m+d(f)+u(f,p,b)+a[g]+r[g]|0,w=c(n)+h(n,i,o)|0;m=b,b=p,p=f,f=s+v|0,s=o,o=i,i=n,n=v+w|0}this._a=n+this._a|0,this._b=i+this._b|0,this._c=o+this._c|0,this._d=s+this._d|0,this._e=f+this._e|0,this._f=p+this._f|0,this._g=b+this._g|0,this._h=m+this._h|0},f.prototype._hash=function(){var t=o.allocUnsafe(32);return t.writeInt32BE(this._a,0),t.writeInt32BE(this._b,4),t.writeInt32BE(this._c,8),t.writeInt32BE(this._d,12),t.writeInt32BE(this._e,16),t.writeInt32BE(this._f,20),t.writeInt32BE(this._g,24),t.writeInt32BE(this._h,28),t},e.exports=f},{"./hash":128,inherits:75,"safe-buffer":124}],134:[function(t,e,r){var n=t("inherits"),i=t("./sha512"),o=t("./hash"),a=t("safe-buffer").Buffer,s=new Array(160);function f(){this.init(),this._w=s,o.call(this,128,112)}n(f,i),f.prototype.init=function(){return this._ah=3418070365,this._bh=1654270250,this._ch=2438529370,this._dh=355462360,this._eh=1731405415,this._fh=2394180231,this._gh=3675008525,this._hh=1203062813,this._al=3238371032,this._bl=914150663,this._cl=812702999,this._dl=4144912697,this._el=4290775857,this._fl=1750603025,this._gl=1694076839,this._hl=3204075428,this},f.prototype._hash=function(){var t=a.allocUnsafe(48);function e(e,r,n){t.writeInt32BE(e,n),t.writeInt32BE(r,n+4)}return e(this._ah,this._al,0),e(this._bh,this._bl,8),e(this._ch,this._cl,16),e(this._dh,this._dl,24),e(this._eh,this._el,32),e(this._fh,this._fl,40),t},e.exports=f},{"./hash":128,"./sha512":135,inherits:75,"safe-buffer":124}],135:[function(t,e,r){var n=t("inherits"),i=t("./hash"),o=t("safe-buffer").Buffer,a=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591],s=new Array(160);function f(){this.init(),this._w=s,i.call(this,128,112)}function u(t,e,r){return r^t&(e^r)}function h(t,e,r){return t&e|r&(t|e)}function c(t,e){return(t>>>28|e<<4)^(e>>>2|t<<30)^(e>>>7|t<<25)}function d(t,e){return(t>>>14|e<<18)^(t>>>18|e<<14)^(e>>>9|t<<23)}function l(t,e){return(t>>>1|e<<31)^(t>>>8|e<<24)^t>>>7}function p(t,e){return(t>>>1|e<<31)^(t>>>8|e<<24)^(t>>>7|e<<25)}function b(t,e){return(t>>>19|e<<13)^(e>>>29|t<<3)^t>>>6}function m(t,e){return(t>>>19|e<<13)^(e>>>29|t<<3)^(t>>>6|e<<26)}function y(t,e){return t>>>0>>0?1:0}n(f,i),f.prototype.init=function(){return this._ah=1779033703,this._bh=3144134277,this._ch=1013904242,this._dh=2773480762,this._eh=1359893119,this._fh=2600822924,this._gh=528734635,this._hh=1541459225,this._al=4089235720,this._bl=2227873595,this._cl=4271175723,this._dl=1595750129,this._el=2917565137,this._fl=725511199,this._gl=4215389547,this._hl=327033209,this},f.prototype._update=function(t){for(var e=this._w,r=0|this._ah,n=0|this._bh,i=0|this._ch,o=0|this._dh,s=0|this._eh,f=0|this._fh,g=0|this._gh,v=0|this._hh,w=0|this._al,_=0|this._bl,M=0|this._cl,S=0|this._dl,x=0|this._el,A=0|this._fl,E=0|this._gl,k=0|this._hl,R=0;R<32;R+=2)e[R]=t.readInt32BE(4*R),e[R+1]=t.readInt32BE(4*R+4);for(;R<160;R+=2){var T=e[R-30],B=e[R-30+1],I=l(T,B),L=p(B,T),P=b(T=e[R-4],B=e[R-4+1]),j=m(B,T),O=e[R-14],C=e[R-14+1],N=e[R-32],z=e[R-32+1],U=L+C|0,q=I+O+y(U,L)|0;q=(q=q+P+y(U=U+j|0,j)|0)+N+y(U=U+z|0,z)|0,e[R]=q,e[R+1]=U}for(var K=0;K<160;K+=2){q=e[K],U=e[K+1];var D=h(r,n,i),H=h(w,_,M),F=c(r,w),W=c(w,r),Z=d(s,x),V=d(x,s),Y=a[K],J=a[K+1],X=u(s,f,g),G=u(x,A,E),$=k+V|0,Q=v+Z+y($,k)|0;Q=(Q=(Q=Q+X+y($=$+G|0,G)|0)+Y+y($=$+J|0,J)|0)+q+y($=$+U|0,U)|0;var tt=W+H|0,et=F+D+y(tt,W)|0;v=g,k=E,g=f,E=A,f=s,A=x,s=o+Q+y(x=S+$|0,S)|0,o=i,S=M,i=n,M=_,n=r,_=w,r=Q+et+y(w=$+tt|0,$)|0}this._al=this._al+w|0,this._bl=this._bl+_|0,this._cl=this._cl+M|0,this._dl=this._dl+S|0,this._el=this._el+x|0,this._fl=this._fl+A|0,this._gl=this._gl+E|0,this._hl=this._hl+k|0,this._ah=this._ah+r+y(this._al,w)|0,this._bh=this._bh+n+y(this._bl,_)|0,this._ch=this._ch+i+y(this._cl,M)|0,this._dh=this._dh+o+y(this._dl,S)|0,this._eh=this._eh+s+y(this._el,x)|0,this._fh=this._fh+f+y(this._fl,A)|0,this._gh=this._gh+g+y(this._gl,E)|0,this._hh=this._hh+v+y(this._hl,k)|0},f.prototype._hash=function(){var t=o.allocUnsafe(64);function e(e,r,n){t.writeInt32BE(e,n),t.writeInt32BE(r,n+4)}return e(this._ah,this._al,0),e(this._bh,this._bl,8),e(this._ch,this._cl,16),e(this._dh,this._dl,24),e(this._eh,this._el,32),e(this._fh,this._fl,40),e(this._gh,this._gl,48),e(this._hh,this._hl,56),t},e.exports=f},{"./hash":128,inherits:75,"safe-buffer":124}],136:[function(t,e,r){e.exports=i;var n=t("events").EventEmitter;function i(){n.call(this)}t("inherits")(i,n),i.Readable=t("readable-stream/readable.js"),i.Writable=t("readable-stream/writable.js"),i.Duplex=t("readable-stream/duplex.js"),i.Transform=t("readable-stream/transform.js"),i.PassThrough=t("readable-stream/passthrough.js"),i.Stream=i,i.prototype.pipe=function(t,e){var r=this;function i(e){t.writable&&!1===t.write(e)&&r.pause&&r.pause()}function o(){r.readable&&r.resume&&r.resume()}r.on("data",i),t.on("drain",o),t._isStdio||e&&!1===e.end||(r.on("end",s),r.on("close",f));var a=!1;function s(){a||(a=!0,t.end())}function f(){a||(a=!0,"function"==typeof t.destroy&&t.destroy())}function u(t){if(h(),0===n.listenerCount(this,"error"))throw t}function h(){r.removeListener("data",i),t.removeListener("drain",o),r.removeListener("end",s),r.removeListener("close",f),r.removeListener("error",u),t.removeListener("error",u),r.removeListener("end",h),r.removeListener("close",h),t.removeListener("close",h)}return r.on("error",u),t.on("error",u),r.on("end",h),r.on("close",h),t.on("close",h),t.emit("pipe",r),t}},{events:59,inherits:75,"readable-stream/duplex.js":106,"readable-stream/passthrough.js":117,"readable-stream/readable.js":118,"readable-stream/transform.js":119,"readable-stream/writable.js":120}],137:[function(t,e,r){arguments[4][116][0].apply(r,arguments)},{dup:116,"safe-buffer":124}],138:[function(t,e,r){var n=t("is-hex-prefixed");e.exports=function(t){return"string"!=typeof t?t:n(t)?t.slice(2):t}},{"is-hex-prefixed":77}],139:[function(t,e,r){(function(e,n){var i=t("process/browser.js").nextTick,o=Function.prototype.apply,a=Array.prototype.slice,s={},f=0;function u(t,e){this._id=t,this._clearFn=e}r.setTimeout=function(){return new u(o.call(setTimeout,window,arguments),clearTimeout)},r.setInterval=function(){return new u(o.call(setInterval,window,arguments),clearInterval)},r.clearTimeout=r.clearInterval=function(t){t.close()},u.prototype.unref=u.prototype.ref=function(){},u.prototype.close=function(){this._clearFn.call(window,this._id)},r.enroll=function(t,e){clearTimeout(t._idleTimeoutId),t._idleTimeout=e},r.unenroll=function(t){clearTimeout(t._idleTimeoutId),t._idleTimeout=-1},r._unrefActive=r.active=function(t){clearTimeout(t._idleTimeoutId);var e=t._idleTimeout;e>=0&&(t._idleTimeoutId=setTimeout((function(){t._onTimeout&&t._onTimeout()}),e))},r.setImmediate="function"==typeof e?e:function(t){var e=f++,n=!(arguments.length<2)&&a.call(arguments,1);return s[e]=!0,i((function(){s[e]&&(n?t.apply(null,n):t.call(null),r.clearImmediate(e))})),e},r.clearImmediate="function"==typeof n?n:function(t){delete s[t]}}).call(this,t("timers").setImmediate,t("timers").clearImmediate)},{"process/browser.js":104,timers:139}],140:[function(t,e,r){(function(t){!function(t,r){"use strict";void 0!==e&&e.exports?e.exports=r():(t.nacl||(t.nacl={}),t.nacl.util=r())}(this,(function(){"use strict";var e={};function r(t){if(!/^(?:[A-Za-z0-9+\/]{2}[A-Za-z0-9+\/]{2})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/.test(t))throw new TypeError("invalid encoding")}return e.decodeUTF8=function(t){if("string"!=typeof t)throw new TypeError("expected string");var e,r=unescape(encodeURIComponent(t)),n=new Uint8Array(r.length);for(e=0;e=0)return null;r=r.toRed(i.red);let a=r.redSqr().redIMul(r).redIAdd(i.b).redSqrt();return 3===t!==a.isOdd()&&(a=a.redNeg()),n.keyPair({pub:{x:r,y:a}})}(e,t.subarray(1,33));case 4:case 6:case 7:return 65!==t.length?null:function(t,e,r){let a=new o(e),s=new o(r);if(a.cmp(i.p)>=0||s.cmp(i.p)>=0)return null;if(a=a.toRed(i.red),s=s.toRed(i.red),(6===t||7===t)&&s.isOdd()!==(7===t))return null;const f=a.redSqr().redIMul(a);return s.redSqr().redISub(f.redIAdd(i.b)).isZero()?n.keyPair({pub:{x:a,y:s}}):null}(e,t.subarray(1,33),t.subarray(33,65));default:return null}}function s(t,e){const r=e.encode(null,33===t.length);for(let e=0;e0,privateKeyVerify(t){const e=new o(t);return e.cmp(i.n)<0&&!e.isZero()?0:1},privateKeyNegate(t){const e=new o(t),r=i.n.sub(e).umod(i.n).toArrayLike(Uint8Array,"be",32);return t.set(r),0},privateKeyTweakAdd(t,e){const r=new o(e);if(r.cmp(i.n)>=0)return 1;if(r.iadd(new o(t)),r.cmp(i.n)>=0&&r.isub(i.n),r.isZero())return 1;const n=r.toArrayLike(Uint8Array,"be",32);return t.set(n),0},privateKeyTweakMul(t,e){let r=new o(e);if(r.cmp(i.n)>=0||r.isZero())return 1;r.imul(new o(t)),r.cmp(i.n)>=0&&(r=r.umod(i.n));const n=r.toArrayLike(Uint8Array,"be",32);return t.set(n),0},publicKeyVerify:t=>null===a(t)?1:0,publicKeyCreate(t,e){const r=new o(e);if(r.cmp(i.n)>=0||r.isZero())return 1;return s(t,n.keyFromPrivate(e).getPublic()),0},publicKeyConvert(t,e){const r=a(e);if(null===r)return 1;return s(t,r.getPublic()),0},publicKeyNegate(t,e){const r=a(e);if(null===r)return 1;const n=r.getPublic();return n.y=n.y.redNeg(),s(t,n),0},publicKeyCombine(t,e){const r=new Array(e.length);for(let t=0;t=0)return 2;const f=n.getPublic().add(i.g.mul(r));return f.isInfinity()?2:(s(t,f),0)},publicKeyTweakMul(t,e,r){const n=a(e);if(null===n)return 1;if((r=new o(r)).cmp(i.n)>=0||r.isZero())return 2;return s(t,n.getPublic().mul(r)),0},signatureNormalize(t){const e=new o(t.subarray(0,32)),r=new o(t.subarray(32,64));return e.cmp(i.n)>=0||r.cmp(i.n)>=0?1:(1===r.cmp(n.nh)&&t.set(i.n.sub(r).toArrayLike(Uint8Array,"be",32),32),0)},signatureExport(t,e){const r=e.subarray(0,32),n=e.subarray(32,64);if(new o(r).cmp(i.n)>=0)return 1;if(new o(n).cmp(i.n)>=0)return 1;const{output:a}=t;let s=a.subarray(4,37);s[0]=0,s.set(r,1);let f=33,u=0;for(;f>1&&0===s[u]&&!(128&s[u+1]);--f,++u);if(s=s.subarray(u),128&s[0])return 1;if(f>1&&0===s[0]&&!(128&s[1]))return 1;let h=a.subarray(39,72);h[0]=0,h.set(n,1);let c=33,d=0;for(;c>1&&0===h[d]&&!(128&h[d+1]);--c,++d);return h=h.subarray(d),128&h[0]||c>1&&0===h[0]&&!(128&h[1])?1:(t.outputlen=6+f+c,a[0]=48,a[1]=t.outputlen-2,a[2]=2,a[3]=s.length,a.set(s,4),a[4+f]=2,a[5+f]=h.length,a.set(h,6+f),0)},signatureImport(t,e){if(e.length<8)return 1;if(e.length>72)return 1;if(48!==e[0])return 1;if(e[1]!==e.length-2)return 1;if(2!==e[2])return 1;const r=e[3];if(0===r)return 1;if(5+r>=e.length)return 1;if(2!==e[4+r])return 1;const n=e[5+r];if(0===n)return 1;if(6+r+n!==e.length)return 1;if(128&e[4])return 1;if(r>1&&0===e[4]&&!(128&e[5]))return 1;if(128&e[r+6])return 1;if(n>1&&0===e[r+6]&&!(128&e[r+7]))return 1;let a=e.subarray(4,4+r);if(33===a.length&&0===a[0]&&(a=a.subarray(1)),a.length>32)return 1;let s=e.subarray(6+r);if(33===s.length&&0===s[0]&&(s=s.slice(1)),s.length>32)throw new Error("S length is too long");let f=new o(a);f.cmp(i.n)>=0&&(f=new o(0));let u=new o(e.subarray(6+r));return u.cmp(i.n)>=0&&(u=new o(0)),t.set(f.toArrayLike(Uint8Array,"be",32),0),t.set(u.toArrayLike(Uint8Array,"be",32),32),0},ecdsaSign(t,e,r,a,s){if(s){const t=s;s=n=>{const i=t(e,r,null,a,n);if(!(i instanceof Uint8Array&&32===i.length))throw new Error("This is the way");return new o(i)}}const f=new o(r);if(f.cmp(i.n)>=0||f.isZero())return 1;let u;try{u=n.sign(e,r,{canonical:!0,k:s,pers:a})}catch(t){return 1}return t.signature.set(u.r.toArrayLike(Uint8Array,"be",32),0),t.signature.set(u.s.toArrayLike(Uint8Array,"be",32),32),t.recid=u.recoveryParam,0},ecdsaVerify(t,e,r){const s={r:t.subarray(0,32),s:t.subarray(32,64)},f=new o(s.r),u=new o(s.s);if(f.cmp(i.n)>=0||u.cmp(i.n)>=0)return 1;if(1===u.cmp(n.nh)||f.isZero()||u.isZero())return 3;const h=a(r);if(null===h)return 2;const c=h.getPublic();return n.verify(e,s,c)?0:3},ecdsaRecover(t,e,r,a){const f={r:e.slice(0,32),s:e.slice(32,64)},u=new o(f.r),h=new o(f.s);if(u.cmp(i.n)>=0||h.cmp(i.n)>=0)return 1;if(u.isZero()||h.isZero())return 2;let c;try{c=n.recoverPubKey(a,f,r)}catch(t){return 2}return s(t,c),0},ecdh(t,e,r,s,f,u,h){const c=a(e);if(null===c)return 1;const d=new o(r);if(d.cmp(i.n)>=0||d.isZero())return 2;const l=c.getPublic().mul(d);if(void 0===f){const e=l.encode(null,!0),r=n.hash().update(e).digest();for(let e=0;e<32;++e)t[e]=r[e]}else{u||(u=new Uint8Array(32));const e=l.getX().toArray("be",32);for(let t=0;t<32;++t)u[t]=e[t];h||(h=new Uint8Array(32));const r=l.getY().toArray("be",32);for(let t=0;t<32;++t)h[t]=r[t];const n=f(u,h,s);if(!(n instanceof Uint8Array&&n.length===t.length))return 2;t.set(n)}return 0}}},{elliptic:13}],127:[function(t,e,r){const n="Impossible case. Please create issue.",i="The tweak was out of range or the resulted private key is invalid",o="The tweak was out of range or equal to zero",a="Unknow error on context randomization",s="Private Key is invalid",f="Public Key could not be parsed",u="Public Key serialization error",h="The sum of the public keys is not valid",c="Signature could not be parsed",d="The nonce generation function failed, or the private key was invalid",l="Public key could not be recover",p="Scalar was invalid (zero or overflow)";function b(t,e){if(!t)throw new Error(e)}function m(t,e,r){if(b(e instanceof Uint8Array,`Expected ${t} to be an Uint8Array`),void 0!==r)if(Array.isArray(r)){const n=`Expected ${t} to be an Uint8Array with length [${r.join(", ")}]`;b(r.includes(e.length),n)}else{const n=`Expected ${t} to be an Uint8Array with length ${r}`;b(e.length===r,n)}}function y(t){b("Boolean"===v(t),"Expected compressed to be a Boolean")}function g(t=(t=>new Uint8Array(t)),e){return"function"==typeof t&&(t=t(e)),m("output",t,e),t}function v(t){return Object.prototype.toString.call(t).slice(8,-1)}e.exports=t=>({contextRandomize(e){switch(b(null===e||e instanceof Uint8Array,"Expected seed to be an Uint8Array or null"),null!==e&&m("seed",e,32),t.contextRandomize(e)){case 1:throw new Error(a)}},privateKeyVerify:e=>(m("private key",e,32),0===t.privateKeyVerify(e)),privateKeyNegate(e){switch(m("private key",e,32),t.privateKeyNegate(e)){case 0:return e;case 1:throw new Error(n)}},privateKeyTweakAdd(e,r){switch(m("private key",e,32),m("tweak",r,32),t.privateKeyTweakAdd(e,r)){case 0:return e;case 1:throw new Error(i)}},privateKeyTweakMul(e,r){switch(m("private key",e,32),m("tweak",r,32),t.privateKeyTweakMul(e,r)){case 0:return e;case 1:throw new Error(o)}},publicKeyVerify:e=>(m("public key",e,[33,65]),0===t.publicKeyVerify(e)),publicKeyCreate(e,r=!0,n){switch(m("private key",e,32),y(r),n=g(n,r?33:65),t.publicKeyCreate(n,e)){case 0:return n;case 1:throw new Error(s);case 2:throw new Error(u)}},publicKeyConvert(e,r=!0,n){switch(m("public key",e,[33,65]),y(r),n=g(n,r?33:65),t.publicKeyConvert(n,e)){case 0:return n;case 1:throw new Error(f);case 2:throw new Error(u)}},publicKeyNegate(e,r=!0,i){switch(m("public key",e,[33,65]),y(r),i=g(i,r?33:65),t.publicKeyNegate(i,e)){case 0:return i;case 1:throw new Error(f);case 2:throw new Error(n);case 3:throw new Error(u)}},publicKeyCombine(e,r=!0,n){b(Array.isArray(e),"Expected public keys to be an Array"),b(e.length>0,"Expected public keys array will have more than zero items");for(const t of e)m("public key",t,[33,65]);switch(y(r),n=g(n,r?33:65),t.publicKeyCombine(n,e)){case 0:return n;case 1:throw new Error(f);case 2:throw new Error(h);case 3:throw new Error(u)}},publicKeyTweakAdd(e,r,n=!0,o){switch(m("public key",e,[33,65]),m("tweak",r,32),y(n),o=g(o,n?33:65),t.publicKeyTweakAdd(o,e,r)){case 0:return o;case 1:throw new Error(f);case 2:throw new Error(i)}},publicKeyTweakMul(e,r,n=!0,i){switch(m("public key",e,[33,65]),m("tweak",r,32),y(n),i=g(i,n?33:65),t.publicKeyTweakMul(i,e,r)){case 0:return i;case 1:throw new Error(f);case 2:throw new Error(o)}},signatureNormalize(e){switch(m("signature",e,64),t.signatureNormalize(e)){case 0:return e;case 1:throw new Error(c)}},signatureExport(e,r){m("signature",e,64);const i={output:r=g(r,72),outputlen:72};switch(t.signatureExport(i,e)){case 0:return r.slice(0,i.outputlen);case 1:throw new Error(c);case 2:throw new Error(n)}},signatureImport(e,r){switch(m("signature",e),r=g(r,64),t.signatureImport(r,e)){case 0:return r;case 1:throw new Error(c);case 2:throw new Error(n)}},ecdsaSign(e,r,i={},o){m("message",e,32),m("private key",r,32),b("Object"===v(i),"Expected options to be an Object"),void 0!==i.data&&m("options.data",i.data),void 0!==i.noncefn&&b("Function"===v(i.noncefn),"Expected options.noncefn to be a Function");const a={signature:o=g(o,64),recid:null};switch(t.ecdsaSign(a,e,r,i.data,i.noncefn)){case 0:return a;case 1:throw new Error(d);case 2:throw new Error(n)}},ecdsaVerify(e,r,n){switch(m("signature",e,64),m("message",r,32),m("public key",n,[33,65]),t.ecdsaVerify(e,r,n)){case 0:return!0;case 3:return!1;case 1:throw new Error(c);case 2:throw new Error(f)}},ecdsaRecover(e,r,i,o=!0,a){switch(m("signature",e,64),b("Number"===v(r)&&r>=0&&r<=3,"Expected recovery id to be a Number within interval [0, 3]"),m("message",i,32),y(o),a=g(a,o?33:65),t.ecdsaRecover(a,e,r,i)){case 0:return a;case 1:throw new Error(c);case 2:throw new Error(l);case 3:throw new Error(n)}},ecdh(e,r,n={},i){switch(m("public key",e,[33,65]),m("private key",r,32),b("Object"===v(n),"Expected options to be an Object"),void 0!==n.data&&m("options.data",n.data),void 0!==n.hashfn?(b("Function"===v(n.hashfn),"Expected options.hashfn to be a Function"),void 0!==n.xbuf&&m("options.xbuf",n.xbuf,32),void 0!==n.ybuf&&m("options.ybuf",n.ybuf,32),m("output",i)):i=g(i,32),t.ecdh(i,e,r,n.data,n.hashfn,n.xbuf,n.ybuf)){case 0:return i;case 1:throw new Error(f);case 2:throw new Error(p)}}})},{}],128:[function(t,e,r){var n=t("safe-buffer").Buffer;function i(t,e){this._block=n.alloc(t),this._finalSize=e,this._blockSize=t,this._len=0}i.prototype.update=function(t,e){"string"==typeof t&&(e=e||"utf8",t=n.from(t,e));for(var r=this._block,i=this._blockSize,o=t.length,a=this._len,s=0;s=this._finalSize&&(this._update(this._block),this._block.fill(0));var r=8*this._len;if(r<=4294967295)this._block.writeUInt32BE(r,this._blockSize-4);else{var n=(4294967295&r)>>>0,i=(r-n)/4294967296;this._block.writeUInt32BE(i,this._blockSize-8),this._block.writeUInt32BE(n,this._blockSize-4)}this._update(this._block);var o=this._hash();return t?o.toString(t):o},i.prototype._update=function(){throw new Error("_update must be implemented by subclass")},e.exports=i},{"safe-buffer":124}],129:[function(t,e,r){(r=e.exports=function(t){t=t.toLowerCase();var e=r[t];if(!e)throw new Error(t+" is not supported (we accept pull requests)");return new e}).sha=t("./sha"),r.sha1=t("./sha1"),r.sha224=t("./sha224"),r.sha256=t("./sha256"),r.sha384=t("./sha384"),r.sha512=t("./sha512")},{"./sha":130,"./sha1":131,"./sha224":132,"./sha256":133,"./sha384":134,"./sha512":135}],130:[function(t,e,r){var n=t("inherits"),i=t("./hash"),o=t("safe-buffer").Buffer,a=[1518500249,1859775393,-1894007588,-899497514],s=new Array(80);function f(){this.init(),this._w=s,i.call(this,64,56)}function u(t){return t<<30|t>>>2}function h(t,e,r,n){return 0===t?e&r|~e&n:2===t?e&r|e&n|r&n:e^r^n}n(f,i),f.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},f.prototype._update=function(t){for(var e,r=this._w,n=0|this._a,i=0|this._b,o=0|this._c,s=0|this._d,f=0|this._e,c=0;c<16;++c)r[c]=t.readInt32BE(4*c);for(;c<80;++c)r[c]=r[c-3]^r[c-8]^r[c-14]^r[c-16];for(var d=0;d<80;++d){var l=~~(d/20),p=0|((e=n)<<5|e>>>27)+h(l,i,o,s)+f+r[d]+a[l];f=s,s=o,o=u(i),i=n,n=p}this._a=n+this._a|0,this._b=i+this._b|0,this._c=o+this._c|0,this._d=s+this._d|0,this._e=f+this._e|0},f.prototype._hash=function(){var t=o.allocUnsafe(20);return t.writeInt32BE(0|this._a,0),t.writeInt32BE(0|this._b,4),t.writeInt32BE(0|this._c,8),t.writeInt32BE(0|this._d,12),t.writeInt32BE(0|this._e,16),t},e.exports=f},{"./hash":128,inherits:75,"safe-buffer":124}],131:[function(t,e,r){var n=t("inherits"),i=t("./hash"),o=t("safe-buffer").Buffer,a=[1518500249,1859775393,-1894007588,-899497514],s=new Array(80);function f(){this.init(),this._w=s,i.call(this,64,56)}function u(t){return t<<5|t>>>27}function h(t){return t<<30|t>>>2}function c(t,e,r,n){return 0===t?e&r|~e&n:2===t?e&r|e&n|r&n:e^r^n}n(f,i),f.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},f.prototype._update=function(t){for(var e,r=this._w,n=0|this._a,i=0|this._b,o=0|this._c,s=0|this._d,f=0|this._e,d=0;d<16;++d)r[d]=t.readInt32BE(4*d);for(;d<80;++d)r[d]=(e=r[d-3]^r[d-8]^r[d-14]^r[d-16])<<1|e>>>31;for(var l=0;l<80;++l){var p=~~(l/20),b=u(n)+c(p,i,o,s)+f+r[l]+a[p]|0;f=s,s=o,o=h(i),i=n,n=b}this._a=n+this._a|0,this._b=i+this._b|0,this._c=o+this._c|0,this._d=s+this._d|0,this._e=f+this._e|0},f.prototype._hash=function(){var t=o.allocUnsafe(20);return t.writeInt32BE(0|this._a,0),t.writeInt32BE(0|this._b,4),t.writeInt32BE(0|this._c,8),t.writeInt32BE(0|this._d,12),t.writeInt32BE(0|this._e,16),t},e.exports=f},{"./hash":128,inherits:75,"safe-buffer":124}],132:[function(t,e,r){var n=t("inherits"),i=t("./sha256"),o=t("./hash"),a=t("safe-buffer").Buffer,s=new Array(64);function f(){this.init(),this._w=s,o.call(this,64,56)}n(f,i),f.prototype.init=function(){return this._a=3238371032,this._b=914150663,this._c=812702999,this._d=4144912697,this._e=4290775857,this._f=1750603025,this._g=1694076839,this._h=3204075428,this},f.prototype._hash=function(){var t=a.allocUnsafe(28);return t.writeInt32BE(this._a,0),t.writeInt32BE(this._b,4),t.writeInt32BE(this._c,8),t.writeInt32BE(this._d,12),t.writeInt32BE(this._e,16),t.writeInt32BE(this._f,20),t.writeInt32BE(this._g,24),t},e.exports=f},{"./hash":128,"./sha256":133,inherits:75,"safe-buffer":124}],133:[function(t,e,r){var n=t("inherits"),i=t("./hash"),o=t("safe-buffer").Buffer,a=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],s=new Array(64);function f(){this.init(),this._w=s,i.call(this,64,56)}function u(t,e,r){return r^t&(e^r)}function h(t,e,r){return t&e|r&(t|e)}function c(t){return(t>>>2|t<<30)^(t>>>13|t<<19)^(t>>>22|t<<10)}function d(t){return(t>>>6|t<<26)^(t>>>11|t<<21)^(t>>>25|t<<7)}function l(t){return(t>>>7|t<<25)^(t>>>18|t<<14)^t>>>3}n(f,i),f.prototype.init=function(){return this._a=1779033703,this._b=3144134277,this._c=1013904242,this._d=2773480762,this._e=1359893119,this._f=2600822924,this._g=528734635,this._h=1541459225,this},f.prototype._update=function(t){for(var e,r=this._w,n=0|this._a,i=0|this._b,o=0|this._c,s=0|this._d,f=0|this._e,p=0|this._f,b=0|this._g,m=0|this._h,y=0;y<16;++y)r[y]=t.readInt32BE(4*y);for(;y<64;++y)r[y]=0|(((e=r[y-2])>>>17|e<<15)^(e>>>19|e<<13)^e>>>10)+r[y-7]+l(r[y-15])+r[y-16];for(var g=0;g<64;++g){var v=m+d(f)+u(f,p,b)+a[g]+r[g]|0,w=c(n)+h(n,i,o)|0;m=b,b=p,p=f,f=s+v|0,s=o,o=i,i=n,n=v+w|0}this._a=n+this._a|0,this._b=i+this._b|0,this._c=o+this._c|0,this._d=s+this._d|0,this._e=f+this._e|0,this._f=p+this._f|0,this._g=b+this._g|0,this._h=m+this._h|0},f.prototype._hash=function(){var t=o.allocUnsafe(32);return t.writeInt32BE(this._a,0),t.writeInt32BE(this._b,4),t.writeInt32BE(this._c,8),t.writeInt32BE(this._d,12),t.writeInt32BE(this._e,16),t.writeInt32BE(this._f,20),t.writeInt32BE(this._g,24),t.writeInt32BE(this._h,28),t},e.exports=f},{"./hash":128,inherits:75,"safe-buffer":124}],134:[function(t,e,r){var n=t("inherits"),i=t("./sha512"),o=t("./hash"),a=t("safe-buffer").Buffer,s=new Array(160);function f(){this.init(),this._w=s,o.call(this,128,112)}n(f,i),f.prototype.init=function(){return this._ah=3418070365,this._bh=1654270250,this._ch=2438529370,this._dh=355462360,this._eh=1731405415,this._fh=2394180231,this._gh=3675008525,this._hh=1203062813,this._al=3238371032,this._bl=914150663,this._cl=812702999,this._dl=4144912697,this._el=4290775857,this._fl=1750603025,this._gl=1694076839,this._hl=3204075428,this},f.prototype._hash=function(){var t=a.allocUnsafe(48);function e(e,r,n){t.writeInt32BE(e,n),t.writeInt32BE(r,n+4)}return e(this._ah,this._al,0),e(this._bh,this._bl,8),e(this._ch,this._cl,16),e(this._dh,this._dl,24),e(this._eh,this._el,32),e(this._fh,this._fl,40),t},e.exports=f},{"./hash":128,"./sha512":135,inherits:75,"safe-buffer":124}],135:[function(t,e,r){var n=t("inherits"),i=t("./hash"),o=t("safe-buffer").Buffer,a=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591],s=new Array(160);function f(){this.init(),this._w=s,i.call(this,128,112)}function u(t,e,r){return r^t&(e^r)}function h(t,e,r){return t&e|r&(t|e)}function c(t,e){return(t>>>28|e<<4)^(e>>>2|t<<30)^(e>>>7|t<<25)}function d(t,e){return(t>>>14|e<<18)^(t>>>18|e<<14)^(e>>>9|t<<23)}function l(t,e){return(t>>>1|e<<31)^(t>>>8|e<<24)^t>>>7}function p(t,e){return(t>>>1|e<<31)^(t>>>8|e<<24)^(t>>>7|e<<25)}function b(t,e){return(t>>>19|e<<13)^(e>>>29|t<<3)^t>>>6}function m(t,e){return(t>>>19|e<<13)^(e>>>29|t<<3)^(t>>>6|e<<26)}function y(t,e){return t>>>0>>0?1:0}n(f,i),f.prototype.init=function(){return this._ah=1779033703,this._bh=3144134277,this._ch=1013904242,this._dh=2773480762,this._eh=1359893119,this._fh=2600822924,this._gh=528734635,this._hh=1541459225,this._al=4089235720,this._bl=2227873595,this._cl=4271175723,this._dl=1595750129,this._el=2917565137,this._fl=725511199,this._gl=4215389547,this._hl=327033209,this},f.prototype._update=function(t){for(var e=this._w,r=0|this._ah,n=0|this._bh,i=0|this._ch,o=0|this._dh,s=0|this._eh,f=0|this._fh,g=0|this._gh,v=0|this._hh,w=0|this._al,_=0|this._bl,M=0|this._cl,S=0|this._dl,x=0|this._el,A=0|this._fl,E=0|this._gl,k=0|this._hl,R=0;R<32;R+=2)e[R]=t.readInt32BE(4*R),e[R+1]=t.readInt32BE(4*R+4);for(;R<160;R+=2){var T=e[R-30],B=e[R-30+1],I=l(T,B),L=p(B,T),P=b(T=e[R-4],B=e[R-4+1]),j=m(B,T),O=e[R-14],C=e[R-14+1],N=e[R-32],z=e[R-32+1],U=L+C|0,q=I+O+y(U,L)|0;q=(q=q+P+y(U=U+j|0,j)|0)+N+y(U=U+z|0,z)|0,e[R]=q,e[R+1]=U}for(var K=0;K<160;K+=2){q=e[K],U=e[K+1];var D=h(r,n,i),H=h(w,_,M),F=c(r,w),W=c(w,r),Z=d(s,x),V=d(x,s),Y=a[K],J=a[K+1],X=u(s,f,g),G=u(x,A,E),$=k+V|0,Q=v+Z+y($,k)|0;Q=(Q=(Q=Q+X+y($=$+G|0,G)|0)+Y+y($=$+J|0,J)|0)+q+y($=$+U|0,U)|0;var tt=W+H|0,et=F+D+y(tt,W)|0;v=g,k=E,g=f,E=A,f=s,A=x,s=o+Q+y(x=S+$|0,S)|0,o=i,S=M,i=n,M=_,n=r,_=w,r=Q+et+y(w=$+tt|0,$)|0}this._al=this._al+w|0,this._bl=this._bl+_|0,this._cl=this._cl+M|0,this._dl=this._dl+S|0,this._el=this._el+x|0,this._fl=this._fl+A|0,this._gl=this._gl+E|0,this._hl=this._hl+k|0,this._ah=this._ah+r+y(this._al,w)|0,this._bh=this._bh+n+y(this._bl,_)|0,this._ch=this._ch+i+y(this._cl,M)|0,this._dh=this._dh+o+y(this._dl,S)|0,this._eh=this._eh+s+y(this._el,x)|0,this._fh=this._fh+f+y(this._fl,A)|0,this._gh=this._gh+g+y(this._gl,E)|0,this._hh=this._hh+v+y(this._hl,k)|0},f.prototype._hash=function(){var t=o.allocUnsafe(64);function e(e,r,n){t.writeInt32BE(e,n),t.writeInt32BE(r,n+4)}return e(this._ah,this._al,0),e(this._bh,this._bl,8),e(this._ch,this._cl,16),e(this._dh,this._dl,24),e(this._eh,this._el,32),e(this._fh,this._fl,40),e(this._gh,this._gl,48),e(this._hh,this._hl,56),t},e.exports=f},{"./hash":128,inherits:75,"safe-buffer":124}],136:[function(t,e,r){e.exports=i;var n=t("events").EventEmitter;function i(){n.call(this)}t("inherits")(i,n),i.Readable=t("readable-stream/readable.js"),i.Writable=t("readable-stream/writable.js"),i.Duplex=t("readable-stream/duplex.js"),i.Transform=t("readable-stream/transform.js"),i.PassThrough=t("readable-stream/passthrough.js"),i.Stream=i,i.prototype.pipe=function(t,e){var r=this;function i(e){t.writable&&!1===t.write(e)&&r.pause&&r.pause()}function o(){r.readable&&r.resume&&r.resume()}r.on("data",i),t.on("drain",o),t._isStdio||e&&!1===e.end||(r.on("end",s),r.on("close",f));var a=!1;function s(){a||(a=!0,t.end())}function f(){a||(a=!0,"function"==typeof t.destroy&&t.destroy())}function u(t){if(h(),0===n.listenerCount(this,"error"))throw t}function h(){r.removeListener("data",i),t.removeListener("drain",o),r.removeListener("end",s),r.removeListener("close",f),r.removeListener("error",u),t.removeListener("error",u),r.removeListener("end",h),r.removeListener("close",h),t.removeListener("close",h)}return r.on("error",u),t.on("error",u),r.on("end",h),r.on("close",h),t.on("close",h),t.emit("pipe",r),t}},{events:59,inherits:75,"readable-stream/duplex.js":106,"readable-stream/passthrough.js":117,"readable-stream/readable.js":118,"readable-stream/transform.js":119,"readable-stream/writable.js":120}],137:[function(t,e,r){arguments[4][116][0].apply(r,arguments)},{dup:116,"safe-buffer":124}],138:[function(t,e,r){var n=t("is-hex-prefixed");e.exports=function(t){return"string"!=typeof t?t:n(t)?t.slice(2):t}},{"is-hex-prefixed":77}],139:[function(t,e,r){(function(e,n){var i=t("process/browser.js").nextTick,o=Function.prototype.apply,a=Array.prototype.slice,s={},f=0;function u(t,e){this._id=t,this._clearFn=e}r.setTimeout=function(){return new u(o.call(setTimeout,window,arguments),clearTimeout)},r.setInterval=function(){return new u(o.call(setInterval,window,arguments),clearInterval)},r.clearTimeout=r.clearInterval=function(t){t.close()},u.prototype.unref=u.prototype.ref=function(){},u.prototype.close=function(){this._clearFn.call(window,this._id)},r.enroll=function(t,e){clearTimeout(t._idleTimeoutId),t._idleTimeout=e},r.unenroll=function(t){clearTimeout(t._idleTimeoutId),t._idleTimeout=-1},r._unrefActive=r.active=function(t){clearTimeout(t._idleTimeoutId);var e=t._idleTimeout;e>=0&&(t._idleTimeoutId=setTimeout((function(){t._onTimeout&&t._onTimeout()}),e))},r.setImmediate="function"==typeof e?e:function(t){var e=f++,n=!(arguments.length<2)&&a.call(arguments,1);return s[e]=!0,i((function(){s[e]&&(n?t.apply(null,n):t.call(null),r.clearImmediate(e))})),e},r.clearImmediate="function"==typeof n?n:function(t){delete s[t]}}).call(this,t("timers").setImmediate,t("timers").clearImmediate)},{"process/browser.js":104,timers:139}],140:[function(t,e,r){(function(t){!function(t,r){"use strict";void 0!==e&&e.exports?e.exports=r():(t.nacl||(t.nacl={}),t.nacl.util=r())}(this,(function(){"use strict";var e={};function r(t){if(!/^(?:[A-Za-z0-9+\/]{2}[A-Za-z0-9+\/]{2})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/.test(t))throw new TypeError("invalid encoding")}return e.decodeUTF8=function(t){if("string"!=typeof t)throw new TypeError("expected string");var e,r=unescape(encodeURIComponent(t)),n=new Uint8Array(r.length);for(e=0;e} request * @param {Export.resolve} resolve * @param {reject} reject diff --git a/src/request/export/ExportFile.js b/src/request/export/ExportFile.js index 45dcaac40..8b66e83d0 100644 --- a/src/request/export/ExportFile.js +++ b/src/request/export/ExportFile.js @@ -19,9 +19,6 @@ class ExportFile extends Nimiq.Observable { /** - * if a complete page is missing it will be created. - * However these pages will be the default pages which usually don't match the applications requirements. - * Refer to the corresponding _build(Privacy | RecoveryWords | ValidateWords) to see the general Structure. * @param {Parsed} request * @param {ExportFile.resolve} resolve * @param {reject} reject diff --git a/src/request/export/ExportWords.js b/src/request/export/ExportWords.js index b8d2386f8..d8900d1c5 100644 --- a/src/request/export/ExportWords.js +++ b/src/request/export/ExportWords.js @@ -18,9 +18,6 @@ class ExportWords extends Nimiq.Observable { /** - * if a complete page is missing it will be created. - * However these pages will be the default pages which usually don't match the applications requirements. - * Refer to the corresponding _build(Privacy | RecoveryWords | ValidateWords) to see the general Structure. * @param {Parsed} request * @param {ExportWords.resolve} resolve * @param {reject} reject diff --git a/src/translations/en.json b/src/translations/en.json index 0470587d2..359031a46 100644 --- a/src/translations/en.json +++ b/src/translations/en.json @@ -183,7 +183,7 @@ "remove-key-heading": "Don't lose Access", "remove-key-intro-text": "If you log out without saving your account, you will irreversibly lose access to it!", - "remove-key-login-file-question": "Is your Login File savely stored and accessible?", + "remove-key-login-file-question": "Is your Login File safely stored and accessible?", "remove-key-download-login-file": "Download Login File", "remove-key-recovery-words-question": "Do you know where your Recovery Words are?", "remove-key-show-recovery-words": "Create a backup",